@dominusnode/pi-extension 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/dist/toolkit.d.ts +3 -0
- package/dist/toolkit.js +15 -1
- package/package.json +7 -3
package/dist/toolkit.d.ts
CHANGED
|
@@ -50,6 +50,8 @@ export interface DominusNodeToolkitOptions {
|
|
|
50
50
|
proxyHost?: string;
|
|
51
51
|
proxyPort?: number;
|
|
52
52
|
timeout?: number;
|
|
53
|
+
/** Optional agent secret for MCP agent auto-verification (bypasses reCAPTCHA). */
|
|
54
|
+
agentSecret?: string;
|
|
53
55
|
}
|
|
54
56
|
export declare class DominusNodeToolkit {
|
|
55
57
|
private apiKey;
|
|
@@ -57,6 +59,7 @@ export declare class DominusNodeToolkit {
|
|
|
57
59
|
private proxyHost;
|
|
58
60
|
private proxyPort;
|
|
59
61
|
private timeout;
|
|
62
|
+
private agentSecret?;
|
|
60
63
|
private token;
|
|
61
64
|
private tokenExpiresAt;
|
|
62
65
|
private _authPromise;
|
package/dist/toolkit.js
CHANGED
|
@@ -381,6 +381,7 @@ class DominusNodeToolkit {
|
|
|
381
381
|
proxyHost;
|
|
382
382
|
proxyPort;
|
|
383
383
|
timeout;
|
|
384
|
+
agentSecret;
|
|
384
385
|
token = null;
|
|
385
386
|
tokenExpiresAt = 0;
|
|
386
387
|
_authPromise = null; // H-1: mutex for concurrent _ensureAuth
|
|
@@ -418,6 +419,7 @@ class DominusNodeToolkit {
|
|
|
418
419
|
// H-2: Validate timeout option; store but use REQUEST_TIMEOUT_MS constant for requests
|
|
419
420
|
const tVal = Number(options.timeout ?? 30000);
|
|
420
421
|
this.timeout = Number.isFinite(tVal) && tVal >= 1000 && tVal <= 120000 ? tVal : 30000;
|
|
422
|
+
this.agentSecret = options.agentSecret || process.env["DOMINUSNODE_AGENT_SECRET"];
|
|
421
423
|
}
|
|
422
424
|
// -----------------------------------------------------------------------
|
|
423
425
|
// Authentication
|
|
@@ -428,9 +430,17 @@ class DominusNodeToolkit {
|
|
|
428
430
|
if (!this.apiKey.startsWith("dn_live_") && !this.apiKey.startsWith("dn_test_")) {
|
|
429
431
|
throw new Error('DOMINUSNODE_API_KEY must start with "dn_live_" or "dn_test_".');
|
|
430
432
|
}
|
|
433
|
+
const authHeaders = {
|
|
434
|
+
"Content-Type": "application/json",
|
|
435
|
+
"User-Agent": "dominusnode-pi/1.0.0",
|
|
436
|
+
};
|
|
437
|
+
if (this.agentSecret) {
|
|
438
|
+
authHeaders["X-DominusNode-Agent"] = "mcp";
|
|
439
|
+
authHeaders["X-DominusNode-Agent-Secret"] = this.agentSecret;
|
|
440
|
+
}
|
|
431
441
|
const res = await fetch(`${this.baseUrl}/api/auth/verify-key`, {
|
|
432
442
|
method: "POST",
|
|
433
|
-
headers:
|
|
443
|
+
headers: authHeaders,
|
|
434
444
|
body: JSON.stringify({ apiKey: this.apiKey }),
|
|
435
445
|
redirect: "error",
|
|
436
446
|
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS),
|
|
@@ -491,6 +501,10 @@ class DominusNodeToolkit {
|
|
|
491
501
|
Accept: "application/json",
|
|
492
502
|
"User-Agent": "dominusnode-pi/1.0.0",
|
|
493
503
|
};
|
|
504
|
+
if (this.agentSecret) {
|
|
505
|
+
headers["X-DominusNode-Agent"] = "mcp";
|
|
506
|
+
headers["X-DominusNode-Agent-Secret"] = this.agentSecret;
|
|
507
|
+
}
|
|
494
508
|
const init = { method, headers, signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS), redirect: "error" };
|
|
495
509
|
// M-6: Drop body on safe HTTP methods
|
|
496
510
|
if (body && !["GET", "HEAD"].includes(method) && ["POST", "PUT", "PATCH", "DELETE"].includes(method)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dominusnode/pi-extension",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Dominus Node pi-mono extension — 26 tools for rotating proxy, wallet, agentic wallets, teams, and payments",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
|
@@ -20,8 +20,12 @@
|
|
|
20
20
|
"CHANGELOG.md"
|
|
21
21
|
],
|
|
22
22
|
"pi": {
|
|
23
|
-
"extensions": [
|
|
24
|
-
|
|
23
|
+
"extensions": [
|
|
24
|
+
"./dist"
|
|
25
|
+
],
|
|
26
|
+
"skills": [
|
|
27
|
+
"./skills"
|
|
28
|
+
]
|
|
25
29
|
},
|
|
26
30
|
"scripts": {
|
|
27
31
|
"build": "tsc",
|