feat(engine): 提示词调用 + 执行者/门禁两模型 + 三种执行方式 + 版本号

改了什么
- 调 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 与泳道标题不动
This commit is contained in:
ning-inspire
2026-11-19 23:20:37 +08:00
parent 8d51331b45
commit 6388958a80
17 changed files with 1014 additions and 116 deletions

View File

@@ -2,15 +2,10 @@
from __future__ import annotations
import os
from typing import Any
from . import models
WORK_KINDS = ("action", "gate", "decision", "human_input", "milestone")
ACTORS = ("human", "master", "subagent")
REVIEW_PAIRS = (
("ba-write-spec", "ba-requirement-review"),
("dev-plan", "dev-plan-review"),
)
def node_map(graph: dict) -> dict:
@@ -162,17 +157,12 @@ def validate(graph: dict) -> tuple:
if stranded:
errors.append("这些节点从入口走不到:%s。覆盖可能把图切断了" % "、".join(stranded))
for writer_id, reviewer_id in REVIEW_PAIRS:
writer = by_id.get(writer_id)
reviewer = by_id.get(reviewer_id)
if not writer or not reviewer:
continue
left = _model_value(graph, writer)
right = _model_value(graph, reviewer)
if not left or not right:
warnings.append("未配置对抗模型:%s 与 %s 将沿用主会话模型" % (writer_id, reviewer_id))
elif left == right:
warnings.append("未做对抗验证:%s 与 %s 使用了同一个模型" % (writer_id, reviewer_id))
executor_model = models.model_of(graph, "executor")
gate_model = models.model_of(graph, "gate")
if not executor_model or not gate_model:
warnings.append("未配置模型:执行者或门禁没写 model,将沿用主会话模型")
elif executor_model == gate_model:
warnings.append("未做对抗验证:执行者与门禁用了同一个模型(%s)" % executor_model)
return errors, warnings
@@ -192,14 +182,3 @@ def _reachable(entry: str, edges: list) -> set:
if edge.get("from") == current:
stack.append(edge.get("to"))
return seen
def _model_value(graph: dict, node: dict) -> str:
key = node.get("model")
models = graph.get("models") or {}
if not key or key not in models:
return ""
spec: Any = models[key]
if isinstance(spec, dict) and spec.get("env"):
return os.environ.get(str(spec["env"]), "")
return str(spec)