feat(agent): align investigation reports and selected context
This commit is contained in:
@@ -51,6 +51,21 @@ afterEach(() => {
|
||||
});
|
||||
|
||||
describe("OperationalTaskClient", () => {
|
||||
it("requests a selected report while retaining the current task snapshot", async () => {
|
||||
let requestedUrl = "";
|
||||
globalThis.fetch = (async (input: Parameters<typeof fetch>[0]) => {
|
||||
requestedUrl = String(input);
|
||||
return Response.json({ task: { ...task, execution_generation: 2, latest_plan: null,
|
||||
latest_report: { revision: 8, execution_generation: 2 }, evidence: [], actions: [], permissions: {} },
|
||||
approved_data_scopes: [], selected_report: { revision: 3, execution_generation: 1, report: { title: "上一轮报告" } } });
|
||||
}) as unknown as typeof fetch;
|
||||
bindOperationalTaskCredential("runtime-1", { authorization: "Bearer transient-secret", projectId: "project-1" });
|
||||
const client = new OperationalTaskClient("http://server.test");
|
||||
const context = await client.getAgentContext("runtime-1", taskId, 3);
|
||||
expect(new URL(requestedUrl).searchParams.get("report_revision")).toBe("3");
|
||||
expect(context.selected_report?.execution_generation).toBe(1);
|
||||
expect(context.task.execution_generation).toBe(2);
|
||||
});
|
||||
it("matches proposed action payloads to the generated Server contract", () => {
|
||||
const common = {
|
||||
request_id: "60000000-0000-4000-8000-000000000001",
|
||||
@@ -187,6 +202,7 @@ describe("OperationalTaskClient", () => {
|
||||
sourceSessionId: "session-1",
|
||||
report: {
|
||||
title: "失败",
|
||||
stage: "final", outcome: "concluded", stop_reason: null, data_gaps: [],
|
||||
current_conclusion: "租约已失效",
|
||||
conclusion_boundary: "未继续写回",
|
||||
evidence_refs: [],
|
||||
|
||||
Reference in New Issue
Block a user