troxy-cli 1.4.6 → 1.4.7
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 +0 -16
- package/package.json +1 -1
- package/src/activity.js +6 -4
- package/src/api.js +1 -6
package/bin/troxy.js
CHANGED
|
@@ -61,22 +61,6 @@ switch (command) {
|
|
|
61
61
|
break;
|
|
62
62
|
|
|
63
63
|
// ── Auth ──────────────────────────────────────────────────────
|
|
64
|
-
case 'connect': {
|
|
65
|
-
const k = flags.key;
|
|
66
|
-
if (!k || !k.startsWith('txy-')) {
|
|
67
|
-
console.error('\n Usage: troxy connect --key txy-...\n');
|
|
68
|
-
process.exit(1);
|
|
69
|
-
}
|
|
70
|
-
// Validate key before saving
|
|
71
|
-
process.stdout.write('\n Validating key... ');
|
|
72
|
-
await api.agentStatus(k);
|
|
73
|
-
console.log('✓');
|
|
74
|
-
const { saveConfig } = await import('../src/config.js');
|
|
75
|
-
saveConfig({ apiKey: k });
|
|
76
|
-
console.log(' Key saved to ~/.troxy/config.json\n');
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
64
|
case 'login':
|
|
81
65
|
await runLogin(flags);
|
|
82
66
|
break;
|
package/package.json
CHANGED
package/src/activity.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { api } from './api.js';
|
|
2
2
|
import { requireJwt } from './auth.js';
|
|
3
|
+
import { loadConfig } from './config.js';
|
|
3
4
|
import { table } from './print.js';
|
|
4
5
|
|
|
5
6
|
const ICON = { ALLOW: '✓', BLOCK: '✗', ESCALATE: '⏳', NOTIFY: '~' };
|
|
@@ -23,11 +24,12 @@ export async function runActivity(flags) {
|
|
|
23
24
|
process.exit(0);
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
const jwt
|
|
27
|
-
const limit
|
|
28
|
-
const mine
|
|
27
|
+
const jwt = requireJwt();
|
|
28
|
+
const limit = Number(flags.limit || 20);
|
|
29
|
+
const mine = !!flags.mine;
|
|
30
|
+
const tokenPrefix = mine ? (loadConfig()?.apiKey || '').substring(0, 11) : undefined;
|
|
29
31
|
|
|
30
|
-
const data = await api.agentActivity(jwt, limit, mine);
|
|
32
|
+
const data = await api.agentActivity(jwt, limit, mine, tokenPrefix);
|
|
31
33
|
const rows = data?.activity || [];
|
|
32
34
|
|
|
33
35
|
if (!rows.length) { console.log('\n No activity yet.\n'); return; }
|
package/src/api.js
CHANGED
|
@@ -66,17 +66,12 @@ export const api = {
|
|
|
66
66
|
resumeToken: (jwt, id) => request('POST', `/tokens/${id}/resume`, { jwt }),
|
|
67
67
|
renameToken: (jwt, id, name) => request('PATCH', `/tokens/${id}/name`, { jwt, body: { name } }),
|
|
68
68
|
|
|
69
|
-
// MCP daemon endpoints (agent API key — used by MCP server only)
|
|
70
|
-
mcpPause: (apiKey) => request('POST', '/mcp/pause', { apiKey }),
|
|
71
|
-
mcpResume: (apiKey) => request('POST', '/mcp/resume', { apiKey }),
|
|
72
|
-
mcpRename: (apiKey, name) => request('PATCH', '/mcp/name', { apiKey, body: { name } }),
|
|
73
|
-
|
|
74
69
|
// Agent read-only API (JWT session auth — run: troxy login)
|
|
75
70
|
agentStatus: (jwt) => request('GET', '/agent/status', { jwt }),
|
|
76
71
|
agentPolicies: (jwt) => request('GET', '/agent/policies', { jwt }),
|
|
77
72
|
agentMcps: (jwt) => request('GET', '/agent/mcps', { jwt }),
|
|
78
73
|
agentCards: (jwt) => request('GET', '/agent/cards', { jwt }),
|
|
79
|
-
agentActivity: (jwt, limit, mine) => request('GET', `/agent/activity?limit=${limit || 20}${mine ?
|
|
74
|
+
agentActivity: (jwt, limit, mine, tokenPrefix) => request('GET', `/agent/activity?limit=${limit || 20}${mine ? `&mine=true&token_prefix=${encodeURIComponent(tokenPrefix || '')}` : ''}`, { jwt }),
|
|
80
75
|
agentInsights: (jwt, period) => request('GET', `/agent/insights?period=${period || 30}`, { jwt }),
|
|
81
76
|
};
|
|
82
77
|
|