diff --git a/components/ChatWindow.notices.test.mjs b/components/ChatWindow.notices.test.mjs index de4172c6e..7913f1ee7 100644 --- a/components/ChatWindow.notices.test.mjs +++ b/components/ChatWindow.notices.test.mjs @@ -13,3 +13,8 @@ test("renders temporary notices once at the top center of the chat column", () = /position: "absolute",\s*top: 12,\s*left: 0,\s*right: isMobile \? 0 : CHAT_MINIMAP_WIDTH,[\s\S]*?justifyContent: "center",[\s\S]*?/, ); }); + +test("renders multi-line notices (e.g. /acp status panel) with pre-wrap monospace instead of truncating to one line", () => { + assert.match(source, /const isMultiLine = notice\.message\.includes\("\\n"\);/); + assert.match(source, /whiteSpace: "pre-wrap", fontFamily: "var\(--font-mono\)"/); +}); diff --git a/components/ChatWindow.tsx b/components/ChatWindow.tsx index 7b31d0337..bdf006e5f 100644 --- a/components/ChatWindow.tsx +++ b/components/ChatWindow.tsx @@ -961,17 +961,17 @@ function NoticeShelf({ notices, floating = false }: { notices: NoticeItem[]; flo : notice.type === "success" ? "#10b981" : "var(--accent)"; + const isMultiLine = notice.message.includes("\n"); return (
- + {notice.message}
diff --git a/hooks/useAgentSession.ts b/hooks/useAgentSession.ts index 1a5eb10a2..0db6bedfc 100644 --- a/hooks/useAgentSession.ts +++ b/hooks/useAgentSession.ts @@ -91,6 +91,7 @@ export type NoticeItem = { message: string; type: NoticeType; exiting?: boolean; + visibleMs?: number; }; type NoticeState = { @@ -163,6 +164,7 @@ const EVENT_STREAM_READY_TIMEOUT_MS = 60_000; const EVENT_STREAM_RECONNECT_DELAY_MS = 1_000; const MAX_NOTICES = 5; const NOTICE_VISIBLE_MS = 5000; +const MULTI_LINE_NOTICE_VISIBLE_MS = 30000; const NOTICE_EXIT_ANIMATION_MS = 180; function createNoticeId(): string { if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") { @@ -743,6 +745,7 @@ export function useAgentSession(opts: UseAgentSessionOptions) { id: notice.id ?? createNoticeId(), message, type: notice.type ?? "info", + visibleMs: message.includes("\n") ? MULTI_LINE_NOTICE_VISIBLE_MS : undefined, }, }); }, []); @@ -1911,7 +1914,7 @@ export function useAgentSession(opts: UseAgentSessionOptions) { if (!oldest) return; const t = setTimeout(() => { dispatchNotice({ type: "mark_oldest_exiting" }); - }, NOTICE_VISIBLE_MS); + }, oldest.visibleMs ?? NOTICE_VISIBLE_MS); return () => clearTimeout(t); }, [noticeState.visible]);