@agentvalet/register 1.6.0 → 1.7.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/index.js +27 -10
- package/package.json +12 -11
package/dist/index.js
CHANGED
|
@@ -1263,6 +1263,7 @@ async function browserLogin() {
|
|
|
1263
1263
|
}
|
|
1264
1264
|
|
|
1265
1265
|
// src/api/agentvalet.ts
|
|
1266
|
+
import { generateKeyPairSync } from "crypto";
|
|
1266
1267
|
var API_URL2 = process.env.AGENTVALET_API_URL ?? "https://api.agentvalet.ai";
|
|
1267
1268
|
var FUNCTIONS_URL2 = `${API_URL2}/functions/v1`;
|
|
1268
1269
|
var baseHeaders = {
|
|
@@ -1295,6 +1296,20 @@ async function registerAgent2(params, apiKey) {
|
|
|
1295
1296
|
clearTimeout(timeout);
|
|
1296
1297
|
}
|
|
1297
1298
|
}
|
|
1299
|
+
async function registerAgentWithLocalKey(params, apiKey) {
|
|
1300
|
+
const { publicKey, privateKey } = generateKeyPairSync("rsa", {
|
|
1301
|
+
modulusLength: 2048,
|
|
1302
|
+
publicKeyEncoding: { type: "spki", format: "pem" },
|
|
1303
|
+
privateKeyEncoding: { type: "pkcs8", format: "pem" }
|
|
1304
|
+
});
|
|
1305
|
+
const agent = await registerAgent2({ ...params, public_key_pem: publicKey }, apiKey);
|
|
1306
|
+
if (agent.private_key_pem || agent.public_key_pem?.trim() !== publicKey.trim()) {
|
|
1307
|
+
throw new Error(
|
|
1308
|
+
`The server did not accept this machine's public key, so agent ${agent.agent_id} cannot use it. Delete that agent in the dashboard and try again later, or report this to AgentValet support.`
|
|
1309
|
+
);
|
|
1310
|
+
}
|
|
1311
|
+
return { agent, privateKeyPem: privateKey };
|
|
1312
|
+
}
|
|
1298
1313
|
|
|
1299
1314
|
// src/config/local.ts
|
|
1300
1315
|
import { mkdir as mkdir2, writeFile as writeFile2, appendFile, readFile } from "fs/promises";
|
|
@@ -1696,13 +1711,14 @@ async function registerAgentFlow(apiKey, ownerId, scope = "user", presetName) {
|
|
|
1696
1711
|
const agentType = resolveAgentType(detectedAtRegister);
|
|
1697
1712
|
const spinner = ora(" Registering agent...").start();
|
|
1698
1713
|
let agent;
|
|
1714
|
+
let privateKeyPem;
|
|
1699
1715
|
try {
|
|
1700
|
-
agent = await
|
|
1716
|
+
({ agent, privateKeyPem } = await registerAgentWithLocalKey({
|
|
1701
1717
|
owner_id: ownerId,
|
|
1702
1718
|
name: agentName.trim(),
|
|
1703
1719
|
source: "cli",
|
|
1704
1720
|
agent_type: agentType
|
|
1705
|
-
}, apiKey);
|
|
1721
|
+
}, apiKey));
|
|
1706
1722
|
spinner.succeed(` Agent registered: ${chalk7.bold(agent.agent_id)}`);
|
|
1707
1723
|
} catch (err) {
|
|
1708
1724
|
spinner.fail(` Registration failed: ${err.message}`);
|
|
@@ -1715,7 +1731,7 @@ async function registerAgentFlow(apiKey, ownerId, scope = "user", presetName) {
|
|
|
1715
1731
|
agentId: agent.agent_id,
|
|
1716
1732
|
agentName: agent.agent_name,
|
|
1717
1733
|
proxyUrl,
|
|
1718
|
-
privateKeyPem
|
|
1734
|
+
privateKeyPem
|
|
1719
1735
|
});
|
|
1720
1736
|
saveConfig({ lastAgentId: agent.agent_id, lastKeyPath: keyPath });
|
|
1721
1737
|
} catch (err) {
|
|
@@ -1811,7 +1827,7 @@ async function registerAgentFlow(apiKey, ownerId, scope = "user", presetName) {
|
|
|
1811
1827
|
console.log(
|
|
1812
1828
|
` Dashboard: ${chalk7.cyan.underline("https://app.agentvalet.ai")}`
|
|
1813
1829
|
);
|
|
1814
|
-
console.log(chalk7.dim("
|
|
1830
|
+
console.log(chalk7.dim(" The agent is active but has no access yet. Grant it platforms on its page in the dashboard."));
|
|
1815
1831
|
console.log("");
|
|
1816
1832
|
if (shouldSetup) {
|
|
1817
1833
|
if (scope === "user") {
|
|
@@ -2447,13 +2463,13 @@ function injectCommand() {
|
|
|
2447
2463
|
// src/commands/install.ts
|
|
2448
2464
|
import { writeFile as writeFile9, mkdir as mkdir6 } from "fs/promises";
|
|
2449
2465
|
import path7 from "path";
|
|
2450
|
-
import { generateKeyPairSync } from "crypto";
|
|
2466
|
+
import { generateKeyPairSync as generateKeyPairSync2 } from "crypto";
|
|
2451
2467
|
import { Command as Command5 } from "commander";
|
|
2452
2468
|
import chalk12 from "chalk";
|
|
2453
2469
|
import prompts4 from "prompts";
|
|
2454
2470
|
var API_URL3 = process.env.AGENTVALET_API_URL ?? "https://api.agentvalet.ai";
|
|
2455
2471
|
async function bindInstallToken(proxyUrl, bootstrapToken) {
|
|
2456
|
-
const { publicKey, privateKey } =
|
|
2472
|
+
const { publicKey, privateKey } = generateKeyPairSync2("rsa", {
|
|
2457
2473
|
modulusLength: 2048,
|
|
2458
2474
|
publicKeyEncoding: { type: "spki", format: "pem" },
|
|
2459
2475
|
privateKeyEncoding: { type: "pkcs8", format: "pem" }
|
|
@@ -2648,7 +2664,7 @@ function installCommand() {
|
|
|
2648
2664
|
|
|
2649
2665
|
// src/commands/claim.ts
|
|
2650
2666
|
import { Command as Command6 } from "commander";
|
|
2651
|
-
import { generateKeyPairSync as
|
|
2667
|
+
import { generateKeyPairSync as generateKeyPairSync3 } from "crypto";
|
|
2652
2668
|
import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync4, existsSync as existsSync9 } from "fs";
|
|
2653
2669
|
import { homedir as homedir3 } from "os";
|
|
2654
2670
|
import { join as join5 } from "path";
|
|
@@ -2708,7 +2724,7 @@ function claimCommand() {
|
|
|
2708
2724
|
process.exit(3);
|
|
2709
2725
|
}
|
|
2710
2726
|
const proxyUrl = opts.apiUrl.replace(/\/$/, "");
|
|
2711
|
-
const { publicKey, privateKey } =
|
|
2727
|
+
const { publicKey, privateKey } = generateKeyPairSync3("rsa", {
|
|
2712
2728
|
modulusLength: 2048,
|
|
2713
2729
|
publicKeyEncoding: { type: "spki", format: "pem" },
|
|
2714
2730
|
privateKeyEncoding: { type: "pkcs8", format: "pem" }
|
|
@@ -2818,9 +2834,10 @@ function respondToCredentialRequest(action, request2, creds, privateKeyPem) {
|
|
|
2818
2834
|
password=${jwt}
|
|
2819
2835
|
`;
|
|
2820
2836
|
}
|
|
2837
|
+
var GIT_HELPER_COMMAND = "npx --yes @agentvalet/register git-credential";
|
|
2821
2838
|
function gitConfigLine(apiUrl) {
|
|
2822
2839
|
const origin = new URL(apiUrl).origin;
|
|
2823
|
-
return [`credential.${origin}.helper`,
|
|
2840
|
+
return [`credential.${origin}.helper`, `!${GIT_HELPER_COMMAND}`];
|
|
2824
2841
|
}
|
|
2825
2842
|
async function readStdin() {
|
|
2826
2843
|
const chunks = [];
|
|
@@ -2828,7 +2845,7 @@ async function readStdin() {
|
|
|
2828
2845
|
return Buffer.concat(chunks).toString("utf8");
|
|
2829
2846
|
}
|
|
2830
2847
|
function gitCredentialCommand() {
|
|
2831
|
-
return new Command7("git-credential").description("git credential helper: answers the AgentValet proxy with this agent's JWT (used via `agentvalet git-setup`)").argument("<action>", "get | store | erase (supplied by git)").action(async (action) => {
|
|
2848
|
+
return new Command7("git-credential").description("git credential helper: answers the AgentValet proxy with this agent's JWT (used via `npx @agentvalet/register git-setup`)").argument("<action>", "get | store | erase (supplied by git)").action(async (action) => {
|
|
2832
2849
|
const creds = resolveAgent();
|
|
2833
2850
|
const request2 = parseCredentialInput(await readStdin());
|
|
2834
2851
|
if (action !== "get") return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentvalet/register",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "Self-register AI agents with AgentValet",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -10,6 +10,13 @@
|
|
|
10
10
|
"dist",
|
|
11
11
|
"README.md"
|
|
12
12
|
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsup src/index.ts --format esm --dts --clean --shims",
|
|
15
|
+
"dev": "tsx src/index.ts",
|
|
16
|
+
"test": "vitest run",
|
|
17
|
+
"typecheck": "tsc --noEmit",
|
|
18
|
+
"prepublishOnly": "node ../../scripts/no-secrets.mjs && pnpm build && node ../../scripts/no-workspace-protocol.mjs"
|
|
19
|
+
},
|
|
13
20
|
"dependencies": {
|
|
14
21
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
15
22
|
"@octokit/auth-oauth-device": "^7.0.0",
|
|
@@ -22,13 +29,13 @@
|
|
|
22
29
|
"undici": "^6.0.0"
|
|
23
30
|
},
|
|
24
31
|
"devDependencies": {
|
|
32
|
+
"@agentvalet/mcp-server": "workspace:^",
|
|
25
33
|
"@types/node": "^20.0.0",
|
|
26
34
|
"@types/prompts": "^2.4.0",
|
|
27
35
|
"tsup": "^8.0.0",
|
|
28
36
|
"tsx": "^4.0.0",
|
|
29
37
|
"typescript": "^5.0.0",
|
|
30
|
-
"vitest": "^1.5.0"
|
|
31
|
-
"@agentvalet/mcp-server": "^1.14.0"
|
|
38
|
+
"vitest": "^1.5.0"
|
|
32
39
|
},
|
|
33
40
|
"engines": {
|
|
34
41
|
"node": ">=18"
|
|
@@ -54,11 +61,5 @@
|
|
|
54
61
|
"valet",
|
|
55
62
|
"agentvalet"
|
|
56
63
|
],
|
|
57
|
-
"license": "MIT"
|
|
58
|
-
|
|
59
|
-
"build": "tsup src/index.ts --format esm --dts --clean --shims",
|
|
60
|
-
"dev": "tsx src/index.ts",
|
|
61
|
-
"test": "vitest run",
|
|
62
|
-
"typecheck": "tsc --noEmit"
|
|
63
|
-
}
|
|
64
|
-
}
|
|
64
|
+
"license": "MIT"
|
|
65
|
+
}
|