From 10985671ad9553e7ac594ede30981166f69ba3c5 Mon Sep 17 00:00:00 2001 From: Adam <2363879+adamdotdevin@users.noreply.github.com> Date: Tue, 17 Feb 2026 07:16:23 -0600 Subject: feat(app): session timeline/turn rework (#13196) Co-authored-by: David Hill --- packages/app/src/context/global-sync/bootstrap.ts | 4 ++++ packages/app/src/context/global-sync/event-reducer.ts | 14 +++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) (limited to 'packages/app/src/context/global-sync') diff --git a/packages/app/src/context/global-sync/bootstrap.ts b/packages/app/src/context/global-sync/bootstrap.ts index 2137a19a8..478bc02f5 100644 --- a/packages/app/src/context/global-sync/bootstrap.ts +++ b/packages/app/src/context/global-sync/bootstrap.ts @@ -6,6 +6,7 @@ import { type ProviderAuthResponse, type ProviderListResponse, type QuestionRequest, + type Todo, createOpencodeClient, } from "@opencode-ai/sdk/v2/client" import { batch } from "solid-js" @@ -20,6 +21,9 @@ type GlobalStore = { ready: boolean path: Path project: Project[] + session_todo: { + [sessionID: string]: Todo[] + } provider: ProviderListResponse provider_auth: ProviderAuthResponse config: Config diff --git a/packages/app/src/context/global-sync/event-reducer.ts b/packages/app/src/context/global-sync/event-reducer.ts index 48ac0fea1..241dfb14d 100644 --- a/packages/app/src/context/global-sync/event-reducer.ts +++ b/packages/app/src/context/global-sync/event-reducer.ts @@ -39,7 +39,12 @@ export function applyGlobalEvent(input: { }) } -function cleanupSessionCaches(store: Store, setStore: SetStoreFunction, sessionID: string) { +function cleanupSessionCaches( + store: Store, + setStore: SetStoreFunction, + sessionID: string, + setSessionTodo?: (sessionID: string, todos: Todo[] | undefined) => void, +) { if (!sessionID) return const hasAny = store.message[sessionID] !== undefined || @@ -48,6 +53,7 @@ function cleanupSessionCaches(store: Store, setStore: SetStoreFunction { @@ -77,6 +83,7 @@ export function applyDirectoryEvent(input: { directory: string loadLsp: () => void vcsCache?: VcsCache + setSessionTodo?: (sessionID: string, todos: Todo[] | undefined) => void }) { const event = input.event switch (event.type) { @@ -110,7 +117,7 @@ export function applyDirectoryEvent(input: { }), ) } - cleanupSessionCaches(input.store, input.setStore, info.id) + cleanupSessionCaches(input.store, input.setStore, info.id, input.setSessionTodo) if (info.parentID) break input.setStore("sessionTotal", (value) => Math.max(0, value - 1)) break @@ -136,7 +143,7 @@ export function applyDirectoryEvent(input: { }), ) } - cleanupSessionCaches(input.store, input.setStore, info.id) + cleanupSessionCaches(input.store, input.setStore, info.id, input.setSessionTodo) if (info.parentID) break input.setStore("sessionTotal", (value) => Math.max(0, value - 1)) break @@ -149,6 +156,7 @@ export function applyDirectoryEvent(input: { case "todo.updated": { const props = event.properties as { sessionID: string; todos: Todo[] } input.setStore("todo", props.sessionID, reconcile(props.todos, { key: "id" })) + input.setSessionTodo?.(props.sessionID, props.todos) break } case "session.status": { -- cgit v1.2.3