agentapprove 0.1.22 → 0.1.24

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.
Files changed (2) hide show
  1. package/dist/cli.js +101 -9
  2. 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.22";
2830
+ var VERSION = "0.1.24";
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.0";
2909
+ var HERMES_PLUGIN_VERSION = "0.1.1";
2910
2910
  var HERMES_PIP_DEPS = ["cryptography>=44.0,<46", "httpx>=0.27,<0.29"];
2911
2911
  var AGENTS = {
2912
2912
  "claude-code": {
@@ -4812,6 +4812,8 @@ 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",
4815
4817
  " hermes plugins enable agentapprove",
4816
4818
  "",
4817
4819
  "The plugin reads your existing Agent Approve config from ~/.agentapprove/env.",
@@ -4856,9 +4858,50 @@ function readOpenClawInstalledVersion() {
4856
4858
  return null;
4857
4859
  }
4858
4860
  }
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
+ }
4859
4873
  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
+ }
4860
4904
  try {
4861
- execSync(`openclaw plugins install ${OPENCLAW_PLUGIN_SPEC}`, { stdio: "pipe" });
4862
4905
  const installedVersion = readOpenClawInstalledVersion();
4863
4906
  if (!installedVersion) {
4864
4907
  return {
@@ -4989,7 +5032,7 @@ function removePiPluginViaCli() {
4989
5032
  };
4990
5033
  }
4991
5034
  }
4992
- var HERMES_BUNDLE_SHA256 = "2572cec0a2d8467e9ffc2000e5c52cf652265d20638244a8a70e2e3a6c9d2734";
5035
+ var HERMES_BUNDLE_SHA256 = "2631f8b287f05a02fb73b40e9e0dd38321a605e0d39d2ed13ac296a68d9044e6";
4993
5036
  var HERMES_BUNDLE_FILENAME = `agentapprove-hermes-${HERMES_PLUGIN_VERSION}.tar.gz`;
4994
5037
  var HERMES_PLUGIN_DIR = join(homedir(), ".hermes", "plugins", "agentapprove");
4995
5038
  function findPython() {
@@ -5142,6 +5185,56 @@ function hermesDepsAlreadyInstalled(pythonCommand) {
5142
5185
  return false;
5143
5186
  }
5144
5187
  }
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
+ }
5145
5238
  async function installHermesPluginViaCli() {
5146
5239
  try {
5147
5240
  execSync("hermes --version", { stdio: "pipe" });
@@ -5270,14 +5363,12 @@ async function installHermesPluginViaCli() {
5270
5363
  }
5271
5364
  }
5272
5365
  if (!hermesDepsAlreadyInstalled(python.command)) {
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) {
5366
+ const depsResult = installHermesDepsAdaptive(python.command, HERMES_PIP_DEPS);
5367
+ if (!depsResult.ok) {
5277
5368
  return {
5278
5369
  success: false,
5279
5370
  label: "Agent Approve plugin",
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(" ")}`
5371
+ error: `Installed bundle but could not install Python runtime deps: ${depsResult.error}`
5281
5372
  };
5282
5373
  }
5283
5374
  }
@@ -6144,6 +6235,7 @@ Backups will be created with timestamp`, "Files to be modified");
6144
6235
  ` + ` 3. Extract into ~/.hermes/plugins/agentapprove/
6145
6236
  ` + ` 4. Write the SHA-256 to ~/.hermes/plugins/agentapprove/.bundle-hash
6146
6237
  ` + ` 5. pip install --user cryptography httpx
6238
+ ` + ` (uv-managed Python: uv pip install --system --break-system-packages --python $(which python3.12) cryptography httpx)
6147
6239
  ` + ` 6. hermes plugins enable agentapprove
6148
6240
  ` + ` Then re-run: npx agentapprove`);
6149
6241
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentapprove",
3
- "version": "0.1.22",
3
+ "version": "0.1.24",
4
4
  "description": "Approve AI agent actions from your iPhone or Apple Watch",
5
5
  "type": "module",
6
6
  "bin": {