@agentapprove/opencode

中文文档
0.1.26发布于 2026/11/10SEE LICENSE IN LICENSECommonJS零依赖近 30 天下载 3959

Agent Approve plugin for OpenCode - approve or deny AI agent tool calls from your iPhone and Apple Watch

原始使用文档
文档目录9 节
  1. Why Agent Approve?
  2. Important
  3. How it works
  4. Install
  5. Manual setup (advanced)
  6. Configuration
  7. Requirements
  8. Supported agents
  9. Links

@agentapprove/opencode

Agent Approve plugin for OpenCode. Approve or deny AI agent tool calls from your iPhone and Apple Watch.

Why Agent Approve?

  • Visibility -- see what your OpenCode agent is doing in real time from your mobile device
  • Centralized policy -- define your default stance (allow, deny, or ask) and manage custom allowlists and denylists for tools, parameters, and commands
  • Mobile approval -- when human approval is required, review and respond from your iPhone or Apple Watch with a tap

You decide the rules. Agent Approve enforces them.

Important

  • A valid Agent Approve subscription is required to use this plugin.
  • You must download the iOS app, run npx agentapprove, and pair your device.
  • If a valid token is not configured, permission checks are denied and setup guidance is printed locally.

How it works

This plugin hooks into OpenCode's event system to enforce your approval policy:

  • tool.execute.before -- evaluates each tool call against your policy and blocks until allowed/denied
  • permission.ask -- fallback for native OpenCode permission prompts
  • tool.execute.after -- logs tool completion events
  • chat.message -- logs user prompt activity
  • event / experimental.session.compacting -- logs session lifecycle and compaction events

Install

  1. Download Agent Approve from the App Store and start your 7-day free trial
  2. Run the installer on each machine where you use OpenCode:
npx agentapprove

The installer handles pairing, token setup, and OpenCode plugin activation. Select OpenCode when prompted for which agents to configure.

  1. Restart OpenCode to load the plugin

That's it. Tool calls will now be evaluated against your policy, and approval requests will appear on your paired device when needed.

Manual setup (advanced)

If you already have Agent Approve configured and just need to add the OpenCode plugin, install it with OpenCode's plugin command:

opencode plugin @agentapprove/[email protected] --global --force

This installs the npm plugin and updates your global OpenCode config. If you need to edit the config manually, ensure the versioned Agent Approve plugin is listed in your OpenCode config:

~/.config/opencode/opencode.json

{
  "plugin": [
    "@agentapprove/[email protected]"
  ]
}

Restart OpenCode to activate the plugin.

Configuration

Plugin behavior is configured through Agent Approve environment settings in:

~/.agentapprove/env

SettingDefaultDescription
AGENTAPPROVE_TIMEOUT300Seconds to wait for an approval response
AGENTAPPROVE_FAIL_BEHAVIORaskDefault policy when API is unreachable: allow, deny, or ask
AGENTAPPROVE_PRIVACYfullWhat tool data is stored in event logs: minimal, summary, or full
AGENTAPPROVE_DEBUGfalseWrite debug logs to ~/.agentapprove/hook-debug.log
AGENTAPPROVE_AGENT_NAME / AGENTAPPROVE_OPENCODE_NAMEOpenCodeDisplay name for this agent
AGENTAPPROVE_E2E_ENABLEDfalseEnable end-to-end encryption for non-approval event content

Requirements

  • OpenCode runtime
  • Agent Approve iOS app and active subscription ($14.99/month, 7-day free trial)

Supported agents

Agent Approve works with OpenCode, OpenClaw, Claude Code, Cursor, OpenAI Codex, Google Antigravity, VS Code Copilot, Copilot CLI, Windsurf, Pi, Hermes, OpenHands, and more. Run npx agentapprove to configure multiple agents at once.

版本与发布记录

@agentapprove/opencode 共发布 22 个版本,首次发布于 2026/03/01;过去 12 个月发布了 22 个版本。

版本发布日期距今
0.1.26latest2026/11/10今天
0.1.25beta2026/10/071 个月前
0.1.242026/08/312 个月前
0.1.232026/07/203 个月前
0.1.222026/07/193 个月前
0.1.212026/07/044 个月前

关于 @agentapprove/opencode 的常见问题

@agentapprove/opencode 是什么?

Agent Approve plugin for OpenCode - approve or deny AI agent tool calls from your iPhone and Apple Watch

如何安装 @agentapprove/opencode?

在项目目录运行 npm install @agentapprove/opencode,或使用 pnpm add / yarn add / bun add。

@agentapprove/opencode 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/agentapprove__opencode 是否存在。

@agentapprove/opencode 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@agentapprove/opencode 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@agentapprove/opencode 可以商用吗?

@agentapprove/opencode 使用 SEE LICENSE IN LICENSE 许可。许可条款写在包内的独立文件中,请阅读该文件确认可否商用。以上为概括,不构成法律意见,请以许可原文为准。

@agentapprove/opencode 的下载量有多少?

根据 npm 官方下载统计,@agentapprove/opencode 在 2026/10/05 – 2026/11/03 这 30 天内被下载 3,959 次,日均约 132 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@agentapprove/opencode 还在维护吗?

最新版本 0.1.26 发布于 2026/11/10(今天);至今共发布 22 个版本,其中过去 12 个月发布了 22 个;首次发布于 2026/03/01。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。