@dominusnode/mastra-tools 1.0.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/CHANGELOG.md +30 -0
- package/README.md +7 -4
- package/dist/index.d.ts +3 -3
- package/dist/index.js +6 -3
- package/dist/toolkit.d.ts +30 -7
- package/dist/toolkit.js +96 -18
- package/package.json +4 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.1.0
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- Stripe checkout top-up tool (`dominusnode_topup_stripe`) — create Stripe Checkout sessions ($5–$1,000)
|
|
7
|
+
- Crypto top-up tool (`dominusnode_topup_crypto`) — NOWPayments invoices for BTC, ETH, LTC, XMR, ZEC, USDC, SOL, USDT, DAI, BNB, LINK ($5–$1,000)
|
|
8
|
+
- `dominusnode_update_wallet_policy` tool — update daily limits and domain allowlists for agentic wallets
|
|
9
|
+
- Comprehensive test suite: 167 tests covering SSRF protection (incl. DNS rebinding), input validation, credential scrubbing, payment response fields, and all 26 tools
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
- `topupCrypto`: use `Number.isFinite()` instead of `isNaN()` to correctly reject `NaN` and `Infinity` inputs
|
|
13
|
+
|
|
14
|
+
## 1.0.1
|
|
15
|
+
|
|
16
|
+
- Fix branding: replace "DomiNode" with "Dominus Node" throughout
|
|
17
|
+
|
|
18
|
+
## 1.0.0 (2026-02-24)
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- Initial release with 23 Mastra AI tools for Dominus Node proxy service
|
|
23
|
+
- Proxied fetch with full SSRF protection, DNS rebinding, OFAC blocking, and credential scrubbing
|
|
24
|
+
- Wallet balance and usage monitoring tools
|
|
25
|
+
- Proxy configuration and active session listing
|
|
26
|
+
- Agentic wallet management: create, fund, balance, list, transactions, freeze, unfreeze, delete
|
|
27
|
+
- Team management: create, list, details, fund, create key, usage, update, update member role
|
|
28
|
+
- PayPal top-up and x402 micropayment info tools
|
|
29
|
+
- Full security suite: DNS rebinding protection, Teredo/6to4 IPv6 tunnel detection, IPv4-mapped/compatible IPv6 handling, hex/octal/decimal IP normalization, prototype pollution prevention
|
|
30
|
+
- Comprehensive test suite covering SSRF, sanitization, OFAC, HTTP methods, validation, and all 23 tools
|
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# @dominusnode/mastra-tools
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Dominus Node rotating proxy tools for [Mastra AI](https://mastra.ai) agents.
|
|
4
4
|
|
|
5
|
-
Provides
|
|
5
|
+
Provides 26 tools for interacting with Dominus Node's rotating proxy-as-a-service platform from Mastra AI workflows and agents.
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
@@ -35,7 +35,7 @@ const balance = await toolkit.checkBalance();
|
|
|
35
35
|
| `DOMINUSNODE_PROXY_HOST` | Proxy gateway host | `proxy.dominusnode.com` |
|
|
36
36
|
| `DOMINUSNODE_PROXY_PORT` | Proxy gateway port | `8080` |
|
|
37
37
|
|
|
38
|
-
## Available Tools (
|
|
38
|
+
## Available Tools (26)
|
|
39
39
|
|
|
40
40
|
### Proxy Operations
|
|
41
41
|
- `dominusnode_proxied_fetch` - Fetch a URL through the rotating proxy with geo-targeting
|
|
@@ -53,6 +53,7 @@ const balance = await toolkit.checkBalance();
|
|
|
53
53
|
- `dominusnode_freeze_agentic_wallet` - Freeze an agentic wallet
|
|
54
54
|
- `dominusnode_unfreeze_agentic_wallet` - Unfreeze an agentic wallet
|
|
55
55
|
- `dominusnode_delete_agentic_wallet` - Delete an agentic wallet
|
|
56
|
+
- `dominusnode_update_wallet_policy` - Update daily limits and domain restrictions
|
|
56
57
|
|
|
57
58
|
### Team Management
|
|
58
59
|
- `dominusnode_create_team` - Create a team with shared wallet
|
|
@@ -65,7 +66,9 @@ const balance = await toolkit.checkBalance();
|
|
|
65
66
|
- `dominusnode_update_team_member_role` - Change a member's role
|
|
66
67
|
|
|
67
68
|
### Payments
|
|
68
|
-
- `dominusnode_topup_paypal` - Top up wallet via PayPal
|
|
69
|
+
- `dominusnode_topup_paypal` - Top up wallet via PayPal ($5–$1,000)
|
|
70
|
+
- `dominusnode_topup_stripe` - Top up wallet via Stripe ($5–$1,000)
|
|
71
|
+
- `dominusnode_topup_crypto` - Top up wallet via crypto (BTC/ETH/LTC/XMR/ZEC/USDC/SOL/USDT/DAI/BNB/LINK)
|
|
69
72
|
- `dominusnode_x402_info` - Get x402 micropayment protocol info
|
|
70
73
|
|
|
71
74
|
## Security
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @dominusnode/mastra-tools
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* Provides
|
|
4
|
+
* Dominus Node rotating proxy tools for Mastra AI agents.
|
|
5
|
+
* Provides 26 tools for proxy fetching, wallet management,
|
|
6
6
|
* team collaboration, and payment operations.
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
@@ -16,5 +16,5 @@
|
|
|
16
16
|
* const tools = toolkit.getTools();
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
|
-
export { DominusNodeToolkit, isPrivateIp, validateTargetUrl, validateCountry, validateUuid, normalizeIpv4, stripDangerousKeys, scrubCredentials, truncate, formatBytes, formatCents, } from "./toolkit.js";
|
|
19
|
+
export { DominusNodeToolkit, isPrivateIp, validateTargetUrl, validateCountry, validateUuid, normalizeIpv4, stripDangerousKeys, scrubCredentials, truncate, formatBytes, formatCents, checkDnsRebinding, SANCTIONED_COUNTRIES, BLOCKED_HOSTNAMES, } from "./toolkit.js";
|
|
20
20
|
export type { DominusNodeToolkitConfig } from "./toolkit.js";
|
package/dist/index.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* @dominusnode/mastra-tools
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* Provides
|
|
5
|
+
* Dominus Node rotating proxy tools for Mastra AI agents.
|
|
6
|
+
* Provides 26 tools for proxy fetching, wallet management,
|
|
7
7
|
* team collaboration, and payment operations.
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.formatCents = exports.formatBytes = exports.truncate = exports.scrubCredentials = exports.stripDangerousKeys = exports.normalizeIpv4 = exports.validateUuid = exports.validateCountry = exports.validateTargetUrl = exports.isPrivateIp = exports.DominusNodeToolkit = void 0;
|
|
21
|
+
exports.BLOCKED_HOSTNAMES = exports.SANCTIONED_COUNTRIES = exports.checkDnsRebinding = exports.formatCents = exports.formatBytes = exports.truncate = exports.scrubCredentials = exports.stripDangerousKeys = exports.normalizeIpv4 = exports.validateUuid = exports.validateCountry = exports.validateTargetUrl = exports.isPrivateIp = exports.DominusNodeToolkit = void 0;
|
|
22
22
|
var toolkit_js_1 = require("./toolkit.js");
|
|
23
23
|
Object.defineProperty(exports, "DominusNodeToolkit", { enumerable: true, get: function () { return toolkit_js_1.DominusNodeToolkit; } });
|
|
24
24
|
// Security utilities (exported for testing)
|
|
@@ -32,3 +32,6 @@ Object.defineProperty(exports, "scrubCredentials", { enumerable: true, get: func
|
|
|
32
32
|
Object.defineProperty(exports, "truncate", { enumerable: true, get: function () { return toolkit_js_1.truncate; } });
|
|
33
33
|
Object.defineProperty(exports, "formatBytes", { enumerable: true, get: function () { return toolkit_js_1.formatBytes; } });
|
|
34
34
|
Object.defineProperty(exports, "formatCents", { enumerable: true, get: function () { return toolkit_js_1.formatCents; } });
|
|
35
|
+
Object.defineProperty(exports, "checkDnsRebinding", { enumerable: true, get: function () { return toolkit_js_1.checkDnsRebinding; } });
|
|
36
|
+
Object.defineProperty(exports, "SANCTIONED_COUNTRIES", { enumerable: true, get: function () { return toolkit_js_1.SANCTIONED_COUNTRIES; } });
|
|
37
|
+
Object.defineProperty(exports, "BLOCKED_HOSTNAMES", { enumerable: true, get: function () { return toolkit_js_1.BLOCKED_HOSTNAMES; } });
|
package/dist/toolkit.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Dominus Node Mastra AI Toolkit
|
|
3
3
|
*
|
|
4
|
-
* Implements
|
|
4
|
+
* Implements 26 tools for interacting with Dominus Node's rotating proxy service
|
|
5
5
|
* from Mastra AI agents and workflows.
|
|
6
6
|
*
|
|
7
7
|
* Uses createTool() from @mastra/core/tools with Zod schemas.
|
|
@@ -16,19 +16,24 @@
|
|
|
16
16
|
* - 10 MB response cap, 30s timeout
|
|
17
17
|
* - Redirect following disabled
|
|
18
18
|
*/
|
|
19
|
+
/** OFAC sanctioned countries -- must never be used as geo-targeting destinations. */
|
|
20
|
+
export declare const SANCTIONED_COUNTRIES: Set<string>;
|
|
19
21
|
export interface DominusNodeToolkitConfig {
|
|
20
|
-
/**
|
|
22
|
+
/** Dominus Node API key (dn_live_... or dn_test_...). Falls back to DOMINUSNODE_API_KEY env var. */
|
|
21
23
|
apiKey?: string;
|
|
22
|
-
/** Base URL of the
|
|
24
|
+
/** Base URL of the Dominus Node REST API. */
|
|
23
25
|
baseUrl?: string;
|
|
24
|
-
/** Hostname of the
|
|
26
|
+
/** Hostname of the Dominus Node proxy gateway. */
|
|
25
27
|
proxyHost?: string;
|
|
26
|
-
/** Port of the
|
|
28
|
+
/** Port of the Dominus Node proxy gateway. */
|
|
27
29
|
proxyPort?: number;
|
|
30
|
+
/** Optional agent secret for MCP agent auto-verification (bypasses reCAPTCHA). */
|
|
31
|
+
agentSecret?: string;
|
|
28
32
|
}
|
|
29
33
|
/** Remove any dn_live_* or dn_test_* tokens from error messages. */
|
|
30
34
|
export declare function scrubCredentials(msg: string): string;
|
|
31
35
|
export declare function truncate(text: string, max?: number): string;
|
|
36
|
+
export declare const BLOCKED_HOSTNAMES: Set<string>;
|
|
32
37
|
/**
|
|
33
38
|
* Normalize non-standard IPv4 representations to dotted-decimal.
|
|
34
39
|
* Handles: decimal integers (2130706433), hex (0x7f000001), octal octets (0177.0.0.1).
|
|
@@ -48,6 +53,10 @@ export declare function validateCountry(country: string | undefined): string | u
|
|
|
48
53
|
* Validate a UUID string.
|
|
49
54
|
*/
|
|
50
55
|
export declare function validateUuid(id: string, label: string): string;
|
|
56
|
+
/**
|
|
57
|
+
* Resolve a hostname via DNS and verify none of the resolved IPs are private.
|
|
58
|
+
*/
|
|
59
|
+
export declare function checkDnsRebinding(hostname: string): Promise<void>;
|
|
51
60
|
export declare function stripDangerousKeys(obj: unknown, depth?: number): void;
|
|
52
61
|
export declare function formatBytes(bytes: number): string;
|
|
53
62
|
export declare function formatCents(cents: number): string;
|
|
@@ -56,6 +65,7 @@ export declare class DominusNodeToolkit {
|
|
|
56
65
|
private baseUrl;
|
|
57
66
|
private proxyHost;
|
|
58
67
|
private proxyPort;
|
|
68
|
+
private agentSecret?;
|
|
59
69
|
private cachedJwt;
|
|
60
70
|
private jwtExpiresAt;
|
|
61
71
|
constructor(config?: DominusNodeToolkitConfig);
|
|
@@ -105,6 +115,9 @@ export declare class DominusNodeToolkit {
|
|
|
105
115
|
updateTeam(teamId: string, name?: string, maxMembers?: number): Promise<Record<string, unknown>>;
|
|
106
116
|
updateTeamMemberRole(teamId: string, userId: string, role: string): Promise<Record<string, unknown>>;
|
|
107
117
|
topupPaypal(amountCents: number): Promise<Record<string, unknown>>;
|
|
118
|
+
topupStripe(amountCents: number): Promise<Record<string, unknown>>;
|
|
119
|
+
private static readonly VALID_CRYPTO_CURRENCIES;
|
|
120
|
+
topupCrypto(amountUsd: number, currency: string): Promise<Record<string, unknown>>;
|
|
108
121
|
x402Info(): Promise<Record<string, unknown>>;
|
|
109
122
|
getTools(): (import("@mastra/core/tools", { with: { "resolution-mode": "import" } }).Tool<{
|
|
110
123
|
context: any;
|
|
@@ -237,7 +250,17 @@ export declare class DominusNodeToolkit {
|
|
|
237
250
|
}, {
|
|
238
251
|
error?: string | undefined;
|
|
239
252
|
data?: unknown;
|
|
240
|
-
}, unknown, unknown, import("@mastra/core/tools", { with: { "resolution-mode": "import" } }).ToolExecutionContext<unknown, unknown, unknown>, "dominusnode_topup_paypal", unknown> | import("@mastra/core/tools", { with: { "resolution-mode": "import" } }).Tool<
|
|
253
|
+
}, unknown, unknown, import("@mastra/core/tools", { with: { "resolution-mode": "import" } }).ToolExecutionContext<unknown, unknown, unknown>, "dominusnode_topup_paypal", unknown> | import("@mastra/core/tools", { with: { "resolution-mode": "import" } }).Tool<{
|
|
254
|
+
context: any;
|
|
255
|
+
}, {
|
|
256
|
+
error?: string | undefined;
|
|
257
|
+
data?: unknown;
|
|
258
|
+
}, unknown, unknown, import("@mastra/core/tools", { with: { "resolution-mode": "import" } }).ToolExecutionContext<unknown, unknown, unknown>, "dominusnode_topup_stripe", unknown> | import("@mastra/core/tools", { with: { "resolution-mode": "import" } }).Tool<{
|
|
259
|
+
context: any;
|
|
260
|
+
}, {
|
|
261
|
+
error?: string | undefined;
|
|
262
|
+
data?: unknown;
|
|
263
|
+
}, unknown, unknown, import("@mastra/core/tools", { with: { "resolution-mode": "import" } }).ToolExecutionContext<unknown, unknown, unknown>, "dominusnode_topup_crypto", unknown> | import("@mastra/core/tools", { with: { "resolution-mode": "import" } }).Tool<unknown, {
|
|
241
264
|
error?: string | undefined;
|
|
242
265
|
data?: unknown;
|
|
243
266
|
}, unknown, unknown, import("@mastra/core/tools", { with: { "resolution-mode": "import" } }).ToolExecutionContext<unknown, unknown, unknown>, "dominusnode_x402_info", unknown>)[];
|
package/dist/toolkit.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Dominus Node Mastra AI Toolkit
|
|
4
4
|
*
|
|
5
|
-
* Implements
|
|
5
|
+
* Implements 26 tools for interacting with Dominus Node's rotating proxy service
|
|
6
6
|
* from Mastra AI agents and workflows.
|
|
7
7
|
*
|
|
8
8
|
* Uses createTool() from @mastra/core/tools with Zod schemas.
|
|
@@ -51,7 +51,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
51
51
|
};
|
|
52
52
|
})();
|
|
53
53
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
-
exports.DominusNodeToolkit = void 0;
|
|
54
|
+
exports.DominusNodeToolkit = exports.BLOCKED_HOSTNAMES = exports.SANCTIONED_COUNTRIES = void 0;
|
|
55
55
|
exports.scrubCredentials = scrubCredentials;
|
|
56
56
|
exports.truncate = truncate;
|
|
57
57
|
exports.normalizeIpv4 = normalizeIpv4;
|
|
@@ -59,6 +59,7 @@ exports.isPrivateIp = isPrivateIp;
|
|
|
59
59
|
exports.validateTargetUrl = validateTargetUrl;
|
|
60
60
|
exports.validateCountry = validateCountry;
|
|
61
61
|
exports.validateUuid = validateUuid;
|
|
62
|
+
exports.checkDnsRebinding = checkDnsRebinding;
|
|
62
63
|
exports.stripDangerousKeys = stripDangerousKeys;
|
|
63
64
|
exports.formatBytes = formatBytes;
|
|
64
65
|
exports.formatCents = formatCents;
|
|
@@ -75,7 +76,7 @@ const MAX_RESPONSE_CHARS = 4000;
|
|
|
75
76
|
const REQUEST_TIMEOUT_MS = 30_000;
|
|
76
77
|
const MAX_RESPONSE_BYTES = 10 * 1024 * 1024; // 10 MB hard cap
|
|
77
78
|
/** OFAC sanctioned countries -- must never be used as geo-targeting destinations. */
|
|
78
|
-
|
|
79
|
+
exports.SANCTIONED_COUNTRIES = new Set(["CU", "IR", "KP", "RU", "SY"]);
|
|
79
80
|
/** ISO 3166-1 alpha-2 country code pattern. */
|
|
80
81
|
const COUNTRY_CODE_RE = /^[A-Z]{2}$/;
|
|
81
82
|
/** UUID v4 pattern for wallet/team IDs. */
|
|
@@ -102,7 +103,7 @@ function truncate(text, max = MAX_RESPONSE_CHARS) {
|
|
|
102
103
|
// ---------------------------------------------------------------------------
|
|
103
104
|
// SSRF Protection
|
|
104
105
|
// ---------------------------------------------------------------------------
|
|
105
|
-
|
|
106
|
+
exports.BLOCKED_HOSTNAMES = new Set([
|
|
106
107
|
"localhost",
|
|
107
108
|
"localhost.localdomain",
|
|
108
109
|
"ip6-localhost",
|
|
@@ -261,7 +262,7 @@ function validateTargetUrl(url) {
|
|
|
261
262
|
throw new Error("URLs with embedded credentials are not allowed");
|
|
262
263
|
}
|
|
263
264
|
const hostname = parsed.hostname.toLowerCase();
|
|
264
|
-
if (BLOCKED_HOSTNAMES.has(hostname)) {
|
|
265
|
+
if (exports.BLOCKED_HOSTNAMES.has(hostname)) {
|
|
265
266
|
throw new Error("Requests to localhost/loopback addresses are blocked");
|
|
266
267
|
}
|
|
267
268
|
if (isPrivateIp(hostname)) {
|
|
@@ -291,7 +292,7 @@ function validateCountry(country) {
|
|
|
291
292
|
if (!COUNTRY_CODE_RE.test(upper)) {
|
|
292
293
|
throw new Error(`Invalid country code: "${country}". Must be a 2-letter ISO 3166-1 code.`);
|
|
293
294
|
}
|
|
294
|
-
if (SANCTIONED_COUNTRIES.has(upper)) {
|
|
295
|
+
if (exports.SANCTIONED_COUNTRIES.has(upper)) {
|
|
295
296
|
throw new Error(`Country "${upper}" is OFAC sanctioned and cannot be used as a proxy target.`);
|
|
296
297
|
}
|
|
297
298
|
return upper;
|
|
@@ -383,6 +384,7 @@ class DominusNodeToolkit {
|
|
|
383
384
|
baseUrl;
|
|
384
385
|
proxyHost;
|
|
385
386
|
proxyPort;
|
|
387
|
+
agentSecret;
|
|
386
388
|
cachedJwt = null;
|
|
387
389
|
jwtExpiresAt = 0;
|
|
388
390
|
constructor(config = {}) {
|
|
@@ -392,6 +394,7 @@ class DominusNodeToolkit {
|
|
|
392
394
|
const portStr = config.proxyPort?.toString() || process.env.DOMINUSNODE_PROXY_PORT || "8080";
|
|
393
395
|
const port = parseInt(portStr, 10);
|
|
394
396
|
this.proxyPort = isNaN(port) || port < 1 || port > 65535 ? 8080 : port;
|
|
397
|
+
this.agentSecret = config.agentSecret || process.env.DOMINUSNODE_AGENT_SECRET;
|
|
395
398
|
}
|
|
396
399
|
// -----------------------------------------------------------------------
|
|
397
400
|
// Authentication
|
|
@@ -399,7 +402,7 @@ class DominusNodeToolkit {
|
|
|
399
402
|
getApiKey() {
|
|
400
403
|
if (!this.apiKey || typeof this.apiKey !== "string" || this.apiKey.trim().length === 0) {
|
|
401
404
|
throw new Error("DOMINUSNODE_API_KEY is required. " +
|
|
402
|
-
'Set it to your
|
|
405
|
+
'Set it to your Dominus Node API key (starts with "dn_live_" or "dn_test_").');
|
|
403
406
|
}
|
|
404
407
|
const trimmed = this.apiKey.trim();
|
|
405
408
|
if (!trimmed.startsWith("dn_live_") && !trimmed.startsWith("dn_test_")) {
|
|
@@ -411,12 +414,17 @@ class DominusNodeToolkit {
|
|
|
411
414
|
if (this.cachedJwt && Date.now() < this.jwtExpiresAt)
|
|
412
415
|
return this.cachedJwt;
|
|
413
416
|
const apiKey = this.getApiKey();
|
|
417
|
+
const authHeaders = {
|
|
418
|
+
"Content-Type": "application/json",
|
|
419
|
+
"User-Agent": "dominusnode-mastra/1.0.0",
|
|
420
|
+
};
|
|
421
|
+
if (this.agentSecret) {
|
|
422
|
+
authHeaders["X-DominusNode-Agent"] = "mcp";
|
|
423
|
+
authHeaders["X-DominusNode-Agent-Secret"] = this.agentSecret;
|
|
424
|
+
}
|
|
414
425
|
const res = await fetch(`${this.baseUrl}/api/auth/verify-key`, {
|
|
415
426
|
method: "POST",
|
|
416
|
-
headers:
|
|
417
|
-
"Content-Type": "application/json",
|
|
418
|
-
"User-Agent": "dominusnode-mastra/1.0.0",
|
|
419
|
-
},
|
|
427
|
+
headers: authHeaders,
|
|
420
428
|
body: JSON.stringify({ apiKey }),
|
|
421
429
|
redirect: "error",
|
|
422
430
|
});
|
|
@@ -431,7 +439,7 @@ class DominusNodeToolkit {
|
|
|
431
439
|
return this.cachedJwt;
|
|
432
440
|
}
|
|
433
441
|
// -----------------------------------------------------------------------
|
|
434
|
-
// HTTP client for
|
|
442
|
+
// HTTP client for Dominus Node API
|
|
435
443
|
// -----------------------------------------------------------------------
|
|
436
444
|
async apiRequest(method, path, body) {
|
|
437
445
|
const jwt = await this.ensureAuth();
|
|
@@ -441,6 +449,10 @@ class DominusNodeToolkit {
|
|
|
441
449
|
Accept: "application/json",
|
|
442
450
|
"User-Agent": "dominusnode-mastra/1.0.0",
|
|
443
451
|
};
|
|
452
|
+
if (this.agentSecret) {
|
|
453
|
+
headers["X-DominusNode-Agent"] = "mcp";
|
|
454
|
+
headers["X-DominusNode-Agent-Secret"] = this.agentSecret;
|
|
455
|
+
}
|
|
444
456
|
const init = {
|
|
445
457
|
method,
|
|
446
458
|
headers,
|
|
@@ -839,18 +851,37 @@ class DominusNodeToolkit {
|
|
|
839
851
|
}
|
|
840
852
|
return this.apiPost("/api/wallet/topup/paypal", { amountCents });
|
|
841
853
|
}
|
|
854
|
+
async topupStripe(amountCents) {
|
|
855
|
+
if (!Number.isInteger(amountCents) || amountCents < 500 || amountCents > 100000) {
|
|
856
|
+
throw new Error("amount_cents must be an integer between 500 ($5) and 100000 ($1,000).");
|
|
857
|
+
}
|
|
858
|
+
return this.apiPost("/api/wallet/topup/stripe", { amountCents });
|
|
859
|
+
}
|
|
860
|
+
static VALID_CRYPTO_CURRENCIES = new Set([
|
|
861
|
+
"btc", "eth", "ltc", "xmr", "zec", "usdc", "sol", "usdt", "dai", "bnb", "link",
|
|
862
|
+
]);
|
|
863
|
+
async topupCrypto(amountUsd, currency) {
|
|
864
|
+
if (typeof amountUsd !== "number" || !Number.isFinite(amountUsd) || amountUsd < 5 || amountUsd > 1000) {
|
|
865
|
+
throw new Error("amount_usd must be a number between 5 and 1,000.");
|
|
866
|
+
}
|
|
867
|
+
const cur = String(currency ?? "").toLowerCase();
|
|
868
|
+
if (!DominusNodeToolkit.VALID_CRYPTO_CURRENCIES.has(cur)) {
|
|
869
|
+
throw new Error(`currency must be one of: ${[...DominusNodeToolkit.VALID_CRYPTO_CURRENCIES].join(", ")}.`);
|
|
870
|
+
}
|
|
871
|
+
return this.apiPost("/api/wallet/topup/crypto", { amountUsd, currency: cur });
|
|
872
|
+
}
|
|
842
873
|
async x402Info() {
|
|
843
874
|
return this.apiGet("/api/x402/info");
|
|
844
875
|
}
|
|
845
876
|
// -----------------------------------------------------------------------
|
|
846
|
-
// getTools() -- returns Mastra createTool() instances for all
|
|
877
|
+
// getTools() -- returns Mastra createTool() instances for all 26 tools
|
|
847
878
|
// -----------------------------------------------------------------------
|
|
848
879
|
getTools() {
|
|
849
880
|
return [
|
|
850
881
|
// 1. proxied_fetch
|
|
851
882
|
(0, tools_1.createTool)({
|
|
852
883
|
id: "dominusnode_proxied_fetch",
|
|
853
|
-
description: "Fetch a URL through
|
|
884
|
+
description: "Fetch a URL through Dominus Node's rotating proxy network with geo-targeting. " +
|
|
854
885
|
"Supports datacenter ($3/GB) and residential ($5/GB) pools. " +
|
|
855
886
|
"Only GET, HEAD, and OPTIONS methods are allowed.",
|
|
856
887
|
inputSchema: zod_1.z.object({
|
|
@@ -879,7 +910,7 @@ class DominusNodeToolkit {
|
|
|
879
910
|
// 2. check_balance
|
|
880
911
|
(0, tools_1.createTool)({
|
|
881
912
|
id: "dominusnode_check_balance",
|
|
882
|
-
description: "Check your
|
|
913
|
+
description: "Check your Dominus Node wallet balance and estimated remaining bandwidth at current pricing. " +
|
|
883
914
|
"Shows balance in USD, datacenter GB remaining ($3/GB), and residential GB remaining ($5/GB).",
|
|
884
915
|
inputSchema: zod_1.z.object({}),
|
|
885
916
|
outputSchema: zod_1.z.object({
|
|
@@ -1326,7 +1357,7 @@ class DominusNodeToolkit {
|
|
|
1326
1357
|
// 22. topup_paypal
|
|
1327
1358
|
(0, tools_1.createTool)({
|
|
1328
1359
|
id: "dominusnode_topup_paypal",
|
|
1329
|
-
description: "Top up your
|
|
1360
|
+
description: "Top up your Dominus Node wallet balance via PayPal. Creates a PayPal order and returns " +
|
|
1330
1361
|
"an approval URL to complete payment. Minimum $5 (500 cents), maximum $1,000 (100000 cents).",
|
|
1331
1362
|
inputSchema: zod_1.z.object({
|
|
1332
1363
|
amountCents: zod_1.z.number().int().min(500).max(100000)
|
|
@@ -1345,7 +1376,54 @@ class DominusNodeToolkit {
|
|
|
1345
1376
|
}
|
|
1346
1377
|
},
|
|
1347
1378
|
}),
|
|
1348
|
-
//
|
|
1379
|
+
// 23. topup_stripe
|
|
1380
|
+
(0, tools_1.createTool)({
|
|
1381
|
+
id: "dominusnode_topup_stripe",
|
|
1382
|
+
description: "Top up your Dominus Node wallet balance via Stripe. Creates a Stripe checkout session and returns " +
|
|
1383
|
+
"a checkout URL to complete payment. Minimum $5 (500 cents), maximum $1,000 (100000 cents).",
|
|
1384
|
+
inputSchema: zod_1.z.object({
|
|
1385
|
+
amountCents: zod_1.z.number().int().min(500).max(100000)
|
|
1386
|
+
.describe("Amount in cents to top up (min 500 = $5, max 100000 = $1,000)"),
|
|
1387
|
+
}),
|
|
1388
|
+
outputSchema: zod_1.z.object({
|
|
1389
|
+
data: zod_1.z.unknown(),
|
|
1390
|
+
error: zod_1.z.string().optional(),
|
|
1391
|
+
}),
|
|
1392
|
+
execute: async ({ context }) => {
|
|
1393
|
+
try {
|
|
1394
|
+
return { data: await this.topupStripe(context.amountCents) };
|
|
1395
|
+
}
|
|
1396
|
+
catch (err) {
|
|
1397
|
+
return { data: null, error: safeError(err) };
|
|
1398
|
+
}
|
|
1399
|
+
},
|
|
1400
|
+
}),
|
|
1401
|
+
// 24. topup_crypto
|
|
1402
|
+
(0, tools_1.createTool)({
|
|
1403
|
+
id: "dominusnode_topup_crypto",
|
|
1404
|
+
description: "Top up your Dominus Node wallet balance via cryptocurrency. Creates a crypto payment invoice. " +
|
|
1405
|
+
"Supports BTC, ETH, LTC, XMR, ZEC, USDC, SOL, USDT, DAI, BNB, LINK. " +
|
|
1406
|
+
"Minimum $5, maximum $1,000.",
|
|
1407
|
+
inputSchema: zod_1.z.object({
|
|
1408
|
+
amountUsd: zod_1.z.number().min(5).max(1000)
|
|
1409
|
+
.describe("Amount in USD to top up (5-1000)"),
|
|
1410
|
+
currency: zod_1.z.enum(["btc", "eth", "ltc", "xmr", "zec", "usdc", "sol", "usdt", "dai", "bnb", "link"])
|
|
1411
|
+
.describe("Cryptocurrency to pay with"),
|
|
1412
|
+
}),
|
|
1413
|
+
outputSchema: zod_1.z.object({
|
|
1414
|
+
data: zod_1.z.unknown(),
|
|
1415
|
+
error: zod_1.z.string().optional(),
|
|
1416
|
+
}),
|
|
1417
|
+
execute: async ({ context }) => {
|
|
1418
|
+
try {
|
|
1419
|
+
return { data: await this.topupCrypto(context.amountUsd, context.currency) };
|
|
1420
|
+
}
|
|
1421
|
+
catch (err) {
|
|
1422
|
+
return { data: null, error: safeError(err) };
|
|
1423
|
+
}
|
|
1424
|
+
},
|
|
1425
|
+
}),
|
|
1426
|
+
// 26. x402_info
|
|
1349
1427
|
(0, tools_1.createTool)({
|
|
1350
1428
|
id: "dominusnode_x402_info",
|
|
1351
1429
|
description: "Get x402 micropayment protocol information including supported " +
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dominusnode/mastra-tools",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "Dominus Node rotating proxy tools for Mastra AI",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"files": [
|
|
22
22
|
"dist/",
|
|
23
23
|
"README.md",
|
|
24
|
-
"LICENSE"
|
|
24
|
+
"LICENSE",
|
|
25
|
+
"CHANGELOG.md"
|
|
25
26
|
]
|
|
26
27
|
}
|