agentapprove 0.1.32 → 0.1.33

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 +226 -14
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -2454,6 +2454,14 @@ function getOpenCodePluginTargets(opencodeConfigDir, opencodeCacheDir) {
2454
2454
  ...packageCacheTargets
2455
2455
  ].filter((target) => target !== null);
2456
2456
  }
2457
+ function getAntigravityPluginTargets(geminiDir) {
2458
+ const appPluginPath = safeJoinWithinBase(geminiDir, "config", "plugins", "agentapprove");
2459
+ const cliPluginPath = safeJoinWithinBase(geminiDir, "antigravity-cli", "plugins", "agentapprove");
2460
+ return [
2461
+ appPluginPath ? createRemovalTarget(appPluginPath, "plugin_artifact", true) : null,
2462
+ cliPluginPath ? createRemovalTarget(cliPluginPath, "plugin_artifact", true) : null
2463
+ ].filter((target) => target !== null);
2464
+ }
2457
2465
  function collectBackupTargets(configPaths) {
2458
2466
  const targets = [];
2459
2467
  for (const configPath of configPaths) {
@@ -2831,7 +2839,7 @@ function resolvePairingApiBaseUrl(options) {
2831
2839
  }
2832
2840
 
2833
2841
  // src/cli.ts
2834
- var VERSION = "0.1.28";
2842
+ var VERSION = "0.1.33";
2835
2843
  function getApiUrl() {
2836
2844
  return process.env.AGENTAPPROVE_API || "https://api.agentapprove.com";
2837
2845
  }
@@ -2903,14 +2911,14 @@ function getCommand() {
2903
2911
  }
2904
2912
  return filtered[0] || "install";
2905
2913
  }
2906
- var OPENCODE_PLUGIN_VERSION = "0.1.18";
2914
+ var OPENCODE_PLUGIN_VERSION = "0.1.21";
2907
2915
  var OPENCODE_PLUGIN_SPEC = `@agentapprove/opencode@${OPENCODE_PLUGIN_VERSION}`;
2908
- var OPENCLAW_PLUGIN_VERSION = "0.2.11";
2916
+ var OPENCLAW_PLUGIN_VERSION = "0.2.14";
2909
2917
  var OPENCLAW_PLUGIN_SPEC = `@agentapprove/openclaw@${OPENCLAW_PLUGIN_VERSION}`;
2910
- var PI_PLUGIN_VERSION = "0.1.7";
2918
+ var PI_PLUGIN_VERSION = "0.1.10";
2911
2919
  var PI_PLUGIN_SPEC = `npm:@agentapprove/pi@${PI_PLUGIN_VERSION}`;
2912
2920
  var PI_STATUS_TIMEOUT_MS = 5000;
2913
- var HERMES_PLUGIN_VERSION = "0.1.5";
2921
+ var HERMES_PLUGIN_VERSION = "0.1.6";
2914
2922
  var HERMES_PIP_DEPS = ["cryptography>=44.0,<46", "httpx>=0.27,<0.29"];
2915
2923
  var AGENTS = {
2916
2924
  "claude-code": {
@@ -2967,8 +2975,20 @@ var AGENTS = {
2967
2975
  { name: "post_cascade_response", file: "windsurf-hook.sh", description: "Cascade response (logging)" }
2968
2976
  ]
2969
2977
  },
2978
+ antigravity: {
2979
+ name: "Antigravity",
2980
+ configPath: join(homedir(), ".gemini", "config", "plugins", "agentapprove", "hooks.json"),
2981
+ hooksKey: "antigravityPlugin",
2982
+ hooks: [
2983
+ { name: "PreToolUse", file: "antigravity-hook.sh", description: "Tool approval", isApprovalHook: true, timeout: 300 },
2984
+ { name: "PostToolUse", file: "antigravity-hook.sh", description: "Tool completion logging" },
2985
+ { name: "PreInvocation", file: "antigravity-hook.sh", description: "Prompt/session capture" },
2986
+ { name: "PostInvocation", file: "antigravity-hook.sh", description: "Response capture" },
2987
+ { name: "Stop", file: "antigravity-hook.sh", description: "Agent stopped (iOS input)", isApprovalHook: true, timeout: 600 }
2988
+ ]
2989
+ },
2970
2990
  "gemini-cli": {
2971
- name: "Gemini CLI",
2991
+ name: "Gemini CLI (legacy)",
2972
2992
  configPath: join(homedir(), ".gemini", "settings.json"),
2973
2993
  hooksKey: "hooks",
2974
2994
  hooks: [
@@ -2983,6 +3003,18 @@ var AGENTS = {
2983
3003
  { name: "SessionEnd", file: "gemini-session-end.sh", description: "Session ended" }
2984
3004
  ]
2985
3005
  },
3006
+ "antigravity-cli": {
3007
+ name: "Antigravity CLI",
3008
+ configPath: join(homedir(), ".gemini", "antigravity-cli", "plugins", "agentapprove", "hooks.json"),
3009
+ hooksKey: "antigravityPlugin",
3010
+ hooks: [
3011
+ { name: "PreToolUse", file: "antigravity-hook.sh", description: "Tool approval", isApprovalHook: true, timeout: 300 },
3012
+ { name: "PostToolUse", file: "antigravity-hook.sh", description: "Tool completion logging" },
3013
+ { name: "PreInvocation", file: "antigravity-hook.sh", description: "Prompt/session capture" },
3014
+ { name: "PostInvocation", file: "antigravity-hook.sh", description: "Response capture" },
3015
+ { name: "Stop", file: "antigravity-hook.sh", description: "Agent stopped (iOS input)", isApprovalHook: true, timeout: 600 }
3016
+ ]
3017
+ },
2986
3018
  "vscode-agent": {
2987
3019
  name: "VS Code GitHub Copilot",
2988
3020
  configPath: join(homedir(), ".agentapprove", "hooks", "vscode-hooks.json"),
@@ -3069,6 +3101,39 @@ var AGENTS = {
3069
3101
  ]
3070
3102
  }
3071
3103
  };
3104
+ var AGENT_INSTALL_DISPLAY_ORDER = [
3105
+ "antigravity",
3106
+ "antigravity-cli",
3107
+ "claude-code",
3108
+ "cursor",
3109
+ "gemini-cli",
3110
+ "copilot-cli",
3111
+ "hermes",
3112
+ "codex",
3113
+ "openclaw",
3114
+ "opencode",
3115
+ "openhands",
3116
+ "pi",
3117
+ "vscode-agent",
3118
+ "windsurf"
3119
+ ];
3120
+ var SUPPORTED_AGENT_COPY = [
3121
+ "Antigravity",
3122
+ "Antigravity CLI",
3123
+ "Claude Code",
3124
+ "Cursor",
3125
+ "Gemini CLI (legacy)",
3126
+ "GitHub Copilot CLI",
3127
+ "Hermes",
3128
+ "OpenAI Codex",
3129
+ "OpenClaw",
3130
+ "OpenCode",
3131
+ "OpenHands",
3132
+ "Pi",
3133
+ "VS Code GitHub Copilot",
3134
+ "Windsurf"
3135
+ ].join(", ");
3136
+ var HIGHLIGHTED_AGENT_COPY = "Antigravity, Hermes, Pi, OpenClaw, OpenCode, and OpenHands";
3072
3137
  var SHARED_HOOK_FILES = ["common.sh"];
3073
3138
  var STATUS_FIELD_LABELS = {
3074
3139
  AGENTAPPROVE_API: "API URL",
@@ -3110,6 +3175,8 @@ var HOOK_STATUS_LABELS = {
3110
3175
  AfterAgent: "Stop",
3111
3176
  BeforeModel: "Model request",
3112
3177
  AfterModel: "Model response",
3178
+ PreInvocation: "Prompt capture",
3179
+ PostInvocation: "Response capture",
3113
3180
  Notification: "Notification",
3114
3181
  userPromptSubmitted: "Prompt submitted",
3115
3182
  errorOccurred: "Error",
@@ -3173,6 +3240,72 @@ function buildHookCommand(hookScriptPath, agentId) {
3173
3240
  }
3174
3241
  return `"${gitBash}" "${toGitBashPath(hookScriptPath)}"`;
3175
3242
  }
3243
+ function isAntigravityAgent(agentId) {
3244
+ return agentId === "antigravity" || agentId === "antigravity-cli";
3245
+ }
3246
+ function buildAntigravityHookCommand(hookScriptPath, agentId, hookName, mode) {
3247
+ return `${buildHookCommand(hookScriptPath, agentId)} ${hookName} ${agentId} ${mode}`;
3248
+ }
3249
+ function getAntigravityPluginRoot(agentId) {
3250
+ if (agentId === "antigravity-cli") {
3251
+ return join(homedir(), ".gemini", "antigravity-cli", "plugins", "agentapprove");
3252
+ }
3253
+ return join(homedir(), ".gemini", "config", "plugins", "agentapprove");
3254
+ }
3255
+ function getAntigravityPluginManifest() {
3256
+ return {
3257
+ $schema: "https://antigravity.google/schemas/v1/plugin.json",
3258
+ name: "agentapprove",
3259
+ description: "Agent Approve approvals, activity monitoring, and mobile follow-up input"
3260
+ };
3261
+ }
3262
+ function buildAntigravityHooksJson(agentId, hooksDir, mode) {
3263
+ const agent = AGENTS[agentId];
3264
+ const hooksToInstall = mode === "observe" ? agent.hooks.filter((h2) => h2.name !== "Stop") : agent.hooks;
3265
+ const bundle = { enabled: true };
3266
+ for (const hook of hooksToInstall) {
3267
+ const hookPath = join(hooksDir, hook.file);
3268
+ const hookCommand = buildAntigravityHookCommand(hookPath, agentId, hook.name, mode);
3269
+ const hookTimeout = hook.timeout ?? 30;
3270
+ const commandHook = {
3271
+ type: "command",
3272
+ command: hookCommand,
3273
+ timeout: hookTimeout
3274
+ };
3275
+ if (hook.name === "PreToolUse" || hook.name === "PostToolUse") {
3276
+ bundle[hook.name] = [
3277
+ {
3278
+ matcher: "*",
3279
+ hooks: [commandHook]
3280
+ }
3281
+ ];
3282
+ } else {
3283
+ bundle[hook.name] = [commandHook];
3284
+ }
3285
+ }
3286
+ return { agentapprove: bundle };
3287
+ }
3288
+ function installAntigravityPluginBundle(agentId, hooksDir, mode) {
3289
+ const agent = AGENTS[agentId];
3290
+ const pluginRoot = getAntigravityPluginRoot(agentId);
3291
+ const hooksPath = join(pluginRoot, "hooks.json");
3292
+ const manifestPath = join(pluginRoot, "plugin.json");
3293
+ const backupPath = backupConfig(hooksPath);
3294
+ try {
3295
+ mkdirSync(pluginRoot, { recursive: true });
3296
+ writeJsonConfig(manifestPath, getAntigravityPluginManifest());
3297
+ writeJsonConfig(hooksPath, buildAntigravityHooksJson(agentId, hooksDir, mode));
3298
+ } catch (err) {
3299
+ return {
3300
+ success: false,
3301
+ backupPath,
3302
+ hooks: [],
3303
+ error: err instanceof Error ? err.message : String(err)
3304
+ };
3305
+ }
3306
+ const installedHooks = (mode === "observe" ? agent.hooks.filter((h2) => h2.name !== "Stop") : agent.hooks).map((hook) => hook.name);
3307
+ return { success: true, backupPath, hooks: installedHooks };
3308
+ }
3176
3309
  function getVSCodeSettingsPaths() {
3177
3310
  const paths = [];
3178
3311
  if (process.platform === "darwin") {
@@ -3339,6 +3472,19 @@ function detectInstalledAgents() {
3339
3472
  installed.push(id);
3340
3473
  } catch {}
3341
3474
  }
3475
+ } else if (id === "antigravity") {
3476
+ if (existsSync2(getAntigravityPluginRoot(id)) || existsSync2(join(homedir(), ".gemini", "antigravity")) || existsSync2(join(homedir(), ".gemini", "antigravity-ide")) || existsSync2("/Applications/Antigravity.app")) {
3477
+ installed.push(id);
3478
+ }
3479
+ } else if (id === "antigravity-cli") {
3480
+ if (existsSync2(join(homedir(), ".gemini", "antigravity-cli"))) {
3481
+ installed.push(id);
3482
+ } else {
3483
+ try {
3484
+ execSync("agy --version", { stdio: "ignore" });
3485
+ installed.push(id);
3486
+ } catch {}
3487
+ }
3342
3488
  } else {
3343
3489
  const configDir = dirname2(agent.configPath);
3344
3490
  if (existsSync2(configDir)) {
@@ -3517,7 +3663,8 @@ function buildUninstallPlan() {
3517
3663
  const configuredAgents = detectInstalledAgents();
3518
3664
  const pluginArtifactTargets = uniqueRemovalTargets([
3519
3665
  ...getOpenClawPluginTargets(AGENTS.openclaw.configPath),
3520
- ...getOpenCodePluginTargets(getOpenCodeConfigDir(), getOpenCodeCacheDir())
3666
+ ...getOpenCodePluginTargets(getOpenCodeConfigDir(), getOpenCodeCacheDir()),
3667
+ ...getAntigravityPluginTargets(join(homedir(), ".gemini"))
3521
3668
  ]);
3522
3669
  return {
3523
3670
  configuredAgents,
@@ -4144,6 +4291,34 @@ async function storeTokenInKeychain(token, options) {
4144
4291
  }
4145
4292
  return false;
4146
4293
  }
4294
+ function readTokenFromKeychain() {
4295
+ if (!isKeychainAvailable())
4296
+ return null;
4297
+ try {
4298
+ const result = spawnSync("security", [
4299
+ "find-generic-password",
4300
+ "-s",
4301
+ KEYCHAIN_SERVICE,
4302
+ "-a",
4303
+ KEYCHAIN_ACCOUNT,
4304
+ "-w"
4305
+ ], { encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] });
4306
+ if (result.status !== 0 || result.error)
4307
+ return null;
4308
+ return (result.stdout || "").trim() || null;
4309
+ } catch {
4310
+ return null;
4311
+ }
4312
+ }
4313
+ async function syncKeychainTokenWithEnv(envToken) {
4314
+ if (!envToken || !isKeychainAvailable())
4315
+ return true;
4316
+ const keychainToken = readTokenFromKeychain();
4317
+ if (!keychainToken || keychainToken === envToken)
4318
+ return true;
4319
+ v2.warn("Keychain token did not match ~/.agentapprove/env — updated the Keychain to match. " + "(A stale Keychain token can route events to the wrong account.)");
4320
+ return storeTokenInKeychain(envToken, { quiet: true });
4321
+ }
4147
4322
  function deleteTokenFromKeychain() {
4148
4323
  if (isKeychainAvailable()) {
4149
4324
  try {
@@ -4191,6 +4366,9 @@ async function installHooksForAgent(agentId, hooksDir, mode = "approval") {
4191
4366
  }
4192
4367
  return { success: true, backupPath: null, hooks: [installResult.label] };
4193
4368
  }
4369
+ if (isAntigravityAgent(agentId)) {
4370
+ return installAntigravityPluginBundle(agentId, hooksDir, mode);
4371
+ }
4194
4372
  const backupPath = backupConfig(agent.configPath);
4195
4373
  const config = readJsonConfig(agent.configPath);
4196
4374
  const useTopLevelHooks = agent.hooksKey === "";
@@ -4685,6 +4863,18 @@ codex_hooks = true`;
4685
4863
  hooksObj[hook.name] = [{ hooks: [hookObject] }];
4686
4864
  }
4687
4865
  return JSON.stringify({ hooks: hooksObj }, null, 2);
4866
+ } else if (isAntigravityAgent(agentId)) {
4867
+ const pluginRoot = getAntigravityPluginRoot(agentId);
4868
+ return [
4869
+ `Create plugin directory: ${pluginRoot}`,
4870
+ "",
4871
+ "plugin.json:",
4872
+ JSON.stringify(getAntigravityPluginManifest(), null, 2),
4873
+ "",
4874
+ "hooks.json:",
4875
+ JSON.stringify(buildAntigravityHooksJson(agentId, hooksDir, "approval"), null, 2)
4876
+ ].join(`
4877
+ `);
4688
4878
  } else if (agentId === "vscode-agent") {
4689
4879
  const hooksObj = {};
4690
4880
  for (const hook of agent.hooks) {
@@ -5036,7 +5226,7 @@ function removePiPluginViaCli() {
5036
5226
  };
5037
5227
  }
5038
5228
  }
5039
- var HERMES_BUNDLE_SHA256 = "5af57a4607437912dbdd044d60971ffba6d4ffdd3dd86b0eea4c5ab220ecf308";
5229
+ var HERMES_BUNDLE_SHA256 = "70d1f87a2199023aef4d5f6c5045e8bafa5d1334a13469aa730981688bdaafdf";
5040
5230
  var HERMES_BUNDLE_FILENAME = `agentapprove-hermes-${HERMES_PLUGIN_VERSION}.tar.gz`;
5041
5231
  var HERMES_PLUGIN_DIR = join(homedir(), ".hermes", "plugins", "agentapprove");
5042
5232
  function findPython() {
@@ -5826,10 +6016,10 @@ async function installCommand() {
5826
6016
  he("Installation cancelled");
5827
6017
  process.exit(1);
5828
6018
  }
5829
- me(`Approve AI agent actions from your iPhone or Apple Watch.
5830
- Installs hooks and extensions for Cursor, Windsurf, Claude, Gemini, Pi, OpenCode, OpenClaw, and more.`, "About");
6019
+ me(`AI agent observability and control from your iPhone or Apple Watch.
6020
+ Monitor activity, enforce policy, and approve with a tap.`, "About");
5831
6021
  const installedAgents = detectInstalledAgents();
5832
- const agentOptions = Object.entries(AGENTS).map(([id, agent]) => ({
6022
+ const agentOptions = AGENT_INSTALL_DISPLAY_ORDER.map((id) => [id, AGENTS[id]]).map(([id, agent]) => ({
5833
6023
  value: id,
5834
6024
  label: agent.name,
5835
6025
  hint: installedAgents.includes(id) ? "Detected" : "Not found"
@@ -6463,6 +6653,7 @@ async function statusCommand() {
6463
6653
  const envContent = readFileSync(envPath, "utf-8");
6464
6654
  const lines = envContent.split(`
6465
6655
  `);
6656
+ let envToken = "";
6466
6657
  for (const line of lines) {
6467
6658
  if (line.startsWith("AGENTAPPROVE_")) {
6468
6659
  const assignment = parseEnvAssignment(line);
@@ -6470,11 +6661,15 @@ async function statusCommand() {
6470
6661
  continue;
6471
6662
  }
6472
6663
  const { key, value } = assignment;
6664
+ if (key === "AGENTAPPROVE_TOKEN") {
6665
+ envToken = value;
6666
+ }
6473
6667
  const displayKey = STATUS_FIELD_LABELS[key] || key.replace("AGENTAPPROVE_", "");
6474
6668
  const displayValue = formatStatusValue(key, value);
6475
6669
  console.log(` ${source_default.dim(displayKey + ":")} ${displayValue}`);
6476
6670
  }
6477
6671
  }
6672
+ await syncKeychainTokenWithEnv(envToken);
6478
6673
  const e2eKeyFile = join(getAgentApproveDir(), "e2e-key");
6479
6674
  const e2eServerKeyFile = join(getAgentApproveDir(), "e2e-server-key");
6480
6675
  if (existsSync2(e2eKeyFile)) {
@@ -6487,7 +6682,8 @@ async function statusCommand() {
6487
6682
  console.log(` ${source_default.dim(" E2E encryption: not configured")}`);
6488
6683
  }
6489
6684
  console.log();
6490
- for (const [agentId, agent] of Object.entries(AGENTS)) {
6685
+ for (const agentId of AGENT_INSTALL_DISPLAY_ORDER) {
6686
+ const agent = AGENTS[agentId];
6491
6687
  if (agentId === "pi") {
6492
6688
  try {
6493
6689
  const listOutput = execSync("pi list", {
@@ -6533,6 +6729,19 @@ async function statusCommand() {
6533
6729
  }
6534
6730
  continue;
6535
6731
  }
6732
+ if (isAntigravityAgent(agentId)) {
6733
+ const bundle = config.agentapprove;
6734
+ if (bundle) {
6735
+ const installedHooks = agent.hooks.filter((h2) => {
6736
+ const hookEntry = bundle[h2.name];
6737
+ return !!hookEntry && JSON.stringify(hookEntry).includes("agentapprove");
6738
+ });
6739
+ if (installedHooks.length > 0) {
6740
+ console.log(` ${source_default.green("✓")} ${agent.name}: ${installedHooks.map((h2) => formatHookStatusLabel(h2.name)).join(", ")}`);
6741
+ }
6742
+ }
6743
+ continue;
6744
+ }
6536
6745
  const hooksConfig = agent.hooksKey === "" ? config : config[agent.hooksKey];
6537
6746
  if (hooksConfig) {
6538
6747
  const installedHooks = agent.hooks.filter((h2) => {
@@ -6833,8 +7042,10 @@ async function initRepoCommand() {
6833
7042
  }
6834
7043
  function helpCommand() {
6835
7044
  console.log(`
6836
- ${source_default.cyan("Agent Approve")} - Approve AI agent actions from your iPhone or Apple Watch
7045
+ ${source_default.cyan("Agent Approve")} - AI agent observability and control from your iPhone or Apple Watch
6837
7046
  ${source_default.dim("Supports macOS, Linux, and Windows (via Git Bash)")}
7047
+ ${source_default.dim(`Supported agents: ${SUPPORTED_AGENT_COPY}`)}
7048
+ ${source_default.dim(`Especially useful for autonomous agents like ${HIGHLIGHTED_AGENT_COPY}.`)}
6838
7049
 
6839
7050
  ${source_default.yellow("Usage:")}
6840
7051
  npx agentapprove [command] [options]
@@ -7182,7 +7393,8 @@ async function updateHookScriptsWithToken(token, apiUrl) {
7182
7393
  "gemini-approval.sh",
7183
7394
  "gemini-complete.sh",
7184
7395
  "windsurf-hook.sh",
7185
- "openhands-hook.sh"
7396
+ "openhands-hook.sh",
7397
+ "antigravity-hook.sh"
7186
7398
  ];
7187
7399
  for (const file of hookFiles) {
7188
7400
  const filePath = join(hooksDir, file);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentapprove",
3
- "version": "0.1.32",
3
+ "version": "0.1.33",
4
4
  "description": "AI agent observability and control from your iPhone or Apple Watch",
5
5
  "type": "module",
6
6
  "bin": {