feat: guardian as an extension (contributors part) (#22216)

Part 1 of guardian as extension. This bind all the logic to spawn
another agent from an extension and it adds `ThreadId` in the start
thread collaborator
This commit is contained in:
jif-oai authored and GitHub committed 2026-05-12 14:41:45 +02:00
1 parent 5b1a4c2fa7
commit d996f5366f
17 files changed
+265 -31

No files matched your search

+10 -3
View File
@@ -1,5 +1,6 @@
use std::future::Future;
use codex_protocol::ThreadId;
use codex_protocol::items::TurnItem;
use codex_tool_api::ToolBundle;
@@ -10,10 +11,16 @@ mod prompt;
pub use prompt::PromptFragment;
pub use prompt::PromptSlot;
/// Contributor that receives host-owned thread-start input before later
/// contributors read from extension stores.
/// Contributor that receives the live thread id and host-owned thread-start
/// input before later contributors read from extension stores.
pub trait ThreadStartContributor<C>: Send + Sync {
fn contribute(&self, input: &C, session_store: &ExtensionData, thread_store: &ExtensionData);
fn contribute(
&self,
thread_id: ThreadId,
input: &C,
session_store: &ExtensionData,
thread_store: &ExtensionData,
);
}
/// Extension contribution that adds prompt fragments during prompt assembly.