@dominusnode/gemini-functions 1.0.0 → 1.1.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/README.md +7 -7
- package/dist/handler.d.ts +9 -7
- package/dist/handler.js +59 -10
- package/functions.json +39 -7
- package/package.json +15 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Dominus Node Google Gemini / Vertex AI Function Declarations
|
|
2
2
|
|
|
3
|
-
Gemini-format function declarations and handler implementations for the
|
|
3
|
+
Gemini-format function declarations and handler implementations for the Dominus Node rotating proxy-as-a-service platform. These declarations allow Google Gemini and Vertex AI models to interact with Dominus Node's proxy network, wallet, agentic wallet, and team APIs via function calling.
|
|
4
4
|
|
|
5
5
|
## What This Is
|
|
6
6
|
|
|
@@ -9,8 +9,8 @@ This directory contains:
|
|
|
9
9
|
| File | Description |
|
|
10
10
|
|------|-------------|
|
|
11
11
|
| `functions.json` | Array of 22 Gemini `FunctionDeclaration` objects |
|
|
12
|
-
| `handler.ts` | TypeScript handler that dispatches function calls to the
|
|
13
|
-
| `handler.py` | Python handler that dispatches function calls to the
|
|
12
|
+
| `handler.ts` | TypeScript handler that dispatches function calls to the Dominus Node API |
|
|
13
|
+
| `handler.py` | Python handler that dispatches function calls to the Dominus Node API |
|
|
14
14
|
|
|
15
15
|
The function declarations follow the [Gemini function calling specification](https://ai.google.dev/docs/function_calling), using uppercase types (`STRING`, `INTEGER`, `OBJECT`, `BOOLEAN`, `ARRAY`) and embedding constraints in description text rather than using JSON Schema keywords like `minimum`, `maximum`, `enum`, or `default`.
|
|
16
16
|
|
|
@@ -18,7 +18,7 @@ The function declarations follow the [Gemini function calling specification](htt
|
|
|
18
18
|
|
|
19
19
|
| Function | Description | Auth Required |
|
|
20
20
|
|----------|-------------|---------------|
|
|
21
|
-
| `dominusnode_proxied_fetch` | Make an HTTP request through
|
|
21
|
+
| `dominusnode_proxied_fetch` | Make an HTTP request through Dominus Node's rotating proxy network | Yes |
|
|
22
22
|
| `dominusnode_check_balance` | Check wallet balance (cents, USD, currency) | Yes |
|
|
23
23
|
| `dominusnode_check_usage` | Check usage stats for a time period (day/week/month) | Yes |
|
|
24
24
|
| `dominusnode_get_proxy_config` | Get proxy endpoints, supported countries, geo-targeting info | Yes |
|
|
@@ -52,7 +52,7 @@ from handler import create_dominusnode_function_handler
|
|
|
52
52
|
with open("functions.json") as f:
|
|
53
53
|
declarations = json.load(f)
|
|
54
54
|
|
|
55
|
-
# Create the
|
|
55
|
+
# Create the Dominus Node handler
|
|
56
56
|
dominusnode = create_dominusnode_function_handler(
|
|
57
57
|
api_key="dn_live_your_api_key_here",
|
|
58
58
|
base_url="https://api.dominusnode.com",
|
|
@@ -67,7 +67,7 @@ model = genai.GenerativeModel(
|
|
|
67
67
|
|
|
68
68
|
# Start a chat
|
|
69
69
|
chat = model.start_chat()
|
|
70
|
-
response = chat.send_message("What is my
|
|
70
|
+
response = chat.send_message("What is my Dominus Node proxy balance?")
|
|
71
71
|
|
|
72
72
|
# Handle function calls
|
|
73
73
|
for part in response.parts:
|
package/dist/handler.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Dominus Node Gemini / Vertex AI function calling handler (TypeScript).
|
|
3
3
|
*
|
|
4
4
|
* Provides a factory function that creates a handler for dispatching
|
|
5
|
-
* Google Gemini function calls to the
|
|
5
|
+
* Google Gemini function calls to the Dominus Node REST API. Works with
|
|
6
6
|
* Gemini, Vertex AI, or any system that uses Gemini-format function
|
|
7
7
|
* declarations.
|
|
8
8
|
*
|
|
@@ -40,23 +40,25 @@ declare function stripDangerousKeys(obj: unknown, depth?: number): void;
|
|
|
40
40
|
declare function safeJsonParse<T>(text: string): T;
|
|
41
41
|
declare function sanitizeError(message: string): string;
|
|
42
42
|
export interface DominusNodeFunctionConfig {
|
|
43
|
-
/**
|
|
43
|
+
/** Dominus Node API key (starts with dn_live_ or dn_test_). */
|
|
44
44
|
apiKey: string;
|
|
45
|
-
/** Base URL of the
|
|
45
|
+
/** Base URL of the Dominus Node REST API. Defaults to https://api.dominusnode.com */
|
|
46
46
|
baseUrl?: string;
|
|
47
47
|
/** Request timeout in milliseconds. Defaults to 30000. */
|
|
48
48
|
timeoutMs?: number;
|
|
49
|
+
/** Optional agent secret for MCP agent auto-verification (bypasses reCAPTCHA). */
|
|
50
|
+
agentSecret?: string;
|
|
49
51
|
}
|
|
50
52
|
/**
|
|
51
53
|
* Handler function type returned by createDominusNodeFunctionHandler.
|
|
52
|
-
* Dispatches function calls to the
|
|
54
|
+
* Dispatches function calls to the Dominus Node API and returns JSON string results.
|
|
53
55
|
*/
|
|
54
56
|
export type FunctionHandler = (name: string, args: Record<string, unknown>) => Promise<string>;
|
|
55
57
|
/**
|
|
56
|
-
* Create a
|
|
58
|
+
* Create a Dominus Node function handler for Gemini / Vertex AI function calling.
|
|
57
59
|
*
|
|
58
60
|
* Authenticates using the provided API key, then returns a handler function
|
|
59
|
-
* that dispatches function calls to the appropriate
|
|
61
|
+
* that dispatches function calls to the appropriate Dominus Node REST API endpoint.
|
|
60
62
|
*
|
|
61
63
|
* @param config - API key and optional base URL / timeout.
|
|
62
64
|
* @returns A handler function: (name, args) => Promise<string>
|
package/dist/handler.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Dominus Node Gemini / Vertex AI function calling handler (TypeScript).
|
|
3
3
|
*
|
|
4
4
|
* Provides a factory function that creates a handler for dispatching
|
|
5
|
-
* Google Gemini function calls to the
|
|
5
|
+
* Google Gemini function calls to the Dominus Node REST API. Works with
|
|
6
6
|
* Gemini, Vertex AI, or any system that uses Gemini-format function
|
|
7
7
|
* declarations.
|
|
8
8
|
*
|
|
@@ -325,6 +325,10 @@ async function apiRequest(config, method, path, body) {
|
|
|
325
325
|
"Content-Type": "application/json",
|
|
326
326
|
Authorization: `Bearer ${config.token}`,
|
|
327
327
|
};
|
|
328
|
+
if (config.agentSecret) {
|
|
329
|
+
headers["X-DominusNode-Agent"] = "mcp";
|
|
330
|
+
headers["X-DominusNode-Agent-Secret"] = config.agentSecret;
|
|
331
|
+
}
|
|
328
332
|
const response = await fetch(url, {
|
|
329
333
|
method,
|
|
330
334
|
headers,
|
|
@@ -377,10 +381,10 @@ function periodToDateRange(period) {
|
|
|
377
381
|
return { since: since.toISOString(), until };
|
|
378
382
|
}
|
|
379
383
|
/**
|
|
380
|
-
* Create a
|
|
384
|
+
* Create a Dominus Node function handler for Gemini / Vertex AI function calling.
|
|
381
385
|
*
|
|
382
386
|
* Authenticates using the provided API key, then returns a handler function
|
|
383
|
-
* that dispatches function calls to the appropriate
|
|
387
|
+
* that dispatches function calls to the appropriate Dominus Node REST API endpoint.
|
|
384
388
|
*
|
|
385
389
|
* @param config - API key and optional base URL / timeout.
|
|
386
390
|
* @returns A handler function: (name, args) => Promise<string>
|
|
@@ -405,6 +409,7 @@ export { isPrivateIp, validateUrl, normalizeIpv4, sanitizeError, stripDangerousK
|
|
|
405
409
|
export function createDominusNodeFunctionHandler(config) {
|
|
406
410
|
const baseUrl = config.baseUrl ?? "https://api.dominusnode.com";
|
|
407
411
|
const timeoutMs = config.timeoutMs ?? 30_000;
|
|
412
|
+
const agentSecret = config.agentSecret || process.env.DOMINUSNODE_AGENT_SECRET;
|
|
408
413
|
if (!config.apiKey || typeof config.apiKey !== "string") {
|
|
409
414
|
throw new Error("apiKey is required and must be a non-empty string");
|
|
410
415
|
}
|
|
@@ -412,12 +417,17 @@ export function createDominusNodeFunctionHandler(config) {
|
|
|
412
417
|
let authToken = null;
|
|
413
418
|
let authPromise = null;
|
|
414
419
|
async function authenticate() {
|
|
420
|
+
const authHeaders = {
|
|
421
|
+
"User-Agent": "dominusnode-gemini/1.0.0",
|
|
422
|
+
"Content-Type": "application/json",
|
|
423
|
+
};
|
|
424
|
+
if (agentSecret) {
|
|
425
|
+
authHeaders["X-DominusNode-Agent"] = "mcp";
|
|
426
|
+
authHeaders["X-DominusNode-Agent-Secret"] = agentSecret;
|
|
427
|
+
}
|
|
415
428
|
const response = await fetch(`${baseUrl}/api/auth/verify-key`, {
|
|
416
429
|
method: "POST",
|
|
417
|
-
headers:
|
|
418
|
-
"User-Agent": "dominusnode-gemini/1.0.0",
|
|
419
|
-
"Content-Type": "application/json",
|
|
420
|
-
},
|
|
430
|
+
headers: authHeaders,
|
|
421
431
|
body: JSON.stringify({ apiKey: config.apiKey }),
|
|
422
432
|
signal: AbortSignal.timeout(timeoutMs),
|
|
423
433
|
redirect: "error",
|
|
@@ -445,7 +455,7 @@ export function createDominusNodeFunctionHandler(config) {
|
|
|
445
455
|
function api(method, path, body) {
|
|
446
456
|
if (!authToken)
|
|
447
457
|
throw new Error("Not authenticated");
|
|
448
|
-
return apiRequest({ baseUrl, timeoutMs, token: authToken }, method, path, body);
|
|
458
|
+
return apiRequest({ baseUrl, timeoutMs, token: authToken, agentSecret }, method, path, body);
|
|
449
459
|
}
|
|
450
460
|
// -----------------------------------------------------------------------
|
|
451
461
|
// Function handlers
|
|
@@ -645,7 +655,7 @@ export function createDominusNodeFunctionHandler(config) {
|
|
|
645
655
|
catch (err) {
|
|
646
656
|
return JSON.stringify({
|
|
647
657
|
error: `Proxy fetch failed: ${sanitizeError(err instanceof Error ? err.message : String(err))}`,
|
|
648
|
-
hint: "Ensure the
|
|
658
|
+
hint: "Ensure the Dominus Node proxy gateway is running and accessible.",
|
|
649
659
|
});
|
|
650
660
|
}
|
|
651
661
|
}
|
|
@@ -953,6 +963,43 @@ export function createDominusNodeFunctionHandler(config) {
|
|
|
953
963
|
const result = await api("POST", "/api/wallet/topup/paypal", { amountCents });
|
|
954
964
|
return JSON.stringify(result);
|
|
955
965
|
}
|
|
966
|
+
async function handleTopupStripe(args) {
|
|
967
|
+
const amountCents = args.amount_cents;
|
|
968
|
+
if (!Number.isInteger(amountCents) ||
|
|
969
|
+
amountCents < 500 ||
|
|
970
|
+
amountCents > 100_000) {
|
|
971
|
+
return JSON.stringify({
|
|
972
|
+
error: "amount_cents must be an integer between 500 ($5) and 100,000 ($1,000)",
|
|
973
|
+
});
|
|
974
|
+
}
|
|
975
|
+
const result = await api("POST", "/api/wallet/topup/stripe", { amountCents });
|
|
976
|
+
return JSON.stringify(result);
|
|
977
|
+
}
|
|
978
|
+
const VALID_CRYPTO_CURRENCIES = new Set([
|
|
979
|
+
"btc", "eth", "ltc", "xmr", "zec", "usdc", "sol", "usdt", "dai", "bnb", "link",
|
|
980
|
+
]);
|
|
981
|
+
async function handleTopupCrypto(args) {
|
|
982
|
+
const amountUsd = args.amount_usd;
|
|
983
|
+
const currency = String(args.currency ?? "").toLowerCase();
|
|
984
|
+
if (typeof amountUsd !== "number" ||
|
|
985
|
+
!Number.isFinite(amountUsd) ||
|
|
986
|
+
amountUsd < 5 ||
|
|
987
|
+
amountUsd > 1_000) {
|
|
988
|
+
return JSON.stringify({
|
|
989
|
+
error: "amount_usd must be a number between 5 and 1,000",
|
|
990
|
+
});
|
|
991
|
+
}
|
|
992
|
+
if (!VALID_CRYPTO_CURRENCIES.has(currency)) {
|
|
993
|
+
return JSON.stringify({
|
|
994
|
+
error: `currency must be one of: ${[...VALID_CRYPTO_CURRENCIES].join(", ")}`,
|
|
995
|
+
});
|
|
996
|
+
}
|
|
997
|
+
const result = await api("POST", "/api/wallet/topup/crypto", {
|
|
998
|
+
amountUsd,
|
|
999
|
+
currency,
|
|
1000
|
+
});
|
|
1001
|
+
return JSON.stringify(result);
|
|
1002
|
+
}
|
|
956
1003
|
// -----------------------------------------------------------------------
|
|
957
1004
|
// Dispatch table
|
|
958
1005
|
// -----------------------------------------------------------------------
|
|
@@ -979,6 +1026,8 @@ export function createDominusNodeFunctionHandler(config) {
|
|
|
979
1026
|
dominusnode_update_team: handleUpdateTeam,
|
|
980
1027
|
dominusnode_update_team_member_role: handleUpdateTeamMemberRole,
|
|
981
1028
|
dominusnode_topup_paypal: handleTopupPaypal,
|
|
1029
|
+
dominusnode_topup_stripe: handleTopupStripe,
|
|
1030
|
+
dominusnode_topup_crypto: handleTopupCrypto,
|
|
982
1031
|
dominusnode_x402_info: handleX402Info,
|
|
983
1032
|
dominusnode_update_wallet_policy: handleUpdateWalletPolicy,
|
|
984
1033
|
};
|
package/functions.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[
|
|
2
2
|
{
|
|
3
3
|
"name": "dominusnode_proxied_fetch",
|
|
4
|
-
"description": "Make an HTTP request through
|
|
4
|
+
"description": "Make an HTTP request through Dominus Node's rotating proxy network. Routes traffic through datacenter ($3/GB) or residential ($5/GB) proxies with optional geo-targeting. Useful for accessing geo-restricted content, avoiding IP blocks, or web scraping. Private/internal IPs and sanctioned countries (CU, IR, KP, RU, SY) are blocked.",
|
|
5
5
|
"parameters": {
|
|
6
6
|
"type": "OBJECT",
|
|
7
7
|
"properties": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
"name": "dominusnode_check_balance",
|
|
34
|
-
"description": "Check the current wallet balance for the authenticated
|
|
34
|
+
"description": "Check the current wallet balance for the authenticated Dominus Node account. Returns balance in cents and USD, currency, and last top-up timestamp. The wallet uses a prepaid model -- top up first, then usage is debited automatically.",
|
|
35
35
|
"parameters": {
|
|
36
36
|
"type": "OBJECT",
|
|
37
37
|
"properties": {},
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
42
|
"name": "dominusnode_check_usage",
|
|
43
|
-
"description": "Check proxy usage statistics for the authenticated
|
|
43
|
+
"description": "Check proxy usage statistics for the authenticated Dominus Node account. Returns total bytes transferred, total cost, and request count for the specified period. Useful for monitoring bandwidth consumption and spending.",
|
|
44
44
|
"parameters": {
|
|
45
45
|
"type": "OBJECT",
|
|
46
46
|
"properties": {
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
},
|
|
55
55
|
{
|
|
56
56
|
"name": "dominusnode_get_proxy_config",
|
|
57
|
-
"description": "Get
|
|
57
|
+
"description": "Get Dominus Node proxy endpoint configuration and supported features. Returns HTTP and SOCKS5 proxy connection details, list of supported countries for geo-targeting, blocked/sanctioned countries, and geo-targeting capabilities. Use this to discover available proxy endpoints before making proxied requests.",
|
|
58
58
|
"parameters": {
|
|
59
59
|
"type": "OBJECT",
|
|
60
60
|
"properties": {},
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
},
|
|
64
64
|
{
|
|
65
65
|
"name": "dominusnode_list_sessions",
|
|
66
|
-
"description": "List all currently active proxy sessions for the authenticated
|
|
66
|
+
"description": "List all currently active proxy sessions for the authenticated Dominus Node account. Returns session IDs, start times, and status. Useful for monitoring concurrent connections and debugging active proxy usage.",
|
|
67
67
|
"parameters": {
|
|
68
68
|
"type": "OBJECT",
|
|
69
69
|
"properties": {},
|
|
@@ -362,16 +362,48 @@
|
|
|
362
362
|
},
|
|
363
363
|
{
|
|
364
364
|
"name": "dominusnode_topup_paypal",
|
|
365
|
-
"description": "Create a PayPal wallet top-up session. Initiates a PayPal payment for the specified amount to add funds to your
|
|
365
|
+
"description": "Create a PayPal wallet top-up session. Initiates a PayPal payment for the specified amount to add funds to your Dominus Node wallet. Returns a PayPal approval URL to complete the payment. Minimum $5 (500 cents), maximum $1,000 (100000 cents).",
|
|
366
366
|
"parameters": {
|
|
367
367
|
"type": "OBJECT",
|
|
368
368
|
"properties": {
|
|
369
369
|
"amount_cents": {
|
|
370
370
|
"type": "INTEGER",
|
|
371
|
-
"description": "Amount to top up in cents. Must be
|
|
371
|
+
"description": "Amount to top up in cents. Must be an integer between 500 ($5) and 100000 ($1,000). Example: 1000 = $10.00."
|
|
372
372
|
}
|
|
373
373
|
},
|
|
374
374
|
"required": ["amount_cents"]
|
|
375
375
|
}
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
"name": "dominusnode_topup_stripe",
|
|
379
|
+
"description": "Create a Stripe wallet top-up checkout session. Initiates a Stripe payment for the specified amount to add funds to your Dominus Node wallet. Returns a Stripe checkout URL to complete the payment. Minimum $5 (500 cents), maximum $1,000 (100000 cents).",
|
|
380
|
+
"parameters": {
|
|
381
|
+
"type": "OBJECT",
|
|
382
|
+
"properties": {
|
|
383
|
+
"amount_cents": {
|
|
384
|
+
"type": "INTEGER",
|
|
385
|
+
"description": "Amount to top up in cents. Must be an integer between 500 ($5) and 100000 ($1,000). Example: 1000 = $10.00."
|
|
386
|
+
}
|
|
387
|
+
},
|
|
388
|
+
"required": ["amount_cents"]
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
"name": "dominusnode_topup_crypto",
|
|
393
|
+
"description": "Create a cryptocurrency wallet top-up invoice. Initiates a crypto payment for the specified amount to add funds to your Dominus Node wallet. Returns payment address and amount. Minimum $5, maximum $1,000. Supported currencies: BTC, ETH, LTC, XMR, ZEC, USDC, SOL, USDT, DAI, BNB, LINK.",
|
|
394
|
+
"parameters": {
|
|
395
|
+
"type": "OBJECT",
|
|
396
|
+
"properties": {
|
|
397
|
+
"amount_usd": {
|
|
398
|
+
"type": "NUMBER",
|
|
399
|
+
"description": "Amount to top up in USD. Must be between 5 and 1000."
|
|
400
|
+
},
|
|
401
|
+
"currency": {
|
|
402
|
+
"type": "STRING",
|
|
403
|
+
"description": "Cryptocurrency to pay with. One of: btc, eth, ltc, xmr, zec, usdc, sol, usdt, dai, bnb, link."
|
|
404
|
+
}
|
|
405
|
+
},
|
|
406
|
+
"required": ["amount_usd", "currency"]
|
|
407
|
+
}
|
|
376
408
|
}
|
|
377
409
|
]
|
package/package.json
CHANGED
|
@@ -1,18 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dominusnode/gemini-functions",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Dominus Node function declarations and handlers for Google Gemini / Vertex AI",
|
|
5
5
|
"main": "dist/handler.js",
|
|
6
6
|
"types": "dist/handler.d.ts",
|
|
7
7
|
"type": "module",
|
|
8
|
-
"files": [
|
|
8
|
+
"files": [
|
|
9
|
+
"dist/",
|
|
10
|
+
"functions.json",
|
|
11
|
+
"README.md",
|
|
12
|
+
"LICENSE"
|
|
13
|
+
],
|
|
9
14
|
"scripts": {
|
|
10
15
|
"build": "tsc",
|
|
11
16
|
"test": "vitest run",
|
|
12
17
|
"test:watch": "vitest",
|
|
13
18
|
"test:py": "python -m pytest test_handler.py -v"
|
|
14
19
|
},
|
|
15
|
-
"keywords": [
|
|
20
|
+
"keywords": [
|
|
21
|
+
"dominusnode",
|
|
22
|
+
"gemini",
|
|
23
|
+
"vertex-ai",
|
|
24
|
+
"proxy",
|
|
25
|
+
"function-calling"
|
|
26
|
+
],
|
|
16
27
|
"license": "MIT",
|
|
17
28
|
"repository": {
|
|
18
29
|
"type": "git",
|