feat: Implement Plan-and-Reflect Autonomous Loop
This commit introduces a significant architectural enhancement to the Bytebot agent, moving it from a purely reactive model to a proactive, plan-driven autonomous system.
The core changes include:
-
PlannerService: A new service that uses an LLM to break down high-level user requests into a concrete, step-by-step plan.
-
ReflectorService: A new service that evaluates the outcome of each executed step. It determines if a step was successful, failed, or needs to be retried, enabling self-correction.
-
Plan-and-Execute Loop: The
AgentProcessorhas been refactored to orchestrate the new autonomous loop. It now generates a plan, executes it step-by-step, and reflects on each outcome to decide the next action. -
Database Schema: The
Taskmodel in the Prisma schema has been updated to store theplanand the currentplanStep, making the agent's state more robust and resumable. -
Testing:
- The Jest configuration has been fixed to work correctly in the monorepo environment.
- A new unit test for the
PlannerServicehas been added, which uncovered and led to a fix for a bug in handling empty LLM responses.
This new architecture provides a strong foundation for future autonomous capabilities, such as more advanced planning, memory, and self-optimization.