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

Abierto
#67,067 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
58/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
bun, typescript
Área
backend, tooling

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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).

Lenguaje dominante
TypeScript
Estrellas
230k
Forks
31.3k
Merge medio
5 h 32 min
PR fusionados (30 d)
453

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de anomalyco/opencode

Todos los issues de anomalyco/opencode

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.