Add opt-in deferred image generation in code mode (#63594)

## What changed

Add `features.defer_image_generation` so code mode can discover the image
generation tool through `ALL_TOOLS` without including its definition in
the initial model request. Direct exposure remains the default and
applies when `image_gen` is excluded from code mode.

## Testing

Update the app-server GIF edit test to discover and invoke the deferred
tool through code mode. Verify that the initial request omits the tool
definition, the discovered definition includes the GIF option, and the
edit preserves animation and API defaults.

GitOrigin-RevId: 899f689bae0b86099a0ca3736d1cd2576bc3a7a9
This commit is contained in:
verma-oai
2026-11-24 09:52:16 +00:00
committed by copyberry
parent d4b84f9bb0
commit 37aeac06b3
5 changed files with 49 additions and 10 deletions
+12
View File
@@ -416,6 +416,8 @@ pub enum Feature {
ExternalMigration,
/// Enable extension-backed image generation.
ImageGeneration,
/// Load the image generation tool definition on demand in code mode.
DeferImageGeneration,
/// Allow the image-generation tool to request a backend-assembled GIF.
ImageGenerationAnimation,
/// Omit inline image and audio content from app-server item notifications.
@@ -684,6 +686,10 @@ impl Features {
self.enabled.contains(&f)
}
pub fn defer_image_generation_enabled(&self) -> bool {
self.enabled(Feature::DeferImageGeneration)
}
/// Whether to advertise GIF output in the image-generation tool.
pub fn image_generation_animation_enabled(&self) -> bool {
self.enabled(Feature::ImageGenerationAnimation)
@@ -2130,6 +2136,12 @@ pub const FEATURES: &[FeatureSpec] = &[
stage: Stage::Stable,
default_enabled: true,
},
FeatureSpec {
id: Feature::DeferImageGeneration,
key: "defer_image_generation",
stage: Stage::UnderDevelopment,
default_enabled: false,
},
FeatureSpec {
id: Feature::ImageGenerationAnimation,
key: "image_generation_animation",