Files
beaver_project/projcet_review/backend_blueprint/tasks.html
steven_li 6e9e74d1ee feat(engine): 添加运行时上下文支持并重构工具迭代限制
添加 RuntimeContext 类用于捕获模型运行时的日期时间信息,
包括UTC时间、本地时间和时区信息,并在系统提示中显示这些信息。

同时增加最大上下文消息数和工具迭代次数的配置选项,
将验证服务从引擎加载器中移除,并更新相关的数据结构和接口。

BREAKING CHANGE: 移除了验证服务,相关字段被替换为证据状态和接受状态。

- 添加 RuntimeContext 类和相关渲染方法
- 增加 max_context_messages 和 max_tool_iterations 配置
- 移除 ValidationService 相关代码
- 更新消息记录中的验证状态字段
- 添加原始工具调用检测和回退处理
2026-05-26 11:18:35 +08:00

75 lines
4.7 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!doctype html>
<html lang="zh-CN">
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Tasks 模块蓝图</title><link rel="stylesheet" href="blueprint.css"></head>
<body><main class="page">
<header class="topbar"><h1>Tasks</h1><p>Tasks 模块把“需要执行和跟踪”的用户请求从普通聊天中拆出来,形成有状态的内部任务。它包含路由、计划、技能解析、事实证据、用户验收和 task store。</p></header>
<nav class="nav"><a href="index.html">索引</a><a href="services.html">Services</a><a href="coordinator.html">Coordinator</a><a href="prompt-atlas.html">Prompt Atlas</a></nav>
<section class="content">
<h2>大模块流程</h2>
<div class="flow">
<div class="step"><strong>Router</strong>simple/task/revise/new/close</div><div class="arrow">-&gt;</div>
<div class="step"><strong>TaskRecord</strong>创建或复用 open task</div><div class="arrow">-&gt;</div>
<div class="step"><strong>Planner</strong>single 或 team graph</div><div class="arrow">-&gt;</div>
<div class="step"><strong>Run</strong>team + main AgentLoop</div><div class="arrow">-&gt;</div>
<div class="step"><strong>Evidence</strong>事实记录,不判断</div><div class="arrow">-&gt;</div>
<div class="step"><strong>User Acceptance</strong>accept/revise/abandon</div>
</div>
<h2>小模块拆分</h2>
<article class="module">
<h3>models / store / service</h3>
<p><code>TaskRecord</code> 保存 task_id、session_id、description、goal、status、run_ids、acceptance history、metadata。TaskService 提供 create/start/complete/acceptance/close/abandon 等状态操作。</p>
<div class="subflow">
<div>router 决定进入 Task 后创建或复用 active task。</div>
<div>每次 attempt 调用 start_run 记录 user_message 和 attempt_index。</div>
<div>run 完成后构建 TaskEvidencePacket状态进入 awaiting_acceptance。</div>
<div>用户验收后进入 closedaccepted、needs_revision 或 abandoned。</div>
</div>
</article>
<article class="module">
<h3>MainAgentRouter</h3>
<p>独立 LLM 调用,只负责路由,不回答用户。输入 active task 摘要、最近对话、当前 message 和 intent-agent skill guidance输出紧凑 JSON。</p>
<div class="subflow">
<div>provider 不可用时 fallback有 active task 则 continue_task否则 simple_chat。</div>
<div>system message 约束“只路由、不解释、只 JSON”。</div>
<div>user prompt 包含 actions、critical policy、active task、recent conversation、current message。</div>
<div>解析 action映射成 MainAgentDecision。</div>
</div>
<p>详细 prompt 字段见 <a href="prompt-atlas.html#intent-router">Prompt Atlas</a></p>
</article>
<article class="module">
<h3>TaskExecutionPlanner</h3>
<p>决定当前 attempt 是单 agent 还是先跑小 team。它要求模型返回 JSON schemamode、reason、strategy、nodes、final_synthesis_instruction。</p>
<div class="subflow">
<div>选择 auxiliary/main provider。</div>
<div>输入 task goal、当前用户请求、attempt index 和必要的 task history。</div>
<div>如果 team解析 nodes 为 ExecutionGraph 并 validate。</div>
<div>调用 TaskSkillResolver 为 team node 绑定 published skills 或 ephemeral guidance。</div>
</div>
</article>
<article class="module">
<h3>TaskSkillResolver</h3>
<p>给 planner 生成的泛型 team node 解析能力来源:先 embedding 召回 published skills再让 LLM 从候选中选;没有匹配则生成一次性 ephemeral guidance。</p>
<div class="subflow">
<div>构造 queryskill_query、node.task、required_capabilities、task.goal、user_message。</div>
<div>embedding top-8 召回候选 skill。</div>
<div>LLM 返回候选 skill name JSON array。</div>
<div>若为空EphemeralGuidanceSynthesizer 生成临时 SkillContext 注入 node。</div>
</div>
</article>
<article class="module">
<h3>EvidenceBuilder / User Acceptance</h3>
<p>EvidenceBuilder 从 session 中提取 run evidence、tool summaries、team node results。Evidence 只记录事实,不判断、不打分、不 gate也不生成 revision promptTask 是否完成只由用户验收决定。</p>
<div class="subflow">
<div>主 run 完成后收集 assistant output、tool result、team result。</div>
<div>渲染 evidence packet 文本,用于审计、展示和后续 skill learning。</div>
<div>用户 accept 后关闭 task并把整个 task 的所有 runs 标记为 Accepted Task Evidence。</div>
<div>用户 revise 时只把 revision message 和必要 task history 带入下一轮执行,不把整包 evidence 自动塞进 prompt。</div>
</div>
</article>
</section></main></body></html>