Add a skill invocation extension contributor (#32200)

## What changed

- Add `SkillInvocationContributor` and registration support to the extension API.
- Provide invocation callbacks with session-, thread-, and turn-scoped extension data, the turn ID, skill resource, and explicit or implicit invocation kind.
- Notify registered contributors when Codex observes a deduplicated implicit skill invocation.

## Testing

- Extend the extension registry round-trip test to cover skill invocation contributors.

GitOrigin-RevId: f428336728889d9bf4fba41a7dd8d3a6f9b9728c
This commit is contained in:
jif authored and copyberry committed 2026-07-10 15:52:04 +00:00
1 parent 601b61a83f
commit 2b9c050460
6 files changed
+87

No files matched your search

@@ -14,6 +14,7 @@ use crate::ExtensionData;
mod context;
mod mcp;
mod prompt;
mod skill_invocation;
mod thread_lifecycle;
mod tool_lifecycle;
mod turn_input;
@@ -25,6 +26,8 @@ pub use mcp::McpServerContribution;
pub use mcp::McpServerContributionContext;
pub use prompt::PromptFragment;
pub use prompt::PromptSlot;
pub use skill_invocation::SkillInvocationInput;
pub use skill_invocation::SkillInvocationKind;
pub use thread_lifecycle::ThreadIdleInput;
pub use thread_lifecycle::ThreadResumeInput;
pub use thread_lifecycle::ThreadStartInput;
@@ -247,6 +250,23 @@ pub trait TokenUsageContributor: Send + Sync {
}
}
/// Contributor for skill invocations observed by the host or an owning extension.
///
/// Implementations should treat the skill resource as an opaque identity and keep this callback
/// cheap because it runs inline with skill loading or command dispatch.
pub trait SkillInvocationContributor: Send + Sync {
/// Called after one explicit skill load or deduplicated implicit skill invocation is observed.
fn on_skill_invocation<'a>(
&'a self,
_input: SkillInvocationInput<'a>,
) -> ExtensionFuture<'a, ()> {
Box::pin(async move {
let _self = self;
let _input = _input;
})
}
}
/// Extension contribution that exposes native tools owned by a feature.
pub trait ToolContributor: Send + Sync {
/// Returns the native tools visible for the supplied extension stores.