feat(agent): improve investigation contracts and runtime readiness
Generic Container CI/CD / test-build-publish (push) Successful in 1m53s
Agent CI/CD / build-test-publish-and-deploy (push) Successful in 1m53s

This commit is contained in:
2026-11-07 19:43:57 +08:00
parent c7b750b099
commit b8f7edb3ee
29 changed files with 1465 additions and 119 deletions
+21
View File
@@ -58,6 +58,27 @@ describe("locally rendered answers", () => {
for (const data of [[0.3, 0.4], [Infinity], [NaN]]) expect(parseAnswerUiInput(withNode({ ...node, props: { ...node.props, series: [{ name: "压力", data }] } }))).toBeNull();
expect(parseAnswerUiInput({ ...input, spec: { ...input.spec, elements: { ...input.spec.elements, unused: node } } })).toBeNull();
});
it("preserves historical scatter timestamps and missing slots in comparison charts", () => {
const props = {
title: "压力七天对比", chart_type: "line", source: "冻结SCADA观测",
x_data: ["19:30", "19:45", "20:00"], y_axis_name: "压力(m)",
series: [
{ name: "当前", type: "line", data: [32.1, null, 31.9] },
{ name: "前一天", type: "scatter", data: [null, 32.4, 32.2],
sample_times: [null, "2026-06-13T19:45:00+08:00", "2026-06-13T20:00:00+08:00"] },
],
};
const withProps = (value: unknown) => ({ ...input, spec: { root: "chart", elements: {
chart: { type: "Chart", props: value, children: [] },
} } });
expect(parseAnswerUiInput(withProps(props))?.spec.elements.chart.props).toEqual(props);
for (const sample_times of [
[null],
["2026-06-13T19:30:00+08:00", null, null],
[null, "2026-06-13T19:45:00", null],
[null, "2026-02-30T19:45:00+08:00", null],
]) expect(parseAnswerUiInput(withProps({ ...props, series: [{ ...props.series[1], sample_times }] }))).toBeNull();
});
it("flushes prose before the interface, publishes once per tool call, and suppresses background UI", async () => {
const part = { id: "ui-call", type: "tool", tool: "present_answer", sessionID: "s", messageID: "m", state: { status: "completed", input, output: "{}", time: { start: 1, end: 2 } } };
const events = [