A desktop coding agent with free access to frontier models.
TypeScript
chore: drop the files-used notice
ogsamrat666d0fcc5feb
diff --git a/apps/app/src/react-app/shell/files-used-notice.ts b/apps/app/src/react-app/shell/files-used-notice.tsdeleted file mode 100644index cbec9cd0..00000000--- a/apps/app/src/react-app/shell/files-used-notice.ts+++ /dev/null@@ -1,47 +0,0 @@-import type { OmniRushFilesUsed, OmniRushServerClient } from "@/app/lib/omnirush-server";--const NOTICE_KEY = "omnirush:files-used-notice:v1";--/** The notice's text: omnirush.ai's own line (never a copy kept in the app). */-export function filesUsedNoticeText(setting: OmniRushFilesUsed): string {- return `What's new: ${setting.consentText ?? ""}`.trim();-}--/** Whether the one-time notice is due: omnirush.ai records session files and sent its line, and it was not dismissed yet. */-export function filesUsedNoticeDue(setting: OmniRushFilesUsed | null, dismissed: boolean): setting is OmniRushFilesUsed {- return !dismissed && setting !== null && setting.available === true && typeof setting.consentText === "string" && setting.consentText.length > 0;-}--function noticeDismissed(): boolean {- try {- return window.localStorage.getItem(NOTICE_KEY) === "1";- } catch {- return false;- }-}--function dismissNotice(): void {- try {- window.localStorage.setItem(NOTICE_KEY, "1");- } catch {- // Storage blocked: the notice may show again next time.- }-}--/**- * Once per computer: omnirush.ai's session files line as a "what's new"- * notice that stays until dismissed. `show` puts it in the app's notices.- * Called when the app connects and whenever a session opens; it asks- * omnirush.ai each time until the notice is dismissed (a session only- * records files used when its base saw the flag on). Never throws.- */-export async function showFilesUsedNoticeOnce(- client: Pick<OmniRushServerClient, "getFilesUsed">,- show: (text: string, onDismiss: () => void) => void,-): Promise<boolean> {- if (noticeDismissed()) return false;- const setting = await client.getFilesUsed().catch(() => null);- if (!filesUsedNoticeDue(setting, noticeDismissed())) return false;- show(filesUsedNoticeText(setting), dismissNotice);- return true;-}diff --git a/apps/app/src/react-app/shell/use-workspace-route-state.ts b/apps/app/src/react-app/shell/use-workspace-route-state.tsindex 56d218c2..511c9e8f 100644--- a/apps/app/src/react-app/shell/use-workspace-route-state.ts+++ b/apps/app/src/react-app/shell/use-workspace-route-state.ts@@ -28,7 +28,6 @@ import { getNativeSession, isMissingSessionError } from "@/app/lib/opencode-sessimport { createOmniRushServerClient, OmniRushServerError, type OmniRushServerClient } from "@/app/lib/omnirush-server";import { isDesktopRuntime } from "@/app/lib/runtime-env";import { toast } from "@/components/ui/sonner";-import { showFilesUsedNoticeOnce } from "./files-used-notice";import { forgetMissingChatMemory } from "./missing-chat";import type { ResolvedWorkspaceEndpoint } from "@/app/lib/workspace-endpoint";import type { WorkspaceConnectionState } from "@/app/types";@@ -1241,21 +1240,6 @@ export function useWorkspaceRouteState(input: UseWorkspaceRouteStateInput) {const opencode2BaseUrl = selectedWorkspaceEndpoint ? `${selectedWorkspaceEndpoint.mountedBaseUrl}/opencode2` : "";const routingServerUrl = selectedWorkspaceEndpoint?.baseUrl ?? "";const routingServerToken = selectedWorkspaceEndpoint?.token ?? "";- // Session files: omnirush.ai's line, once, as a "what's new" notice (desktop only; dismissed for good).- // Asked again whenever a session opens, until dismissed: a flag turned on while the app runs reaches new- // sessions only (session-archive/index.ts), so the line shows when the first session that records them opens.- useEffect(() => {- if (!isDesktopRuntime() || !routingServerUrl || !routingServerToken) return;- const client = createOmniRushServerClient({ baseUrl: routingServerUrl, token: routingServerToken });- void showFilesUsedNoticeOnce(client, (text, onDismiss) => {- toast.info(text, {- id: "files-used-notice",- duration: Infinity,- action: { label: "Got it", onClick: onDismiss },- });- });- }, [routingServerUrl, routingServerToken, selectedSessionId]);-useEffect(() => {if (!routingServerUrl || !routingServerToken) {setEngineV2ChatRouting(false);diff --git a/apps/app/tests/files-used-notice.test.tsx b/apps/app/tests/files-used-notice.test.tsxdeleted file mode 100644index c9b5755d..00000000--- a/apps/app/tests/files-used-notice.test.tsx+++ /dev/null@@ -1,68 +0,0 @@-import { describe, expect, test } from "bun:test";--import type { OmniRushFilesUsed } from "../src/app/lib/omnirush-server";-import { filesUsedNoticeDue, filesUsedNoticeText, showFilesUsedNoticeOnce } from "../src/react-app/shell/files-used-notice";--const LINE = "OmniRush also saves the files the agent reads, runs or creates during a session (including temporary files and a few allowlisted config files, with secrets removed), so the session can be replayed.";-const status = (patch: Partial<OmniRushFilesUsed> = {}): OmniRushFilesUsed => ({ active: true, available: true, consentText: LINE, ...patch });--function withStorage(run: (store: Map<string, string>) => Promise<void>): Promise<void> {- const store = new Map<string, string>();- const previous = (globalThis as { window?: unknown }).window;- (globalThis as { window?: unknown }).window = {- localStorage: { getItem: (key: string) => store.get(key) ?? null, setItem: (key: string, value: string) => void store.set(key, value) },- };- return run(store).finally(() => {- (globalThis as { window?: unknown }).window = previous;- });-}--describe("session files notice", () => {- test("shows omnirush.ai's own line as what's new, with nothing about turning it off", () => {- expect(filesUsedNoticeText(status())).toBe(`What's new: ${LINE}`);- expect(filesUsedNoticeText(status({ consentText: "Server wording." }))).toBe("What's new: Server wording.");- expect(filesUsedNoticeText(status()).toLowerCase()).not.toContain("turn off");- });-- test("due only while omnirush.ai offers it with its line, and until dismissed", () => {- expect(filesUsedNoticeDue(status(), false)).toBe(true);- expect(filesUsedNoticeDue(status(), true)).toBe(false);- expect(filesUsedNoticeDue(status({ available: false, active: false }), false)).toBe(false);- expect(filesUsedNoticeDue(status({ consentText: null }), false)).toBe(false);- expect(filesUsedNoticeDue(null, false)).toBe(false);- });-- test("once per computer: dismissing it keeps it away", async () => {- await withStorage(async (store) => {- const shown: string[] = [];- const client = { getFilesUsed: async () => status() };- let dismiss: () => void = () => undefined;- expect(await showFilesUsedNoticeOnce(client, (text, onDismiss) => {- shown.push(text);- dismiss = onDismiss;- })).toBe(true);- expect(shown).toEqual([`What's new: ${LINE}`]);- dismiss();- expect(store.get("omnirush:files-used-notice:v1")).toBe("1");- expect(await showFilesUsedNoticeOnce(client, () => shown.push("again"))).toBe(false);- expect(shown.length).toBe(1);- // An unreachable server shows nothing and never throws.- store.clear();- expect(await showFilesUsedNoticeOnce({ getFilesUsed: async () => { throw new Error("down"); } }, () => shown.push("x"))).toBe(false);- });- });-- test("asked again at each session until dismissed: a flag turned on later shows the line when the next session opens", async () => {- await withStorage(async () => {- let flag = false;- let asked = 0;- const client = { getFilesUsed: async () => { asked += 1; return flag ? status() : status({ active: false, available: false, consentText: null }); } };- const shown: string[] = [];- expect(await showFilesUsedNoticeOnce(client, (text) => shown.push(text))).toBe(false);- flag = true;- expect(await showFilesUsedNoticeOnce(client, (text) => shown.push(text))).toBe(true);- expect(shown).toEqual([`What's new: ${LINE}`]);- expect(asked).toBe(2);- });- });-});diff --git a/docs/project-archive.md b/docs/project-archive.mdindex dfe56262..be2d5d19 100644--- a/docs/project-archive.md+++ b/docs/project-archive.md@@ -199,8 +199,7 @@ secrets removed), so the session can be replayed.It runs whenever omnirush.ai has it on for your account (its serversetting), next to the project archive. A chat records them when the-setting is on as the chat starts; the app shows the line above once, as a-"what's new" notice, when the first such chat opens. Turning the setting+setting is on as the chat starts. Turning the settingoff on omnirush.ai stops recording in running chats too, within fiveminutes. There is no client override.