verbose live UI + tool-level SSE events + Groq default + regression tests
This commit is contained in:
37
api/plan/types.py
Normal file
37
api/plan/types.py
Normal file
@@ -0,0 +1,37 @@
|
||||
"""Public data shapes for the Plan layer."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Any
|
||||
|
||||
|
||||
@dataclass
|
||||
class PlanStep:
|
||||
analysis: str
|
||||
args: dict[str, Any] = field(default_factory=dict)
|
||||
why: str = ""
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, raw: dict[str, Any]) -> "PlanStep":
|
||||
return cls(
|
||||
analysis=raw["analysis"],
|
||||
args=raw.get("args") or {},
|
||||
why=raw.get("why", ""),
|
||||
)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
return {"analysis": self.analysis, "args": self.args, "why": self.why}
|
||||
|
||||
|
||||
@dataclass
|
||||
class Plan:
|
||||
rationale: str
|
||||
steps: list[PlanStep]
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, raw: dict[str, Any]) -> "Plan":
|
||||
return cls(
|
||||
rationale=raw.get("rationale", ""),
|
||||
steps=[PlanStep.from_dict(s) for s in raw.get("steps", [])],
|
||||
)
|
||||
Reference in New Issue
Block a user