use crate::sessions::ExternalAgentSessionMigration; use std::path::PathBuf; #[derive(Debug, Clone, PartialEq, Eq)] pub struct ExternalAgentConfigDetectOptions { pub include_home: bool, pub include_memory: bool, pub cwds: Option>, } #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum ExternalAgentConfigMigrationItemType { Config, Skills, AgentsMd, Plugins, McpServerConfig, Subagents, Hooks, Commands, Memory, Sessions, } #[derive(Debug, Clone, PartialEq, Eq)] pub struct PluginsMigration { pub marketplace_name: String, pub plugin_names: Vec, } #[derive(Debug, Clone, PartialEq, Eq)] pub struct NamedMigration { pub name: String, } #[derive(Debug, Clone, Default, PartialEq, Eq)] pub struct MigrationDetails { pub plugins: Vec, pub skills: Vec, pub sessions: Vec, pub mcp_servers: Vec, pub hooks: Vec, pub subagents: Vec, pub commands: Vec, pub memory: Vec, } #[derive(Debug, Clone, PartialEq, Eq)] pub struct PendingPluginImport { pub cwd: Option, pub description: String, pub details: MigrationDetails, } #[derive(Debug, Clone, Default, PartialEq, Eq)] pub struct PluginImportOutcome { pub succeeded_marketplaces: Vec, pub succeeded_plugin_ids: Vec, pub failed_marketplaces: Vec, pub failed_plugin_ids: Vec, pub raw_errors: Vec, } #[derive(Debug, Clone, Default, PartialEq, Eq)] pub struct ExternalAgentConfigImportOutcome { pub pending_plugin_imports: Vec, pub item_results: Vec, } #[derive(Debug, Clone, PartialEq, Eq)] pub struct ExternalAgentConfigImportItemResult { pub item_type: ExternalAgentConfigMigrationItemType, pub description: String, pub cwd: Option, pub success_count: u32, pub error_count: u32, pub successes: Vec, pub raw_errors: Vec, } impl ExternalAgentConfigImportItemResult { pub fn new( item_type: ExternalAgentConfigMigrationItemType, description: String, cwd: Option, ) -> Self { Self { item_type, description, cwd, success_count: 0, error_count: 0, successes: Vec::new(), raw_errors: Vec::new(), } } pub fn record_error(&mut self, raw_error: ExternalAgentConfigImportRawError) { self.error_count = self.error_count.saturating_add(1); self.raw_errors.push(raw_error); } pub fn record_success(&mut self, source: Option, target: Option) { self.success_count = self.success_count.saturating_add(1); self.successes.push(ExternalAgentConfigImportSuccess { item_type: self.item_type, cwd: self.cwd.clone(), source, target, }); } } #[derive(Debug, Clone, PartialEq, Eq)] pub struct ExternalAgentConfigImportSuccess { pub item_type: ExternalAgentConfigMigrationItemType, pub cwd: Option, pub source: Option, pub target: Option, } #[derive(Debug, Clone, PartialEq, Eq)] pub struct ExternalAgentConfigImportRawError { pub item_type: ExternalAgentConfigMigrationItemType, pub error_type: Option, pub sub_error_type: Option, pub failure_stage: String, pub message: String, pub cwd: Option, pub source: Option, } #[derive(Debug, Clone, PartialEq, Eq)] pub struct ExternalAgentConfigMigrationItem { pub item_type: ExternalAgentConfigMigrationItemType, pub description: String, pub cwd: Option, pub details: Option, }