pub struct TodoManager { /* private fields */ }Expand description
Todo 管理器:轻量级方向跟踪,单文件持久化
Implementations§
Source§impl TodoManager
impl TodoManager
pub fn new() -> Self
Sourcepub fn new_with_file_path(file_path: PathBuf) -> Self
pub fn new_with_file_path(file_path: PathBuf) -> Self
使用任意文件路径创建 TodoManager(用于 session / teammate / subagent 独立 todo 文件)
Sourcepub fn write_todos(
&self,
new_items: Vec<TodoItem>,
merge: bool,
) -> Result<Vec<TodoItem>, String>
pub fn write_todos( &self, new_items: Vec<TodoItem>, merge: bool, ) -> Result<Vec<TodoItem>, String>
写入 todos。merge=false 替换全部;merge=true 按 id 合并更新。 返回写入后的完整列表。
pub fn list_todos(&self) -> Vec<TodoItem>
pub fn has_todos(&self) -> bool
Sourcepub fn format_todos_summary(&self) -> String
pub fn format_todos_summary(&self) -> String
格式化当前 todos 为可读字符串(供 nag reminder 使用)
Sourcepub fn increment_turn(&self)
pub fn increment_turn(&self)
每轮 agent loop 调用,递增计数器
Sourcepub fn turns_since_last_call(&self) -> u32
pub fn turns_since_last_call(&self) -> u32
获取距离上次调用的轮数
Sourcepub fn replace_all(&self, new_items: Vec<TodoItem>)
pub fn replace_all(&self, new_items: Vec<TodoItem>)
替换所有 todos(session 恢复时使用)
Trait Implementations§
Source§impl Debug for TodoManager
impl Debug for TodoManager
Auto Trait Implementations§
impl !Freeze for TodoManager
impl RefUnwindSafe for TodoManager
impl Send for TodoManager
impl Sync for TodoManager
impl Unpin for TodoManager
impl UnsafeUnpin for TodoManager
impl UnwindSafe for TodoManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.