agentapprove 0.1.24 → 0.1.26
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/cli.js +9 -101
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2827,7 +2827,7 @@ function resolvePairingApiBaseUrl(options) {
|
|
|
2827
2827
|
}
|
|
2828
2828
|
|
|
2829
2829
|
// src/cli.ts
|
|
2830
|
-
var VERSION = "0.1.
|
|
2830
|
+
var VERSION = "0.1.22";
|
|
2831
2831
|
function getApiUrl() {
|
|
2832
2832
|
return process.env.AGENTAPPROVE_API || "https://api.agentapprove.com";
|
|
2833
2833
|
}
|
|
@@ -2906,7 +2906,7 @@ var OPENCLAW_PLUGIN_SPEC = `@agentapprove/openclaw@${OPENCLAW_PLUGIN_VERSION}`;
|
|
|
2906
2906
|
var PI_PLUGIN_VERSION = "0.1.7";
|
|
2907
2907
|
var PI_PLUGIN_SPEC = `npm:@agentapprove/pi@${PI_PLUGIN_VERSION}`;
|
|
2908
2908
|
var PI_STATUS_TIMEOUT_MS = 5000;
|
|
2909
|
-
var HERMES_PLUGIN_VERSION = "0.1.
|
|
2909
|
+
var HERMES_PLUGIN_VERSION = "0.1.0";
|
|
2910
2910
|
var HERMES_PIP_DEPS = ["cryptography>=44.0,<46", "httpx>=0.27,<0.29"];
|
|
2911
2911
|
var AGENTS = {
|
|
2912
2912
|
"claude-code": {
|
|
@@ -4812,8 +4812,6 @@ codex_hooks = true`;
|
|
|
4812
4812
|
"in that directory, then:",
|
|
4813
4813
|
"",
|
|
4814
4814
|
" pip install --user cryptography httpx",
|
|
4815
|
-
" # On uv-managed Python (PEP 668 EXTERNALLY-MANAGED): instead run",
|
|
4816
|
-
" # uv pip install --system --break-system-packages --python $(which python3.12) cryptography httpx",
|
|
4817
4815
|
" hermes plugins enable agentapprove",
|
|
4818
4816
|
"",
|
|
4819
4817
|
"The plugin reads your existing Agent Approve config from ~/.agentapprove/env.",
|
|
@@ -4858,50 +4856,9 @@ function readOpenClawInstalledVersion() {
|
|
|
4858
4856
|
return null;
|
|
4859
4857
|
}
|
|
4860
4858
|
}
|
|
4861
|
-
function isOpenClawAlreadyExistsError(err) {
|
|
4862
|
-
if (!err || typeof err !== "object")
|
|
4863
|
-
return false;
|
|
4864
|
-
const e2 = err;
|
|
4865
|
-
const blob = [
|
|
4866
|
-
Buffer.isBuffer(e2.stderr) ? e2.stderr.toString() : String(e2.stderr || ""),
|
|
4867
|
-
Buffer.isBuffer(e2.stdout) ? e2.stdout.toString() : String(e2.stdout || ""),
|
|
4868
|
-
String(e2.message || "")
|
|
4869
|
-
].join(`
|
|
4870
|
-
`);
|
|
4871
|
-
return /plugin already exists|delete it first|use .*plugins update/i.test(blob);
|
|
4872
|
-
}
|
|
4873
4859
|
function installOpenClawPluginViaCli() {
|
|
4874
|
-
const installCmd = (force) => `openclaw plugins install ${OPENCLAW_PLUGIN_SPEC}${force ? " --force" : ""}`;
|
|
4875
|
-
const tryInstall = (force) => {
|
|
4876
|
-
try {
|
|
4877
|
-
execSync(installCmd(force), { stdio: "pipe" });
|
|
4878
|
-
return { ok: true };
|
|
4879
|
-
} catch (err) {
|
|
4880
|
-
return { ok: false, err };
|
|
4881
|
-
}
|
|
4882
|
-
};
|
|
4883
|
-
let firstAttempt = tryInstall(false);
|
|
4884
|
-
if (!firstAttempt.ok && isOpenClawAlreadyExistsError(firstAttempt.err)) {
|
|
4885
|
-
const existingVersion = readOpenClawInstalledVersion();
|
|
4886
|
-
if (existingVersion === OPENCLAW_PLUGIN_VERSION) {
|
|
4887
|
-
return {
|
|
4888
|
-
success: true,
|
|
4889
|
-
version: existingVersion,
|
|
4890
|
-
label: `Agent Approve plugin v${existingVersion} (already installed)`
|
|
4891
|
-
};
|
|
4892
|
-
}
|
|
4893
|
-
const forceAttempt = tryInstall(true);
|
|
4894
|
-
if (!forceAttempt.ok) {
|
|
4895
|
-
const message = forceAttempt.err instanceof Error ? forceAttempt.err.message : "unknown error";
|
|
4896
|
-
return { success: false, error: message, label: "Agent Approve plugin" };
|
|
4897
|
-
}
|
|
4898
|
-
firstAttempt = { ok: true };
|
|
4899
|
-
}
|
|
4900
|
-
if (!firstAttempt.ok) {
|
|
4901
|
-
const message = firstAttempt.err instanceof Error ? firstAttempt.err.message : "unknown error";
|
|
4902
|
-
return { success: false, error: message, label: "Agent Approve plugin" };
|
|
4903
|
-
}
|
|
4904
4860
|
try {
|
|
4861
|
+
execSync(`openclaw plugins install ${OPENCLAW_PLUGIN_SPEC}`, { stdio: "pipe" });
|
|
4905
4862
|
const installedVersion = readOpenClawInstalledVersion();
|
|
4906
4863
|
if (!installedVersion) {
|
|
4907
4864
|
return {
|
|
@@ -5032,7 +4989,7 @@ function removePiPluginViaCli() {
|
|
|
5032
4989
|
};
|
|
5033
4990
|
}
|
|
5034
4991
|
}
|
|
5035
|
-
var HERMES_BUNDLE_SHA256 = "
|
|
4992
|
+
var HERMES_BUNDLE_SHA256 = "2572cec0a2d8467e9ffc2000e5c52cf652265d20638244a8a70e2e3a6c9d2734";
|
|
5036
4993
|
var HERMES_BUNDLE_FILENAME = `agentapprove-hermes-${HERMES_PLUGIN_VERSION}.tar.gz`;
|
|
5037
4994
|
var HERMES_PLUGIN_DIR = join(homedir(), ".hermes", "plugins", "agentapprove");
|
|
5038
4995
|
function findPython() {
|
|
@@ -5185,56 +5142,6 @@ function hermesDepsAlreadyInstalled(pythonCommand) {
|
|
|
5185
5142
|
return false;
|
|
5186
5143
|
}
|
|
5187
5144
|
}
|
|
5188
|
-
function uvAvailable() {
|
|
5189
|
-
try {
|
|
5190
|
-
execSync("uv --version", { stdio: "pipe", timeout: 5000 });
|
|
5191
|
-
return true;
|
|
5192
|
-
} catch {
|
|
5193
|
-
return false;
|
|
5194
|
-
}
|
|
5195
|
-
}
|
|
5196
|
-
function isExternallyManagedError(err) {
|
|
5197
|
-
if (!err || typeof err !== "object")
|
|
5198
|
-
return false;
|
|
5199
|
-
const e2 = err;
|
|
5200
|
-
const stderr = Buffer.isBuffer(e2.stderr) ? e2.stderr.toString() : String(e2.stderr || "");
|
|
5201
|
-
const stdout = Buffer.isBuffer(e2.stdout) ? e2.stdout.toString() : String(e2.stdout || "");
|
|
5202
|
-
const message = String(e2.message || "");
|
|
5203
|
-
const blob = `${stderr}
|
|
5204
|
-
${stdout}
|
|
5205
|
-
${message}`;
|
|
5206
|
-
return /externally-managed-environment|PEP 668|managed by uv/i.test(blob);
|
|
5207
|
-
}
|
|
5208
|
-
function installHermesDepsAdaptive(pythonCommand, deps) {
|
|
5209
|
-
const depsArg = deps.map((d2) => `"${d2}"`).join(" ");
|
|
5210
|
-
try {
|
|
5211
|
-
execSync(`${pythonCommand} -m pip install --user --quiet ${depsArg}`, { stdio: "pipe" });
|
|
5212
|
-
return { ok: true };
|
|
5213
|
-
} catch (pipErr) {
|
|
5214
|
-
if (!isExternallyManagedError(pipErr)) {
|
|
5215
|
-
return {
|
|
5216
|
-
ok: false,
|
|
5217
|
-
error: `pip install failed: ${pipErr instanceof Error ? pipErr.message : String(pipErr)}. ` + `Try manually: ${pythonCommand} -m pip install --user ${depsArg}`
|
|
5218
|
-
};
|
|
5219
|
-
}
|
|
5220
|
-
if (!uvAvailable()) {
|
|
5221
|
-
return {
|
|
5222
|
-
ok: false,
|
|
5223
|
-
error: "Python is externally managed (PEP 668) and `uv` is not installed. " + `Install uv (https://docs.astral.sh/uv/) and re-run, or run manually: uv pip install --system --python ${pythonCommand} ${depsArg}`
|
|
5224
|
-
};
|
|
5225
|
-
}
|
|
5226
|
-
const uvCmd = `uv pip install --system --break-system-packages --python ${pythonCommand} --quiet ${depsArg}`;
|
|
5227
|
-
try {
|
|
5228
|
-
execSync(uvCmd, { stdio: "pipe" });
|
|
5229
|
-
return { ok: true };
|
|
5230
|
-
} catch (uvErr) {
|
|
5231
|
-
return {
|
|
5232
|
-
ok: false,
|
|
5233
|
-
error: `uv pip install failed: ${uvErr instanceof Error ? uvErr.message : String(uvErr)}. ` + `Try manually: ${uvCmd}`
|
|
5234
|
-
};
|
|
5235
|
-
}
|
|
5236
|
-
}
|
|
5237
|
-
}
|
|
5238
5145
|
async function installHermesPluginViaCli() {
|
|
5239
5146
|
try {
|
|
5240
5147
|
execSync("hermes --version", { stdio: "pipe" });
|
|
@@ -5363,12 +5270,14 @@ async function installHermesPluginViaCli() {
|
|
|
5363
5270
|
}
|
|
5364
5271
|
}
|
|
5365
5272
|
if (!hermesDepsAlreadyInstalled(python.command)) {
|
|
5366
|
-
const
|
|
5367
|
-
|
|
5273
|
+
const depsArg = HERMES_PIP_DEPS.map((d2) => `"${d2}"`).join(" ");
|
|
5274
|
+
try {
|
|
5275
|
+
execSync(`${python.command} -m pip install --user --quiet ${depsArg}`, { stdio: "pipe" });
|
|
5276
|
+
} catch (err) {
|
|
5368
5277
|
return {
|
|
5369
5278
|
success: false,
|
|
5370
5279
|
label: "Agent Approve plugin",
|
|
5371
|
-
error: `Installed bundle but could not install Python runtime deps: ${
|
|
5280
|
+
error: `Installed bundle but could not install Python runtime deps: ${err instanceof Error ? err.message : String(err)}. ` + `Try manually: ${python.command} -m pip install --user ${HERMES_PIP_DEPS.join(" ")}`
|
|
5372
5281
|
};
|
|
5373
5282
|
}
|
|
5374
5283
|
}
|
|
@@ -6235,7 +6144,6 @@ Backups will be created with timestamp`, "Files to be modified");
|
|
|
6235
6144
|
` + ` 3. Extract into ~/.hermes/plugins/agentapprove/
|
|
6236
6145
|
` + ` 4. Write the SHA-256 to ~/.hermes/plugins/agentapprove/.bundle-hash
|
|
6237
6146
|
` + ` 5. pip install --user cryptography httpx
|
|
6238
|
-
` + ` (uv-managed Python: uv pip install --system --break-system-packages --python $(which python3.12) cryptography httpx)
|
|
6239
6147
|
` + ` 6. hermes plugins enable agentapprove
|
|
6240
6148
|
` + ` Then re-run: npx agentapprove`);
|
|
6241
6149
|
}
|