Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
import { useMemo } from "react";
import { EMPTY_TRANSCRIPT, isTranscriptAtLiveTail, transcriptViewMessages } from "../lib/transcript-reading";
import { useAppStore } from "../stores/app-store";
/** Main transcript and subagent details consume the same renderer reading range. */
export function useTranscriptView(sessionId: string) {
const live = useAppStore((state) =>
state.activeSessionId === sessionId
? state.messages
: (state.retainedTranscripts[sessionId] ?? EMPTY_TRANSCRIPT),
);
const history = useAppStore((state) => state.sessionHistory[sessionId]);
const view = useAppStore((state) => state.transcriptViews[sessionId]);
const messages = useMemo(() => transcriptViewMessages(live, view), [live, view]);
return {
messages,
hasMoreBefore: view?.hasMoreBefore ?? history?.hasMoreBefore ?? false,
hasMoreAfter: view?.hasMoreAfter ?? false,
focus: view?.focus ?? null,
parentMessage: view?.parentMessage,
historical: Boolean(view?.focus || view?.restored),
liveTail: isTranscriptAtLiveTail(live, messages, view),
loading: Boolean(view?.loading),
};
}