@dominusnode/openai-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 +51 -5
- package/functions.json +46 -0
- package/package.json +1 -1
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
|
+
/** Agent secret for MCP agent identification. Bypasses reCAPTCHA and auto-verifies email. */
|
|
50
|
+
agentSecret?: string;
|
|
49
51
|
}
|
|
50
52
|
/**
|
|
51
53
|
* Handler function type returned by createDominusNodeFunctionHandler.
|
package/dist/handler.js
CHANGED
|
@@ -312,6 +312,10 @@ async function apiRequest(config, method, path, body) {
|
|
|
312
312
|
"Content-Type": "application/json",
|
|
313
313
|
Authorization: `Bearer ${config.token}`,
|
|
314
314
|
};
|
|
315
|
+
if (config.agentSecret) {
|
|
316
|
+
headers["X-DominusNode-Agent"] = "mcp";
|
|
317
|
+
headers["X-DominusNode-Agent-Secret"] = config.agentSecret;
|
|
318
|
+
}
|
|
315
319
|
const response = await fetch(url, {
|
|
316
320
|
method,
|
|
317
321
|
headers,
|
|
@@ -392,6 +396,7 @@ export { isPrivateIp, validateUrl, normalizeIpv4, sanitizeError, stripDangerousK
|
|
|
392
396
|
export function createDominusNodeFunctionHandler(config) {
|
|
393
397
|
const baseUrl = config.baseUrl ?? "https://api.dominusnode.com";
|
|
394
398
|
const timeoutMs = config.timeoutMs ?? 30_000;
|
|
399
|
+
const agentSecret = config.agentSecret || process.env.DOMINUSNODE_AGENT_SECRET;
|
|
395
400
|
if (!config.apiKey || typeof config.apiKey !== "string") {
|
|
396
401
|
throw new Error("apiKey is required and must be a non-empty string");
|
|
397
402
|
}
|
|
@@ -399,12 +404,17 @@ export function createDominusNodeFunctionHandler(config) {
|
|
|
399
404
|
let authToken = null;
|
|
400
405
|
let authPromise = null;
|
|
401
406
|
async function authenticate() {
|
|
407
|
+
const authHeaders = {
|
|
408
|
+
"User-Agent": "dominusnode-openai-functions/1.0.0",
|
|
409
|
+
"Content-Type": "application/json",
|
|
410
|
+
};
|
|
411
|
+
if (agentSecret) {
|
|
412
|
+
authHeaders["X-DominusNode-Agent"] = "mcp";
|
|
413
|
+
authHeaders["X-DominusNode-Agent-Secret"] = agentSecret;
|
|
414
|
+
}
|
|
402
415
|
const response = await fetch(`${baseUrl}/api/auth/verify-key`, {
|
|
403
416
|
method: "POST",
|
|
404
|
-
headers:
|
|
405
|
-
"User-Agent": "dominusnode-openai-functions/1.0.0",
|
|
406
|
-
"Content-Type": "application/json",
|
|
407
|
-
},
|
|
417
|
+
headers: authHeaders,
|
|
408
418
|
body: JSON.stringify({ apiKey: config.apiKey }),
|
|
409
419
|
signal: AbortSignal.timeout(timeoutMs),
|
|
410
420
|
redirect: "error",
|
|
@@ -432,7 +442,7 @@ export function createDominusNodeFunctionHandler(config) {
|
|
|
432
442
|
function api(method, path, body) {
|
|
433
443
|
if (!authToken)
|
|
434
444
|
throw new Error("Not authenticated");
|
|
435
|
-
return apiRequest({ baseUrl, timeoutMs, token: authToken }, method, path, body);
|
|
445
|
+
return apiRequest({ baseUrl, timeoutMs, token: authToken, agentSecret }, method, path, body);
|
|
436
446
|
}
|
|
437
447
|
// -----------------------------------------------------------------------
|
|
438
448
|
// Function handlers
|
|
@@ -923,6 +933,40 @@ export function createDominusNodeFunctionHandler(config) {
|
|
|
923
933
|
const result = await api("POST", "/api/wallet/topup/paypal", { amountCents });
|
|
924
934
|
return JSON.stringify(result);
|
|
925
935
|
}
|
|
936
|
+
async function handleTopupStripe(args) {
|
|
937
|
+
const amountCents = args.amount_cents;
|
|
938
|
+
if (!Number.isInteger(amountCents) ||
|
|
939
|
+
amountCents < 500 ||
|
|
940
|
+
amountCents > 100_000) {
|
|
941
|
+
return JSON.stringify({
|
|
942
|
+
error: "amount_cents must be an integer between 500 ($5) and 100,000 ($1,000)",
|
|
943
|
+
});
|
|
944
|
+
}
|
|
945
|
+
const result = await api("POST", "/api/wallet/topup/stripe", { amountCents });
|
|
946
|
+
return JSON.stringify(result);
|
|
947
|
+
}
|
|
948
|
+
async function handleTopupCrypto(args) {
|
|
949
|
+
const amountUsd = args.amount_usd;
|
|
950
|
+
const currency = args.currency;
|
|
951
|
+
if (typeof amountUsd !== "number" || !Number.isFinite(amountUsd) || amountUsd < 5 || amountUsd > 1000) {
|
|
952
|
+
return JSON.stringify({
|
|
953
|
+
error: "amount_usd must be a number between 5 and 1,000",
|
|
954
|
+
});
|
|
955
|
+
}
|
|
956
|
+
const validCurrencies = new Set([
|
|
957
|
+
"BTC", "ETH", "LTC", "XMR", "ZEC", "USDC", "SOL", "USDT", "DAI", "BNB", "LINK",
|
|
958
|
+
]);
|
|
959
|
+
if (!currency || typeof currency !== "string" || !validCurrencies.has(currency.toUpperCase())) {
|
|
960
|
+
return JSON.stringify({
|
|
961
|
+
error: "currency must be one of: BTC, ETH, LTC, XMR, ZEC, USDC, SOL, USDT, DAI, BNB, LINK",
|
|
962
|
+
});
|
|
963
|
+
}
|
|
964
|
+
const result = await api("POST", "/api/wallet/topup/crypto", {
|
|
965
|
+
amountUsd,
|
|
966
|
+
currency: currency.toLowerCase(),
|
|
967
|
+
});
|
|
968
|
+
return JSON.stringify(result);
|
|
969
|
+
}
|
|
926
970
|
async function handleUpdateWalletPolicy(args) {
|
|
927
971
|
const walletId = args.wallet_id;
|
|
928
972
|
if (!walletId || typeof walletId !== "string") {
|
|
@@ -1033,6 +1077,8 @@ export function createDominusNodeFunctionHandler(config) {
|
|
|
1033
1077
|
dominusnode_update_team: handleUpdateTeam,
|
|
1034
1078
|
dominusnode_update_team_member_role: handleUpdateTeamMemberRole,
|
|
1035
1079
|
dominusnode_topup_paypal: handleTopupPaypal,
|
|
1080
|
+
dominusnode_topup_stripe: handleTopupStripe,
|
|
1081
|
+
dominusnode_topup_crypto: handleTopupCrypto,
|
|
1036
1082
|
dominusnode_x402_info: handleX402Info,
|
|
1037
1083
|
};
|
|
1038
1084
|
async function handleX402Info() {
|
package/functions.json
CHANGED
|
@@ -415,5 +415,51 @@
|
|
|
415
415
|
},
|
|
416
416
|
"required": ["amount_cents"]
|
|
417
417
|
}
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
"name": "dominusnode_topup_stripe",
|
|
421
|
+
"description": "Create a Stripe checkout session to top up your Dominus Node wallet with credit/debit card, Apple Pay, Google Pay, or Link. Returns a checkout URL. After payment, wallet is credited automatically. Minimum $5 (500 cents), maximum $1,000 (100,000 cents).",
|
|
422
|
+
"parameters": {
|
|
423
|
+
"type": "object",
|
|
424
|
+
"properties": {
|
|
425
|
+
"amount_cents": {
|
|
426
|
+
"type": "integer",
|
|
427
|
+
"description": "Amount in cents to add to wallet. Minimum 500 ($5.00), maximum 100000 ($1,000.00).",
|
|
428
|
+
"minimum": 500,
|
|
429
|
+
"maximum": 100000
|
|
430
|
+
}
|
|
431
|
+
},
|
|
432
|
+
"required": ["amount_cents"]
|
|
433
|
+
}
|
|
434
|
+
},
|
|
435
|
+
{
|
|
436
|
+
"name": "dominusnode_topup_crypto",
|
|
437
|
+
"description": "Create a cryptocurrency payment invoice to top up your Dominus Node wallet. Supports BTC, ETH, LTC, XMR, ZEC, USDC, SOL, USDT, DAI, BNB, and LINK. Returns a payment URL with address and amount. Privacy coins (XMR, ZEC) provide anonymous billing. Minimum $5, maximum $1,000.",
|
|
438
|
+
"parameters": {
|
|
439
|
+
"type": "object",
|
|
440
|
+
"properties": {
|
|
441
|
+
"amount_usd": {
|
|
442
|
+
"type": "number",
|
|
443
|
+
"description": "Amount in USD to add to wallet. Minimum 5, maximum 1000.",
|
|
444
|
+
"minimum": 5,
|
|
445
|
+
"maximum": 1000
|
|
446
|
+
},
|
|
447
|
+
"currency": {
|
|
448
|
+
"type": "string",
|
|
449
|
+
"description": "Cryptocurrency to pay with: BTC, ETH, LTC, XMR, ZEC, USDC, SOL, USDT, DAI, BNB, or LINK.",
|
|
450
|
+
"enum": ["BTC", "ETH", "LTC", "XMR", "ZEC", "USDC", "SOL", "USDT", "DAI", "BNB", "LINK"]
|
|
451
|
+
}
|
|
452
|
+
},
|
|
453
|
+
"required": ["amount_usd", "currency"]
|
|
454
|
+
}
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
"name": "dominusnode_x402_info",
|
|
458
|
+
"description": "Get x402 micropayment protocol information for pay-per-request proxy access. Returns the accepted payment networks (Coinbase Base USDC, PayAI Solana USDC, Polygon, Avalanche, Sei, and more), per-request pricing, and how to use the X-PAYMENT header for zero-signup proxy access. Use this when you want to pay per-request without a wallet top-up.",
|
|
459
|
+
"parameters": {
|
|
460
|
+
"type": "object",
|
|
461
|
+
"properties": {},
|
|
462
|
+
"required": []
|
|
463
|
+
}
|
|
418
464
|
}
|
|
419
465
|
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dominusnode/openai-functions",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Dominus Node OpenAI-compatible function calling handler — dispatches LLM function calls to the Dominus Node REST API",
|
|
5
5
|
"main": "dist/handler.js",
|
|
6
6
|
"types": "dist/handler.d.ts",
|