Code Mode file APIs (Bun.write / Bun.file / Bun.Glob) should pass through plugin tool hooks

未关闭
#67,067 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
58/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
bun, typescript
领域
backend, tooling

调研方向

Start with packages/core/src/tool.ts to understand existing tool.execute.before and tool.execute.after behavior, then inspect packages/core/src/codemode/tool.ts for the Code Mode extension path. Trace the permission-service handling of Bun.file, Bun.write, Bun.Glob, and fetch, and identify the corresponding plugin hook entry points. Done means the selected approach consistently exposes these calls to plugin hooks or clearly documents the permission-only behavior, with matching failure handling and relevant tests.

由索引模型根据 Issue 内容生成。

描述

area/plugins type/feature version/v2
Summary

With experimental.full_codemode on, a Code Mode script can use Bun.file, Bun.write, Bun.Glob and fetch. These calls go through the permission service (read, write and webfetch permissions). They do not go through plugin tool.execute.before and tool.execute.after hooks, because they are not tool calls.

Why it matters

Plugins use tool hooks for more than allow or deny: audit logs, output redaction, path rules that depend on call context, rate limits. A plugin that does this work in tool hooks does not see file reads, file writes, glob scans or HTTP requests that a Code Mode script makes. The same operation through the read, write, glob or webfetch tool is visible to it.

Request

One of these:

  1. Run the plugin hooks of the matching tool (read, write, edit, glob, webfetch) for each Code Mode Bun file call and each fetch, with the tool name and an input that has the path or URL. A tool.execute.before failure then stops the call, as it does for a tool call.
  2. Or a separate plugin hook for Code Mode extension calls (name, arguments, result), with the same failure contract as tool.execute.before.
  3. At minimum, document that Code Mode file and network calls pass the permission service only, so that plugin authors can move such checks to the permission hook.
Version

v2.4.2. On current dev, plugin tool.execute.before is still triggered only for tool calls (packages/core/src/tool.ts); the Code Mode extension hooks drive the progress display only (packages/core/src/codemode/tool.ts).

主要语言
TypeScript
星标
230k
派生
31.3k
平均合并
5 小时 32 分钟
30 天内合并 PR
453

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

anomalyco/opencode 的其他 Issue

查看 anomalyco/opencode 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。