From fd5941fb36f9c5dab98efd825d21c97ac9e2d845 Mon Sep 17 00:00:00 2001 From: Shantur Rathore Date: Wed, 11 Feb 2026 15:41:28 +0000 Subject: [PATCH] fix(ui): show active session status in header Fixes #139 --- .../components/instance/instance-shell2.tsx | 158 +++++++++++++----- 1 file changed, 114 insertions(+), 44 deletions(-) diff --git a/packages/ui/src/components/instance/instance-shell2.tsx b/packages/ui/src/components/instance/instance-shell2.tsx index f180d0f7..c16bd408 100644 --- a/packages/ui/src/components/instance/instance-shell2.tsx +++ b/packages/ui/src/components/instance/instance-shell2.tsx @@ -35,10 +35,13 @@ import { serverApi } from "../../lib/api-client" import { loadBackgroundProcesses } from "../../stores/background-processes" import { BackgroundProcessOutputDialog } from "../background-process-output-dialog" import { useI18n } from "../../lib/i18n" +import { getPermissionQueueLength, getQuestionQueueLength } from "../../stores/instances" import SessionSidebar from "./shell/SessionSidebar" import { useSessionSidebarRequests } from "./shell/useSessionSidebarRequests" import RightPanel from "./shell/right-panel/RightPanel" import { useDrawerChrome } from "./shell/useDrawerChrome" +import { getSessionStatus } from "../../stores/session-status" +import { ShieldAlert } from "lucide-solid" import type { LayoutMode } from "./shell/types" import { @@ -229,6 +232,57 @@ const InstanceShell2: Component = (props) => { return t("instanceShell.connection.unknown") } + const hasPendingRequests = createMemo(() => { + const permissions = getPermissionQueueLength(props.instance.id) + const questions = getQuestionQueueLength(props.instance.id) + return permissions + questions > 0 + }) + + const activeSessionStatusPill = createMemo(() => { + const activeSessionId = activeSessionIdForInstance() + if (!activeSessionId || activeSessionId === "info") return null + + const activeSession = activeSessionForInstance() + const needsPermission = Boolean(activeSession?.pendingPermission) + const needsQuestion = Boolean(activeSession?.pendingQuestion) + const needsInput = needsPermission || needsQuestion + + if (needsInput) { + return { + className: "session-permission", + text: needsPermission + ? t("sessionList.status.needsPermission") + : t("sessionList.status.needsInput"), + showAlertIcon: true, + } + } + + const status = getSessionStatus(props.instance.id, activeSessionId) + const text = + status === "working" + ? t("sessionList.status.working") + : status === "compacting" + ? t("sessionList.status.compacting") + : t("sessionList.status.idle") + + return { + className: `session-${status}`, + text, + showAlertIcon: false, + } + }) + + const renderActiveSessionStatusPill = () => { + const pill = activeSessionStatusPill() + if (!pill) return null + return ( + + {pill.showAlertIcon ?