feat(#2569): DB-backed per-agent todo store + mcp.sock upsert/clear/list/mark-done ops

This commit is contained in:
damocles 2026-07-19 01:15:17 +02:00 committed by mara
commit 6685b33c9d
8 changed files with 505 additions and 0 deletions

View file

@ -16,6 +16,7 @@ use crate::container_view::{self, ContainerView};
use crate::dashboard_events::DashboardEvent;
use crate::operator_questions::OperatorQuestions;
use crate::socket_server::{self, AgentSocket};
use crate::todos::Todos;
/// Capacity of the dashboard event channel. Slow browser subscribers
/// (idle tab, throttled connection) drop frames past this — that's
@ -32,6 +33,11 @@ pub struct Coordinator {
pub broker: Arc<Broker>,
pub approvals: Arc<Approvals>,
pub questions: Arc<OperatorQuestions>,
/// Dynamic, subsystem-pushed todos (loose-ends v2, #2569). In-agent
/// subsystems (matrix, forge, bash) upsert/clear todos over mcp.sock
/// instead of firing wakes directly; `get_todos` merges these with
/// the computed static loose ends.
pub todos: Arc<Todos>,
/// Scheduled-prompts queue. One sqlite connection,
/// internal mutex; the worker drains due rows and the manager
/// handlers insert / cancel through the same handle.
@ -460,6 +466,7 @@ impl Coordinator {
let broker = Broker::open(db_path).context("open broker")?;
let approvals = Approvals::open(db_path).context("open approvals")?;
let questions = OperatorQuestions::open(db_path).context("open operator_questions")?;
let todos = Todos::open(db_path).context("open todos")?;
let scheduled_prompts = crate::scheduled_prompts::ScheduledPrompts::open(db_path)
.context("open scheduled_prompts")?;
// BuildLogs wants a directory (it picks its own `build_logs.sqlite`
@ -489,6 +496,7 @@ impl Coordinator {
broker: Arc::new(broker),
approvals: Arc::new(approvals),
questions: Arc::new(questions),
todos: Arc::new(todos),
scheduled_prompts: Arc::new(scheduled_prompts),
build_logs,
audit_log,