refactor(memory): rename workflow.target -> params, type -> name
The Workflow STM component stored an active workflow as
{type, target, stage, started_at}. Now that start_workflow takes a
workflow_name and a params dict, those keys match what they actually
hold:
type -> name (the YAML workflow name, e.g. media.organize_media)
target -> params (the dict passed to start_workflow)
ShortTermMemory.start_workflow parameters renamed accordingly. All
consumers (prompt builder workflow scope + STM context, start/end
workflow tools) updated.
This commit is contained in:
@@ -39,7 +39,7 @@ class PromptBuilder:
|
||||
current = memory.stm.workflow.current
|
||||
if current is None:
|
||||
return None
|
||||
return self.workflow_loader.get(current.get("type"))
|
||||
return self.workflow_loader.get(current.get("name"))
|
||||
|
||||
def visible_tool_names(self) -> list[str]:
|
||||
"""
|
||||
@@ -149,12 +149,12 @@ EXPRESSIONS À UTILISER (une par situation, naturellement intégrées dans ta r
|
||||
|
||||
current = memory.stm.workflow.current or {}
|
||||
lines = [
|
||||
f"WORKFLOW SCOPE: active — {current.get('type')} "
|
||||
f"WORKFLOW SCOPE: active — {current.get('name')} "
|
||||
f"(stage: {current.get('stage')})",
|
||||
]
|
||||
target = current.get("target")
|
||||
if target:
|
||||
lines.append(f" Params: {target}")
|
||||
params = current.get("params")
|
||||
if params:
|
||||
lines.append(f" Params: {params}")
|
||||
wf_desc = (workflow.get("description") or "").strip()
|
||||
if wf_desc:
|
||||
lines.append(f" Goal: {wf_desc}")
|
||||
@@ -220,10 +220,10 @@ EXPRESSIONS À UTILISER (une par situation, naturellement intégrées dans ta r
|
||||
if memory.stm.current_workflow:
|
||||
workflow = memory.stm.current_workflow
|
||||
lines.append(
|
||||
f"CURRENT WORKFLOW: {workflow.get('type')} (stage: {workflow.get('stage')})"
|
||||
f"CURRENT WORKFLOW: {workflow.get('name')} (stage: {workflow.get('stage')})"
|
||||
)
|
||||
if workflow.get("target"):
|
||||
lines.append(f" Target: {workflow.get('target')}")
|
||||
if workflow.get("params"):
|
||||
lines.append(f" Params: {workflow.get('params')}")
|
||||
|
||||
if memory.stm.current_topic:
|
||||
lines.append(f"CURRENT TOPIC: {memory.stm.current_topic}")
|
||||
|
||||
@@ -44,10 +44,10 @@ def start_workflow(workflow_name: str, params: dict) -> dict[str, Any]:
|
||||
"status": "error",
|
||||
"error": "workflow_already_active",
|
||||
"message": (
|
||||
f"Workflow '{current.get('type')}' is already active. "
|
||||
f"Workflow '{current.get('name')}' is already active. "
|
||||
"Call end_workflow before starting a new one."
|
||||
),
|
||||
"active_workflow": current.get("type"),
|
||||
"active_workflow": current.get("name"),
|
||||
}
|
||||
|
||||
memory.stm.start_workflow(workflow_name, params or {})
|
||||
@@ -74,7 +74,7 @@ def end_workflow(reason: str) -> dict[str, Any]:
|
||||
"message": "No workflow is currently active.",
|
||||
}
|
||||
|
||||
workflow_name = current.get("type")
|
||||
workflow_name = current.get("name")
|
||||
memory.stm.end_workflow()
|
||||
memory.save()
|
||||
logger.info(f"end_workflow: '{workflow_name}' reason={reason!r}")
|
||||
|
||||
Reference in New Issue
Block a user