feat(agent): Wave 3 strategic coupling (G5/G6) #6
|
|
@ -56,6 +56,8 @@ class AdvancePhaseTool(Tool):
|
|||
self._engine = engine
|
||||
|
||||
async def execute(self, **kwargs) -> dict[str, Any]:
|
||||
# Capture previous phase before transition (engine is single-threaded per request).
|
||||
previous = self._engine.current_phase
|
||||
new_phase = self._engine.advance_phase()
|
||||
if new_phase is None:
|
||||
# Either no policy set, or already at DELIVERY.
|
||||
|
|
@ -74,26 +76,7 @@ class AdvancePhaseTool(Tool):
|
|||
}
|
||||
return {
|
||||
"is_error": False,
|
||||
"previous_phase": self._previous_value(new_phase),
|
||||
"previous_phase": previous.value if previous else "",
|
||||
"current_phase": new_phase.value,
|
||||
"message": f"Phase advanced to {new_phase.value}.",
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
def _previous_value(current: Any) -> str:
|
||||
"""Return the previous phase value (for telemetry/UI)."""
|
||||
from agentkit.core.phase import PhaseState
|
||||
|
||||
order = [
|
||||
PhaseState.PLANNING,
|
||||
PhaseState.BUILDING,
|
||||
PhaseState.VERIFICATION,
|
||||
PhaseState.DELIVERY,
|
||||
]
|
||||
try:
|
||||
idx = order.index(current)
|
||||
except ValueError:
|
||||
return ""
|
||||
if idx == 0:
|
||||
return ""
|
||||
return order[idx - 1].value
|
||||
|
|
|
|||
Loading…
Reference in New Issue