From 9944b5e01e5f19df795395d6b6c16c9fbe0923fa Mon Sep 17 00:00:00 2001 From: Andy Salerno Date: Tue, 25 Aug 2026 12:04:12 -0700 Subject: [PATCH 1/3] Node.js: expose contextual model discovery Regenerate the public RPC types for the versioned pre-session models.list context and resolution acknowledgment introduced by github/copilot-agent-runtime#16938. Keep the cached listModels API unchanged so existing callers preserve legacy behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- nodejs/src/generated/rpc.ts | 67 +++++++++++++++++++++++++++++++++++-- 1 file changed, 65 insertions(+), 2 deletions(-) diff --git a/nodejs/src/generated/rpc.ts b/nodejs/src/generated/rpc.ts index 0174e476b..55fd1ca4b 100644 --- a/nodejs/src/generated/rpc.ts +++ b/nodejs/src/generated/rpc.ts @@ -2265,7 +2265,9 @@ export type ModelPickerCategory = /** Versatile model category suitable for a broad range of tasks. */ | "versatile" /** Powerful model category optimized for complex tasks. */ - | "powerful"; + | "powerful" + /** Experimental model category for models that require an explicit experimental opt-in. */ + | "experimental"; /** * Relative cost tier for token-based billing users * @@ -2282,6 +2284,14 @@ export type ModelPickerPriceCategory = | "high" /** Highest relative token cost tier. */ | "very_high"; +/** + * How a server-level model list was resolved. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "ModelsListResolutionMode". + */ +/** @experimental */ +export type ModelsListResolutionMode = /** The runtime applied the supplied pre-session context. */ "pre-session"; /** * Optional listing options. * @@ -2299,6 +2309,15 @@ export type ModelListRequest = */ skipCache?: boolean; }; + +/** @experimental */ +export type ModelsListSessionKind = "top-level"; + +/** @experimental */ +export type ModelsListExecutionEnvironment = "local"; + +/** @experimental */ +export type ModelsListModelBackend = "copilot"; /** * Provider type. Defaults to "openai" for generic OpenAI-compatible APIs. * @@ -12194,6 +12213,21 @@ export interface ModelList { * List of available models with full metadata */ models: Model[]; + resolution?: ModelsListResolution; +} +/** + * Acknowledges how the runtime resolved a server-level model list. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "ModelsListResolution". + */ +/** @experimental */ +export interface ModelsListResolution { + mode: ModelsListResolutionMode; + /** + * Version of the applied pre-session context contract. + */ + contextVersion: number; } /** @experimental */ @@ -12266,6 +12300,35 @@ export interface ModelsListRequest { * GitHub token accepted for compatibility with existing SDK clients. When provided, resolves this token instead of using the current account. */ gitHubToken?: string; + sessionContext?: ModelsListPreSessionContext; +} +/** + * Ordinary session inputs used to resolve a selectable model snapshot before session creation. Version 1 is limited to local, top-level, Copilot-backed sessions. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "ModelsListPreSessionContext". + */ +/** @experimental */ +export interface ModelsListPreSessionContext { + /** + * Pre-session context contract version. Version 1 is the only supported value. + */ + version: number; + sessionKind: ModelsListSessionKind; + executionEnvironment: ModelsListExecutionEnvironment; + modelBackend: ModelsListModelBackend; + /** + * Working directory used to evaluate repository model policy. + */ + workingDirectory: string; + /** + * Whether the subsequent top-level session will enable experimental mode. + */ + enableExperimentalMode: boolean; + /** + * Existing ExP assignment response supplied using the same ordinary session input as `session.create`. The runtime interprets assignments; callers must not submit resolved feature or kill-switch claims. + */ + expAssignments?: JsonValue; } /** @experimental */ @@ -22442,7 +22505,7 @@ export function createServerRpc(connection: MessageConnection) { /** * Lists Copilot models available to the authenticated user. * - * @param params Optional opaque account selection or compatibility GitHub token used to list models. + * @param params Optional account selection and pre-session context used to list models. * * @returns List of Copilot models available to the resolved user, including capabilities and billing metadata. */ From 11df95ba4e70b8ac5f0fdf698a7d3ab25a6eb1fe Mon Sep 17 00:00:00 2001 From: Andy Salerno Date: Tue, 25 Aug 2026 12:17:59 -0700 Subject: [PATCH 2/3] Rust: expose contextual model discovery Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- rust/src/generated/api_types.rs | 129 +++++++++++++++++++++++++++++++- rust/src/generated/rpc.rs | 2 +- 2 files changed, 129 insertions(+), 2 deletions(-) diff --git a/rust/src/generated/api_types.rs b/rust/src/generated/api_types.rs index 0583c0922..aa8e06e6e 100644 --- a/rust/src/generated/api_types.rs +++ b/rust/src/generated/api_types.rs @@ -10077,6 +10077,23 @@ pub struct ModelCapabilitiesOverride { pub supports: Option, } +/// Acknowledges how the runtime resolved a server-level model list. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct ModelsListResolution { + /// Version of the applied pre-session context contract. + pub context_version: i32, + /// Resolution mode applied by the runtime. + pub mode: ModelsListResolutionMode, +} + /// List of Copilot models available to the resolved user, including capabilities and billing metadata. /// ///
@@ -10090,6 +10107,9 @@ pub struct ModelCapabilitiesOverride { pub struct ModelList { /// List of available models with full metadata pub models: Vec, + /// Present only when the runtime applied a pre-session resolution context. + #[serde(skip_serializing_if = "Option::is_none")] + pub resolution: Option, } /// Optional listing options. @@ -10178,7 +10198,35 @@ pub struct ModelSetReasoningEffortResult { pub reasoning_effort: String, } -/// Optional opaque account selection or compatibility GitHub token used to list models. +/// Ordinary session inputs used to resolve a selectable model snapshot before session creation. Version 1 is limited to local, top-level, Copilot-backed sessions. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct ModelsListPreSessionContext { + /// Whether the subsequent top-level session will enable experimental mode. + pub enable_experimental_mode: bool, + /// Execution environment being planned. Version 1 accepts only `local`. + pub execution_environment: ModelsListExecutionEnvironment, + /// Existing ExP assignment response supplied using the same ordinary session input as `session.create`. The runtime interprets assignments; callers must not submit resolved feature or kill-switch claims. + #[serde(skip_serializing_if = "Option::is_none")] + pub exp_assignments: Option, + /// Model backend being planned. Version 1 accepts only `copilot`. + pub model_backend: ModelsListModelBackend, + /// Session kind being planned. Version 1 accepts only `top-level`. + pub session_kind: ModelsListSessionKind, + /// Pre-session context contract version. Version 1 is the only supported value. + pub version: i32, + /// Working directory used to evaluate repository model policy. + pub working_directory: String, +} + +/// Optional account selection and pre-session context used to list models. /// ///
/// @@ -10195,6 +10243,9 @@ pub struct ModelsListRequest { /// Opaque account identifier returned by `account.getAllUsers`. When omitted, the current account is used. #[serde(skip_serializing_if = "Option::is_none")] pub selection_id: Option, + /// Optional versioned context for resolving the model picker before creating a session. + #[serde(skip_serializing_if = "Option::is_none")] + pub session_context: Option, } /// @@ -21082,6 +21133,9 @@ pub struct WorkspacesWriteAutopilotObjectiveResult { pub struct ModelsListResult { /// List of available models with full metadata pub models: Vec, + /// Present only when the runtime applied a pre-session resolution context. + #[serde(skip_serializing_if = "Option::is_none")] + pub resolution: Option, } /// The running runtime's complete catalog of well-known built-in model IDs, including supported models and additional IDs with built-in metadata. @@ -30406,6 +30460,9 @@ pub enum ModelPickerCategory { /// Powerful model category optimized for complex tasks. #[serde(rename = "powerful")] Powerful, + /// Experimental model category for models that require an explicit experimental opt-in. + #[serde(rename = "experimental")] + Experimental, /// Unknown variant for forward compatibility. #[default] #[serde(other)] @@ -30465,6 +30522,76 @@ pub enum ModelPolicyState { Unknown, } +/// How a server-level model list was resolved. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum ModelsListResolutionMode { + /// The runtime applied the supplied pre-session context. + #[serde(rename = "pre-session")] + PreSession, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, +} + +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum ModelsListExecutionEnvironment { + #[serde(rename = "local")] + Local, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, +} + +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum ModelsListModelBackend { + #[serde(rename = "copilot")] + Copilot, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, +} + +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum ModelsListSessionKind { + #[serde(rename = "top-level")] + TopLevel, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, +} + /// Provider transport. Defaults to "http". /// ///
diff --git a/rust/src/generated/rpc.rs b/rust/src/generated/rpc.rs index c955637e3..9b396084d 100644 --- a/rust/src/generated/rpc.rs +++ b/rust/src/generated/rpc.rs @@ -1144,7 +1144,7 @@ impl<'a> ClientRpcModels<'a> { /// /// # Parameters /// - /// * `params` - Optional opaque account selection or compatibility GitHub token used to list models. + /// * `params` - Optional account selection and pre-session context used to list models. /// /// # Returns /// From 3b2019f05e3a8455541e3fd2778748216ed2ea24 Mon Sep 17 00:00:00 2001 From: Andy Salerno Date: Tue, 25 Aug 2026 12:53:37 -0700 Subject: [PATCH 3/3] Expose contextual model discovery for GitHub App baseline Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- nodejs/src/generated/rpc.ts | 67 +++++++++++++++- rust/src/generated/api_types.rs | 132 +++++++++++++++++++++++++++++++- rust/src/generated/rpc.rs | 2 +- 3 files changed, 197 insertions(+), 4 deletions(-) diff --git a/nodejs/src/generated/rpc.ts b/nodejs/src/generated/rpc.ts index cefc8ef4d..4b884ec2b 100644 --- a/nodejs/src/generated/rpc.ts +++ b/nodejs/src/generated/rpc.ts @@ -1523,7 +1523,9 @@ export type ModelPickerCategory = /** Versatile model category suitable for a broad range of tasks. */ | "versatile" /** Powerful model category optimized for complex tasks. */ - | "powerful"; + | "powerful" + /** Experimental model category for models that require an explicit experimental opt-in. */ + | "experimental"; /** * Relative cost tier for token-based billing users * @@ -1540,6 +1542,14 @@ export type ModelPickerPriceCategory = | "high" /** Highest relative token cost tier. */ | "very_high"; +/** + * How a server-level model list was resolved. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "ModelsListResolutionMode". + */ +/** @experimental */ +export type ModelsListResolutionMode = /** The runtime applied the supplied pre-session context. */ "pre-session"; /** * Optional listing options. * @@ -1557,6 +1567,15 @@ export type ModelListRequest = */ skipCache?: boolean; }; + +/** @experimental */ +export type ModelsListSessionKind = "top-level"; + +/** @experimental */ +export type ModelsListExecutionEnvironment = "local"; + +/** @experimental */ +export type ModelsListModelBackend = "copilot"; /** * Provider type. Defaults to "openai" for generic OpenAI-compatible APIs. * @@ -9707,6 +9726,21 @@ export interface ModelList { * List of available models with full metadata */ models: Model[]; + resolution?: ModelsListResolution; +} +/** + * Acknowledges how the runtime resolved a server-level model list. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "ModelsListResolution". + */ +/** @experimental */ +export interface ModelsListResolution { + mode: ModelsListResolutionMode; + /** + * Version of the applied pre-session context contract. + */ + contextVersion: number; } /** * Reasoning effort level to apply to the currently selected model. @@ -9741,6 +9775,35 @@ export interface ModelsListRequest { * GitHub token for per-user model listing. When provided, resolves this token to determine the user's Copilot plan and available models instead of using the global auth. */ gitHubToken?: string; + sessionContext?: ModelsListPreSessionContext; +} +/** + * Ordinary session inputs used to resolve a selectable model snapshot before session creation. Version 1 is limited to local, top-level, Copilot-backed sessions. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "ModelsListPreSessionContext". + */ +/** @experimental */ +export interface ModelsListPreSessionContext { + /** + * Pre-session context contract version. Version 1 is the only supported value. + */ + version: number; + sessionKind: ModelsListSessionKind; + executionEnvironment: ModelsListExecutionEnvironment; + modelBackend: ModelsListModelBackend; + /** + * Working directory used to evaluate repository model policy. + */ + workingDirectory: string; + /** + * Whether the subsequent top-level session will enable experimental mode. + */ + enableExperimentalMode: boolean; + /** + * Existing ExP assignment response supplied using the same ordinary session input as `session.create`. The runtime interprets assignments; callers must not submit resolved feature or kill-switch claims. + */ + expAssignments?: JsonValue; } /** * Target model identifier and optional reasoning effort, summary, capability overrides, and context tier. @@ -18769,7 +18832,7 @@ export function createServerRpc(connection: MessageConnection) { /** * Lists Copilot models available to the authenticated user. * - * @param params Optional GitHub token used to list models for a specific user instead of the global auth context. + * @param params Optional account selection and pre-session context used to list models. * * @returns List of Copilot models available to the resolved user, including capabilities and billing metadata. */ diff --git a/rust/src/generated/api_types.rs b/rust/src/generated/api_types.rs index caf9457a8..bf8e28d14 100644 --- a/rust/src/generated/api_types.rs +++ b/rust/src/generated/api_types.rs @@ -8454,6 +8454,23 @@ pub struct ModelCapabilitiesOverride { pub supports: Option, } +/// Acknowledges how the runtime resolved a server-level model list. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct ModelsListResolution { + /// Version of the applied pre-session context contract. + pub context_version: i32, + /// Resolution mode applied by the runtime. + pub mode: ModelsListResolutionMode, +} + /// List of Copilot models available to the resolved user, including capabilities and billing metadata. /// ///
@@ -8467,6 +8484,9 @@ pub struct ModelCapabilitiesOverride { pub struct ModelList { /// List of available models with full metadata pub models: Vec, + /// Present only when the runtime applied a pre-session resolution context. + #[serde(skip_serializing_if = "Option::is_none")] + pub resolution: Option, } /// Optional listing options. @@ -8515,7 +8535,35 @@ pub struct ModelSetReasoningEffortResult { pub reasoning_effort: String, } -/// Optional GitHub token used to list models for a specific user instead of the global auth context. +/// Ordinary session inputs used to resolve a selectable model snapshot before session creation. Version 1 is limited to local, top-level, Copilot-backed sessions. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct ModelsListPreSessionContext { + /// Whether the subsequent top-level session will enable experimental mode. + pub enable_experimental_mode: bool, + /// Execution environment being planned. Version 1 accepts only `local`. + pub execution_environment: ModelsListExecutionEnvironment, + /// Existing ExP assignment response supplied using the same ordinary session input as `session.create`. The runtime interprets assignments; callers must not submit resolved feature or kill-switch claims. + #[serde(skip_serializing_if = "Option::is_none")] + pub exp_assignments: Option, + /// Model backend being planned. Version 1 accepts only `copilot`. + pub model_backend: ModelsListModelBackend, + /// Session kind being planned. Version 1 accepts only `top-level`. + pub session_kind: ModelsListSessionKind, + /// Pre-session context contract version. Version 1 is the only supported value. + pub version: i32, + /// Working directory used to evaluate repository model policy. + pub working_directory: String, +} + +/// Optional account selection and pre-session context used to list models. /// ///
/// @@ -8529,6 +8577,12 @@ pub struct ModelsListRequest { /// GitHub token for per-user model listing. When provided, resolves this token to determine the user's Copilot plan and available models instead of using the global auth. #[serde(skip_serializing_if = "Option::is_none")] pub git_hub_token: Option, + /// Opaque account identifier returned by `account.getAllUsers`. When omitted, the current account is used. + #[serde(skip_serializing_if = "Option::is_none")] + pub selection_id: Option, + /// Optional versioned context for resolving the model picker before creating a session. + #[serde(skip_serializing_if = "Option::is_none")] + pub session_context: Option, } /// Target model identifier and optional reasoning effort, summary, capability overrides, and context tier. @@ -18448,6 +18502,9 @@ pub struct WorkspacesWriteAutopilotObjectiveResult { pub struct ModelsListResult { /// List of available models with full metadata pub models: Vec, + /// Present only when the runtime applied a pre-session resolution context. + #[serde(skip_serializing_if = "Option::is_none")] + pub resolution: Option, } /// The running runtime's complete catalog of well-known built-in model IDs, including supported models and additional IDs with built-in metadata. @@ -25956,6 +26013,9 @@ pub enum ModelPickerCategory { /// Powerful model category optimized for complex tasks. #[serde(rename = "powerful")] Powerful, + /// Experimental model category for models that require an explicit experimental opt-in. + #[serde(rename = "experimental")] + Experimental, /// Unknown variant for forward compatibility. #[default] #[serde(other)] @@ -26015,6 +26075,76 @@ pub enum ModelPolicyState { Unknown, } +/// How a server-level model list was resolved. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum ModelsListResolutionMode { + /// The runtime applied the supplied pre-session context. + #[serde(rename = "pre-session")] + PreSession, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, +} + +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum ModelsListExecutionEnvironment { + #[serde(rename = "local")] + Local, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, +} + +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum ModelsListModelBackend { + #[serde(rename = "copilot")] + Copilot, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, +} + +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum ModelsListSessionKind { + #[serde(rename = "top-level")] + TopLevel, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, +} + /// Provider transport. Defaults to "http". /// ///
diff --git a/rust/src/generated/rpc.rs b/rust/src/generated/rpc.rs index fae4d7e16..bfb4639ec 100644 --- a/rust/src/generated/rpc.rs +++ b/rust/src/generated/rpc.rs @@ -1070,7 +1070,7 @@ impl<'a> ClientRpcModels<'a> { /// /// # Parameters /// - /// * `params` - Optional GitHub token used to list models for a specific user instead of the global auth context. + /// * `params` - Optional account selection and pre-session context used to list models. /// /// # Returns ///