mirror of
https://github.com/harivansh-afk/clanker-agent.git
synced 2026-04-16 16:01:01 +00:00
Revert "fix: simplify chat rendering, persist drawer size, fix auth guard (#334)"
This reverts commit 4a36e795a6.
This commit is contained in:
parent
4a36e795a6
commit
6a4f4d1c80
3 changed files with 54 additions and 131 deletions
|
|
@ -125,75 +125,6 @@ describe("DurableChatRunReporter", () => {
|
|||
});
|
||||
});
|
||||
|
||||
it("accumulates reasoning across multi-step tool use", async () => {
|
||||
const fetchMock = vi.fn<typeof fetch>().mockResolvedValue(mockOkResponse());
|
||||
vi.stubGlobal("fetch", fetchMock);
|
||||
|
||||
const reporter = new DurableChatRunReporter({
|
||||
runId: "run-3",
|
||||
callbackUrl: "https://web.example/api/chat/runs/run-3/events",
|
||||
callbackToken: "callback-token",
|
||||
});
|
||||
|
||||
const step1Message = {
|
||||
role: "assistant",
|
||||
timestamp: 100,
|
||||
content: [
|
||||
{ type: "thinking", thinking: "step 1 reasoning" },
|
||||
{ type: "text", text: "step 1 text" },
|
||||
],
|
||||
};
|
||||
|
||||
reporter.handleSessionEvent(
|
||||
{ type: "message_start", message: step1Message } as never,
|
||||
[],
|
||||
);
|
||||
reporter.handleSessionEvent(
|
||||
{ type: "message_end", message: step1Message } as never,
|
||||
[],
|
||||
);
|
||||
|
||||
const step2Message = {
|
||||
role: "assistant",
|
||||
timestamp: 200,
|
||||
content: [
|
||||
{ type: "thinking", thinking: "step 2 reasoning" },
|
||||
{ type: "text", text: "step 2 text" },
|
||||
],
|
||||
};
|
||||
|
||||
reporter.handleSessionEvent(
|
||||
{ type: "message_start", message: step2Message } as never,
|
||||
[],
|
||||
);
|
||||
reporter.handleSessionEvent(
|
||||
{ type: "message_end", message: step2Message } as never,
|
||||
[],
|
||||
);
|
||||
|
||||
await reporter.finalize({
|
||||
ok: true,
|
||||
response: "step 2 text",
|
||||
sessionKey: "session-1",
|
||||
});
|
||||
|
||||
const itemsCall = fetchMock.mock.calls.find((call) =>
|
||||
String(call[1]?.body).includes('"items"'),
|
||||
);
|
||||
const body = JSON.parse(String(itemsCall?.[1]?.body)) as {
|
||||
items: Array<{ partsJson: string }>;
|
||||
};
|
||||
const parts = JSON.parse(body.items[0]?.partsJson ?? "[]") as Array<{
|
||||
type: string;
|
||||
text?: string;
|
||||
}>;
|
||||
|
||||
const reasoningParts = parts.filter((p) => p.type === "reasoning");
|
||||
expect(reasoningParts).toHaveLength(2);
|
||||
expect(reasoningParts[0]?.text).toBe("step 1 reasoning");
|
||||
expect(reasoningParts[1]?.text).toBe("step 2 reasoning");
|
||||
});
|
||||
|
||||
it("marks aborted runs as interrupted", async () => {
|
||||
const fetchMock = vi.fn<typeof fetch>().mockResolvedValue(mockOkResponse());
|
||||
vi.stubGlobal("fetch", fetchMock);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue