@dominusnode/gemini-functions 1.0.1 → 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/dist/handler.d.ts +2 -0
- package/dist/handler.js +54 -5
- package/functions.json +34 -2
- package/package.json +14 -3
package/dist/handler.d.ts
CHANGED
|
@@ -46,6 +46,8 @@ export interface DominusNodeFunctionConfig {
|
|
|
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.
|
package/dist/handler.js
CHANGED
|
@@ -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,
|
|
@@ -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
|
|
@@ -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
|
@@ -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 Dominus Node wallet. Returns a PayPal approval URL to complete the payment.",
|
|
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.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
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",
|