Public declaration syntax from harness-sdk/src/types.rs Original source SHA-256: 38855a6544b96ba94c773619f0eb2d360cfbbc542da64c63e389a82f2b6b2830 Function bodies and constant values are omitted. This is not the complete implementation. Source line 27 pub const MAX_AGENT_ID_LEN: usize; Source line 30 pub const MAX_AGENT_NAME_LEN: usize; Source line 33 pub const MAX_CHUNK_SIZE: usize; Source line 36 pub const MAX_TOOL_INPUT_SIZE: usize; Source line 39 pub const MAX_INTERJECTION_LEN: usize; Source line 42 pub const DEFAULT_STREAM_TIMEOUT: Duration; Source line 45 pub const DEFAULT_MAX_MESSAGES: usize; Source line 66 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] pub enum Mode { /// Interactive chat mode — user sends messages, agent responds. Chat, /// Autonomous execution mode — agent works independently with interjections. Autonomy, /// Transient state while draining autonomy events and cleaning up. Stopping, } Source line 85 #[must_use] pub const fn label(&self) -> &'static str; Source line 104 #[must_use] pub const fn is_autonomy(&self) -> bool; Source line 134 #[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] pub enum SdkRole { /// A human end-user. User, /// An AI agent, optionally identified by name. Agent(String), /// A system-generated message. System, /// Output from a tool invocation. Tool, } Source line 156 #[must_use] pub const fn label(&self) -> &'static str; Source line 177 #[must_use] pub fn to_kit_role(&self) -> harness_tui_kit::Role; Source line 196 #[must_use] pub fn agent_name(&self) -> &str; Source line 232 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct SdkAgentInfo { /// Unique identifier for this agent. pub id: String, /// Human-readable display name. pub name: String, /// Short description of the agent's role or purpose. pub role_description: String, /// Model identifier (e.g., "claude-opus-4-6"). pub model: String, /// Current lifecycle status. pub status: SdkAgentStatus, /// Capabilities this agent supports. pub capabilities: Vec, /// Tools available to this agent. pub tools: Vec, /// Additional metadata (adapter-specific, not logged at INFO+). pub metadata: std::collections::HashMap } Source line 266 #[must_use] pub fn new(id: impl Into, name: impl Into, model: impl Into) -> Self; Source line 281 #[must_use] pub fn with_role(mut self, role: impl Into) -> Self; Source line 288 #[must_use] pub fn with_status(mut self, status: SdkAgentStatus) -> Self; Source line 295 #[must_use] pub fn with_capabilities(mut self, caps: Vec) -> Self; Source line 302 #[must_use] pub fn with_tools(mut self, tools: Vec) -> Self; Source line 320 #[must_use] pub fn to_kit_agent_info(&self) -> harness_tui_kit::AgentInfo; Source line 345 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] pub enum SdkAgentStatus { /// Connected and ready. #[default] Online, /// Actively executing. Working, /// Reasoning/planning. Thinking, /// Connected, no pending work. Idle, /// Blocked on external resource or human. Waiting, /// Encountered an error. Error, /// Permanently shut down. Terminated, /// Disconnected/unreachable. Offline, } Source line 368 #[must_use] pub const fn label(&self) -> &'static str; Source line 383 #[must_use] pub const fn is_active(&self) -> bool; Source line 389 #[must_use] pub const fn is_terminal(&self) -> bool; Source line 395 #[must_use] pub fn to_kit_status(&self) -> harness_tui_kit::AgentStatus; Source line 446 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[serde(tag = "type", rename_all = "snake_case")] pub enum ResponseChunk { /// A fragment of the agent's text response. TextDelta { /// The text fragment. text: String, /// The agent that produced this text. agent_id: String, }, /// A tool call has started. ToolCallStart { /// Unique ID for this tool call. call_id: String, /// Tool name. tool_name: String, /// Tool input (JSON). input: String, /// The agent making the tool call. agent_id: String, }, /// A tool call has completed. ToolCallEnd { /// Unique ID matching the `ToolCallStart`. call_id: String, /// Tool output. output: String, /// Whether the tool call succeeded. success: bool, /// Wall-clock duration in milliseconds. duration_ms: u64, }, /// A fragment of the agent's thinking/reasoning (if exposed). ThinkingDelta { /// The thinking text fragment. text: String, /// The agent that is thinking. agent_id: String, }, /// The agent's status has changed. StatusChange { /// The agent whose status changed. agent_id: String, /// The new status. status: SdkAgentStatus, }, /// An approval is needed from the user. ApprovalNeeded { /// The approval request details. request: SdkApprovalRequest, }, /// A cost/usage update. UsageUpdate { /// Input tokens consumed. input_tokens: u64, /// Output tokens consumed. output_tokens: u64, /// Estimated cost in USD (cents). cost_cents: f64, }, /// The response stream has ended successfully. Done { /// The agent that finished. agent_id: String, }, /// The response stream ended with an error. Error { /// Error message. message: String, /// The agent that errored (if known). agent_id: String, }, } Source line 548 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[serde(tag = "type", rename_all = "snake_case")] pub enum AutonomyEvent { /// An activity log entry from an agent. ActivityLog { /// The agent producing this log. agent_id: String, /// Log message. message: String, /// Severity level. level: ActivityLevel, }, /// An agent's status changed during autonomy. AgentStatusChange { /// The agent whose status changed. agent_id: String, /// The new status. status: SdkAgentStatus, }, /// An agent needs approval to proceed. ApprovalRequired { /// The approval request. request: SdkApprovalRequest, }, /// A previously requested approval was resolved (by timeout or cancel). ApprovalResolved { /// The approval request ID. request_id: String, /// How it was resolved. resolution: String, }, /// A task was created or updated. TaskUpdate { /// Task identifier. task_id: String, /// Task title. title: String, /// Task status. status: String, /// The agent working on this task. agent_id: String, }, /// Metrics/usage update during autonomy. MetricsUpdate { /// Total input tokens. total_input_tokens: u64, /// Total output tokens. total_output_tokens: u64, /// Total cost in USD cents. total_cost_cents: f64, /// Elapsed time in seconds. elapsed_secs: u64, }, /// Autonomy session has ended. SessionEnded { /// Reason for ending. reason: String, }, /// Error during autonomy (non-fatal). Error { /// The agent that errored. agent_id: String, /// Error message. message: String, }, } Source line 630 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] pub enum ActivityLevel { /// Trace-level detail. Trace, /// Debug information. Debug, /// General information. #[default] Info, /// Warning condition. Warn, /// Error condition. Error, } Source line 647 #[must_use] pub const fn label(&self) -> &'static str; Source line 659 #[must_use] pub fn to_kit_log_level(&self) -> harness_tui_kit::LogLevel; Source line 695 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct SdkApprovalRequest { /// Unique identifier for this request. pub id: String, /// Name of the agent requesting approval. pub agent_name: String, /// ID of the agent requesting approval. pub agent_id: String, /// Short summary of the proposed action. pub action_summary: String, /// Detailed reasoning for the action. pub reasoning: String, /// Expected impact description. pub impact: String, /// Resources affected by the action. pub resources: Vec, /// Assessed risk level. pub risk_level: SdkRiskLevel, /// ISO-8601 timestamp of when the request was created. pub created_at: String } Source line 719 #[must_use] pub fn new( id: impl Into, agent_name: impl Into, action_summary: impl Into, ) -> Self; Source line 739 #[must_use] pub fn with_agent_id(mut self, agent_id: impl Into) -> Self; Source line 746 #[must_use] pub fn with_risk_level(mut self, risk_level: SdkRiskLevel) -> Self; Source line 753 #[must_use] pub fn with_reasoning(mut self, reasoning: impl Into) -> Self; Source line 760 #[must_use] pub fn with_impact(mut self, impact: impl Into) -> Self; Source line 767 #[must_use] pub fn with_resources(mut self, resources: Vec) -> Self; Source line 774 #[must_use] pub fn with_created_at(mut self, created_at: impl Into) -> Self; Source line 781 #[must_use] pub fn to_kit_approval_request(&self) -> harness_tui_kit::ApprovalRequest; Source line 807 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] pub enum SdkRiskLevel { /// Low risk, routine action. #[default] Low, /// Medium risk, warrants attention. Medium, /// High risk, requires careful review. High, /// Critical risk, potentially destructive. Critical, } Source line 822 #[must_use] pub const fn label(&self) -> &'static str; Source line 833 #[must_use] pub const fn requires_review(&self) -> bool; Source line 839 #[must_use] pub const fn weight(&self) -> u8; Source line 850 #[must_use] pub fn to_kit_risk_level(&self) -> harness_tui_kit::RiskLevel; Source line 882 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] pub enum SdkApprovalAction { /// Approve the request as-is. Approve, /// Deny the request. Deny, /// Approve with modifications. Edit { /// Description of the modification. modification: String, }, } Source line 897 #[must_use] pub fn is_approved(&self) -> bool; Source line 903 #[must_use] pub fn to_kit_approval_action(&self) -> harness_tui_kit::ApprovalAction; Source line 938 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct HumanInterjection { /// Original raw input text. pub raw: String, /// Cleaned text content (prefix markers stripped). pub text: String, /// Priority level. pub priority: InterjectionPriority, /// Kind of interjection. pub kind: InterjectionKind, /// Target agent name, if specified (via `@Agent` syntax). pub target: Option } Source line 954 #[must_use] pub fn is_urgent(&self) -> bool; Source line 960 #[must_use] pub fn is_targeted(&self) -> bool; Source line 966 #[must_use] pub fn is_broadcast(&self) -> bool; Source line 981 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] pub enum InterjectionPriority { /// Standard priority. #[default] Normal, /// High priority — should interrupt current work. High, /// Urgent — must be processed immediately. Urgent, } Source line 994 #[must_use] pub const fn label(&self) -> &'static str; Source line 1019 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] pub enum InterjectionKind { /// A direct instruction to the agent(s). #[default] Instruction, /// A question for the agent(s). Question, /// A new mission directive. Mission, /// A general message or comment. Message, } Source line 1034 #[must_use] pub const fn label(&self) -> &'static str; Source line 1068 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct InterjectionAck { /// Whether the adapter accepted the interjection. pub received: bool, /// Optional message from the adapter. pub message: String } Source line 1094 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct AdapterCapabilities { /// Supports chat mode. pub chat: bool, /// Supports autonomy mode. pub autonomy: bool, /// Supports multi-agent operations. pub multi_agent: bool, /// Supports usage/cost metrics. pub metrics: bool, /// Supports streaming responses. pub streaming: bool, /// Supports tool calls. pub tool_calls: bool, /// Supports thinking/reasoning display. pub thinking: bool } Source line 1114 #[must_use] pub fn chat_only() -> Self; Source line 1128 #[must_use] pub fn full() -> Self; Source line 1162 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct SessionInfo { /// Unique session identifier. pub id: String, /// ISO-8601 timestamp of session start. pub started_at: String, /// Total messages in this session. pub message_count: usize, /// Total input tokens consumed. pub total_input_tokens: u64, /// Total output tokens consumed. pub total_output_tokens: u64, /// Total estimated cost in USD cents. pub total_cost_cents: f64, /// Elapsed duration. pub elapsed: Duration } Source line 1182 #[must_use] pub fn new(id: impl Into) -> Self;