Files
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

72 lines
4.3 KiB
HTML
Raw Permalink 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>Services 模块蓝图</title><link rel="stylesheet" href="blueprint.css"></head>
<body><main class="page">
<header class="topbar"><h1>Services</h1><p>Services 是产品用例编排层。它不实现底层 tool loop但决定什么时候进入 Task、什么时候跑通知、什么时候创建 team、什么时候记录用户验收和学习候选。</p></header>
<nav class="nav"><a href="index.html">索引</a><a href="tasks.html">Tasks</a><a href="engine.html">Engine</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>接口调用</strong>chat / cron / acceptance / skill admin</div><div class="arrow">-&gt;</div>
<div class="step"><strong>AgentService</strong>路由 simple vs Task</div><div class="arrow">-&gt;</div>
<div class="step"><strong>Task 编排</strong>planner、team、main run、evidence</div><div class="arrow">-&gt;</div>
<div class="step"><strong>状态落盘</strong>session events、task store、run memory、skill learning</div>
</div>
<h2>小模块拆分</h2>
<article class="module">
<h3>AgentService</h3>
<p>核心服务。普通消息先由 MainAgentRouter 分类simple chat 关闭 skill/tool 装配直接跑Task 模式创建或复用 TaskRecord计划 single/team运行主 agent记录 evidence并等待用户验收。</p>
<div class="subflow">
<div>输入 message + session kwargs创建 provider bundle。</div>
<div>调用 Intent Agent得到 simple_chat / continue_task / revise_task / new_task / close_task / abandon_task。</div>
<div>Task 模式中调用 TaskExecutionPlanner必要时先跑 TeamGraphScheduler。</div>
<div>主 AgentLoop 执行后构建 evidence packetevidence 只记录事实,不判断结果质量。</div>
<div>run 完成后进入 awaiting_acceptance用户 accept/revise/abandon 决定后续状态。</div>
</div>
<p>Prompt 相关AgentService 组装 Task skill selection context、team execution context、scheduled execution context详细见 <a href="prompt-atlas.html#agent-service-contexts">Prompt Atlas</a></p>
</article>
<article class="module">
<h3>CronService</h3>
<p>管理定时任务的创建、启停、触发、run history。CronService 负责调度状态;真正生成内容时调用 AgentService 的 scheduled task 或 notification 路径。</p>
<div class="subflow">
<div>保存 CronJob 配置和 payload。</div>
<div>到点创建 CronRunRecord。</div>
<div>调用 AgentService 执行 notification 或 Task。</div>
<div>回写 output/error/task_id/run_id。</div>
</div>
<div class="callout">核对点:<code>run_scheduled_task()</code> 当前末尾引用未定义 <code>job</code>/<code>run</code>,应改为函数入参。</div>
</article>
<article class="module">
<h3>TeamService</h3>
<p>提供 team graph 的产品级封装。底层执行在 coordinatorService 层关心的是把执行结果转成 API 友好的结构。</p>
<div class="subflow">
<div>接收 graph / nodes / strategy。</div>
<div>创建 TeamGraphScheduler 和 LocalAgentRunner。</div>
<div>返回 node results、run ids、success/error。</div>
</div>
</article>
<article class="module">
<h3>MemoryService 与 SessionProcessProjector</h3>
<p>MemoryService 给每个 run 捕获 frozen curated memory snapshotSessionProcessProjector 把 session 事件投影成 UI 所需的过程视图。</p>
<div class="subflow">
<div>run 开始前捕获 memory snapshot避免运行中写入导致 prompt 漂移。</div>
<div>session event 记录完整过程。</div>
<div>projector 从事件流还原步骤、工具、evidence 和用户验收状态。</div>
</div>
</article>
<article class="module">
<h3>SkillHubService</h3>
<p>面向产品的 skill 草稿、审核、发布、学习候选接口。底层由 skills/drafts/reviews/publisher/learning 实现。</p>
<div class="subflow">
<div>列出 learning candidates 或 drafts。</div>
<div>触发 draft synthesis / review。</div>
<div>人工确认后发布为 published skill。</div>
</div>
</article>
</section></main></body></html>