Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
fix(sidebar): show running related session status
vastsaa1eb6f334eb8
diff --git a/apps/desktop/src/components/Sidebar.tsx b/apps/desktop/src/components/Sidebar.tsxindex 7b3a8801c..c42fb25e2 100644--- a/apps/desktop/src/components/Sidebar.tsx+++ b/apps/desktop/src/components/Sidebar.tsx@@ -2358,6 +2358,8 @@ export function Sidebar({<SessionHoverCardkey={sessionHoverCard.session.id}card={sessionHoverCard}+ runningSessions={runningSessions}+ pendingPermissions={pendingPermissions}refreshProject={refreshProject}onOpenSession={openSessionFromHover}keepVisible={keepSessionHoverCardVisible}diff --git a/apps/desktop/src/features/sessions/SessionHoverCard.tsx b/apps/desktop/src/features/sessions/SessionHoverCard.tsxindex d4b626e8f..f0123d58e 100644--- a/apps/desktop/src/features/sessions/SessionHoverCard.tsx+++ b/apps/desktop/src/features/sessions/SessionHoverCard.tsx@@ -12,17 +12,22 @@ import {positionSessionHoverCard,sessionPreview,sessionReferenceAvailable,+ sessionReferenceIsRunning,} from "./session-collaboration-view";import type { SessionHoverCardData } from "./useSessionHoverCard";export function SessionHoverCard({card,+ runningSessions,+ pendingPermissions,refreshProject,onOpenSession,keepVisible,scheduleHide,}: {card: SessionHoverCardData;+ runningSessions: Readonly<Record<string, boolean>>;+ pendingPermissions: Readonly<Record<string, readonly unknown[]>>;refreshProject: (path: string) => Promise<ProjectWorkspace | null>;onOpenSession: (sessionId: string) => Promise<void>;keepVisible: () => void;@@ -98,6 +103,22 @@ export function SessionHoverCard({const openSessionReference = (reference: SessionReference) => {void onOpenSession(reference.sessionId);};+ const runningLabel = t("nav.sessionRunning");+ const referenceOpenLabel = (reference: SessionReference) => {+ const label = t("sessionCollaboration.openSession", { name: reference.title || reference.sessionId });+ return sessionReferenceIsRunning(reference, runningSessions, pendingPermissions) ? `${label} (${runningLabel})` : label;+ };+ const renderRunningReferenceStatus = (reference: SessionReference) => (+ sessionReferenceIsRunning(reference, runningSessions, pendingPermissions) ? (+ <span+ className="sidebar-session-hover-card-session-link-status"+ data-session-running="true"+ title={runningLabel}+ >+ {runningLabel}+ </span>+ ) : null+ );return portalToBody(<div@@ -138,11 +159,14 @@ export function SessionHoverCard({className="sidebar-session-hover-card-session-link"data-session-link={summary.createdBySession.sessionId}title={summary.createdBySession.sessionId}- aria-label={t("sessionCollaboration.openSession", { name: summary.createdBySession.title || summary.createdBySession.sessionId })}+ aria-label={referenceOpenLabel(summary.createdBySession)}onClick={() => openSessionReference(summary.createdBySession!)}><span className="sidebar-session-hover-card-session-link-title">{summary.createdBySession.title || summary.createdBySession.sessionId}</span>- <IconArrowUpRight size={12} aria-hidden />+ <span className="sidebar-session-hover-card-session-link-trailing">+ {renderRunningReferenceStatus(summary.createdBySession)}+ <IconArrowUpRight size={12} aria-hidden />+ </span></button>) : (<span@@ -169,11 +193,14 @@ export function SessionHoverCard({className="sidebar-session-hover-card-session-link"data-session-link={reference.sessionId}title={reference.sessionId}- aria-label={t("sessionCollaboration.openSession", { name: reference.title || reference.sessionId })}+ aria-label={referenceOpenLabel(reference)}onClick={() => openSessionReference(reference)}><span className="sidebar-session-hover-card-session-link-title">{reference.title || reference.sessionId}</span>- <IconArrowUpRight size={12} aria-hidden />+ <span className="sidebar-session-hover-card-session-link-trailing">+ {renderRunningReferenceStatus(reference)}+ <IconArrowUpRight size={12} aria-hidden />+ </span></button>) : (<spandiff --git a/apps/desktop/src/features/sessions/session-collaboration-view.ts b/apps/desktop/src/features/sessions/session-collaboration-view.tsindex 954404e75..3472170bd 100644--- a/apps/desktop/src/features/sessions/session-collaboration-view.ts+++ b/apps/desktop/src/features/sessions/session-collaboration-view.ts@@ -1,4 +1,4 @@-import type { SessionCollaborationSummary } from "@pi-desktop/shared";+import type { SessionCollaborationSummary, SessionReference } from "@pi-desktop/shared";const STATUS_KEYS = {idle: "sessionCollaboration.statusIdle",@@ -24,6 +24,14 @@ export function sessionReferenceAvailable(reference: { available?: boolean }): breturn reference.available !== false;}+export function sessionReferenceIsRunning(+ reference: Pick<SessionReference, "sessionId">,+ runningSessions: Readonly<Record<string, boolean>>,+ pendingPermissions: Readonly<Record<string, readonly unknown[]>> = {},+): boolean {+ return runningSessions[reference.sessionId] === true && !pendingPermissions[reference.sessionId]?.length;+}+export function sessionPreview(value: string | undefined, limit = 300): string {const text = (value ?? "").replace(/\s+/g, " ").trim();return text.length > limit ? `${text.slice(0, limit).trimEnd()}…` : text;diff --git a/apps/desktop/src/styles/sessions.css b/apps/desktop/src/styles/sessions.cssindex f16edc069..4a304bb6a 100644--- a/apps/desktop/src/styles/sessions.css+++ b/apps/desktop/src/styles/sessions.css@@ -909,6 +909,34 @@white-space: nowrap;}+.sidebar-session-hover-card-session-link-trailing {+ display: inline-flex;+ flex: 0 0 auto;+ align-items: center;+ gap: 6px;+}++.sidebar-session-hover-card-session-link-status {+ display: inline-flex;+ flex: 0 0 auto;+ align-items: center;+ gap: 4px;+ color: var(--ds-warning);+ font-size: var(--text-xs);+ font-weight: var(--font-weight-medium);+ line-height: var(--leading-tight);+ white-space: nowrap;+}++.sidebar-session-hover-card-session-link-status::before {+ width: 6px;+ height: 6px;+ border-radius: var(--radius-full);+ background: var(--ds-warning);+ content: "";+ animation: sidebar-status-breathe 1.6s ease-in-out infinite;+}+.sidebar-session-hover-card-preview,.sidebar-session-hover-card-peer {color: var(--ds-text-primary);@@ -946,6 +974,10 @@.sidebar-session-hover-card {animation: none;}++ .sidebar-session-hover-card-session-link-status::before {+ animation: none;+ }}.sidebar-session-hover-card-tags {diff --git a/apps/desktop/test/session-collaboration-preview.test.mjs b/apps/desktop/test/session-collaboration-preview.test.mjsindex a5e45491f..b9b3fa0b3 100644--- a/apps/desktop/test/session-collaboration-preview.test.mjs+++ b/apps/desktop/test/session-collaboration-preview.test.mjs@@ -8,6 +8,7 @@ import {formatSessionTimestamp,positionSessionHoverCard,sessionPreview,+ sessionReferenceIsRunning,} from "../src/features/sessions/session-collaboration-view.ts";const summary = (overrides = {}) => ({@@ -191,6 +192,14 @@ test("an unknown host status falls back to the shared unknown label", () => {assert.equal(collaborationStatusKey("completed"), "sessionCollaboration.statusCompleted");});+test("related session references expose only active runtime state", () => {+ const reference = { sessionId: "worker-session", title: "Worker" };+ assert.equal(sessionReferenceIsRunning(reference, { "worker-session": true }), true);+ assert.equal(sessionReferenceIsRunning(reference, { "worker-session": false }), false);+ assert.equal(sessionReferenceIsRunning(reference, {}), false);+ assert.equal(sessionReferenceIsRunning(reference, { "worker-session": true }, { "worker-session": [{}] }), false);+});+test("a reused worker displays only the current settled request's result", () => {const currentTask = { messageId: "new-request", status: "completed", turnId: "new-turn" };const result = { messageId: "new-request", status: "completed", turnId: "new-turn", text: "New report" };diff --git a/apps/desktop/test/sidebar-navigation.test.mjs b/apps/desktop/test/sidebar-navigation.test.mjsindex 942ef982a..cdbbad8ed 100644--- a/apps/desktop/test/sidebar-navigation.test.mjs+++ b/apps/desktop/test/sidebar-navigation.test.mjs@@ -303,6 +303,15 @@ test("session hover cards expose readable models and keyboard-navigable sessionassert.match(globalStyles, /\.sidebar-session-hover-card-session-link:focus-visible\s*\{[\s\S]*?outline:/);});+test("related session links show only active running state", () => {+ assert.match(sidebarSource, /<SessionHoverCard[\s\S]*?runningSessions=\{runningSessions\}/);+ assert.match(sidebarSource, /<SessionHoverCard[\s\S]*?pendingPermissions=\{pendingPermissions\}/);+ assert.match(hoverSource, /sessionReferenceIsRunning\(reference, runningSessions, pendingPermissions\)/);+ assert.match(hoverSource, /data-session-running="true"/);+ assert.match(globalStyles, /\.sidebar-session-hover-card-session-link-status\s*\{[\s\S]*?--ds-warning/);+ assert.match(globalStyles, /\.sidebar-session-hover-card-session-link-status::before\s*\{[\s\S]*?sidebar-status-breathe/);+});+test("hidden row actions stay out of the row's click path", () => {// Resting state: the invisible control is not a pointer target at all.assert.match(diff --git a/docs/spec/04-ux/08-component-spec.md b/docs/spec/04-ux/08-component-spec.mdindex bb32ab221..59468e0b7 100644--- a/docs/spec/04-ux/08-component-spec.md+++ b/docs/spec/04-ux/08-component-spec.md@@ -589,6 +589,9 @@ visually distinct from list content.externally changed Git branch is current. This refresh does not activate aproject or change the selected conversation; if the read is unavailable, thelast cached branch remains usable.+- Collaboration creator and created-session links in the hover card show a+ localized running indicator only while the referenced session has an active+ runtime; non-running related sessions remain title-only.- Project groups use compact vertical spacing so adjacent directories andconversation rows read as one dense navigation list rather than detachedcards. Directory `+` and overflow actions remain hidden until hover ordiff --git a/docs/spec/04-ux/09-interaction-patterns.md b/docs/spec/04-ux/09-interaction-patterns.mdindex 2310fd3ca..9f651d6e4 100644--- a/docs/spec/04-ux/09-interaction-patterns.md+++ b/docs/spec/04-ux/09-interaction-patterns.md@@ -1393,11 +1393,13 @@ Project drag/drop follows these patterns:bounded collaboration section after the chips: creator/source sessionwhen present (title, not UUID), current task preview, up to two recentexchanges with direction, and terminal result. Created-session- references remain keyboard-navigable buttons (at most eight). It may- show a live `running` or `waiting_permission` state, but never loads the- complete transcript or exposes message content beyond the host's bounded- preview. Completion and failure results are derived from the durable target- turn and remain visible after reload.+ references remain keyboard-navigable buttons (at most eight), and show a+ localized running indicator only while the referenced session has an active+ runtime; idle, queued, permission, and terminal states add no label. It may+ show a live `running` or `waiting_permission` state for the hovered session,+ but never loads the complete transcript or exposes message content beyond+ the host's bounded preview. Completion and failure results are derived from+ the durable target turn and remain visible after reload.- Before showing a project session card, the renderer re-reads the activeworkspace through the existing project-read operation. This keeps the Gitbranch current after an external checkout without activating a project ordiff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.mdindex 3b35677a6..f6ca00d09 100644--- a/docs/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/spec/06-delivery/04-e2e-test-plan.md@@ -12197,7 +12197,9 @@ are withdrawn with ADR 0165.While a worker is busy, send a follow-up to that exact Session ID and verifyit is queued against the target inbox rather than starting a second turn. 5)Inspect status from the Agents panel and a sidebar hover card; confirm both- use bounded host projections and do not fetch a complete worker transcript.+ use bounded host projections, the hover card marks currently running+ created-session links, and neither surface fetches a complete worker+ transcript.6) Wait for one worker, query `result` by its exact `messageId` and `turnId`,and inspect the parent transcript for one host-generated completion message.7) Re-read the result and repeat the settlement notification path; confirm