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:
@@ -1,5 +1,5 @@
|
||||
import { tool } from "../tool.js";
|
||||
import { mermaidDeclaresNodeId } from "../../src/product/investigation-report.js";
|
||||
import { investigationNodeAnnotations } from "../../src/product/investigation-node-state.js";
|
||||
|
||||
// OpenCode owns a separate Zod version. Native parameters are described here;
|
||||
// product schemas revalidate progress and presentation at execution boundaries.
|
||||
@@ -36,28 +36,11 @@ const gapFields = {
|
||||
evidence_refs: tool.schema.array(text).min(1),
|
||||
};
|
||||
|
||||
export const taskPublicationDiagramSchema = tool.schema.object({
|
||||
title: text,
|
||||
mermaid: text.max(20000).describe("Mermaid flowchart structure; no Markdown fences, initialization directives or click callbacks. Reuse exact Mermaid node ids in node_refs, including class-attached declarations such as A:::stage. Supply execution states through node_refs.status; the host supplies execution colors, so no style/classDef is needed for state coloring."),
|
||||
node_refs: tool.schema.array(tool.schema.object({
|
||||
node_id: tool.schema.string().regex(/^[A-Za-z_][A-Za-z0-9_-]{0,79}$/).describe("Exact id of a node declared in the Mermaid source; do not create a separate reference id"),
|
||||
label: text,
|
||||
evidence_refs: tool.schema.array(text).default([]),
|
||||
action_refs: tool.schema.array(tool.schema.string().uuid()).default([]),
|
||||
status: tool.schema.enum(["pending", "running", "completed", "waiting", "waiting_human", "failed", "skipped", "cancelled"]).nullish().describe("Evidence-confirmed node state; waiting means prerequisites/external/system result, waiting_human requires manual authorization/approval/feedback. Unknown stays omitted/null; host controls colors."),
|
||||
map_targets: tool.schema.array(tool.schema.object({ source_id: layer, feature_id: identifier }).strict()).max(100).default([]),
|
||||
}).strict()).max(100).default([]),
|
||||
}).strict().refine(
|
||||
(diagram) => diagram.node_refs.every((node) => mermaidDeclaresNodeId(diagram.mermaid, node.node_id)),
|
||||
"Every node_refs node_id must be declared with the same id in the Mermaid source",
|
||||
);
|
||||
|
||||
const reportFields = {
|
||||
title: text,
|
||||
current_conclusion: text,
|
||||
conclusion_boundary: text,
|
||||
evidence_refs: tool.schema.array(text).default([]),
|
||||
diagram: taskPublicationDiagramSchema.nullish(),
|
||||
ui_blocks: taskReportUiBlocksSchema,
|
||||
};
|
||||
|
||||
@@ -83,9 +66,25 @@ export const taskPublicationReportSchema = tool.schema.discriminatedUnion("outco
|
||||
}).strict(),
|
||||
]);
|
||||
|
||||
export const taskPublicationProgressSchema = tool.schema.object({
|
||||
export const taskPublicationGraphProgressSchema = tool.schema.object({
|
||||
summary: text.max(20000),
|
||||
diagram: taskPublicationDiagramSchema.nullable().default(null),
|
||||
graph_update: tool.schema.object({
|
||||
title: text.max(200).nullish(),
|
||||
nodes: tool.schema.array(tool.schema.object({
|
||||
node_id: tool.schema.string().regex(/^[A-Za-z_][A-Za-z0-9_-]{0,79}$/).describe("Stable task-wide id. Keep this id when updating a step; use a new id for a retry of a failed attempt."),
|
||||
label: text,
|
||||
detail: text.max(2000).nullish().describe("Actual result or failure reason; preserve the failed attempt."),
|
||||
status: tool.schema.enum(investigationNodeAnnotations).nullish().describe("Optional saved reference annotation. recorded means a finding exists, not business completion; reference is neutral. No running state or live task synchronization."),
|
||||
evidence_refs: tool.schema.array(text).default([]),
|
||||
action_refs: tool.schema.array(tool.schema.string().uuid()).default([]),
|
||||
map_targets: tool.schema.array(tool.schema.object({ source_id: layer, feature_id: identifier }).strict()).max(100).default([]),
|
||||
}).strict()).max(100).default([]),
|
||||
edges: tool.schema.array(tool.schema.object({
|
||||
source: tool.schema.string().regex(/^[A-Za-z_][A-Za-z0-9_-]{0,79}$/),
|
||||
target: tool.schema.string().regex(/^[A-Za-z_][A-Za-z0-9_-]{0,79}$/),
|
||||
label: text.max(200).nullish(),
|
||||
}).strict()).max(200).default([]),
|
||||
}).strict().optional().describe("Incremental nodes and explicit relationships. The Server retains prior paths and generates Mermaid; omit for a text-only update."),
|
||||
}).strict();
|
||||
|
||||
import { createViewSchemas } from "../../src/frontendAction/command.js";
|
||||
|
||||
Reference in New Issue
Block a user