Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(media): add image generation module with prompt and view types

Steven Enamakelcc1ee6d7d507
diff --git a/crates/openhuman-core/src/media/README.md b/crates/openhuman-core/src/media/README.md
index e0c8bbc2e9..9ffb9628bf 100644
--- a/crates/openhuman-core/src/media/README.md
+++ b/crates/openhuman-core/src/media/README.md
@@ -14,9 +14,6 @@ thing the group tags is the `media_*` tool names (`tool_group()` in
`crates/openhuman-core/src/tools/ops.rs` under `#[cfg(feature = "media")]`.
The builder returns no tools when `integrations::build_client()` yields no
`IntegrationClient` for the config.
-- [`image`](image/README.md), image tool contracts scaffold
- (`image_generation`, `view_image`). Currently unwired (#2997); nothing
- outside `media/image/` references its types.
## Gate
diff --git a/crates/openhuman-core/src/media/image/README.md b/crates/openhuman-core/src/media/image/README.md
deleted file mode 100644
index 74fd01ae65..0000000000
--- a/crates/openhuman-core/src/media/image/README.md
+++ /dev/null
@@ -1,57 +0,0 @@
-# image
-
-High-level contracts for image-capable agent runtimes.
-
-This module does not execute image generation or pixel inspection directly. It
-defines the stable model-facing contracts that provider/runtime adapters can
-expose when image capabilities are available.
-
-Currently unwired (#2997): no tool registers these contracts yet, and nothing
-outside `media/image/` references its types (see the family root
-`media/mod.rs` and the `media` feature comment in
-`crates/openhuman-core/Cargo.toml`).
-
-## Gate
-
-Gated transitively by the `media` feature at
-`crates/openhuman-core/src/lib.rs` (`#[cfg(feature = "media")] pub mod media;`).
-
-## Responsibilities
-
-- Define the `image_generation` contract for hosted raster image creation and
- edits.
-- Define the `view_image` contract for loading local image files into
- model-visible image context.
-- Gate contract exposure by runtime support and local policy:
- - generated image writes
- - local image reads
-- Render concise prompt guidance for agents when image tools are available.
-- Keep schema/serialization contracts covered by focused Rust tests.
-
-## Module Shape
-
-| File | Role |
-| --------------------- | ------------------------------------------------------------------- |
-| `mod.rs` | Re-exports plus the `image_tests.rs` test-module declaration. |
-| `types.rs` | Shared descriptors, permission/config types, and gating helpers. |
-| `image_generation.rs` | `image_generation` schema and output-format contract. |
-| `image_view.rs` | `view_image` schema and detail-level contract. |
-| `prompt.rs` | Agent prompt guidance for enabled image tools. |
-| `image_tests.rs` | Contract-level e2e tests across config, schemas, and prompt output. |
-
-Per-file tests also live alongside their subject: `image_generation_tests.rs`,
-`image_view_tests.rs`, `prompt_tests.rs`.
-
-## Notes
-
-Existing lower-level image helpers remain separate:
-
-- `image_info` reads metadata/base64 text.
-- Browser `snapshot` exposes structured DOM and accessibility content without
- capturing page pixels.
-- Multimodal `[IMAGE:...]` preparation normalizes image references for
- image-capable providers.
-
-Future execution adapters should depend on these contracts and live next to the
-runtime/provider implementation that actually performs the hosted call or model
-attachment.
diff --git a/crates/openhuman-core/src/media/image/image_generation.rs b/crates/openhuman-core/src/media/image/image_generation.rs
deleted file mode 100644
index c3211daeb8..0000000000
--- a/crates/openhuman-core/src/media/image/image_generation.rs
+++ /dev/null
@@ -1,76 +0,0 @@
-//! Contract for the hosted `image_generation` tool.
-//!
-//! The tool is a hosted/provider capability, not a local Rust image renderer.
-//! Runtimes that support it should persist generated bytes under a
-//! session-scoped generated-media root, then return stable file paths in tool
-//! output so final answers can reference concrete artifacts.
-
-use serde::{Deserialize, Serialize};
-use serde_json::json;
-
-use super::{ImagePermission, ImageToolSpec};
-
-/// Stable model-facing tool name.
-pub const IMAGE_GENERATION_TOOL_NAME: &str = "image_generation";
-
-/// Generated image file format requested from the hosted provider.
-#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
-#[serde(rename_all = "snake_case")]
-pub enum ImageGenerationOutputFormat {
- Png,
- Webp,
- Jpeg,
-}
-
-impl ImageGenerationOutputFormat {
- pub fn as_str(self) -> &'static str {
- match self {
- Self::Png => "png",
- Self::Webp => "webp",
- Self::Jpeg => "jpeg",
- }
- }
-}
-
-/// Build the hosted `image_generation` model-facing contract.
-pub fn image_generation_spec(output_format: ImageGenerationOutputFormat) -> ImageToolSpec {
- ImageToolSpec {
- name: IMAGE_GENERATION_TOOL_NAME.to_string(),
- description: "Generate or edit raster images from a prompt and store each result as a local artifact path for the user.".to_string(),
- parameters: json!({
- "type": "object",
- "properties": {
- "prompt": {
- "type": "string",
- "description": "Detailed visual prompt or edit instruction for the hosted image model."
- },
- "output_path": {
- "type": "string",
- "description": "Optional workspace-relative or approved absolute output path. When omitted, the runtime chooses a generated-media path."
- },
- "size": {
- "type": "string",
- "description": "Optional output size such as 1024x1024, 1536x1024, or provider default."
- },
- "input_image_path": {
- "type": "string",
- "description": "Optional local image path to edit. The runtime must validate local-file access before attaching it."
- },
- "output_format": {
- "type": "string",
- "enum": ["png", "webp", "jpeg"],
- "default": output_format.as_str(),
- "description": "Requested persisted file format."
- }
- },
- "required": ["prompt"]
- }),
- permission: ImagePermission::Write,
- model_visible_image_output: false,
- writes_files: true,
- }
-}
-
-#[cfg(test)]
-#[path = "image_generation_tests.rs"]
-mod tests;
diff --git a/crates/openhuman-core/src/media/image/image_generation_tests.rs b/crates/openhuman-core/src/media/image/image_generation_tests.rs
deleted file mode 100644
index 0c2d7cdb1d..0000000000
--- a/crates/openhuman-core/src/media/image/image_generation_tests.rs
+++ /dev/null
@@ -1,55 +0,0 @@
-use super::*;
-
-#[test]
-fn image_generation_schema_declares_output_path_and_format() {
- let spec = image_generation_spec(ImageGenerationOutputFormat::Webp);
-
- assert_eq!(spec.name, "image_generation");
- assert!(spec.description.contains("Generate or edit raster images"));
- assert_eq!(spec.permission, ImagePermission::Write);
- assert!(!spec.model_visible_image_output);
- assert!(spec.writes_files);
- assert_eq!(spec.parameters["required"], serde_json::json!(["prompt"]));
- assert!(spec.parameters["properties"].get("output_path").is_some());
- assert_eq!(
- spec.parameters["properties"]["output_format"]["default"],
- "webp"
- );
-}
-
-#[test]
-fn output_format_serializes_as_snake_case() {
- assert_eq!(ImageGenerationOutputFormat::Png.as_str(), "png");
- assert_eq!(ImageGenerationOutputFormat::Webp.as_str(), "webp");
- assert_eq!(ImageGenerationOutputFormat::Jpeg.as_str(), "jpeg");
-
- assert_eq!(
- serde_json::to_value(ImageGenerationOutputFormat::Webp).unwrap(),
- serde_json::json!("webp")
- );
- assert_eq!(
- serde_json::from_value::<ImageGenerationOutputFormat>(serde_json::json!("jpeg")).unwrap(),
- ImageGenerationOutputFormat::Jpeg
- );
-}
-
-#[test]
-fn image_generation_schema_keeps_edit_and_size_inputs_optional() {
- let spec = image_generation_spec(ImageGenerationOutputFormat::Png);
- let properties = spec.parameters["properties"].as_object().unwrap();
-
- assert_eq!(
- properties.keys().cloned().collect::<Vec<_>>(),
- vec![
- "input_image_path".to_string(),
- "output_format".to_string(),
- "output_path".to_string(),
- "prompt".to_string(),
- "size".to_string()
- ]
- );
- assert_eq!(
- properties["output_format"]["enum"],
- serde_json::json!(["png", "webp", "jpeg"])
- );
-}
diff --git a/crates/openhuman-core/src/media/image/image_tests.rs b/crates/openhuman-core/src/media/image/image_tests.rs
deleted file mode 100644
index f80dcc2ef7..0000000000
--- a/crates/openhuman-core/src/media/image/image_tests.rs
+++ /dev/null
@@ -1,120 +0,0 @@
-use super::*;
-
-#[test]
-fn image_specs_gate_each_tool_independently() {
- let config = ImageToolConfig {
- image_generation_enabled: true,
- image_view_enabled: true,
- local_image_reads_allowed: false,
- generated_image_writes_allowed: true,
- ..ImageToolConfig::default()
- };
-
- let specs = image_specs(&config);
-
- assert_eq!(specs.len(), 1);
- assert_eq!(specs[0].name, IMAGE_GENERATION_TOOL_NAME);
- assert!(!is_image_tool_gated(IMAGE_GENERATION_TOOL_NAME, &config));
- assert!(is_image_tool_gated(IMAGE_VIEW_TOOL_NAME, &config));
-}
-
-#[test]
-fn image_specs_hide_generation_when_writes_are_blocked() {
- let config = ImageToolConfig {
- image_generation_enabled: true,
- image_view_enabled: true,
- local_image_reads_allowed: true,
- generated_image_writes_allowed: false,
- ..ImageToolConfig::default()
- };
-
- let specs = image_specs(&config);
-
- assert_eq!(specs.len(), 1);
- assert_eq!(specs[0].name, IMAGE_VIEW_TOOL_NAME);
- assert!(is_image_tool_gated(IMAGE_GENERATION_TOOL_NAME, &config));
- assert!(!is_image_tool_gated(IMAGE_VIEW_TOOL_NAME, &config));
-}
-
-#[test]
-fn image_specs_are_empty_when_runtime_support_is_disabled() {
- let config = ImageToolConfig {
- local_image_reads_allowed: true,
- generated_image_writes_allowed: true,
- ..ImageToolConfig::default()
- };
-
- assert!(image_specs(&config).is_empty());
- assert!(is_image_tool_gated("unknown_tool", &config));
-}
-
-#[test]
-fn image_e2e_contract_renders_specs_and_prompt_guidance() {
- let config = ImageToolConfig {
- image_generation_enabled: true,
- image_view_enabled: true,
- image_generation_output_format: ImageGenerationOutputFormat::Jpeg,
- local_image_reads_allowed: true,
- generated_image_writes_allowed: true,
- };
-
- let specs = image_specs(&config);
- let names = specs
- .iter()
- .map(|spec| spec.name.as_str())
- .collect::<Vec<_>>();
- let prompt = render_image_prompt_guidance(&config, &ImagePromptOptions::default());
-
- assert_eq!(
- names,
- vec![IMAGE_GENERATION_TOOL_NAME, IMAGE_VIEW_TOOL_NAME]
- );
- assert_eq!(
- specs[0].parameters["properties"]["output_format"]["default"],
- "jpeg"
- );
- assert_eq!(
- specs[1].parameters["properties"]["detail"]["default"],
- "auto"
- );
- assert!(prompt.contains("## Image Tools"));
- assert!(prompt.contains(IMAGE_GENERATION_TOOL_NAME));
- assert!(prompt.contains(IMAGE_VIEW_TOOL_NAME));
-}
-
-#[test]
-fn known_image_tool_names_stay_stable() {
- assert_eq!(
- IMAGE_TOOL_NAMES,
- [IMAGE_GENERATION_TOOL_NAME, IMAGE_VIEW_TOOL_NAME]
- );
-}
-
-#[test]
-fn image_spec_serializes_for_schema_catalogs() {
- let spec = image_generation_spec(ImageGenerationOutputFormat::Png);
- let encoded = serde_json::to_value(&spec).unwrap();
-
- assert_eq!(encoded["name"], IMAGE_GENERATION_TOOL_NAME);
- assert_eq!(encoded["permission"], "write");
- assert_eq!(encoded["writes_files"], true);
- assert_eq!(encoded["model_visible_image_output"], false);
-
- let decoded: ImageToolSpec = serde_json::from_value(encoded).unwrap();
- assert_eq!(decoded, spec);
-}
-
-#[test]
-fn image_config_default_is_closed_by_capability() {
- let config = ImageToolConfig::default();
-
- assert!(!config.image_generation_enabled);
- assert!(!config.image_view_enabled);
- assert_eq!(
- config.image_generation_output_format,
- ImageGenerationOutputFormat::Png
- );
- assert!(config.local_image_reads_allowed);
- assert!(config.generated_image_writes_allowed);
- assert!(image_specs(&config).is_empty());
-}
diff --git a/crates/openhuman-core/src/media/image/image_view.rs b/crates/openhuman-core/src/media/image/image_view.rs
deleted file mode 100644
index 90644280c8..0000000000
--- a/crates/openhuman-core/src/media/image/image_view.rs
+++ /dev/null
@@ -1,63 +0,0 @@
-//! Contract for the hosted `view_image` tool.
-//!
-//! `view_image` bridges local image files into model-visible image content. It
-//! is distinct from `image_info`: metadata extraction can stay textual, while
-//! `view_image` asks the runtime to load pixels into the conversation context.
-
-use serde::{Deserialize, Serialize};
-use serde_json::json;
-
-use super::{ImagePermission, ImageToolSpec};
-
-/// Stable model-facing tool name.
-pub const IMAGE_VIEW_TOOL_NAME: &str = "view_image";
-
-/// Requested image-detail level for model-visible inspection.
-#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
-#[serde(rename_all = "snake_case")]
-pub enum ImageDetail {
- Auto,
- High,
- Original,
-}
-
-impl ImageDetail {
- pub fn as_str(self) -> &'static str {
- match self {
- Self::Auto => "auto",
- Self::High => "high",
- Self::Original => "original",
- }
- }
-}
-
-/// Build the hosted `view_image` model-facing contract.
-pub fn image_view_spec() -> ImageToolSpec {
- ImageToolSpec {
- name: IMAGE_VIEW_TOOL_NAME.to_string(),
- description: "Load a local image file into model-visible image context for inspection, OCR, UI review, or visual reasoning.".to_string(),
- parameters: json!({
- "type": "object",
- "properties": {
- "path": {
- "type": "string",
- "description": "Local image path, absolute or relative to the approved workspace."
- },
- "detail": {
- "type": "string",
- "enum": ["auto", "high", "original"],
- "default": ImageDetail::Auto.as_str(),
- "description": "Inspection detail. Use original only when full resolution is necessary."
- }
- },
- "required": ["path"]
- }),
- permission: ImagePermission::ReadOnly,
- model_visible_image_output: true,
- writes_files: false,
- }
-}
-
-#[cfg(test)]
-#[path = "image_view_tests.rs"]
-mod tests;
diff --git a/crates/openhuman-core/src/media/image/image_view_tests.rs b/crates/openhuman-core/src/media/image/image_view_tests.rs
deleted file mode 100644
index 12684b889e..0000000000
--- a/crates/openhuman-core/src/media/image/image_view_tests.rs
+++ /dev/null
@@ -1,41 +0,0 @@
-use super::*;
-
-#[test]
-fn view_image_schema_requires_path_and_marks_model_visible_output() {
- let spec = image_view_spec();
-
- assert_eq!(spec.name, "view_image");
- assert!(spec.description.contains("model-visible image context"));
- assert_eq!(spec.permission, ImagePermission::ReadOnly);
- assert!(spec.model_visible_image_output);
- assert!(!spec.writes_files);
- assert_eq!(spec.parameters["required"], serde_json::json!(["path"]));
- assert_eq!(spec.parameters["properties"]["detail"]["default"], "auto");
-}
-
-#[test]
-fn detail_names_match_prompt_contract() {
- assert_eq!(ImageDetail::Auto.as_str(), "auto");
- assert_eq!(ImageDetail::High.as_str(), "high");
- assert_eq!(ImageDetail::Original.as_str(), "original");
-
- assert_eq!(
- serde_json::to_value(ImageDetail::Original).unwrap(),
- serde_json::json!("original")
- );
- assert_eq!(
- serde_json::from_value::<ImageDetail>(serde_json::json!("high")).unwrap(),
- ImageDetail::High
- );
-}
-
-#[test]
-fn view_image_schema_lists_supported_detail_levels() {
- let spec = image_view_spec();
-
- assert_eq!(
- spec.parameters["properties"]["detail"]["enum"],
- serde_json::json!(["auto", "high", "original"])
- );
- assert_eq!(spec.parameters["properties"]["path"]["type"], "string");
-}
diff --git a/crates/openhuman-core/src/media/image/mod.rs b/crates/openhuman-core/src/media/image/mod.rs
deleted file mode 100644
index 0117ce40bf..0000000000
--- a/crates/openhuman-core/src/media/image/mod.rs
+++ /dev/null
@@ -1,37 +0,0 @@
-//! Image-tool contracts for model-facing agents.
-//!
-//! This module is intentionally a high-level contract layer. OpenHuman already
-//! has lower-level image helpers (`image_info`, local image viewing, and
-//! multimodal `[IMAGE:...]` normalization). The image layer defines the
-//! stable tool names, schema, gating, and prompt guidance that agents should see
-//! when a runtime can provide Codex-like media tools.
-//!
-//! The two first-class contracts are:
-//!
-//! - [`image_generation`] — create or edit raster images and return stored file
-//! references.
-//! - [`image_view`] — attach a local image file as model-visible image content
-//! so the agent can inspect it.
-//!
-//! Keeping this contract separate from execution lets provider runtimes adopt
-//! the surface incrementally without duplicating business logic in the tools
-//! registry.
-
-pub mod image_generation;
-pub mod image_view;
-pub mod prompt;
-pub mod types;
-
-pub use image_generation::{
- image_generation_spec, ImageGenerationOutputFormat, IMAGE_GENERATION_TOOL_NAME,
-};
-pub use image_view::{image_view_spec, ImageDetail, IMAGE_VIEW_TOOL_NAME};
-pub use prompt::{render_image_prompt_guidance, ImagePromptOptions};
-pub use types::{
- image_specs, is_image_tool_gated, ImagePermission, ImageToolConfig, ImageToolSpec,
- IMAGE_TOOL_NAMES,
-};
-
-#[cfg(test)]
-#[path = "image_tests.rs"]
-mod tests;
diff --git a/crates/openhuman-core/src/media/image/prompt.rs b/crates/openhuman-core/src/media/image/prompt.rs
deleted file mode 100644
index 237fd859d0..0000000000
--- a/crates/openhuman-core/src/media/image/prompt.rs
+++ /dev/null
@@ -1,65 +0,0 @@
-//! Prompt guidance for image tools.
-
-use super::{ImageToolConfig, IMAGE_GENERATION_TOOL_NAME, IMAGE_VIEW_TOOL_NAME};
-
-/// Rendering options for image prompt guidance.
-#[derive(Debug, Clone, PartialEq, Eq)]
-pub struct ImagePromptOptions {
- /// Include final-answer artifact-reference guidance for generated images.
- pub include_final_answer_rules: bool,
- /// Include local-file privacy boundaries for viewed images.
- pub include_local_file_boundaries: bool,
-}
-
-impl Default for ImagePromptOptions {
- fn default() -> Self {
- Self {
- include_final_answer_rules: true,
- include_local_file_boundaries: true,
- }
- }
-}
-
-/// Render concise model guidance for enabled image tools.
-pub fn render_image_prompt_guidance(
- config: &ImageToolConfig,
- options: &ImagePromptOptions,
-) -> String {
- let image_generation_available =
- config.image_generation_enabled && config.generated_image_writes_allowed;
- let image_view_available = config.image_view_enabled && config.local_image_reads_allowed;
-
- if !image_generation_available && !image_view_available {
- return String::new();
- }
-
- let mut out = String::from("## Image Tools\n\n");
-
- if image_view_available {
- out.push_str(&format!(
- "- Use `{IMAGE_VIEW_TOOL_NAME}` when image pixels are needed for UI review, OCR, chart inspection, visual comparison, or understanding a local screenshot.\n"
- ));
- if options.include_local_file_boundaries {
- out.push_str(
- "- Only view local images that are in the approved workspace, were created during this session, or were explicitly referenced by the user or trusted tool output.\n",
- );
- }
- }
-
- if image_generation_available {
- out.push_str(&format!(
- "- Use `{IMAGE_GENERATION_TOOL_NAME}` for requested raster image creation or image edits; provide a specific prompt and an output path when the destination matters.\n"
- ));
- if options.include_final_answer_rules {
- out.push_str(
- "- After generating images, mention the saved artifact path in the final answer so the user can find it.\n",
- );
- }
- }
-
- out.trim_end().to_string()
-}
-
-#[cfg(test)]
-#[path = "prompt_tests.rs"]
-mod tests;
diff --git a/crates/openhuman-core/src/media/image/prompt_tests.rs b/crates/openhuman-core/src/media/image/prompt_tests.rs
deleted file mode 100644
index bfa08d6527..0000000000
--- a/crates/openhuman-core/src/media/image/prompt_tests.rs
+++ /dev/null
@@ -1,92 +0,0 @@
-use super::*;
-use crate::media::image::ImageGenerationOutputFormat;
-
-#[test]
-fn prompt_guidance_is_empty_when_no_image_tools_are_enabled() {
- let rendered =
- render_image_prompt_guidance(&ImageToolConfig::default(), &ImagePromptOptions::default());
-
- assert!(rendered.is_empty());
-}
-
-#[test]
-fn prompt_guidance_renders_image_generation_and_view_rules() {
- let config = ImageToolConfig {
- image_generation_enabled: true,
- image_view_enabled: true,
- image_generation_output_format: ImageGenerationOutputFormat::Png,
- local_image_reads_allowed: true,
- generated_image_writes_allowed: true,
- };
-
- let rendered = render_image_prompt_guidance(&config, &ImagePromptOptions::default());
-
- assert!(rendered.contains("## Image Tools"));
- assert!(rendered.contains("`view_image`"));
- assert!(rendered.contains("`image_generation`"));
- assert!(rendered.contains("saved artifact path"));
-}
-
-#[test]
-fn prompt_guidance_can_omit_optional_rule_text() {
- let config = ImageToolConfig {
- image_generation_enabled: true,
- image_view_enabled: true,
- image_generation_output_format: ImageGenerationOutputFormat::Png,
- local_image_reads_allowed: true,
- generated_image_writes_allowed: true,
- };
- let options = ImagePromptOptions {
- include_final_answer_rules: false,
- include_local_file_boundaries: false,
- };
-
- let rendered = render_image_prompt_guidance(&config, &options);
-
- assert!(rendered.contains("`view_image`"));
- assert!(rendered.contains("`image_generation`"));
- assert!(!rendered.contains("approved workspace"));
- assert!(!rendered.contains("saved artifact path"));
-}
-
-#[test]
-fn prompt_guidance_respects_policy_gates() {
- let config = ImageToolConfig {
- image_generation_enabled: true,
- image_view_enabled: true,
- image_generation_output_format: ImageGenerationOutputFormat::Png,
- local_image_reads_allowed: false,
- generated_image_writes_allowed: false,
- };
-
- let rendered = render_image_prompt_guidance(&config, &ImagePromptOptions::default());
-
- assert!(rendered.is_empty());
-}
-
-#[test]
-fn prompt_guidance_renders_single_available_tool() {
- let generation_only = ImageToolConfig {
- image_generation_enabled: true,
- image_view_enabled: false,
- image_generation_output_format: ImageGenerationOutputFormat::Png,
- local_image_reads_allowed: true,
- generated_image_writes_allowed: true,
- };
- let view_only = ImageToolConfig {
- image_generation_enabled: false,
- image_view_enabled: true,
- image_generation_output_format: ImageGenerationOutputFormat::Png,
- local_image_reads_allowed: true,
- generated_image_writes_allowed: true,
- };
-
- let generation_rendered =
- render_image_prompt_guidance(&generation_only, &ImagePromptOptions::default());
- let view_rendered = render_image_prompt_guidance(&view_only, &ImagePromptOptions::default());
-
- assert!(generation_rendered.contains("`image_generation`"));
- assert!(!generation_rendered.contains("`view_image`"));
- assert!(view_rendered.contains("`view_image`"));
- assert!(!view_rendered.contains("`image_generation`"));
-}
diff --git a/crates/openhuman-core/src/media/image/types.rs b/crates/openhuman-core/src/media/image/types.rs
deleted file mode 100644
index 77e647ea96..0000000000
--- a/crates/openhuman-core/src/media/image/types.rs
+++ /dev/null
@@ -1,87 +0,0 @@
-use serde::{Deserialize, Serialize};
-use serde_json::Value;
-
-use super::{
- image_generation_spec, image_view_spec, ImageGenerationOutputFormat,
- IMAGE_GENERATION_TOOL_NAME, IMAGE_VIEW_TOOL_NAME,
-};
-
-/// Model-facing image tool names used for filtering and policy decisions.
-pub const IMAGE_TOOL_NAMES: [&str; 2] = [IMAGE_GENERATION_TOOL_NAME, IMAGE_VIEW_TOOL_NAME];
-
-/// A provider/runtime independent image tool descriptor.
-#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
-pub struct ImageToolSpec {
- /// Stable model-facing tool name.
- pub name: String,
- /// Concise tool description injected into prompt/tool catalogues.
- pub description: String,
- /// JSON Schema object for tool arguments.
- pub parameters: Value,
- /// Execution permission required by OpenHuman policy gates.
- pub permission: ImagePermission,
- /// Whether the tool payload is expected to become model-visible image
- /// content rather than plain text.
- pub model_visible_image_output: bool,
- /// Whether execution writes files into an output directory.
- pub writes_files: bool,
-}
-
-/// Permission class for image tools.
-#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
-#[serde(rename_all = "snake_case")]
-pub enum ImagePermission {
- /// Metadata or read-only local inspection.
- ReadOnly,
- /// Creates or edits generated media files.
- Write,
-}
-
-/// Session/runtime switches that decide which image tools are exposed.
-#[derive(Debug, Clone, PartialEq, Eq)]
-pub struct ImageToolConfig {
- /// Runtime supports hosted image generation.
- pub image_generation_enabled: bool,
- /// Runtime supports local image attachment/viewing.
- pub image_view_enabled: bool,
- /// Desired output format for generated images.
- pub image_generation_output_format: ImageGenerationOutputFormat,
- /// Whether the current filesystem policy allows workspace image reads.
- pub local_image_reads_allowed: bool,
- /// Whether generated files may be written under the configured output root.
- pub generated_image_writes_allowed: bool,
-}
-
-impl Default for ImageToolConfig {
- fn default() -> Self {
- Self {
- image_generation_enabled: false,
- image_view_enabled: false,
- image_generation_output_format: ImageGenerationOutputFormat::Png,
- local_image_reads_allowed: true,
- generated_image_writes_allowed: true,
- }
- }
-}
-
-/// Build the image specs visible to an agent for this runtime.
-pub fn image_specs(config: &ImageToolConfig) -> Vec<ImageToolSpec> {
- let mut specs = Vec::new();
-
- if config.image_generation_enabled && config.generated_image_writes_allowed {
- specs.push(image_generation_spec(config.image_generation_output_format));
- }
-
- if config.image_view_enabled && config.local_image_reads_allowed {
- specs.push(image_view_spec());
- }
-
- specs
-}
-
-/// Return true when an image tool should be hidden from a session.
-pub fn is_image_tool_gated(tool_name: &str, config: &ImageToolConfig) -> bool {
- !image_specs(config)
- .iter()
- .any(|spec| spec.name == tool_name)
-}
diff --git a/crates/openhuman-core/src/media/mod.rs b/crates/openhuman-core/src/media/mod.rs
index e630d6fd39..40d258ef3b 100644
--- a/crates/openhuman-core/src/media/mod.rs
+++ b/crates/openhuman-core/src/media/mod.rs
@@ -1,15 +1,12 @@
-//! Media generation and image tool contracts.
+//! Media generation.
//!
//! - [`generation`] — the `media_generate_*` agent tools (image/video via GMI,
//! proxied through the TinyHumans backend)
-//! - [`image`] — image tool contracts scaffold (currently unwired, #2997)
//!
//! Gated by the `media` feature at the family root (`pub mod media;` in
-//! `crates/openhuman-core/src/lib.rs`), because both children are wholly gated. It is a
-//! **surface-only** gate: media generation is backend-proxied over the shared
-//! `IntegrationClient`/`reqwest`, and [`image`] is a dependency-free contract
-//! layer, so no exclusive dependency is shed. No controller/store/subscriber is
+//! `crates/openhuman-core/src/lib.rs`). It is a **surface-only** gate: media
+//! generation is backend-proxied over the shared `IntegrationClient`/`reqwest`,
+//! so no exclusive dependency is shed. No controller/store/subscriber is
//! tagged `DomainGroup::Media` — this family is agent-tools-only.
pub mod generation;
-pub mod image;