改了什么 - 调 agent 不再拼 --skill/--node/--task:skill 名与 SKILL.md 相对路径写进提示词, 子进程 cwd 改成目标项目根(原来在引擎目录,相对路径找不到) - 模型收到图级 models:executor / gate,按节点 kind 自动分配,环境变量可覆盖; 删掉 13 处节点级 model:,对抗验证检查简化为「两个模型是否相同」 - run 启动三选一:会话内开子 agent(默认)/ 只用主会话(--solo)/ 独立 agent(--agent); 三个入口互斥,选独立 agent 不给 --agent 直接报错 - 新增 --version 与 version.py(0.2.0)、CHANGELOG.md;decisions.jsonl 首行记引擎版本 - install.sh 读目标项目的 version.py 并与本预设对比,不一致直接提示(预设与引擎必须成对升级) 为什么 - 真实 CLI 没有认 --skill 的,改成提示词后不用再为每个 CLI 写包装脚本 - 执行者与门禁两个模型做对抗验证,图里一处配完,节点不再重复声明 - 当前会话能开子 agent 时不必拉进程,少一层进程边界 怎么验证的 - 单元测试 25 → 46,全绿(python3 agents-workflow-engine/tests/test_units.py) - ./.agents/verify.sh 全部通过(72 项),166 条相对链接有效 - 假 agent 真跑:argv 为 -q --model <模型> <提示词>、pwd 等于项目根、 执行者 10 次 / 门禁 2 次;--solo 真跑一遍核对 prompts.md 抬头与话术 文档同步检查 - 已更新:agents-workflow-engine/README.md、CHANGELOG.md、AGENTS.md(§8 §10 §12 §13)、 .agents/plan 三份记录(agent-protocol / default-session-subagent / version) - 不涉及:agile-team-sdd、catalog.json、placeholders.md;graph.html 与泳道标题不动
38 lines
1.2 KiB
Python
38 lines
1.2 KiB
Python
"""两个模型:执行者管 action,门禁管 gate。配在图里,可被环境变量覆盖。"""
|
||
|
||
from __future__ import annotations
|
||
|
||
import os
|
||
from typing import Tuple
|
||
|
||
ROLES = ("executor", "gate")
|
||
|
||
|
||
def role_of(node: dict) -> str:
|
||
"""门禁节点用门禁模型,其余用执行者模型。节点写了角色名时以它为准。"""
|
||
key = node.get("model")
|
||
if key in ROLES:
|
||
return str(key)
|
||
return "gate" if node.get("kind") == "gate" else "executor"
|
||
|
||
|
||
def model_of(graph: dict, role: str) -> str:
|
||
"""取角色模型:环境变量有值优先,其次图里写的 model。"""
|
||
spec = (graph.get("models") or {}).get(role)
|
||
if isinstance(spec, dict):
|
||
env = spec.get("env")
|
||
if env and os.environ.get(str(env)):
|
||
return str(os.environ[str(env)])
|
||
return str(spec.get("model") or "")
|
||
if isinstance(spec, str):
|
||
return spec
|
||
return ""
|
||
|
||
|
||
def resolve(graph: dict, node: dict, master: str) -> Tuple[str, str]:
|
||
"""返回 (角色, 模型)。节点里写了具体模型名时直接用它。"""
|
||
literal = node.get("model")
|
||
role = role_of(node)
|
||
if literal and literal not in ROLES:
|
||
return role, str(literal)
|
||
return role, model_of(graph, role) or master |