Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン 初心者向け
#1,674 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

  • #2051 @rinceyuan による — マージされずにクローズ

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
88/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
rust
領域
api

調査の方向性

types.rs を開き、すでに Model と ModelPolicy をエクスポートしている、整理された pub use crate::generated::api_types ブロックを確認します。そこに指定された 2 つの enum エクスポートを追加し、crate ルートのインポートがコンパイルできること、また ModelPolicyState と ModelPickerCategory にそれぞれのコンテナ型と同じようにアクセスできることを確認します。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
TypeScript
スター
10.5k
フォーク
1.5k
平均マージ
1日 7時間
マージ済み PR(30日)
64

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

github/copilot-sdk のほかの issue

github/copilot-sdk の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。