Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions codex-rs/app-server-protocol/schema/json/v2/HooksListResponse.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 13 additions & 1 deletion codex-rs/app-server-protocol/src/protocol/v2/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,19 @@ pub enum ConfiguredHookHandler {
},
#[serde(rename = "prompt")]
#[ts(rename = "prompt")]
Prompt {},
Prompt {
prompt: String,
model: Option<String>,
#[serde(rename = "timeoutSec")]
#[ts(rename = "timeoutSec")]
timeout_sec: Option<u64>,
#[serde(rename = "statusMessage")]
#[ts(rename = "statusMessage")]
status_message: Option<String>,
#[serde(rename = "continueOnBlock")]
#[ts(rename = "continueOnBlock")]
continue_on_block: bool,
},
#[serde(rename = "agent")]
#[ts(rename = "agent")]
Agent {},
Expand Down
3 changes: 3 additions & 0 deletions codex-rs/app-server-protocol/src/protocol/v2/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,9 @@ pub struct HookMetadata {
pub handler_type: HookHandlerType,
pub matcher: Option<String>,
pub command: Option<String>,
pub prompt: Option<String>,
pub model: Option<String>,
pub continue_on_block: Option<bool>,
pub timeout_sec: u64,
pub status_message: Option<String>,
pub source_path: AbsolutePathBuf,
Expand Down
3 changes: 3 additions & 0 deletions codex-rs/app-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1724,6 +1724,8 @@ Hooks are returned even when disabled so clients can render and re-enable them.

For unmanaged hooks, `currentHash` and `trustStatus` describe whether the current definition is first-seen, approved, or changed since approval. Only trusted unmanaged hooks become runnable. Hook keys combine the source identity with a trailing event/group/handler selector that is currently positional.

Command hooks expose their definition in `command`, while prompt hooks expose it in `prompt`. The unused field is `null`.

```json
{
"method": "hooks/list",
Expand All @@ -1747,6 +1749,7 @@ For unmanaged hooks, `currentHash` and `trustStatus` describe whether the curren
"isManaged": false,
"matcher": "Bash",
"command": "python3 /Users/me/hook.py",
"prompt": null,
"timeoutSec": 5,
"statusMessage": "running hook",
"sourcePath": "/Users/me/.codex/config.toml",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ fn hooks_to_info(hooks: &[codex_hooks::HookListEntry]) -> Vec<HookMetadata> {
handler_type: hook.handler_type.into(),
matcher: hook.matcher.clone(),
command: hook.command.clone(),
prompt: hook.prompt.clone(),
model: hook.model.clone(),
continue_on_block: hook.continue_on_block,
timeout_sec: hook.timeout_sec,
status_message: hook.status_message.clone(),
source_path: hook.source_path.clone(),
Expand Down
14 changes: 13 additions & 1 deletion codex-rs/app-server/src/request_processors/config_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,19 @@ fn map_hook_handler_to_api(handler: CoreHookHandlerConfig) -> ConfiguredHookHand
r#async,
status_message,
},
CoreHookHandlerConfig::Prompt { .. } => ConfiguredHookHandler::Prompt {},
CoreHookHandlerConfig::Prompt {
prompt,
model,
timeout_sec,
status_message,
continue_on_block,
} => ConfiguredHookHandler::Prompt {
prompt,
model,
timeout_sec,
status_message,
continue_on_block,
},
CoreHookHandlerConfig::Agent {} => ConfiguredHookHandler::Agent {},
}
}
Expand Down
Loading
Loading