mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-07-09 17:08:29 +00:00
Adds the always-enabled _goal plugin with per-chat goal storage, WebUI goal strip, /goal slash command, and agent-facing goal tools. Includes command-picker integration, focused plugin tests, and the generated 256x256 thumbnail asset.
31 lines
918 B
Python
31 lines
918 B
Python
from __future__ import annotations
|
|
|
|
from helpers.tool import Response, Tool
|
|
from plugins._goal.helpers import goals
|
|
|
|
|
|
class UpdateGoal(Tool):
|
|
async def execute(
|
|
self,
|
|
status: str = "",
|
|
objective: str = "",
|
|
note: str = "",
|
|
**kwargs,
|
|
) -> Response:
|
|
normalized_status = str(status or "").strip().lower()
|
|
if normalized_status not in {"complete", "blocked"}:
|
|
return Response(
|
|
message="Model-managed goal updates may only mark goals complete or blocked.",
|
|
break_loop=False,
|
|
)
|
|
|
|
goal = goals.update_goal(
|
|
self.agent.context.id,
|
|
status=normalized_status,
|
|
objective=objective if objective else None,
|
|
note=note if note else None,
|
|
)
|
|
return Response(
|
|
message=goals.summarize_goal(goal),
|
|
break_loop=False,
|
|
)
|