troxy-cli 1.8.5 → 1.8.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/package.json +1 -1
- package/src/api.js +1 -0
- package/src/mcp-server.js +10 -3
- package/src/uninstall.js +13 -3
package/package.json
CHANGED
package/src/api.js
CHANGED
|
@@ -72,6 +72,7 @@ export const api = {
|
|
|
72
72
|
// Evaluate + confirm (agent API key)
|
|
73
73
|
evaluate: (body, apiKey) => request('POST', '/evaluate', { apiKey, body }),
|
|
74
74
|
evaluateEmail: (body, apiKey) => request('POST', '/evaluate/email', { apiKey, body }),
|
|
75
|
+
selfRevoke: (apiKey) => request('POST', '/mcp/self-revoke', { apiKey }),
|
|
75
76
|
confirmPayment: (auditId, body, apiKey) => request('POST', `/payments/${auditId}/confirm`, { apiKey, body }),
|
|
76
77
|
waitApprovalStatus: (token) => request('GET', `/approvals/${encodeURIComponent(token)}/wait`),
|
|
77
78
|
|
package/src/mcp-server.js
CHANGED
|
@@ -40,7 +40,7 @@ export async function runMcp() {
|
|
|
40
40
|
'If the decision is NOTIFY, proceed but the user will be notified. ' +
|
|
41
41
|
'When calling evaluate_payment, use the merchant\'s domain name as merchant_name when available (e.g. "amazon.com", "indigobloom.co.il"); this ensures consistent matching against policies. ' +
|
|
42
42
|
'After every ALLOW or NOTIFY decision, attempt the payment, then call confirm_payment with the audit_id and the outcome (success/failed/cancelled). Always include a reason when the charge fails. ' +
|
|
43
|
-
'You MUST also call the evaluate_email tool before sending any email on the user\'s behalf. Never send an email without first receiving an ALLOW or NOTIFY decision. If BLOCK, do not send it. If ESCALATE, call wait_for_payment_approval with the returned approval_token (same wait mechanism payments use), then call evaluate_email again with the approval_token once approved.',
|
|
43
|
+
'You MUST also call the evaluate_email tool before sending any email on the user\'s behalf. Always include the full plaintext "body" argument, exactly as you intend to send it — Troxy policies inspect the body for secrets and confidential content, and cannot do so if it is omitted, summarized, or truncated. Never send an email without first receiving an ALLOW or NOTIFY decision. If BLOCK, do not send it. If ESCALATE, call wait_for_payment_approval with the returned approval_token (same wait mechanism payments use), then call evaluate_email again with the approval_token once approved.',
|
|
44
44
|
},
|
|
45
45
|
{ capabilities: { tools: {} } },
|
|
46
46
|
);
|
|
@@ -142,7 +142,7 @@ export async function runMcp() {
|
|
|
142
142
|
'based on your Troxy policies. Call this before sending any email on the user\'s behalf.',
|
|
143
143
|
inputSchema: {
|
|
144
144
|
type: 'object',
|
|
145
|
-
required: ['recipient'],
|
|
145
|
+
required: ['recipient', 'body'],
|
|
146
146
|
properties: {
|
|
147
147
|
recipient: {
|
|
148
148
|
type: 'string',
|
|
@@ -152,6 +152,13 @@ export async function runMcp() {
|
|
|
152
152
|
type: 'string',
|
|
153
153
|
description: 'Subject line of the email (optional)',
|
|
154
154
|
},
|
|
155
|
+
body: {
|
|
156
|
+
type: 'string',
|
|
157
|
+
description:
|
|
158
|
+
'The full plaintext body of the email, exactly as it will be sent. REQUIRED — ' +
|
|
159
|
+
'Troxy policies scan this to catch secrets, credentials, or confidential content ' +
|
|
160
|
+
'before the email goes out. Never omit, summarize, or truncate it.',
|
|
161
|
+
},
|
|
155
162
|
agent: {
|
|
156
163
|
type: 'string',
|
|
157
164
|
description: 'Name of the agent sending the email (optional)',
|
|
@@ -261,7 +268,7 @@ export async function runMcp() {
|
|
|
261
268
|
emailText = `✗ Email blocked.${reason ? ` ${reason}` : ''} Do not send it. (audit: ${audit_id})`;
|
|
262
269
|
break;
|
|
263
270
|
case 'ESCALATE':
|
|
264
|
-
emailText = `⏳ Email requires human approval; a request has been sent to the account owner.\n\nApproval token: ${approval_token}\n\nNow call wait_for_payment_approval(approval_token="${approval_token}") to automatically detect approval, then call evaluate_email again with the same recipient/subject PLUS this approval_token. Do not send until it returns approved.`;
|
|
271
|
+
emailText = `⏳ Email requires human approval; a request has been sent to the account owner.\n\nApproval token: ${approval_token}\n\nNow call wait_for_payment_approval(approval_token="${approval_token}") to automatically detect approval, then call evaluate_email again with the same recipient/subject/body PLUS this approval_token. Do not send until it returns approved.`;
|
|
265
272
|
break;
|
|
266
273
|
default:
|
|
267
274
|
emailText = JSON.stringify(result);
|
package/src/uninstall.js
CHANGED
|
@@ -4,6 +4,7 @@ import path from 'path';
|
|
|
4
4
|
import { execSync } from 'child_process';
|
|
5
5
|
import readline from 'readline';
|
|
6
6
|
import { loadConfig } from './config.js';
|
|
7
|
+
import { api } from './api.js';
|
|
7
8
|
|
|
8
9
|
const MCP_CLIENTS = [
|
|
9
10
|
{
|
|
@@ -107,12 +108,21 @@ export async function runUninstall() {
|
|
|
107
108
|
console.log('none found');
|
|
108
109
|
}
|
|
109
110
|
|
|
110
|
-
// 3.
|
|
111
|
+
// 3. Revoke the API key. /mcp/self-revoke only lets a key revoke the exact
|
|
112
|
+
// token it authenticates as — it can't touch or list any other token — so
|
|
113
|
+
// this doesn't need a login/JWT, the key on disk is enough.
|
|
111
114
|
const cfg = loadConfig();
|
|
112
115
|
if (cfg?.apiKey) {
|
|
113
116
|
const prefix = cfg.apiKey.slice(0, 12) + '...';
|
|
114
|
-
|
|
115
|
-
|
|
117
|
+
process.stdout.write(` Revoking API key ${prefix}... `);
|
|
118
|
+
try {
|
|
119
|
+
await api.selfRevoke(cfg.apiKey);
|
|
120
|
+
console.log('✓');
|
|
121
|
+
} catch (err) {
|
|
122
|
+
console.log('✗');
|
|
123
|
+
console.log(` Couldn't revoke automatically (${err.message}).`);
|
|
124
|
+
console.log(' Go to dash.troxy.io → Settings → API Keys to revoke it.\n');
|
|
125
|
+
}
|
|
116
126
|
}
|
|
117
127
|
|
|
118
128
|
// 4. Delete ~/.troxy config
|