troxy-cli 1.3.9 → 1.4.0
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 +12 -0
- package/package.json +1 -1
- package/src/api.js +4 -0
- package/src/pause.js +25 -0
package/bin/troxy.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { runInit } from '../src/init.js';
|
|
3
3
|
import { runUninstall } from '../src/uninstall.js';
|
|
4
4
|
import { runMcp } from '../src/mcp-server.js';
|
|
5
|
+
import { runPause, runResume } from '../src/pause.js';
|
|
5
6
|
import { runLogin, clearSession, requireKey, requireJwt, loadSession, getKeySource } from '../src/auth.js';
|
|
6
7
|
import { loadConfig } from '../src/config.js';
|
|
7
8
|
import { runPolicies } from '../src/policies.js';
|
|
@@ -131,6 +132,15 @@ switch (command) {
|
|
|
131
132
|
await runMcp();
|
|
132
133
|
break;
|
|
133
134
|
|
|
135
|
+
// ── Pause / resume payment evaluations ───────────────────────
|
|
136
|
+
case 'pause':
|
|
137
|
+
await runPause();
|
|
138
|
+
break;
|
|
139
|
+
|
|
140
|
+
case 'resume':
|
|
141
|
+
await runResume();
|
|
142
|
+
break;
|
|
143
|
+
|
|
134
144
|
// ── Simulate a payment evaluation ────────────────────────────
|
|
135
145
|
case 'pay': {
|
|
136
146
|
const apiKey = requireKey(flags);
|
|
@@ -268,6 +278,8 @@ switch (command) {
|
|
|
268
278
|
troxy rotate-key --revoke-old Same + revoke the old key immediately
|
|
269
279
|
troxy uninstall Remove Troxy from this machine
|
|
270
280
|
troxy status API health + account overview
|
|
281
|
+
troxy pause Pause this MCP (blocks all payments until resumed)
|
|
282
|
+
troxy resume Resume this MCP after a pause
|
|
271
283
|
|
|
272
284
|
Inspect (requires: troxy login)
|
|
273
285
|
troxy policies list
|
package/package.json
CHANGED
package/src/api.js
CHANGED
|
@@ -58,6 +58,10 @@ export const api = {
|
|
|
58
58
|
// MCP heartbeat (agent API key)
|
|
59
59
|
mcpHeartbeat: (apiKey, agentName) => request('POST', '/mcp/heartbeat', { apiKey, body: agentName ? { agent_name: agentName } : undefined }),
|
|
60
60
|
|
|
61
|
+
// MCP pause / resume (agent API key)
|
|
62
|
+
mcpPause: (apiKey) => request('POST', '/mcp/pause', { apiKey }),
|
|
63
|
+
mcpResume: (apiKey) => request('POST', '/mcp/resume', { apiKey }),
|
|
64
|
+
|
|
61
65
|
// Agent read-only API (JWT session auth — run: troxy login)
|
|
62
66
|
agentStatus: (jwt) => request('GET', '/agent/status', { jwt }),
|
|
63
67
|
agentPolicies: (jwt) => request('GET', '/agent/policies', { jwt }),
|
package/src/pause.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { loadConfig } from './config.js';
|
|
2
|
+
import { api } from './api.js';
|
|
3
|
+
|
|
4
|
+
export async function runPause() {
|
|
5
|
+
const config = loadConfig();
|
|
6
|
+
const apiKey = process.env.TROXY_API_KEY || config?.apiKey;
|
|
7
|
+
if (!apiKey) {
|
|
8
|
+
console.error('No API key found. Run: npx troxy init --key txy-...');
|
|
9
|
+
process.exit(1);
|
|
10
|
+
}
|
|
11
|
+
await api.mcpPause(apiKey);
|
|
12
|
+
console.log('⏸ MCP paused. All payment evaluations will be blocked.');
|
|
13
|
+
console.log(' Run "troxy resume" to resume.');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export async function runResume() {
|
|
17
|
+
const config = loadConfig();
|
|
18
|
+
const apiKey = process.env.TROXY_API_KEY || config?.apiKey;
|
|
19
|
+
if (!apiKey) {
|
|
20
|
+
console.error('No API key found. Run: npx troxy init --key txy-...');
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
await api.mcpResume(apiKey);
|
|
24
|
+
console.log('▶ MCP resumed. Payment evaluations are active again.');
|
|
25
|
+
}
|