Class: SwarmSDK::Tools::Stores::TodoManager
- Inherits:
-
Object
- Object
- SwarmSDK::Tools::Stores::TodoManager
- Defined in:
- lib/swarm_sdk/tools/stores/todo_manager.rb
Overview
TodoManager provides per-agent todo list storage
Each agent maintains its own independent todo list that persists throughout the agent's execution session. This allows agents to track progress on complex multi-step tasks.
Class Method Summary collapse
-
.clear_all ⇒ Object
Clear all todos for all agents.
-
.clear_todos(agent_id) ⇒ Object
Clear all todos for an agent.
-
.get_todos(agent_id) ⇒ Array<Hash>
Get the current todo list for an agent.
-
.set_todos(agent_id, todos) ⇒ Array<Hash>
Set the todo list for an agent.
-
.summary ⇒ Hash
Get summary of all agent todo lists.
Class Method Details
.clear_all ⇒ Object
Clear all todos for all agents
47 48 49 50 51 |
# File 'lib/swarm_sdk/tools/stores/todo_manager.rb', line 47 def clear_all @mutex.synchronize do @storage.clear end end |
.clear_todos(agent_id) ⇒ Object
Clear all todos for an agent
40 41 42 43 44 |
# File 'lib/swarm_sdk/tools/stores/todo_manager.rb', line 40 def clear_todos(agent_id) @mutex.synchronize do @storage.delete(agent_id.to_sym) end end |
.get_todos(agent_id) ⇒ Array<Hash>
Get the current todo list for an agent
20 21 22 23 24 |
# File 'lib/swarm_sdk/tools/stores/todo_manager.rb', line 20 def get_todos(agent_id) @mutex.synchronize do @storage[agent_id.to_sym] ||= [] end end |
.set_todos(agent_id, todos) ⇒ Array<Hash>
Set the todo list for an agent
31 32 33 34 35 |
# File 'lib/swarm_sdk/tools/stores/todo_manager.rb', line 31 def set_todos(agent_id, todos) @mutex.synchronize do @storage[agent_id.to_sym] = todos end end |
.summary ⇒ Hash
Get summary of all agent todo lists
56 57 58 59 60 |
# File 'lib/swarm_sdk/tools/stores/todo_manager.rb', line 56 def summary @mutex.synchronize do @storage.transform_values(&:size) end end |