@agentvalet/register 0.4.15 → 0.4.17
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.
|
@@ -13,7 +13,11 @@ function getStoredConfig() {
|
|
|
13
13
|
return store.store;
|
|
14
14
|
}
|
|
15
15
|
function saveConfig(config) {
|
|
16
|
-
|
|
16
|
+
const filtered = {};
|
|
17
|
+
for (const [k, v] of Object.entries(config)) {
|
|
18
|
+
if (v !== void 0) filtered[k] = v;
|
|
19
|
+
}
|
|
20
|
+
store.set(filtered);
|
|
17
21
|
}
|
|
18
22
|
function clearConfig() {
|
|
19
23
|
store.clear();
|
package/dist/index.js
CHANGED
|
@@ -6,12 +6,12 @@ import {
|
|
|
6
6
|
getStoredConfig,
|
|
7
7
|
isAuthenticated,
|
|
8
8
|
saveConfig
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-CSOYDHNO.js";
|
|
10
10
|
|
|
11
11
|
// src/index.ts
|
|
12
12
|
import { createRequire as createRequire2 } from "module";
|
|
13
|
-
import { Command as
|
|
14
|
-
import
|
|
13
|
+
import { Command as Command6 } from "commander";
|
|
14
|
+
import chalk13 from "chalk";
|
|
15
15
|
|
|
16
16
|
// src/wizard.ts
|
|
17
17
|
import prompts from "prompts";
|
|
@@ -1571,7 +1571,7 @@ import { Command } from "commander";
|
|
|
1571
1571
|
import chalk8 from "chalk";
|
|
1572
1572
|
|
|
1573
1573
|
// src/lib/api.ts
|
|
1574
|
-
async function request(
|
|
1574
|
+
async function request(path8, options) {
|
|
1575
1575
|
const config = getStoredConfig();
|
|
1576
1576
|
const token = config.cliToken;
|
|
1577
1577
|
if (!token) {
|
|
@@ -1580,7 +1580,7 @@ async function request(path7, options) {
|
|
|
1580
1580
|
);
|
|
1581
1581
|
}
|
|
1582
1582
|
const proxyUrl = config.proxyUrl ?? "https://api.agentvalet.ai";
|
|
1583
|
-
const response = await fetch(`${proxyUrl}/functions/v1${
|
|
1583
|
+
const response = await fetch(`${proxyUrl}/functions/v1${path8}`, {
|
|
1584
1584
|
method: options.method,
|
|
1585
1585
|
headers: {
|
|
1586
1586
|
"Authorization": `Bearer ${token}`,
|
|
@@ -1763,24 +1763,25 @@ function injectCommand() {
|
|
|
1763
1763
|
import { Command as Command4 } from "commander";
|
|
1764
1764
|
import chalk11 from "chalk";
|
|
1765
1765
|
import { existsSync as existsSync7, readFileSync as readFileSync4, writeFileSync as writeFileSync3, rmSync } from "fs";
|
|
1766
|
-
import { resolve as resolve3 } from "path";
|
|
1766
|
+
import { resolve as resolve3, join as join2 } from "path";
|
|
1767
|
+
import { homedir as homedir2 } from "os";
|
|
1767
1768
|
var CLAUDE_START2 = "<!-- agentvalet:start -->";
|
|
1768
1769
|
var CLAUDE_END2 = "<!-- agentvalet:end -->";
|
|
1769
1770
|
var HOOK_MARKER2 = "agentvalet/register refresh";
|
|
1770
1771
|
function stripClaudeMd() {
|
|
1771
|
-
const
|
|
1772
|
-
if (!existsSync7(
|
|
1773
|
-
let content = readFileSync4(
|
|
1772
|
+
const path8 = resolve3("CLAUDE.md");
|
|
1773
|
+
if (!existsSync7(path8)) return;
|
|
1774
|
+
let content = readFileSync4(path8, "utf-8");
|
|
1774
1775
|
content = content.replace(new RegExp(`${CLAUDE_START2}[\\s\\S]*?${CLAUDE_END2}`, "m"), "");
|
|
1775
1776
|
content = content.replace(/^@\.claude\/agentvalet-permissions\.md\s*$/m, "");
|
|
1776
1777
|
content = content.replace(/(\r?\n){3,}/g, "\n\n").trim();
|
|
1777
|
-
writeFileSync3(
|
|
1778
|
+
writeFileSync3(path8, content ? content + "\n" : "", "utf-8");
|
|
1778
1779
|
}
|
|
1779
1780
|
function stripSettingsJson() {
|
|
1780
|
-
const
|
|
1781
|
-
if (!existsSync7(
|
|
1781
|
+
const path8 = resolve3(".claude/settings.local.json");
|
|
1782
|
+
if (!existsSync7(path8)) return;
|
|
1782
1783
|
try {
|
|
1783
|
-
const settings = JSON.parse(readFileSync4(
|
|
1784
|
+
const settings = JSON.parse(readFileSync4(path8, "utf-8"));
|
|
1784
1785
|
const hooks = settings.hooks ?? {};
|
|
1785
1786
|
const ups = hooks.UserPromptSubmit ?? [];
|
|
1786
1787
|
hooks.UserPromptSubmit = ups.filter(
|
|
@@ -1791,24 +1792,65 @@ function stripSettingsJson() {
|
|
|
1791
1792
|
const allow = perms.allow ?? [];
|
|
1792
1793
|
perms.allow = allow.filter((e) => !e.startsWith("mcp__agentvalet__"));
|
|
1793
1794
|
settings.permissions = perms;
|
|
1794
|
-
writeFileSync3(
|
|
1795
|
+
writeFileSync3(path8, JSON.stringify(settings, null, 2) + "\n", "utf-8");
|
|
1795
1796
|
} catch {
|
|
1796
1797
|
}
|
|
1797
1798
|
}
|
|
1798
|
-
function stripMcpJson() {
|
|
1799
|
-
|
|
1800
|
-
if (!existsSync7(path7)) return;
|
|
1799
|
+
function stripMcpJson(filePath, options = {}) {
|
|
1800
|
+
if (!existsSync7(filePath)) return false;
|
|
1801
1801
|
try {
|
|
1802
|
-
const config = JSON.parse(readFileSync4(
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1802
|
+
const config = JSON.parse(readFileSync4(filePath, "utf-8"));
|
|
1803
|
+
let removed = false;
|
|
1804
|
+
if (options.wrapped === false) {
|
|
1805
|
+
if (config["agentvalet"] !== void 0) {
|
|
1806
|
+
delete config["agentvalet"];
|
|
1807
|
+
removed = true;
|
|
1808
|
+
}
|
|
1809
|
+
} else {
|
|
1810
|
+
const servers = config.mcpServers ?? {};
|
|
1811
|
+
if (servers["agentvalet"] !== void 0) {
|
|
1812
|
+
delete servers["agentvalet"];
|
|
1813
|
+
config.mcpServers = servers;
|
|
1814
|
+
removed = true;
|
|
1815
|
+
}
|
|
1816
|
+
}
|
|
1817
|
+
if (removed) {
|
|
1818
|
+
writeFileSync3(filePath, JSON.stringify(config, null, 2) + "\n", "utf-8");
|
|
1819
|
+
}
|
|
1820
|
+
return removed;
|
|
1807
1821
|
} catch {
|
|
1822
|
+
return false;
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
function stripCodexToml() {
|
|
1826
|
+
const path8 = join2(homedir2(), ".codex", "config.toml");
|
|
1827
|
+
if (!existsSync7(path8)) return false;
|
|
1828
|
+
try {
|
|
1829
|
+
const content = readFileSync4(path8, "utf-8");
|
|
1830
|
+
if (!content.includes("[mcp_servers.agentvalet]")) return false;
|
|
1831
|
+
const stripped = content.replace(
|
|
1832
|
+
/\r?\n?\[mcp_servers\.agentvalet\][\s\S]*?(?=\r?\n\[|\r?\n*$)/,
|
|
1833
|
+
""
|
|
1834
|
+
);
|
|
1835
|
+
writeFileSync3(path8, stripped.replace(/(\r?\n){3,}/g, "\n\n").trimEnd() + "\n", "utf-8");
|
|
1836
|
+
return true;
|
|
1837
|
+
} catch {
|
|
1838
|
+
return false;
|
|
1839
|
+
}
|
|
1840
|
+
}
|
|
1841
|
+
function isAgentValetGeneratedDoc(filePath, markers) {
|
|
1842
|
+
if (!existsSync7(filePath)) return false;
|
|
1843
|
+
try {
|
|
1844
|
+
const content = readFileSync4(filePath, "utf-8");
|
|
1845
|
+
const firstLine = content.split(/\r?\n/).find((l) => l.trim().length > 0) ?? "";
|
|
1846
|
+
return markers.some((m) => firstLine.startsWith(m));
|
|
1847
|
+
} catch {
|
|
1848
|
+
return false;
|
|
1808
1849
|
}
|
|
1809
1850
|
}
|
|
1810
1851
|
function cleanLocally() {
|
|
1811
1852
|
const removed = [];
|
|
1853
|
+
const stripped = [];
|
|
1812
1854
|
const r = (p) => {
|
|
1813
1855
|
const abs = resolve3(p);
|
|
1814
1856
|
if (existsSync7(abs)) {
|
|
@@ -1816,6 +1858,12 @@ function cleanLocally() {
|
|
|
1816
1858
|
removed.push(abs);
|
|
1817
1859
|
}
|
|
1818
1860
|
};
|
|
1861
|
+
const rAbs = (abs) => {
|
|
1862
|
+
if (existsSync7(abs)) {
|
|
1863
|
+
rmSync(abs, { recursive: true, force: true });
|
|
1864
|
+
removed.push(abs);
|
|
1865
|
+
}
|
|
1866
|
+
};
|
|
1819
1867
|
if (existsSync7(AGENT_KEY_PATH)) {
|
|
1820
1868
|
rmSync(AGENT_KEY_PATH, { force: true });
|
|
1821
1869
|
removed.push(AGENT_KEY_PATH);
|
|
@@ -1828,14 +1876,32 @@ function cleanLocally() {
|
|
|
1828
1876
|
r(".agentvalet");
|
|
1829
1877
|
r("agentvalet.key");
|
|
1830
1878
|
r(".claude/agentvalet-permissions.md");
|
|
1879
|
+
r("AGENTVALET.md");
|
|
1880
|
+
r(".factory/droids/agentvalet.yaml");
|
|
1881
|
+
r(".factory/droids/agentvalet-reliability.yaml");
|
|
1882
|
+
r(".factory/commands/av-status.md");
|
|
1883
|
+
r(".factory/commands/av-register.md");
|
|
1884
|
+
const agentsMd = resolve3("AGENTS.md");
|
|
1885
|
+
if (isAgentValetGeneratedDoc(agentsMd, ["# AgentValet"])) rAbs(agentsMd);
|
|
1886
|
+
const skillMd = resolve3("SKILL.md");
|
|
1887
|
+
if (isAgentValetGeneratedDoc(skillMd, ["# AgentValet"])) rAbs(skillMd);
|
|
1888
|
+
if (stripMcpJson(resolve3(".mcp.json"))) stripped.push(".mcp.json");
|
|
1889
|
+
if (stripMcpJson(resolve3(".cursor/mcp.json"))) stripped.push(".cursor/mcp.json");
|
|
1890
|
+
if (stripMcpJson(resolve3(".factory/mcp.json"), { wrapped: false })) stripped.push(".factory/mcp.json");
|
|
1891
|
+
const homeFactoryMcp = join2(homedir2(), ".factory", "mcp.json");
|
|
1892
|
+
if (stripMcpJson(homeFactoryMcp, { wrapped: false })) stripped.push("~/.factory/mcp.json");
|
|
1893
|
+
if (stripCodexToml()) stripped.push("~/.codex/config.toml");
|
|
1831
1894
|
stripClaudeMd();
|
|
1832
1895
|
stripSettingsJson();
|
|
1833
|
-
|
|
1896
|
+
stripped.push("CLAUDE.md", ".claude/settings.local.json");
|
|
1834
1897
|
if (removed.length > 0) {
|
|
1835
1898
|
console.log(chalk11.green(" \u2713 Removed files:"));
|
|
1836
1899
|
for (const f of removed) console.log(chalk11.dim(` ${f}`));
|
|
1837
1900
|
}
|
|
1838
|
-
|
|
1901
|
+
if (stripped.length > 0) {
|
|
1902
|
+
console.log(chalk11.green(" \u2713 Stripped agentvalet entries from:"));
|
|
1903
|
+
for (const f of stripped) console.log(chalk11.dim(` ${f}`));
|
|
1904
|
+
}
|
|
1839
1905
|
}
|
|
1840
1906
|
var SSE_READ_TIMEOUT_MS = 25e3;
|
|
1841
1907
|
async function pollForApproval(apiUrl, revocationToken, timeoutMs) {
|
|
@@ -1982,13 +2048,155 @@ function uninstallCommand() {
|
|
|
1982
2048
|
});
|
|
1983
2049
|
}
|
|
1984
2050
|
|
|
2051
|
+
// src/commands/install.ts
|
|
2052
|
+
import { writeFile as writeFile8, mkdir as mkdir5 } from "fs/promises";
|
|
2053
|
+
import path7 from "path";
|
|
2054
|
+
import { Command as Command5 } from "commander";
|
|
2055
|
+
import chalk12 from "chalk";
|
|
2056
|
+
import prompts4 from "prompts";
|
|
2057
|
+
var SUPABASE_URL2 = "https://jmodblrolfoavrxqgbps.supabase.co";
|
|
2058
|
+
var CLAIM_URL = `${SUPABASE_URL2}/functions/v1/cli-claim-agent`;
|
|
2059
|
+
async function claimToken(installToken) {
|
|
2060
|
+
const resp = await fetch(CLAIM_URL, {
|
|
2061
|
+
method: "POST",
|
|
2062
|
+
headers: { "Content-Type": "application/json" },
|
|
2063
|
+
body: JSON.stringify({ install_token: installToken })
|
|
2064
|
+
});
|
|
2065
|
+
const text = await resp.text();
|
|
2066
|
+
let body = null;
|
|
2067
|
+
try {
|
|
2068
|
+
body = text ? JSON.parse(text) : null;
|
|
2069
|
+
} catch {
|
|
2070
|
+
}
|
|
2071
|
+
if (!resp.ok) {
|
|
2072
|
+
const detail = body?.error ?? text ?? `HTTP ${resp.status}`;
|
|
2073
|
+
throw new Error(detail);
|
|
2074
|
+
}
|
|
2075
|
+
if (!body || !body.agent_id || !body.private_key_pem) {
|
|
2076
|
+
throw new Error("Server returned an unexpected response");
|
|
2077
|
+
}
|
|
2078
|
+
return body;
|
|
2079
|
+
}
|
|
2080
|
+
function installCommand() {
|
|
2081
|
+
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").action(async (token, opts) => {
|
|
2082
|
+
if (!token.startsWith("itok_")) {
|
|
2083
|
+
console.error(chalk12.red('Invalid install token. Tokens start with "itok_".'));
|
|
2084
|
+
process.exit(3);
|
|
2085
|
+
}
|
|
2086
|
+
console.log(chalk12.bold("\n Claiming agent\u2026"));
|
|
2087
|
+
let claim;
|
|
2088
|
+
try {
|
|
2089
|
+
claim = await claimToken(token);
|
|
2090
|
+
} catch (err) {
|
|
2091
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
2092
|
+
console.error(chalk12.red(`
|
|
2093
|
+
\u2717 ${msg}`));
|
|
2094
|
+
if (msg.toLowerCase().includes("expired") || msg.toLowerCase().includes("not found")) {
|
|
2095
|
+
console.error(chalk12.dim(" Generate a fresh install command from app.agentvalet.ai/agents"));
|
|
2096
|
+
}
|
|
2097
|
+
process.exit(3);
|
|
2098
|
+
}
|
|
2099
|
+
const { agent_id, agent_name, owner_id, private_key_pem, proxy_url } = claim;
|
|
2100
|
+
try {
|
|
2101
|
+
await mkdir5(AGENT_DIR, { recursive: true });
|
|
2102
|
+
await writeFile8(AGENT_KEY_PATH, private_key_pem, { mode: 384 });
|
|
2103
|
+
} catch (err) {
|
|
2104
|
+
console.error(chalk12.red(`
|
|
2105
|
+
\u2717 Failed to write key: ${err instanceof Error ? err.message : err}`));
|
|
2106
|
+
process.exit(3);
|
|
2107
|
+
}
|
|
2108
|
+
saveConfig({
|
|
2109
|
+
agentId: agent_id,
|
|
2110
|
+
ownerId: owner_id,
|
|
2111
|
+
apiUrl: proxy_url,
|
|
2112
|
+
keyPath: AGENT_KEY_PATH,
|
|
2113
|
+
proxyUrl: proxy_url,
|
|
2114
|
+
lastAgentId: agent_id,
|
|
2115
|
+
lastKeyPath: AGENT_KEY_PATH
|
|
2116
|
+
});
|
|
2117
|
+
console.log(chalk12.green(` \u2713 Agent claimed: ${chalk12.bold(agent_name)} (${agent_id})`));
|
|
2118
|
+
console.log(chalk12.dim(` Key written to ${AGENT_KEY_PATH}`));
|
|
2119
|
+
if (opts.frameworks !== false) {
|
|
2120
|
+
const detected = detectFrameworks();
|
|
2121
|
+
const shouldSetup = await frameworkSetupConsent(detected);
|
|
2122
|
+
let installReliabilityDroid = false;
|
|
2123
|
+
if (detected.factoryDroid && shouldSetup) {
|
|
2124
|
+
const { reliability } = await prompts4({
|
|
2125
|
+
type: "confirm",
|
|
2126
|
+
name: "reliability",
|
|
2127
|
+
message: "Also install AgentValet Reliability Droid for Factory Droid? (monitors agent governance)",
|
|
2128
|
+
initial: false
|
|
2129
|
+
});
|
|
2130
|
+
installReliabilityDroid = reliability ?? false;
|
|
2131
|
+
}
|
|
2132
|
+
if (shouldSetup) {
|
|
2133
|
+
console.log("");
|
|
2134
|
+
console.log(chalk12.bold(" Configuring agent frameworks..."));
|
|
2135
|
+
console.log("");
|
|
2136
|
+
const ideResults = await writeIdeConfigs({
|
|
2137
|
+
agentId: agent_id,
|
|
2138
|
+
ownerId: owner_id,
|
|
2139
|
+
proxyUrl: proxy_url,
|
|
2140
|
+
keyPath: AGENT_KEY_PATH,
|
|
2141
|
+
detected
|
|
2142
|
+
});
|
|
2143
|
+
for (const r of ideResults) console.log(chalk12.green(` \u2713 ${r}`));
|
|
2144
|
+
const globalResults = await writeGlobalFrameworkConfigs({
|
|
2145
|
+
agentId: agent_id,
|
|
2146
|
+
ownerId: owner_id,
|
|
2147
|
+
proxyUrl: proxy_url,
|
|
2148
|
+
keyPath: AGENT_KEY_PATH
|
|
2149
|
+
});
|
|
2150
|
+
for (const r of globalResults) console.log(chalk12.green(` \u2713 ${r}`));
|
|
2151
|
+
if (detected.codex) writeAgentsMd();
|
|
2152
|
+
if (detected.openclaw) writeSkillMd();
|
|
2153
|
+
if (detected.factoryDroid) {
|
|
2154
|
+
writeFactoryDroidDroid();
|
|
2155
|
+
writeFactoryDroidCommand();
|
|
2156
|
+
if (installReliabilityDroid) writeFactoryDroidReliabilityDroid();
|
|
2157
|
+
}
|
|
2158
|
+
writeQuickstartDoc({
|
|
2159
|
+
agentId: agent_id,
|
|
2160
|
+
ownerId: owner_id,
|
|
2161
|
+
proxyUrl: proxy_url,
|
|
2162
|
+
keyPath: AGENT_KEY_PATH,
|
|
2163
|
+
detected
|
|
2164
|
+
});
|
|
2165
|
+
ensureMcpServer();
|
|
2166
|
+
}
|
|
2167
|
+
}
|
|
2168
|
+
try {
|
|
2169
|
+
const envContent = [
|
|
2170
|
+
"# AgentValet \u2014 generated by agentvalet-register install",
|
|
2171
|
+
`AGENTVALET_AGENT_ID=${agent_id}`,
|
|
2172
|
+
`AGENTVALET_OWNER_ID=${owner_id}`,
|
|
2173
|
+
`AGENTVALET_API_URL=${proxy_url}`,
|
|
2174
|
+
`AGENTVALET_PRIVATE_KEY_PATH=${AGENT_KEY_PATH}`,
|
|
2175
|
+
""
|
|
2176
|
+
].join("\n");
|
|
2177
|
+
await writeFile8(path7.join(process.cwd(), ".env.agentvalet"), envContent, { encoding: "utf8", mode: 384 });
|
|
2178
|
+
} catch {
|
|
2179
|
+
}
|
|
2180
|
+
console.log("");
|
|
2181
|
+
console.log(chalk12.bold.green(" \u2713 All done!"));
|
|
2182
|
+
console.log("");
|
|
2183
|
+
console.log(` Agent ID: ${chalk12.cyan(agent_id)}`);
|
|
2184
|
+
console.log(` Key path: ${chalk12.dim(AGENT_KEY_PATH)}`);
|
|
2185
|
+
console.log(` Proxy: ${chalk12.dim(proxy_url)}`);
|
|
2186
|
+
console.log("");
|
|
2187
|
+
console.log(` Dashboard: ${chalk12.cyan.underline("https://app.agentvalet.ai/agents/" + agent_id)}`);
|
|
2188
|
+
console.log("");
|
|
2189
|
+
process.exit(0);
|
|
2190
|
+
});
|
|
2191
|
+
}
|
|
2192
|
+
|
|
1985
2193
|
// src/index.ts
|
|
1986
2194
|
var require2 = createRequire2(import.meta.url);
|
|
1987
2195
|
var { version } = require2("../package.json");
|
|
1988
2196
|
function collectScope(value, previous) {
|
|
1989
2197
|
return [...previous, value];
|
|
1990
2198
|
}
|
|
1991
|
-
var program = new
|
|
2199
|
+
var program = new Command6();
|
|
1992
2200
|
program.name("agentvalet-register").description("Self-register an AI agent with AgentValet").version(version).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("--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) => {
|
|
1993
2201
|
const isJson = !!opts.json;
|
|
1994
2202
|
let ownerId = opts.owner ?? process.env.AGENTVALET_OWNER ?? "";
|
|
@@ -2015,7 +2223,7 @@ program.name("agentvalet-register").description("Self-register an AI agent with
|
|
|
2015
2223
|
console.error(JSON.stringify({ error: "--owner or AGENTVALET_OWNER is required" }));
|
|
2016
2224
|
process.exit(3);
|
|
2017
2225
|
}
|
|
2018
|
-
console.error(
|
|
2226
|
+
console.error(chalk13.red("Error: --owner or AGENTVALET_OWNER environment variable is required"));
|
|
2019
2227
|
process.exit(3);
|
|
2020
2228
|
}
|
|
2021
2229
|
const scopeMap = /* @__PURE__ */ new Map();
|
|
@@ -2023,7 +2231,7 @@ program.name("agentvalet-register").description("Self-register an AI agent with
|
|
|
2023
2231
|
const colon = s.indexOf(":");
|
|
2024
2232
|
if (colon === -1) {
|
|
2025
2233
|
console.error(
|
|
2026
|
-
isJson ? JSON.stringify({ error: `Invalid scope format: ${s} (expected platform:scope)` }) :
|
|
2234
|
+
isJson ? JSON.stringify({ error: `Invalid scope format: ${s} (expected platform:scope)` }) : chalk13.red(`Invalid scope format: ${s} (expected platform:scope)`)
|
|
2027
2235
|
);
|
|
2028
2236
|
process.exit(3);
|
|
2029
2237
|
}
|
|
@@ -2046,11 +2254,11 @@ program.name("agentvalet-register").description("Self-register an AI agent with
|
|
|
2046
2254
|
});
|
|
2047
2255
|
} catch (err) {
|
|
2048
2256
|
const msg = err instanceof Error ? err.message : String(err);
|
|
2049
|
-
console.error(isJson ? JSON.stringify({ error: msg }) :
|
|
2257
|
+
console.error(isJson ? JSON.stringify({ error: msg }) : chalk13.red(`Registration failed: ${msg}`));
|
|
2050
2258
|
process.exit(3);
|
|
2051
2259
|
}
|
|
2052
2260
|
if (!isJson) {
|
|
2053
|
-
console.log(
|
|
2261
|
+
console.log(chalk13.cyan(`
|
|
2054
2262
|
Approve at: https://app.agentvalet.ai/agents
|
|
2055
2263
|
`));
|
|
2056
2264
|
}
|
|
@@ -2058,7 +2266,7 @@ Approve at: https://app.agentvalet.ai/agents
|
|
|
2058
2266
|
if (isJson) {
|
|
2059
2267
|
console.log(JSON.stringify({ status: "pending", token }));
|
|
2060
2268
|
} else {
|
|
2061
|
-
console.log(
|
|
2269
|
+
console.log(chalk13.yellow("Registration submitted (--no-wait). Token:"), token);
|
|
2062
2270
|
}
|
|
2063
2271
|
process.exit(0);
|
|
2064
2272
|
}
|
|
@@ -2069,14 +2277,14 @@ Approve at: https://app.agentvalet.ai/agents
|
|
|
2069
2277
|
});
|
|
2070
2278
|
} catch (err) {
|
|
2071
2279
|
const msg = err instanceof Error ? err.message : String(err);
|
|
2072
|
-
console.error(isJson ? JSON.stringify({ error: msg }) :
|
|
2280
|
+
console.error(isJson ? JSON.stringify({ error: msg }) : chalk13.red(`Wait failed: ${msg}`));
|
|
2073
2281
|
process.exit(3);
|
|
2074
2282
|
}
|
|
2075
2283
|
if (result.status === "rejected") {
|
|
2076
2284
|
if (isJson) {
|
|
2077
2285
|
console.log(JSON.stringify({ status: "rejected" }));
|
|
2078
2286
|
} else {
|
|
2079
|
-
console.log(
|
|
2287
|
+
console.log(chalk13.red("\nRegistration denied by owner."));
|
|
2080
2288
|
}
|
|
2081
2289
|
process.exit(1);
|
|
2082
2290
|
}
|
|
@@ -2084,7 +2292,7 @@ Approve at: https://app.agentvalet.ai/agents
|
|
|
2084
2292
|
if (isJson) {
|
|
2085
2293
|
console.log(JSON.stringify({ status: "timeout" }));
|
|
2086
2294
|
} else {
|
|
2087
|
-
console.log(
|
|
2295
|
+
console.log(chalk13.yellow("\nTimed out waiting for approval."));
|
|
2088
2296
|
}
|
|
2089
2297
|
process.exit(2);
|
|
2090
2298
|
}
|
|
@@ -2102,35 +2310,35 @@ Approve at: https://app.agentvalet.ai/agents
|
|
|
2102
2310
|
}));
|
|
2103
2311
|
} catch (err) {
|
|
2104
2312
|
const msg = err instanceof Error ? err.message : String(err);
|
|
2105
|
-
console.error(isJson ? JSON.stringify({ error: msg }) :
|
|
2313
|
+
console.error(isJson ? JSON.stringify({ error: msg }) : chalk13.red(`Failed to save output: ${msg}`));
|
|
2106
2314
|
process.exit(3);
|
|
2107
2315
|
}
|
|
2108
2316
|
} else {
|
|
2109
|
-
const { AGENT_KEY_PATH: AGENT_KEY_PATH2 } = await import("./store-
|
|
2317
|
+
const { AGENT_KEY_PATH: AGENT_KEY_PATH2 } = await import("./store-ZVZMF6GW.js");
|
|
2110
2318
|
keyPath = AGENT_KEY_PATH2;
|
|
2111
2319
|
}
|
|
2112
2320
|
if (isJson) {
|
|
2113
2321
|
console.log(JSON.stringify({ status: "approved", agentId, keyPath: keyWritten ? keyPath : null }));
|
|
2114
2322
|
} else {
|
|
2115
|
-
console.log(
|
|
2323
|
+
console.log(chalk13.green(`
|
|
2116
2324
|
Approved! Agent ID: ${agentId}`));
|
|
2117
2325
|
if (keyWritten) {
|
|
2118
|
-
console.log(
|
|
2326
|
+
console.log(chalk13.gray(`Key: ${keyPath}`));
|
|
2119
2327
|
} else {
|
|
2120
|
-
console.log(
|
|
2328
|
+
console.log(chalk13.yellow(`Key: not written \u2014 copy it from the dashboard and paste into ${keyPath}`));
|
|
2121
2329
|
}
|
|
2122
2330
|
}
|
|
2123
2331
|
if (keyWritten) {
|
|
2124
2332
|
try {
|
|
2125
2333
|
if (grantedPlatforms && grantedPlatforms.length > 0) {
|
|
2126
2334
|
writePermissionsFromEvent(agentId, resolvedOwnerId, grantedPlatforms);
|
|
2127
|
-
if (!isJson) console.log(
|
|
2335
|
+
if (!isJson) console.log(chalk13.gray(`Permissions: .claude/agentvalet-permissions.md`));
|
|
2128
2336
|
} else {
|
|
2129
2337
|
await runRefresh({ envFile: ".env.agentvalet", outputPath: ".claude/agentvalet-permissions.md", ifStale: false, quiet: isJson });
|
|
2130
|
-
if (!isJson) console.log(
|
|
2338
|
+
if (!isJson) console.log(chalk13.gray(`Permissions: .claude/agentvalet-permissions.md`));
|
|
2131
2339
|
}
|
|
2132
2340
|
} catch {
|
|
2133
|
-
if (!isJson) console.log(
|
|
2341
|
+
if (!isJson) console.log(chalk13.yellow(`Permissions: run 'agentvalet-register refresh' to generate`));
|
|
2134
2342
|
}
|
|
2135
2343
|
}
|
|
2136
2344
|
process.exit(0);
|
|
@@ -2145,7 +2353,7 @@ program.command("refresh").description("Refresh approved permissions and update
|
|
|
2145
2353
|
});
|
|
2146
2354
|
} catch (err) {
|
|
2147
2355
|
const msg = err instanceof Error ? err.message : String(err);
|
|
2148
|
-
console.error(
|
|
2356
|
+
console.error(chalk13.red(`Refresh failed: ${msg}`));
|
|
2149
2357
|
process.exit(3);
|
|
2150
2358
|
}
|
|
2151
2359
|
});
|
|
@@ -2157,6 +2365,7 @@ program.addCommand(listCommand());
|
|
|
2157
2365
|
program.addCommand(revokeCommand());
|
|
2158
2366
|
program.addCommand(injectCommand());
|
|
2159
2367
|
program.addCommand(uninstallCommand());
|
|
2368
|
+
program.addCommand(installCommand());
|
|
2160
2369
|
program.parseAsync().catch((err) => {
|
|
2161
2370
|
console.error(err);
|
|
2162
2371
|
process.exit(3);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentvalet/register",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.17",
|
|
4
4
|
"description": "Self-register AI agents with AgentValet",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -10,8 +10,15 @@
|
|
|
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": "pnpm build"
|
|
19
|
+
},
|
|
13
20
|
"dependencies": {
|
|
14
|
-
"@agentvalet/mcp-server": "
|
|
21
|
+
"@agentvalet/mcp-server": "^0.2.0",
|
|
15
22
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
16
23
|
"@octokit/auth-oauth-device": "^7.0.0",
|
|
17
24
|
"chalk": "^5.3.0",
|
|
@@ -48,11 +55,5 @@
|
|
|
48
55
|
"valet",
|
|
49
56
|
"agentvalet"
|
|
50
57
|
],
|
|
51
|
-
"license": "MIT"
|
|
52
|
-
|
|
53
|
-
"build": "tsup src/index.ts --format esm --dts --clean --shims",
|
|
54
|
-
"dev": "tsx src/index.ts",
|
|
55
|
-
"test": "vitest run",
|
|
56
|
-
"typecheck": "tsc --noEmit"
|
|
57
|
-
}
|
|
58
|
-
}
|
|
58
|
+
"license": "MIT"
|
|
59
|
+
}
|