Complete implementation across all 13 phases: - vault-core: types, YAML frontmatter parsing, entity classification, filesystem ops, config, prompt composition, validation, search - vault-watch: filesystem watcher with daemon write filtering, event classification - vault-scheduler: cron engine, process executor, task runner with retry logic and concurrency limiting - vault-api: Axum REST API (15 route modules), WebSocket with broadcast, AI assistant proxy, validation, templates - Dashboard: React + TypeScript + Tailwind v4 with kanban, CodeMirror editor, dynamic view system, AI chat sidebar - Nix flake with dev shell and NixOS module - Graceful shutdown, inotify overflow recovery, tracing instrumentation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
108 lines
3.8 KiB
Rust
108 lines
3.8 KiB
Rust
use std::path::PathBuf;
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub enum VaultEvent {
|
|
AgentCreated(PathBuf),
|
|
AgentModified(PathBuf),
|
|
AgentDeleted(PathBuf),
|
|
|
|
SkillCreated(PathBuf),
|
|
SkillModified(PathBuf),
|
|
SkillDeleted(PathBuf),
|
|
|
|
CronCreated(PathBuf),
|
|
CronModified(PathBuf),
|
|
CronDeleted(PathBuf),
|
|
CronMoved { from: PathBuf, to: PathBuf },
|
|
|
|
HumanTaskCreated(PathBuf),
|
|
HumanTaskModified(PathBuf),
|
|
HumanTaskMoved { from: PathBuf, to: PathBuf },
|
|
HumanTaskDeleted(PathBuf),
|
|
|
|
AgentTaskCreated(PathBuf),
|
|
AgentTaskModified(PathBuf),
|
|
AgentTaskMoved { from: PathBuf, to: PathBuf },
|
|
AgentTaskDeleted(PathBuf),
|
|
|
|
KnowledgeCreated(PathBuf),
|
|
KnowledgeModified(PathBuf),
|
|
KnowledgeDeleted(PathBuf),
|
|
|
|
ViewCreated(PathBuf),
|
|
ViewModified(PathBuf),
|
|
ViewDeleted(PathBuf),
|
|
|
|
NotificationCreated(PathBuf),
|
|
NotificationExpired(PathBuf),
|
|
|
|
FileChanged(PathBuf),
|
|
}
|
|
|
|
impl VaultEvent {
|
|
/// Get the primary path associated with this event.
|
|
pub fn path(&self) -> &PathBuf {
|
|
match self {
|
|
Self::AgentCreated(p)
|
|
| Self::AgentModified(p)
|
|
| Self::AgentDeleted(p)
|
|
| Self::SkillCreated(p)
|
|
| Self::SkillModified(p)
|
|
| Self::SkillDeleted(p)
|
|
| Self::CronCreated(p)
|
|
| Self::CronModified(p)
|
|
| Self::CronDeleted(p)
|
|
| Self::HumanTaskCreated(p)
|
|
| Self::HumanTaskModified(p)
|
|
| Self::HumanTaskDeleted(p)
|
|
| Self::AgentTaskCreated(p)
|
|
| Self::AgentTaskModified(p)
|
|
| Self::AgentTaskDeleted(p)
|
|
| Self::KnowledgeCreated(p)
|
|
| Self::KnowledgeModified(p)
|
|
| Self::KnowledgeDeleted(p)
|
|
| Self::ViewCreated(p)
|
|
| Self::ViewModified(p)
|
|
| Self::ViewDeleted(p)
|
|
| Self::NotificationCreated(p)
|
|
| Self::NotificationExpired(p)
|
|
| Self::FileChanged(p) => p,
|
|
Self::CronMoved { to, .. }
|
|
| Self::HumanTaskMoved { to, .. }
|
|
| Self::AgentTaskMoved { to, .. } => to,
|
|
}
|
|
}
|
|
|
|
/// Return a string event type name for serialization.
|
|
pub fn event_type(&self) -> &'static str {
|
|
match self {
|
|
Self::AgentCreated(_) => "agent_created",
|
|
Self::AgentModified(_) => "agent_modified",
|
|
Self::AgentDeleted(_) => "agent_deleted",
|
|
Self::SkillCreated(_) => "skill_created",
|
|
Self::SkillModified(_) => "skill_modified",
|
|
Self::SkillDeleted(_) => "skill_deleted",
|
|
Self::CronCreated(_) => "cron_created",
|
|
Self::CronModified(_) => "cron_modified",
|
|
Self::CronDeleted(_) => "cron_deleted",
|
|
Self::CronMoved { .. } => "cron_moved",
|
|
Self::HumanTaskCreated(_) => "human_task_created",
|
|
Self::HumanTaskModified(_) => "human_task_modified",
|
|
Self::HumanTaskMoved { .. } => "human_task_moved",
|
|
Self::HumanTaskDeleted(_) => "human_task_deleted",
|
|
Self::AgentTaskCreated(_) => "agent_task_created",
|
|
Self::AgentTaskModified(_) => "agent_task_modified",
|
|
Self::AgentTaskMoved { .. } => "agent_task_moved",
|
|
Self::AgentTaskDeleted(_) => "agent_task_deleted",
|
|
Self::KnowledgeCreated(_) => "knowledge_created",
|
|
Self::KnowledgeModified(_) => "knowledge_modified",
|
|
Self::KnowledgeDeleted(_) => "knowledge_deleted",
|
|
Self::ViewCreated(_) => "view_created",
|
|
Self::ViewModified(_) => "view_modified",
|
|
Self::ViewDeleted(_) => "view_deleted",
|
|
Self::NotificationCreated(_) => "notification_created",
|
|
Self::NotificationExpired(_) => "notification_expired",
|
|
Self::FileChanged(_) => "file_changed",
|
|
}
|
|
}
|
|
}
|