Add a new task to the queue. Args: description: Task description dependencies: List of task IDs that must complete first Returns: Task ID
(self, description: str, dependencies: List[int] = None)
| 90 | ) |
| 91 | |
| 92 | def add_task(self, description: str, dependencies: List[int] = None) -> int: |
| 93 | """ |
| 94 | Add a new task to the queue. |
| 95 | |
| 96 | Args: |
| 97 | description: Task description |
| 98 | dependencies: List of task IDs that must complete first |
| 99 | |
| 100 | Returns: |
| 101 | Task ID |
| 102 | """ |
| 103 | # Add to database |
| 104 | task_id = self.state.add_task(description) |
| 105 | |
| 106 | # Update with dependencies if any |
| 107 | if dependencies: |
| 108 | self._update_task_dependencies(task_id, dependencies) |
| 109 | |
| 110 | # Create local task object |
| 111 | task = Task( |
| 112 | id=task_id, |
| 113 | description=description, |
| 114 | status=TaskStatus.PENDING, |
| 115 | dependencies=dependencies or [], |
| 116 | created_at=int(time.time()), |
| 117 | ) |
| 118 | self._tasks[task_id] = task |
| 119 | |
| 120 | info(f"Planner: added task {task_id}: {description[:50]}...") |
| 121 | |
| 122 | # Log in episodic memory |
| 123 | self.state.log_action("task_planned", description[:200]) |
| 124 | |
| 125 | return task_id |
| 126 | |
| 127 | def add_tasks(self, descriptions: List[str]) -> List[int]: |
| 128 | """ |
no test coverage detected