@vhyxvoid/agent 1.0.3 → 1.0.6
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/AgentClient.d.ts +1 -1
- package/dist/AgentClient.d.ts.map +1 -1
- package/dist/AgentClient.js +28 -14
- package/dist/AgentClient.js.map +1 -1
- package/dist/cli.bundled.js +486 -50
- package/dist/cli.js +486 -50
- package/dist/cli.js.map +1 -1
- package/package.json +2 -1
package/dist/cli.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
-
|
|
4
|
-
// dist/cli.js
|
|
5
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
4
|
var __commonJS = (cb, mod) => function __require() {
|
|
7
5
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
8
6
|
};
|
|
7
|
+
|
|
8
|
+
// ../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/error.js
|
|
9
9
|
var require_error = __commonJS({
|
|
10
10
|
"../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/error.js"(exports2) {
|
|
11
11
|
var CommanderError = class extends Error {
|
|
@@ -39,6 +39,8 @@ var require_error = __commonJS({
|
|
|
39
39
|
exports2.InvalidArgumentError = InvalidArgumentError;
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
|
+
|
|
43
|
+
// ../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/argument.js
|
|
42
44
|
var require_argument = __commonJS({
|
|
43
45
|
"../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/argument.js"(exports2) {
|
|
44
46
|
var { InvalidArgumentError } = require_error();
|
|
@@ -165,6 +167,8 @@ var require_argument = __commonJS({
|
|
|
165
167
|
exports2.humanReadableArgName = humanReadableArgName;
|
|
166
168
|
}
|
|
167
169
|
});
|
|
170
|
+
|
|
171
|
+
// ../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/help.js
|
|
168
172
|
var require_help = __commonJS({
|
|
169
173
|
"../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/help.js"(exports2) {
|
|
170
174
|
var { humanReadableArgName } = require_argument();
|
|
@@ -765,6 +769,8 @@ ${itemIndentStr}`);
|
|
|
765
769
|
exports2.stripColor = stripColor;
|
|
766
770
|
}
|
|
767
771
|
});
|
|
772
|
+
|
|
773
|
+
// ../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/option.js
|
|
768
774
|
var require_option = __commonJS({
|
|
769
775
|
"../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/option.js"(exports2) {
|
|
770
776
|
var { InvalidArgumentError } = require_error();
|
|
@@ -1076,6 +1082,8 @@ var require_option = __commonJS({
|
|
|
1076
1082
|
exports2.DualOptions = DualOptions;
|
|
1077
1083
|
}
|
|
1078
1084
|
});
|
|
1085
|
+
|
|
1086
|
+
// ../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/suggestSimilar.js
|
|
1079
1087
|
var require_suggestSimilar = __commonJS({
|
|
1080
1088
|
"../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/suggestSimilar.js"(exports2) {
|
|
1081
1089
|
var maxDistance = 3;
|
|
@@ -1154,6 +1162,8 @@ var require_suggestSimilar = __commonJS({
|
|
|
1154
1162
|
exports2.suggestSimilar = suggestSimilar;
|
|
1155
1163
|
}
|
|
1156
1164
|
});
|
|
1165
|
+
|
|
1166
|
+
// ../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/command.js
|
|
1157
1167
|
var require_command = __commonJS({
|
|
1158
1168
|
"../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/command.js"(exports2) {
|
|
1159
1169
|
var EventEmitter = require("node:events").EventEmitter;
|
|
@@ -3398,6 +3408,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3398
3408
|
exports2.useColor = useColor;
|
|
3399
3409
|
}
|
|
3400
3410
|
});
|
|
3411
|
+
|
|
3412
|
+
// ../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/index.js
|
|
3401
3413
|
var require_commander = __commonJS({
|
|
3402
3414
|
"../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/index.js"(exports2) {
|
|
3403
3415
|
var { Argument } = require_argument();
|
|
@@ -3418,25 +3430,29 @@ var require_commander = __commonJS({
|
|
|
3418
3430
|
exports2.InvalidOptionArgumentError = InvalidArgumentError;
|
|
3419
3431
|
}
|
|
3420
3432
|
});
|
|
3433
|
+
|
|
3434
|
+
// ../protocol/dist/messages.js
|
|
3421
3435
|
var require_messages = __commonJS({
|
|
3422
3436
|
"../protocol/dist/messages.js"(exports2) {
|
|
3423
3437
|
"use strict";
|
|
3424
3438
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3425
3439
|
}
|
|
3426
3440
|
});
|
|
3441
|
+
|
|
3442
|
+
// ../protocol/dist/canonical.js
|
|
3427
3443
|
var require_canonical = __commonJS({
|
|
3428
3444
|
"../protocol/dist/canonical.js"(exports2) {
|
|
3429
3445
|
"use strict";
|
|
3430
|
-
var
|
|
3446
|
+
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
|
|
3431
3447
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
3432
3448
|
};
|
|
3433
3449
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3434
3450
|
exports2.buildCanonical = buildCanonical;
|
|
3435
3451
|
exports2.signCanonical = signCanonical;
|
|
3436
3452
|
exports2.verifyCanonical = verifyCanonical;
|
|
3437
|
-
var
|
|
3453
|
+
var crypto_1 = __importDefault(require("crypto"));
|
|
3438
3454
|
function buildCanonical(params) {
|
|
3439
|
-
const bodyHash = params.body ?
|
|
3455
|
+
const bodyHash = params.body ? crypto_1.default.createHash("sha256").update(params.body, "utf8").digest("hex") : "";
|
|
3440
3456
|
return [
|
|
3441
3457
|
params.method.toUpperCase(),
|
|
3442
3458
|
params.path,
|
|
@@ -3446,23 +3462,25 @@ var require_canonical = __commonJS({
|
|
|
3446
3462
|
params.ts.toString()
|
|
3447
3463
|
].join("|");
|
|
3448
3464
|
}
|
|
3449
|
-
function signCanonical(canonical,
|
|
3450
|
-
return
|
|
3465
|
+
function signCanonical(canonical, secretHash) {
|
|
3466
|
+
return crypto_1.default.createHmac("sha256", secretHash).update(canonical).digest("hex");
|
|
3451
3467
|
}
|
|
3452
|
-
function verifyCanonical(canonical, signature,
|
|
3468
|
+
function verifyCanonical(canonical, signature, secretHash) {
|
|
3453
3469
|
try {
|
|
3454
|
-
const expected = signCanonical(canonical,
|
|
3470
|
+
const expected = signCanonical(canonical, secretHash);
|
|
3455
3471
|
const a = Buffer.from(expected, "hex");
|
|
3456
3472
|
const b = Buffer.from(signature, "hex");
|
|
3457
3473
|
if (a.length !== b.length)
|
|
3458
3474
|
return false;
|
|
3459
|
-
return
|
|
3475
|
+
return crypto_1.default.timingSafeEqual(a, b);
|
|
3460
3476
|
} catch {
|
|
3461
3477
|
return false;
|
|
3462
3478
|
}
|
|
3463
3479
|
}
|
|
3464
3480
|
}
|
|
3465
3481
|
});
|
|
3482
|
+
|
|
3483
|
+
// ../protocol/dist/constants.js
|
|
3466
3484
|
var require_constants = __commonJS({
|
|
3467
3485
|
"../protocol/dist/constants.js"(exports2) {
|
|
3468
3486
|
"use strict";
|
|
@@ -3509,6 +3527,8 @@ var require_constants = __commonJS({
|
|
|
3509
3527
|
};
|
|
3510
3528
|
}
|
|
3511
3529
|
});
|
|
3530
|
+
|
|
3531
|
+
// ../protocol/dist/serializer.js
|
|
3512
3532
|
var require_serializer = __commonJS({
|
|
3513
3533
|
"../protocol/dist/serializer.js"(exports2) {
|
|
3514
3534
|
"use strict";
|
|
@@ -3554,6 +3574,8 @@ var require_serializer = __commonJS({
|
|
|
3554
3574
|
exports2.ProtocolError = ProtocolError;
|
|
3555
3575
|
}
|
|
3556
3576
|
});
|
|
3577
|
+
|
|
3578
|
+
// ../protocol/dist/errors.js
|
|
3557
3579
|
var require_errors = __commonJS({
|
|
3558
3580
|
"../protocol/dist/errors.js"(exports2) {
|
|
3559
3581
|
"use strict";
|
|
@@ -3568,6 +3590,8 @@ var require_errors = __commonJS({
|
|
|
3568
3590
|
};
|
|
3569
3591
|
}
|
|
3570
3592
|
});
|
|
3593
|
+
|
|
3594
|
+
// ../protocol/dist/index.js
|
|
3571
3595
|
var require_dist = __commonJS({
|
|
3572
3596
|
"../protocol/dist/index.js"(exports2) {
|
|
3573
3597
|
"use strict";
|
|
@@ -3595,16 +3619,18 @@ var require_dist = __commonJS({
|
|
|
3595
3619
|
__exportStar(require_errors(), exports2);
|
|
3596
3620
|
}
|
|
3597
3621
|
});
|
|
3622
|
+
|
|
3623
|
+
// dist/queue/DurableQueue.js
|
|
3598
3624
|
var require_DurableQueue = __commonJS({
|
|
3599
3625
|
"dist/queue/DurableQueue.js"(exports2) {
|
|
3600
3626
|
"use strict";
|
|
3601
|
-
var
|
|
3627
|
+
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
|
|
3602
3628
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
3603
3629
|
};
|
|
3604
3630
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3605
3631
|
exports2.DurableQueue = void 0;
|
|
3606
|
-
var better_sqlite3_1 =
|
|
3607
|
-
var
|
|
3632
|
+
var better_sqlite3_1 = __importDefault(require("better-sqlite3"));
|
|
3633
|
+
var crypto_1 = require("crypto");
|
|
3608
3634
|
var protocol_1 = require_dist();
|
|
3609
3635
|
var DurableQueue = class {
|
|
3610
3636
|
db;
|
|
@@ -3649,13 +3675,13 @@ var require_DurableQueue = __commonJS({
|
|
|
3649
3675
|
this.db.prepare(`
|
|
3650
3676
|
INSERT INTO queue (id, direction, payload, ts, attempts, max_attempts, next_retry_at)
|
|
3651
3677
|
VALUES (?, 'inbound', ?, ?, 0, ?, 0)
|
|
3652
|
-
`).run((0,
|
|
3678
|
+
`).run((0, crypto_1.randomUUID)(), JSON.stringify(payload), Date.now(), protocol_1.LIMITS.QUEUE_MAX_ATTEMPTS_INBOUND);
|
|
3653
3679
|
}
|
|
3654
3680
|
enqueueOutbound(payload) {
|
|
3655
3681
|
this.db.prepare(`
|
|
3656
3682
|
INSERT INTO queue (id, direction, payload, ts, attempts, max_attempts, next_retry_at)
|
|
3657
3683
|
VALUES (?, 'outbound', ?, ?, 0, ?, 0)
|
|
3658
|
-
`).run((0,
|
|
3684
|
+
`).run((0, crypto_1.randomUUID)(), JSON.stringify(payload), Date.now(), protocol_1.LIMITS.QUEUE_MAX_ATTEMPTS_OUTBOUND);
|
|
3659
3685
|
}
|
|
3660
3686
|
/**
|
|
3661
3687
|
* Returns all items ready for replay, ordered:
|
|
@@ -3716,6 +3742,8 @@ var require_DurableQueue = __commonJS({
|
|
|
3716
3742
|
exports2.DurableQueue = DurableQueue;
|
|
3717
3743
|
}
|
|
3718
3744
|
});
|
|
3745
|
+
|
|
3746
|
+
// dist/cache/ResponseCache.js
|
|
3719
3747
|
var require_ResponseCache = __commonJS({
|
|
3720
3748
|
"dist/cache/ResponseCache.js"(exports2) {
|
|
3721
3749
|
"use strict";
|
|
@@ -3838,15 +3866,17 @@ var require_ResponseCache = __commonJS({
|
|
|
3838
3866
|
exports2.ResponseCache = ResponseCache;
|
|
3839
3867
|
}
|
|
3840
3868
|
});
|
|
3869
|
+
|
|
3870
|
+
// dist/proxy/BackendProxy.js
|
|
3841
3871
|
var require_BackendProxy = __commonJS({
|
|
3842
3872
|
"dist/proxy/BackendProxy.js"(exports2) {
|
|
3843
3873
|
"use strict";
|
|
3844
|
-
var
|
|
3874
|
+
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
|
|
3845
3875
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
3846
3876
|
};
|
|
3847
3877
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3848
3878
|
exports2.BackendProxy = void 0;
|
|
3849
|
-
var axios_1 =
|
|
3879
|
+
var axios_1 = __importDefault(require("axios"));
|
|
3850
3880
|
var protocol_1 = require_dist();
|
|
3851
3881
|
var ResponseCache_1 = require_ResponseCache();
|
|
3852
3882
|
var HOP_BY_HOP = /* @__PURE__ */ new Set([
|
|
@@ -3954,6 +3984,8 @@ var require_BackendProxy = __commonJS({
|
|
|
3954
3984
|
exports2.BackendProxy = BackendProxy;
|
|
3955
3985
|
}
|
|
3956
3986
|
});
|
|
3987
|
+
|
|
3988
|
+
// dist/batcher/MessageBatcher.js
|
|
3957
3989
|
var require_MessageBatcher = __commonJS({
|
|
3958
3990
|
"dist/batcher/MessageBatcher.js"(exports2) {
|
|
3959
3991
|
"use strict";
|
|
@@ -4029,6 +4061,8 @@ var require_MessageBatcher = __commonJS({
|
|
|
4029
4061
|
exports2.MessageBatcher = MessageBatcher;
|
|
4030
4062
|
}
|
|
4031
4063
|
});
|
|
4064
|
+
|
|
4065
|
+
// dist/replay/replayQueue.js
|
|
4032
4066
|
var require_replayQueue = __commonJS({
|
|
4033
4067
|
"dist/replay/replayQueue.js"(exports2) {
|
|
4034
4068
|
"use strict";
|
|
@@ -4080,15 +4114,17 @@ var require_replayQueue = __commonJS({
|
|
|
4080
4114
|
}
|
|
4081
4115
|
}
|
|
4082
4116
|
});
|
|
4117
|
+
|
|
4118
|
+
// dist/discovery/LocalDiscoveryServer.js
|
|
4083
4119
|
var require_LocalDiscoveryServer = __commonJS({
|
|
4084
4120
|
"dist/discovery/LocalDiscoveryServer.js"(exports2) {
|
|
4085
4121
|
"use strict";
|
|
4086
|
-
var
|
|
4122
|
+
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
|
|
4087
4123
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
4088
4124
|
};
|
|
4089
4125
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
4090
4126
|
exports2.LocalDiscoveryServer = void 0;
|
|
4091
|
-
var http_1 =
|
|
4127
|
+
var http_1 = __importDefault(require("http"));
|
|
4092
4128
|
var protocol_1 = require_dist();
|
|
4093
4129
|
var LocalDiscoveryServer = class {
|
|
4094
4130
|
server = null;
|
|
@@ -4133,19 +4169,20 @@ var require_LocalDiscoveryServer = __commonJS({
|
|
|
4133
4169
|
exports2.LocalDiscoveryServer = LocalDiscoveryServer;
|
|
4134
4170
|
}
|
|
4135
4171
|
});
|
|
4172
|
+
|
|
4173
|
+
// dist/AgentClient.js
|
|
4136
4174
|
var require_AgentClient = __commonJS({
|
|
4137
4175
|
"dist/AgentClient.js"(exports2) {
|
|
4138
4176
|
"use strict";
|
|
4139
|
-
var
|
|
4177
|
+
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
|
|
4140
4178
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
4141
4179
|
};
|
|
4142
4180
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
4143
4181
|
exports2.AgentClient = void 0;
|
|
4144
|
-
var ws_1 =
|
|
4145
|
-
var
|
|
4146
|
-
var
|
|
4147
|
-
var
|
|
4148
|
-
var fs_1 = __importDefault2(require("fs"));
|
|
4182
|
+
var ws_1 = __importDefault(require("ws"));
|
|
4183
|
+
var path_1 = __importDefault(require("path"));
|
|
4184
|
+
var os_1 = __importDefault(require("os"));
|
|
4185
|
+
var fs_1 = __importDefault(require("fs"));
|
|
4149
4186
|
var protocol_1 = require_dist();
|
|
4150
4187
|
var DurableQueue_1 = require_DurableQueue();
|
|
4151
4188
|
var BackendProxy_1 = require_BackendProxy();
|
|
@@ -4239,24 +4276,14 @@ var require_AgentClient = __commonJS({
|
|
|
4239
4276
|
onOpen() {
|
|
4240
4277
|
this.setState("AUTHENTICATING");
|
|
4241
4278
|
this.reconnectDelay = protocol_1.TIMING.RECONNECT_INITIAL_MS;
|
|
4242
|
-
const now = Date.now();
|
|
4243
|
-
const requestId = (0, crypto_12.randomUUID)();
|
|
4244
|
-
const canonical = (0, protocol_1.buildCanonical)({
|
|
4245
|
-
method: "AGENT_REGISTER",
|
|
4246
|
-
path: "/agent/register",
|
|
4247
|
-
query: "",
|
|
4248
|
-
body: this.config.label,
|
|
4249
|
-
requestId,
|
|
4250
|
-
ts: now
|
|
4251
|
-
});
|
|
4252
4279
|
const msg = {
|
|
4253
4280
|
v: protocol_1.PROTOCOL_VERSION,
|
|
4254
4281
|
type: "agent:register",
|
|
4255
4282
|
keyId: this.config.keyId,
|
|
4256
4283
|
label: this.config.label,
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4284
|
+
// agentVersion: this.config.agentVersion,
|
|
4285
|
+
rawSecret: this.config.secret,
|
|
4286
|
+
// ← raw secret, hub applies pepper
|
|
4260
4287
|
agentVersion: this.config.agentVersion
|
|
4261
4288
|
};
|
|
4262
4289
|
this.sendRaw((0, protocol_1.serialize)(msg));
|
|
@@ -4295,6 +4322,20 @@ var require_AgentClient = __commonJS({
|
|
|
4295
4322
|
async onRegistered(msg) {
|
|
4296
4323
|
this.agentId = msg.agentId;
|
|
4297
4324
|
this.setState("CONNECTED");
|
|
4325
|
+
console.log("");
|
|
4326
|
+
console.log(" \u2705 Tunnel active");
|
|
4327
|
+
console.log("");
|
|
4328
|
+
if (msg.tunnelUrl) {
|
|
4329
|
+
console.log(` Local: http://localhost:${this.config.port}`);
|
|
4330
|
+
console.log(` Public: ${msg.tunnelUrl}`);
|
|
4331
|
+
console.log("");
|
|
4332
|
+
console.log(" Share the Public URL \u2014 it is stable and never changes.");
|
|
4333
|
+
console.log(" Put it in webhooks, .env files, or share with teammates.");
|
|
4334
|
+
} else {
|
|
4335
|
+
console.log(` Local: http://localhost:${this.config.port}`);
|
|
4336
|
+
console.log(` Label: ${this.config.label}`);
|
|
4337
|
+
}
|
|
4338
|
+
console.log("");
|
|
4298
4339
|
this.log.info({
|
|
4299
4340
|
agentId: msg.agentId,
|
|
4300
4341
|
accountId: msg.accountId,
|
|
@@ -4391,11 +4432,13 @@ var require_AgentClient = __commonJS({
|
|
|
4391
4432
|
exports2.AgentClient = AgentClient;
|
|
4392
4433
|
}
|
|
4393
4434
|
});
|
|
4435
|
+
|
|
4436
|
+
// package.json
|
|
4394
4437
|
var require_package = __commonJS({
|
|
4395
4438
|
"package.json"(exports2, module2) {
|
|
4396
4439
|
module2.exports = {
|
|
4397
4440
|
name: "@vhyxvoid/agent",
|
|
4398
|
-
version: "1.0.
|
|
4441
|
+
version: "1.0.6",
|
|
4399
4442
|
description: "Platform tunnel agent \u2014 connect your local server to the platform",
|
|
4400
4443
|
keywords: [
|
|
4401
4444
|
"tunnel",
|
|
@@ -4422,6 +4465,7 @@ var require_package = __commonJS({
|
|
|
4422
4465
|
axios: "^1.13.2",
|
|
4423
4466
|
"better-sqlite3": "^12.8.0",
|
|
4424
4467
|
commander: "^14.0.3",
|
|
4468
|
+
dotenv: "^17.2.3",
|
|
4425
4469
|
ws: "^8.18.3"
|
|
4426
4470
|
},
|
|
4427
4471
|
devDependencies: {
|
|
@@ -4435,16 +4479,413 @@ var require_package = __commonJS({
|
|
|
4435
4479
|
};
|
|
4436
4480
|
}
|
|
4437
4481
|
});
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4482
|
+
|
|
4483
|
+
// ../../node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/package.json
|
|
4484
|
+
var require_package2 = __commonJS({
|
|
4485
|
+
"../../node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/package.json"(exports2, module2) {
|
|
4486
|
+
module2.exports = {
|
|
4487
|
+
name: "dotenv",
|
|
4488
|
+
version: "17.2.3",
|
|
4489
|
+
description: "Loads environment variables from .env file",
|
|
4490
|
+
main: "lib/main.js",
|
|
4491
|
+
types: "lib/main.d.ts",
|
|
4492
|
+
exports: {
|
|
4493
|
+
".": {
|
|
4494
|
+
types: "./lib/main.d.ts",
|
|
4495
|
+
require: "./lib/main.js",
|
|
4496
|
+
default: "./lib/main.js"
|
|
4497
|
+
},
|
|
4498
|
+
"./config": "./config.js",
|
|
4499
|
+
"./config.js": "./config.js",
|
|
4500
|
+
"./lib/env-options": "./lib/env-options.js",
|
|
4501
|
+
"./lib/env-options.js": "./lib/env-options.js",
|
|
4502
|
+
"./lib/cli-options": "./lib/cli-options.js",
|
|
4503
|
+
"./lib/cli-options.js": "./lib/cli-options.js",
|
|
4504
|
+
"./package.json": "./package.json"
|
|
4505
|
+
},
|
|
4506
|
+
scripts: {
|
|
4507
|
+
"dts-check": "tsc --project tests/types/tsconfig.json",
|
|
4508
|
+
lint: "standard",
|
|
4509
|
+
pretest: "npm run lint && npm run dts-check",
|
|
4510
|
+
test: "tap run tests/**/*.js --allow-empty-coverage --disable-coverage --timeout=60000",
|
|
4511
|
+
"test:coverage": "tap run tests/**/*.js --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov",
|
|
4512
|
+
prerelease: "npm test",
|
|
4513
|
+
release: "standard-version"
|
|
4514
|
+
},
|
|
4515
|
+
repository: {
|
|
4516
|
+
type: "git",
|
|
4517
|
+
url: "git://github.com/motdotla/dotenv.git"
|
|
4518
|
+
},
|
|
4519
|
+
homepage: "https://github.com/motdotla/dotenv#readme",
|
|
4520
|
+
funding: "https://dotenvx.com",
|
|
4521
|
+
keywords: [
|
|
4522
|
+
"dotenv",
|
|
4523
|
+
"env",
|
|
4524
|
+
".env",
|
|
4525
|
+
"environment",
|
|
4526
|
+
"variables",
|
|
4527
|
+
"config",
|
|
4528
|
+
"settings"
|
|
4529
|
+
],
|
|
4530
|
+
readmeFilename: "README.md",
|
|
4531
|
+
license: "BSD-2-Clause",
|
|
4532
|
+
devDependencies: {
|
|
4533
|
+
"@types/node": "^18.11.3",
|
|
4534
|
+
decache: "^4.6.2",
|
|
4535
|
+
sinon: "^14.0.1",
|
|
4536
|
+
standard: "^17.0.0",
|
|
4537
|
+
"standard-version": "^9.5.0",
|
|
4538
|
+
tap: "^19.2.0",
|
|
4539
|
+
typescript: "^4.8.4"
|
|
4540
|
+
},
|
|
4541
|
+
engines: {
|
|
4542
|
+
node: ">=12"
|
|
4543
|
+
},
|
|
4544
|
+
browser: {
|
|
4545
|
+
fs: false
|
|
4546
|
+
}
|
|
4547
|
+
};
|
|
4548
|
+
}
|
|
4549
|
+
});
|
|
4550
|
+
|
|
4551
|
+
// ../../node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/lib/main.js
|
|
4552
|
+
var require_main = __commonJS({
|
|
4553
|
+
"../../node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/lib/main.js"(exports2, module2) {
|
|
4554
|
+
var fs = require("fs");
|
|
4555
|
+
var path = require("path");
|
|
4556
|
+
var os = require("os");
|
|
4557
|
+
var crypto = require("crypto");
|
|
4558
|
+
var packageJson = require_package2();
|
|
4559
|
+
var version = packageJson.version;
|
|
4560
|
+
var TIPS = [
|
|
4561
|
+
"\u{1F510} encrypt with Dotenvx: https://dotenvx.com",
|
|
4562
|
+
"\u{1F510} prevent committing .env to code: https://dotenvx.com/precommit",
|
|
4563
|
+
"\u{1F510} prevent building .env in docker: https://dotenvx.com/prebuild",
|
|
4564
|
+
"\u{1F4E1} add observability to secrets: https://dotenvx.com/ops",
|
|
4565
|
+
"\u{1F465} sync secrets across teammates & machines: https://dotenvx.com/ops",
|
|
4566
|
+
"\u{1F5C2}\uFE0F backup and recover secrets: https://dotenvx.com/ops",
|
|
4567
|
+
"\u2705 audit secrets and track compliance: https://dotenvx.com/ops",
|
|
4568
|
+
"\u{1F504} add secrets lifecycle management: https://dotenvx.com/ops",
|
|
4569
|
+
"\u{1F511} add access controls to secrets: https://dotenvx.com/ops",
|
|
4570
|
+
"\u{1F6E0}\uFE0F run anywhere with `dotenvx run -- yourcommand`",
|
|
4571
|
+
"\u2699\uFE0F specify custom .env file path with { path: '/custom/path/.env' }",
|
|
4572
|
+
"\u2699\uFE0F enable debug logging with { debug: true }",
|
|
4573
|
+
"\u2699\uFE0F override existing env vars with { override: true }",
|
|
4574
|
+
"\u2699\uFE0F suppress all logs with { quiet: true }",
|
|
4575
|
+
"\u2699\uFE0F write to custom object with { processEnv: myObject }",
|
|
4576
|
+
"\u2699\uFE0F load multiple .env files with { path: ['.env.local', '.env'] }"
|
|
4577
|
+
];
|
|
4578
|
+
function _getRandomTip() {
|
|
4579
|
+
return TIPS[Math.floor(Math.random() * TIPS.length)];
|
|
4580
|
+
}
|
|
4581
|
+
function parseBoolean(value) {
|
|
4582
|
+
if (typeof value === "string") {
|
|
4583
|
+
return !["false", "0", "no", "off", ""].includes(value.toLowerCase());
|
|
4584
|
+
}
|
|
4585
|
+
return Boolean(value);
|
|
4586
|
+
}
|
|
4587
|
+
function supportsAnsi() {
|
|
4588
|
+
return process.stdout.isTTY;
|
|
4589
|
+
}
|
|
4590
|
+
function dim(text) {
|
|
4591
|
+
return supportsAnsi() ? `\x1B[2m${text}\x1B[0m` : text;
|
|
4592
|
+
}
|
|
4593
|
+
var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
|
|
4594
|
+
function parse(src) {
|
|
4595
|
+
const obj = {};
|
|
4596
|
+
let lines = src.toString();
|
|
4597
|
+
lines = lines.replace(/\r\n?/mg, "\n");
|
|
4598
|
+
let match;
|
|
4599
|
+
while ((match = LINE.exec(lines)) != null) {
|
|
4600
|
+
const key = match[1];
|
|
4601
|
+
let value = match[2] || "";
|
|
4602
|
+
value = value.trim();
|
|
4603
|
+
const maybeQuote = value[0];
|
|
4604
|
+
value = value.replace(/^(['"`])([\s\S]*)\1$/mg, "$2");
|
|
4605
|
+
if (maybeQuote === '"') {
|
|
4606
|
+
value = value.replace(/\\n/g, "\n");
|
|
4607
|
+
value = value.replace(/\\r/g, "\r");
|
|
4608
|
+
}
|
|
4609
|
+
obj[key] = value;
|
|
4610
|
+
}
|
|
4611
|
+
return obj;
|
|
4612
|
+
}
|
|
4613
|
+
function _parseVault(options) {
|
|
4614
|
+
options = options || {};
|
|
4615
|
+
const vaultPath = _vaultPath(options);
|
|
4616
|
+
options.path = vaultPath;
|
|
4617
|
+
const result = DotenvModule.configDotenv(options);
|
|
4618
|
+
if (!result.parsed) {
|
|
4619
|
+
const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
|
|
4620
|
+
err.code = "MISSING_DATA";
|
|
4621
|
+
throw err;
|
|
4622
|
+
}
|
|
4623
|
+
const keys = _dotenvKey(options).split(",");
|
|
4624
|
+
const length = keys.length;
|
|
4625
|
+
let decrypted;
|
|
4626
|
+
for (let i = 0; i < length; i++) {
|
|
4627
|
+
try {
|
|
4628
|
+
const key = keys[i].trim();
|
|
4629
|
+
const attrs = _instructions(result, key);
|
|
4630
|
+
decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
|
|
4631
|
+
break;
|
|
4632
|
+
} catch (error) {
|
|
4633
|
+
if (i + 1 >= length) {
|
|
4634
|
+
throw error;
|
|
4635
|
+
}
|
|
4636
|
+
}
|
|
4637
|
+
}
|
|
4638
|
+
return DotenvModule.parse(decrypted);
|
|
4639
|
+
}
|
|
4640
|
+
function _warn(message) {
|
|
4641
|
+
console.error(`[dotenv@${version}][WARN] ${message}`);
|
|
4642
|
+
}
|
|
4643
|
+
function _debug(message) {
|
|
4644
|
+
console.log(`[dotenv@${version}][DEBUG] ${message}`);
|
|
4645
|
+
}
|
|
4646
|
+
function _log(message) {
|
|
4647
|
+
console.log(`[dotenv@${version}] ${message}`);
|
|
4648
|
+
}
|
|
4649
|
+
function _dotenvKey(options) {
|
|
4650
|
+
if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
|
|
4651
|
+
return options.DOTENV_KEY;
|
|
4652
|
+
}
|
|
4653
|
+
if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {
|
|
4654
|
+
return process.env.DOTENV_KEY;
|
|
4655
|
+
}
|
|
4656
|
+
return "";
|
|
4657
|
+
}
|
|
4658
|
+
function _instructions(result, dotenvKey) {
|
|
4659
|
+
let uri;
|
|
4660
|
+
try {
|
|
4661
|
+
uri = new URL(dotenvKey);
|
|
4662
|
+
} catch (error) {
|
|
4663
|
+
if (error.code === "ERR_INVALID_URL") {
|
|
4664
|
+
const err = new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");
|
|
4665
|
+
err.code = "INVALID_DOTENV_KEY";
|
|
4666
|
+
throw err;
|
|
4667
|
+
}
|
|
4668
|
+
throw error;
|
|
4669
|
+
}
|
|
4670
|
+
const key = uri.password;
|
|
4671
|
+
if (!key) {
|
|
4672
|
+
const err = new Error("INVALID_DOTENV_KEY: Missing key part");
|
|
4673
|
+
err.code = "INVALID_DOTENV_KEY";
|
|
4674
|
+
throw err;
|
|
4675
|
+
}
|
|
4676
|
+
const environment = uri.searchParams.get("environment");
|
|
4677
|
+
if (!environment) {
|
|
4678
|
+
const err = new Error("INVALID_DOTENV_KEY: Missing environment part");
|
|
4679
|
+
err.code = "INVALID_DOTENV_KEY";
|
|
4680
|
+
throw err;
|
|
4681
|
+
}
|
|
4682
|
+
const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
|
|
4683
|
+
const ciphertext = result.parsed[environmentKey];
|
|
4684
|
+
if (!ciphertext) {
|
|
4685
|
+
const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);
|
|
4686
|
+
err.code = "NOT_FOUND_DOTENV_ENVIRONMENT";
|
|
4687
|
+
throw err;
|
|
4688
|
+
}
|
|
4689
|
+
return { ciphertext, key };
|
|
4690
|
+
}
|
|
4691
|
+
function _vaultPath(options) {
|
|
4692
|
+
let possibleVaultPath = null;
|
|
4693
|
+
if (options && options.path && options.path.length > 0) {
|
|
4694
|
+
if (Array.isArray(options.path)) {
|
|
4695
|
+
for (const filepath of options.path) {
|
|
4696
|
+
if (fs.existsSync(filepath)) {
|
|
4697
|
+
possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
|
|
4698
|
+
}
|
|
4699
|
+
}
|
|
4700
|
+
} else {
|
|
4701
|
+
possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
|
|
4702
|
+
}
|
|
4703
|
+
} else {
|
|
4704
|
+
possibleVaultPath = path.resolve(process.cwd(), ".env.vault");
|
|
4705
|
+
}
|
|
4706
|
+
if (fs.existsSync(possibleVaultPath)) {
|
|
4707
|
+
return possibleVaultPath;
|
|
4708
|
+
}
|
|
4709
|
+
return null;
|
|
4710
|
+
}
|
|
4711
|
+
function _resolveHome(envPath) {
|
|
4712
|
+
return envPath[0] === "~" ? path.join(os.homedir(), envPath.slice(1)) : envPath;
|
|
4713
|
+
}
|
|
4714
|
+
function _configVault(options) {
|
|
4715
|
+
const debug = parseBoolean(process.env.DOTENV_CONFIG_DEBUG || options && options.debug);
|
|
4716
|
+
const quiet = parseBoolean(process.env.DOTENV_CONFIG_QUIET || options && options.quiet);
|
|
4717
|
+
if (debug || !quiet) {
|
|
4718
|
+
_log("Loading env from encrypted .env.vault");
|
|
4719
|
+
}
|
|
4720
|
+
const parsed = DotenvModule._parseVault(options);
|
|
4721
|
+
let processEnv = process.env;
|
|
4722
|
+
if (options && options.processEnv != null) {
|
|
4723
|
+
processEnv = options.processEnv;
|
|
4724
|
+
}
|
|
4725
|
+
DotenvModule.populate(processEnv, parsed, options);
|
|
4726
|
+
return { parsed };
|
|
4727
|
+
}
|
|
4728
|
+
function configDotenv(options) {
|
|
4729
|
+
const dotenvPath = path.resolve(process.cwd(), ".env");
|
|
4730
|
+
let encoding = "utf8";
|
|
4731
|
+
let processEnv = process.env;
|
|
4732
|
+
if (options && options.processEnv != null) {
|
|
4733
|
+
processEnv = options.processEnv;
|
|
4734
|
+
}
|
|
4735
|
+
let debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || options && options.debug);
|
|
4736
|
+
let quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || options && options.quiet);
|
|
4737
|
+
if (options && options.encoding) {
|
|
4738
|
+
encoding = options.encoding;
|
|
4739
|
+
} else {
|
|
4740
|
+
if (debug) {
|
|
4741
|
+
_debug("No encoding is specified. UTF-8 is used by default");
|
|
4742
|
+
}
|
|
4743
|
+
}
|
|
4744
|
+
let optionPaths = [dotenvPath];
|
|
4745
|
+
if (options && options.path) {
|
|
4746
|
+
if (!Array.isArray(options.path)) {
|
|
4747
|
+
optionPaths = [_resolveHome(options.path)];
|
|
4748
|
+
} else {
|
|
4749
|
+
optionPaths = [];
|
|
4750
|
+
for (const filepath of options.path) {
|
|
4751
|
+
optionPaths.push(_resolveHome(filepath));
|
|
4752
|
+
}
|
|
4753
|
+
}
|
|
4754
|
+
}
|
|
4755
|
+
let lastError;
|
|
4756
|
+
const parsedAll = {};
|
|
4757
|
+
for (const path2 of optionPaths) {
|
|
4758
|
+
try {
|
|
4759
|
+
const parsed = DotenvModule.parse(fs.readFileSync(path2, { encoding }));
|
|
4760
|
+
DotenvModule.populate(parsedAll, parsed, options);
|
|
4761
|
+
} catch (e) {
|
|
4762
|
+
if (debug) {
|
|
4763
|
+
_debug(`Failed to load ${path2} ${e.message}`);
|
|
4764
|
+
}
|
|
4765
|
+
lastError = e;
|
|
4766
|
+
}
|
|
4767
|
+
}
|
|
4768
|
+
const populated = DotenvModule.populate(processEnv, parsedAll, options);
|
|
4769
|
+
debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || debug);
|
|
4770
|
+
quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || quiet);
|
|
4771
|
+
if (debug || !quiet) {
|
|
4772
|
+
const keysCount = Object.keys(populated).length;
|
|
4773
|
+
const shortPaths = [];
|
|
4774
|
+
for (const filePath of optionPaths) {
|
|
4775
|
+
try {
|
|
4776
|
+
const relative = path.relative(process.cwd(), filePath);
|
|
4777
|
+
shortPaths.push(relative);
|
|
4778
|
+
} catch (e) {
|
|
4779
|
+
if (debug) {
|
|
4780
|
+
_debug(`Failed to load ${filePath} ${e.message}`);
|
|
4781
|
+
}
|
|
4782
|
+
lastError = e;
|
|
4783
|
+
}
|
|
4784
|
+
}
|
|
4785
|
+
_log(`injecting env (${keysCount}) from ${shortPaths.join(",")} ${dim(`-- tip: ${_getRandomTip()}`)}`);
|
|
4786
|
+
}
|
|
4787
|
+
if (lastError) {
|
|
4788
|
+
return { parsed: parsedAll, error: lastError };
|
|
4789
|
+
} else {
|
|
4790
|
+
return { parsed: parsedAll };
|
|
4791
|
+
}
|
|
4792
|
+
}
|
|
4793
|
+
function config(options) {
|
|
4794
|
+
if (_dotenvKey(options).length === 0) {
|
|
4795
|
+
return DotenvModule.configDotenv(options);
|
|
4796
|
+
}
|
|
4797
|
+
const vaultPath = _vaultPath(options);
|
|
4798
|
+
if (!vaultPath) {
|
|
4799
|
+
_warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
|
|
4800
|
+
return DotenvModule.configDotenv(options);
|
|
4801
|
+
}
|
|
4802
|
+
return DotenvModule._configVault(options);
|
|
4803
|
+
}
|
|
4804
|
+
function decrypt(encrypted, keyStr) {
|
|
4805
|
+
const key = Buffer.from(keyStr.slice(-64), "hex");
|
|
4806
|
+
let ciphertext = Buffer.from(encrypted, "base64");
|
|
4807
|
+
const nonce = ciphertext.subarray(0, 12);
|
|
4808
|
+
const authTag = ciphertext.subarray(-16);
|
|
4809
|
+
ciphertext = ciphertext.subarray(12, -16);
|
|
4810
|
+
try {
|
|
4811
|
+
const aesgcm = crypto.createDecipheriv("aes-256-gcm", key, nonce);
|
|
4812
|
+
aesgcm.setAuthTag(authTag);
|
|
4813
|
+
return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
|
|
4814
|
+
} catch (error) {
|
|
4815
|
+
const isRange = error instanceof RangeError;
|
|
4816
|
+
const invalidKeyLength = error.message === "Invalid key length";
|
|
4817
|
+
const decryptionFailed = error.message === "Unsupported state or unable to authenticate data";
|
|
4818
|
+
if (isRange || invalidKeyLength) {
|
|
4819
|
+
const err = new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");
|
|
4820
|
+
err.code = "INVALID_DOTENV_KEY";
|
|
4821
|
+
throw err;
|
|
4822
|
+
} else if (decryptionFailed) {
|
|
4823
|
+
const err = new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");
|
|
4824
|
+
err.code = "DECRYPTION_FAILED";
|
|
4825
|
+
throw err;
|
|
4826
|
+
} else {
|
|
4827
|
+
throw error;
|
|
4828
|
+
}
|
|
4829
|
+
}
|
|
4830
|
+
}
|
|
4831
|
+
function populate(processEnv, parsed, options = {}) {
|
|
4832
|
+
const debug = Boolean(options && options.debug);
|
|
4833
|
+
const override = Boolean(options && options.override);
|
|
4834
|
+
const populated = {};
|
|
4835
|
+
if (typeof parsed !== "object") {
|
|
4836
|
+
const err = new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
|
|
4837
|
+
err.code = "OBJECT_REQUIRED";
|
|
4838
|
+
throw err;
|
|
4839
|
+
}
|
|
4840
|
+
for (const key of Object.keys(parsed)) {
|
|
4841
|
+
if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
|
|
4842
|
+
if (override === true) {
|
|
4843
|
+
processEnv[key] = parsed[key];
|
|
4844
|
+
populated[key] = parsed[key];
|
|
4845
|
+
}
|
|
4846
|
+
if (debug) {
|
|
4847
|
+
if (override === true) {
|
|
4848
|
+
_debug(`"${key}" is already defined and WAS overwritten`);
|
|
4849
|
+
} else {
|
|
4850
|
+
_debug(`"${key}" is already defined and was NOT overwritten`);
|
|
4851
|
+
}
|
|
4852
|
+
}
|
|
4853
|
+
} else {
|
|
4854
|
+
processEnv[key] = parsed[key];
|
|
4855
|
+
populated[key] = parsed[key];
|
|
4856
|
+
}
|
|
4857
|
+
}
|
|
4858
|
+
return populated;
|
|
4859
|
+
}
|
|
4860
|
+
var DotenvModule = {
|
|
4861
|
+
configDotenv,
|
|
4862
|
+
_configVault,
|
|
4863
|
+
_parseVault,
|
|
4864
|
+
config,
|
|
4865
|
+
decrypt,
|
|
4866
|
+
parse,
|
|
4867
|
+
populate
|
|
4868
|
+
};
|
|
4869
|
+
module2.exports.configDotenv = DotenvModule.configDotenv;
|
|
4870
|
+
module2.exports._configVault = DotenvModule._configVault;
|
|
4871
|
+
module2.exports._parseVault = DotenvModule._parseVault;
|
|
4872
|
+
module2.exports.config = DotenvModule.config;
|
|
4873
|
+
module2.exports.decrypt = DotenvModule.decrypt;
|
|
4874
|
+
module2.exports.parse = DotenvModule.parse;
|
|
4875
|
+
module2.exports.populate = DotenvModule.populate;
|
|
4876
|
+
module2.exports = DotenvModule;
|
|
4877
|
+
}
|
|
4878
|
+
});
|
|
4879
|
+
|
|
4880
|
+
// dist/cli.js
|
|
4441
4881
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4442
4882
|
var commander_1 = require_commander();
|
|
4443
4883
|
var AgentClient_1 = require_AgentClient();
|
|
4444
|
-
var crypto_1 = __importDefault(require("crypto"));
|
|
4445
4884
|
var package_json_1 = require_package();
|
|
4885
|
+
var dotenv_1 = require_main();
|
|
4886
|
+
(0, dotenv_1.config)();
|
|
4446
4887
|
var program = new commander_1.Command();
|
|
4447
|
-
program.name("vhyxvoid").description("Platform tunnel agent.\nConnects your local server to the platform so the frontend SDK can reach it.").version(package_json_1.version).option("-k, --key <keyId>", "API key ID (e.g. vhyxvoid_dev_abc123). Env: VHYXVOID_API_KEY", process.env.VHYXVOID_API_KEY).option("-s, --secret <secret>", "API key secret (shown once at creation). Env: VHYXVOID_SECRET", process.env.VHYXVOID_SECRET).option("-p, --port <port>", "Local backend port to tunnel (e.g. 3000). Env: VHYXVOID_PORT", process.env.VHYXVOID_PORT ?? "3000").option("-l, --label <label>", "Tunnel label \u2014 identifies this agent if you run multiple. Env: VHYXVOID_LABEL", process.env.VHYXVOID_LABEL ?? "default").option("--hub <url>", "Hub WebSocket URL. Env: VHYXVOID_HUB_URL", process.env.VHYXVOID_HUB_URL ?? "wss://hub.
|
|
4888
|
+
program.name("vhyxvoid").description("Platform tunnel agent.\nConnects your local server to the platform so the frontend SDK can reach it.").version(package_json_1.version).option("-k, --key <keyId>", "API key ID (e.g. vhyxvoid_dev_abc123). Env: VHYXVOID_API_KEY", process.env.VHYXVOID_API_KEY).option("-s, --secret <secret>", "API key secret (shown once at creation). Env: VHYXVOID_SECRET", process.env.VHYXVOID_SECRET).option("-p, --port <port>", "Local backend port to tunnel (e.g. 3000). Env: VHYXVOID_PORT", process.env.VHYXVOID_PORT ?? "3000").option("-l, --label <label>", "Tunnel label \u2014 identifies this agent if you run multiple. Env: VHYXVOID_LABEL", process.env.VHYXVOID_LABEL ?? "default").option("--hub <url>", "Hub WebSocket URL. Env: VHYXVOID_HUB_URL", process.env.VHYXVOID_HUB_URL ?? "wss://hub.vhyxvoid.com/agent").option("--queue-path <path>", "SQLite queue file path. Default: ~/.vhyxvoid/queue.db", process.env.VHYXVOID_QUEUE_PATH).option("--no-local-discovery", "Disable local discovery server on port 4242").parse(process.argv);
|
|
4448
4889
|
var opts = program.opts();
|
|
4449
4890
|
if (!opts.key) {
|
|
4450
4891
|
console.error("\u274C --key is required. Get your API key from the platform dashboard.");
|
|
@@ -4456,11 +4897,6 @@ if (!opts.secret) {
|
|
|
4456
4897
|
console.error(" If you lost it, rotate the key from the dashboard to get a new secret.");
|
|
4457
4898
|
process.exit(1);
|
|
4458
4899
|
}
|
|
4459
|
-
var pepper = opts.pepper;
|
|
4460
|
-
var secretHash = pepper ? crypto_1.default.createHmac("sha256", pepper).update(opts.secret).digest("hex") : crypto_1.default.createHmac("sha256", "dev-pepper").update(opts.secret).digest("hex");
|
|
4461
|
-
if (!pepper) {
|
|
4462
|
-
console.warn("\u26A0 --pepper not set. Using dev-pepper \u2014 this will not work in production.\n Set SERVER_HMAC_PEPPER to match the value in your hub environment.");
|
|
4463
|
-
}
|
|
4464
4900
|
var port = parseInt(opts.port, 10);
|
|
4465
4901
|
if (isNaN(port) || port < 1 || port > 65535) {
|
|
4466
4902
|
console.error(`\u274C Invalid port: "${opts.port}"`);
|
|
@@ -4478,7 +4914,7 @@ console.log("");
|
|
|
4478
4914
|
var agent = new AgentClient_1.AgentClient({
|
|
4479
4915
|
hubUrl: opts.hub,
|
|
4480
4916
|
keyId: opts.key,
|
|
4481
|
-
|
|
4917
|
+
secret: opts.secret,
|
|
4482
4918
|
label: opts.label,
|
|
4483
4919
|
port,
|
|
4484
4920
|
agentVersion: package_json_1.version,
|