anthropics / anthropics/claude-code

Function hooks: agent.offer doc comment and example say `offered`, AgentOfferResult declares `isOffered` (2.1.263 /plugin-types)

Abierto Apto para principiantes
#92,440 0 comentarios 0 reacciones 0 asignados Ver en GitHub
area:hooks bug documentation
Lenguaje dominante
Python
Estrellas
145k
Forks
23.1k
Métricas de merge de PR
Métricas de PR pendientes

Descripción

## Summary

In the declarations `/plugin-types` writes (`claude-code.d.ts`, Claude Code 2.1.263, `CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1`), the `agent.offer` doc comment and its example describe the result as `{ offered }`, while the result type `AgentOfferResult` declares `isOffered`.

## Lines in the generated file

- `EngineEventOf['agent.offer']` doc comment: "Return `{ offered: false }` to keep the type out of the listing and refuse its dispatch."
- Its `@example`: `on("agent.offer", { agent: "advisor" }, () => ({ offered: false }))`
- `EngineResultOf['agent.offer']` doc comment: "`{ offered }`."
- The type: `export type AgentOfferResult = { isOffered: boolean; };`

## Effect

A hook written from the doc comment or the example returns `{ offered: false }`, which fails to typecheck against `AgentOfferResult` and, at run time, is not the shape the engine reads. A hook written from the type returns `{ isOffered: false }` and compiles.

## Expected

The doc comment, the example, and the type name one field.

## Reproduction

```sh
claude -p "/plugin-types .claude/types"
rg -n 'offered' .claude/types/claude-code.d.ts
```

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Regenerate the declarations with `claude -p "/plugin-types .claude/types"` and inspect `.claude/types/claude-code.d.ts` around `EngineEventOf['agent.offer']`, `EngineResultOf['agent.offer']`, and `AgentOfferResult`. Use `rg -n 'offered' .claude/types/claude-code.d.ts` to verify the comments and example consistently use `isOffered` and match the declared result type.

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

Evaluación

Stack tecnológico
typescript
Área
api, developer-experience
Tipo de issue
Error
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Activo
Claridad
Bien especificado
Aptitud para principiantes
76/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.