feat(investigation): publish incremental reference graphs

Publish graph deltas using the Server-owned cumulative graph contract. Validate historical comparison chart publications and consolidate Agent documentation.
This commit is contained in:
2026-11-11 19:10:41 +08:00
parent 5ee93329a4
commit db87323b69
28 changed files with 2329 additions and 90 deletions
+4 -4
View File
@@ -1,16 +1,16 @@
import { tool } from "../tool.js";
import { getInternalBridgeConfig } from "../internalBridge.js";
import { taskProgressSchema } from "../../src/product/investigation-report.js";
import { taskPublicationProgressSchema } from "./task-publication-schema.js";
import { taskPublicationGraphProgressSchema } from "./task-publication-schema.js";
export default tool({
description: "Publish the complete current investigation progress from a task execution session. Publish before starting a real investigation step and when changing direction. The summary and optional Mermaid diagram describe actual activity for people; they never schedule the Agent or derive status from todo. Every node_refs node_id must exactly reuse an id declared in the Mermaid source; do not use A/B nodes in Mermaid and separate semantic ids in node_refs. The entire diagram may be redrawn, and only explicitly running nodes indicate current activity. Map targets reference known supply features. Use a stable UUID request_id and reuse it on retries. Publishing progress does not complete the run or confirm any human work.",
description: "Save an optional investigation process reference with summary and optional graph_update. Update when the route materially changes, an important finding or failed attempt should be recorded, or a report is being organized. No per-step publication, frequent refresh, or live synchronization is required. The Server retains prior nodes and paths and generates Mermaid. Use stable node_id values; only submit changes. Before extending a saved graph, read get_task_context section=progress when needed. Optional status annotations are reference, recorded, needs_input, failed, and not_taken. They describe the saved explanation, not execution lifecycle: recorded means a finding exists, not that a task, calculation, work order, or field action completed. Retain failed attempts with the actual reason in detail; append a new node and edge for a retry or alternative. Text-only updates preserve the graph. Graphs never schedule execution, settle runs, or infer human completion. Use known supply feature ids and saved evidence/action references. Reuse request_id on retries.",
args: {
request_id: tool.schema.string().uuid().describe("Stable UUID idempotency key; reuse for retries of this progress publication"),
progress: taskPublicationProgressSchema,
progress: taskPublicationGraphProgressSchema,
},
async execute(args, context) {
const progress = taskProgressSchema.parse(args.progress);
const progress = taskProgressSchema.parse(taskPublicationGraphProgressSchema.parse(args.progress));
const { baseUrl, internalToken } = getInternalBridgeConfig();
const response = await fetch(`${baseUrl}/internal/operational-task/artifacts`, {
method: "POST",