Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Re-export ModelPolicyState and ModelPickerCategory from the crate root alongside Model/ModelPolicy

Đang mở Phù hợp với người mới
#1,674 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

  • #2051 của @rinceyuan — đã đóng, không merge

Đánh giá

Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức phù hợp với người mới
88/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
rust
Lĩnh vực
api

Hướng nghiên cứu

Mở types.rs và kiểm tra block pub use crate::generated::api_types đã được chọn lọc, vốn đã export Model và ModelPolicy. Thêm hai enum export được nêu tên vào đó, sau đó xác minh rằng các import ở crate root biên dịch được và ModelPolicyState cùng ModelPickerCategory có thể được truy cập bên cạnh các kiểu container tương ứng của chúng.

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

Mô tả

enhancement
Summary

The crate-root prelude (pub use types::*) surfaces a curated set of
generated protocol types, but omits two enums that are the field types
of structs already re-exported there. This makes the model-info surface
inconsistent: you can name the container struct at the crate root but
must reach through copilot::rpc for the enum that one of its fields
holds.

Details

types.rs curates the public re-export block:

/// Re-exports of generated protocol types that are part of the SDK's
/// public API surface. ...
pub use crate::generated::api_types::{
    Model, ModelBilling, ModelCapabilities, ModelCapabilitiesLimits, ModelCapabilitiesLimitsVision,
    ModelCapabilitiesSupports, ModelList, ModelPolicy, PermissionDecision,
    PermissionDecisionApproveOnce, PermissionDecisionReject, PermissionDecisionUserNotAvailable,
};

Two enums are missing from that list even though they are the declared
field types of structs that are in it:

  • ModelPolicy.state: ModelPolicyState — ModelPolicy is re-exported; ModelPolicyState is not.
  • Model.model_picker_category: Option<ModelPickerCategory> — Model is re-exported; ModelPickerCategory is not.
Consequence

A consumer that pattern-matches on policy.state or reads
model.model_picker_category can refer to copilot::Model /
copilot::ModelPolicy from the crate root, but has to import the field
enums from a different path:

use copilot::{Model, ModelPolicy};            // crate root
use copilot::rpc::{ModelPolicyState, ModelPickerCategory}; // only here

Because the curated list looks complete, it's easy to assume the whole
model-info surface lives at the crate root and be surprised these two
don't. It's a small ergonomics/consistency papercut, not a correctness
issue (both are reachable via copilot::rpc).

Suggested fix

Add ModelPolicyState and ModelPickerCategory to the curated
pub use crate::generated::api_types::{ ... } block in types.rs, so
the full model-info type set is reachable from the crate root alongside
Model and ModelPolicy.

Ngôn ngữ chính
TypeScript
Star
10.5k
Fork
1.5k
Merge trung bình
1 ngày 7 giờ
Pull request đã merge (30 ngày)
63

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của github/copilot-sdk

Tất cả issue của github/copilot-sdk

Issue tương tự

Thêm issue về TypeScript

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.