@agentvalet/register 0.3.7 → 0.3.9
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 +21 -17
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -806,22 +806,17 @@ Dashboard: ${proxyUrl.replace("api.", "app.")}
|
|
|
806
806
|
}
|
|
807
807
|
async function writeGlobalFrameworkConfigs(params) {
|
|
808
808
|
const written = [];
|
|
809
|
-
const
|
|
810
|
-
const codexConfigPath = path4.join(
|
|
811
|
-
if (existsSync4(
|
|
809
|
+
const codexDir = path4.join(os.homedir(), ".codex");
|
|
810
|
+
const codexConfigPath = path4.join(codexDir, "config.toml");
|
|
811
|
+
if (existsSync4(codexDir)) {
|
|
812
812
|
try {
|
|
813
|
-
const existing = await readFile2(codexConfigPath, "utf8");
|
|
814
|
-
if (!existing.includes("[
|
|
813
|
+
const existing = existsSync4(codexConfigPath) ? await readFile2(codexConfigPath, "utf8") : "";
|
|
814
|
+
if (!existing.includes("[mcp_servers.agentvalet]")) {
|
|
815
815
|
const addition = `
|
|
816
|
-
[
|
|
816
|
+
[mcp_servers.agentvalet]
|
|
817
817
|
command = "npx"
|
|
818
|
-
args = ["-y", "@agentvalet/mcp-server"]
|
|
819
|
-
|
|
820
|
-
[mcp.servers.agentvalet.env]
|
|
821
|
-
AGENT_ID = "${params.agentId}"
|
|
822
|
-
OWNER_ID = "${params.ownerId}"
|
|
823
|
-
PROXY_URL = "${params.proxyUrl}"
|
|
824
|
-
AGENT_PRIVATE_KEY = "${privateKeyEscaped}"
|
|
818
|
+
args = ["-y", "@agentvalet/register", "mcp-server"]
|
|
819
|
+
env = { AGENT_ID = "${params.agentId}", OWNER_ID = "${params.ownerId}", PROXY_URL = "${params.proxyUrl}", AGENT_PRIVATE_KEY_PATH = "${params.keyPath.replace(/\\/g, "/")}" }
|
|
825
820
|
`;
|
|
826
821
|
await appendFile3(codexConfigPath, addition, "utf8");
|
|
827
822
|
written.push("~/.codex/config.toml");
|
|
@@ -873,10 +868,19 @@ async function writeIdeConfigs(params) {
|
|
|
873
868
|
|
|
874
869
|
// src/config/frameworks.ts
|
|
875
870
|
import { existsSync as existsSync5 } from "fs";
|
|
871
|
+
import { execSync as execSync2 } from "child_process";
|
|
876
872
|
import os2 from "os";
|
|
877
873
|
import path5 from "path";
|
|
878
874
|
import prompts2 from "prompts";
|
|
879
875
|
import chalk5 from "chalk";
|
|
876
|
+
function tryBinary(cmd) {
|
|
877
|
+
try {
|
|
878
|
+
execSync2(`${cmd} --version`, { stdio: "ignore", timeout: 3e3 });
|
|
879
|
+
return true;
|
|
880
|
+
} catch {
|
|
881
|
+
return false;
|
|
882
|
+
}
|
|
883
|
+
}
|
|
880
884
|
function cursorInstalled() {
|
|
881
885
|
const home = os2.homedir();
|
|
882
886
|
const platform = process.platform;
|
|
@@ -893,8 +897,8 @@ function cursorInstalled() {
|
|
|
893
897
|
function detectFrameworks() {
|
|
894
898
|
const home = os2.homedir();
|
|
895
899
|
return {
|
|
896
|
-
codex: existsSync5(path5.join(home, ".codex"
|
|
897
|
-
claudeCode: existsSync5(path5.join(home, ".claude")),
|
|
900
|
+
codex: existsSync5(path5.join(home, ".codex")) || tryBinary("codex"),
|
|
901
|
+
claudeCode: existsSync5(path5.join(home, ".claude")) || tryBinary("claude"),
|
|
898
902
|
cursor: existsSync5(path5.join(process.cwd(), ".cursor")) || cursorInstalled(),
|
|
899
903
|
openclaw: existsSync5(path5.join(home, ".openclaw"))
|
|
900
904
|
};
|
|
@@ -1135,7 +1139,7 @@ async function registerAgentFlow(apiKey, ownerId) {
|
|
|
1135
1139
|
agentId: agent.agent_id,
|
|
1136
1140
|
ownerId,
|
|
1137
1141
|
proxyUrl: getStoredConfig().proxyUrl,
|
|
1138
|
-
|
|
1142
|
+
keyPath: path6.join(process.cwd(), ".agentvalet", "agent.key")
|
|
1139
1143
|
});
|
|
1140
1144
|
for (const r of globalResults) {
|
|
1141
1145
|
console.log(chalk6.green(` \u2713 ${r}`));
|
|
@@ -1188,7 +1192,7 @@ function collectScope(value, previous) {
|
|
|
1188
1192
|
return [...previous, value];
|
|
1189
1193
|
}
|
|
1190
1194
|
var program = new Command();
|
|
1191
|
-
program.name("agentvalet-register").description("Self-register an AI agent with AgentValet").version("0.3.
|
|
1195
|
+
program.name("agentvalet-register").description("Self-register an AI agent with AgentValet").version("0.3.9").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) => {
|
|
1192
1196
|
const isJson = !!opts.json;
|
|
1193
1197
|
let ownerId = opts.owner ?? process.env.AGENTVALET_OWNER ?? "";
|
|
1194
1198
|
let agentName = opts.name ?? "";
|