sync snapshot from LAN repo (source codex/merge-tjlnew-classic-retrieval-20261019 @ ded012d9)
This commit is contained in:
1 parent
ea9dcff9c0
commit
c753e6c9b5
818 files changed
+14037
-108991
No files matched your search
@@ -124,35 +124,23 @@ _SEED_FILES: tuple[str, ...] = ("config.yaml", "SOUL.md")
|
||||
_ACTION_PLAN_SKILL = "position-roundtable-action-create"
|
||||
|
||||
|
||||
def _ensure_action_plan_contract(agent_dir: Path) -> bool:
|
||||
"""Refresh the action-type contract and retain the batch-create skill binding.
|
||||
def _ensure_action_plan_skill(agent_dir: Path) -> bool:
|
||||
"""Merge the owned batch-create Skill into an existing action planner.
|
||||
|
||||
``actionType`` changed from a task-system enum to a model-derived name. An
|
||||
already seeded planner must receive this contract update; otherwise its
|
||||
persisted SOUL would continue to require frontend ``dictValue`` input after
|
||||
a deployment. Other optional skills on a deployed agent are preserved.
|
||||
The planner SOUL remains editable in the agent configuration drawer and is
|
||||
therefore never overwritten here. The skill binding, however, is a runtime
|
||||
integration contract: without it an already-deployed planner cannot read
|
||||
the new SKILL.md or invoke the batch API script after a code upgrade.
|
||||
"""
|
||||
changed = False
|
||||
source_soul = _ASSETS_DIR / ACTION_PLAN_AGENT_ID / "SOUL.md"
|
||||
target_soul = agent_dir / "SOUL.md"
|
||||
try:
|
||||
source_bytes = source_soul.read_bytes()
|
||||
if not target_soul.exists() or target_soul.read_bytes() != source_bytes:
|
||||
target_soul.write_bytes(source_bytes)
|
||||
changed = True
|
||||
except OSError:
|
||||
logger.warning("Unable to refresh action planner contract: %s", target_soul)
|
||||
return changed
|
||||
|
||||
config_path = agent_dir / "config.yaml"
|
||||
try:
|
||||
config = yaml.safe_load(config_path.read_text(encoding="utf-8")) if config_path.exists() else {}
|
||||
except (OSError, yaml.YAMLError):
|
||||
logger.warning("Unable to read action planner config for skill binding: %s", config_path)
|
||||
return changed
|
||||
return False
|
||||
if not isinstance(config, dict):
|
||||
logger.warning("Action planner config is not a mapping; skip skill binding: %s", config_path)
|
||||
return changed
|
||||
return False
|
||||
skills = config.get("skills")
|
||||
if skills is None:
|
||||
normalized: list[str] = []
|
||||
@@ -160,9 +148,9 @@ def _ensure_action_plan_contract(agent_dir: Path) -> bool:
|
||||
normalized = [str(name).strip() for name in skills if str(name).strip()]
|
||||
else:
|
||||
logger.warning("Action planner skills is not a list; skip skill binding: %s", config_path)
|
||||
return changed
|
||||
return False
|
||||
if _ACTION_PLAN_SKILL in normalized:
|
||||
return changed
|
||||
return False
|
||||
|
||||
config["skills"] = [*normalized, _ACTION_PLAN_SKILL]
|
||||
try:
|
||||
@@ -172,7 +160,7 @@ def _ensure_action_plan_contract(agent_dir: Path) -> bool:
|
||||
)
|
||||
except OSError:
|
||||
logger.warning("Unable to write action planner skill binding: %s", config_path)
|
||||
return changed
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
@@ -180,11 +168,10 @@ def _ensure_one(agent_id: str) -> bool:
|
||||
"""Copy the verified SOUL.md + config.yaml for one functional agent into
|
||||
``.deer-flow/agents/<id>/`` if that directory is missing.
|
||||
|
||||
The position-roundtable intent agent and action planner are implementation-
|
||||
owned compatibility contracts: unlike user-managed agents, their required
|
||||
prompts must stay aligned with the position workspace. Their affected seed
|
||||
files are therefore refreshed when they differ, so a previously seeded
|
||||
incorrect prompt is repaired after deployment.
|
||||
The position-roundtable intent agent is an implementation-owned compatibility
|
||||
contract: unlike user-managed agents, its schema must stay aligned with the
|
||||
position workspace. Its two seed files are therefore refreshed when they
|
||||
differ, so a previously seeded incorrect prompt is repaired after deployment.
|
||||
|
||||
Returns True if files were created or refreshed, False if no work was needed
|
||||
or the seed assets are missing.
|
||||
@@ -203,7 +190,7 @@ def _ensure_one(agent_id: str) -> bool:
|
||||
agent_dir = get_paths().agent_dir(agent_id)
|
||||
if agent_dir.exists():
|
||||
if agent_id == ACTION_PLAN_AGENT_ID:
|
||||
return _ensure_action_plan_contract(agent_dir)
|
||||
return _ensure_action_plan_skill(agent_dir)
|
||||
if agent_id not in {POSITION_INTENT_AGENT_ID, REPORT_COLLABORATION_INTENT_AGENT_ID}:
|
||||
# Other built-in agents may have been tuned on a deployed machine;
|
||||
# preserve the long-standing no-overwrite behavior for them.
|
||||
|
||||
Reference in new issue
Block a user