Fix: behaviors.py import Task → PrimaryTask for new task_queue
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
1c8e2a7c90
commit
5297ac664a
1 changed files with 14 additions and 24 deletions
|
|
@ -14,7 +14,7 @@ import random
|
|||
import time
|
||||
from typing import Optional
|
||||
|
||||
from dougbot.core.task_queue import Task, Priority
|
||||
from dougbot.core.task_queue import PrimaryTask, SubTask, Priority, make_task
|
||||
from dougbot.utils.logging import get_logger
|
||||
|
||||
log = get_logger("core.behaviors")
|
||||
|
|
@ -278,37 +278,27 @@ class GoalManager:
|
|||
active.sort(key=lambda g: g["priority"], reverse=True)
|
||||
return active[0]
|
||||
|
||||
def get_next_step(self, goal: dict, behaviors, memory) -> Task | None:
|
||||
"""Get the next task from a goal's step list."""
|
||||
def get_next_step(self, goal: dict, behaviors, memory):
|
||||
"""Get the next step from a goal. Returns object with name/action/params/description/timeout."""
|
||||
if goal["current_step"] >= len(goal["steps"]):
|
||||
return None # All steps done
|
||||
return None
|
||||
|
||||
step = goal["steps"][goal["current_step"]]
|
||||
goal["current_step"] += 1
|
||||
|
||||
# Build the task from the step
|
||||
params = dict(step["params"])
|
||||
params.update(goal.get("extra_params", {}))
|
||||
|
||||
# For find_blocks, we need a callback to process the result
|
||||
if step["action"] == "find_blocks":
|
||||
return Task(
|
||||
name=f"goal_{goal['name']}_find",
|
||||
priority=Priority.NORMAL,
|
||||
action=step["action"],
|
||||
params=params,
|
||||
description=step["description"],
|
||||
timeout=15,
|
||||
)
|
||||
|
||||
return Task(
|
||||
name=f"goal_{goal['name']}_step{goal['current_step']}",
|
||||
priority=Priority.NORMAL,
|
||||
action=step["action"],
|
||||
params=params,
|
||||
description=step["description"],
|
||||
timeout=20,
|
||||
)
|
||||
# Return a simple namespace with the fields the brain expects
|
||||
class StepInfo:
|
||||
pass
|
||||
info = StepInfo()
|
||||
info.name = f"goal_{goal['name']}_step{goal['current_step']}"
|
||||
info.action = step["action"]
|
||||
info.params = params
|
||||
info.description = step["description"]
|
||||
info.timeout = 20
|
||||
return info
|
||||
|
||||
def complete_goal(self, name: str):
|
||||
"""Mark a goal as complete."""
|
||||
|
|
|
|||
Loading…
Reference in a new issue