mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Add hooks/list app-server RPC (#19778)
## Why We need a way to list the available hooks to expose via the TUI and App so users can view and manage their hooks ## What - Adds `hooks/list` for one or more `cwd` values that returns discovered hook metadata ## Stack 1. openai/codex#19705 2. This PR - openai/codex#19778 3. openai/codex#19840 4. openai/codex#19882 ## Review Notes The generated schema files account for most of the raw diff, these files have the core change: - `hooks/src/engine/discovery.rs` builds the inventory entries during hook discovery while leaving runtime handlers focused on execution. - `app-server/src/codex_message_processor.rs` wires `hooks/list` into the app-server flow for each requested `cwd`. - `app-server-protocol/src/protocol/v2.rs` defines the new v2 request/response payloads exposed on the wire. ### Core Changes `core/src/plugins/manager.rs` adds `plugins_for_layer_stack(...)` so `skills/list` and `hooks/list`can resolve plugin state for each requested `cwd` --------- Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
1 parent
6eab7519b4
commit
8774229a89
28 files changed
+1405
-193
No files matched your search
@@ -4,6 +4,7 @@ use tokio::process::Command;
|
||||
|
||||
use crate::engine::ClaudeHooksEngine;
|
||||
use crate::engine::CommandShell;
|
||||
use crate::engine::HookListEntry;
|
||||
use crate::events::permission_request::PermissionRequestOutcome;
|
||||
use crate::events::permission_request::PermissionRequestRequest;
|
||||
use crate::events::post_tool_use::PostToolUseOutcome;
|
||||
@@ -32,6 +33,12 @@ pub struct HooksConfig {
|
||||
pub shell_args: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, PartialEq, Eq)]
|
||||
pub struct HookListOutcome {
|
||||
pub hooks: Vec<HookListEntry>,
|
||||
pub warnings: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Hooks {
|
||||
after_agent: Vec<Hook>,
|
||||
@@ -173,6 +180,22 @@ impl Hooks {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn list_hooks(config: HooksConfig) -> HookListOutcome {
|
||||
if !config.feature_enabled {
|
||||
return HookListOutcome::default();
|
||||
}
|
||||
|
||||
let discovered = crate::engine::discovery::discover_handlers(
|
||||
config.config_layer_stack.as_ref(),
|
||||
config.plugin_hook_sources,
|
||||
config.plugin_hook_load_warnings,
|
||||
);
|
||||
HookListOutcome {
|
||||
hooks: discovered.hook_entries,
|
||||
warnings: discovered.warnings,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn command_from_argv(argv: &[String]) -> Option<Command> {
|
||||
let (program, args) = argv.split_first()?;
|
||||
if program.is_empty() {
|
||||
|
||||
Reference in new issue
Block a user