@agentvalet/register 0.3.9 → 0.4.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 +20 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -938,6 +938,7 @@ async function frameworkSetupConsent(detected) {
|
|
|
938
938
|
// src/commands/onboard.ts
|
|
939
939
|
import os3 from "os";
|
|
940
940
|
import path6 from "path";
|
|
941
|
+
import { writeFile as writeFile5 } from "fs/promises";
|
|
941
942
|
async function runOnboard() {
|
|
942
943
|
console.log("");
|
|
943
944
|
console.log(chalk6.bold(" AgentValet \u2014 Agent Registration"));
|
|
@@ -1107,11 +1108,13 @@ async function registerAgentFlow(apiKey, ownerId) {
|
|
|
1107
1108
|
spinner.fail(` Registration failed: ${err.message}`);
|
|
1108
1109
|
process.exit(1);
|
|
1109
1110
|
}
|
|
1111
|
+
const keyPath = path6.join(process.cwd(), ".agentvalet", "agent.key");
|
|
1112
|
+
const proxyUrl = getStoredConfig().proxyUrl;
|
|
1110
1113
|
try {
|
|
1111
1114
|
await writeLocalConfig({
|
|
1112
1115
|
agentId: agent.agent_id,
|
|
1113
1116
|
agentName: agent.agent_name,
|
|
1114
|
-
proxyUrl
|
|
1117
|
+
proxyUrl,
|
|
1115
1118
|
privateKeyPem: agent.private_key_pem
|
|
1116
1119
|
});
|
|
1117
1120
|
} catch (err) {
|
|
@@ -1119,6 +1122,17 @@ async function registerAgentFlow(apiKey, ownerId) {
|
|
|
1119
1122
|
console.log(chalk6.dim(" Agent was registered \u2014 run again to save config locally."));
|
|
1120
1123
|
process.exit(1);
|
|
1121
1124
|
}
|
|
1125
|
+
try {
|
|
1126
|
+
const envContent = [
|
|
1127
|
+
"# AgentValet \u2014 generated by agentvalet-register",
|
|
1128
|
+
`AGENTVALET_AGENT_ID=${agent.agent_id}`,
|
|
1129
|
+
`AGENTVALET_OWNER_ID=${ownerId}`,
|
|
1130
|
+
`AGENTVALET_API_URL=${proxyUrl}`,
|
|
1131
|
+
`AGENTVALET_PRIVATE_KEY_PATH=${keyPath}`
|
|
1132
|
+
].join("\n") + "\n";
|
|
1133
|
+
await writeFile5(path6.join(process.cwd(), ".env.agentvalet"), envContent, { encoding: "utf8", mode: 384 });
|
|
1134
|
+
} catch {
|
|
1135
|
+
}
|
|
1122
1136
|
const detected = detectFrameworks();
|
|
1123
1137
|
const shouldSetup = await frameworkSetupConsent(detected);
|
|
1124
1138
|
if (shouldSetup) {
|
|
@@ -1128,8 +1142,8 @@ async function registerAgentFlow(apiKey, ownerId) {
|
|
|
1128
1142
|
const ideResults = await writeIdeConfigs({
|
|
1129
1143
|
agentId: agent.agent_id,
|
|
1130
1144
|
ownerId,
|
|
1131
|
-
proxyUrl
|
|
1132
|
-
keyPath
|
|
1145
|
+
proxyUrl,
|
|
1146
|
+
keyPath,
|
|
1133
1147
|
detected
|
|
1134
1148
|
});
|
|
1135
1149
|
for (const r of ideResults) {
|
|
@@ -1138,8 +1152,8 @@ async function registerAgentFlow(apiKey, ownerId) {
|
|
|
1138
1152
|
const globalResults = await writeGlobalFrameworkConfigs({
|
|
1139
1153
|
agentId: agent.agent_id,
|
|
1140
1154
|
ownerId,
|
|
1141
|
-
proxyUrl
|
|
1142
|
-
keyPath
|
|
1155
|
+
proxyUrl,
|
|
1156
|
+
keyPath
|
|
1143
1157
|
});
|
|
1144
1158
|
for (const r of globalResults) {
|
|
1145
1159
|
console.log(chalk6.green(` \u2713 ${r}`));
|
|
@@ -1192,7 +1206,7 @@ function collectScope(value, previous) {
|
|
|
1192
1206
|
return [...previous, value];
|
|
1193
1207
|
}
|
|
1194
1208
|
var program = new Command();
|
|
1195
|
-
program.name("agentvalet-register").description("Self-register an AI agent with AgentValet").version("0.
|
|
1209
|
+
program.name("agentvalet-register").description("Self-register an AI agent with AgentValet").version("0.4.0").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) => {
|
|
1196
1210
|
const isJson = !!opts.json;
|
|
1197
1211
|
let ownerId = opts.owner ?? process.env.AGENTVALET_OWNER ?? "";
|
|
1198
1212
|
let agentName = opts.name ?? "";
|