feat: upgrade investigation and presentation runtime
This commit is contained in:
@@ -10,46 +10,48 @@ import {
|
||||
describe("appendBackendToolArtifact", () => {
|
||||
it("marks SCADA frontend actions as map artifacts", () => {
|
||||
const artifacts = appendBackendToolArtifact([], {
|
||||
tool: "render_scada_analysis",
|
||||
tool: "present_view",
|
||||
reason: "显示已完成的分级结论",
|
||||
params: { items: [{ device_id: "MP01", level: "high" }] },
|
||||
params: { command: { action: "render_scada_analysis", items: [{ device_id: "MP01", level: "high" }] } },
|
||||
}) as Array<Record<string, unknown>>;
|
||||
|
||||
expect(artifacts[0]).toMatchObject({
|
||||
tool: "render_scada_analysis",
|
||||
tool: "present_view",
|
||||
kind: "map",
|
||||
description: "显示已完成的分级结论",
|
||||
});
|
||||
});
|
||||
|
||||
it("persists removed visual tool calls as generic tool artifacts", () => {
|
||||
const artifacts = appendBackendToolArtifact([], {
|
||||
session_id: "session-1",
|
||||
tool: "show_chart",
|
||||
reason: "测试折线图渲染",
|
||||
params: {
|
||||
it("persists chart presentation commands as view artifacts", () => {
|
||||
const command = {
|
||||
action: "open_chart",
|
||||
chart_id: "chart-1",
|
||||
chart: {
|
||||
title: "液位曲线",
|
||||
chart_type: "line",
|
||||
x_data: ["00:00", "01:00"],
|
||||
series: [{ name: "P-101", data: [0.42, 0.41] }],
|
||||
},
|
||||
evidence_refs: [],
|
||||
};
|
||||
const artifacts = appendBackendToolArtifact([], {
|
||||
session_id: "session-1",
|
||||
tool: "present_view",
|
||||
reason: "测试折线图渲染",
|
||||
params: { command },
|
||||
}) as Array<Record<string, unknown>>;
|
||||
|
||||
expect(artifacts).toHaveLength(1);
|
||||
expect(artifacts[0]).toMatchObject({
|
||||
tool: "show_chart",
|
||||
kind: "tool",
|
||||
title: "液位曲线",
|
||||
tool: "present_view",
|
||||
kind: "map",
|
||||
title: "present_view",
|
||||
description: "测试折线图渲染",
|
||||
params: {
|
||||
chart_type: "line",
|
||||
x_data: ["00:00", "01:00"],
|
||||
series: [{ name: "P-101", data: [0.42, 0.41] }],
|
||||
},
|
||||
params: { command },
|
||||
});
|
||||
expect(artifacts[0]).toEqual(
|
||||
expect.objectContaining({
|
||||
id: expect.stringMatching(/^show_chart-/),
|
||||
id: expect.stringMatching(/^present_view-/),
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user