feat(agent): improve investigation contracts and runtime readiness
This commit is contained in:
@@ -33,6 +33,22 @@ describe("unified view commands", () => {
|
||||
expect(viewCommandSchema.safeParse({ ...commands[4], evidence_refs: [] }).success).toBeTrue();
|
||||
expect(taskPresentationCommandSchema.safeParse({ ...commands[4], evidence_refs: [] }).success).toBeFalse();
|
||||
});
|
||||
it("passes aligned historical scatter points through native and publication contracts", () => {
|
||||
const command = { action: "open_chart", chart_id: "pressure-comparison", evidence_refs: ["E1"], chart: {
|
||||
title: "压力七天对比", chart_type: "line", y_axis_name: "压力(m)",
|
||||
x_data: ["19:30", "19:45", "20:00"], series: [
|
||||
{ name: "当前", type: "line", data: [32, null, 31] },
|
||||
{ name: "前一天", type: "scatter", data: [null, 32, 33],
|
||||
sample_times: [null, "2026-06-13T19:45:00+08:00", "2026-06-13T20:00:00+08:00"] },
|
||||
],
|
||||
} };
|
||||
for (const schema of [presentView.args.command, viewCommandSchema, taskPublicationCommandSchema, taskPresentationCommandSchema]) {
|
||||
expect(schema.parse(command)).toEqual(command);
|
||||
for (const sample_times of [[null], ["2026-06-13T19:30:00+08:00", null, null]]) {
|
||||
expect(schema.safeParse({ ...command, chart: { ...command.chart, series: [{ ...command.chart.series[1], sample_times }] } }).success).toBeFalse();
|
||||
}
|
||||
}
|
||||
});
|
||||
it("rejects old envelopes, unknown fields, scripts, nonfinite numbers and old receipts", () => {
|
||||
for (const command of [
|
||||
{ name: "locate_features", params: { layer: "pipes", feature_ids: ["P1"] } },
|
||||
|
||||
Reference in New Issue
Block a user