mirror of
https://github.com/openai/codex.git
synced 2026-09-13 11:47:17 +00:00
[mcp] Add InputItem type
This commit is contained in:
@@ -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>>(),
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user