anthropics / anthropics/claude-code
Function hooks: agent.offer doc comment and example say `offered`, AgentOfferResult declares `isOffered` (2.1.263 /plugin-types)
- Vorherrschende Sprache
- Python
- Sterne
- 145k
- Forks
- 23.1k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
## 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
```
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- api, developer-experience
- Issue-Typ
- Bug
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Aktiv
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 76/100