@agentvalet/register 0.6.1 → 1.0.2

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.
Files changed (2) hide show
  1. package/dist/index.js +30 -23
  2. package/package.json +10 -4
package/dist/index.js CHANGED
@@ -988,8 +988,8 @@ import { createRequire } from "module";
988
988
  import open from "open";
989
989
  import chalk5 from "chalk";
990
990
  var _require = createRequire(import.meta.url);
991
- var FUNCTIONS_URL = "https://jmodblrolfoavrxqgbps.supabase.co/functions/v1";
992
- var SUPABASE_ANON_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Imptb2RibHJvbGZvYXZyeHFnYnBzIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzQwODIzNzYsImV4cCI6MjA4OTY1ODM3Nn0.xQQiYHXbDsHyiTd5TsAfXtNWBUGkT4eO7Ew9UH8n6UE";
991
+ var API_URL = process.env.AGENTVALET_API_URL ?? "https://api.agentvalet.ai";
992
+ var FUNCTIONS_URL = `${API_URL}/functions/v1`;
993
993
  var APP_URL = "https://app.agentvalet.ai";
994
994
  var CALLBACK_TIMEOUT_MS = 12e4;
995
995
  async function findFreePort() {
@@ -1011,8 +1011,7 @@ async function callCliAuth(body) {
1011
1011
  const res = await fetch(`${FUNCTIONS_URL}/cli-auth`, {
1012
1012
  method: "POST",
1013
1013
  headers: {
1014
- "Content-Type": "application/json",
1015
- "apikey": SUPABASE_ANON_KEY
1014
+ "Content-Type": "application/json"
1016
1015
  },
1017
1016
  body: JSON.stringify(body)
1018
1017
  });
@@ -1081,12 +1080,10 @@ async function browserLogin() {
1081
1080
  }
1082
1081
 
1083
1082
  // src/api/agentvalet.ts
1084
- var SUPABASE_URL = "https://jmodblrolfoavrxqgbps.supabase.co";
1085
- var SUPABASE_ANON_KEY2 = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Imptb2RibHJvbGZvYXZyeHFnYnBzIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzQwODIzNzYsImV4cCI6MjA4OTY1ODM3Nn0.xQQiYHXbDsHyiTd5TsAfXtNWBUGkT4eO7Ew9UH8n6UE";
1086
- var FUNCTIONS_URL2 = `${SUPABASE_URL}/functions/v1`;
1083
+ var API_URL2 = process.env.AGENTVALET_API_URL ?? "https://api.agentvalet.ai";
1084
+ var FUNCTIONS_URL2 = `${API_URL2}/functions/v1`;
1087
1085
  var baseHeaders = {
1088
- "Content-Type": "application/json",
1089
- "apikey": SUPABASE_ANON_KEY2
1086
+ "Content-Type": "application/json"
1090
1087
  };
1091
1088
  async function registerAgent2(params, apiKey) {
1092
1089
  const controller = new AbortController();
@@ -2286,16 +2283,22 @@ function injectCommand() {
2286
2283
  // src/commands/install.ts
2287
2284
  import { writeFile as writeFile9, mkdir as mkdir6 } from "fs/promises";
2288
2285
  import path7 from "path";
2286
+ import { generateKeyPairSync } from "crypto";
2289
2287
  import { Command as Command5 } from "commander";
2290
2288
  import chalk12 from "chalk";
2291
2289
  import prompts4 from "prompts";
2292
- var SUPABASE_URL2 = "https://jmodblrolfoavrxqgbps.supabase.co";
2293
- var CLAIM_URL = `${SUPABASE_URL2}/functions/v1/cli-claim-agent`;
2294
- async function claimToken(installToken) {
2295
- const resp = await fetch(CLAIM_URL, {
2290
+ var API_URL3 = process.env.AGENTVALET_API_URL ?? "https://api.agentvalet.ai";
2291
+ async function bindInstallToken(proxyUrl, bootstrapToken) {
2292
+ const { publicKey, privateKey } = generateKeyPairSync("rsa", {
2293
+ modulusLength: 2048,
2294
+ publicKeyEncoding: { type: "spki", format: "pem" },
2295
+ privateKeyEncoding: { type: "pkcs8", format: "pem" }
2296
+ });
2297
+ const url = `${proxyUrl.replace(/\/$/, "")}/v1/agents/bind`;
2298
+ const resp = await fetch(url, {
2296
2299
  method: "POST",
2297
2300
  headers: { "Content-Type": "application/json" },
2298
- body: JSON.stringify({ install_token: installToken })
2301
+ body: JSON.stringify({ bootstrap_token: bootstrapToken, public_key_pem: publicKey })
2299
2302
  });
2300
2303
  const text = await resp.text();
2301
2304
  let body = null;
@@ -2307,32 +2310,36 @@ async function claimToken(installToken) {
2307
2310
  const detail = body?.error ?? text ?? `HTTP ${resp.status}`;
2308
2311
  throw new Error(detail);
2309
2312
  }
2310
- if (!body || !body.agent_id || !body.private_key_pem) {
2313
+ if (!body || !body.agent_id || !body.owner_id || !body.proxy_url) {
2311
2314
  throw new Error("Server returned an unexpected response");
2312
2315
  }
2313
- return body;
2316
+ return { ...body, privateKeyPem: privateKey };
2314
2317
  }
2315
2318
  function installCommand() {
2316
- return new Command5("install").description("Claim an agent created in the dashboard using a one-time install token").argument("<token>", "install token (itok_...) from the dashboard").option("--no-frameworks", "skip IDE/framework configuration prompts").option("--project", "write project-scoped configs (.mcp.json, .cursor/mcp.json) instead of user-scoped (~/.claude.json, ~/.cursor/mcp.json)").action(async (token, opts) => {
2319
+ return new Command5("install").description("Install an agent on this machine using a one-time install token (generates the keypair locally and binds it)").argument("<token>", "install token (itok_...) from the dashboard").option("--no-frameworks", "skip IDE/framework configuration prompts").option("--project", "write project-scoped configs (.mcp.json, .cursor/mcp.json) instead of user-scoped (~/.claude.json, ~/.cursor/mcp.json)").action(async (token, opts) => {
2317
2320
  const scope = opts.project ? "project" : "user";
2318
2321
  if (!token.startsWith("itok_")) {
2319
2322
  console.error(chalk12.red('Invalid install token. Tokens start with "itok_".'));
2320
2323
  process.exit(3);
2321
2324
  }
2322
- console.log(chalk12.bold("\n Claiming agent\u2026"));
2325
+ console.log(chalk12.bold("\n Binding agent\u2026"));
2323
2326
  let claim;
2324
2327
  try {
2325
- claim = await claimToken(token);
2328
+ claim = await bindInstallToken(API_URL3, token);
2326
2329
  } catch (err) {
2327
2330
  const msg = err instanceof Error ? err.message : String(err);
2328
2331
  console.error(chalk12.red(`
2329
2332
  \u2717 ${msg}`));
2330
- if (msg.toLowerCase().includes("expired") || msg.toLowerCase().includes("not found")) {
2333
+ if (msg.toLowerCase().includes("expired") || msg.toLowerCase().includes("invalid") || msg.toLowerCase().includes("used")) {
2331
2334
  console.error(chalk12.dim(" Generate a fresh install command from app.agentvalet.ai/agents"));
2332
2335
  }
2333
2336
  process.exit(3);
2334
2337
  }
2335
- const { agent_id, agent_name, owner_id, private_key_pem, proxy_url } = claim;
2338
+ const agent_id = claim.agent_id;
2339
+ const owner_id = claim.owner_id;
2340
+ const private_key_pem = claim.privateKeyPem;
2341
+ const proxy_url = claim.proxy_url;
2342
+ const agent_name = claim.agent_id;
2336
2343
  try {
2337
2344
  await mkdir6(AGENT_DIR, { recursive: true });
2338
2345
  await writeFile9(AGENT_KEY_PATH, private_key_pem, { mode: 384 });
@@ -2470,7 +2477,7 @@ function installCommand() {
2470
2477
 
2471
2478
  // src/commands/claim.ts
2472
2479
  import { Command as Command6 } from "commander";
2473
- import { generateKeyPairSync } from "crypto";
2480
+ import { generateKeyPairSync as generateKeyPairSync2 } from "crypto";
2474
2481
  import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync4, existsSync as existsSync8 } from "fs";
2475
2482
  import { homedir as homedir3 } from "os";
2476
2483
  import { join as join3 } from "path";
@@ -2530,7 +2537,7 @@ function claimCommand() {
2530
2537
  process.exit(3);
2531
2538
  }
2532
2539
  const proxyUrl = opts.apiUrl.replace(/\/$/, "");
2533
- const { publicKey, privateKey } = generateKeyPairSync("rsa", {
2540
+ const { publicKey, privateKey } = generateKeyPairSync2("rsa", {
2534
2541
  modulusLength: 2048,
2535
2542
  publicKeyEncoding: { type: "spki", format: "pem" },
2536
2543
  privateKeyEncoding: { type: "pkcs8", format: "pem" }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentvalet/register",
3
- "version": "0.6.1",
3
+ "version": "1.0.2",
4
4
  "description": "Self-register AI agents with AgentValet",
5
5
  "type": "module",
6
6
  "bin": {
@@ -18,7 +18,7 @@
18
18
  "prepublishOnly": "pnpm build"
19
19
  },
20
20
  "dependencies": {
21
- "@agentvalet/mcp-server": "^0.2.0",
21
+ "@agentvalet/mcp-server": "workspace:^",
22
22
  "@modelcontextprotocol/sdk": "^1.29.0",
23
23
  "@octokit/auth-oauth-device": "^7.0.0",
24
24
  "chalk": "^5.3.0",
@@ -43,8 +43,14 @@
43
43
  },
44
44
  "repository": {
45
45
  "type": "git",
46
- "url": "git+https://github.com/MCSEdwin/agentvalet.git",
47
- "directory": "apps/cli"
46
+ "url": "git+https://github.com/agentvalet/agentvalet.git"
47
+ },
48
+ "homepage": "https://agentvalet.ai",
49
+ "bugs": {
50
+ "url": "https://github.com/agentvalet/agentvalet/issues"
51
+ },
52
+ "publishConfig": {
53
+ "access": "public"
48
54
  },
49
55
  "keywords": [
50
56
  "ai",