@dominusnode/ai-tools 1.1.0 → 1.2.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/dist/create-tools.d.ts +90 -18
- package/dist/create-tools.d.ts.map +1 -1
- package/dist/create-tools.js +78 -35
- package/dist/create-tools.js.map +1 -1
- package/dist/tools.d.ts +141 -1
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +813 -0
- package/dist/tools.js.map +1 -1
- package/package.json +2 -2
package/dist/tools.js
CHANGED
|
@@ -922,6 +922,819 @@ export function createUpdateWalletPolicyTool(client, agentSecret) {
|
|
|
922
922
|
},
|
|
923
923
|
});
|
|
924
924
|
}
|
|
925
|
+
// ---------------------------------------------------------------------------
|
|
926
|
+
// Account lifecycle tools
|
|
927
|
+
// ---------------------------------------------------------------------------
|
|
928
|
+
/**
|
|
929
|
+
* Creates a tool to register a new DomiNode account.
|
|
930
|
+
*/
|
|
931
|
+
export function createRegisterTool(agentSecret) {
|
|
932
|
+
return tool({
|
|
933
|
+
description: "Register a new Dominus Node account. Returns user info and JWT tokens. " +
|
|
934
|
+
"After registering, use verifyEmail or rely on MCP agent auto-verification.",
|
|
935
|
+
parameters: z.object({
|
|
936
|
+
email: z.string().email().describe("Email address for the new account"),
|
|
937
|
+
password: z.string().min(8).max(128).describe("Password (min 8 characters)"),
|
|
938
|
+
}),
|
|
939
|
+
execute: async ({ email, password }) => {
|
|
940
|
+
try {
|
|
941
|
+
const baseUrl = process.env.DOMINUSNODE_BASE_URL || "https://api.dominusnode.com";
|
|
942
|
+
const headers = { "Content-Type": "application/json" };
|
|
943
|
+
if (agentSecret) {
|
|
944
|
+
headers["X-DominusNode-Agent"] = "mcp";
|
|
945
|
+
headers["X-DominusNode-Agent-Secret"] = agentSecret;
|
|
946
|
+
}
|
|
947
|
+
const resp = await fetch(`${baseUrl}/api/auth/register`, {
|
|
948
|
+
method: "POST", headers, body: JSON.stringify({ email, password }), redirect: "error",
|
|
949
|
+
});
|
|
950
|
+
if (!resp.ok) {
|
|
951
|
+
const text = await resp.text().catch(() => "");
|
|
952
|
+
throw new Error(`Registration failed (${resp.status}): ${text.slice(0, 200)}`);
|
|
953
|
+
}
|
|
954
|
+
const data = JSON.parse(await resp.text());
|
|
955
|
+
stripDangerousKeys(data);
|
|
956
|
+
return { userId: data.user?.id, email: data.user?.email, message: "Account created. Verify email to unlock financial features." };
|
|
957
|
+
}
|
|
958
|
+
catch (err) {
|
|
959
|
+
return { error: `Failed to register: ${sanitizeError(err instanceof Error ? err.message : "Unknown error")}` };
|
|
960
|
+
}
|
|
961
|
+
},
|
|
962
|
+
});
|
|
963
|
+
}
|
|
964
|
+
/**
|
|
965
|
+
* Creates a tool to log into an existing DomiNode account.
|
|
966
|
+
*/
|
|
967
|
+
export function createLoginTool(agentSecret) {
|
|
968
|
+
return tool({
|
|
969
|
+
description: "Log into an existing Dominus Node account. Returns JWT access and refresh tokens.",
|
|
970
|
+
parameters: z.object({
|
|
971
|
+
email: z.string().email().describe("Account email address"),
|
|
972
|
+
password: z.string().min(1).describe("Account password"),
|
|
973
|
+
}),
|
|
974
|
+
execute: async ({ email, password }) => {
|
|
975
|
+
try {
|
|
976
|
+
const baseUrl = process.env.DOMINUSNODE_BASE_URL || "https://api.dominusnode.com";
|
|
977
|
+
const headers = { "Content-Type": "application/json" };
|
|
978
|
+
if (agentSecret) {
|
|
979
|
+
headers["X-DominusNode-Agent"] = "mcp";
|
|
980
|
+
headers["X-DominusNode-Agent-Secret"] = agentSecret;
|
|
981
|
+
}
|
|
982
|
+
const resp = await fetch(`${baseUrl}/api/auth/login`, {
|
|
983
|
+
method: "POST", headers, body: JSON.stringify({ email, password }), redirect: "error",
|
|
984
|
+
});
|
|
985
|
+
if (!resp.ok) {
|
|
986
|
+
const text = await resp.text().catch(() => "");
|
|
987
|
+
throw new Error(`Login failed (${resp.status}): ${sanitizeError(text.slice(0, 200))}`);
|
|
988
|
+
}
|
|
989
|
+
const data = JSON.parse(await resp.text());
|
|
990
|
+
stripDangerousKeys(data);
|
|
991
|
+
if (data.mfaRequired) {
|
|
992
|
+
return { mfaRequired: true, challengeToken: data.challengeToken, message: "MFA verification required" };
|
|
993
|
+
}
|
|
994
|
+
return { accessToken: data.accessToken ? "[REDACTED]" : undefined, message: "Login successful" };
|
|
995
|
+
}
|
|
996
|
+
catch (err) {
|
|
997
|
+
return { error: `Failed to login: ${sanitizeError(err instanceof Error ? err.message : "Unknown error")}` };
|
|
998
|
+
}
|
|
999
|
+
},
|
|
1000
|
+
});
|
|
1001
|
+
}
|
|
1002
|
+
/**
|
|
1003
|
+
* Creates a tool to get the current authenticated account information.
|
|
1004
|
+
*/
|
|
1005
|
+
export function createGetAccountInfoTool(client, agentSecret) {
|
|
1006
|
+
return tool({
|
|
1007
|
+
description: "Get the current authenticated Dominus Node account information including email, plan, and verification status.",
|
|
1008
|
+
parameters: z.object({}),
|
|
1009
|
+
execute: async () => {
|
|
1010
|
+
try {
|
|
1011
|
+
const result = await apiRequest(client, "GET", "/api/auth/me", undefined, agentSecret);
|
|
1012
|
+
const user = result.user;
|
|
1013
|
+
return {
|
|
1014
|
+
id: user?.id,
|
|
1015
|
+
email: user?.email,
|
|
1016
|
+
plan: user?.plan,
|
|
1017
|
+
emailVerified: user?.emailVerified,
|
|
1018
|
+
status: user?.status,
|
|
1019
|
+
createdAt: user?.createdAt,
|
|
1020
|
+
};
|
|
1021
|
+
}
|
|
1022
|
+
catch (err) {
|
|
1023
|
+
return { error: `Failed to get account info: ${sanitizeError(err instanceof Error ? err.message : "Unknown error")}` };
|
|
1024
|
+
}
|
|
1025
|
+
},
|
|
1026
|
+
});
|
|
1027
|
+
}
|
|
1028
|
+
/**
|
|
1029
|
+
* Creates a tool to verify an email address with a token.
|
|
1030
|
+
*/
|
|
1031
|
+
export function createVerifyEmailTool(agentSecret) {
|
|
1032
|
+
return tool({
|
|
1033
|
+
description: "Verify email address using the verification token sent to email. MCP agents are auto-verified.",
|
|
1034
|
+
parameters: z.object({
|
|
1035
|
+
token: z.string().min(1).describe("Email verification token from the verification email"),
|
|
1036
|
+
}),
|
|
1037
|
+
execute: async ({ token }) => {
|
|
1038
|
+
try {
|
|
1039
|
+
const baseUrl = process.env.DOMINUSNODE_BASE_URL || "https://api.dominusnode.com";
|
|
1040
|
+
const headers = { "Content-Type": "application/json" };
|
|
1041
|
+
if (agentSecret) {
|
|
1042
|
+
headers["X-DominusNode-Agent"] = "mcp";
|
|
1043
|
+
headers["X-DominusNode-Agent-Secret"] = agentSecret;
|
|
1044
|
+
}
|
|
1045
|
+
const resp = await fetch(`${baseUrl}/api/auth/verify-email`, {
|
|
1046
|
+
method: "POST", headers, body: JSON.stringify({ token }), redirect: "error",
|
|
1047
|
+
});
|
|
1048
|
+
if (!resp.ok) {
|
|
1049
|
+
const text = await resp.text().catch(() => "");
|
|
1050
|
+
throw new Error(`Verification failed (${resp.status}): ${text.slice(0, 200)}`);
|
|
1051
|
+
}
|
|
1052
|
+
return { success: true, message: "Email verified successfully" };
|
|
1053
|
+
}
|
|
1054
|
+
catch (err) {
|
|
1055
|
+
return { error: `Failed to verify email: ${sanitizeError(err instanceof Error ? err.message : "Unknown error")}` };
|
|
1056
|
+
}
|
|
1057
|
+
},
|
|
1058
|
+
});
|
|
1059
|
+
}
|
|
1060
|
+
/**
|
|
1061
|
+
* Creates a tool to resend the email verification token.
|
|
1062
|
+
*/
|
|
1063
|
+
export function createResendVerificationTool(client, agentSecret) {
|
|
1064
|
+
return tool({
|
|
1065
|
+
description: "Resend the email verification token to the account's email address.",
|
|
1066
|
+
parameters: z.object({}),
|
|
1067
|
+
execute: async () => {
|
|
1068
|
+
try {
|
|
1069
|
+
await apiRequest(client, "POST", "/api/auth/resend-verification", undefined, agentSecret);
|
|
1070
|
+
return { success: true, message: "Verification email sent" };
|
|
1071
|
+
}
|
|
1072
|
+
catch (err) {
|
|
1073
|
+
return { error: `Failed to resend verification: ${sanitizeError(err instanceof Error ? err.message : "Unknown error")}` };
|
|
1074
|
+
}
|
|
1075
|
+
},
|
|
1076
|
+
});
|
|
1077
|
+
}
|
|
1078
|
+
/**
|
|
1079
|
+
* Creates a tool to change the account password.
|
|
1080
|
+
*/
|
|
1081
|
+
export function createUpdatePasswordTool(client, agentSecret) {
|
|
1082
|
+
return tool({
|
|
1083
|
+
description: "Change the password for the current Dominus Node account.",
|
|
1084
|
+
parameters: z.object({
|
|
1085
|
+
current_password: z.string().min(1).describe("Current password"),
|
|
1086
|
+
new_password: z.string().min(8).max(128).describe("New password (min 8 characters)"),
|
|
1087
|
+
}),
|
|
1088
|
+
execute: async ({ current_password, new_password }) => {
|
|
1089
|
+
try {
|
|
1090
|
+
await apiRequest(client, "POST", "/api/auth/change-password", {
|
|
1091
|
+
currentPassword: current_password,
|
|
1092
|
+
newPassword: new_password,
|
|
1093
|
+
}, agentSecret);
|
|
1094
|
+
return { success: true, message: "Password updated" };
|
|
1095
|
+
}
|
|
1096
|
+
catch (err) {
|
|
1097
|
+
return { error: `Failed to update password: ${sanitizeError(err instanceof Error ? err.message : "Unknown error")}` };
|
|
1098
|
+
}
|
|
1099
|
+
},
|
|
1100
|
+
});
|
|
1101
|
+
}
|
|
1102
|
+
// ---------------------------------------------------------------------------
|
|
1103
|
+
// API key management tools
|
|
1104
|
+
// ---------------------------------------------------------------------------
|
|
1105
|
+
/**
|
|
1106
|
+
* Creates a tool to list all API keys for the current account.
|
|
1107
|
+
*/
|
|
1108
|
+
export function createListKeysTool(client, agentSecret) {
|
|
1109
|
+
return tool({
|
|
1110
|
+
description: "List all API keys for the current Dominus Node account. Shows key ID, label, prefix, and creation date.",
|
|
1111
|
+
parameters: z.object({}),
|
|
1112
|
+
execute: async () => {
|
|
1113
|
+
try {
|
|
1114
|
+
return await apiRequest(client, "GET", "/api/keys", undefined, agentSecret);
|
|
1115
|
+
}
|
|
1116
|
+
catch (err) {
|
|
1117
|
+
return { error: `Failed to list keys: ${sanitizeError(err instanceof Error ? err.message : "Unknown error")}` };
|
|
1118
|
+
}
|
|
1119
|
+
},
|
|
1120
|
+
});
|
|
1121
|
+
}
|
|
1122
|
+
/**
|
|
1123
|
+
* Creates a tool to create a new API key.
|
|
1124
|
+
*/
|
|
1125
|
+
export function createCreateKeyTool(client, agentSecret) {
|
|
1126
|
+
return tool({
|
|
1127
|
+
description: "Create a new Dominus Node API key. The full key is shown only once — store it securely. " +
|
|
1128
|
+
"WARNING: API keys are secret credentials. Never log or share them.",
|
|
1129
|
+
parameters: z.object({
|
|
1130
|
+
label: z.string().min(1).max(100).optional().describe("Human-readable label for the key"),
|
|
1131
|
+
}),
|
|
1132
|
+
execute: async ({ label }) => {
|
|
1133
|
+
if (label && /[\x00-\x1F\x7F]/.test(label)) {
|
|
1134
|
+
return { error: "label contains invalid control characters" };
|
|
1135
|
+
}
|
|
1136
|
+
try {
|
|
1137
|
+
const body = {};
|
|
1138
|
+
if (label)
|
|
1139
|
+
body.label = label;
|
|
1140
|
+
return await apiRequest(client, "POST", "/api/keys", body, agentSecret);
|
|
1141
|
+
}
|
|
1142
|
+
catch (err) {
|
|
1143
|
+
return { error: `Failed to create key: ${sanitizeError(err instanceof Error ? err.message : "Unknown error")}` };
|
|
1144
|
+
}
|
|
1145
|
+
},
|
|
1146
|
+
});
|
|
1147
|
+
}
|
|
1148
|
+
/**
|
|
1149
|
+
* Creates a tool to revoke (delete) an API key.
|
|
1150
|
+
*/
|
|
1151
|
+
export function createRevokeKeyTool(client, agentSecret) {
|
|
1152
|
+
return tool({
|
|
1153
|
+
description: "Revoke (permanently delete) a Dominus Node API key. This cannot be undone.",
|
|
1154
|
+
parameters: z.object({
|
|
1155
|
+
key_id: z.string().regex(UUID_RE, "Must be a valid UUID").describe("UUID of the API key to revoke"),
|
|
1156
|
+
}),
|
|
1157
|
+
execute: async ({ key_id }) => {
|
|
1158
|
+
try {
|
|
1159
|
+
await apiRequest(client, "DELETE", `/api/keys/${encodeURIComponent(key_id)}`, undefined, agentSecret);
|
|
1160
|
+
return { success: true, message: "API key revoked" };
|
|
1161
|
+
}
|
|
1162
|
+
catch (err) {
|
|
1163
|
+
return { error: `Failed to revoke key: ${sanitizeError(err instanceof Error ? err.message : "Unknown error")}` };
|
|
1164
|
+
}
|
|
1165
|
+
},
|
|
1166
|
+
});
|
|
1167
|
+
}
|
|
1168
|
+
// ---------------------------------------------------------------------------
|
|
1169
|
+
// Wallet extended tools
|
|
1170
|
+
// ---------------------------------------------------------------------------
|
|
1171
|
+
/**
|
|
1172
|
+
* Creates a tool to get wallet transaction history.
|
|
1173
|
+
*/
|
|
1174
|
+
export function createGetTransactionsTool(client, agentSecret) {
|
|
1175
|
+
return tool({
|
|
1176
|
+
description: "Get wallet transaction history showing top-ups, usage charges, and transfers.",
|
|
1177
|
+
parameters: z.object({
|
|
1178
|
+
limit: z.number().int().min(1).max(100).optional().describe("Maximum transactions to return (default 50)"),
|
|
1179
|
+
offset: z.number().int().min(0).optional().describe("Offset for pagination"),
|
|
1180
|
+
}),
|
|
1181
|
+
execute: async ({ limit, offset }) => {
|
|
1182
|
+
try {
|
|
1183
|
+
const params = new URLSearchParams();
|
|
1184
|
+
if (limit !== undefined)
|
|
1185
|
+
params.set("limit", String(limit));
|
|
1186
|
+
if (offset !== undefined)
|
|
1187
|
+
params.set("offset", String(offset));
|
|
1188
|
+
const qs = params.toString() ? `?${params.toString()}` : "";
|
|
1189
|
+
return await apiRequest(client, "GET", `/api/wallet/transactions${qs}`, undefined, agentSecret);
|
|
1190
|
+
}
|
|
1191
|
+
catch (err) {
|
|
1192
|
+
return { error: `Failed to get transactions: ${sanitizeError(err instanceof Error ? err.message : "Unknown error")}` };
|
|
1193
|
+
}
|
|
1194
|
+
},
|
|
1195
|
+
});
|
|
1196
|
+
}
|
|
1197
|
+
/**
|
|
1198
|
+
* Creates a tool to get wallet balance forecast.
|
|
1199
|
+
*/
|
|
1200
|
+
export function createGetForecastTool(client, agentSecret) {
|
|
1201
|
+
return tool({
|
|
1202
|
+
description: "Get a wallet balance forecast based on recent usage patterns. Shows estimated days until balance depletion.",
|
|
1203
|
+
parameters: z.object({}),
|
|
1204
|
+
execute: async () => {
|
|
1205
|
+
try {
|
|
1206
|
+
return await apiRequest(client, "GET", "/api/wallet/forecast", undefined, agentSecret);
|
|
1207
|
+
}
|
|
1208
|
+
catch (err) {
|
|
1209
|
+
return { error: `Failed to get forecast: ${sanitizeError(err instanceof Error ? err.message : "Unknown error")}` };
|
|
1210
|
+
}
|
|
1211
|
+
},
|
|
1212
|
+
});
|
|
1213
|
+
}
|
|
1214
|
+
/**
|
|
1215
|
+
* Creates a tool to check the status of a crypto payment invoice.
|
|
1216
|
+
*/
|
|
1217
|
+
export function createCheckPaymentTool(client, agentSecret) {
|
|
1218
|
+
return tool({
|
|
1219
|
+
description: "Check the status of a cryptocurrency payment invoice. Use after creating a crypto top-up.",
|
|
1220
|
+
parameters: z.object({
|
|
1221
|
+
invoice_id: z.string().min(1).describe("The invoice ID from the crypto top-up creation"),
|
|
1222
|
+
}),
|
|
1223
|
+
execute: async ({ invoice_id }) => {
|
|
1224
|
+
try {
|
|
1225
|
+
return await apiRequest(client, "GET", `/api/wallet/crypto/status/${encodeURIComponent(invoice_id)}`, undefined, agentSecret);
|
|
1226
|
+
}
|
|
1227
|
+
catch (err) {
|
|
1228
|
+
return { error: `Failed to check payment: ${sanitizeError(err instanceof Error ? err.message : "Unknown error")}` };
|
|
1229
|
+
}
|
|
1230
|
+
},
|
|
1231
|
+
});
|
|
1232
|
+
}
|
|
1233
|
+
// ---------------------------------------------------------------------------
|
|
1234
|
+
// Usage extended tools
|
|
1235
|
+
// ---------------------------------------------------------------------------
|
|
1236
|
+
/**
|
|
1237
|
+
* Creates a tool to get daily usage breakdown.
|
|
1238
|
+
*/
|
|
1239
|
+
export function createGetDailyUsageTool(client, agentSecret) {
|
|
1240
|
+
return tool({
|
|
1241
|
+
description: "Get daily proxy usage breakdown showing bytes, cost, and request count per day.",
|
|
1242
|
+
parameters: z.object({
|
|
1243
|
+
since: z.string().optional().describe("Start date (ISO 8601). Defaults to 30 days ago."),
|
|
1244
|
+
until: z.string().optional().describe("End date (ISO 8601). Defaults to now."),
|
|
1245
|
+
}),
|
|
1246
|
+
execute: async ({ since, until }) => {
|
|
1247
|
+
try {
|
|
1248
|
+
const params = new URLSearchParams();
|
|
1249
|
+
if (since)
|
|
1250
|
+
params.set("since", since);
|
|
1251
|
+
if (until)
|
|
1252
|
+
params.set("until", until);
|
|
1253
|
+
const qs = params.toString() ? `?${params.toString()}` : "";
|
|
1254
|
+
return await apiRequest(client, "GET", `/api/usage/daily${qs}`, undefined, agentSecret);
|
|
1255
|
+
}
|
|
1256
|
+
catch (err) {
|
|
1257
|
+
return { error: `Failed to get daily usage: ${sanitizeError(err instanceof Error ? err.message : "Unknown error")}` };
|
|
1258
|
+
}
|
|
1259
|
+
},
|
|
1260
|
+
});
|
|
1261
|
+
}
|
|
1262
|
+
/**
|
|
1263
|
+
* Creates a tool to get the top accessed hosts through the proxy.
|
|
1264
|
+
*/
|
|
1265
|
+
export function createGetTopHostsTool(client, agentSecret) {
|
|
1266
|
+
return tool({
|
|
1267
|
+
description: "Get the top accessed hosts (domains) through the proxy, ranked by total bytes transferred.",
|
|
1268
|
+
parameters: z.object({
|
|
1269
|
+
since: z.string().optional().describe("Start date (ISO 8601). Defaults to 30 days ago."),
|
|
1270
|
+
until: z.string().optional().describe("End date (ISO 8601). Defaults to now."),
|
|
1271
|
+
limit: z.number().int().min(1).max(100).optional().describe("Max hosts to return (default 10)"),
|
|
1272
|
+
}),
|
|
1273
|
+
execute: async ({ since, until, limit }) => {
|
|
1274
|
+
try {
|
|
1275
|
+
const params = new URLSearchParams();
|
|
1276
|
+
if (since)
|
|
1277
|
+
params.set("since", since);
|
|
1278
|
+
if (until)
|
|
1279
|
+
params.set("until", until);
|
|
1280
|
+
if (limit !== undefined)
|
|
1281
|
+
params.set("limit", String(limit));
|
|
1282
|
+
const qs = params.toString() ? `?${params.toString()}` : "";
|
|
1283
|
+
return await apiRequest(client, "GET", `/api/usage/top-hosts${qs}`, undefined, agentSecret);
|
|
1284
|
+
}
|
|
1285
|
+
catch (err) {
|
|
1286
|
+
return { error: `Failed to get top hosts: ${sanitizeError(err instanceof Error ? err.message : "Unknown error")}` };
|
|
1287
|
+
}
|
|
1288
|
+
},
|
|
1289
|
+
});
|
|
1290
|
+
}
|
|
1291
|
+
// ---------------------------------------------------------------------------
|
|
1292
|
+
// Plan management tools
|
|
1293
|
+
// ---------------------------------------------------------------------------
|
|
1294
|
+
/**
|
|
1295
|
+
* Creates a tool to get the current user's plan.
|
|
1296
|
+
*/
|
|
1297
|
+
export function createGetPlanTool(client, agentSecret) {
|
|
1298
|
+
return tool({
|
|
1299
|
+
description: "Get the current user's plan details including bandwidth limits, pricing tier, and features.",
|
|
1300
|
+
parameters: z.object({}),
|
|
1301
|
+
execute: async () => {
|
|
1302
|
+
try {
|
|
1303
|
+
return await apiRequest(client, "GET", "/api/plans/user/plan", undefined, agentSecret);
|
|
1304
|
+
}
|
|
1305
|
+
catch (err) {
|
|
1306
|
+
return { error: `Failed to get plan: ${sanitizeError(err instanceof Error ? err.message : "Unknown error")}` };
|
|
1307
|
+
}
|
|
1308
|
+
},
|
|
1309
|
+
});
|
|
1310
|
+
}
|
|
1311
|
+
/**
|
|
1312
|
+
* Creates a tool to list all available plans.
|
|
1313
|
+
*/
|
|
1314
|
+
export function createListPlansTool(client, agentSecret) {
|
|
1315
|
+
return tool({
|
|
1316
|
+
description: "List all available Dominus Node plans with pricing, bandwidth limits, and features.",
|
|
1317
|
+
parameters: z.object({}),
|
|
1318
|
+
execute: async () => {
|
|
1319
|
+
try {
|
|
1320
|
+
return await apiRequest(client, "GET", "/api/plans", undefined, agentSecret);
|
|
1321
|
+
}
|
|
1322
|
+
catch (err) {
|
|
1323
|
+
return { error: `Failed to list plans: ${sanitizeError(err instanceof Error ? err.message : "Unknown error")}` };
|
|
1324
|
+
}
|
|
1325
|
+
},
|
|
1326
|
+
});
|
|
1327
|
+
}
|
|
1328
|
+
/**
|
|
1329
|
+
* Creates a tool to change the current user's plan.
|
|
1330
|
+
*/
|
|
1331
|
+
export function createChangePlanTool(client, agentSecret) {
|
|
1332
|
+
return tool({
|
|
1333
|
+
description: "Change the current user's plan. Requires email verification.",
|
|
1334
|
+
parameters: z.object({
|
|
1335
|
+
plan_id: z.string().min(1).describe("ID of the plan to switch to"),
|
|
1336
|
+
}),
|
|
1337
|
+
execute: async ({ plan_id }) => {
|
|
1338
|
+
try {
|
|
1339
|
+
return await apiRequest(client, "PUT", "/api/plans/user/plan", { planId: plan_id }, agentSecret);
|
|
1340
|
+
}
|
|
1341
|
+
catch (err) {
|
|
1342
|
+
return { error: `Failed to change plan: ${sanitizeError(err instanceof Error ? err.message : "Unknown error")}` };
|
|
1343
|
+
}
|
|
1344
|
+
},
|
|
1345
|
+
});
|
|
1346
|
+
}
|
|
1347
|
+
// ---------------------------------------------------------------------------
|
|
1348
|
+
// Proxy extended tools
|
|
1349
|
+
// ---------------------------------------------------------------------------
|
|
1350
|
+
/**
|
|
1351
|
+
* Creates a tool to get proxy health/status information.
|
|
1352
|
+
*/
|
|
1353
|
+
export function createGetProxyStatusTool(client, agentSecret) {
|
|
1354
|
+
return tool({
|
|
1355
|
+
description: "Get proxy health and status information including uptime, active connections, and provider status.",
|
|
1356
|
+
parameters: z.object({}),
|
|
1357
|
+
execute: async () => {
|
|
1358
|
+
try {
|
|
1359
|
+
return await apiRequest(client, "GET", "/api/proxy/status", undefined, agentSecret);
|
|
1360
|
+
}
|
|
1361
|
+
catch (err) {
|
|
1362
|
+
return { error: `Failed to get proxy status: ${sanitizeError(err instanceof Error ? err.message : "Unknown error")}` };
|
|
1363
|
+
}
|
|
1364
|
+
},
|
|
1365
|
+
});
|
|
1366
|
+
}
|
|
1367
|
+
// ---------------------------------------------------------------------------
|
|
1368
|
+
// Team management tools (full suite — 17 tools)
|
|
1369
|
+
// ---------------------------------------------------------------------------
|
|
1370
|
+
/**
|
|
1371
|
+
* Creates a tool to create a new team.
|
|
1372
|
+
*/
|
|
1373
|
+
export function createCreateTeamTool(client, agentSecret) {
|
|
1374
|
+
return tool({
|
|
1375
|
+
description: "Create a new Dominus Node team with a shared wallet for collaborative proxy usage.",
|
|
1376
|
+
parameters: z.object({
|
|
1377
|
+
name: z.string().min(1).max(100).describe("Team name"),
|
|
1378
|
+
max_members: z.number().int().min(2).max(100).optional().describe("Maximum team members (default 10)"),
|
|
1379
|
+
}),
|
|
1380
|
+
execute: async ({ name, max_members }) => {
|
|
1381
|
+
if (/[\x00-\x1F\x7F]/.test(name)) {
|
|
1382
|
+
return { error: "name contains invalid control characters" };
|
|
1383
|
+
}
|
|
1384
|
+
try {
|
|
1385
|
+
const body = { name };
|
|
1386
|
+
if (max_members !== undefined)
|
|
1387
|
+
body.maxMembers = max_members;
|
|
1388
|
+
return await apiRequest(client, "POST", "/api/teams", body, agentSecret);
|
|
1389
|
+
}
|
|
1390
|
+
catch (err) {
|
|
1391
|
+
return { error: `Failed to create team: ${sanitizeError(err instanceof Error ? err.message : "Unknown error")}` };
|
|
1392
|
+
}
|
|
1393
|
+
},
|
|
1394
|
+
});
|
|
1395
|
+
}
|
|
1396
|
+
/**
|
|
1397
|
+
* Creates a tool to list all teams the user belongs to.
|
|
1398
|
+
*/
|
|
1399
|
+
export function createListTeamsTool(client, agentSecret) {
|
|
1400
|
+
return tool({
|
|
1401
|
+
description: "List all teams the current user belongs to (as owner, admin, or member).",
|
|
1402
|
+
parameters: z.object({}),
|
|
1403
|
+
execute: async () => {
|
|
1404
|
+
try {
|
|
1405
|
+
return await apiRequest(client, "GET", "/api/teams", undefined, agentSecret);
|
|
1406
|
+
}
|
|
1407
|
+
catch (err) {
|
|
1408
|
+
return { error: `Failed to list teams: ${sanitizeError(err instanceof Error ? err.message : "Unknown error")}` };
|
|
1409
|
+
}
|
|
1410
|
+
},
|
|
1411
|
+
});
|
|
1412
|
+
}
|
|
1413
|
+
/**
|
|
1414
|
+
* Creates a tool to get detailed information about a team.
|
|
1415
|
+
*/
|
|
1416
|
+
export function createTeamDetailsTool(client, agentSecret) {
|
|
1417
|
+
return tool({
|
|
1418
|
+
description: "Get detailed information about a team including wallet balance, members count, and settings.",
|
|
1419
|
+
parameters: z.object({
|
|
1420
|
+
team_id: z.string().regex(UUID_RE, "Must be a valid UUID").describe("UUID of the team"),
|
|
1421
|
+
}),
|
|
1422
|
+
execute: async ({ team_id }) => {
|
|
1423
|
+
try {
|
|
1424
|
+
return await apiRequest(client, "GET", `/api/teams/${encodeURIComponent(team_id)}`, undefined, agentSecret);
|
|
1425
|
+
}
|
|
1426
|
+
catch (err) {
|
|
1427
|
+
return { error: `Failed to get team details: ${sanitizeError(err instanceof Error ? err.message : "Unknown error")}` };
|
|
1428
|
+
}
|
|
1429
|
+
},
|
|
1430
|
+
});
|
|
1431
|
+
}
|
|
1432
|
+
/**
|
|
1433
|
+
* Creates a tool to update team settings.
|
|
1434
|
+
*/
|
|
1435
|
+
export function createUpdateTeamTool(client, agentSecret) {
|
|
1436
|
+
return tool({
|
|
1437
|
+
description: "Update team settings such as name or max members. Requires owner or admin role.",
|
|
1438
|
+
parameters: z.object({
|
|
1439
|
+
team_id: z.string().regex(UUID_RE, "Must be a valid UUID").describe("UUID of the team"),
|
|
1440
|
+
name: z.string().min(1).max(100).optional().describe("New team name"),
|
|
1441
|
+
max_members: z.number().int().min(2).max(100).optional().describe("New max members limit"),
|
|
1442
|
+
}),
|
|
1443
|
+
execute: async ({ team_id, name, max_members }) => {
|
|
1444
|
+
if (name && /[\x00-\x1F\x7F]/.test(name)) {
|
|
1445
|
+
return { error: "name contains invalid control characters" };
|
|
1446
|
+
}
|
|
1447
|
+
const body = {};
|
|
1448
|
+
if (name !== undefined)
|
|
1449
|
+
body.name = name;
|
|
1450
|
+
if (max_members !== undefined)
|
|
1451
|
+
body.maxMembers = max_members;
|
|
1452
|
+
if (Object.keys(body).length === 0) {
|
|
1453
|
+
return { error: "At least one field (name or max_members) must be provided" };
|
|
1454
|
+
}
|
|
1455
|
+
try {
|
|
1456
|
+
return await apiRequest(client, "PATCH", `/api/teams/${encodeURIComponent(team_id)}`, body, agentSecret);
|
|
1457
|
+
}
|
|
1458
|
+
catch (err) {
|
|
1459
|
+
return { error: `Failed to update team: ${sanitizeError(err instanceof Error ? err.message : "Unknown error")}` };
|
|
1460
|
+
}
|
|
1461
|
+
},
|
|
1462
|
+
});
|
|
1463
|
+
}
|
|
1464
|
+
/**
|
|
1465
|
+
* Creates a tool to delete a team. Requires owner role.
|
|
1466
|
+
*/
|
|
1467
|
+
export function createTeamDeleteTool(client, agentSecret) {
|
|
1468
|
+
return tool({
|
|
1469
|
+
description: "Delete a team permanently. Requires owner role. Remaining team wallet balance is NOT refunded.",
|
|
1470
|
+
parameters: z.object({
|
|
1471
|
+
team_id: z.string().regex(UUID_RE, "Must be a valid UUID").describe("UUID of the team to delete"),
|
|
1472
|
+
}),
|
|
1473
|
+
execute: async ({ team_id }) => {
|
|
1474
|
+
try {
|
|
1475
|
+
await apiRequest(client, "DELETE", `/api/teams/${encodeURIComponent(team_id)}`, undefined, agentSecret);
|
|
1476
|
+
return { success: true, message: "Team deleted" };
|
|
1477
|
+
}
|
|
1478
|
+
catch (err) {
|
|
1479
|
+
return { error: `Failed to delete team: ${sanitizeError(err instanceof Error ? err.message : "Unknown error")}` };
|
|
1480
|
+
}
|
|
1481
|
+
},
|
|
1482
|
+
});
|
|
1483
|
+
}
|
|
1484
|
+
/**
|
|
1485
|
+
* Creates a tool to fund a team wallet from the user's personal wallet.
|
|
1486
|
+
*/
|
|
1487
|
+
export function createTeamFundTool(client, agentSecret) {
|
|
1488
|
+
return tool({
|
|
1489
|
+
description: "Fund a team wallet by transferring from your personal wallet. Requires owner or admin role.",
|
|
1490
|
+
parameters: z.object({
|
|
1491
|
+
team_id: z.string().regex(UUID_RE, "Must be a valid UUID").describe("UUID of the team"),
|
|
1492
|
+
amount_cents: z.number().int().min(1).max(2147483647).describe("Amount in cents to transfer"),
|
|
1493
|
+
}),
|
|
1494
|
+
execute: async ({ team_id, amount_cents }) => {
|
|
1495
|
+
try {
|
|
1496
|
+
return await apiRequest(client, "POST", `/api/teams/${encodeURIComponent(team_id)}/wallet/fund`, { amountCents: amount_cents }, agentSecret);
|
|
1497
|
+
}
|
|
1498
|
+
catch (err) {
|
|
1499
|
+
return { error: `Failed to fund team: ${sanitizeError(err instanceof Error ? err.message : "Unknown error")}` };
|
|
1500
|
+
}
|
|
1501
|
+
},
|
|
1502
|
+
});
|
|
1503
|
+
}
|
|
1504
|
+
/**
|
|
1505
|
+
* Creates a tool to create a team API key.
|
|
1506
|
+
*/
|
|
1507
|
+
export function createTeamCreateKeyTool(client, agentSecret) {
|
|
1508
|
+
return tool({
|
|
1509
|
+
description: "Create an API key for a team. Team keys bill to the team wallet. Requires owner or admin role.",
|
|
1510
|
+
parameters: z.object({
|
|
1511
|
+
team_id: z.string().regex(UUID_RE, "Must be a valid UUID").describe("UUID of the team"),
|
|
1512
|
+
label: z.string().min(1).max(100).optional().describe("Label for the team API key"),
|
|
1513
|
+
}),
|
|
1514
|
+
execute: async ({ team_id, label }) => {
|
|
1515
|
+
if (label && /[\x00-\x1F\x7F]/.test(label)) {
|
|
1516
|
+
return { error: "label contains invalid control characters" };
|
|
1517
|
+
}
|
|
1518
|
+
try {
|
|
1519
|
+
const body = {};
|
|
1520
|
+
if (label)
|
|
1521
|
+
body.label = label;
|
|
1522
|
+
return await apiRequest(client, "POST", `/api/teams/${encodeURIComponent(team_id)}/keys`, body, agentSecret);
|
|
1523
|
+
}
|
|
1524
|
+
catch (err) {
|
|
1525
|
+
return { error: `Failed to create team key: ${sanitizeError(err instanceof Error ? err.message : "Unknown error")}` };
|
|
1526
|
+
}
|
|
1527
|
+
},
|
|
1528
|
+
});
|
|
1529
|
+
}
|
|
1530
|
+
/**
|
|
1531
|
+
* Creates a tool to revoke a team API key.
|
|
1532
|
+
*/
|
|
1533
|
+
export function createTeamRevokeKeyTool(client, agentSecret) {
|
|
1534
|
+
return tool({
|
|
1535
|
+
description: "Revoke (delete) a team API key. Requires owner or admin role.",
|
|
1536
|
+
parameters: z.object({
|
|
1537
|
+
team_id: z.string().regex(UUID_RE, "Must be a valid UUID").describe("UUID of the team"),
|
|
1538
|
+
key_id: z.string().regex(UUID_RE, "Must be a valid UUID").describe("UUID of the team key to revoke"),
|
|
1539
|
+
}),
|
|
1540
|
+
execute: async ({ team_id, key_id }) => {
|
|
1541
|
+
try {
|
|
1542
|
+
await apiRequest(client, "DELETE", `/api/teams/${encodeURIComponent(team_id)}/keys/${encodeURIComponent(key_id)}`, undefined, agentSecret);
|
|
1543
|
+
return { success: true, message: "Team key revoked" };
|
|
1544
|
+
}
|
|
1545
|
+
catch (err) {
|
|
1546
|
+
return { error: `Failed to revoke team key: ${sanitizeError(err instanceof Error ? err.message : "Unknown error")}` };
|
|
1547
|
+
}
|
|
1548
|
+
},
|
|
1549
|
+
});
|
|
1550
|
+
}
|
|
1551
|
+
/**
|
|
1552
|
+
* Creates a tool to list all API keys for a team.
|
|
1553
|
+
*/
|
|
1554
|
+
export function createTeamListKeysTool(client, agentSecret) {
|
|
1555
|
+
return tool({
|
|
1556
|
+
description: "List all API keys for a team. Shows key ID, label, prefix, and creation date.",
|
|
1557
|
+
parameters: z.object({
|
|
1558
|
+
team_id: z.string().regex(UUID_RE, "Must be a valid UUID").describe("UUID of the team"),
|
|
1559
|
+
}),
|
|
1560
|
+
execute: async ({ team_id }) => {
|
|
1561
|
+
try {
|
|
1562
|
+
return await apiRequest(client, "GET", `/api/teams/${encodeURIComponent(team_id)}/keys`, undefined, agentSecret);
|
|
1563
|
+
}
|
|
1564
|
+
catch (err) {
|
|
1565
|
+
return { error: `Failed to list team keys: ${sanitizeError(err instanceof Error ? err.message : "Unknown error")}` };
|
|
1566
|
+
}
|
|
1567
|
+
},
|
|
1568
|
+
});
|
|
1569
|
+
}
|
|
1570
|
+
/**
|
|
1571
|
+
* Creates a tool to get team usage statistics.
|
|
1572
|
+
*/
|
|
1573
|
+
export function createTeamUsageTool(client, agentSecret) {
|
|
1574
|
+
return tool({
|
|
1575
|
+
description: "Get proxy usage statistics for a team including total bytes, cost, and per-member breakdown.",
|
|
1576
|
+
parameters: z.object({
|
|
1577
|
+
team_id: z.string().regex(UUID_RE, "Must be a valid UUID").describe("UUID of the team"),
|
|
1578
|
+
}),
|
|
1579
|
+
execute: async ({ team_id }) => {
|
|
1580
|
+
try {
|
|
1581
|
+
return await apiRequest(client, "GET", `/api/teams/${encodeURIComponent(team_id)}/usage`, undefined, agentSecret);
|
|
1582
|
+
}
|
|
1583
|
+
catch (err) {
|
|
1584
|
+
return { error: `Failed to get team usage: ${sanitizeError(err instanceof Error ? err.message : "Unknown error")}` };
|
|
1585
|
+
}
|
|
1586
|
+
},
|
|
1587
|
+
});
|
|
1588
|
+
}
|
|
1589
|
+
/**
|
|
1590
|
+
* Creates a tool to list all members of a team.
|
|
1591
|
+
*/
|
|
1592
|
+
export function createTeamListMembersTool(client, agentSecret) {
|
|
1593
|
+
return tool({
|
|
1594
|
+
description: "List all members of a team with their roles (owner/admin/member) and join dates.",
|
|
1595
|
+
parameters: z.object({
|
|
1596
|
+
team_id: z.string().regex(UUID_RE, "Must be a valid UUID").describe("UUID of the team"),
|
|
1597
|
+
}),
|
|
1598
|
+
execute: async ({ team_id }) => {
|
|
1599
|
+
try {
|
|
1600
|
+
return await apiRequest(client, "GET", `/api/teams/${encodeURIComponent(team_id)}/members`, undefined, agentSecret);
|
|
1601
|
+
}
|
|
1602
|
+
catch (err) {
|
|
1603
|
+
return { error: `Failed to list team members: ${sanitizeError(err instanceof Error ? err.message : "Unknown error")}` };
|
|
1604
|
+
}
|
|
1605
|
+
},
|
|
1606
|
+
});
|
|
1607
|
+
}
|
|
1608
|
+
/**
|
|
1609
|
+
* Creates a tool to add a member directly to a team (by user ID or email).
|
|
1610
|
+
*/
|
|
1611
|
+
export function createTeamAddMemberTool(client, agentSecret) {
|
|
1612
|
+
return tool({
|
|
1613
|
+
description: "Add a member directly to a team by email. Requires owner or admin role.",
|
|
1614
|
+
parameters: z.object({
|
|
1615
|
+
team_id: z.string().regex(UUID_RE, "Must be a valid UUID").describe("UUID of the team"),
|
|
1616
|
+
email: z.string().email().describe("Email of the user to add"),
|
|
1617
|
+
role: z.enum(["admin", "member"]).optional().describe("Role to assign (default: member)"),
|
|
1618
|
+
}),
|
|
1619
|
+
execute: async ({ team_id, email, role }) => {
|
|
1620
|
+
try {
|
|
1621
|
+
const body = { email };
|
|
1622
|
+
if (role)
|
|
1623
|
+
body.role = role;
|
|
1624
|
+
return await apiRequest(client, "POST", `/api/teams/${encodeURIComponent(team_id)}/members`, body, agentSecret);
|
|
1625
|
+
}
|
|
1626
|
+
catch (err) {
|
|
1627
|
+
return { error: `Failed to add member: ${sanitizeError(err instanceof Error ? err.message : "Unknown error")}` };
|
|
1628
|
+
}
|
|
1629
|
+
},
|
|
1630
|
+
});
|
|
1631
|
+
}
|
|
1632
|
+
/**
|
|
1633
|
+
* Creates a tool to remove a member from a team.
|
|
1634
|
+
*/
|
|
1635
|
+
export function createTeamRemoveMemberTool(client, agentSecret) {
|
|
1636
|
+
return tool({
|
|
1637
|
+
description: "Remove a member from a team. Requires owner or admin role. Cannot remove the owner.",
|
|
1638
|
+
parameters: z.object({
|
|
1639
|
+
team_id: z.string().regex(UUID_RE, "Must be a valid UUID").describe("UUID of the team"),
|
|
1640
|
+
user_id: z.string().regex(UUID_RE, "Must be a valid UUID").describe("UUID of the member to remove"),
|
|
1641
|
+
}),
|
|
1642
|
+
execute: async ({ team_id, user_id }) => {
|
|
1643
|
+
try {
|
|
1644
|
+
await apiRequest(client, "DELETE", `/api/teams/${encodeURIComponent(team_id)}/members/${encodeURIComponent(user_id)}`, undefined, agentSecret);
|
|
1645
|
+
return { success: true, message: "Member removed" };
|
|
1646
|
+
}
|
|
1647
|
+
catch (err) {
|
|
1648
|
+
return { error: `Failed to remove member: ${sanitizeError(err instanceof Error ? err.message : "Unknown error")}` };
|
|
1649
|
+
}
|
|
1650
|
+
},
|
|
1651
|
+
});
|
|
1652
|
+
}
|
|
1653
|
+
/**
|
|
1654
|
+
* Creates a tool to update a team member's role.
|
|
1655
|
+
*/
|
|
1656
|
+
export function createUpdateTeamMemberRoleTool(client, agentSecret) {
|
|
1657
|
+
return tool({
|
|
1658
|
+
description: "Update a team member's role (admin or member). Requires owner role.",
|
|
1659
|
+
parameters: z.object({
|
|
1660
|
+
team_id: z.string().regex(UUID_RE, "Must be a valid UUID").describe("UUID of the team"),
|
|
1661
|
+
user_id: z.string().regex(UUID_RE, "Must be a valid UUID").describe("UUID of the member"),
|
|
1662
|
+
role: z.enum(["admin", "member"]).describe("New role for the member"),
|
|
1663
|
+
}),
|
|
1664
|
+
execute: async ({ team_id, user_id, role }) => {
|
|
1665
|
+
try {
|
|
1666
|
+
return await apiRequest(client, "PATCH", `/api/teams/${encodeURIComponent(team_id)}/members/${encodeURIComponent(user_id)}`, { role }, agentSecret);
|
|
1667
|
+
}
|
|
1668
|
+
catch (err) {
|
|
1669
|
+
return { error: `Failed to update member role: ${sanitizeError(err instanceof Error ? err.message : "Unknown error")}` };
|
|
1670
|
+
}
|
|
1671
|
+
},
|
|
1672
|
+
});
|
|
1673
|
+
}
|
|
1674
|
+
/**
|
|
1675
|
+
* Creates a tool to invite a member to a team via email.
|
|
1676
|
+
*/
|
|
1677
|
+
export function createTeamInviteMemberTool(client, agentSecret) {
|
|
1678
|
+
return tool({
|
|
1679
|
+
description: "Invite a user to join a team via email. They receive an invitation link. Requires owner or admin role.",
|
|
1680
|
+
parameters: z.object({
|
|
1681
|
+
team_id: z.string().regex(UUID_RE, "Must be a valid UUID").describe("UUID of the team"),
|
|
1682
|
+
email: z.string().email().describe("Email address to invite"),
|
|
1683
|
+
role: z.enum(["admin", "member"]).optional().describe("Role to assign when they accept (default: member)"),
|
|
1684
|
+
}),
|
|
1685
|
+
execute: async ({ team_id, email, role }) => {
|
|
1686
|
+
try {
|
|
1687
|
+
const body = { email };
|
|
1688
|
+
if (role)
|
|
1689
|
+
body.role = role;
|
|
1690
|
+
return await apiRequest(client, "POST", `/api/teams/${encodeURIComponent(team_id)}/invites`, body, agentSecret);
|
|
1691
|
+
}
|
|
1692
|
+
catch (err) {
|
|
1693
|
+
return { error: `Failed to invite member: ${sanitizeError(err instanceof Error ? err.message : "Unknown error")}` };
|
|
1694
|
+
}
|
|
1695
|
+
},
|
|
1696
|
+
});
|
|
1697
|
+
}
|
|
1698
|
+
/**
|
|
1699
|
+
* Creates a tool to list pending team invitations.
|
|
1700
|
+
*/
|
|
1701
|
+
export function createTeamListInvitesTool(client, agentSecret) {
|
|
1702
|
+
return tool({
|
|
1703
|
+
description: "List all pending invitations for a team.",
|
|
1704
|
+
parameters: z.object({
|
|
1705
|
+
team_id: z.string().regex(UUID_RE, "Must be a valid UUID").describe("UUID of the team"),
|
|
1706
|
+
}),
|
|
1707
|
+
execute: async ({ team_id }) => {
|
|
1708
|
+
try {
|
|
1709
|
+
return await apiRequest(client, "GET", `/api/teams/${encodeURIComponent(team_id)}/invites`, undefined, agentSecret);
|
|
1710
|
+
}
|
|
1711
|
+
catch (err) {
|
|
1712
|
+
return { error: `Failed to list invites: ${sanitizeError(err instanceof Error ? err.message : "Unknown error")}` };
|
|
1713
|
+
}
|
|
1714
|
+
},
|
|
1715
|
+
});
|
|
1716
|
+
}
|
|
1717
|
+
/**
|
|
1718
|
+
* Creates a tool to cancel a pending team invitation.
|
|
1719
|
+
*/
|
|
1720
|
+
export function createTeamCancelInviteTool(client, agentSecret) {
|
|
1721
|
+
return tool({
|
|
1722
|
+
description: "Cancel a pending team invitation. Requires owner or admin role.",
|
|
1723
|
+
parameters: z.object({
|
|
1724
|
+
team_id: z.string().regex(UUID_RE, "Must be a valid UUID").describe("UUID of the team"),
|
|
1725
|
+
invite_id: z.string().regex(UUID_RE, "Must be a valid UUID").describe("UUID of the invitation to cancel"),
|
|
1726
|
+
}),
|
|
1727
|
+
execute: async ({ team_id, invite_id }) => {
|
|
1728
|
+
try {
|
|
1729
|
+
await apiRequest(client, "DELETE", `/api/teams/${encodeURIComponent(team_id)}/invites/${encodeURIComponent(invite_id)}`, undefined, agentSecret);
|
|
1730
|
+
return { success: true, message: "Invitation cancelled" };
|
|
1731
|
+
}
|
|
1732
|
+
catch (err) {
|
|
1733
|
+
return { error: `Failed to cancel invite: ${sanitizeError(err instanceof Error ? err.message : "Unknown error")}` };
|
|
1734
|
+
}
|
|
1735
|
+
},
|
|
1736
|
+
});
|
|
1737
|
+
}
|
|
925
1738
|
// Re-export validation helpers for testing
|
|
926
1739
|
export { validateUrl, isPrivateIp, truncateBody, filterHeaders, apiRequest, UUID_RE, DOMAIN_RE };
|
|
927
1740
|
//# sourceMappingURL=tools.js.map
|