A desktop coding agent with free access to frontier models.
TypeScript
fix: header overlap and short project config notice
ogsamrat2b8bf85b6da5
diff --git a/apps/app/src/app/lib/buildathon.ts b/apps/app/src/app/lib/buildathon.tsindex 7217d845..70b20eb8 100644--- a/apps/app/src/app/lib/buildathon.ts+++ b/apps/app/src/app/lib/buildathon.ts@@ -91,6 +91,28 @@ export function buildathonChipText(countdown: BuildathonCountdown): string {return `Buildathon · ${formatRemaining(countdown.remainingMs)} left`;}+/** The chip's words in two parts, so a narrow title bar can drop "Buildathon · ". */+export function buildathonChipParts(countdown: BuildathonCountdown): { prefix: string; rest: string } {+ const text = buildathonChipText(countdown);+ const prefix = "Buildathon · ";+ return text.startsWith(prefix) ? { prefix, rest: text.slice(prefix.length) } : { prefix: "", rest: text };+}++/** The header chip shows while the event is upcoming or open; once submissions close it goes away. */+export function buildathonChipVisible(countdown: BuildathonCountdown | null): boolean {+ return countdown !== null && countdown.kind !== "closed";+}++/**+ * The "Buildathon" item in the header's "…" menu: for people who joined, from+ * the moment submissions close (the chip is gone then) until the event is over+ * (phase "closed"), so judging and results stay one click away.+ */+export function buildathonMenuVisible(status: BuildathonStatus | null, countdown: BuildathonCountdown | null): boolean {+ if (!status || status.enrolled !== true || !countdown) return false;+ return countdown.kind === "closed" && status.event.phase !== "closed";+}+/** "20 Oct, 23:59 IST", plus the local time when the machine is not on IST. */export function formatEventTime(iso: string | null | undefined, locale?: string): string {if (!iso) return "";diff --git a/apps/app/src/app/lib/project-code-notice.ts b/apps/app/src/app/lib/project-code-notice.tsnew file mode 100644index 00000000..2e70aeed--- /dev/null+++ b/apps/app/src/app/lib/project-code-notice.ts@@ -0,0 +1,107 @@+// The notice about a project's own config the engine left out because it could+// run code (its plugins, language server and formatter commands, model+// provider settings). The engine decides what is skipped (OMNIRUSH_PROJECT_CODE=0);+// this file only words the notice and remembers, per project folder, that it+// was shown, so it appears at most once per project.++export type ProjectCodeIgnoredItem = {+ kind: "plugin" | "lsp" | "formatter" | "provider";+ name: string;+ source: string | null;+};++export const PROJECT_CODE_NOTICE_TEXT = "Project plugins and provider settings are off for safety. Your own settings still apply.";+export const PROJECT_CODE_NOTICE_WHY = "A project's own plugins, tools, commands and providers could run code just by opening it. Built-in language servers and formatters still work.";+export const PROJECT_CODE_NOTICE_STORAGE_KEY = "omnirush.project-code-notice.v1";+const MAX_PROJECTS_REMEMBERED = 500;+const MAX_DETAIL_LINES = 12;++type KeyValueStore = Pick<Storage, "getItem" | "setItem">;++function defaultStorage(): KeyValueStore | null {+ try {+ return typeof window !== "undefined" && window.localStorage ? window.localStorage : null;+ } catch {+ return null;+ }+}++function pluginName(name: string): string {+ const plain = name.replace(/^file:\/\//, "").replace(/[\\/]+$/, "");+ const base = plain.split(/[\\/]/).pop();+ return base || plain;+}++/** One line per skipped item, for the notice's Details. */+export function projectCodeNoticeDetails(items: ReadonlyArray<ProjectCodeIgnoredItem> | null | undefined): string[] {+ const list = Array.isArray(items) ? items : [];+ const lines: string[] = [];+ const add = (line: string) => {+ if (!lines.includes(line)) lines.push(line);+ };+ for (const item of list) {+ if (item.kind === "plugin") add(`Plugin: ${pluginName(item.name)}`);+ else if (item.kind === "lsp") add(`Language server: ${item.name}`);+ else if (item.kind === "formatter") add(`Formatter: ${item.name}`);+ }+ if (list.some((item) => item.kind === "provider")) add("Model provider settings");+ if (lines.length <= MAX_DETAIL_LINES) return lines;+ return [...lines.slice(0, MAX_DETAIL_LINES), `and ${lines.length - MAX_DETAIL_LINES} more`];+}++function projectKey(project: string): string {+ return project.trim().replace(/[\\/]+$/, "");+}++function readShown(storage: KeyValueStore | null): string[] {+ try {+ const raw = storage?.getItem(PROJECT_CODE_NOTICE_STORAGE_KEY);+ const parsed = raw ? (JSON.parse(raw) as unknown) : [];+ return Array.isArray(parsed) ? parsed.filter((x): x is string => typeof x === "string") : [];+ } catch {+ return [];+ }+}++/** True once the notice was shown (or dismissed) for this project folder. */+export function projectCodeNoticeShown(project: string, storage: KeyValueStore | null = defaultStorage()): boolean {+ const key = projectKey(project);+ return Boolean(key) && readShown(storage).includes(key);+}++/** Remember that this project folder has had its notice. */+export function markProjectCodeNoticeShown(project: string, storage: KeyValueStore | null = defaultStorage()): void {+ const key = projectKey(project);+ if (!key) return;+ const shown = readShown(storage).filter((x) => x !== key);+ shown.push(key);+ try {+ storage?.setItem(PROJECT_CODE_NOTICE_STORAGE_KEY, JSON.stringify(shown.slice(-MAX_PROJECTS_REMEMBERED)));+ } catch {+ // Storage full or unavailable: the notice may show again, nothing worse.+ }+}++// Shown this app run, for when local storage is unavailable.+const shownThisRun = new Set<string>();++/**+ * The notice to show for a project, once: null when nothing was skipped or the+ * project already had it. Showing it marks the project as done.+ */+export function takeProjectCodeNotice(+ project: string,+ policy: { ignored?: ReadonlyArray<ProjectCodeIgnoredItem> | null; ignoredNotice?: string | null } | null | undefined,+ storage: KeyValueStore | null = defaultStorage(),+): { id: string; text: string; details: string[] } | null {+ const key = projectKey(project);+ if (!key || !policy) return null;+ let details = projectCodeNoticeDetails(policy.ignored);+ // An older server sends only the long sentence: keep it as the details.+ if (!details.length && policy.ignoredNotice?.trim()) details = [policy.ignoredNotice.trim()];+ if (!details.length) return null;+ if (shownThisRun.has(key) || projectCodeNoticeShown(key, storage)) return null;+ shownThisRun.add(key);+ markProjectCodeNoticeShown(key, storage);+ return { id: `project-code-ignored:${key}`, text: PROJECT_CODE_NOTICE_TEXT, details };+}diff --git a/apps/app/src/lib/capability-call.ts b/apps/app/src/lib/capability-call.tsindex c41a0b09..0f10ad1a 100644--- a/apps/app/src/lib/capability-call.ts+++ b/apps/app/src/lib/capability-call.ts@@ -139,19 +139,6 @@ function verbPhrase(action: string, tense: "present" | "past"): string {// engine names their tools `<id>_<tool>`; those calls read "Used <title>: <tool>".const mcpServerTitles = new Map<string, string>()-const projectCodeNoticesShown = new Set<string>()--/**- * The notice about a project's own config the engine left out (its plugins,- * language server and formatter commands): once per project and app run.- */-export function projectCodeNotice(workspaceId: string, text: string | null | undefined): { id: string; text: string } | null {- const line = text?.trim()- if (!line || projectCodeNoticesShown.has(`${workspaceId}\0${line}`)) return null- projectCodeNoticesShown.add(`${workspaceId}\0${line}`)- return { id: `project-code-ignored:${workspaceId}`, text: line }-}-/** Remember the titles of supported MCP servers (from GET /workspace/:id/mcp). */export function registerMcpServerTitles(entries: ReadonlyArray<{ id?: string | null; title?: string | null }>): void {for (const entry of entries) {diff --git a/apps/app/src/react-app/domains/buildathon/buildathon.tsx b/apps/app/src/react-app/domains/buildathon/buildathon.tsxindex 2a4288b6..97bc190b 100644--- a/apps/app/src/react-app/domains/buildathon/buildathon.tsx+++ b/apps/app/src/react-app/domains/buildathon/buildathon.tsx@@ -25,7 +25,10 @@ import {readAnnouncementIds,rememberAnnouncementIds,unreadAnnouncementIds,+ buildathonChipParts,buildathonChipText,+ buildathonChipVisible,+ buildathonMenuVisible,buildathonCountdown,compactTokens,formatEventTime,@@ -83,30 +86,45 @@ function useUnreadAnnouncements(status: BuildathonStatus | null): string[] {);}-/** Header chip: "Buildathon · 5d 03h left", red in the last hour, a dot for unread updates. Nothing unless enrolled. */+/** True while the header's "…" menu should offer My Buildathon (joined, submissions closed, results not over). */+export function useBuildathonMenuItem(): { visible: boolean; open: () => void } {+ const status = useBuildathonStore((store) => store.status);+ const countdown = useCountdown(status);+ return { visible: buildathonMenuVisible(status, countdown), open: () => useBuildathonStore.getState().openPanel() };+}++/**+ * Header chip: "Buildathon · 5d 03h left", red in the last hour, a dot for+ * unread updates. Nothing unless enrolled, and nothing once submissions have+ * closed. In a narrow title bar it drops the "Buildathon ·" words, then hides.+ */export function BuildathonChip() {const status = useBuildathonStore((store) => store.status);const countdown = useCountdown(status);const unread = useUnreadAnnouncements(status);- if (!status || !countdown) return null;+ if (!status || !countdown || !buildathonChipVisible(countdown)) return null;+ const { prefix, rest } = buildathonChipParts(countdown);return (<buttontype="button"onClick={() => useBuildathonStore.getState().openPanel()}className={cn(- "inline-flex h-6 shrink-0 items-center gap-1.5 rounded-lg border px-2 text-[11.5px] font-medium tabular-nums transition-colors mac:titlebar-no-drag",+ "inline-flex h-6 min-w-0 max-w-60 shrink items-center gap-1.5 overflow-hidden rounded-lg border px-2 text-[11.5px] font-medium tabular-nums transition-colors mac:titlebar-no-drag @max-[32rem]/titlebar:hidden",countdown.urgent? "border-red-500/50 bg-red-500/10 text-red-600 hover:bg-red-500/15 dark:text-red-400": countdown.kind === "closed"? "border-border bg-muted/40 text-muted-foreground hover:bg-muted": "border-[#b9f45a]/50 bg-[#b9f45a]/10 text-foreground hover:bg-[#b9f45a]/20",)}- title={`${status.event.name}: deadline ${formatEventTime(status.event.deadlineAt)}`}+ title={`${buildathonChipText(countdown)} (${status.event.name}: deadline ${formatEventTime(status.event.deadlineAt)})`}data-testid="buildathon-chip"data-urgent={countdown.urgent ? "true" : undefined}>- <Trophy className="size-3.5" />- <span>{buildathonChipText(countdown)}</span>+ <Trophy className="size-3.5 shrink-0" />+ <span className="min-w-0 truncate">+ <span className="@max-[48rem]/titlebar:hidden">{prefix}</span>+ {rest}+ </span>{unread.length ? (<spanclassName="size-1.5 rounded-full bg-[#3A2DF5] dark:bg-[#D8FC38]"diff --git a/apps/app/src/react-app/domains/session/chat/session-page.tsx b/apps/app/src/react-app/domains/session/chat/session-page.tsxindex 45cefa8e..037a9f7d 100644--- a/apps/app/src/react-app/domains/session/chat/session-page.tsx+++ b/apps/app/src/react-app/domains/session/chat/session-page.tsx@@ -3,8 +3,8 @@ import type { CSSProperties } from "react";import { useCallback, useEffect, useEffectEvent, useMemo, useRef, useState } from "react";import { usePanelRef } from "react-resizable-panels";import { DesktopUpdateButton } from "../../settings/state/desktop-updater-provider";-import { BuildathonChip } from "../../buildathon/buildathon";-import { ArrowLeft, Cloud, Code2, FileDiff, Layers, MessageSquare, LayoutGrid, Library, MessageSquareOff, PanelLeft, FileText, Gauge, Redo2, Undo2, Globe, ListChecks, Maximize2, MoreHorizontal, PanelRight, TextSearch, X, Zap } from "lucide-react";+import { BuildathonChip, useBuildathonMenuItem } from "../../buildathon/buildathon";+import { ArrowLeft, Cloud, Code2, FileDiff, Layers, MessageSquare, LayoutGrid, Library, MessageSquareOff, PanelLeft, FileText, Gauge, Redo2, Undo2, Globe, ListChecks, Maximize2, MoreHorizontal, PanelRight, TextSearch, Trophy, X, Zap } from "lucide-react";import { SessionCommandControls } from "../commands/session-command-controls";import { useSessionCommandBridge, useSessionCommandsStore } from "../commands/session-commands-store";@@ -507,6 +507,8 @@ export function SessionPage(props: SessionPageProps) {const ideMode = editorAvailable && !isMobile && storedLayoutMode === "ide" && !props.primarySlot && !props.mainContentTakeover;const layoutMode: LayoutMode = ideMode ? "ide" : "chat";const ideChatCollapsed = useEditorStore((state) => state.ideChatCollapsed);+ // After submissions close the header chip is gone; the "…" menu keeps My Buildathon reachable.+ const buildathonMenu = useBuildathonMenuItem();const setLayoutMode = useCallback((mode: LayoutMode) => {if (mode === "ide" && !editorAvailable) return;useEditorStore.getState().setMode(props.selectedWorkspaceId, mode);@@ -1511,8 +1513,9 @@ export function SessionPage(props: SessionPageProps) {below) is invisible — nothing scrolls beneath either — but eachone forces an extra full-pane blur pass every frame the transcriptrepaints. Keep the pane as the only backdrop surface. */}- <header className="z-10 flex h-9 shrink-0 items-center justify-between border-b border-border px-3 max-lg:h-12 lg:px-6 mac:titlebar-drag @container/titlebar">- <div className="flex min-w-0 items-center gap-3">+ <header className="z-10 flex h-9 shrink-0 items-center justify-between gap-2 border-b border-border px-3 max-lg:h-12 lg:px-6 mac:titlebar-drag @container/titlebar" data-session-header>+ {/* Title side takes the room left over and truncates; the buttons side never shrinks under it. */}+ <div className="flex min-w-0 flex-1 items-center gap-3" data-session-header-title>{ideMode ? (<ChatSwitcherchats={ideChats}@@ -1547,7 +1550,7 @@ export function SessionPage(props: SessionPageProps) {<TooltipContent>Back to parent chat</TooltipContent></Tooltip>) : null}- <h1 className={cn("truncate text-[13px] font-medium text-dls-text", ideMode && "sr-only")}>+ <h1 className={cn("min-w-0 truncate text-[13px] font-medium text-dls-text", ideMode && "sr-only")}>{props.primaryTitle? props.primaryTitle: props.mainContentTitle@@ -1560,11 +1563,11 @@ export function SessionPage(props: SessionPageProps) {// Pinned and archived sessions are listed across workspaces, so// the header names the workspace the open session belongs to.<span- className="flex min-w-0 shrink-0 items-center gap-1.5 text-[12px] text-dls-secondary"+ className="flex shrink-[3] items-center gap-1.5 text-[12px] text-dls-secondary"data-session-header-workspace={workspaceName}><span aria-hidden="true">·</span>- <span className="max-w-40 truncate @max-[30rem]/titlebar:max-w-20">{workspaceName}</span>+ <span className="min-w-12 max-w-40 truncate @max-[30rem]/titlebar:max-w-20">{workspaceName}</span></span>) : null}{props.developerMode ? (@@ -1579,7 +1582,7 @@ export function SessionPage(props: SessionPageProps) {) : null}</div>- <div className="flex shrink-0 items-center gap-1.5 text-gray-10 mac:titlebar-no-drag">+ <div className="flex min-w-0 shrink-0 items-center justify-end gap-1.5 text-gray-10 mac:titlebar-no-drag" data-session-header-actions><BuildathonChip /><DesktopUpdateButton />{commandSessionId && props.runtimeWorkspaceId ? (@@ -1667,7 +1670,7 @@ export function SessionPage(props: SessionPageProps) {<Buttonvariant="ghost"size="icon-sm"- className={cn("rounded-xl text-gray-10 transition-colors hover:bg-muted hover:text-foreground", !ideMode && "@min-[40rem]/titlebar:hidden")}+ className={cn("rounded-xl text-gray-10 transition-colors hover:bg-muted hover:text-foreground", !ideMode && !buildathonMenu.visible && "@min-[40rem]/titlebar:hidden")}aria-label="More actions"><MoreHorizontal size={18} />@@ -1734,6 +1737,12 @@ export function SessionPage(props: SessionPageProps) {<FileText className="size-4" />Files{artifactTargetCount > 0 ? ` (${artifactTargetCount})` : ""}</DropdownMenuItem>+ {buildathonMenu.visible ? (+ <DropdownMenuItem onClick={buildathonMenu.open} data-menu-buildathon>+ <Trophy className="size-4" />+ Buildathon+ </DropdownMenuItem>+ ) : null}{showCloudSignIn ? (<DropdownMenuItem onClick={openCloudSignIn}><Cloud className="size-4" />diff --git a/apps/app/src/react-app/domains/session/editor/ide-chrome.tsx b/apps/app/src/react-app/domains/session/editor/ide-chrome.tsxindex 1e552d3b..5fb0f6b7 100644--- a/apps/app/src/react-app/domains/session/editor/ide-chrome.tsx+++ b/apps/app/src/react-app/domains/session/editor/ide-chrome.tsx@@ -129,7 +129,7 @@ export function ChatSwitcher(props: {<DropdownMenu><DropdownMenuTriggerrender={(- <Button variant="ghost" size="sm" className="h-7 min-w-0 max-w-64 gap-1.5 rounded-lg px-2 text-[13px] font-medium" data-chat-switcher aria-label="Switch chat">+ <Button variant="ghost" size="sm" className="h-7 min-w-0 max-w-64 shrink gap-1.5 rounded-lg px-2 text-[13px] font-medium" data-chat-switcher aria-label="Switch chat"><MessageSquare className="size-3.5 shrink-0 text-muted-foreground" /><span className="truncate">{props.title}</span>{props.chats.length > 1 ? <span className="shrink-0 text-[11px] font-normal text-muted-foreground">{props.chats.length}</span> : null}diff --git a/apps/app/src/react-app/domains/session/surface/project-code-notice.tsx b/apps/app/src/react-app/domains/session/surface/project-code-notice.tsxnew file mode 100644index 00000000..3c39fab0--- /dev/null+++ b/apps/app/src/react-app/domains/session/surface/project-code-notice.tsx@@ -0,0 +1,55 @@+import { useState } from "react";+import { toast as sonnerToast } from "sonner";+import { ShieldCheck, XIcon } from "lucide-react";++import { Button } from "@/components/ui/button";+import { PROJECT_CODE_NOTICE_WHY } from "@/app/lib/project-code-notice";++/** One short line, a Details toggle with what was skipped, and a close button. */+export function ProjectCodeNoticeCard(props: { text: string; details: string[]; onDismiss: () => void; defaultOpen?: boolean }) {+ const [open, setOpen] = useState(props.defaultOpen === true);+ return (+ <div+ className="flex w-full items-start gap-2.5 rounded-2xl border border-border bg-popover/95 py-2 pl-3 pr-1.5 text-popover-foreground shadow-md ring-1 ring-popover-border/20 backdrop-blur-sm md:max-w-sm"+ data-project-code-notice+ >+ <ShieldCheck className="mt-0.5 size-4 shrink-0 text-muted-foreground" aria-hidden="true" />+ <div className="flex min-w-0 flex-1 flex-col gap-1">+ <p className="text-[13px] leading-5">+ {props.text}{" "}+ <button+ type="button"+ className="cursor-pointer text-[12px] font-medium text-link underline-offset-2 hover:underline"+ aria-expanded={open}+ onClick={() => setOpen((value) => !value)}+ data-project-code-notice-details-toggle+ >+ {open ? "Hide details" : "Details"}+ </button>+ </p>+ {open ? (+ <div className="flex flex-col gap-1 text-[12px] text-muted-foreground" data-project-code-notice-details>+ <p>Not loaded from this project:</p>+ <ul className="list-disc pl-4">+ {props.details.map((line) => <li key={line} className="break-words">{line}</li>)}+ </ul>+ <p>{PROJECT_CODE_NOTICE_WHY}</p>+ </div>+ ) : null}+ </div>+ <Button variant="ghost" size="icon-sm" aria-label="Dismiss" onClick={props.onDismiss} className="shrink-0 rounded-lg text-muted-foreground">+ <XIcon className="size-4" />+ </Button>+ </div>+ );+}++/** Shows the notice for 15 seconds (paused while the pointer is on it), or until closed. */+export function showProjectCodeNotice(notice: { id: string; text: string; details: string[] }) {+ return sonnerToast.custom(+ (id) => (+ <ProjectCodeNoticeCard text={notice.text} details={notice.details} onDismiss={() => sonnerToast.dismiss(id)} />+ ),+ { id: notice.id, duration: 15_000, position: "top-center" },+ );+}diff --git a/apps/app/src/react-app/domains/session/surface/session-surface.tsx b/apps/app/src/react-app/domains/session/surface/session-surface.tsxindex e480cf48..27328788 100644--- a/apps/app/src/react-app/domains/session/surface/session-surface.tsx+++ b/apps/app/src/react-app/domains/session/surface/session-surface.tsx@@ -147,7 +147,9 @@ import {type ChatMcpReconnectScope,} from "./mcp-chat-reconnect";import { OpenTargetProvider, type OpenTargetOptions } from "@/lib/target-provider";-import { projectCodeNotice, registerMcpServerTitles } from "@/lib/capability-call";+import { registerMcpServerTitles } from "@/lib/capability-call";+import { takeProjectCodeNotice } from "@/app/lib/project-code-notice";+import { showProjectCodeNotice } from "./project-code-notice";import type { ThreadStatus } from "@/lib/messages";import {EnvironmentVariableProvider,@@ -2858,12 +2860,12 @@ export function SessionSurface(props: SessionSurfaceProps) {void props.client.listMcp(props.workspaceId).then((response) => {if (!current || !response.mcpPolicy) return;registerMcpServerTitles([...response.mcpPolicy.supported, ...response.mcpPolicy.decisions]);- // Once per project and app run: what of the project's own config did not load.- const notice = projectCodeNotice(props.workspaceId, response.mcpPolicy.ignoredNotice);- if (notice) toast.info(notice.text, { id: notice.id });+ // Once per project folder (remembered locally): what of the project's own config did not load.+ const notice = takeProjectCodeNotice(props.workspaceRoot.trim() || props.workspaceId, response.mcpPolicy);+ if (notice) showProjectCodeNotice(notice);}).catch(() => undefined);return () => { current = false; };- }, [props.client, props.workspaceId]);+ }, [props.client, props.workspaceId, props.workspaceRoot]);const listMcp = useCallback(async (): Promise<{ servers: McpServerEntry[]; statuses: McpStatusMap; status: string | null }> => {if (props.mcpDisabled === true) {diff --git a/apps/app/tests/buildathon-chip.test.tsx b/apps/app/tests/buildathon-chip.test.tsxnew file mode 100644index 00000000..e9c3c6c6--- /dev/null+++ b/apps/app/tests/buildathon-chip.test.tsx@@ -0,0 +1,72 @@+import { GlobalRegistrator } from "@happy-dom/global-registrator";+import { afterEach, describe, expect, test } from "bun:test";+import { act } from "react";+import { createRoot } from "react-dom/client";++import { useBuildathonStore, type BuildathonEvent, type BuildathonStatus } from "../src/app/lib/buildathon";+import { BuildathonChip } from "../src/react-app/domains/buildathon/buildathon";++const HOUR = 3_600_000;++function event(overrides: Partial<BuildathonEvent>): BuildathonEvent {+ return {+ id: "frontier-2026",+ name: "OmniRush Frontier Buildathon 2026",+ startsAt: new Date(Date.now() - 48 * HOUR).toISOString(),+ registrationEndsAt: null,+ deadlineAt: new Date(Date.now() + 5 * HOUR).toISOString(),+ resultsAt: null,+ phase: "building",+ pageUrl: null,+ submitUrl: null,+ rules: [],+ tracks: [],+ reminders: [],+ ...overrides,+ } as BuildathonEvent;+}++if (typeof globalThis.window === "undefined" || typeof globalThis.document === "undefined") GlobalRegistrator.register({ url: "http://localhost/" });+Object.defineProperty(globalThis, "IS_REACT_ACT_ENVIRONMENT", { configurable: true, value: true });++function renderChip(): string {+ const host = document.createElement("div");+ document.body.appendChild(host);+ const root = createRoot(host);+ act(() => root.render(<BuildathonChip />));+ const html = host.innerHTML;+ act(() => root.unmount());+ host.remove();+ return html;+}++function withStatus(ev: BuildathonEvent): string {+ const status = { enrolled: true, serverTime: null, event: ev, participant: null, submission: null, repro: { box: "on", agentRules: "", checklist: [] }, announcements: [], github: null } as BuildathonStatus;+ useBuildathonStore.setState({ status, offsetMs: 0 });+ return renderChip();+}++afterEach(() => useBuildathonStore.setState({ status: null }));++describe("header chip", () => {+ test("shows while submissions are open, shrinks and hides in a narrow title bar", () => {+ const html = withStatus(event({}));+ expect(html).toContain('data-testid="buildathon-chip"');+ expect(html).toContain("left");+ expect(html).toContain("Buildathon · ");+ expect(html).toContain("@max-[48rem]/titlebar:hidden");+ expect(html).toContain("@max-[32rem]/titlebar:hidden");+ expect(html).toContain("truncate");+ });++ test("nothing once submissions have closed (deadline passed, judging, results, closed)", () => {+ expect(withStatus(event({ deadlineAt: new Date(Date.now() - HOUR).toISOString() }))).toBe("");+ for (const phase of ["judging", "results", "closed"] as const) {+ expect(withStatus(event({ phase }))).toBe("");+ }+ });++ test("nothing without a status", () => {+ expect(renderChip()).toBe("");+ });+});diff --git a/apps/app/tests/buildathon.test.ts b/apps/app/tests/buildathon.test.tsindex b01e4b32..b30640c1 100644--- a/apps/app/tests/buildathon.test.ts+++ b/apps/app/tests/buildathon.test.ts@@ -10,7 +10,10 @@ import {unreadAnnouncementIds,type BuildathonAnnouncement,type BuildathonPromo,+ buildathonChipParts,buildathonChipText,+ buildathonChipVisible,+ buildathonMenuVisible,buildathonCountdown,buildathonProjectPaths,buildathonProjects,@@ -91,6 +94,28 @@ describe("countdown", () => {expect(buildathonCountdown({ ...EVENT, phase: "judging" }, DEADLINE - HOUR * 10).kind).toBe("closed");});+ test("the header chip goes away once submissions close; narrow bars can drop the prefix", () => {+ const open = buildathonCountdown(EVENT, DEADLINE - 2 * HOUR);+ expect(buildathonChipVisible(open)).toBe(true);+ expect(buildathonChipParts(open)).toEqual({ prefix: "Buildathon · ", rest: "2h 00m left" });+ expect(buildathonChipVisible(buildathonCountdown(EVENT, Date.parse(EVENT.startsAt!) - HOUR))).toBe(true);+ expect(buildathonChipVisible(buildathonCountdown(EVENT, DEADLINE + 1))).toBe(false);+ expect(buildathonChipVisible(buildathonCountdown({ ...EVENT, phase: "results" }, DEADLINE - HOUR))).toBe(false);+ expect(buildathonChipVisible(null)).toBe(false);+ });++ test("the menu item keeps My Buildathon reachable from close until the event is over, for people who joined", () => {+ const status = (event: BuildathonEvent): BuildathonStatus => ({ enrolled: true, serverTime: null, event, participant: null, submission: null, repro: { box: "on", agentRules: "", checklist: [] }, announcements: [], github: null });+ const at = (event: BuildathonEvent, now: number) => buildathonMenuVisible(status(event), buildathonCountdown(event, now));+ expect(at(EVENT, DEADLINE - HOUR)).toBe(false);+ expect(at(EVENT, DEADLINE + 1)).toBe(true);+ expect(at({ ...EVENT, phase: "judging" }, DEADLINE - HOUR)).toBe(true);+ expect(at({ ...EVENT, phase: "results" }, DEADLINE + 3 * 24 * HOUR)).toBe(true);+ expect(at({ ...EVENT, phase: "closed" }, DEADLINE + 10 * 24 * HOUR)).toBe(false);+ expect(buildathonMenuVisible(null, buildathonCountdown(EVENT, DEADLINE + 1))).toBe(false);+ expect(buildathonMenuVisible({ ...status(EVENT), enrolled: false } as unknown as BuildathonStatus, buildathonCountdown(EVENT, DEADLINE + 1))).toBe(false);+ });+test("before the start it counts to the start", () => {const upcoming = buildathonCountdown(EVENT, Date.parse(EVENT.startsAt!) - 2 * HOUR);expect(upcoming.kind).toBe("upcoming");diff --git a/apps/app/tests/mcp-supported-panel.test.tsx b/apps/app/tests/mcp-supported-panel.test.tsxindex 1359630d..958f08ef 100644--- a/apps/app/tests/mcp-supported-panel.test.tsx+++ b/apps/app/tests/mcp-supported-panel.test.tsx@@ -2,7 +2,6 @@ import { describe, expect, test } from "bun:test";import { renderToStaticMarkup } from "react-dom/server";import type { OmniRushMcpPolicyView, OmniRushMcpPreset } from "../src/app/lib/omnirush-server";-import { projectCodeNotice } from "../src/lib/capability-call";import type { McpServerEntry } from "../src/app/types";import {MCP_BLOCKED_HINTS,@@ -112,19 +111,14 @@ describe("Settings > MCP: supported servers", () => {expect(html).not.toContain("`");});- test("what the project's own config could not load is said once, in the panel and as a notice", () => {+ test("what the project's own config could not load is said in the panel", () => {const line = "Not loaded from this project's config: plugins evil.ts.";const shown = line.replace(/'/g, "'");expect(render({ policy: policy({ ignoredNotice: line }) })).toContain(shown);expect(render({ policy: policy({ enabled: false, ignoredNotice: line }) })).toContain(shown);expect(render()).not.toContain("mcp-project-code-ignored");- expect(projectCodeNotice("ws_1", line)).toEqual({ id: "project-code-ignored:ws_1", text: line });- expect(projectCodeNotice("ws_1", line)).toBeNull();- expect(projectCodeNotice("ws_2", line)).not.toBeNull();- expect(projectCodeNotice("ws_3", null)).toBeNull();const providers = "Not loaded from this project's config: model provider settings. A project's own plugins, tools, commands and providers could run code just by opening it; the built-in language servers and formatters still work, and your own (user-level) settings apply as usual.";expect(render({ policy: policy({ ignored: [{ kind: "provider", name: "provider", source: "/repo/opencode.json" }], ignoredNotice: providers }) })).toContain("model provider settings");- expect(projectCodeNotice("ws_4", providers)?.text).toBe(providers);});test("a missing runner says how to fix it", () => {diff --git a/apps/app/tests/project-code-notice.test.tsx b/apps/app/tests/project-code-notice.test.tsxnew file mode 100644index 00000000..a1df6f0d--- /dev/null+++ b/apps/app/tests/project-code-notice.test.tsx@@ -0,0 +1,82 @@+import { describe, expect, test } from "bun:test";+import { renderToStaticMarkup } from "react-dom/server";++import {+ PROJECT_CODE_NOTICE_STORAGE_KEY,+ PROJECT_CODE_NOTICE_TEXT,+ markProjectCodeNoticeShown,+ projectCodeNoticeDetails,+ projectCodeNoticeShown,+ takeProjectCodeNotice,+} from "../src/app/lib/project-code-notice";+import { ProjectCodeNoticeCard } from "../src/react-app/domains/session/surface/project-code-notice";++function memoryStorage() {+ const data = new Map<string, string>();+ return {+ data,+ getItem: (key: string) => data.get(key) ?? null,+ setItem: (key: string, value: string) => void data.set(key, value),+ };+}++const ignored = [+ { kind: "plugin" as const, name: "[email protected]", source: "/repo/opencode.json" },+ { kind: "plugin" as const, name: "file:///repo/.opencode/plugin/evil.ts", source: null },+ { kind: "lsp" as const, name: "custom-ls", source: null },+ { kind: "provider" as const, name: "provider", source: "/repo/opencode.json" },+ { kind: "provider" as const, name: "anthropic", source: "/repo/opencode.json" },+];++describe("project config notice", () => {+ test("one short line; details name each skipped item", () => {+ expect(PROJECT_CODE_NOTICE_TEXT).toBe("Project plugins and provider settings are off for safety. Your own settings still apply.");+ expect(projectCodeNoticeDetails(ignored)).toEqual([+ "Plugin: [email protected]",+ "Plugin: evil.ts",+ "Language server: custom-ls",+ "Model provider settings",+ ]);+ expect(projectCodeNoticeDetails([])).toEqual([]);+ expect(projectCodeNoticeDetails(null)).toEqual([]);+ const many = Array.from({ length: 20 }, (_, i) => ({ kind: "plugin" as const, name: `p${i}`, source: null }));+ expect(projectCodeNoticeDetails(many)).toHaveLength(13);+ expect(projectCodeNoticeDetails(many).at(-1)).toBe("and 8 more");+ });++ test("at most once per project folder, remembered across runs", () => {+ const storage = memoryStorage();+ const first = takeProjectCodeNotice("/home/me/proj-a/", { ignored }, storage);+ expect(first).toMatchObject({ text: PROJECT_CODE_NOTICE_TEXT, id: "project-code-ignored:/home/me/proj-a" });+ expect(first?.details).toContain("Model provider settings");+ expect(takeProjectCodeNotice("/home/me/proj-a", { ignored }, storage)).toBeNull();+ expect(projectCodeNoticeShown("/home/me/proj-a", storage)).toBe(true);+ expect(JSON.parse(storage.data.get(PROJECT_CODE_NOTICE_STORAGE_KEY)!)).toEqual(["/home/me/proj-a"]);+ // Another folder gets its own notice.+ expect(takeProjectCodeNotice("/home/me/proj-b", { ignored }, storage)).not.toBeNull();+ // A later app run (fresh in-memory state) still reads the stored list.+ const later = memoryStorage();+ markProjectCodeNoticeShown("/home/me/proj-c", later);+ expect(takeProjectCodeNotice("/home/me/proj-c", { ignored }, later)).toBeNull();+ });++ test("nothing skipped, no notice; an older server's sentence becomes the details", () => {+ const storage = memoryStorage();+ expect(takeProjectCodeNotice("/p/none", { ignored: [] }, storage)).toBeNull();+ expect(takeProjectCodeNotice("/p/none", null, storage)).toBeNull();+ expect(projectCodeNoticeShown("/p/none", storage)).toBe(false);+ const old = takeProjectCodeNotice("/p/old", { ignoredNotice: "Not loaded from this project's config: plugins x.ts." }, storage);+ expect(old?.details).toEqual(["Not loaded from this project's config: plugins x.ts."]);+ });++ test("the card: short line with Details and a close button; details list when open", () => {+ const closed = renderToStaticMarkup(<ProjectCodeNoticeCard text={PROJECT_CODE_NOTICE_TEXT} details={["Plugin: a"]} onDismiss={() => undefined} />);+ expect(closed).toContain(PROJECT_CODE_NOTICE_TEXT);+ expect(closed).toContain(">Details<");+ expect(closed).toContain('aria-label="Dismiss"');+ expect(closed).not.toContain("Plugin: a");+ const open = renderToStaticMarkup(<ProjectCodeNoticeCard text={PROJECT_CODE_NOTICE_TEXT} details={["Plugin: a"]} onDismiss={() => undefined} defaultOpen />);+ expect(open).toContain("Plugin: a");+ expect(open).toContain("Hide details");+ });+});diff --git a/apps/app/tests/session-header-actions.test.ts b/apps/app/tests/session-header-actions.test.tsindex 14c3199d..e6d2752a 100644--- a/apps/app/tests/session-header-actions.test.ts+++ b/apps/app/tests/session-header-actions.test.ts@@ -13,3 +13,23 @@ test("hidden Cloud sign-in does not reserve header space", () => {expect(source).not.toContain('className={showCloudSignIn ? undefined : "invisible"}');expect(source).not.toContain("disabled={!showCloudSignIn}");});++test("header title side truncates and never runs under the buttons", () => {+ const source = readFileSync(sessionPagePath, "utf8");+ const header = source.slice(source.indexOf("<header className="), source.indexOf("</header>"));+ // Title side takes the leftover room and may shrink to nothing; the buttons side keeps its size.+ expect(header).toMatch(/className="flex min-w-0 flex-1 items-center gap-3" data-session-header-title/);+ expect(header).toMatch(/className="flex min-w-0 shrink-0 items-center justify-end gap-1.5[^"]*" data-session-header-actions/);+ expect(header).toContain('"min-w-0 truncate text-[13px] font-medium text-dls-text"');+ const ideChrome = readFileSync(fileURLToPath(new URL("../src/react-app/domains/session/editor/ide-chrome.tsx", import.meta.url)), "utf8");+ // Button defaults to shrink-0; the chat switcher must be allowed to shrink so its title truncates.+ expect(ideChrome).toMatch(/className="h-7 min-w-0 max-w-64 shrink [^"]*" data-chat-switcher/);+});++test("the More actions menu offers My Buildathon after the chip is gone", () => {+ const source = readFileSync(sessionPagePath, "utf8");+ expect(source).toContain("const buildathonMenu = useBuildathonMenuItem();");+ expect(source).toMatch(/\{buildathonMenu\.visible \? \(\s*<DropdownMenuItem onClick=\{buildathonMenu\.open\} data-menu-buildathon>/);+ // The "…" button stays visible in a wide Chat layout while the item is offered.+ expect(source).toContain('!ideMode && !buildathonMenu.visible && "@min-[40rem]/titlebar:hidden"');+});