@agentvalet/register 0.4.2 → 0.4.4
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
CHANGED
|
@@ -392,12 +392,12 @@ ${platformSections}
|
|
|
392
392
|
|
|
393
393
|
## How to call a platform
|
|
394
394
|
|
|
395
|
-
All platform calls **must** go through the \`
|
|
395
|
+
All platform calls **must** go through the \`mcp__agentvalet__use_platform\` MCP tool.
|
|
396
396
|
|
|
397
397
|
**NEVER** write inline JWT signing code, \`node -e\` scripts, or manual HTTP calls. The MCP tool handles all authentication internally.
|
|
398
398
|
|
|
399
399
|
\`\`\`
|
|
400
|
-
|
|
400
|
+
mcp__agentvalet__use_platform({
|
|
401
401
|
platform: "<platformId>",
|
|
402
402
|
endpoint: "<endpoint>",
|
|
403
403
|
method: "POST",
|
|
@@ -514,6 +514,16 @@ async function runRefresh(options) {
|
|
|
514
514
|
}
|
|
515
515
|
}
|
|
516
516
|
}
|
|
517
|
+
if (!agentId || !ownerId || !keyPath) {
|
|
518
|
+
try {
|
|
519
|
+
const global = getStoredConfig();
|
|
520
|
+
if (!agentId && global.lastAgentId) agentId = global.lastAgentId;
|
|
521
|
+
if (!ownerId && global.ownerId) ownerId = global.ownerId;
|
|
522
|
+
if (!keyPath && global.lastKeyPath) keyPath = global.lastKeyPath;
|
|
523
|
+
if (!apiUrl && global.proxyUrl) apiUrl = global.proxyUrl;
|
|
524
|
+
} catch {
|
|
525
|
+
}
|
|
526
|
+
}
|
|
517
527
|
if (!agentId || !ownerId || !keyPath) {
|
|
518
528
|
throw new Error(
|
|
519
529
|
`Cannot find agent credentials.
|
|
@@ -596,7 +606,7 @@ function ensureHook() {
|
|
|
596
606
|
}
|
|
597
607
|
const perms = settings.permissions ?? {};
|
|
598
608
|
const allow = perms.allow ?? [];
|
|
599
|
-
const mcpAllows = ["
|
|
609
|
+
const mcpAllows = ["mcp__agentvalet__list_platforms", "mcp__agentvalet__use_platform"];
|
|
600
610
|
const missing = mcpAllows.filter((e) => !allow.includes(e));
|
|
601
611
|
if (missing.length > 0) {
|
|
602
612
|
perms.allow = [...allow, ...missing];
|
|
@@ -617,7 +627,7 @@ function ensureMcpJson() {
|
|
|
617
627
|
}
|
|
618
628
|
}
|
|
619
629
|
const servers = mcpConfig.mcpServers ?? {};
|
|
620
|
-
if (servers["
|
|
630
|
+
if (servers["agentvalet"]) return;
|
|
621
631
|
let agentId;
|
|
622
632
|
let ownerId;
|
|
623
633
|
let apiUrl = "https://api.agentvalet.ai";
|
|
@@ -652,7 +662,7 @@ function ensureMcpJson() {
|
|
|
652
662
|
}
|
|
653
663
|
}
|
|
654
664
|
if (!agentId || !ownerId || !keyPath) return;
|
|
655
|
-
servers["
|
|
665
|
+
servers["agentvalet"] = {
|
|
656
666
|
command: "npx",
|
|
657
667
|
args: ["-y", "@agentvalet/register", "mcp-server"],
|
|
658
668
|
env: {
|
|
@@ -896,10 +906,10 @@ Never call platform APIs (Slack, Stripe, Gmail, GitHub, etc.) directly.
|
|
|
896
906
|
|
|
897
907
|
## Making a platform call
|
|
898
908
|
|
|
899
|
-
Use the \`
|
|
909
|
+
Use the \`mcp__agentvalet__use_platform\` MCP tool:
|
|
900
910
|
|
|
901
911
|
\`\`\`
|
|
902
|
-
|
|
912
|
+
mcp__agentvalet__use_platform({
|
|
903
913
|
platform: "slack",
|
|
904
914
|
endpoint: "/api/chat.postMessage",
|
|
905
915
|
method: "POST",
|
|
@@ -910,8 +920,8 @@ mcp__agent-authority__use_platform({
|
|
|
910
920
|
|
|
911
921
|
## Before any platform session
|
|
912
922
|
|
|
913
|
-
1. Call \`
|
|
914
|
-
2. Call \`
|
|
923
|
+
1. Call \`mcp__agentvalet__list_platforms\` to see approved platforms and scopes
|
|
924
|
+
2. Call \`mcp__agentvalet__authzen_evaluate\` before destructive operations
|
|
915
925
|
3. If a call returns \`pending_approval\` \u2014 wait, do not retry
|
|
916
926
|
|
|
917
927
|
## Rules
|
|
@@ -1094,7 +1104,7 @@ async function runOnboard() {
|
|
|
1094
1104
|
console.log(chalk6.dim(" Signed out. Run again to re-authenticate."));
|
|
1095
1105
|
return;
|
|
1096
1106
|
}
|
|
1097
|
-
await registerAgentFlow(stored.
|
|
1107
|
+
await registerAgentFlow(stored.cliToken, stored.ownerId);
|
|
1098
1108
|
return;
|
|
1099
1109
|
}
|
|
1100
1110
|
const { authMethod } = await prompts3({
|
|
@@ -1169,9 +1179,10 @@ async function runOnboard() {
|
|
|
1169
1179
|
orgId: account.org_id,
|
|
1170
1180
|
proxyUrl: account.proxy_url,
|
|
1171
1181
|
githubUsername: githubUser.login,
|
|
1172
|
-
email: githubUser.email
|
|
1182
|
+
email: githubUser.email,
|
|
1183
|
+
cliToken: account.cli_token
|
|
1173
1184
|
});
|
|
1174
|
-
await registerAgentFlow(account.
|
|
1185
|
+
await registerAgentFlow(account.cli_token, account.owner_id);
|
|
1175
1186
|
}
|
|
1176
1187
|
async function ownerIdFlow() {
|
|
1177
1188
|
console.log("");
|
|
@@ -1201,9 +1212,10 @@ async function ownerIdFlow() {
|
|
|
1201
1212
|
ownerId: account.owner_id,
|
|
1202
1213
|
orgId: account.org_id,
|
|
1203
1214
|
proxyUrl: "https://api.agentvalet.ai",
|
|
1204
|
-
email: account.email ?? ""
|
|
1215
|
+
email: account.email ?? "",
|
|
1216
|
+
cliToken: account.cli_token
|
|
1205
1217
|
});
|
|
1206
|
-
await registerAgentFlow(account.
|
|
1218
|
+
await registerAgentFlow(account.cli_token, account.owner_id);
|
|
1207
1219
|
}
|
|
1208
1220
|
async function registerAgentFlow(apiKey, ownerId) {
|
|
1209
1221
|
const hostname = os3.hostname().split(".")[0];
|
|
@@ -1240,6 +1252,7 @@ async function registerAgentFlow(apiKey, ownerId) {
|
|
|
1240
1252
|
proxyUrl,
|
|
1241
1253
|
privateKeyPem: agent.private_key_pem
|
|
1242
1254
|
});
|
|
1255
|
+
saveConfig({ lastAgentId: agent.agent_id, lastKeyPath: keyPath });
|
|
1243
1256
|
} catch (err) {
|
|
1244
1257
|
console.error(chalk6.red(` \u2717 Failed to write local config: ${err.message}`));
|
|
1245
1258
|
console.log(chalk6.dim(" Agent was registered \u2014 run again to save config locally."));
|
|
@@ -1340,7 +1353,7 @@ function collectScope(value, previous) {
|
|
|
1340
1353
|
return [...previous, value];
|
|
1341
1354
|
}
|
|
1342
1355
|
var program = new Command();
|
|
1343
|
-
program.name("agentvalet-register").description("Self-register an AI agent with AgentValet").version("0.4.
|
|
1356
|
+
program.name("agentvalet-register").description("Self-register an AI agent with AgentValet").version("0.4.4").option("--owner <uuid>", "Owner ID (or set AGENTVALET_OWNER env var)").option("--name <name>", "Agent name").option("--description <desc>", "Agent description").option("--scope <platform:scope>", "Requested scope, repeatable", collectScope, []).option("--api-url <url>", "AgentValet API base URL", "https://api.agentvalet.ai").option("--output <path>", "Path to write .env file", "./.env.agentvalet").option("--key-path <path>", "Path to write private key", "./agentvalet.key").option("--json", "Machine-readable JSON output").option("--no-wait", "Register only, do not wait for approval").option("--timeout <seconds>", "Approval wait timeout in seconds", "300").action(async (opts) => {
|
|
1344
1357
|
const isJson = !!opts.json;
|
|
1345
1358
|
let ownerId = opts.owner ?? process.env.AGENTVALET_OWNER ?? "";
|
|
1346
1359
|
let agentName = opts.name ?? "";
|
|
@@ -1458,6 +1471,9 @@ Approve at: https://app.agentvalet.ai/agents
|
|
|
1458
1471
|
process.exit(3);
|
|
1459
1472
|
}
|
|
1460
1473
|
const keyWritten = !!privateKey;
|
|
1474
|
+
if (keyWritten) {
|
|
1475
|
+
saveConfig({ lastAgentId: agentId, lastKeyPath: keyPath, ownerId: resolvedOwnerId });
|
|
1476
|
+
}
|
|
1461
1477
|
if (isJson) {
|
|
1462
1478
|
console.log(JSON.stringify({ status: "approved", agentId, keyPath: keyWritten ? keyPath : null, envPath }));
|
|
1463
1479
|
} else {
|
|
@@ -1508,7 +1524,7 @@ program.command("refresh").description("Refresh approved permissions and update
|
|
|
1508
1524
|
}
|
|
1509
1525
|
});
|
|
1510
1526
|
program.command("mcp-server").description("Start the AgentValet MCP server (stdio transport)").action(async () => {
|
|
1511
|
-
await import("./mcp-server-
|
|
1527
|
+
await import("./mcp-server-SBGWYBP7.js");
|
|
1512
1528
|
});
|
|
1513
1529
|
program.parseAsync().catch((err) => {
|
|
1514
1530
|
console.error(err);
|
|
@@ -8,7 +8,7 @@ if (!process.env.AGENT_PRIVATE_KEY && process.env.AGENT_PRIVATE_KEY_PATH) {
|
|
|
8
8
|
try {
|
|
9
9
|
process.env.AGENT_PRIVATE_KEY = readFileSync(process.env.AGENT_PRIVATE_KEY_PATH, "utf-8").trim();
|
|
10
10
|
} catch (err) {
|
|
11
|
-
process.stderr.write(`[
|
|
11
|
+
process.stderr.write(`[agentvalet] Cannot read AGENT_PRIVATE_KEY_PATH: ${err instanceof Error ? err.message : err}
|
|
12
12
|
`);
|
|
13
13
|
process.exit(1);
|
|
14
14
|
}
|
|
@@ -16,7 +16,7 @@ if (!process.env.AGENT_PRIVATE_KEY && process.env.AGENT_PRIVATE_KEY_PATH) {
|
|
|
16
16
|
var REQUIRED = ["AGENT_PRIVATE_KEY", "AGENT_ID", "OWNER_ID", "PROXY_URL"];
|
|
17
17
|
for (const key of REQUIRED) {
|
|
18
18
|
if (!process.env[key]) {
|
|
19
|
-
process.stderr.write(`[
|
|
19
|
+
process.stderr.write(`[agentvalet] Missing env var: ${key}
|
|
20
20
|
`);
|
|
21
21
|
process.exit(1);
|
|
22
22
|
}
|
|
@@ -65,7 +65,7 @@ function errResult(msg) {
|
|
|
65
65
|
}
|
|
66
66
|
var ALLOWED_METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE"];
|
|
67
67
|
var server = new Server(
|
|
68
|
-
{ name: "
|
|
68
|
+
{ name: "agentvalet", version: "1.0.0" },
|
|
69
69
|
{ capabilities: { tools: {} } }
|
|
70
70
|
);
|
|
71
71
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|