Skip to main content

Crate opendev_runtime

Crate opendev_runtime 

Source
Expand description

Runtime services for the OpenDev AI coding assistant.

This crate provides:

  • approval — Pattern-based command approval rules with persistence
  • cost_tracker — Session-level token usage and cost tracking
  • interrupt — Async-safe cancellation token (CancellationToken pattern)
  • plan_index — Plan-session-project association index (JSON CRUD)
  • plan_names — Unique plan name generation (adjective-verb-noun)
  • session_model — Per-session model configuration overlay
  • error_handler — Error classification, retry logic, user-facing recovery
  • errors — Structured error types with provider pattern matching

Re-exports§

pub use approval::ApprovalRule;
pub use approval::ApprovalRulesManager;
pub use approval::RuleAction;
pub use approval::RuleScope;
pub use approval::RuleType;
pub use constants::AutonomyLevel;
pub use constants::SAFE_COMMANDS;
pub use constants::extract_command_prefix;
pub use constants::is_safe_command;
pub use cost_tracker::CostTracker;
pub use cost_tracker::PricingInfo;
pub use cost_tracker::TokenUsage;
pub use error_handler::ErrorAction;
pub use error_handler::ErrorResult;
pub use error_handler::OperationError;
pub use errors::ErrorCategory;
pub use errors::StructuredError;
pub use errors::classify_api_error;
pub use interrupt::InterruptToken;
pub use interrupt::InterruptedError;
pub use plan_index::PlanIndex;
pub use plan_names::generate_plan_name;
pub use session_model::SessionModelManager;
pub use todo::SubTodoItem;
pub use todo::TodoItem;
pub use todo::TodoManager;
pub use todo::TodoStatus;
pub use todo::parse_plan_steps;
pub use todo::parse_status;
pub use todo::strip_markdown;
pub use action_summarizer::summarize_action;
pub use ask_user_channel::AskUserReceiver;
pub use ask_user_channel::AskUserRequest;
pub use ask_user_channel::AskUserSender;
pub use ask_user_channel::ask_user_channel;
pub use custom_commands::CustomCommand;
pub use custom_commands::CustomCommandLoader;
pub use debug_logger::SessionDebugLogger;
pub use event_bus::Event;
pub use event_bus::EventBus;
pub use event_bus::EventTopic;
pub use event_bus::FilteredSubscriber;
pub use event_bus::RuntimeEvent;
pub use event_bus::TopicSubscriber;
pub use event_bus::group_runtime_events_by_topic;
pub use file_watcher::FileChange;
pub use file_watcher::FileChangeKind;
pub use file_watcher::FileWatcher;
pub use file_watcher::FileWatcherConfig;
pub use gitignore::GitIgnoreParser;
pub use lazy_init::LazyEmbeddings;
pub use lazy_init::LazyLsp;
pub use lazy_init::LazyMcp;
pub use lazy_init::LazySubsystem;
pub use lazy_init::SyncLazy;
pub use lazy_init::create_lazy_subsystems;
pub use permissions::PermissionAction;
pub use permissions::PermissionRule;
pub use permissions::PermissionRuleSet;
pub use permissions::is_sensitive_file;
pub use plan_approval::PlanApprovalReceiver;
pub use plan_approval::PlanApprovalRequest;
pub use plan_approval::PlanApprovalSender;
pub use plan_approval::PlanDecision;
pub use plan_approval::plan_approval_channel;
pub use sandbox::SandboxConfig;
pub use secrets::SecretKind;
pub use secrets::SecretMatch;
pub use secrets::detect_secrets;
pub use secrets::redact_secrets;
pub use session_status::SessionStatus;
pub use session_status::SessionStatusTracker;
pub use snapshot::SnapshotManager;
pub use sound::play_finish_sound;
pub use state_snapshot::AppStateSnapshot;
pub use state_snapshot::SnapshotPersistence;
pub use state_snapshot::ToolResultEntry;
pub use task_scheduler::TaskScheduler;
pub use tool_approval_channel::ToolApprovalDecision;
pub use tool_approval_channel::ToolApprovalReceiver;
pub use tool_approval_channel::ToolApprovalRequest;
pub use tool_approval_channel::ToolApprovalSender;
pub use tool_approval_channel::tool_approval_channel;
pub use tool_summarizer::build_background_result;
pub use tool_summarizer::safe_truncate;
pub use tool_summarizer::summarize_tool_result;

Modules§

action_summarizer
Action summarizer — create concise spinner text from LLM responses.
approval
Approval rules system for pattern-based command approval.
ask_user_channel
Ask-user channel types shared between tools and TUI.
constants
Shared constants for the approval system.
cost_tracker
Session-level cost tracking for LLM API usage.
custom_commands
Custom commands loaded from .opendev/commands/.
debug_logger
Per-session structured debug logger.
error_handler
Error handling and recovery for operations.
errors
Structured error types for OpenDev.
event_bus
Typed event bus for decoupled inter-component communication.
file_watcher
File watcher using the notify crate for native filesystem event detection.
gitignore
GitIgnore parser — filter files based on .gitignore patterns.
interrupt
Centralized interrupt/cancellation token for a single agent run.
lazy_init
Lazy initialization for expensive subsystems (#50).
permissions
Fine-grained permission rule set with glob-based matching and directory scoping.
plan_approval
Plan approval types shared between tools and TUI.
plan_index
Plan index manager for tracking plan-session-project associations.
plan_names
Generate unique plan names using adjective-verb-noun pattern.
sandbox
Sandbox mode for restricting tool operations.
secrets
Secret detection and redaction in tool outputs.
session_model
Per-session model configuration overlay.
session_status
Session status tracking for monitoring agent activity.
snapshot
Git-based snapshot system for reliable file change tracking and revert.
sound
Sound utility for task completion notifications.
state_snapshot
Application state snapshot for crash recovery (#97).
task_scheduler
Background task scheduler for deferred and periodic work (#95).
todo
Todo tracking for plan execution.
tool_approval_channel
Tool approval channel types shared between the react loop and TUI.
tool_summarizer
Tool result summarizer — creates concise summaries for LLM context.