OpenAgentID documentation
Source referencesRust module referenceopenagent-claude-agent

openagent-claude-agent · plugin

Declared module signatures, types, configuration, and source documentation.

Source: openagent-sdk/integrations/claude-agent-sdk/rust/src/plugin.rs. SHA-256: 87304e5c59bf4e6a5b65c3631673ed87107bc9dc98e2c8eeaff4ddd5a89c3f22.

This source reference follows declared modules and preserves feature attributes. It includes public declarations and implementation methods in those modules. Private-module exports and trait resolution still require the compiler; not every declaration is a crate-root import. Function bodies and constant values are omitted. Source comments describe their implementation context and are not a production deployment claim.

plugin::DenyMode

Behaviour on a denied tool / skill request.

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum DenyMode {
    /// Return `Err(Error::ToolDenied / SkillDenied)`.
    Throw,
    /// Record the deny in the audit log and return `Ok(())`.
    Block,
}

Source line: 22.

plugin::PluginConfig

Plugin configuration.

pub struct PluginConfig {
/// The verified OpenAgent identity to attach to the session. Any

/// implementor of [`OpenAgentIdentity`] is accepted — typically an

/// [`crate::identity::OpenAgentSdkIdentity`] in production or

/// [`crate::identity::Identity`] in tests.

pub identity: Arc<dyn OpenAgentIdentity>,
/// Capability checker (Arsenal-backed in production).

pub capabilities: Arc<dyn CapabilityChecker>,
/// Skills policy.

pub skills_policy: Arc<dyn SkillsPolicy>,
/// Audit sink.

pub sink: Arc<dyn AuditSink>,
/// Sign outbound messages with the agent key.

pub sign_messages: bool,
/// Behaviour on deny.

pub deny_mode: DenyMode
}

Source line: 30.

plugin::OpenAgentPlugin

The composition root that drives the lifecycle hooks.

pub struct OpenAgentPlugin {

}

Source line: 49.

plugin::OpenAgentPlugin::new

Construct a new plugin from configuration.

pub fn new(config: PluginConfig) -> Self;

Source line: 65.

plugin::OpenAgentPlugin::session_start

Begin a new session — must be called before any other hook.

pub async fn session_start(&self, session_id: &str) -> Result<()>;

Source line: 80.

plugin::OpenAgentPlugin::session_end

End the current session.

pub async fn session_end(&self) -> Result<()>;

Source line: 112.

plugin::OpenAgentPlugin::pre_tool_use

Verify a tool call against Arsenal scopes (preflight).

pub async fn pre_tool_use(&self, tool_name: &str, args: &Value) -> Result<()>;

Source line: 131.

plugin::OpenAgentPlugin::post_tool_use

Emit a post-tool-use audit record.

pub async fn post_tool_use(
        &self,
        tool_name: &str,
        result: &Value,
        ok: bool,
        error: Option<&str>,
    ) -> Result<()>;

Source line: 179.

plugin::OpenAgentPlugin::on_message

Sign an outbound message and emit an audit record.

pub async fn on_message(&self, body: &[u8], outbound: bool) -> Result<Option<String>>;

Source line: 203.

plugin::OpenAgentPlugin::on_skill_invoke

Consult the skills policy before a SKILLS.md skill runs.

pub async fn on_skill_invoke(
        &self,
        skill_name: &str,
        args: Option<&Value>,
    ) -> Result<()>;

Source line: 234.

On this page