feat: add scoped history and artifacts
This commit is contained in:
@@ -180,7 +180,7 @@
|
||||
"description": "只读查询与受控分析通过原生 MCP 发现和调用;第一方 mcp_tjwater 由宿主提供,管理员外部连接单独配置。分析不操作现场设备,工具目录不授予业务权限,不恢复旧查询插件或 HTTP 查询执行桥。",
|
||||
"first_party": {
|
||||
"server": "mcp_tjwater",
|
||||
"description": "6 项宿主查询加 35 项产品工具,其中产品工具含 25 项查询与 10 项受控分析,完整目录合计 41 项。各角色按白名单缩减,Server 产品目录须与 Agent 预期完全匹配才可启用。原生工具 ID 使用 mcp_tjwater_<name>,项目凭据和上下文由宿主绑定。",
|
||||
"description": "6 项宿主查询加 67 项产品工具,其中产品工具含 42 项查询、12 项受控计算与 13 项预览式写入,完整目录合计 73 项。各角色按白名单缩减,Server 产品目录须与 Agent 预期完全匹配才可启用。原生工具 ID 使用 mcp_tjwater_<name>,项目凭据和上下文由宿主绑定。",
|
||||
"connection": "query-mcp.ts",
|
||||
"implementation": "../src/mcp/query-server.ts",
|
||||
"tool_ids": "../src/runtime/product-mcp-tools.ts",
|
||||
@@ -188,7 +188,7 @@
|
||||
"session_policy": "../src/runtime/query-mcp-policy.ts",
|
||||
"product_client": "../src/product/mcp-query-client.ts",
|
||||
"catalog_compatibility": {
|
||||
"description": "Server 与 Agent 的产品目录均为 35 项,prepare 对工具名做全等检查。查询和分析名单分别以 PRODUCT_MCP_READ_TOOLS、PRODUCT_MCP_ANALYSIS_TOOLS 为准;reader 仅使用查询名单。目录一致不代表当前用户或任务已获得全部业务权限。",
|
||||
"description": "Server 与 Agent 的产品目录均为 67 项,prepare 对工具名做全等检查。查询和分析名单分别以 PRODUCT_MCP_READ_TOOLS、PRODUCT_MCP_ANALYSIS_TOOLS、PRODUCT_MCP_WRITE_TOOLS 为准;reader 仅使用查询名单。目录一致不代表当前用户或任务已获得全部业务权限。",
|
||||
"server_catalog": "../../next-tjwater-server/app/mcp/catalog.py",
|
||||
"analysis_contract": "../../next-tjwater-server/docs/mcp-analysis-tools.md"
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ mode: primary
|
||||
temperature: 0.2
|
||||
---
|
||||
|
||||
你是 TJWater 供水数据 Agent。回复用户时使用简体中文,内容简洁准确,区分已知事实、推断、模拟假设和待现场核验项。
|
||||
你是 TJWater 实验性供水数据 Agent。回复用户时使用简体中文,内容简洁准确,区分已知事实、推断、模拟假设和待现场核验项。
|
||||
|
||||
## 角色与工具入口
|
||||
|
||||
@@ -29,7 +29,7 @@ temperature: 0.2
|
||||
|
||||
从当前可调用的工具定义判断能力,必要时实际调用对应业务工具。MCP 资源列表与工具目录不同,资源为空或资源读取不可用不能证明业务工具不存在;一个接口失败也不能证明整个 MCP 未启动。确实缺少必需工具时,如实说明能力不可用,不猜测服务配置,也不通过源码、配置、凭据或其他未授权入口寻找替代通道。
|
||||
|
||||
## 数据来源与权限
|
||||
## 供水事件数据边界
|
||||
|
||||
- 业务数据只来自用户输入、经过校验的事件上下文和受控工具。访问 TJWater Server 不得自行构造 URL、HTTP header、SQL、命令、project_id、network 或上下文句柄;身份、项目与任务由宿主绑定。
|
||||
- 产品 MCP 未启用时说明查询不可用,不回退到旧插件、HTTP 查询桥或 Shell 业务查询。权限、认证和接口错误属于执行异常,不是没有数据或没有异常的证明。
|
||||
@@ -137,3 +137,10 @@ temperature: 0.2
|
||||
## 记忆持久化
|
||||
|
||||
`memory_manager` 只保存长期有效的稳定事实或用户偏好。修改 memory 前先 list 当前 scope,再决定 add、replace 或 remove。
|
||||
|
||||
### 项目服务与写入边界
|
||||
|
||||
- 项目MCP目录含区域/连接/范围、配置、项目地名、需水量分配、假设爆管模拟和会话导出;GIS只读当前项目,缺失时明确说明,不借用其他项目。健康预测未接入。
|
||||
- 新写入工具默认dry_run预览。先查询对象和schema,再保持相同参数、request_id,携带expected_digest并设置dry_run=false执行;遵循原生许可,不把预览当已完成。后台调查、协作和reader不得调用写入工具。
|
||||
- 写入失败或超时先用get_mutation_status及目标查询核实,started不等于成功或回滚,不自动换request_id重试。保存正式场景会重新计算;SCADA补录必须有真实来源,模型结果不能冒充实测。
|
||||
- 导出结果中的file.markdown可直接引用为下载链接;不要展示base64、宿主路径或凭据。文件仅属于当前会话。
|
||||
|
||||
@@ -45,6 +45,14 @@ Mermaid 可以展示真实并行分支与汇总节点,不是固定 todo 或调
|
||||
|
||||
## 正式报告与运行收尾
|
||||
|
||||
正式报告可用 `ui_blocks` 表达已保存证据中的指标、趋势、数据表与对比,每块提供
|
||||
`answer-ui@1`、唯一 `block_id`、`fallback_text` 和真实 `evidence_refs`。
|
||||
按问题选择组件,简单判断仍用文字;不要重复固定结论、边界和状态,不为布局臆造数据。
|
||||
图表保留单位与来源,表单仅供用户主动补充,不能写入事实或执行审批。
|
||||
每份报告最多 8 块、合计 400 KB;证据组件必须引用本块声明且报告已引用的证据。
|
||||
需要资料时在固定 `data_gaps` 中记录,生成组件不能绕过 insufficient_data 的收尾约束。
|
||||
后台使用 `publish_task_report` 保存这些内容,不调用聊天的 `present_answer`。
|
||||
|
||||
报告采用固定契约:stage、outcome、结论、边界和证据引用必须真实。已通过授权查询确认关键数据不足,且现有入口无法补齐时,发布 final/insufficient_data,stop_reason 说明为何无法判断;data_gaps 提供缺失内容、查询范围、判断影响、所需数据和真实查询依据,至少一个 blocking=true。node_id 只是可选展示定位;recommendations 和 pending_items 为空。报告成功保存后,本轮到此正常结束,不等待补数据、不生成补数据工单,也不用给未来图节点补填“完成”或“跳过”。已形成判断时 outcome=concluded、stop_reason=null,缺口只能非阻塞。
|
||||
|
||||
发布失败不等于报告已保存。按工具 schema 修正可纠正的字段;同一内容重试复用 request_id,修改内容使用新的合法 UUID,不重写不可变证据,也不为通过校验补造 evidence_id。无法成功发布时如实返回执行失败,不反复调用 `final_answer` 代替正式报告。后台不调用 `final_answer`;正式成果使用 `publish_task_report`,过程说明使用 `publish_task_progress`。
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { tool } from "../tool.js";
|
||||
import { getInternalBridgeConfig } from "../internalBridge.js";
|
||||
import { taskPublicationDiagramSchema } from "./task-publication-schema.js";
|
||||
import { taskPublicationDiagramSchema, taskReportUiBlocksSchema } from "./task-publication-schema.js";
|
||||
import catalog from "../../src/chat/answer-ui-catalog.json" with { type: "json" };
|
||||
|
||||
export default tool({
|
||||
description: "Publish an evidence-backed investigation report. No todo or execution plan is required. An optional Mermaid diagram explains the investigation to people; it never schedules or completes work. Before proposing actions publish an interim concluded report, then publish a final report referencing the actual actions. Missing critical data ends the round with final insufficient_data and blocking gaps, no recommendations or pending items. Query failures are execution errors, not proof that data is absent. The run lifecycle endpoint settles execution independently of the diagram.",
|
||||
description: "Publish an evidence-backed investigation report. No todo or execution plan is required. An optional Mermaid diagram explains the investigation to people; it never schedules or completes work. Before proposing actions publish an interim concluded report, then publish a final report referencing the actual actions. Missing critical data ends the round with final insufficient_data and blocking gaps, no recommendations or pending items. Query failures are execution errors, not proof that data is absent. The run lifecycle endpoint settles execution independently of the diagram. Optional ui_blocks express evidence as interactive metrics, charts, tables and forms. Each block references saved report evidence, has a unique block_id and a text fallback. Maximum 8 blocks / 400 KB total. Do not duplicate the conclusion or invent data to fill a layout. Component property schemas: " + JSON.stringify(catalog.props),
|
||||
args: {
|
||||
request_id: tool.schema.string().describe("Stable UUID idempotency key for this report revision"),
|
||||
report: tool.schema.object({
|
||||
@@ -27,6 +28,7 @@ export default tool({
|
||||
blocking: tool.schema.boolean(),
|
||||
})),
|
||||
diagram: taskPublicationDiagramSchema.nullish(),
|
||||
ui_blocks: taskReportUiBlocksSchema,
|
||||
}),
|
||||
evidence: tool.schema.array(tool.schema.object({
|
||||
evidence_id: tool.schema.string(),
|
||||
|
||||
@@ -6,6 +6,23 @@ const text = tool.schema.string().trim().min(1);
|
||||
const identifier = text.max(128);
|
||||
const layer = tool.schema.enum(["junctions", "pipes", "valves", "pumps", "tanks", "reservoirs", "scada"]);
|
||||
|
||||
export const taskReportUiBlocksSchema = tool.schema.array(tool.schema.object({
|
||||
block: tool.schema.object({
|
||||
version: tool.schema.literal("answer-ui@1"),
|
||||
block_id: tool.schema.string().regex(/^[a-zA-Z0-9_-]{1,80}$/),
|
||||
fallback_text: text.max(4000),
|
||||
spec: tool.schema.object({
|
||||
root: tool.schema.string(),
|
||||
elements: tool.schema.record(tool.schema.string(), tool.schema.object({
|
||||
type: tool.schema.string(),
|
||||
props: tool.schema.record(tool.schema.string(), tool.schema.unknown()),
|
||||
children: tool.schema.array(tool.schema.string()).max(48),
|
||||
}).strict()),
|
||||
}).strict(),
|
||||
}).strict(),
|
||||
evidence_refs: tool.schema.array(identifier).min(1).max(100),
|
||||
}).strict()).max(8).optional();
|
||||
|
||||
export const taskPublicationDiagramSchema = tool.schema.object({
|
||||
title: text,
|
||||
mermaid: text.max(20000).describe("Mermaid flowchart source; no Markdown fences, initialization directives or click callbacks"),
|
||||
|
||||
Reference in New Issue
Block a user