anthropics / anthropics/claude-code

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

Đang mở Phù hợp với người mới
#92,440 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
area:hooks bug documentation
Ngôn ngữ chính
Python
Star
145k
Fork
23.1k
Chỉ số merge pull request
Chỉ số pull request đang chờ

Mô tả

## 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
```

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
typescript
Lĩnh vực
api, developer-experience
Loại issue
Lỗi
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
76/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.