anthropics / anthropics/claude-code
Function hooks: agent.offer doc comment and example say `offered`, AgentOfferResult declares `isOffered` (2.1.263 /plugin-types)
- 主要语言
- Python
- 星标
- 145k
- 派生
- 23.1k
- PR 合并指标
- PR 指标待抓取
描述
## 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
```
贡献指南
这个仓库没有索引到贡献指南
调研方向
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.
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- typescript
- 领域
- api, developer-experience
- Issue 类型
- 缺陷
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 活跃
- 描述清晰度
- 描述清楚
- 新手友好度
- 76/100