feat: session-scoped entries query, session title tree and message stream updates
This commit is contained in:
1 parent
bef8a35632
commit
e910e75849
37 files changed
+1409
-75
No files matched your search
@@ -8,6 +8,8 @@ import { PagePill } from "@/components/shared/page-pill";
|
||||
import { PrefsMenu } from "@/components/shared/prefs-menu";
|
||||
import { ServerChip } from "@/components/shared/server-chip";
|
||||
import { clearPairMeta } from "@/features/connect/pairing";
|
||||
import { useHealthQuery } from "@/features/status/queries";
|
||||
import { resolveServerStatus } from "@/features/status/server";
|
||||
import { api, getDeviceToken, onUnauthorized } from "@/lib/api";
|
||||
import { CONNECT_PATH, safeNext } from "@/lib/routing";
|
||||
import { defaultWsUrl, PiWsClient, type WsConnectionState } from "@/lib/ws";
|
||||
@@ -99,6 +101,7 @@ export function AppShell() {
|
||||
const href = useRouterState({ select: (state) => state.location.href });
|
||||
const paired = useConnectionStore((state) => state.paired);
|
||||
const setServer = useConnectionStore((state) => state.setServer);
|
||||
const setServerStatus = useConnectionStore((state) => state.setServerStatus);
|
||||
const wsState = useConnectionStore((state) => state.wsState);
|
||||
const setWsState = useConnectionStore((state) => state.setWsState);
|
||||
const disconnect = useConnectionStore((state) => state.disconnect);
|
||||
@@ -116,11 +119,24 @@ export function AppShell() {
|
||||
staleTime: 30_000,
|
||||
retry: 1,
|
||||
});
|
||||
const health = useHealthQuery(paired && !isConnect);
|
||||
const healthOk = health.data?.ok ?? (health.data ? health.data.items.every((item) => item.ok) : undefined);
|
||||
|
||||
useEffect(() => {
|
||||
if (info.data) setServer(info.data);
|
||||
}, [info.data, setServer]);
|
||||
|
||||
useEffect(() => {
|
||||
setServerStatus(
|
||||
resolveServerStatus({
|
||||
paired,
|
||||
info: info.data,
|
||||
infoError: info.isError,
|
||||
healthOk,
|
||||
}),
|
||||
);
|
||||
}, [healthOk, info.data, info.isError, paired, setServerStatus]);
|
||||
|
||||
useEffect(() => {
|
||||
document.body.dataset.page = page;
|
||||
}, [page]);
|
||||
|
||||
@@ -5,6 +5,7 @@ import { useTranslation } from "react-i18next";
|
||||
|
||||
import { Icon, type IconName } from "@/components/icons";
|
||||
import { NAV } from "@/components/shared/nav-list";
|
||||
import { sessionTitle } from "@/features/chat/session-title";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { useSessionsStore } from "@/stores/sessions";
|
||||
import { useWorkspacesStore } from "@/stores/workspaces";
|
||||
@@ -76,7 +77,10 @@ export function CommandPalette({ open, onOpenChange }: CommandPaletteProps) {
|
||||
id: `session-${session.sessionId}`,
|
||||
group: groupSessions,
|
||||
icon: "chat",
|
||||
label: session.name ?? session.sessionId,
|
||||
label: sessionTitle(session, {
|
||||
unnamed: t("chat.sessionUnnamed"),
|
||||
subagentUnnamed: t("chat.subagentUnnamed"),
|
||||
}).text,
|
||||
hint: t(`state.${session.status}`),
|
||||
keywords: `${session.sessionId} ${session.model?.id ?? ""} ${session.cwd}`,
|
||||
href: `/chat/${encodeURIComponent(session.sessionId)}`,
|
||||
|
||||
@@ -57,10 +57,10 @@ export interface NavListProps {
|
||||
export function NavList({ variant, page }: NavListProps) {
|
||||
const { t } = useTranslation();
|
||||
const server = useConnectionStore((state) => state.server);
|
||||
const status = useConnectionStore((state) => state.serverStatus);
|
||||
|
||||
const status = server?.status ?? "offline";
|
||||
const name = server?.name ?? "pi2.nvim";
|
||||
const version = server?.pluginVersion ?? server?.version ?? "";
|
||||
const version = server?.pluginVersion || server?.version || "";
|
||||
const serverTip = t("shell.railServerTip", { name, status: t(`state.${status}`), version });
|
||||
const connectTip = t("shell.connection");
|
||||
|
||||
|
||||
@@ -18,12 +18,12 @@ export interface ServerChipProps {
|
||||
export function ServerChip({ server: override, className }: ServerChipProps) {
|
||||
const { t } = useTranslation();
|
||||
const stored = useConnectionStore((state) => state.server);
|
||||
const status = useConnectionStore((state) => state.serverStatus);
|
||||
const server = override ?? stored;
|
||||
|
||||
const name = server?.name ?? "pi2.nvim";
|
||||
const hostname =
|
||||
server?.hostname ?? (typeof window !== "undefined" ? window.location.hostname || "localhost" : "localhost");
|
||||
const status = server?.status ?? "offline";
|
||||
const dot = serverDotClass(status);
|
||||
const dotStatus = dot.replace("dot--", "") as "ok" | "attention" | "exited" | "idle";
|
||||
|
||||
|
||||
Reference in new issue
Block a user