feat: upgrade investigation and presentation runtime
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { tool } from "../tool.js";
|
||||
import { mermaidDeclaresNodeId } from "../../src/product/investigation-report.js";
|
||||
|
||||
// OpenCode owns a separate Zod version. Native parameters are described here;
|
||||
// product schemas revalidate progress and presentation at execution boundaries.
|
||||
@@ -10,6 +11,7 @@ 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}$/),
|
||||
phase: tool.schema.literal("final").optional(),
|
||||
fallback_text: text.max(4000),
|
||||
spec: tool.schema.object({
|
||||
root: tool.schema.string(),
|
||||
@@ -25,42 +27,24 @@ export const taskReportUiBlocksSchema = tool.schema.array(tool.schema.object({
|
||||
|
||||
export const taskPublicationDiagramSchema = tool.schema.object({
|
||||
title: text,
|
||||
mermaid: text.max(20000).describe("Mermaid flowchart source; no Markdown fences, initialization directives or click callbacks"),
|
||||
mermaid: text.max(20000).describe("Mermaid flowchart source; no Markdown fences, initialization directives or click callbacks. Reuse the exact Mermaid node ids in node_refs"),
|
||||
node_refs: tool.schema.array(tool.schema.object({
|
||||
node_id: tool.schema.string().regex(/^[A-Za-z_][A-Za-z0-9_-]{0,79}$/),
|
||||
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_human", "failed", "skipped", "cancelled"]).nullish(),
|
||||
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();
|
||||
}).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",
|
||||
);
|
||||
|
||||
export const taskPublicationProgressSchema = tool.schema.object({
|
||||
summary: text.max(20000),
|
||||
diagram: taskPublicationDiagramSchema.nullable().default(null),
|
||||
}).strict();
|
||||
|
||||
const chart = tool.schema.object({
|
||||
title: tool.schema.string().max(200),
|
||||
chart_type: tool.schema.enum(["line", "bar"]),
|
||||
x_data: tool.schema.array(tool.schema.string().max(128)).min(1).max(100),
|
||||
series: tool.schema.array(tool.schema.object({
|
||||
name: tool.schema.string().max(128), data: tool.schema.array(tool.schema.number().finite()).min(1).max(100),
|
||||
}).strict()).min(1).max(8),
|
||||
}).strict();
|
||||
|
||||
export const taskPublicationCommandSchema = tool.schema.discriminatedUnion("action", [
|
||||
tool.schema.object({
|
||||
action: tool.schema.literal("highlight_features"), layer,
|
||||
feature_ids: tool.schema.array(identifier).min(1).max(100),
|
||||
effect: tool.schema.enum(["steady", "pulse"]).default("steady"),
|
||||
}).strict(),
|
||||
tool.schema.object({ action: tool.schema.literal("clear_highlights") }).strict(),
|
||||
tool.schema.object({ action: tool.schema.literal("open_chart"), chart_id: identifier, chart,
|
||||
evidence_refs: tool.schema.array(text).min(1).max(100) }).strict(),
|
||||
tool.schema.object({ action: tool.schema.literal("close_chart"), chart_id: identifier }).strict(),
|
||||
tool.schema.object({ action: tool.schema.literal("set_overlay"), overlay_id: identifier,
|
||||
title: text.max(200), mode: tool.schema.enum(["geometry", "heatmap"]), evidence_id: text }).strict(),
|
||||
tool.schema.object({ action: tool.schema.literal("clear_overlay"), overlay_id: identifier }).strict(),
|
||||
]);
|
||||
import { createViewSchemas } from "../../src/frontendAction/command.js";
|
||||
export const taskPublicationCommandSchema = createViewSchemas(tool.schema as unknown as Parameters<typeof createViewSchemas>[0], true).command as unknown as ReturnType<typeof tool.schema.object>;
|
||||
|
||||
Reference in New Issue
Block a user