feat(frontend): build chronological activity timeline

This commit is contained in:
User
2026-07-14 22:56:41 +02:00
parent e0a97a01f3
commit f0f6c3c223
6 changed files with 272 additions and 26 deletions
+25 -2
View File
@@ -22,7 +22,7 @@ test("opens an EventSource and feeds NAMED events to the store", () => {
expect(useSessionStore.getState().pendingWidget?.id).toBe("u1");
});
test("feeds named activity_delta events to the model activity store", () => {
test("feeds named activity_delta events to the thinking activity timeline", () => {
renderHook(() => useSessionStream("s1"));
const es = FakeEventSource.instances[0];
@@ -30,7 +30,30 @@ test("feeds named activity_delta events to the model activity store", () => {
es.emitNamed("activity_delta", { type: "activity_delta", text: "Analizzo le ambiguità" })
);
expect(useSessionStore.getState().activity.at(-1)?.text).toBe("Analizzo le ambiguità");
expect(useSessionStore.getState().activityLog.at(-1)).toMatchObject({
kind: "thinking",
text: "Analizzo le ambiguità",
});
});
test("feeds named activity_event events to the tool activity timeline", () => {
renderHook(() => useSessionStream("s1"));
const es = FakeEventSource.instances[0];
act(() =>
es.emitNamed("activity_event", {
type: "activity_event",
activity: { kind: "tool", toolCallId: "t1", toolName: "bash", status: "running" },
})
);
expect(useSessionStore.getState().activityLog).toContainEqual({
kind: "tool",
phase: null,
text: "bash",
toolCallId: "t1",
status: "running",
});
});
test("also feeds UNNAMED (default message) events to the store", () => {