feat: upgrade investigation and presentation runtime
This commit is contained in:
@@ -13,7 +13,7 @@ describe("business stages and final answer", () => {
|
||||
track(part("b", "error"));
|
||||
expect(events.at(-1)).toMatchObject({ id: "business-data", status: "error" });
|
||||
});
|
||||
it("buffers final_answer until the runtime succeeds and does not end the run at the tool", async () => {
|
||||
it("keeps background task completion under runtime and Server control", async () => {
|
||||
const output: string[] = [];
|
||||
const events = [
|
||||
{ type: "message.part.updated", properties: { sessionID: "s", part: { id: "f", type: "tool", tool: "final_answer", state: { status: "completed", input: { answer: "最终结论" }, output: JSON.stringify({ answer: "最终结论" }) } } } },
|
||||
@@ -21,7 +21,7 @@ describe("business stages and final answer", () => {
|
||||
{ type: "session.idle", properties: { sessionID: "s" } },
|
||||
];
|
||||
const runtime = { prompt: async () => undefined, subscribeEvents: async () => ({ async *[Symbol.asyncIterator]() { yield* events; } }), messages: async () => { throw new Error("final answer needs no text fallback"); } } as unknown as OpencodeRuntimeAdapter;
|
||||
const result = await streamPromptResponse({ runtime, sessionId: "s", clientSessionId: "c", message: "test", write: (event, data) => { output.push(event); if (event === "final_answer") expect(data.content).toBe("最终结论"); } });
|
||||
const result = await streamPromptResponse({ runtime, sessionId: "s", clientSessionId: "c", message: "test", suppressAnswerUi: true, write: (event, data) => { output.push(event); if (event === "final_answer") expect(data.content).toBe("最终结论"); } });
|
||||
expect(result.failed).toBeFalse();
|
||||
expect(output.indexOf("tool_call")).toBeLessThan(output.indexOf("final_answer"));
|
||||
expect(output.at(-1)).toBe("done");
|
||||
|
||||
Reference in New Issue
Block a user