@dominusnode/flowise-tools 1.3.0 → 1.5.2

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/toolkit.js CHANGED
@@ -68,6 +68,7 @@ exports.formatCents = formatCents;
68
68
  // @ts-ignore
69
69
  const tools_1 = require("@langchain/core/tools");
70
70
  const zod_1 = require("zod");
71
+ const crypto = __importStar(require("node:crypto"));
71
72
  const http = __importStar(require("node:http"));
72
73
  const tls = __importStar(require("node:tls"));
73
74
  const dns = __importStar(require("dns/promises"));
@@ -89,7 +90,7 @@ const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/
89
90
  // ---------------------------------------------------------------------------
90
91
  /** Remove any dn_live_* or dn_test_* tokens from error messages. */
91
92
  function scrubCredentials(msg) {
92
- return msg.replace(/dn_(live|test)_[A-Za-z0-9_-]+/g, "dn_$1_***REDACTED***");
93
+ return msg.replace(/dn_(live|test|proxy)_[A-Za-z0-9_-]+/g, "dn_$1_***REDACTED***");
93
94
  }
94
95
  function safeError(err) {
95
96
  const raw = err instanceof Error ? err.message : String(err);
@@ -101,7 +102,8 @@ function safeError(err) {
101
102
  function truncate(text, max = MAX_RESPONSE_CHARS) {
102
103
  if (text.length <= max)
103
104
  return text;
104
- return text.slice(0, max) + `\n\n... [truncated, ${text.length - max} chars omitted]`;
105
+ return (text.slice(0, max) +
106
+ `\n\n... [truncated, ${text.length - max} chars omitted]`);
105
107
  }
106
108
  // ---------------------------------------------------------------------------
107
109
  // SSRF Protection
@@ -387,12 +389,71 @@ class DominusNodeToolkit {
387
389
  this.token = null;
388
390
  this.tokenExpiresAt = 0;
389
391
  this.apiKey = options.apiKey || process.env.DOMINUSNODE_API_KEY || "";
390
- this.baseUrl = (options.baseUrl || process.env.DOMINUSNODE_BASE_URL || "https://api.dominusnode.com").replace(/\/+$/, "");
391
- this.proxyHost = options.proxyHost || process.env.DOMINUSNODE_PROXY_HOST || "proxy.dominusnode.com";
392
+ this.baseUrl = (options.baseUrl ||
393
+ process.env.DOMINUSNODE_BASE_URL ||
394
+ "https://api.dominusnode.com").replace(/\/+$/, "");
395
+ this.proxyHost =
396
+ options.proxyHost ||
397
+ process.env.DOMINUSNODE_PROXY_HOST ||
398
+ "proxy.dominusnode.com";
392
399
  const portVal = Number(options.proxyPort || process.env.DOMINUSNODE_PROXY_PORT || 8080);
393
- this.proxyPort = isNaN(portVal) || portVal < 1 || portVal > 65535 ? 8080 : portVal;
400
+ this.proxyPort =
401
+ isNaN(portVal) || portVal < 1 || portVal > 65535 ? 8080 : portVal;
394
402
  this.timeout = options.timeout || 30000;
395
- this.agentSecret = options.agentSecret || process.env.DOMINUSNODE_AGENT_SECRET;
403
+ this.agentSecret =
404
+ options.agentSecret || process.env.DOMINUSNODE_AGENT_SECRET;
405
+ }
406
+ // -----------------------------------------------------------------------
407
+ // SHA-256 Proof-of-Work solver
408
+ // -----------------------------------------------------------------------
409
+ static _countLeadingZeroBits(buf) {
410
+ let count = 0;
411
+ for (const byte of buf) {
412
+ if (byte === 0) {
413
+ count += 8;
414
+ continue;
415
+ }
416
+ let mask = 0x80;
417
+ while (mask && !(byte & mask)) {
418
+ count++;
419
+ mask >>= 1;
420
+ }
421
+ break;
422
+ }
423
+ return count;
424
+ }
425
+ async _solvePoW() {
426
+ try {
427
+ const resp = await fetch(`${this.baseUrl}/api/auth/pow/challenge`, {
428
+ method: "POST",
429
+ headers: { "Content-Type": "application/json" },
430
+ redirect: "error",
431
+ });
432
+ if (!resp.ok)
433
+ return null;
434
+ const text = await resp.text();
435
+ if (text.length > 10485760)
436
+ return null;
437
+ const challenge = JSON.parse(text);
438
+ const prefix = challenge.prefix ?? "";
439
+ const difficulty = challenge.difficulty ?? 20;
440
+ const challengeId = challenge.challengeId ?? "";
441
+ if (!prefix || !challengeId)
442
+ return null;
443
+ for (let nonce = 0; nonce < 100000000; nonce++) {
444
+ const hash = crypto
445
+ .createHash("sha256")
446
+ .update(prefix + nonce.toString())
447
+ .digest();
448
+ if (DominusNodeToolkit._countLeadingZeroBits(hash) >= difficulty) {
449
+ return { challengeId, nonce: nonce.toString() };
450
+ }
451
+ }
452
+ return null;
453
+ }
454
+ catch {
455
+ return null;
456
+ }
396
457
  }
397
458
  // -----------------------------------------------------------------------
398
459
  // Authentication
@@ -401,7 +462,8 @@ class DominusNodeToolkit {
401
462
  if (!this.apiKey) {
402
463
  throw new Error("Dominus Node API key is required. Pass apiKey in options or set DOMINUSNODE_API_KEY env var.");
403
464
  }
404
- if (!this.apiKey.startsWith("dn_live_") && !this.apiKey.startsWith("dn_test_")) {
465
+ if (!this.apiKey.startsWith("dn_live_") &&
466
+ !this.apiKey.startsWith("dn_test_")) {
405
467
  throw new Error('DOMINUSNODE_API_KEY must start with "dn_live_" or "dn_test_".');
406
468
  }
407
469
  const authHeaders = {
@@ -606,7 +668,9 @@ class DominusNodeToolkit {
606
668
  if (!ALLOWED_METHODS.has(methodUpper)) {
607
669
  return `Error: HTTP method "${methodUpper}" is not allowed. Only GET, HEAD, and OPTIONS are permitted.`;
608
670
  }
609
- if (proxyType !== "dc" && proxyType !== "residential" && proxyType !== "auto") {
671
+ if (proxyType !== "dc" &&
672
+ proxyType !== "residential" &&
673
+ proxyType !== "auto") {
610
674
  return "Error: proxyType must be 'dc', 'residential', or 'auto'.";
611
675
  }
612
676
  const apiKey = this.apiKey;
@@ -674,13 +738,19 @@ class DominusNodeToolkit {
674
738
  return;
675
739
  }
676
740
  const hdr = raw.substring(0, hEnd);
677
- const respBody = raw.substring(hEnd + 4).substring(0, MAX_PROXY_RESPONSE_BYTES);
678
- const sm = hdr.split("\r\n")[0].match(/^HTTP\/\d\.\d\s+(\d+)/);
741
+ const respBody = raw
742
+ .substring(hEnd + 4)
743
+ .substring(0, MAX_PROXY_RESPONSE_BYTES);
744
+ const sm = hdr
745
+ .split("\r\n")[0]
746
+ .match(/^HTTP\/\d\.\d\s+(\d+)/);
679
747
  const hdrs = {};
680
748
  for (const l of hdr.split("\r\n").slice(1)) {
681
749
  const ci = l.indexOf(":");
682
750
  if (ci > 0)
683
- hdrs[l.substring(0, ci).trim().toLowerCase()] = l.substring(ci + 1).trim();
751
+ hdrs[l.substring(0, ci).trim().toLowerCase()] = l
752
+ .substring(ci + 1)
753
+ .trim();
684
754
  }
685
755
  resolve({
686
756
  status: sm ? parseInt(sm[1], 10) : 0,
@@ -731,13 +801,19 @@ class DominusNodeToolkit {
731
801
  return;
732
802
  done = true;
733
803
  clearTimeout(timer);
734
- const respBody = Buffer.concat(chunks).toString("utf-8").substring(0, MAX_PROXY_RESPONSE_BYTES);
804
+ const respBody = Buffer.concat(chunks)
805
+ .toString("utf-8")
806
+ .substring(0, MAX_PROXY_RESPONSE_BYTES);
735
807
  const hdrs = {};
736
808
  for (const [k, v] of Object.entries(res.headers)) {
737
809
  if (v)
738
810
  hdrs[k] = Array.isArray(v) ? v.join(", ") : v;
739
811
  }
740
- resolve({ status: res.statusCode ?? 0, headers: hdrs, body: respBody });
812
+ resolve({
813
+ status: res.statusCode ?? 0,
814
+ headers: hdrs,
815
+ body: respBody,
816
+ });
741
817
  };
742
818
  res.on("end", fin);
743
819
  res.on("close", fin);
@@ -759,7 +835,13 @@ class DominusNodeToolkit {
759
835
  "",
760
836
  ];
761
837
  if (result.headers) {
762
- const showHeaders = ["content-type", "content-length", "server", "x-cache", "cache-control"];
838
+ const showHeaders = [
839
+ "content-type",
840
+ "content-length",
841
+ "server",
842
+ "x-cache",
843
+ "cache-control",
844
+ ];
763
845
  for (const h of showHeaders) {
764
846
  if (result.headers[h]) {
765
847
  lines.push(`${h}: ${result.headers[h]}`);
@@ -899,7 +981,9 @@ class DominusNodeToolkit {
899
981
  spendingLimitCents: limitCents,
900
982
  };
901
983
  if (dailyLimitCents !== undefined && dailyLimitCents !== null) {
902
- if (!Number.isInteger(dailyLimitCents) || dailyLimitCents < 1 || dailyLimitCents > 1000000) {
984
+ if (!Number.isInteger(dailyLimitCents) ||
985
+ dailyLimitCents < 1 ||
986
+ dailyLimitCents > 1000000) {
903
987
  return "Error: daily_limit_cents must be an integer between 1 and 1,000,000.";
904
988
  }
905
989
  body.dailyLimitCents = dailyLimitCents;
@@ -949,7 +1033,9 @@ class DominusNodeToolkit {
949
1033
  body.dailyLimitCents = null;
950
1034
  }
951
1035
  else {
952
- if (!Number.isInteger(dailyLimitCents) || dailyLimitCents < 1 || dailyLimitCents > 1000000) {
1036
+ if (!Number.isInteger(dailyLimitCents) ||
1037
+ dailyLimitCents < 1 ||
1038
+ dailyLimitCents > 1000000) {
953
1039
  return "Error: daily_limit_cents must be an integer between 1 and 1,000,000, or null to remove.";
954
1040
  }
955
1041
  body.dailyLimitCents = dailyLimitCents;
@@ -1006,7 +1092,9 @@ class DominusNodeToolkit {
1006
1092
  async fundAgenticWallet(walletId, amountCents) {
1007
1093
  try {
1008
1094
  const wid = validateUuid(walletId, "wallet_id");
1009
- if (!Number.isInteger(amountCents) || amountCents < 100 || amountCents > 1000000) {
1095
+ if (!Number.isInteger(amountCents) ||
1096
+ amountCents < 100 ||
1097
+ amountCents > 1000000) {
1010
1098
  return "Error: amount_cents must be an integer between 100 ($1) and 1000000 ($10,000).";
1011
1099
  }
1012
1100
  const data = await this._requestWithRetry("POST", `/api/agent-wallet/${encodeURIComponent(wid)}/fund`, {
@@ -1060,7 +1148,9 @@ class DominusNodeToolkit {
1060
1148
  }
1061
1149
  const lines = [`Agentic Wallets (${wallets.length})`, ""];
1062
1150
  for (const w of wallets) {
1063
- const limit = w.spendingLimitCents > 0 ? `${formatCents(w.spendingLimitCents)}/tx` : "none";
1151
+ const limit = w.spendingLimitCents > 0
1152
+ ? `${formatCents(w.spendingLimitCents)}/tx`
1153
+ : "none";
1064
1154
  lines.push(` ${w.label} (${w.id.slice(0, 8)}...)`);
1065
1155
  lines.push(` Balance: ${formatCents(w.balanceCents)} | Limit: ${limit} | Status: ${w.status}`);
1066
1156
  lines.push("");
@@ -1086,7 +1176,9 @@ class DominusNodeToolkit {
1086
1176
  const lines = [`Wallet Transactions (${txs.length})`, ""];
1087
1177
  for (const tx of txs) {
1088
1178
  const sign = tx.type === "fund" || tx.type === "refund" ? "+" : "-";
1089
- const session = tx.sessionId ? ` | Session: ${tx.sessionId.slice(0, 8)}` : "";
1179
+ const session = tx.sessionId
1180
+ ? ` | Session: ${tx.sessionId.slice(0, 8)}`
1181
+ : "";
1090
1182
  lines.push(` ${sign}${formatCents(tx.amountCents)} [${tx.type}] ${tx.description}`);
1091
1183
  lines.push(` ${tx.createdAt}${session}`);
1092
1184
  }
@@ -1173,7 +1265,9 @@ class DominusNodeToolkit {
1173
1265
  }
1174
1266
  const body = { name: name.trim() };
1175
1267
  if (maxMembers !== undefined) {
1176
- if (!Number.isInteger(maxMembers) || maxMembers < 1 || maxMembers > 100) {
1268
+ if (!Number.isInteger(maxMembers) ||
1269
+ maxMembers < 1 ||
1270
+ maxMembers > 100) {
1177
1271
  return "Error: max_members must be an integer between 1 and 100.";
1178
1272
  }
1179
1273
  body.maxMembers = maxMembers;
@@ -1255,7 +1349,9 @@ class DominusNodeToolkit {
1255
1349
  async teamFund(teamId, amountCents) {
1256
1350
  try {
1257
1351
  const tid = validateUuid(teamId, "team_id");
1258
- if (!Number.isInteger(amountCents) || amountCents < 100 || amountCents > 1000000) {
1352
+ if (!Number.isInteger(amountCents) ||
1353
+ amountCents < 100 ||
1354
+ amountCents > 1000000) {
1259
1355
  return "Error: amount_cents must be an integer between 100 ($1) and 1000000 ($10,000).";
1260
1356
  }
1261
1357
  const data = await this._requestWithRetry("POST", `/api/teams/${encodeURIComponent(tid)}/wallet/fund`, {
@@ -1351,7 +1447,9 @@ class DominusNodeToolkit {
1351
1447
  body.name = name.trim();
1352
1448
  }
1353
1449
  if (maxMembers !== undefined) {
1354
- if (!Number.isInteger(maxMembers) || maxMembers < 1 || maxMembers > 100) {
1450
+ if (!Number.isInteger(maxMembers) ||
1451
+ maxMembers < 1 ||
1452
+ maxMembers > 100) {
1355
1453
  return "Error: max_members must be an integer between 1 and 100.";
1356
1454
  }
1357
1455
  body.maxMembers = maxMembers;
@@ -1403,7 +1501,9 @@ class DominusNodeToolkit {
1403
1501
  // -----------------------------------------------------------------------
1404
1502
  async topupPaypal(amountCents) {
1405
1503
  try {
1406
- if (!Number.isInteger(amountCents) || amountCents < 500 || amountCents > 100000) {
1504
+ if (!Number.isInteger(amountCents) ||
1505
+ amountCents < 500 ||
1506
+ amountCents > 100000) {
1407
1507
  return "Error: amount_cents must be an integer between 500 ($5) and 100000 ($1,000).";
1408
1508
  }
1409
1509
  const data = await this._requestWithRetry("POST", "/api/wallet/topup/paypal", { amountCents });
@@ -1427,7 +1527,9 @@ class DominusNodeToolkit {
1427
1527
  // -----------------------------------------------------------------------
1428
1528
  async topupStripe(amountCents) {
1429
1529
  try {
1430
- if (!Number.isInteger(amountCents) || amountCents < 500 || amountCents > 100000) {
1530
+ if (!Number.isInteger(amountCents) ||
1531
+ amountCents < 500 ||
1532
+ amountCents > 100000) {
1431
1533
  return "Error: amount_cents must be an integer between 500 ($5) and 100000 ($1,000).";
1432
1534
  }
1433
1535
  const data = await this._requestWithRetry("POST", "/api/wallet/topup/stripe", { amountCents });
@@ -1448,7 +1550,10 @@ class DominusNodeToolkit {
1448
1550
  }
1449
1551
  async topupCrypto(amountUsd, currency) {
1450
1552
  try {
1451
- if (typeof amountUsd !== "number" || !Number.isFinite(amountUsd) || amountUsd < 5 || amountUsd > 1000) {
1553
+ if (typeof amountUsd !== "number" ||
1554
+ !Number.isFinite(amountUsd) ||
1555
+ amountUsd < 5 ||
1556
+ amountUsd > 1000) {
1452
1557
  return "Error: amount_usd must be a number between 5 and 1,000.";
1453
1558
  }
1454
1559
  const cur = String(currency ?? "").toLowerCase();
@@ -1490,10 +1595,7 @@ class DominusNodeToolkit {
1490
1595
  async getProxyStatus() {
1491
1596
  try {
1492
1597
  const data = await this._requestWithRetry("GET", "/api/proxy/status");
1493
- const lines = [
1494
- "Proxy Status",
1495
- "",
1496
- ];
1598
+ const lines = ["Proxy Status", ""];
1497
1599
  if (data.status)
1498
1600
  lines.push(`Status: ${data.status}`);
1499
1601
  if (data.uptime !== undefined)
@@ -1524,7 +1626,9 @@ class DominusNodeToolkit {
1524
1626
  }
1525
1627
  const lines = [`Wallet Transactions (${txs.length})`, ""];
1526
1628
  for (const tx of txs) {
1527
- const sign = tx.type === "topup" || tx.type === "fund" || tx.type === "refund" ? "+" : "-";
1629
+ const sign = tx.type === "topup" || tx.type === "fund" || tx.type === "refund"
1630
+ ? "+"
1631
+ : "-";
1528
1632
  lines.push(` ${sign}${formatCents(tx.amountCents)} [${tx.type}] ${tx.description}`);
1529
1633
  lines.push(` ${tx.createdAt}`);
1530
1634
  }
@@ -1638,7 +1742,12 @@ class DominusNodeToolkit {
1638
1742
  if (!password || password.length < 8 || password.length > 128) {
1639
1743
  return "Error: password must be between 8 and 128 characters.";
1640
1744
  }
1641
- const data = await this._unauthenticatedRequest("POST", "/api/auth/register", { email, password });
1745
+ // Solve PoW for CAPTCHA-free registration
1746
+ const pow = await this._solvePoW();
1747
+ const regBody = { email, password };
1748
+ if (pow)
1749
+ regBody.pow = pow;
1750
+ const data = await this._unauthenticatedRequest("POST", "/api/auth/register", regBody);
1642
1751
  return [
1643
1752
  "Account Created",
1644
1753
  "",
@@ -1904,7 +2013,9 @@ class DominusNodeToolkit {
1904
2013
  "",
1905
2014
  `New Plan: ${data.name ?? data.id ?? planId}`,
1906
2015
  data.message ? `Message: ${data.message}` : "",
1907
- ].filter(Boolean).join("\n");
2016
+ ]
2017
+ .filter(Boolean)
2018
+ .join("\n");
1908
2019
  }
1909
2020
  catch (err) {
1910
2021
  return `Error: ${safeError(err)}`;
@@ -2065,7 +2176,9 @@ class DominusNodeToolkit {
2065
2176
  `Email: ${data.email ?? email}`,
2066
2177
  `Role: ${data.role ?? role ?? "member"}`,
2067
2178
  data.expiresAt ? `Expires: ${data.expiresAt}` : "",
2068
- ].filter(Boolean).join("\n");
2179
+ ]
2180
+ .filter(Boolean)
2181
+ .join("\n");
2069
2182
  }
2070
2183
  catch (err) {
2071
2184
  return `Error: ${safeError(err)}`;
@@ -2113,6 +2226,67 @@ class DominusNodeToolkit {
2113
2226
  }
2114
2227
  }
2115
2228
  // -----------------------------------------------------------------------
2229
+ // MPP (Machine Payment Protocol) tools
2230
+ // -----------------------------------------------------------------------
2231
+ async mppInfo() {
2232
+ try {
2233
+ const data = await this._requestWithRetry("GET", "/api/mpp/info");
2234
+ return JSON.stringify(data, null, 2);
2235
+ }
2236
+ catch (err) {
2237
+ return `Error: ${safeError(err)}`;
2238
+ }
2239
+ }
2240
+ async payMpp(amountCents, method) {
2241
+ if (!Number.isInteger(amountCents) ||
2242
+ amountCents < 500 ||
2243
+ amountCents > 100000) {
2244
+ return "Error: amount_cents must be an integer between 500 and 100,000";
2245
+ }
2246
+ if (!["tempo", "stripe_spt", "lightning"].includes(method)) {
2247
+ return "Error: method must be one of: tempo, stripe_spt, lightning";
2248
+ }
2249
+ try {
2250
+ const data = await this._requestWithRetry("POST", "/api/mpp/topup", { amountCents, method });
2251
+ return JSON.stringify(data, null, 2);
2252
+ }
2253
+ catch (err) {
2254
+ return `Error: ${safeError(err)}`;
2255
+ }
2256
+ }
2257
+ async mppSessionOpen(maxDepositCents, method, poolType = "dc") {
2258
+ if (!Number.isInteger(maxDepositCents) ||
2259
+ maxDepositCents < 500 ||
2260
+ maxDepositCents > 100000) {
2261
+ return "Error: max_deposit_cents must be an integer between 500 and 100,000";
2262
+ }
2263
+ if (!["tempo", "stripe_spt", "lightning"].includes(method)) {
2264
+ return "Error: method must be one of: tempo, stripe_spt, lightning";
2265
+ }
2266
+ if (!["dc", "residential"].includes(poolType)) {
2267
+ return "Error: pool_type must be dc or residential";
2268
+ }
2269
+ try {
2270
+ const data = await this._requestWithRetry("POST", "/api/mpp/session/open", { maxDepositCents, method, poolType });
2271
+ return JSON.stringify(data, null, 2);
2272
+ }
2273
+ catch (err) {
2274
+ return `Error: ${safeError(err)}`;
2275
+ }
2276
+ }
2277
+ async mppSessionClose(channelId) {
2278
+ if (!channelId) {
2279
+ return "Error: channel_id is required";
2280
+ }
2281
+ try {
2282
+ const data = await this._requestWithRetry("POST", "/api/mpp/session/close", { channelId });
2283
+ return JSON.stringify(data, null, 2);
2284
+ }
2285
+ catch (err) {
2286
+ return `Error: ${safeError(err)}`;
2287
+ }
2288
+ }
2289
+ // -----------------------------------------------------------------------
2116
2290
  // getTools() -- returns LangChain DynamicStructuredTool[] for Flowise
2117
2291
  // -----------------------------------------------------------------------
2118
2292
  getTools() {
@@ -2124,11 +2298,20 @@ class DominusNodeToolkit {
2124
2298
  "by country. Returns status code, headers, and response body (truncated).",
2125
2299
  schema: zod_1.z.object({
2126
2300
  url: zod_1.z.string().describe("The target URL to fetch (http or https)"),
2127
- method: zod_1.z.enum(["GET", "HEAD", "OPTIONS"]).default("GET").describe("HTTP method"),
2128
- country: zod_1.z.string().optional().describe("ISO 3166-1 alpha-2 country code for geo-targeting (e.g., US, GB, DE)"),
2129
- proxyType: zod_1.z.enum(["dc", "residential"]).default("dc").describe("Proxy pool: dc ($3/GB) or residential ($5/GB)"),
2301
+ method: zod_1.z
2302
+ .enum(["GET", "HEAD", "OPTIONS"])
2303
+ .default("GET")
2304
+ .describe("HTTP method"),
2305
+ country: zod_1.z
2306
+ .string()
2307
+ .optional()
2308
+ .describe("ISO 3166-1 alpha-2 country code for geo-targeting (e.g., US, GB, DE)"),
2309
+ proxyType: zod_1.z
2310
+ .enum(["dc", "residential"])
2311
+ .default("dc")
2312
+ .describe("Proxy pool: dc ($3/GB) or residential ($5/GB)"),
2130
2313
  }),
2131
- func: async ({ url, method, country, proxyType }) => {
2314
+ func: async ({ url, method, country, proxyType, }) => {
2132
2315
  return this.proxiedFetch(url, method, country, proxyType);
2133
2316
  },
2134
2317
  }),
@@ -2146,7 +2329,12 @@ class DominusNodeToolkit {
2146
2329
  name: "dominusnode_check_usage",
2147
2330
  description: "View bandwidth usage statistics for a specified time period. Shows total bytes, cost, and request count.",
2148
2331
  schema: zod_1.z.object({
2149
- days: zod_1.z.number().min(1).max(365).default(30).describe("Number of days to look back (1-365)"),
2332
+ days: zod_1.z
2333
+ .number()
2334
+ .min(1)
2335
+ .max(365)
2336
+ .default(30)
2337
+ .describe("Number of days to look back (1-365)"),
2150
2338
  }),
2151
2339
  func: async ({ days }) => {
2152
2340
  return this.checkUsage(days);
@@ -2176,7 +2364,11 @@ class DominusNodeToolkit {
2176
2364
  description: "Create a server-side custodial agentic wallet for autonomous proxy billing. " +
2177
2365
  "Set a spending limit per transaction for safety. Optionally set a daily budget cap and domain allowlist.",
2178
2366
  schema: zod_1.z.object({
2179
- label: zod_1.z.string().min(1).max(100).describe('Label for this wallet (e.g., "scraper-bot")'),
2367
+ label: zod_1.z
2368
+ .string()
2369
+ .min(1)
2370
+ .max(100)
2371
+ .describe('Label for this wallet (e.g., "scraper-bot")'),
2180
2372
  spendingLimitCents: zod_1.z
2181
2373
  .number()
2182
2374
  .int()
@@ -2197,7 +2389,7 @@ class DominusNodeToolkit {
2197
2389
  .optional()
2198
2390
  .describe("Optional list of allowed domains for proxy access (max 100 entries)"),
2199
2391
  }),
2200
- func: async ({ label, spendingLimitCents, dailyLimitCents, allowedDomains }) => {
2392
+ func: async ({ label, spendingLimitCents, dailyLimitCents, allowedDomains, }) => {
2201
2393
  return this.createAgenticWallet(label, spendingLimitCents, dailyLimitCents, allowedDomains);
2202
2394
  },
2203
2395
  }),
@@ -2207,7 +2399,12 @@ class DominusNodeToolkit {
2207
2399
  description: "Transfer funds from your main wallet to an agentic wallet. Min $1, max $10,000.",
2208
2400
  schema: zod_1.z.object({
2209
2401
  walletId: zod_1.z.string().uuid().describe("Agentic wallet ID (UUID)"),
2210
- amountCents: zod_1.z.number().int().min(100).max(1000000).describe("Amount in cents to transfer"),
2402
+ amountCents: zod_1.z
2403
+ .number()
2404
+ .int()
2405
+ .min(100)
2406
+ .max(1000000)
2407
+ .describe("Amount in cents to transfer"),
2211
2408
  }),
2212
2409
  func: async ({ walletId, amountCents }) => {
2213
2410
  return this.fundAgenticWallet(walletId, amountCents);
@@ -2239,7 +2436,13 @@ class DominusNodeToolkit {
2239
2436
  description: "Get transaction history for an agentic wallet.",
2240
2437
  schema: zod_1.z.object({
2241
2438
  walletId: zod_1.z.string().uuid().describe("Agentic wallet ID (UUID)"),
2242
- limit: zod_1.z.number().int().min(1).max(100).default(20).describe("Number of transactions to return"),
2439
+ limit: zod_1.z
2440
+ .number()
2441
+ .int()
2442
+ .min(1)
2443
+ .max(100)
2444
+ .default(20)
2445
+ .describe("Number of transactions to return"),
2243
2446
  }),
2244
2447
  func: async ({ walletId, limit }) => {
2245
2448
  return this.agenticTransactions(walletId, limit);
@@ -2299,7 +2502,7 @@ class DominusNodeToolkit {
2299
2502
  .optional()
2300
2503
  .describe("List of allowed domains (max 100). Set null to remove restriction."),
2301
2504
  }),
2302
- func: async ({ walletId, dailyLimitCents, allowedDomains }) => {
2505
+ func: async ({ walletId, dailyLimitCents, allowedDomains, }) => {
2303
2506
  return this.updateWalletPolicy(walletId, dailyLimitCents, allowedDomains);
2304
2507
  },
2305
2508
  }),
@@ -2308,8 +2511,18 @@ class DominusNodeToolkit {
2308
2511
  name: "dominusnode_create_team",
2309
2512
  description: "Create a new team with shared wallet billing. Teams let multiple users share proxy access.",
2310
2513
  schema: zod_1.z.object({
2311
- name: zod_1.z.string().min(1).max(100).describe("Team name (1-100 characters)"),
2312
- maxMembers: zod_1.z.number().int().min(1).max(100).optional().describe("Maximum team members (1-100, optional)"),
2514
+ name: zod_1.z
2515
+ .string()
2516
+ .min(1)
2517
+ .max(100)
2518
+ .describe("Team name (1-100 characters)"),
2519
+ maxMembers: zod_1.z
2520
+ .number()
2521
+ .int()
2522
+ .min(1)
2523
+ .max(100)
2524
+ .optional()
2525
+ .describe("Maximum team members (1-100, optional)"),
2313
2526
  }),
2314
2527
  func: async ({ name, maxMembers }) => {
2315
2528
  return this.createTeam(name, maxMembers);
@@ -2341,7 +2554,12 @@ class DominusNodeToolkit {
2341
2554
  description: "Transfer funds from your personal wallet to a team wallet. Min $1, max $10,000.",
2342
2555
  schema: zod_1.z.object({
2343
2556
  teamId: zod_1.z.string().uuid().describe("Team ID (UUID)"),
2344
- amountCents: zod_1.z.number().int().min(100).max(1000000).describe("Amount in cents to transfer"),
2557
+ amountCents: zod_1.z
2558
+ .number()
2559
+ .int()
2560
+ .min(100)
2561
+ .max(1000000)
2562
+ .describe("Amount in cents to transfer"),
2345
2563
  }),
2346
2564
  func: async ({ teamId, amountCents }) => {
2347
2565
  return this.teamFund(teamId, amountCents);
@@ -2354,7 +2572,11 @@ class DominusNodeToolkit {
2354
2572
  "The key is shown only once.",
2355
2573
  schema: zod_1.z.object({
2356
2574
  teamId: zod_1.z.string().uuid().describe("Team ID (UUID)"),
2357
- label: zod_1.z.string().min(1).max(100).describe('Label for the API key (e.g., "production")'),
2575
+ label: zod_1.z
2576
+ .string()
2577
+ .min(1)
2578
+ .max(100)
2579
+ .describe('Label for the API key (e.g., "production")'),
2358
2580
  }),
2359
2581
  func: async ({ teamId, label }) => {
2360
2582
  return this.teamCreateKey(teamId, label);
@@ -2366,7 +2588,13 @@ class DominusNodeToolkit {
2366
2588
  description: "Get the team wallet transaction history (funding, usage charges, refunds).",
2367
2589
  schema: zod_1.z.object({
2368
2590
  teamId: zod_1.z.string().uuid().describe("Team ID (UUID)"),
2369
- limit: zod_1.z.number().int().min(1).max(100).default(20).describe("Number of transactions to return"),
2591
+ limit: zod_1.z
2592
+ .number()
2593
+ .int()
2594
+ .min(1)
2595
+ .max(100)
2596
+ .default(20)
2597
+ .describe("Number of transactions to return"),
2370
2598
  }),
2371
2599
  func: async ({ teamId, limit }) => {
2372
2600
  return this.teamUsage(teamId, limit);
@@ -2379,7 +2607,13 @@ class DominusNodeToolkit {
2379
2607
  schema: zod_1.z.object({
2380
2608
  teamId: zod_1.z.string().uuid().describe("Team ID (UUID)"),
2381
2609
  name: zod_1.z.string().min(1).max(100).optional().describe("New team name"),
2382
- maxMembers: zod_1.z.number().int().min(1).max(100).optional().describe("New max member count"),
2610
+ maxMembers: zod_1.z
2611
+ .number()
2612
+ .int()
2613
+ .min(1)
2614
+ .max(100)
2615
+ .optional()
2616
+ .describe("New max member count"),
2383
2617
  }),
2384
2618
  func: async ({ teamId, name, maxMembers }) => {
2385
2619
  return this.updateTeam(teamId, name, maxMembers);
@@ -2404,7 +2638,12 @@ class DominusNodeToolkit {
2404
2638
  description: "Top up your Dominus Node wallet via PayPal. Creates a PayPal order and returns an " +
2405
2639
  "approval URL. Minimum $5, maximum $1,000.",
2406
2640
  schema: zod_1.z.object({
2407
- amountCents: zod_1.z.number().int().min(500).max(100000).describe("Amount in cents to top up (min 500 = $5)"),
2641
+ amountCents: zod_1.z
2642
+ .number()
2643
+ .int()
2644
+ .min(500)
2645
+ .max(100000)
2646
+ .describe("Amount in cents to top up (min 500 = $5)"),
2408
2647
  }),
2409
2648
  func: async ({ amountCents }) => {
2410
2649
  return this.topupPaypal(amountCents);
@@ -2416,7 +2655,12 @@ class DominusNodeToolkit {
2416
2655
  description: "Top up your Dominus Node wallet via Stripe. Creates a Stripe checkout session and returns " +
2417
2656
  "a checkout URL. Minimum $5 (500 cents), maximum $1,000 (100000 cents).",
2418
2657
  schema: zod_1.z.object({
2419
- amountCents: zod_1.z.number().int().min(500).max(100000).describe("Amount in cents to top up (min 500 = $5)"),
2658
+ amountCents: zod_1.z
2659
+ .number()
2660
+ .int()
2661
+ .min(500)
2662
+ .max(100000)
2663
+ .describe("Amount in cents to top up (min 500 = $5)"),
2420
2664
  }),
2421
2665
  func: async ({ amountCents }) => {
2422
2666
  return this.topupStripe(amountCents);
@@ -2429,8 +2673,25 @@ class DominusNodeToolkit {
2429
2673
  "Supports BTC, ETH, LTC, XMR, ZEC, USDC, SOL, USDT, DAI, BNB, LINK. " +
2430
2674
  "Minimum $5, maximum $1,000.",
2431
2675
  schema: zod_1.z.object({
2432
- amountUsd: zod_1.z.number().min(5).max(1000).describe("Amount in USD to top up (5-1000)"),
2433
- currency: zod_1.z.enum(["btc", "eth", "ltc", "xmr", "zec", "usdc", "sol", "usdt", "dai", "bnb", "link"])
2676
+ amountUsd: zod_1.z
2677
+ .number()
2678
+ .min(5)
2679
+ .max(1000)
2680
+ .describe("Amount in USD to top up (5-1000)"),
2681
+ currency: zod_1.z
2682
+ .enum([
2683
+ "btc",
2684
+ "eth",
2685
+ "ltc",
2686
+ "xmr",
2687
+ "zec",
2688
+ "usdc",
2689
+ "sol",
2690
+ "usdt",
2691
+ "dai",
2692
+ "bnb",
2693
+ "link",
2694
+ ])
2434
2695
  .describe("Cryptocurrency to pay with"),
2435
2696
  }),
2436
2697
  func: async ({ amountUsd, currency }) => {
@@ -2461,7 +2722,13 @@ class DominusNodeToolkit {
2461
2722
  name: "dominusnode_get_transactions",
2462
2723
  description: "Get wallet transaction history including top-ups, usage charges, and refunds.",
2463
2724
  schema: zod_1.z.object({
2464
- limit: zod_1.z.number().int().min(1).max(100).default(20).describe("Number of transactions to return (1-100)"),
2725
+ limit: zod_1.z
2726
+ .number()
2727
+ .int()
2728
+ .min(1)
2729
+ .max(100)
2730
+ .default(20)
2731
+ .describe("Number of transactions to return (1-100)"),
2465
2732
  }),
2466
2733
  func: async ({ limit }) => {
2467
2734
  return this.getTransactions(limit);
@@ -2481,7 +2748,10 @@ class DominusNodeToolkit {
2481
2748
  name: "dominusnode_check_payment",
2482
2749
  description: "Check the status of a cryptocurrency payment invoice. Use after creating a crypto top-up.",
2483
2750
  schema: zod_1.z.object({
2484
- invoiceId: zod_1.z.string().min(1).describe("The invoice ID from the crypto top-up creation"),
2751
+ invoiceId: zod_1.z
2752
+ .string()
2753
+ .min(1)
2754
+ .describe("The invoice ID from the crypto top-up creation"),
2485
2755
  }),
2486
2756
  func: async ({ invoiceId }) => {
2487
2757
  return this.checkPayment(invoiceId);
@@ -2492,7 +2762,13 @@ class DominusNodeToolkit {
2492
2762
  name: "dominusnode_get_daily_usage",
2493
2763
  description: "Get daily usage breakdown showing bandwidth, cost, and request count per day.",
2494
2764
  schema: zod_1.z.object({
2495
- days: zod_1.z.number().int().min(1).max(365).default(7).describe("Number of days to look back (1-365)"),
2765
+ days: zod_1.z
2766
+ .number()
2767
+ .int()
2768
+ .min(1)
2769
+ .max(365)
2770
+ .default(7)
2771
+ .describe("Number of days to look back (1-365)"),
2496
2772
  }),
2497
2773
  func: async ({ days }) => {
2498
2774
  return this.getDailyUsage(days);
@@ -2503,7 +2779,13 @@ class DominusNodeToolkit {
2503
2779
  name: "dominusnode_get_top_hosts",
2504
2780
  description: "Get the top accessed hosts ranked by bandwidth usage. Useful for understanding proxy usage patterns.",
2505
2781
  schema: zod_1.z.object({
2506
- limit: zod_1.z.number().int().min(1).max(100).default(10).describe("Number of top hosts to return (1-100)"),
2782
+ limit: zod_1.z
2783
+ .number()
2784
+ .int()
2785
+ .min(1)
2786
+ .max(100)
2787
+ .default(10)
2788
+ .describe("Number of top hosts to return (1-100)"),
2507
2789
  }),
2508
2790
  func: async ({ limit }) => {
2509
2791
  return this.getTopHosts(limit);
@@ -2515,8 +2797,15 @@ class DominusNodeToolkit {
2515
2797
  description: "Register a new Dominus Node account. Returns user info. " +
2516
2798
  "After registering, verify email or rely on MCP agent auto-verification.",
2517
2799
  schema: zod_1.z.object({
2518
- email: zod_1.z.string().email().describe("Email address for the new account"),
2519
- password: zod_1.z.string().min(8).max(128).describe("Password (min 8, max 128 characters)"),
2800
+ email: zod_1.z
2801
+ .string()
2802
+ .email()
2803
+ .describe("Email address for the new account"),
2804
+ password: zod_1.z
2805
+ .string()
2806
+ .min(8)
2807
+ .max(128)
2808
+ .describe("Password (min 8, max 128 characters)"),
2520
2809
  }),
2521
2810
  func: async ({ email, password }) => {
2522
2811
  return this.register(email, password);
@@ -2550,7 +2839,10 @@ class DominusNodeToolkit {
2550
2839
  description: "Verify email address using the verification token sent to email. " +
2551
2840
  "MCP agents are auto-verified via agent headers.",
2552
2841
  schema: zod_1.z.object({
2553
- token: zod_1.z.string().min(1).describe("Email verification token from the verification email"),
2842
+ token: zod_1.z
2843
+ .string()
2844
+ .min(1)
2845
+ .describe("Email verification token from the verification email"),
2554
2846
  }),
2555
2847
  func: async ({ token }) => {
2556
2848
  return this.verifyEmail(token);
@@ -2570,8 +2862,15 @@ class DominusNodeToolkit {
2570
2862
  name: "dominusnode_update_password",
2571
2863
  description: "Change the password for the current Dominus Node account. Requires the current password.",
2572
2864
  schema: zod_1.z.object({
2573
- currentPassword: zod_1.z.string().min(1).describe("Current account password"),
2574
- newPassword: zod_1.z.string().min(8).max(128).describe("New password (min 8, max 128 characters)"),
2865
+ currentPassword: zod_1.z
2866
+ .string()
2867
+ .min(1)
2868
+ .describe("Current account password"),
2869
+ newPassword: zod_1.z
2870
+ .string()
2871
+ .min(8)
2872
+ .max(128)
2873
+ .describe("New password (min 8, max 128 characters)"),
2575
2874
  }),
2576
2875
  func: async ({ currentPassword, newPassword }) => {
2577
2876
  return this.updatePassword(currentPassword, newPassword);
@@ -2591,7 +2890,12 @@ class DominusNodeToolkit {
2591
2890
  name: "dominusnode_create_key",
2592
2891
  description: "Create a new API key for the current account. The key is shown only once on creation.",
2593
2892
  schema: zod_1.z.object({
2594
- label: zod_1.z.string().min(1).max(100).optional().describe('Optional label for the API key (e.g., "production")'),
2893
+ label: zod_1.z
2894
+ .string()
2895
+ .min(1)
2896
+ .max(100)
2897
+ .optional()
2898
+ .describe('Optional label for the API key (e.g., "production")'),
2595
2899
  }),
2596
2900
  func: async ({ label }) => {
2597
2901
  return this.createKey(label);
@@ -2688,8 +2992,14 @@ class DominusNodeToolkit {
2688
2992
  description: "Add a member to a team by email address. Optionally specify their role (member or admin).",
2689
2993
  schema: zod_1.z.object({
2690
2994
  teamId: zod_1.z.string().uuid().describe("Team ID (UUID)"),
2691
- email: zod_1.z.string().email().describe("Email address of the user to add"),
2692
- role: zod_1.z.enum(["member", "admin"]).optional().describe("Role for the new member (default: member)"),
2995
+ email: zod_1.z
2996
+ .string()
2997
+ .email()
2998
+ .describe("Email address of the user to add"),
2999
+ role: zod_1.z
3000
+ .enum(["member", "admin"])
3001
+ .optional()
3002
+ .describe("Role for the new member (default: member)"),
2693
3003
  }),
2694
3004
  func: async ({ teamId, email, role }) => {
2695
3005
  return this.teamAddMember(teamId, email, role);
@@ -2701,7 +3011,10 @@ class DominusNodeToolkit {
2701
3011
  description: "Remove a member from a team. Requires owner or admin role. Cannot remove the owner.",
2702
3012
  schema: zod_1.z.object({
2703
3013
  teamId: zod_1.z.string().uuid().describe("Team ID (UUID)"),
2704
- userId: zod_1.z.string().uuid().describe("User ID (UUID) of the member to remove"),
3014
+ userId: zod_1.z
3015
+ .string()
3016
+ .uuid()
3017
+ .describe("User ID (UUID) of the member to remove"),
2705
3018
  }),
2706
3019
  func: async ({ teamId, userId }) => {
2707
3020
  return this.teamRemoveMember(teamId, userId);
@@ -2714,7 +3027,10 @@ class DominusNodeToolkit {
2714
3027
  schema: zod_1.z.object({
2715
3028
  teamId: zod_1.z.string().uuid().describe("Team ID (UUID)"),
2716
3029
  email: zod_1.z.string().email().describe("Email address to invite"),
2717
- role: zod_1.z.enum(["member", "admin"]).optional().describe("Role for the invited member (default: member)"),
3030
+ role: zod_1.z
3031
+ .enum(["member", "admin"])
3032
+ .optional()
3033
+ .describe("Role for the invited member (default: member)"),
2718
3034
  }),
2719
3035
  func: async ({ teamId, email, role }) => {
2720
3036
  return this.teamInviteMember(teamId, email, role);
@@ -2737,12 +3053,82 @@ class DominusNodeToolkit {
2737
3053
  description: "Cancel a pending team invitation. Requires owner or admin role.",
2738
3054
  schema: zod_1.z.object({
2739
3055
  teamId: zod_1.z.string().uuid().describe("Team ID (UUID)"),
2740
- inviteId: zod_1.z.string().uuid().describe("UUID of the invitation to cancel"),
3056
+ inviteId: zod_1.z
3057
+ .string()
3058
+ .uuid()
3059
+ .describe("UUID of the invitation to cancel"),
2741
3060
  }),
2742
3061
  func: async ({ teamId, inviteId }) => {
2743
3062
  return this.teamCancelInvite(teamId, inviteId);
2744
3063
  },
2745
3064
  }),
3065
+ // 53 (MPP). mpp_info
3066
+ new tools_1.DynamicStructuredTool({
3067
+ name: "dominusnode_mpp_info",
3068
+ description: "Get Machine Payment Protocol (MPP) information including enabled status, " +
3069
+ "supported payment methods, pricing, and session limits.",
3070
+ schema: zod_1.z.object({}),
3071
+ func: async () => {
3072
+ return this.mppInfo();
3073
+ },
3074
+ }),
3075
+ // 54 (MPP). pay_mpp
3076
+ new tools_1.DynamicStructuredTool({
3077
+ name: "dominusnode_pay_mpp",
3078
+ description: "Top up wallet via Machine Payment Protocol (MPP). " +
3079
+ "Supports tempo, stripe_spt, and lightning payment methods.",
3080
+ schema: zod_1.z.object({
3081
+ amountCents: zod_1.z
3082
+ .number()
3083
+ .int()
3084
+ .min(500)
3085
+ .max(100000)
3086
+ .describe("Amount in cents to top up (min 500, max 100000)"),
3087
+ method: zod_1.z
3088
+ .enum(["tempo", "stripe_spt", "lightning"])
3089
+ .describe("MPP payment method"),
3090
+ }),
3091
+ func: async ({ amountCents, method }) => {
3092
+ return this.payMpp(amountCents, method);
3093
+ },
3094
+ }),
3095
+ // 55 (MPP). mpp_session_open
3096
+ new tools_1.DynamicStructuredTool({
3097
+ name: "dominusnode_mpp_session_open",
3098
+ description: "Open a pay-as-you-go MPP session. Returns a channelId for metered proxy usage.",
3099
+ schema: zod_1.z.object({
3100
+ maxDepositCents: zod_1.z
3101
+ .number()
3102
+ .int()
3103
+ .min(500)
3104
+ .max(100000)
3105
+ .describe("Maximum deposit in cents"),
3106
+ method: zod_1.z
3107
+ .enum(["tempo", "stripe_spt", "lightning"])
3108
+ .describe("MPP payment method"),
3109
+ poolType: zod_1.z
3110
+ .enum(["dc", "residential"])
3111
+ .default("dc")
3112
+ .describe("Proxy pool type"),
3113
+ }),
3114
+ func: async ({ maxDepositCents, method, poolType, }) => {
3115
+ return this.mppSessionOpen(maxDepositCents, method, poolType);
3116
+ },
3117
+ }),
3118
+ // 56 (MPP). mpp_session_close
3119
+ new tools_1.DynamicStructuredTool({
3120
+ name: "dominusnode_mpp_session_close",
3121
+ description: "Close an MPP pay-as-you-go session. Returns the amount spent and refunded.",
3122
+ schema: zod_1.z.object({
3123
+ channelId: zod_1.z
3124
+ .string()
3125
+ .min(1)
3126
+ .describe("The channelId returned from mpp_session_open"),
3127
+ }),
3128
+ func: async ({ channelId }) => {
3129
+ return this.mppSessionClose(channelId);
3130
+ },
3131
+ }),
2746
3132
  ];
2747
3133
  }
2748
3134
  }
@@ -2751,6 +3137,16 @@ exports.DominusNodeToolkit = DominusNodeToolkit;
2751
3137
  // Tool 24: topupCrypto
2752
3138
  // -----------------------------------------------------------------------
2753
3139
  DominusNodeToolkit.VALID_CRYPTO_CURRENCIES = new Set([
2754
- "btc", "eth", "ltc", "xmr", "zec", "usdc", "sol", "usdt", "dai", "bnb", "link",
3140
+ "btc",
3141
+ "eth",
3142
+ "ltc",
3143
+ "xmr",
3144
+ "zec",
3145
+ "usdc",
3146
+ "sol",
3147
+ "usdt",
3148
+ "dai",
3149
+ "bnb",
3150
+ "link",
2755
3151
  ]);
2756
3152
  //# sourceMappingURL=toolkit.js.map