mirror of
https://github.com/openai/codex.git
synced 2026-10-20 17:38:45 +00:00
Include plugin IDs in hook run summaries
This commit is contained in:
@@ -1945,6 +1945,12 @@
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"pluginId": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"scope": {
|
||||
"$ref": "#/definitions/HookScope"
|
||||
},
|
||||
|
||||
+6
@@ -10286,6 +10286,12 @@
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"pluginId": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"scope": {
|
||||
"$ref": "#/definitions/v2/HookScope"
|
||||
},
|
||||
|
||||
+6
@@ -6739,6 +6739,12 @@
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"pluginId": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"scope": {
|
||||
"$ref": "#/definitions/HookScope"
|
||||
},
|
||||
|
||||
@@ -108,6 +108,12 @@
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"pluginId": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"scope": {
|
||||
"$ref": "#/definitions/HookScope"
|
||||
},
|
||||
|
||||
@@ -108,6 +108,12 @@
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"pluginId": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"scope": {
|
||||
"$ref": "#/definitions/HookScope"
|
||||
},
|
||||
|
||||
@@ -10,4 +10,4 @@ import type { HookRunStatus } from "./HookRunStatus";
|
||||
import type { HookScope } from "./HookScope";
|
||||
import type { HookSource } from "./HookSource";
|
||||
|
||||
export type HookRunSummary = { id: string, eventName: HookEventName, handlerType: HookHandlerType, executionMode: HookExecutionMode, scope: HookScope, sourcePath: AbsolutePathBuf, source: HookSource, displayOrder: bigint, status: HookRunStatus, statusMessage: string | null, startedAt: bigint, completedAt: bigint | null, durationMs: bigint | null, entries: Array<HookOutputEntry>, };
|
||||
export type HookRunSummary = { id: string, eventName: HookEventName, handlerType: HookHandlerType, executionMode: HookExecutionMode, scope: HookScope, sourcePath: AbsolutePathBuf, source: HookSource, pluginId: string | null, displayOrder: bigint, status: HookRunStatus, statusMessage: string | null, startedAt: bigint, completedAt: bigint | null, durationMs: bigint | null, entries: Array<HookOutputEntry>, };
|
||||
|
||||
@@ -106,6 +106,7 @@ pub struct HookRunSummary {
|
||||
pub source_path: AbsolutePathBuf,
|
||||
#[serde(default = "default_hook_source")]
|
||||
pub source: HookSource,
|
||||
pub plugin_id: Option<String>,
|
||||
pub display_order: i64,
|
||||
pub status: HookRunStatus,
|
||||
pub status_message: Option<String>,
|
||||
@@ -125,6 +126,7 @@ impl From<CoreHookRunSummary> for HookRunSummary {
|
||||
scope: value.scope.into(),
|
||||
source_path: value.source_path,
|
||||
source: value.source.into(),
|
||||
plugin_id: value.plugin_id,
|
||||
display_order: value.display_order,
|
||||
status: value.status.into(),
|
||||
status_message: value.status_message,
|
||||
|
||||
@@ -1596,6 +1596,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.
|
||||
|
||||
The `hook/started` and `hook/completed` notifications include `pluginId` when the run came from a plugin hook.
|
||||
|
||||
```json
|
||||
{
|
||||
"method": "hooks/list",
|
||||
|
||||
@@ -901,6 +901,7 @@ mod tests {
|
||||
scope: HookScope::Turn,
|
||||
source_path: test_path_buf("/tmp/hooks.json").abs(),
|
||||
source,
|
||||
plugin_id: None,
|
||||
display_order: 0,
|
||||
status,
|
||||
status_message: None,
|
||||
|
||||
@@ -532,6 +532,7 @@ fn append_matcher_groups(
|
||||
status_message,
|
||||
source_path: source.path.clone(),
|
||||
source: source.source,
|
||||
plugin_id: source.plugin_id.clone(),
|
||||
display_order: *display_order,
|
||||
env: source.env.clone(),
|
||||
});
|
||||
@@ -783,6 +784,7 @@ mod tests {
|
||||
status_message: None,
|
||||
source_path: source_path.clone(),
|
||||
source: hook_source(),
|
||||
plugin_id: None,
|
||||
display_order: 0,
|
||||
env: std::collections::HashMap::new(),
|
||||
}]
|
||||
@@ -818,6 +820,7 @@ mod tests {
|
||||
status_message: None,
|
||||
source_path: source_path.clone(),
|
||||
source: hook_source(),
|
||||
plugin_id: None,
|
||||
display_order: 0,
|
||||
env: std::collections::HashMap::new(),
|
||||
}]
|
||||
|
||||
@@ -76,6 +76,7 @@ pub(crate) fn running_summary(handler: &ConfiguredHandler) -> HookRunSummary {
|
||||
scope: scope_for_event(handler.event_name),
|
||||
source_path: handler.source_path.clone(),
|
||||
source: handler.source,
|
||||
plugin_id: handler.plugin_id.clone(),
|
||||
display_order: handler.display_order,
|
||||
status: HookRunStatus::Running,
|
||||
status_message: handler.status_message.clone(),
|
||||
@@ -129,6 +130,7 @@ pub(crate) fn completed_summary(
|
||||
scope: scope_for_event(handler.event_name),
|
||||
source_path: handler.source_path.clone(),
|
||||
source: handler.source,
|
||||
plugin_id: handler.plugin_id.clone(),
|
||||
display_order: handler.display_order,
|
||||
status,
|
||||
status_message: handler.status_message.clone(),
|
||||
@@ -178,6 +180,7 @@ mod tests {
|
||||
status_message: None,
|
||||
source_path: test_path_buf("/tmp/hooks.json").abs(),
|
||||
source: HookSource::User,
|
||||
plugin_id: None,
|
||||
display_order,
|
||||
env: std::collections::HashMap::new(),
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ pub(crate) struct ConfiguredHandler {
|
||||
pub status_message: Option<String>,
|
||||
pub source_path: AbsolutePathBuf,
|
||||
pub source: HookSource,
|
||||
pub plugin_id: Option<String>,
|
||||
pub display_order: i64,
|
||||
pub env: HashMap<String, String>,
|
||||
}
|
||||
|
||||
@@ -1210,6 +1210,10 @@ print(json.dumps({
|
||||
assert_eq!(preview.len(), 1);
|
||||
assert_eq!(preview[0].source, HookSource::Plugin);
|
||||
assert_eq!(preview[0].source_path, source_path);
|
||||
assert_eq!(
|
||||
preview[0].plugin_id.as_deref(),
|
||||
Some("demo-plugin@test-marketplace")
|
||||
);
|
||||
let listed = crate::list_hooks(crate::HooksConfig {
|
||||
legacy_notify_argv: None,
|
||||
feature_enabled: true,
|
||||
@@ -1243,6 +1247,10 @@ print(json.dumps({
|
||||
|
||||
assert_eq!(outcome.hook_events.len(), 1);
|
||||
assert_eq!(outcome.hook_events[0].run.source, HookSource::Plugin);
|
||||
assert_eq!(
|
||||
outcome.hook_events[0].run.plugin_id.as_deref(),
|
||||
Some("demo-plugin@test-marketplace")
|
||||
);
|
||||
assert_eq!(
|
||||
outcome.hook_events[0].run.status,
|
||||
HookRunStatus::Completed,
|
||||
|
||||
@@ -602,6 +602,7 @@ mod tests {
|
||||
status_message: Some("running compact hook".to_string()),
|
||||
source_path: test_path_buf("/tmp/hooks.json").abs(),
|
||||
source: codex_protocol::protocol::HookSource::User,
|
||||
plugin_id: None,
|
||||
display_order: 0,
|
||||
env: std::collections::HashMap::new(),
|
||||
}
|
||||
|
||||
@@ -555,6 +555,7 @@ mod tests {
|
||||
status_message: Some("running post tool use hook".to_string()),
|
||||
source_path: test_path_buf("/tmp/hooks.json").abs(),
|
||||
source: codex_protocol::protocol::HookSource::User,
|
||||
plugin_id: None,
|
||||
display_order: 0,
|
||||
env: std::collections::HashMap::new(),
|
||||
}
|
||||
|
||||
@@ -747,6 +747,7 @@ mod tests {
|
||||
status_message: None,
|
||||
source_path: test_path_buf("/tmp/hooks.json").abs(),
|
||||
source: codex_protocol::protocol::HookSource::User,
|
||||
plugin_id: None,
|
||||
display_order: 0,
|
||||
env: std::collections::HashMap::new(),
|
||||
}
|
||||
|
||||
@@ -521,6 +521,7 @@ mod tests {
|
||||
status_message: None,
|
||||
source_path: test_path_buf("/tmp/hooks.json").abs(),
|
||||
source: codex_protocol::protocol::HookSource::User,
|
||||
plugin_id: None,
|
||||
display_order: 0,
|
||||
env: std::collections::HashMap::new(),
|
||||
}
|
||||
|
||||
@@ -637,6 +637,7 @@ mod tests {
|
||||
status_message: None,
|
||||
source_path: test_path_buf("/tmp/hooks.json").abs(),
|
||||
source: codex_protocol::protocol::HookSource::User,
|
||||
plugin_id: None,
|
||||
display_order: 0,
|
||||
env: std::collections::HashMap::new(),
|
||||
}
|
||||
|
||||
@@ -426,6 +426,7 @@ mod tests {
|
||||
status_message: None,
|
||||
source_path: test_path_buf("/tmp/hooks.json").abs(),
|
||||
source: codex_protocol::protocol::HookSource::User,
|
||||
plugin_id: None,
|
||||
display_order: 0,
|
||||
env: std::collections::HashMap::new(),
|
||||
}
|
||||
|
||||
@@ -1489,6 +1489,7 @@ pub struct HookRunSummary {
|
||||
pub source_path: AbsolutePathBuf,
|
||||
#[serde(default)]
|
||||
pub source: HookSource,
|
||||
pub plugin_id: Option<String>,
|
||||
pub display_order: i64,
|
||||
pub status: HookRunStatus,
|
||||
pub status_message: Option<String>,
|
||||
|
||||
@@ -413,6 +413,7 @@ mod tests {
|
||||
scope: AppServerHookScope::Turn,
|
||||
source_path: test_path_buf("/tmp/hooks.json").abs(),
|
||||
source: codex_app_server_protocol::HookSource::User,
|
||||
plugin_id: None,
|
||||
display_order: 0,
|
||||
status: AppServerHookRunStatus::Running,
|
||||
status_message: Some("checking go-workflow input policy".to_string()),
|
||||
@@ -436,6 +437,7 @@ mod tests {
|
||||
scope: AppServerHookScope::Turn,
|
||||
source_path: test_path_buf("/tmp/hooks.json").abs(),
|
||||
source: codex_app_server_protocol::HookSource::User,
|
||||
plugin_id: None,
|
||||
display_order: 0,
|
||||
status: AppServerHookRunStatus::Stopped,
|
||||
status_message: Some("checking go-workflow input policy".to_string()),
|
||||
|
||||
@@ -1483,6 +1483,7 @@ pub(super) fn hook_run(
|
||||
scope: codex_app_server_protocol::HookScope::Turn,
|
||||
source_path: PathBuf::from(test_path_display("/tmp/hooks.json")).abs(),
|
||||
source: codex_app_server_protocol::HookSource::User,
|
||||
plugin_id: None,
|
||||
display_order: 0,
|
||||
status,
|
||||
status_message: Some(status_message.to_string()),
|
||||
|
||||
@@ -2907,6 +2907,7 @@ async fn user_prompt_submit_app_server_hook_notifications_render_snapshot() {
|
||||
scope: AppServerHookScope::Turn,
|
||||
source_path: PathBuf::from(test_path_display("/tmp/hooks.json")).abs(),
|
||||
source: codex_app_server_protocol::HookSource::User,
|
||||
plugin_id: None,
|
||||
display_order: 0,
|
||||
status: AppServerHookRunStatus::Running,
|
||||
status_message: Some("checking go-workflow input policy".to_string()),
|
||||
@@ -2930,6 +2931,7 @@ async fn user_prompt_submit_app_server_hook_notifications_render_snapshot() {
|
||||
scope: AppServerHookScope::Turn,
|
||||
source_path: PathBuf::from(test_path_display("/tmp/hooks.json")).abs(),
|
||||
source: codex_app_server_protocol::HookSource::User,
|
||||
plugin_id: None,
|
||||
display_order: 0,
|
||||
status: AppServerHookRunStatus::Stopped,
|
||||
status_message: Some("checking go-workflow input policy".to_string()),
|
||||
@@ -3527,6 +3529,7 @@ fn hook_run_summary(
|
||||
scope: codex_app_server_protocol::HookScope::Turn,
|
||||
source_path: PathBuf::from(test_path_display("/tmp/hooks.json")).abs(),
|
||||
source: codex_app_server_protocol::HookSource::User,
|
||||
plugin_id: None,
|
||||
display_order: 0,
|
||||
status,
|
||||
status_message: status_message.map(str::to_string),
|
||||
|
||||
@@ -889,6 +889,7 @@ mod tests {
|
||||
scope: codex_app_server_protocol::HookScope::Turn,
|
||||
source_path: test_path_buf("/tmp/hooks.json").abs(),
|
||||
source: codex_app_server_protocol::HookSource::User,
|
||||
plugin_id: None,
|
||||
display_order: 0,
|
||||
status: HookRunStatus::Running,
|
||||
status_message: Some("checking output policy".to_string()),
|
||||
|
||||
Reference in New Issue
Block a user