Public declaration syntax from harness-tui-kit/src/types.rs Original source SHA-256: fe451d870e4287bae66a2c90e5a191ceaf3005d40cc9c603d742fe3dd423bfcf Function bodies and constant values are omitted. This is not the complete implementation. Source line 52 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] #[serde(rename_all = "lowercase")] pub enum Role { /// A human end-user. User, /// An AI agent. Agent, /// A system-generated message (e.g. connection notice, error). System, /// Output from a tool invocation. Tool, } Source line 73 #[must_use] pub const fn label(&self) -> &'static str; Source line 91 #[must_use] pub const fn symbol(&self) -> &'static str; Source line 117 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] pub enum AgentStatus { /// The agent is connected and ready to accept work. #[default] Online, /// The agent is actively executing a task. Working, /// The agent is reasoning / planning (no tool calls yet). Thinking, /// The agent is connected but has no pending work. Idle, /// The agent is blocked waiting on an external resource or human input. Waiting, /// The agent encountered an error. Error, /// The agent has been permanently shut down. Terminated, /// The agent is disconnected / unreachable. Offline, } Source line 147 #[must_use] pub const fn label(&self) -> &'static str; Source line 171 #[must_use] pub const fn is_active(&self) -> bool; Source line 189 #[must_use] pub const fn is_terminal(&self) -> bool; Source line 228 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct ChatMessage { /// Unique identifier for this message (monotonic counter per process). pub id: String, /// Role of the message author. pub role: Role, /// Display name of the sender. pub sender: String, /// Message body (plain text or markdown). pub content: String, /// ISO-8601 timestamp string, or empty if not set. pub timestamp: String } Source line 256 #[must_use] pub fn new(role: Role, sender: impl AsRef, content: impl AsRef) -> Self; Source line 278 #[must_use] pub fn user(content: impl AsRef) -> Self; Source line 294 #[must_use] pub fn agent(sender: impl AsRef, content: impl AsRef) -> Self; Source line 309 #[must_use] pub fn system(content: impl AsRef) -> Self; Source line 324 #[must_use] pub fn tool(content: impl AsRef) -> Self; Source line 339 #[must_use] pub fn with_timestamp(mut self, timestamp: impl AsRef) -> Self; Source line 357 #[must_use] pub fn with_id(mut self, id: impl AsRef) -> Self; Source line 388 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct AgentInfo { /// 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. "gpt-4o", "claude-opus-4-6"). pub model: String, /// Current lifecycle status. pub status: AgentStatus } Source line 417 #[must_use] pub fn new(id: impl AsRef, name: impl AsRef, model: impl AsRef) -> Self; Source line 439 #[must_use] pub fn with_role(mut self, role_description: impl AsRef) -> Self; Source line 456 #[must_use] pub fn with_status(mut self, status: AgentStatus) -> Self; Source line 478 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] pub enum ToolCallStatus { /// The tool call has been requested but not yet started. #[default] Pending, /// The tool call is currently executing. Running, /// The tool call completed successfully. Success, /// The tool call failed with an error. Error, } Source line 500 #[must_use] pub const fn label(&self) -> &'static str; Source line 520 #[must_use] pub const fn is_complete(&self) -> bool; Source line 552 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct ToolCallInfo { /// Name of the tool (e.g. "read_file", "bash"). pub name: String, /// Serialized arguments passed to the tool (typically JSON). pub arguments: String, /// Output produced by the tool, or empty if not yet available. pub output: String, /// Current execution status. pub status: ToolCallStatus, /// Wall-clock duration of the tool call, if completed. #[serde( serialize_with = "serialize_opt_duration", deserialize_with = "deserialize_opt_duration" )] pub duration: Option } Source line 583 #[must_use] pub fn new(name: impl AsRef, arguments: impl AsRef) -> Self; Source line 605 #[must_use] pub fn with_status(mut self, status: ToolCallStatus) -> Self; Source line 621 #[must_use] pub fn with_output(mut self, output: impl AsRef) -> Self; Source line 639 #[must_use] pub fn with_duration(mut self, duration: Duration) -> Self; Source line 670 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize)] #[serde(rename_all = "lowercase")] pub enum Severity { /// Informational message. #[default] Info, /// Positive outcome or confirmation. Success, /// Non-critical issue requiring attention. Warning, /// Critical failure or error condition. Error, } Source line 692 #[must_use] pub const fn label(&self) -> &'static str; Source line 716 #[must_use] pub const fn icon(&self) -> &'static str; Source line 752 #[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)] pub struct CommandHint { /// The command name (e.g., "help", "orgs form", "clear"). pub name: String, /// Short description (e.g., "Show available commands"). pub description: String, /// Source label — "built-in" or a plugin name (e.g., "orgs"). pub source: String } Source line 773 #[must_use] pub fn new( name: impl AsRef, description: impl AsRef, source: impl AsRef, ) -> Self; Source line 801 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] pub enum PermissionCategory { /// Network access (HTTP, DNS, WebSocket). Network, /// Filesystem read access. Read, /// Filesystem write access. Write, /// Shell command execution. Shell, /// Tool invocation (agent-to-agent or external). Tool, } Source line 824 #[must_use] pub const fn icon(&self) -> &'static str; Source line 843 #[must_use] pub const fn label(&self) -> &'static str; Source line 878 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct PermissionRequest { /// Category of access being requested. pub category: PermissionCategory, /// Name of the requesting entity (plugin or agent). pub requester: String, /// Specific resource (URL, file path, shell command). pub resource: String, /// One-line context explaining why the access is needed. pub context: String, /// Suggested glob pattern for "always allow" (e.g., `api.orgs.sh/*`). pub suggested_pattern: String } Source line 896 #[must_use] pub fn new( category: PermissionCategory, requester: impl AsRef, resource: impl AsRef, ) -> Self; Source line 912 #[must_use] pub fn with_context(mut self, context: impl AsRef) -> Self; Source line 919 #[must_use] pub fn with_suggested_pattern(mut self, pattern: impl AsRef) -> Self; Source line 943 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] pub enum PermissionDecision { /// Allow this specific request once. AllowOnce, /// Always allow requests matching the given glob pattern. AlwaysAllow { /// The glob pattern to persist (e.g., `api.orgs.sh/*`). pattern: String, }, /// Deny this request. Deny, } Source line 981 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] pub enum DiffLineKind { /// Unchanged context line. Context, /// Added line (green). Added, /// Removed line (red). Removed, /// Section header (@@). Header, } Source line 995 #[must_use] pub const fn prefix(&self) -> &'static str; Source line 1007 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct DiffLine { /// What kind of diff line this is. pub kind: DiffLineKind, /// The line content (without the +/- prefix). pub content: String, /// Original line number (for removed/context lines), if known. pub old_line_no: Option, /// New line number (for added/context lines), if known. pub new_line_no: Option } Source line 1036 #[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)] pub struct CostEntry { /// Agent that incurred the cost. pub agent_id: String, /// Model used (e.g., "claude-opus-4-6", "gpt-4o"). pub model: String, /// Cost in the smallest currency unit (cents for USD). pub amount_cents: u64, /// ISO 4217 currency code (e.g., "USD", "EUR"). pub currency: String } Source line 1050 #[must_use] pub fn new( agent_id: impl AsRef, model: impl AsRef, amount_cents: u64, currency: impl AsRef, ) -> Self; Source line 1066 #[must_use] pub fn display_amount(&self) -> String; Source line 1108 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct LatencySnapshot { /// Current latency in milliseconds. pub current_ms: u64, /// 50th percentile (median) latency in milliseconds. pub p50: u64, /// 95th percentile latency in milliseconds. pub p95: u64, /// 99th percentile latency in milliseconds. pub p99: u64, /// Recent latency samples for sparkline rendering. pub samples: Vec } Source line 1124 #[must_use] pub fn new(current_ms: u64, p50: u64, p95: u64, p99: u64) -> Self; Source line 1136 #[must_use] pub fn with_samples(mut self, samples: Vec) -> Self; Source line 1171 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] pub enum RiskLevel { /// Low risk, routine action. #[default] Low, /// Medium risk, warrants attention. Medium, /// High risk, requires careful review. High, /// Critical risk, potentially destructive or irreversible. Critical, } Source line 1186 #[must_use] pub const fn label(&self) -> &'static str; Source line 1197 #[must_use] pub const fn requires_review(&self) -> bool; Source line 1203 #[must_use] pub const fn weight(&self) -> u8; Source line 1236 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct ApprovalRequest { /// Unique identifier for this request. pub id: String, /// Name of the agent requesting approval. pub agent_name: String, /// Short summary of the proposed action. pub action_summary: String, /// Detailed reasoning for the action. pub reasoning: String, /// Resources affected by the action. pub resources: Vec, /// Assessed risk level. pub risk_level: RiskLevel, /// ISO-8601 timestamp of when the request was created. pub created_at: String } Source line 1256 #[must_use] pub fn new( id: impl AsRef, agent_name: impl AsRef, action_summary: impl AsRef, ) -> Self; Source line 1274 #[must_use] pub fn with_risk_level(mut self, risk_level: RiskLevel) -> Self; Source line 1281 #[must_use] pub fn with_reasoning(mut self, reasoning: impl AsRef) -> Self; Source line 1288 #[must_use] pub fn with_resources(mut self, resources: Vec) -> Self; Source line 1295 #[must_use] pub fn with_created_at(mut self, created_at: impl AsRef) -> Self; Source line 1318 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] pub enum ApprovalAction { /// Approve the request as-is. Approve, /// Deny the request. Deny, /// Approve with modifications. Edit { /// Description of the modification. modification: String, }, } Source line 1357 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] pub enum TaskStatus { /// Task has not started. #[default] Pending, /// Task is currently executing. Active, /// Task completed successfully. Complete, /// Task failed with an error. Error, /// Task was skipped. Skipped, } Source line 1374 #[must_use] pub const fn label(&self) -> &'static str; Source line 1386 #[must_use] pub const fn icon(&self) -> &'static str; Source line 1398 #[must_use] pub const fn is_terminal(&self) -> bool; Source line 1426 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct TaskItem { /// Unique task identifier. pub id: String, /// Display label for the task. pub label: String, /// Current task status. pub status: TaskStatus, /// Sub-tasks (for hierarchical display). pub children: Vec, /// Progress fraction (0.0 to 1.0), where applicable. pub progress: f32 } Source line 1442 #[must_use] pub fn new(id: impl AsRef, label: impl AsRef) -> Self; Source line 1454 #[must_use] pub fn with_status(mut self, status: TaskStatus) -> Self; Source line 1461 #[must_use] pub fn with_progress(mut self, progress: f32) -> Self; Source line 1468 #[must_use] pub fn with_children(mut self, children: Vec) -> Self; Source line 1496 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] pub enum WorkflowNodeKind { /// An agent node. #[default] Agent, /// A tool invocation node. Tool, /// A conditional branch node. Condition, /// A parallel execution node. Parallel, /// A human-in-the-loop gate. HitlGate, } Source line 1513 #[must_use] pub const fn label(&self) -> &'static str; Source line 1525 #[must_use] pub const fn icon(&self) -> &'static str; Source line 1544 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct WorkflowNodeInfo { /// Unique node identifier. pub id: String, /// Display label for the node. pub label: String, /// Node kind (determines icon and styling). pub kind: WorkflowNodeKind, /// Current execution status. pub status: TaskStatus } Source line 1558 #[must_use] pub fn new(id: impl AsRef, label: impl AsRef, kind: WorkflowNodeKind) -> Self; Source line 1569 #[must_use] pub fn with_status(mut self, status: TaskStatus) -> Self; Source line 1583 #[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)] pub struct WorkflowEdge { /// Source node ID. pub source_id: String, /// Target node ID. pub target_id: String, /// Whether this edge is currently active (data flowing). pub active: bool } Source line 1595 #[must_use] pub fn new(source_id: impl AsRef, target_id: impl AsRef) -> Self; Source line 1605 #[must_use] pub fn with_active(mut self, active: bool) -> Self; Source line 1634 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] pub enum LogLevel { /// Trace-level diagnostic output. Trace, /// Debug-level diagnostic output. Debug, /// Informational messages. #[default] Info, /// Warning conditions. Warn, /// Error conditions. Error, } Source line 1651 #[must_use] pub const fn label(&self) -> &'static str; Source line 1663 #[must_use] pub const fn severity(&self) -> u8; Source line 1682 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct LogEntry { /// ISO-8601 timestamp. pub timestamp: String, /// Log level. pub level: LogLevel, /// Source component or module. pub source: String, /// Log message text. pub message: String } Source line 1696 #[must_use] pub fn new(level: LogLevel, source: impl AsRef, message: impl AsRef) -> Self; Source line 1707 #[must_use] pub fn with_timestamp(mut self, timestamp: impl AsRef) -> Self; Source line 1738 #[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)] pub struct PaletteItem { /// Display label. pub label: String, /// Short description. pub description: String, /// Category for grouping. pub category: String, /// Keyboard shortcut hint (e.g., "Ctrl+O"). pub shortcut: String } Source line 1752 #[must_use] pub fn new( label: impl AsRef, description: impl AsRef, category: impl AsRef, ) -> Self; Source line 1767 #[must_use] pub fn with_shortcut(mut self, shortcut: impl AsRef) -> Self; Source line 1789 #[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)] pub struct KeyShortcut { /// Key combination (e.g., "Ctrl+C", "q", "Shift+Tab"). pub keys: String, /// Description of what the shortcut does. pub description: String, /// Category for grouping (e.g., "Navigation", "Editing"). pub category: String } Source line 1801 #[must_use] pub fn new( keys: impl AsRef, description: impl AsRef, category: impl AsRef, ) -> Self; Source line 1837 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] pub enum ProposalKind { /// General governance proposal. #[default] General, /// Treasury spending or allocation. Treasury, /// Membership change (add/remove). Membership, /// Policy or constitution amendment. Policy, /// Technical or infrastructure change. Technical, } Source line 1854 #[must_use] pub const fn label(&self) -> &'static str; Source line 1874 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] pub enum ProposalStatus { /// Proposal is open for voting. #[default] Active, /// Proposal was approved. Passed, /// Proposal was rejected. Rejected, /// Proposal was withdrawn by the creator. Withdrawn, /// Proposal expired without reaching quorum. Expired, } Source line 1891 #[must_use] pub const fn label(&self) -> &'static str; Source line 1903 #[must_use] pub const fn is_open(&self) -> bool; Source line 1916 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct ProposalInfo { /// Unique proposal identifier. pub id: String, /// Proposal title. pub title: String, /// Proposal kind. pub kind: ProposalKind, /// Current status. pub status: ProposalStatus, /// Creator name. pub creator: String, /// Votes in favor. pub votes_yes: u32, /// Votes against. pub votes_no: u32, /// Abstentions. pub votes_abstain: u32, /// Required quorum (total votes needed). pub quorum: u32, /// ISO-8601 deadline timestamp. pub deadline: String } Source line 1942 #[must_use] pub fn new(id: impl AsRef, title: impl AsRef, kind: ProposalKind) -> Self; Source line 1959 #[must_use] pub fn with_creator(mut self, creator: impl AsRef) -> Self; Source line 1966 #[must_use] pub fn with_status(mut self, status: ProposalStatus) -> Self; Source line 1973 #[must_use] pub fn with_votes(mut self, yes: u32, no: u32, abstain: u32) -> Self; Source line 1982 #[must_use] pub fn with_quorum(mut self, quorum: u32) -> Self; Source line 1989 #[must_use] pub fn with_deadline(mut self, deadline: impl AsRef) -> Self; Source line 1996 #[must_use] pub fn total_votes(&self) -> u32; Source line 2004 #[must_use] pub fn has_quorum(&self) -> bool; Source line 2022 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] pub enum VoteChoice { /// Vote in favor. Yes, /// Vote against. No, /// Abstain from voting. Abstain, } Source line 2034 #[must_use] pub const fn label(&self) -> &'static str; Source line 2051 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct TreasuryInfo { /// Current balance in the smallest currency unit. pub balance_cents: u64, /// Currency code (e.g., "USD", "USDC"). pub currency: String, /// Chain or network label (e.g., "Ethereum", "Solana"). pub chain: String, /// Daily spending limit in the smallest unit. pub daily_limit_cents: u64, /// Amount spent today in the smallest unit. pub daily_spent_cents: u64, /// Recent transactions. pub recent_transactions: Vec } Source line 2069 #[must_use] pub fn new(balance_cents: u64, currency: impl AsRef, chain: impl AsRef) -> Self; Source line 2082 #[must_use] pub fn with_daily_limit(mut self, limit_cents: u64) -> Self; Source line 2089 #[must_use] pub fn with_daily_spent(mut self, spent_cents: u64) -> Self; Source line 2096 #[must_use] pub fn with_transactions(mut self, txns: Vec) -> Self; Source line 2103 #[must_use] pub fn display_balance(&self) -> String; Source line 2118 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct TransactionEntry { /// Amount in the smallest currency unit. pub amount_cents: u64, /// Direction: true = inflow, false = outflow. pub is_inflow: bool, /// Description or recipient. pub description: String, /// ISO-8601 timestamp. pub timestamp: String } Source line 2132 #[must_use] pub fn new(amount_cents: u64, is_inflow: bool, description: impl AsRef) -> Self; Source line 2143 #[must_use] pub fn with_timestamp(mut self, timestamp: impl AsRef) -> Self; Source line 2170 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct DecisionOption { /// Display label for this option. pub label: String, /// Description of what this option does. pub description: String, /// Whether this is the recommended choice. pub recommended: bool } Source line 2182 #[must_use] pub fn new(label: impl AsRef, description: impl AsRef) -> Self; Source line 2192 #[must_use] pub fn with_recommended(mut self, recommended: bool) -> Self;