agentapprove 0.1.6 → 0.1.8

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 +25 -6
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -5,15 +5,29 @@ var __getProtoOf = Object.getPrototypeOf;
5
5
  var __defProp = Object.defineProperty;
6
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ function __accessProp(key) {
9
+ return this[key];
10
+ }
11
+ var __toESMCache_node;
12
+ var __toESMCache_esm;
8
13
  var __toESM = (mod, isNodeMode, target) => {
14
+ var canCache = mod != null && typeof mod === "object";
15
+ if (canCache) {
16
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
17
+ var cached = cache.get(mod);
18
+ if (cached)
19
+ return cached;
20
+ }
9
21
  target = mod != null ? __create(__getProtoOf(mod)) : {};
10
22
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
11
23
  for (let key of __getOwnPropNames(mod))
12
24
  if (!__hasOwnProp.call(to, key))
13
25
  __defProp(to, key, {
14
- get: () => mod[key],
26
+ get: __accessProp.bind(mod, key),
15
27
  enumerable: true
16
28
  });
29
+ if (canCache)
30
+ cache.set(mod, to);
17
31
  return to;
18
32
  };
19
33
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
@@ -2318,7 +2332,7 @@ import { homedir, hostname, platform } from "os";
2318
2332
  import { join, dirname, basename } from "path";
2319
2333
  import { execSync, spawnSync } from "child_process";
2320
2334
  import { randomBytes, createHash } from "crypto";
2321
- var VERSION = "0.1.4";
2335
+ var VERSION = "0.1.7";
2322
2336
  function getApiUrl() {
2323
2337
  return process.env.AGENTAPPROVE_API || "https://api.agentapprove.com";
2324
2338
  }
@@ -2372,10 +2386,10 @@ var AGENTS = {
2372
2386
  configPath: join(homedir(), ".claude", "settings.json"),
2373
2387
  hooksKey: "hooks",
2374
2388
  hooks: [
2375
- { name: "PreToolUse", file: "claude-pre-tool.sh", description: "Before tool execution (approval)", hasMatcher: true, isApprovalHook: true },
2389
+ { name: "PreToolUse", file: "claude-pre-tool.sh", description: "Before tool execution (approval)", hasMatcher: true, isApprovalHook: true, timeout: 300 },
2376
2390
  { name: "PostToolUse", file: "claude-post-tool.sh", description: "After tool execution (logging)", hasMatcher: true },
2377
2391
  { name: "PostToolUseFailure", file: "claude-post-tool-failure.sh", description: "Tool execution failed", hasMatcher: true },
2378
- { name: "PermissionRequest", file: "notify-hook.sh", description: "Permission requests", hasMatcher: true, isApprovalHook: true },
2392
+ { name: "PermissionRequest", file: "notify-hook.sh", description: "Permission requests", hasMatcher: true, isApprovalHook: true, timeout: 300 },
2379
2393
  { name: "UserPromptSubmit", file: "claude-user-prompt.sh", description: "User prompt submitted", hasMatcher: false },
2380
2394
  { name: "Stop", file: "claude-stop.sh", description: "Session/task completed", hasMatcher: false, timeout: 600 },
2381
2395
  { name: "SessionStart", file: "claude-session-start.sh", description: "Session started", hasMatcher: false },
@@ -3134,6 +3148,9 @@ async function installHooksForAgent(agentId, hooksDir, mode = "approval") {
3134
3148
  }
3135
3149
  installedHooks.push(hook.name);
3136
3150
  } else if (agentId === "cursor") {
3151
+ if (typeof config["version"] !== "number") {
3152
+ config["version"] = 1;
3153
+ }
3137
3154
  const existing = hooksConfig[hook.name];
3138
3155
  const needsStopTimeout = hook.name === "stop" || hook.name === "subagentStop";
3139
3156
  const isApproval = hook.isApprovalHook;
@@ -3224,7 +3241,9 @@ async function installHooksForAgent(agentId, hooksDir, mode = "approval") {
3224
3241
  hooksConfig[hook.name] = cleanedArray;
3225
3242
  installedHooks.push(hook.name);
3226
3243
  } else if (agentId === "copilot-cli") {
3227
- config["version"] = 1;
3244
+ if (typeof config["version"] !== "number") {
3245
+ config["version"] = 1;
3246
+ }
3228
3247
  if (!hooksConfig[hook.name]) {
3229
3248
  hooksConfig[hook.name] = [];
3230
3249
  }
@@ -3357,7 +3376,7 @@ function getManualInstructions(agentId, hooksDir) {
3357
3376
  }
3358
3377
  hooksObj[hook.name] = [entry];
3359
3378
  }
3360
- return JSON.stringify({ hooks: hooksObj }, null, 2);
3379
+ return JSON.stringify({ version: 1, hooks: hooksObj }, null, 2);
3361
3380
  } else if (agentId === "gemini-cli") {
3362
3381
  const hooksObj = {};
3363
3382
  for (const hook of agent.hooks) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentapprove",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "Approve AI agent actions from your iPhone or Apple Watch",
5
5
  "type": "module",
6
6
  "bin": {