diff --git a/codex-rs/hooks/src/schema.rs b/codex-rs/hooks/src/schema.rs index 43fb664deb..9375fd81dd 100644 --- a/codex-rs/hooks/src/schema.rs +++ b/codex-rs/hooks/src/schema.rs @@ -10,7 +10,6 @@ use serde::Serialize; use serde_json::Map; use serde_json::Value; use std::path::Path; -use std::path::PathBuf; const GENERATED_DIR: &str = "generated"; const SESSION_START_INPUT_FIXTURE: &str = "session-start.command.input.schema.json"; @@ -22,16 +21,6 @@ const STOP_OUTPUT_FIXTURE: &str = "stop.command.output.schema.json"; #[serde(transparent)] pub(crate) struct NullableString(Option); -impl NullableString { - fn from_path(path: Option) -> Self { - Self(path.map(|path| path.display().to_string())) - } - - fn from_string(value: Option) -> Self { - Self(value) - } -} - impl JsonSchema for NullableString { fn schema_name() -> String { "NullableString".to_string() @@ -122,27 +111,6 @@ pub(crate) struct SessionStartCommandInput { pub source: String, } -impl SessionStartCommandInput { - pub(crate) fn new( - session_id: impl Into, - transcript_path: Option, - cwd: impl Into, - model: impl Into, - permission_mode: impl Into, - source: impl Into, - ) -> Self { - Self { - session_id: session_id.into(), - transcript_path: NullableString::from_path(transcript_path), - cwd: cwd.into(), - hook_event_name: "SessionStart".to_string(), - model: model.into(), - permission_mode: permission_mode.into(), - source: source.into(), - } - } -} - #[derive(Debug, Clone, Serialize, JsonSchema)] #[serde(deny_unknown_fields)] #[schemars(rename = "stop.command.input")] @@ -159,29 +127,6 @@ pub(crate) struct StopCommandInput { pub last_assistant_message: NullableString, } -impl StopCommandInput { - pub(crate) fn new( - session_id: impl Into, - transcript_path: Option, - cwd: impl Into, - model: impl Into, - permission_mode: impl Into, - stop_hook_active: bool, - last_assistant_message: Option, - ) -> Self { - Self { - session_id: session_id.into(), - transcript_path: NullableString::from_path(transcript_path), - cwd: cwd.into(), - hook_event_name: "Stop".to_string(), - model: model.into(), - permission_mode: permission_mode.into(), - stop_hook_active, - last_assistant_message: NullableString::from_string(last_assistant_message), - } - } -} - pub fn write_schema_fixtures(schema_root: &Path) -> anyhow::Result<()> { let generated_dir = schema_root.join(GENERATED_DIR); ensure_empty_dir(&generated_dir)?;