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

オープン
#67,067 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
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分
マージ済み PR(30日)
453

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

anomalyco/opencode のほかの issue

anomalyco/opencode の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。