[mcp] Add InputItem type

This commit is contained in:
Dylan Hurd
2025-08-20 23:46:20 -07:00
parent dc42ec0eb4
commit 7e0056fbdf
4 changed files with 25 additions and 0 deletions

View File

@@ -183,6 +183,9 @@ impl From<Vec<InputItem>> for ResponseInputItem {
None
}
},
InputItem::FileReference { name, path } => Some(ContentItem::InputText {
text: format!("[{name}]({})", path.to_string_lossy()),
}),
_ => None,
})
.collect::<Vec<ContentItem>>(),

View File

@@ -417,6 +417,9 @@ impl CodexMessageProcessor {
WireInputItem::Text { text } => CoreInputItem::Text { text },
WireInputItem::Image { image_url } => CoreInputItem::Image { image_url },
WireInputItem::LocalImage { path } => CoreInputItem::LocalImage { path },
WireInputItem::FileReference { name, path } => {
CoreInputItem::FileReference { name, path }
}
})
.collect();
@@ -465,6 +468,9 @@ impl CodexMessageProcessor {
WireInputItem::Text { text } => CoreInputItem::Text { text },
WireInputItem::Image { image_url } => CoreInputItem::Image { image_url },
WireInputItem::LocalImage { path } => CoreInputItem::LocalImage { path },
WireInputItem::FileReference { name, path } => {
CoreInputItem::FileReference { name, path }
}
})
.collect();

View File

@@ -292,6 +292,14 @@ pub enum InputItem {
LocalImage {
path: PathBuf,
},
/// A reference to a file in the user's workspace.
FileReference {
/// The name of the file
name: String,
/// The relative path to the file in the user's workspace.
path: PathBuf,
},
}
// TODO(mbolin): Need test to ensure these constants match the enum variants.

View File

@@ -376,6 +376,14 @@ pub enum InputItem {
LocalImage {
path: std::path::PathBuf,
},
/// A reference to a file in the user's workspace.
FileReference {
/// The name of the file
name: String,
/// The relative path to the file in the user's workspace.
path: PathBuf,
},
}
/// Event Queue Entry - events from agent