agentapprove 0.1.5 → 0.1.7

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 +27 -12
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -2318,7 +2318,7 @@ import { homedir, hostname, platform } from "os";
2318
2318
  import { join, dirname, basename } from "path";
2319
2319
  import { execSync, spawnSync } from "child_process";
2320
2320
  import { randomBytes, createHash } from "crypto";
2321
- var VERSION = "0.1.4";
2321
+ var VERSION = "0.1.7";
2322
2322
  function getApiUrl() {
2323
2323
  return process.env.AGENTAPPROVE_API || "https://api.agentapprove.com";
2324
2324
  }
@@ -2372,10 +2372,10 @@ var AGENTS = {
2372
2372
  configPath: join(homedir(), ".claude", "settings.json"),
2373
2373
  hooksKey: "hooks",
2374
2374
  hooks: [
2375
- { name: "PreToolUse", file: "claude-pre-tool.sh", description: "Before tool execution (approval)", hasMatcher: true, isApprovalHook: true },
2375
+ { name: "PreToolUse", file: "claude-pre-tool.sh", description: "Before tool execution (approval)", hasMatcher: true, isApprovalHook: true, timeout: 300 },
2376
2376
  { name: "PostToolUse", file: "claude-post-tool.sh", description: "After tool execution (logging)", hasMatcher: true },
2377
2377
  { 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 },
2378
+ { name: "PermissionRequest", file: "notify-hook.sh", description: "Permission requests", hasMatcher: true, isApprovalHook: true, timeout: 300 },
2379
2379
  { name: "UserPromptSubmit", file: "claude-user-prompt.sh", description: "User prompt submitted", hasMatcher: false },
2380
2380
  { name: "Stop", file: "claude-stop.sh", description: "Session/task completed", hasMatcher: false, timeout: 600 },
2381
2381
  { name: "SessionStart", file: "claude-session-start.sh", description: "Session started", hasMatcher: false },
@@ -2413,7 +2413,7 @@ var AGENTS = {
2413
2413
  { name: "BeforeAgent", file: "gemini-before-agent.sh", description: "User prompt capture" },
2414
2414
  { name: "BeforeModel", file: "gemini-before-model.sh", description: "Before LLM request" },
2415
2415
  { name: "AfterModel", file: "gemini-after-model.sh", description: "After LLM response" },
2416
- { name: "BeforeTool", file: "gemini-before-tool.sh", description: "Tool approval", isApprovalHook: true },
2416
+ { name: "BeforeTool", file: "gemini-before-tool.sh", description: "Tool approval", isApprovalHook: true, timeout: 300 },
2417
2417
  { name: "AfterTool", file: "gemini-after-tool.sh", description: "Tool completion logging" },
2418
2418
  { name: "AfterAgent", file: "gemini-stop.sh", description: "Agent stop (iOS input)", timeout: 600 },
2419
2419
  { name: "Notification", file: "gemini-notification.sh", description: "Notifications (logging only)" },
@@ -3135,8 +3135,15 @@ async function installHooksForAgent(agentId, hooksDir, mode = "approval") {
3135
3135
  installedHooks.push(hook.name);
3136
3136
  } else if (agentId === "cursor") {
3137
3137
  const existing = hooksConfig[hook.name];
3138
- const needsTimeout = hook.name === "stop" || hook.name === "subagentStop";
3139
- const hookEntry = needsTimeout ? { command: hookCommand, timeout: 600, loop_limit: 10 } : { command: hookCommand };
3138
+ const needsStopTimeout = hook.name === "stop" || hook.name === "subagentStop";
3139
+ const isApproval = hook.isApprovalHook;
3140
+ const hookEntry = { command: hookCommand };
3141
+ if (needsStopTimeout) {
3142
+ hookEntry.timeout = 600;
3143
+ hookEntry.loop_limit = 10;
3144
+ } else if (isApproval) {
3145
+ hookEntry.timeout = 300;
3146
+ }
3140
3147
  if (!existing) {
3141
3148
  hooksConfig[hook.name] = [hookEntry];
3142
3149
  } else if (Array.isArray(existing)) {
@@ -3208,7 +3215,7 @@ async function installHooksForAgent(agentId, hooksDir, mode = "approval") {
3208
3215
  command: hookCommand
3209
3216
  };
3210
3217
  if (hook.isApprovalHook) {
3211
- hookEntry.timeout = 120;
3218
+ hookEntry.timeout = 300;
3212
3219
  }
3213
3220
  if (hook.timeout) {
3214
3221
  hookEntry.timeout = hook.timeout;
@@ -3231,7 +3238,7 @@ async function installHooksForAgent(agentId, hooksDir, mode = "approval") {
3231
3238
  bash: isWindows() ? toGitBashPath(hookPath) : hookPath
3232
3239
  };
3233
3240
  if (hook.isApprovalHook) {
3234
- hookEntry.timeoutSec = 120;
3241
+ hookEntry.timeoutSec = 300;
3235
3242
  }
3236
3243
  cleanedArray.push(hookEntry);
3237
3244
  hooksConfig[hook.name] = cleanedArray;
@@ -3339,8 +3346,16 @@ function getManualInstructions(agentId, hooksDir) {
3339
3346
  for (const hook of agent.hooks) {
3340
3347
  const hookPath = join(hooksDir, hook.file);
3341
3348
  const hookCmd = buildHookCommand(hookPath, agentId);
3342
- const needsTimeout = hook.name === "stop" || hook.name === "subagentStop";
3343
- hooksObj[hook.name] = needsTimeout ? [{ command: hookCmd, timeout: 600, loop_limit: 10 }] : [{ command: hookCmd }];
3349
+ const needsStopTimeout = hook.name === "stop" || hook.name === "subagentStop";
3350
+ const isApproval = hook.isApprovalHook;
3351
+ const entry = { command: hookCmd };
3352
+ if (needsStopTimeout) {
3353
+ entry.timeout = 600;
3354
+ entry.loop_limit = 10;
3355
+ } else if (isApproval) {
3356
+ entry.timeout = 300;
3357
+ }
3358
+ hooksObj[hook.name] = [entry];
3344
3359
  }
3345
3360
  return JSON.stringify({ hooks: hooksObj }, null, 2);
3346
3361
  } else if (agentId === "gemini-cli") {
@@ -3364,7 +3379,7 @@ function getManualInstructions(agentId, hooksDir) {
3364
3379
  command: hookCmd
3365
3380
  };
3366
3381
  if (isApproval)
3367
- entry.timeout = 120;
3382
+ entry.timeout = 300;
3368
3383
  if (hookTimeout)
3369
3384
  entry.timeout = hookTimeout;
3370
3385
  hooksObj[hook.name] = [entry];
@@ -3380,7 +3395,7 @@ function getManualInstructions(agentId, hooksDir) {
3380
3395
  bash: isWindows() ? toGitBashPath(hookPath) : hookPath
3381
3396
  };
3382
3397
  if (isApproval)
3383
- entry.timeoutSec = 120;
3398
+ entry.timeoutSec = 300;
3384
3399
  hooksObj[hook.name] = [entry];
3385
3400
  }
3386
3401
  return JSON.stringify({ version: 1, hooks: hooksObj }, null, 2);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentapprove",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Approve AI agent actions from your iPhone or Apple Watch",
5
5
  "type": "module",
6
6
  "bin": {