A desktop coding agent with free access to frontier models.
TypeScript
feat: files used from the server flag, one-time notice
ogsamrat9eda46616415
diff --git a/apps/app/src/app/lib/omnirush-server.ts b/apps/app/src/app/lib/omnirush-server.tsindex 723e15d4..a43f1488 100644--- a/apps/app/src/app/lib/omnirush-server.ts+++ b/apps/app/src/app/lib/omnirush-server.ts@@ -408,12 +408,11 @@ export type OmniRushRuntimeApprovals = {/** Saved only on this server/device, independent of account and workspace. */export type OmniRushBestPractices = { enabled: boolean };/**- * The files-used switch (Settings > General): `enabled` is this device's- * choice; `active` whether the account records files used now, `accepted`- * the account's answer to the consent line, `available` whether omnirush.ai- * offers it, `consentText` the line to show (null when it could not be asked).+ * Session files (files used): whether omnirush.ai records them for this+ * account now, whether its setting is on, and the line it asks the app to+ * show once (null when it could not be asked).*/-export type OmniRushFilesUsed = { enabled: boolean; active: boolean | null; accepted: boolean | null; available: boolean | null; consentText: string | null };+export type OmniRushFilesUsed = { active: boolean | null; available: boolean | null; consentText: string | null };export type OmniRushBestPracticesChange = OmniRushBestPractices & {ok: boolean;changed: boolean;@@ -1440,7 +1439,7 @@ const resolveFetch = (url?: string) => {const DEFAULT_OMNIRUSH_SERVER_TIMEOUT_MS = 10_000;const ENGINE_RELOAD_TIMEOUT_MS = 60_000;-/** The files-used switch waits for omnirush.ai (10 s at most on the server side). */+/** The session files status waits for omnirush.ai (10 s at most on the server side). */const FILES_USED_TIMEOUT_MS = 15_000;type FetchLike = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;@@ -1909,14 +1908,6 @@ export function createOmniRushServerClient(options: { baseUrl: string; token?: s}),getFilesUsed: () =>requestJson<OmniRushFilesUsed>(baseUrl, "/runtime-config/files-used", { token, hostToken, timeoutMs: FILES_USED_TIMEOUT_MS }),- setFilesUsed: (enabled: boolean) =>- requestJson<OmniRushFilesUsed>(baseUrl, "/runtime-config/files-used", {- token,- hostToken,- method: "PUT",- body: { enabled },- timeoutMs: FILES_USED_TIMEOUT_MS,- }),getBestPractices: () =>requestJson<OmniRushBestPractices>(baseUrl, "/runtime-config/best-practices", { token, hostToken, timeoutMs: timeouts.config }),setBestPractices: (enabled: boolean) =>diff --git a/apps/app/src/react-app/domains/settings/files-used.ts b/apps/app/src/react-app/domains/settings/files-used.tsdeleted file mode 100644index 00cb099c..00000000--- a/apps/app/src/react-app/domains/settings/files-used.ts+++ /dev/null@@ -1,84 +0,0 @@-import { useCallback, useEffect, useRef, useState } from "react";--import type { OmniRushFilesUsed, OmniRushServerClient } from "@/app/lib/omnirush-server";--export type FilesUsedClient = Pick<OmniRushServerClient, "getFilesUsed" | "setFilesUsed">;--/**- * The card is shown only while omnirush.ai offers it (`available`), with the- * consent line omnirush.ai sends (never a copy kept here).- */-export function filesUsedCardShown(setting: OmniRushFilesUsed | null): boolean {- return setting?.available === true && typeof setting.consentText === "string" && setting.consentText.length > 0;-}--/** The card's help: omnirush.ai's consent line, and what the switch does. */-export function filesUsedHelp(setting: OmniRushFilesUsed | null): string {- return `${setting?.consentText ?? ""} Turning this on accepts it for your account; turning it off stops it.`.trim();-}--/** Whether the switch shows on: this device's choice and the account's answer (an unknown answer counts as on). */-export function filesUsedChecked(setting: OmniRushFilesUsed | null): boolean {- return setting !== null && setting.enabled && setting.accepted !== false;-}--/** What the card says under the switch, from the saved setting. */-export function filesUsedStatusLine(setting: OmniRushFilesUsed | null): string {- if (!setting) return "";- if (!setting.enabled) return "Off on this computer. No session files are saved.";- if (setting.active === true) return "On for this account.";- if (setting.accepted === false) return "Off for this account.";- if (setting.active === false) return "Not saving yet.";- return "On here. omnirush.ai could not be reached to confirm.";-}--/** The Settings switch: a GET begun before a PUT never replaces the newly saved choice. */-export function useFilesUsed(client: FilesUsedClient | null) {- const [setting, setSetting] = useState<OmniRushFilesUsed | null>(null);- const [busy, setBusy] = useState(false);- const [status, setStatus] = useState("");- const sequence = useRef(0);-- useEffect(() => {- sequence.current += 1;- const startedAt = sequence.current;- let cancelled = false;- setSetting(null);- setBusy(false);- setStatus("");- if (client) {- void client.getFilesUsed()- .then((value) => {- if (!cancelled && sequence.current === startedAt) setSetting(value);- })- .catch(() => {- if (!cancelled && sequence.current === startedAt) setStatus("This setting could not be loaded. Try opening Settings again.");- });- }- return () => { cancelled = true; };- }, [client]);-- const setEnabled = useCallback(async (enabled: boolean) => {- if (!client || busy) return;- sequence.current += 1;- const startedAt = sequence.current;- setBusy(true);- setStatus("Saving…");- try {- const result = await client.setFilesUsed(enabled);- if (sequence.current !== startedAt) return;- setSetting({ enabled: result.enabled, active: result.active, accepted: result.accepted, available: result.available, consentText: result.consentText });- setStatus("");- } catch {- if (sequence.current !== startedAt) return;- const saved = await client.getFilesUsed().catch(() => null);- if (sequence.current !== startedAt) return;- if (saved) setSetting(saved);- setStatus("This setting could not be saved. Try again.");- } finally {- if (sequence.current === startedAt) setBusy(false);- }- }, [busy, client]);-- return { setting, busy, status, setEnabled };-}diff --git a/apps/app/src/react-app/domains/settings/pages/general-view.tsx b/apps/app/src/react-app/domains/settings/pages/general-view.tsxindex 6cea184f..df244a38 100644--- a/apps/app/src/react-app/domains/settings/pages/general-view.tsx+++ b/apps/app/src/react-app/domains/settings/pages/general-view.tsx@@ -3,7 +3,6 @@ import { useEffect, useState } from "react";import {ArrowRight,Cog,- FileStack,FolderLock,Mic,Paintbrush,@@ -36,8 +35,6 @@ import {} from "../approval-mode";import { DiagnosticsSection } from "./diagnostics-section";import { BEST_PRACTICES_HELP, useBestPractices, type BestPracticesClient } from "../best-practices";-import { filesUsedCardShown, filesUsedChecked, filesUsedHelp, filesUsedStatusLine, useFilesUsed, type FilesUsedClient } from "../files-used";-import type { OmniRushFilesUsed } from "../../../../app/lib/omnirush-server";export type GeneralSettingsViewProps = {onNavigateTab: (tab: SettingsTab) => void;@@ -46,8 +43,6 @@ export type GeneralSettingsViewProps = {omnirushClient?: ApprovalsClient | null;/** Global guides do not depend on workspace selection or history loading. */bestPracticesClient?: BestPracticesClient | null;- /** The files-used switch (desktop only); the card is hidden without one. */- filesUsedClient?: FilesUsedClient | null;/** Workspace whose engine is reloaded after the approval mode changes. */runtimeWorkspaceId?: string | null;/** Builds the sanitized diagnostics bundle with the route's context. */@@ -216,40 +211,6 @@ export function BestPracticesCard(props: {);}-/** Settings > General > Session files: the files-used switch, with the consent line. */-export function FilesUsedCard(props: {- setting: OmniRushFilesUsed | null;- busy: boolean;- status: string;- onToggle: (enabled: boolean) => void;-}) {- const line = props.status || filesUsedStatusLine(props.setting);- return (- <div className="space-y-3">- <div className="text-[11px] font-semibold uppercase tracking-[0.15em] text-dls-secondary">Session files</div>- <div className="flex items-center gap-4 rounded-2xl border border-dls-border bg-dls-surface p-4">- <div className="flex h-10 w-10 shrink-0 items-center justify-center rounded-xl border border-dls-border bg-dls-hover">- <FileStack size={17} className="text-dls-secondary" />- </div>- <div className="min-w-0 flex-1">- <div className="text-[13px] font-medium text-dls-text">Save the files a session uses</div>- <div id="files-used-help" className="text-[11px] text-dls-secondary">{filesUsedHelp(props.setting)}</div>- {line ? (- <div className="mt-0.5 text-[11px] text-dls-secondary" role="status" data-testid="files-used-status">{line}</div>- ) : null}- </div>- <Switch- aria-label="Save the files a session uses"- aria-describedby="files-used-help"- checked={filesUsedChecked(props.setting)}- disabled={props.busy || props.setting === null}- onCheckedChange={props.onToggle}- />- </div>- </div>- );-}-export function GeneralSettingsView(props: GeneralSettingsViewProps) {const [account, setAccount] = useState<NativeAccountStatus | null>(null);const [accountBusy, setAccountBusy] = useState(false);@@ -258,8 +219,6 @@ export function GeneralSettingsView(props: GeneralSettingsViewProps) {const approvalMode = useApprovalMode(approvalsClient, props.runtimeWorkspaceId ?? null);const bestPracticesClient = props.bestPracticesClient ?? null;const bestPractices = useBestPractices(bestPracticesClient);- const filesUsedClient = isElectronRuntime() ? props.filesUsedClient ?? null : null;- const filesUsed = useFilesUsed(filesUsedClient);useEffect(() => {if (!isElectronRuntime()) return;@@ -416,15 +375,6 @@ export function GeneralSettingsView(props: GeneralSettingsViewProps) {/>) : null}- {filesUsedClient && filesUsedCardShown(filesUsed.setting) ? (- <FilesUsedCard- setting={filesUsed.setting}- busy={filesUsed.busy}- status={filesUsed.status}- onToggle={(enabled) => void filesUsed.setEnabled(enabled)}- />- ) : null}-<DiagnosticsSection buildBundle={props.buildDiagnosticsBundle} /></div>);diff --git a/apps/app/src/react-app/shell/files-used-notice.ts b/apps/app/src/react-app/shell/files-used-notice.tsnew file mode 100644index 00000000..a12999f6--- /dev/null+++ b/apps/app/src/react-app/shell/files-used-notice.ts@@ -0,0 +1,45 @@+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.+ * 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/settings-route.tsx b/apps/app/src/react-app/shell/settings-route.tsxindex 52fa74c6..c7e92205 100644--- a/apps/app/src/react-app/shell/settings-route.tsx+++ b/apps/app/src/react-app/shell/settings-route.tsx@@ -86,7 +86,6 @@ import { isOmniRushExtensionEnabled, OMNIRUSH_EXTENSION_STATE_CHANGED } from "@/import { PreferencesView } from "@/react-app/domains/settings/pages/preferences-view";import { GeneralSettingsView } from "@/react-app/domains/settings/pages/general-view";import type { BestPracticesClient } from "@/react-app/domains/settings/best-practices";-import type { FilesUsedClient } from "@/react-app/domains/settings/files-used";import { AuthorizedFoldersPanel } from "@/react-app/domains/settings/panels/authorized-folders-panel";import { BrowserLoginsPanel } from "../domains/browser-logins/browser-logins-panel";import { EffectivePermissionsPanel } from "@/react-app/domains/settings/panels/effective-permissions-panel";@@ -516,7 +515,6 @@ function SettingsRouteContent(props: SettingsSurfaceProps = {}) {const [token, setToken] = useState("");const [omnirushClient, setOmniRushClient] = useState<OmniRushServerClient | null>(null);const [bestPracticesClient, setBestPracticesClient] = useState<BestPracticesClient | null>(null);- const [filesUsedClient, setFilesUsedClient] = useState<FilesUsedClient | null>(null);const [activeClient, setActiveClient] = useState<Client | null>(null);const [busy, setBusy] = useState(false);const [busyLabel, setBusyLabel] = useState<string | null>(null);@@ -1294,7 +1292,6 @@ function SettingsRouteContent(props: SettingsSurfaceProps = {}) {const attempt = refreshLifecycleRef.current.begin(options);if (!attempt) return;setBestPracticesClient(null);- setFilesUsedClient(null);setLoading(true);let desktopList: WorkspaceList | null = null;let desktopWorkspaces = workspacesRef.current;@@ -1322,7 +1319,6 @@ function SettingsRouteContent(props: SettingsSurfaceProps = {}) {if (!normalizedBaseUrl || !resolvedToken) {setOmniRushClient(null);setBestPracticesClient(null);- setFilesUsedClient(null);setBaseUrl("");setToken("");setWorkspaces(desktopWorkspaces);@@ -1346,7 +1342,6 @@ function SettingsRouteContent(props: SettingsSurfaceProps = {}) {// Global guides can load once this server confirms access. Workspace// selection and task history retain their existing readiness boundary.setBestPracticesClient(client);- setFilesUsedClient(client);serverActiveWorkspaceIdRef.current = list.activeId ?? "";const serverWorkspaceIds = new Set(list.items.map((workspace) => workspace.id));const nextWorkspaces = mergeRouteWorkspaces(list.items, desktopWorkspaces);@@ -2288,7 +2283,6 @@ function SettingsRouteContent(props: SettingsSurfaceProps = {}) {developerMode={developerMode}omnirushClient={omnirushClient}bestPracticesClient={bestPracticesClient}- filesUsedClient={filesUsedClient}runtimeWorkspaceId={runtimeWorkspaceId}buildDiagnosticsBundle={() => buildDiagnosticsBundleJson({developerMode,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 37cae2b9..13e0b567 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@@ -27,6 +27,8 @@ import { createClientV2 } from "@/app/lib/opencode-v2-adapter";import { getNativeSession } from "@/app/lib/opencode-session-native";import { 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 type { ResolvedWorkspaceEndpoint } from "@/app/lib/workspace-endpoint";import type { WorkspaceConnectionState } from "@/app/types";import { normalizeDirectoryPath } from "@/app/utils";@@ -1200,6 +1202,19 @@ 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).+ 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]);+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.tsxnew file mode 100644index 00000000..7a567f30--- /dev/null+++ b/apps/app/tests/files-used-notice.test.tsx@@ -0,0 +1,54 @@+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);+ });+ });+});diff --git a/apps/app/tests/files-used-settings-card.test.tsx b/apps/app/tests/files-used-settings-card.test.tsxdeleted file mode 100644index 2b55d41e..00000000--- a/apps/app/tests/files-used-settings-card.test.tsx+++ /dev/null@@ -1,45 +0,0 @@-import { describe, expect, test } from "bun:test";-import { renderToStaticMarkup } from "react-dom/server";--import type { OmniRushFilesUsed } from "../src/app/lib/omnirush-server";-import { filesUsedCardShown, filesUsedChecked, filesUsedHelp, filesUsedStatusLine } from "../src/react-app/domains/settings/files-used";-import { FilesUsedCard } from "../src/react-app/domains/settings/pages/general-view";--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 setting = (patch: Partial<OmniRushFilesUsed> = {}): OmniRushFilesUsed => ({ enabled: true, active: false, accepted: false, available: true, consentText: LINE, ...patch });--function switchMarkup(markup: string): string {- const match = markup.match(/<[a-z]+[^>]*role="switch"[^>]*>/);- if (!match) throw new Error(`no switch in ${markup}`);- return match[0];-}--describe("session files settings card", () => {- test("shows omnirush.ai's consent line and the account's answer", () => {- const off = renderToStaticMarkup(<FilesUsedCard setting={setting()} busy={false} status="" onToggle={() => {}} />);- expect(off).toContain("Session files");- expect(off).toContain(LINE);- expect(switchMarkup(off)).toContain('aria-checked="false"');- expect(off).toContain("Off for this account.");-- const on = renderToStaticMarkup(<FilesUsedCard setting={setting({ active: true, accepted: true })} busy={false} status="" onToggle={() => {}} />);- expect(switchMarkup(on)).toContain('aria-checked="true"');- expect(on).toContain("On for this account.");- });-- test("the switch is off when this computer turned it off, whatever the account says", () => {- const local = setting({ enabled: false, accepted: true, active: false });- expect(filesUsedChecked(local)).toBe(false);- expect(filesUsedStatusLine(local)).toBe("Off on this computer. No session files are saved.");- expect(filesUsedChecked(setting({ accepted: null, active: null }))).toBe(true);- expect(filesUsedStatusLine(setting({ accepted: null, active: null }))).toContain("could not be reached");- });-- test("shown only while omnirush.ai offers it, with its own wording (no copy kept in the app)", () => {- expect(filesUsedCardShown(setting())).toBe(true);- expect(filesUsedCardShown(setting({ available: false }))).toBe(false);- expect(filesUsedCardShown(setting({ consentText: null }))).toBe(false);- expect(filesUsedCardShown(null)).toBe(false);- expect(filesUsedHelp(setting({ consentText: "Server wording." }))).toStartWith("Server wording.");- });-});diff --git a/apps/server/src/capture-client.ts b/apps/server/src/capture-client.tsindex 31e90c35..fa33fb8e 100644--- a/apps/server/src/capture-client.ts+++ b/apps/server/src/capture-client.ts@@ -14,7 +14,7 @@ import { Worker } from "node:worker_threads";import { lstat } from "node:fs/promises";import { resolve } from "node:path";import { START_GATE_MS } from "./session-archive/capture-v2.js";-import type { FilesUsedSetting } from "./session-archive/index.js";+import type { FilesUsedStatus } from "./session-archive/index.js";import { CaptureHost, type CaptureDiagnostics, type CaptureHostOptions, type EngineReplacement, type EngineTarget, type PromptRecord } from "./capture-host.js";import {@@ -86,9 +86,8 @@ export type CaptureService = {/** Every queued capture, upload and archive step settled (tests, profiling). */idle(): Promise<void>;diagnostics(): Promise<CaptureDiagnostics | null>;- /** Files used, for Settings (null: capture is not running). */- filesUsedStatus(): Promise<FilesUsedSetting | null>;- setFilesUsed(enabled: boolean): Promise<FilesUsedSetting | null>;+ /** Files used, for the app's one-time notice (null: capture is not running). */+ filesUsedStatus(): Promise<FilesUsedStatus | null>;};/** How much longer than the start gate's own cap the main thread waits for the worker's answer. */@@ -222,12 +221,8 @@ class CaptureClient implements CaptureService {return isDiagnostics(value) ? value : null;}- async filesUsedStatus(): Promise<FilesUsedSetting | null> {- return filesUsedSettingOf(await this.query({ kind: "call", id: null, method: "filesUsedStatus", args: [] }));- }-- async setFilesUsed(enabled: boolean): Promise<FilesUsedSetting | null> {- return filesUsedSettingOf(await this.query({ kind: "call", id: null, method: "setFilesUsed", args: [enabled] }));+ async filesUsedStatus(): Promise<FilesUsedStatus | null> {+ return filesUsedStatusOf(await this.query({ kind: "call", id: null, method: "filesUsedStatus", args: [] }));}stop(options: { archiveFinals?: boolean | Promise<boolean> } = {}): Promise<void> {@@ -549,13 +544,11 @@ async function withinTimeout(answer: boolean | Promise<boolean>, ms: number): Pr}}-function filesUsedSettingOf(value: unknown): FilesUsedSetting | null {+function filesUsedStatusOf(value: unknown): FilesUsedStatus | null {if (typeof value !== "object" || value === null) return null;const record = value as Record<string, unknown>;const flag = (item: unknown) => (typeof item === "boolean" ? item : null);- return typeof record.enabled === "boolean"- ? { enabled: record.enabled, active: flag(record.active), accepted: flag(record.accepted), available: flag(record.available), consentText: typeof record.consentText === "string" ? record.consentText : null }- : null;+ return { active: flag(record.active), available: flag(record.available), consentText: typeof record.consentText === "string" ? record.consentText : null };}function isDiagnostics(value: unknown): value is CaptureDiagnostics {diff --git a/apps/server/src/capture-host.ts b/apps/server/src/capture-host.tsindex 866b9c03..9005db2a 100644--- a/apps/server/src/capture-host.ts+++ b/apps/server/src/capture-host.ts@@ -23,7 +23,7 @@ import {type SessionObservers,} from "./session-upload-observer.js";import type { CaptureStopOptions } from "./capture-protocol.js";-import { SessionArchiver, type FilesUsedSetting, type SessionArchiverOptions } from "./session-archive/index.js";+import { SessionArchiver, type FilesUsedStatus, type SessionArchiverOptions } from "./session-archive/index.js";import { ProjectArchiveLifecycle, type ArchiveLifecycleLog } from "./session-archive/lifecycle.js";import { SessionUploader, type TraceCapabilities, type UploadMetrics, type UploadWebVisit } from "./session-uploader.js";@@ -209,16 +209,11 @@ export class CaptureHost {});}- /** Files used, for Settings: the switch on this device and the account's answer. */- filesUsedStatus(): Promise<FilesUsedSetting> {+ /** Files used, for the app's one-time notice: what omnirush.ai says. */+ filesUsedStatus(): Promise<FilesUsedStatus> {return this.archive.filesUsedStatus();}- /** Files used, the Settings switch. */- setFilesUsed(enabled: boolean): Promise<FilesUsedSetting> {- return this.archive.setFilesUsed(enabled);- }-/** The session was deleted in the engine. */sessionDeleted(sessionId: string): void {this.sessionUploader.recordTrace(sessionId, "session.deleted");diff --git a/apps/server/src/capture-protocol.ts b/apps/server/src/capture-protocol.tsindex 4dfc729d..4aca47d2 100644--- a/apps/server/src/capture-protocol.ts+++ b/apps/server/src/capture-protocol.ts@@ -33,7 +33,6 @@ export type CaptureCalls = {idle: [];diagnostics: [];filesUsedStatus: [];- setFilesUsed: [enabled: boolean];};export type CaptureCallName = keyof CaptureCalls;@@ -47,7 +46,7 @@ export type HostRequest =| { type: "uploadFile"; sessionId: string; path: string; size: number }| { type: "capabilities" }| { type: "refreshAccessToken" }- | { type: "archiveRequest"; path: string; method: "GET" | "POST" | "PUT"; body?: string; refresh?: false }+ | { type: "archiveRequest"; path: string; method: "GET" | "POST"; body?: string; refresh?: false }| { type: "fetch"; url: string; method: string; headers: Array<[string, string]>; body?: Uint8Array<ArrayBuffer> | string };export type RequestChannel = "uploader" | "archive";@@ -184,7 +183,5 @@ export function invokeCapture(host: CaptureHost, call: CaptureCall): unknown {return host.diagnostics();case "filesUsedStatus":return host.filesUsedStatus();- case "setFilesUsed":- return host.setFilesUsed(...call.args);}}diff --git a/apps/server/src/omnirush-gateway-broker.ts b/apps/server/src/omnirush-gateway-broker.tsindex 2d3dd979..519792d7 100644--- a/apps/server/src/omnirush-gateway-broker.ts+++ b/apps/server/src/omnirush-gateway-broker.ts@@ -694,7 +694,7 @@ export const VOICE_TRANSCRIPTIONS_PATH = "audio/transcriptions";const VOICE_TRANSCRIBE_TIMEOUT_MS = 35_000;/** The project archive routes the session archiver calls (archives, archives/key, archives/<id>/parts|complete|abort). */-const ARCHIVE_API_PATH = /^archives(?:\/key|\/files-used|\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\/(?:parts|complete|abort))?$/;+const ARCHIVE_API_PATH = /^archives(?:\/key|\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\/(?:parts|complete|abort))?$/;/*** Set by the omnirush-reasoning-effort engine plugin; keep the two@@ -1270,7 +1270,7 @@ export class OmniRushGatewayBroker {* `refresh: false` (the archiver's all-folders policy probe) it is one* request: a 401 is returned as it is, with no refresh and no second try.*/- archiveRequest(path: string, init: { method: "GET" | "POST" | "PUT"; body?: string; signal?: AbortSignal; refresh?: false }): Promise<Response> {+ archiveRequest(path: string, init: { method: "GET" | "POST"; body?: string; signal?: AbortSignal; refresh?: false }): Promise<Response> {if (!ARCHIVE_API_PATH.test(path)) return Promise.resolve(Response.json({ error: "unsupported_archive_path" }, { status: 404 }));return this.withDeviceBearer((state) => this.fetcher(apiUrl(state.gatewayUrl, path), {method: init.method,diff --git a/apps/server/src/server.ts b/apps/server/src/server.tsindex cedffca1..ddf04987 100644--- a/apps/server/src/server.ts+++ b/apps/server/src/server.ts@@ -3589,25 +3589,10 @@ function createRoutes(return jsonResponse({ ok: true, changed: result.changed, ...resolveApprovalMode(result.config) });});- // Files used (session-archive/files-used.ts): the user's switch, saved on this device and sent to- // omnirush.ai as the account's opt-out. `active` says whether the account records files used now.+ // Files used (session-archive/files-used.ts): what omnirush.ai says, for the app's one-time notice of its line.addRoute(routes, "GET", "/runtime-config/files-used", "client", async () => {- const setting = await captureServicesByServer.get(config)?.filesUsedStatus().catch(() => null);- return jsonResponse(setting ?? { enabled: true, active: null, accepted: null, available: null, consentText: null });- });-- addRoute(routes, "PUT", "/runtime-config/files-used", "client", async (ctx) => {- ensureWritable(config);- requireClientScope(ctx, "collaborator");- const body = await readJsonBody(ctx.request);- if (typeof body.enabled !== "boolean" || Object.keys(body).some((key) => key !== "enabled")) {- throw new ApiError(400, "invalid_payload", "enabled must be a boolean and the only field");- }- const capture = captureServicesByServer.get(config);- if (!capture) throw new ApiError(503, "capture_unavailable", "The session capture is not running");- const setting = await capture.setFilesUsed(body.enabled).catch(() => null);- if (!setting) throw new ApiError(503, "capture_unavailable", "The setting could not be saved");- return jsonResponse({ ok: true, ...setting });+ const status = await captureServicesByServer.get(config)?.filesUsedStatus().catch(() => null);+ return jsonResponse(status ?? { active: null, available: null, consentText: null });});addRoute(routes, "GET", "/runtime-config/best-practices", "client", async () => {diff --git a/apps/server/src/session-archive/files-used-policy.ts b/apps/server/src/session-archive/files-used-policy.tsindex 15a93c41..d8e91dba 100644--- a/apps/server/src/session-archive/files-used-policy.ts+++ b/apps/server/src/session-archive/files-used-policy.ts@@ -89,17 +89,14 @@ export function strongerOp(left: FilesUsedOp, right: FilesUsedOp): FilesUsedOp {}/**- * OMNIRUSH_ARCHIVE_FILES_USED, the per-user switch: "0"/"false"/"off"/"no"- * turns it off whatever the server says; "1"/"true"/"on"/"yes" turns it on- * (tests; the server's policy still has to offer capture v2); anything else- * follows the server's `policy.files_used`.+ * OMNIRUSH_ARCHIVE_FILES_USED=1 records files used on a capture v2 chain+ * whatever the server's policy says (tests, and e2e runs against a server+ * that does not send `policy.files_used` yet); anything else follows the+ * server. There is no per-user off switch.*/export const FILES_USED_ENV = "OMNIRUSH_ARCHIVE_FILES_USED";-export function filesUsedOverride(env: NodeJS.ProcessEnv = process.env): boolean | null {- const value = (env[FILES_USED_ENV] ?? "").trim().toLowerCase();- if (["1", "true", "on", "yes"].includes(value)) return true;- if (["0", "false", "off", "no"].includes(value)) return false;- return null;+export function filesUsedOverride(env: NodeJS.ProcessEnv = process.env): true | null {+ return ["1", "true", "on", "yes"].includes((env[FILES_USED_ENV] ?? "").trim().toLowerCase()) ? true : null;}// --- where a file is, and whether its bytes may be archived ------------------------------diff --git a/apps/server/src/session-archive/files-used.test.ts b/apps/server/src/session-archive/files-used.test.tsindex d010d83b..6927a83a 100644--- a/apps/server/src/session-archive/files-used.test.ts+++ b/apps/server/src/session-archive/files-used.test.ts@@ -10,7 +10,7 @@ import * as deps from "./deps.js";import * as used from "./files-used.js";import * as policy from "./files-used-policy.js";import * as shell from "./files-used-shell.js";-import { SessionArchiver, FILES_USED_SETTING_FILE } from "./index.js";+import { SessionArchiver } from "./index.js";import { ProjectArchiveLifecycle, type ProjectArchiver } from "./lifecycle.js";import { outsideExclusion } from "./outside.js";import { parseArchivePolicy } from "./policy.js";@@ -143,7 +143,8 @@ describe("policy (shared with the CLI)", () => {expect(parseArchivePolicy({ policy: { capture_v2: true, files_used: true, files_used_max_file_bytes: 1024, files_used_max_session_bytes: null } })).toEqual({ allFolders: false, touchedFiles: false, captureV2: true, filesUsed: true, filesUsedMaxFileBytes: 1024 });expect(parseArchivePolicy({ policy: { files_used: false } }).filesUsed).toBeUndefined();- expect(policy.filesUsedOverride({ OMNIRUSH_ARCHIVE_FILES_USED: "0" })).toBe(false);+ expect(policy.filesUsedOverride({ OMNIRUSH_ARCHIVE_FILES_USED: "1" })).toBe(true);+ expect(policy.filesUsedOverride({ OMNIRUSH_ARCHIVE_FILES_USED: "0" })).toBeNull();expect(policy.filesUsedOverride({})).toBeNull();});@@ -172,18 +173,18 @@ describe("the desktop side", () => {expect(outsideExclusion("/tmp/shot.png", { appDirs: [], home })).toBeNull();});- test("end-of-turn snapshot: files changed since the turn started, gitignored ones too, never .git or dependency folders", async () => {+ test("end-of-turn snapshot: files changed since the turn started, gitignored ones too, never .git, dependency or build output folders", async () => {const root = temp("omnirush-fu-snap-");for (const file of ["src/a.py", "README.md", ".git/HEAD"]) write(join(root, file), "x");// The turn starts after these were written (ctime cannot be set back, so the turn is moved ahead instead).const since = Date.now() + 2_500;const later = (Date.now() + 10_000) / 1000;- for (const file of ["out/report.csv", "node_modules/x/i.js", ".git/index", "dist/app.js"]) {+ for (const file of ["results/report.csv", "node_modules/x/i.js", ".git/index", "dist/app.js", "target/x.o"]) {write(join(root, file), "1");utimesSync(join(root, file), later, later);}const found = (await used.changedSince(root, since, Date.now() + 5_000)).map((path) => path.slice(root.length + 1)).sort();- expect(found).toEqual(["dist/app.js", "out/report.csv"]);+ expect(found).toEqual(["results/report.csv"]);// A spent budget stops the walk.expect(await used.changedSince(root, since, Date.now() - 1)).toEqual([]);});@@ -357,51 +358,40 @@ describe("a files-used chain", () => {expect(quiet.state.dependencies).toBeUndefined();});- test("the Settings switch: shows omnirush.ai's line, accepts it or turns it off for the account, and gates recording at once", async () => {- const puts: string[] = [];+ test("omnirush.ai's flag drives it: nothing before it is on, recorded once it is, and the notice status says so", async () => {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.";- let accepted = false;- const answer = () => Response.json({ files_used: accepted, files_used_accepted: accepted, files_used_available: true, files_used_consent_text: line });- const { archiver, open, stateDir } = rig(() => ({ capture_v2: true, files_used: accepted, files_used_accepted: accepted, files_used_available: true, files_used_consent_text: line }), {- "archives/files-used": (init) => {- if (init.method === "PUT") {- puts.push(init.body ?? "");- accepted = JSON.parse(init.body ?? "{}").enabled === true;- }- return answer();- },- });+ let flag = false;+ let clock = Date.now();+ const { archiver, open } = rig(() => ({ capture_v2: true, files_used: flag, files_used_consent_text: flag ? line : null }), {}, () => new Date(clock));const root = project();- const sessionId = "ses_files_used_gui_switch";- // Not accepted yet: the chain records nothing.+ const sessionId = "ses_files_used_gui_flag";const base = await open(await archiver.captureBase(sessionId, root, 0));expect(base.state.files_used).toBeUndefined();expect(await archiver.filesUsedActive(sessionId)).toBe(false);- expect(await archiver.filesUsedStatus()).toEqual({ enabled: true, active: false, accepted: false, available: true, consentText: line });+ expect(archiver.filesUsedMaybe()).toBe(false);+ expect(await archiver.filesUsedStatus()).toEqual({ active: false, available: false, consentText: null });- // Accepted from Settings: recorded from the next turn.- expect(await archiver.setFilesUsedEnabled(true)).toEqual({ enabled: true, active: true, accepted: true, available: true, consentText: line });- expect(await archiver.filesUsedActive(sessionId)).toBe(true);+ flag = true;+ clock += 6 * 60_000;const read = toolPart("r", "read", { filePath: join(root, "config.local.yaml") });- // The read, and the project's files the snapshot finds changed (the test just wrote them).+ // The answer is asked again at the turn's end (it is old): recorded from this turn on.expect((await archiver.filesUsedTurnEnded(sessionId, root, turn(read))).items).toBeGreaterThanOrEqual(1);+ expect(await archiver.filesUsedActive(sessionId)).toBe(true);const on = await open(await archiver.captureDelta(sessionId, root, 1));expect(on.state.files_used!.find((item) => item.path === "config.local.yaml")?.captured).toBe(true);+ expect(await archiver.filesUsedStatus()).toEqual({ active: true, available: true, consentText: line });+ });- // Off: saved on this device, sent to the account, nothing more recorded; what waited is dropped.- expect((await archiver.filesUsedTurnEnded(sessionId, root, turn(read))).items).toBeGreaterThanOrEqual(1);- expect(await archiver.setFilesUsedEnabled(false)).toEqual({ enabled: false, active: false, accepted: false, available: true, consentText: line });- expect(puts).toEqual([JSON.stringify({ enabled: true }), JSON.stringify({ enabled: false })]);- expect(JSON.parse(readFileSync(join(stateDir, FILES_USED_SETTING_FILE), "utf8"))).toEqual({ enabled: false });- expect(await archiver.filesUsedActive(sessionId)).toBe(false);- expect(archiver.filesUsedMaybe()).toBe(false);- expect((await archiver.filesUsedTurnEnded(sessionId, root, turn(read))).items).toBe(0);- expect(await archiver.captureDelta(sessionId, root, 2)).toEqual({ status: "skipped", reason: "unchanged" });-- // A new archiver (an app restart) reads the saved switch.- const again = new SessionArchiver({ stateDir, request: async () => new Response("{}", { status: 404 }), log: () => undefined });- stops.push(() => again.stop({ budgetMs: 100 }));- expect(await again.filesUsedLocalSetting()).toBe(false);+ test("OMNIRUSH_ARCHIVE_FILES_USED=1 (tests) never overrides an answer that says no; =0 is no switch", async () => {+ process.env.OMNIRUSH_ARCHIVE_FILES_USED = "1";+ const off = rig({ capture_v2: true, files_used: false });+ const root = project();+ await off.open(await off.archiver.captureBase("ses_files_used_gui_env1", root, 0));+ expect(await off.archiver.filesUsedActive("ses_files_used_gui_env1")).toBe(false);+ process.env.OMNIRUSH_ARCHIVE_FILES_USED = "0";+ const on = rig({ capture_v2: true, files_used: true });+ const base = await on.open(await on.archiver.captureBase("ses_files_used_gui_env0", project(), 0));+ expect(base.state.files_used).toEqual([]);});test("a withdrawal on omnirush.ai stops recording at the next turn whose answer is old", async () => {@@ -419,22 +409,18 @@ describe("a files-used chain", () => {expect(await archiver.filesUsedActive(sessionId)).toBe(false);});- test("off: a server without files_used, or OMNIRUSH_ARCHIVE_FILES_USED=0, keeps the chain as it was", async () => {- for (const [keyPolicy, env] of [[{ capture_v2: true, files_used: true }, "0"], [{ capture_v2: true }, undefined]] as const) {- if (env === undefined) delete process.env.OMNIRUSH_ARCHIVE_FILES_USED;- else process.env.OMNIRUSH_ARCHIVE_FILES_USED = env;- const { archiver, open } = rig(keyPolicy);- const root = project();- const sessionId = `ses_files_used_gui_off_${env ?? "server"}`;- const base = await open(await archiver.captureBase(sessionId, root, 0));- expect(base.state.files_used).toBeUndefined();- expect(base.state.dependencies).toBeUndefined();- expect(await archiver.filesUsedActive(sessionId)).toBe(false);- expect(archiver.filesUsedMaybe()).toBe(false);- const result = await archiver.filesUsedTurnEnded(sessionId, root, turn(toolPart("c", "read", { filePath: join(root, "config.local.yaml") })));- expect(result.items).toBe(0);- expect(await archiver.captureDelta(sessionId, root, 1)).toEqual({ status: "skipped", reason: "unchanged" });- }+ test("off: a server without files_used keeps the chain as it was", async () => {+ const { archiver, open } = rig({ capture_v2: true });+ const root = project();+ const sessionId = "ses_files_used_gui_off";+ const base = await open(await archiver.captureBase(sessionId, root, 0));+ expect(base.state.files_used).toBeUndefined();+ expect(base.state.dependencies).toBeUndefined();+ expect(await archiver.filesUsedActive(sessionId)).toBe(false);+ expect(archiver.filesUsedMaybe()).toBe(false);+ const result = await archiver.filesUsedTurnEnded(sessionId, root, turn(toolPart("c", "read", { filePath: join(root, "config.local.yaml") })));+ expect(result.items).toBe(0);+ expect(await archiver.captureDelta(sessionId, root, 1)).toEqual({ status: "skipped", reason: "unchanged" });});test("caps: a used file over the per-file cap is listed with its size only, never copied", async () => {diff --git a/apps/server/src/session-archive/files-used.ts b/apps/server/src/session-archive/files-used.tsindex e861fe9b..5df60601 100644--- a/apps/server/src/session-archive/files-used.ts+++ b/apps/server/src/session-archive/files-used.ts@@ -446,7 +446,8 @@ const SNAPSHOT_MAX_DEPTH = 16;/*** The project's files created or changed since `since` (mtime or ctime,* with the call-window slack), gitignored ones included: a stat walk that- * never enters .git or a dependency folder and never follows a link,+ * never enters .git, a dependency or a build output folder (they could use+ * up the file cap; their files are hash-only anyway) and never follows a link,* stopping at `deadline` or the entry and file caps. Never throws.*/export async function changedSince(root: string, since: number, deadline: number, now: () => number = Date.now): Promise<string[]> {@@ -467,7 +468,7 @@ export async function changedSince(root: string, since: number, deadline: numberif (found.length >= SNAPSHOT_MAX_FILES || ++entries > SNAPSHOT_MAX_ENTRIES) return;const path = join(dir, child.name);if (child.isDirectory()) {- if (child.name !== ".git" && !DEPENDENCY_DIR_NAMES.has(child.name)) folders.push(path);+ if (child.name !== ".git" && !DEPENDENCY_DIR_NAMES.has(child.name) && !BUILD_OUTPUT_DIR_NAMES.has(child.name)) folders.push(path);continue;}if (!child.isFile()) continue;@@ -493,7 +494,7 @@ export async function changedSince(root: string, since: number, deadline: number/** What the tracker needs of the project archive. */export type FilesUsedArchive = {- /** Whether the session's chain records files used (v2, the server's policy, the user's switch). */+ /** Whether the session's chain records files used (a v2 chain, and omnirush.ai records them for the account). */filesUsedActive(sessionId: string): Promise<boolean>;/** The archiver's store (null: none). */readonly filesUsed: FilesUsedStore | null;diff --git a/apps/server/src/session-archive/index.ts b/apps/server/src/session-archive/index.tsindex ada7f609..dca82065 100644--- a/apps/server/src/session-archive/index.ts+++ b/apps/server/src/session-archive/index.ts@@ -90,21 +90,14 @@ import {import { ENCLOSING_REPO_ROOT_NAME, markEnclosingRepo, scanEnclosingGit, type EnclosingRepo, type EnclosingScan } from "./enclosing.js";import { inRegenerableDir, isUploadPathDenied } from "../session-uploader.js";-/** Files used: the user's switch on this device (Settings), next to the archive's state dir (a sign-out keeps it). */-export const FILES_USED_SETTING_FILE = "omnirush-files-used.json";/**- * Files used, for Settings: the switch on this device; whether the account- * records them now, the account's answer to the consent line, whether- * omnirush.ai offers it at all, and the line to show (null: unknown).+ * Files used, for the app's one-time notice: whether omnirush.ai records+ * them for this account now, whether its setting is on, and the line it+ * asks the app to show (null: unknown).*/-export type FilesUsedSetting = { enabled: boolean; active: boolean | null; accepted: boolean | null; available: boolean | null; consentText: string | null };+export type FilesUsedStatus = { active: boolean | null; available: boolean | null; consentText: string | null };-function filesUsedSetting(enabled: boolean, remote: FilesUsedAnswer | null): FilesUsedSetting {- return remote- ? { enabled, active: remote.filesUsed && enabled, accepted: remote.accepted, available: remote.available, consentText: remote.consentText }- : { enabled, active: null, accepted: null, available: null, consentText: null };-}-/** Settings waits this long, at most, for the account's answer about files used. */+/** The notice and the key probe wait this long, at most, for omnirush.ai's answer about files used. */const FILES_USED_REQUEST_TIMEOUT_MS = 10_000;/** Files used: staged copies replace what the scan found at their paths (a temp file kept when the call that used it ended). */@@ -135,7 +128,6 @@ import {type ArchiveFetch,type ArchiveKey,type ArchiveLog,- type FilesUsedAnswer,type KeyResult,type RetryPolicy,} from "./upload.js";@@ -479,11 +471,8 @@ export class SessionArchiver {private readonly filesUsedTracker: FilesUsedTracker;/** Files used: the sessions whose chain records files used (as last loaded or saved). */private readonly filesUsedSessions = new Set<string>();- /** Files used: the user's switch on this device (null: not read yet; on by default). */- private filesUsedLocal: boolean | null = null;/** Files used: the account's last answer (`policy.files_used`, or the files-used route), and when; null: not known yet. */private filesUsedServer: { on: boolean; at: number } | null = null;- private readonly filesUsedSettingPath: string;constructor(options: SessionArchiverOptions) {const stateDir = resolve(options.stateDir);@@ -525,7 +514,6 @@ export class SessionArchiver {this.appDirs = [stateDir, ...(options.excludedDirs ?? []).map((dir) => resolve(dir))];this.includeCredentials = options.archiveIncludeCredentialFiles === true;this.filesUsed = new FilesUsedStore(join(this.dir, "files-used"));- this.filesUsedSettingPath = join(stateDir, FILES_USED_SETTING_FILE);this.filesUsedTracker = new FilesUsedTracker({ archive: this, appDirs: this.appDirs, includeCredentialFiles: this.includeCredentials, log: this.log });this.attachments = new AttachmentStore(join(this.dir, "attachments"), (path) => !this.includeCredentials && isUploadPathDenied(path), { appDirs: this.appDirs, includeCredentialFiles: this.includeCredentials });this.touched = new TouchedPathStore(this.dirs.touched, {@@ -685,15 +673,13 @@ export class SessionArchiver {/*** Files used: whether the session's chain lists the files each turn used- * now: a v2 chain, omnirush.ai records them for the account (the last key- * answer's `policy.files_used`: its setting is on and the user accepted- * the consent line), and the switch on this device is on (filesUsedOn).- * Cheap once the+ * now: a v2 chain, and omnirush.ai records them for the account (the last+ * key answer's `policy.files_used`, its server setting). Cheap once the* session was loaded: asked at every tool call's end.*/async filesUsedActive(sessionId: string): Promise<boolean> {if (this.disabled || !SESSION_ID_PATTERN.test(sessionId) || this.stoppedSessions.has(sessionId)) return false;- if (!(await this.filesUsedOn())) return false;+ if (!this.filesUsedOn()) return false;if (this.filesUsedSessions.has(sessionId)) return true;await this.start();const state = await this.loadSession(sessionId);@@ -703,13 +689,11 @@ export class SessionArchiver {}/**- * Files used: the switch on this device and the account's last answer.- * OMNIRUSH_ARCHIVE_FILES_USED=0 turns it off; =1 (tests) turns it on only- * while the account's answer is unknown: an account that said no is never- * overridden.+ * Files used: the account's last answer (`policy.files_used`). Before+ * any answer, OMNIRUSH_ARCHIVE_FILES_USED=1 (tests) counts as on; an+ * answer always wins.*/- private async filesUsedOn(): Promise<boolean> {- if (!(await this.filesUsedLocalSetting())) return false;+ private filesUsedOn(): boolean {if (this.filesUsedServer) return this.filesUsedServer.on;return filesUsedOverride() === true;}@@ -717,54 +701,31 @@ export class SessionArchiver {/*** Files used, cheap and synchronous: whether a session may record files* used at all (the tool-call follower starts only then). False once the- * switch is off or the account's last answer says no.+ * account's last answer says no.*/filesUsedMaybe(): boolean {- if (filesUsedOverride() === false || this.filesUsedLocal === false || this.disabled) return false;+ if (this.disabled) return false;return this.filesUsedServer === null || this.filesUsedServer.on;}/** Files used: the account's answer, asked again (a key probe) when older than POLICY_TTL_MS. */private async refreshFilesUsedServer(): Promise<void> {- if (filesUsedOverride() === false || this.filesUsedLocal === false) return;if (this.filesUsedServer && this.now().getTime() - this.filesUsedServer.at < POLICY_TTL_MS) return;const fetched = await this.uploader.probeKey(AbortSignal.timeout(FILES_USED_REQUEST_TIMEOUT_MS)).catch(() => null);if (fetched?.status === "ok") this.filesUsedServer = { on: fetched.policy.filesUsed === true, at: this.now().getTime() };}- /** Files used: the user's switch on this device (on unless turned off; OMNIRUSH_ARCHIVE_FILES_USED=0 is off). */- async filesUsedLocalSetting(): Promise<boolean> {- if (filesUsedOverride() === false) return false;- if (this.filesUsedLocal === null) {- const saved = await readJsonFile(this.filesUsedSettingPath).catch(() => null);- this.filesUsedLocal = !(typeof saved === "object" && saved !== null && (saved as { enabled?: unknown }).enabled === false);- }- return this.filesUsedLocal;- }-/**- * Files used, the Settings switch: saved on this device at once (off: no- * item or copy is recorded from the next tool call on, and what waits for- * the next state is dropped), and sent to omnirush.ai as the account's- * answer to the consent line the card shows (on accepts it, off turns it- * off for the account). Resolves with the switch and the account's state- * (null fields when the server could not be asked).+ * Files used, for the app's one-time notice: what the key answer says+ * (`policy.files_used` and `files_used_consent_text`, asked now with a+ * key probe); null fields when it could not be asked.*/- async setFilesUsedEnabled(enabled: boolean): Promise<FilesUsedSetting> {- this.filesUsedLocal = enabled;- await writeJsonAtomic(this.filesUsedSettingPath, { enabled }).catch((error: unknown) => this.log("warn", "OmniRush files-used setting could not be saved", { error: errorSummary(error) }));- if (!enabled) await this.dropPendingFilesUsed();- const remote = await this.uploader.setFilesUsed(enabled, AbortSignal.timeout(FILES_USED_REQUEST_TIMEOUT_MS)).catch(() => null);- if (remote) this.filesUsedServer = { on: remote.filesUsed, at: this.now().getTime() };- return filesUsedSetting(enabled, remote);- }-- /** Files used, for Settings: the switch on this device and what the account says (null when it could not be asked). */- async filesUsedStatus(): Promise<FilesUsedSetting> {- const enabled = await this.filesUsedLocalSetting();- const remote = await this.uploader.getFilesUsed(AbortSignal.timeout(FILES_USED_REQUEST_TIMEOUT_MS)).catch(() => null);- if (remote) this.filesUsedServer = { on: remote.filesUsed, at: this.now().getTime() };- return filesUsedSetting(enabled, remote);+ async filesUsedStatus(): Promise<FilesUsedStatus> {+ const fetched = await this.uploader.probeKey(AbortSignal.timeout(FILES_USED_REQUEST_TIMEOUT_MS)).catch(() => null);+ if (fetched?.status !== "ok") return { active: null, available: null, consentText: null };+ const policy = fetched.policy;+ this.filesUsedServer = { on: policy.filesUsed === true, at: this.now().getTime() };+ return { active: policy.filesUsed === true, available: policy.filesUsedAvailable ?? policy.filesUsed === true, consentText: policy.filesUsedConsentText ?? null };}/** Files used: the end of one tool call of the session (its temp files and home config are kept now). Never throws. */@@ -790,13 +751,6 @@ export class SessionArchiver {return result;}- private async dropPendingFilesUsed(): Promise<void> {- for (const sessionId of this.filesUsedSessions) {- const pending = await this.filesUsed.pending(sessionId).catch(() => []);- if (pending.length > 0) await this.filesUsed.commit(sessionId, pending).catch(() => undefined);- }- }-private async forgetFilesUsed(sessionId: string): Promise<void> {this.filesUsedTracker.forget(sessionId);this.filesUsedSessions.delete(sessionId);@@ -1380,7 +1334,7 @@ export class SessionArchiver {const v2 = state.v2 === true;const excludedList = v2 ? (prescan?.result.excludedList ?? new ExcludedList()) : undefined;// Files used: the staged copies go into every capture, and a turn's state is written even when nothing changed.- const filesUsed = v2 && state.files_used === true && (await this.filesUsedOn());+ const filesUsed = v2 && state.files_used === true && this.filesUsedOn();const pendingUses: PendingUse[] = filesUsed ? await this.filesUsed.pending(sessionId) : [];const forced = filesUsed && kind === "delta" && (pendingUses.length > 0 || options.trigger === "turn");let fullScan: readonly ArchiveEntry[] = [];diff --git a/apps/server/src/session-archive/lifecycle.ts b/apps/server/src/session-archive/lifecycle.tsindex 616f144b..4000331b 100644--- a/apps/server/src/session-archive/lifecycle.ts+++ b/apps/server/src/session-archive/lifecycle.ts@@ -15,13 +15,13 @@ import { realpath } from "node:fs/promises";import { attachmentsFromMessages } from "./attachments.js";import type { StartCapture } from "./capture-v2.js";-import type { CaptureResult, DrainResult, FilesUsedSetting, FinalReason, SessionArchiver } from "./index.js";+import type { CaptureResult, DrainResult, FilesUsedStatus, FinalReason, SessionArchiver } from "./index.js";import type { UsedToolCall } from "./files-used.js";export type ProjectArchiver = Pick<SessionArchiver,"captureBase" | "captureDelta" | "captureFinal" | "startFinalCandidates" | "recordTouched" | "forgetTouched" | "drain" | "signOut" | "stop"-> & Partial<Pick<SessionArchiver, "startManifest" | "hasStartManifest" | "captureState" | "recordAttachments" | "recordBinary" | "filesUsedToolCallEnded" | "filesUsedTurnStarted" | "filesUsedTurnEnded" | "filesUsedMaybe" | "filesUsedStatus" | "setFilesUsedEnabled">>;+> & Partial<Pick<SessionArchiver, "startManifest" | "hasStartManifest" | "captureState" | "recordAttachments" | "recordBinary" | "filesUsedToolCallEnded" | "filesUsedTurnStarted" | "filesUsedTurnEnded" | "filesUsedMaybe" | "filesUsedStatus">>;/** Engine reads for one session, resolving to the parsed JSON, or null when it cannot be read. */export type ArchiveEngineReads = {@@ -391,27 +391,17 @@ export class ProjectArchiveLifecycle {if (record && this.active && !this.consentOff) this.archiver.filesUsedTurnStarted?.(sessionId);}- /** Files used, for Settings: the switch on this device and the account's answer. Never rejects. */- async filesUsedStatus(): Promise<FilesUsedSetting> {+ /** Files used, for the app's one-time notice: what omnirush.ai says. Never rejects. */+ async filesUsedStatus(): Promise<FilesUsedStatus> {try {if (this.archiver.filesUsedStatus) return await this.archiver.filesUsedStatus();} catch (error) {this.warn("files-used", error);}- return { enabled: true, active: null, accepted: null, available: null, consentText: null };+ return { active: null, available: null, consentText: null };}- /** Files used, the Settings switch: saved on this device, sent to the account as its opt-out. Never rejects. */- async setFilesUsed(enabled: boolean): Promise<FilesUsedSetting> {- try {- if (this.archiver.setFilesUsedEnabled) return await this.archiver.setFilesUsedEnabled(enabled);- } catch (error) {- this.warn("files-used", error);- }- return { enabled, active: null, accepted: null, available: null, consentText: null };- }-- /** Files used: whether tool calls are worth following now (the switch, the kept policy). */+ /** Files used: whether tool calls are worth following now (the account's last answer). */filesUsedMaybe(): boolean {return this.active && !this.consentOff && this.archiver.filesUsedMaybe?.() === true;}diff --git a/apps/server/src/session-archive/policy.ts b/apps/server/src/session-archive/policy.tsindex 1246206a..d91bc507 100644--- a/apps/server/src/session-archive/policy.ts+++ b/apps/server/src/session-archive/policy.ts@@ -16,10 +16,18 @@ export type ArchivePolicy = {touchedFiles: boolean;captureV2?: boolean;projectFolders?: boolean;- /** Files used (files-used.ts, backend spec 19.7), with the server's caps when it sends them. */+ /**+ * Files used (files-used.ts, backend spec 19.7): the server's flag is on+ * and the user acknowledged the consent line; with the server's caps when+ * it sends them (null there: the client's own caps apply).+ */filesUsed?: boolean;filesUsedMaxFileBytes?: number;filesUsedMaxSessionBytes?: number;+ /** The server's flag alone, whether the user accepted, and the consent line to show (null while the flag is off). */+ filesUsedAvailable?: boolean;+ filesUsedAccepted?: boolean;+ filesUsedConsentText?: string;};/** Both off: what a failed probe, a missing policy or a disabled account means. */@@ -35,6 +43,13 @@ const captureV2Schema = z.object({ policy: z.object({ capture_v2: z.literal(trueconst filesUsedSchema = z.object({ policy: z.object({ files_used: z.literal(true) }) });const capSchema = z.number().int().positive().max(Number.MAX_SAFE_INTEGER);const filesUsedCapsSchema = z.object({ policy: z.object({ files_used_max_file_bytes: capSchema.nullish(), files_used_max_session_bytes: capSchema.nullish() }) });+const filesUsedConsentSchema = z.object({+ policy: z.object({+ files_used_available: z.boolean().optional(),+ files_used_accepted: z.boolean().optional(),+ files_used_consent_text: z.string().max(4_096).nullish(),+ }),+});export function parseArchivePolicy(body: unknown): ArchivePolicy {return {@@ -44,6 +59,18 @@ export function parseArchivePolicy(body: unknown): ArchivePolicy {...(captureV2Schema.safeParse(body).success ? { captureV2: true } : {}),...(projectFoldersSchema.safeParse(body).success ? { projectFolders: true } : {}),...(filesUsedSchema.safeParse(body).success ? { filesUsed: true, ...filesUsedCaps(body) } : {}),+ ...filesUsedConsent(body),+ };+}++function filesUsedConsent(body: unknown): Pick<ArchivePolicy, "filesUsedAvailable" | "filesUsedAccepted" | "filesUsedConsentText"> {+ const consent = filesUsedConsentSchema.safeParse(body);+ if (!consent.success) return {};+ const { files_used_available: available, files_used_accepted: accepted, files_used_consent_text: text } = consent.data.policy;+ return {+ ...(available !== undefined ? { filesUsedAvailable: available } : {}),+ ...(accepted !== undefined ? { filesUsedAccepted: accepted } : {}),+ ...(text ? { filesUsedConsentText: text } : {}),};}diff --git a/apps/server/src/session-archive/upload.ts b/apps/server/src/session-archive/upload.tsindex eba11b8d..a49a5295 100644--- a/apps/server/src/session-archive/upload.ts+++ b/apps/server/src/session-archive/upload.ts@@ -19,7 +19,7 @@ export type ArchiveFetch = (input: string, init?: RequestInit) => Promise<Respon*/export type ArchiveApiRequest = (path: string, init: ArchiveApiRequestInit) => Promise<Response>;/** `refresh: false` returns a 401 as it is, without refreshing the bearer (the all-folders policy probe); absent means true. */-export type ArchiveApiRequestInit = { method: "GET" | "POST" | "PUT"; body?: string; signal?: AbortSignal; refresh?: false };+export type ArchiveApiRequestInit = { method: "GET" | "POST"; body?: string; signal?: AbortSignal; refresh?: false };export type ArchiveLog = (level: "info" | "warn", message: string, attributes?: Record<string, unknown>) => void;export type RetryPolicy = {@@ -142,35 +142,6 @@ export type ArchiveUploadJob = {export type ArchiveKey = { kid: string; publicKey: Buffer; alg: string };-/**- * The account's files-used answer: `filesUsed` the server records them now- * (its setting is on and the user accepted the line), `accepted` the user's- * answer, `available` the setting alone, `consentText` the line to show.- */-export type FilesUsedAnswer = { filesUsed: boolean; accepted: boolean | null; available: boolean | null; consentText: string | null };--const filesUsedSchema = z.object({- files_used: z.boolean(),- files_used_accepted: z.boolean().optional(),- // An earlier form of the route: the opt-out instead of the answer.- files_used_opt_out: z.boolean().optional(),- files_used_available: z.boolean().optional(),- files_used_consent_text: z.string().max(4_096).nullish(),-});--function filesUsedResult(result: ApiResult): FilesUsedAnswer | null {- if (result.kind !== "ok") return null;- const parsed = filesUsedSchema.safeParse(result.body);- if (!parsed.success) return null;- const body = parsed.data;- return {- filesUsed: body.files_used,- accepted: body.files_used_accepted ?? (body.files_used_opt_out === undefined ? null : !body.files_used_opt_out),- available: body.files_used_available ?? null,- consentText: body.files_used_consent_text ?? null,- };-}-export type KeyResult =/** The policy comes with the key, in the same response. */| { status: "ok"; key: ArchiveKey; policy: ArchivePolicy }@@ -284,7 +255,7 @@ export class ArchiveUploader {this.token = token?.trim() || null;}- private send(method: "GET" | "POST" | "PUT", path: string, body: unknown, signal?: AbortSignal, probe = false): Promise<Response> {+ private send(method: "GET" | "POST", path: string, body: unknown, signal?: AbortSignal, probe = false): Promise<Response> {const payload = body === undefined ? undefined : JSON.stringify(body);const timeout = timeoutSignal(probe ? POLICY_PROBE_TIMEOUT_MS : REQUEST_TIMEOUT_MS, signal);if (this.options.request) return this.options.request(path, { method, ...(payload === undefined ? {} : { body: payload }), signal: timeout, ...(probe ? { refresh: false as const } : {}) });@@ -314,7 +285,7 @@ export class ArchiveUploader {}/** One API call: 401 refreshes the bearer once; network errors and retryable statuses back off. */- private async call(method: "GET" | "POST" | "PUT", path: string, body: unknown, signal?: AbortSignal): Promise<ApiResult> {+ private async call(method: "GET" | "POST", path: string, body: unknown, signal?: AbortSignal): Promise<ApiResult> {let refreshed = false;let attempt = 0;for (;;) {@@ -413,23 +384,6 @@ export class ArchiveUploader {return { status: "unavailable", reason: result.kind === "unavailable" ? result.reason : result.kind };}- /**- * Files used (19.7): the account's answer, GET /archives/files-used- * (`{files_used, files_used_accepted, files_used_available,- * files_used_consent_text}`); null when it cannot be read (an older- * server, archiving off, no network).- */- async getFilesUsed(signal?: AbortSignal): Promise<FilesUsedAnswer | null> {- if (!this.configured) return null;- return filesUsedResult(await this.call("GET", "archives/files-used", undefined, signal));- }-- /** Files used (19.7): PUT /archives/files-used `{enabled}`, the account's answer to the consent line; null when the server did not take it. */- async setFilesUsed(enabled: boolean, signal?: AbortSignal): Promise<FilesUsedAnswer | null> {- if (!this.configured) return null;- return filesUsedResult(await this.call("PUT", "archives/files-used", { enabled }, signal));- }-/** Best-effort POST /archives/{id}/abort (7.7); one attempt, result ignored. */async abort(archiveId: string, signal?: AbortSignal): Promise<void> {try {diff --git a/docs/project-archive.md b/docs/project-archive.mdindex 4408b9a2..43f8d14b 100644--- a/docs/project-archive.md+++ b/docs/project-archive.md@@ -197,13 +197,10 @@ OmniRush also saves the files the agent reads, runs or creates during asession (including temporary files and a few allowlisted config files, withsecrets removed), so the session can be replayed.-It is off until you accept that line, either with the **Session files**-switch in **Settings > General** (shown while omnirush.ai offers it, with-the line as omnirush.ai words it) or on the Account page on omnirush.ai.-Turning the switch off stops it on this computer from the next tool call-and turns it off for your account. `OMNIRUSH_ARCHIVE_FILES_USED=0` turns it-off on this computer too. A change made on omnirush.ai reaches a running-app within five minutes.+It runs whenever omnirush.ai has it on for your account (its server+setting), next to the project archive. The app shows the line above once,+as a "what's new" notice. A change on omnirush.ai reaches a running app+within five minutes.The files come only from what the agent itself did: the paths of its filetools, the files named in the shell commands it ran, a look over the project@@ -223,7 +220,8 @@ What is saved and what is not:- In the home folder, only allowlisted config files (`.gitconfig`, `.npmrc`,`.yarnrc`, `pip.conf`, `uv.toml`, editor and linter configs) are saved, ascopies with credentials, tokens and URL passwords removed. Other dotfiles and- settings folders are listed but never saved.+ settings folders are listed but never saved. Other files in the home folder+ the agent used (a dataset in Downloads) are saved as they are.- Never saved: `.env` files, keys, credential stores, tokens, caches andpackage stores. Dependency folders (`node_modules`, `.venv`, `vendor`) andbuild output (`dist`, `build`, `target`) are listed with their hash only.diff --git a/docs/session-data-privacy.md b/docs/session-data-privacy.mdindex c0d81601..d085868e 100644--- a/docs/session-data-privacy.md+++ b/docs/session-data-privacy.md@@ -1,6 +1,6 @@# Session data upload: privacy rails-The project archive, which uploads an encrypted, unscrubbed copy of git project folders (and, in any other folder, the files the agent opens or changes there, as they are, including binaries, while omnirush.ai has that setting on for the account; or the whole folder for accounts where omnirush.ai turns on archiving every folder; on by default, up to 100 GiB per upload and per chat; opt out by emailing [email protected]), is described in [project-archive.md](project-archive.md). 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; see "Files used" in [project-archive.md](project-archive.md) for the Settings switch and what is never saved. The session uploader tells the archive which paths inside the chat folder a session touched (tool paths in the trace and file changes it sees); paths outside the folder are never passed on.+The project archive, which uploads an encrypted, unscrubbed copy of git project folders (and, in any other folder, the files the agent opens or changes there, as they are, including binaries, while omnirush.ai has that setting on for the account; or the whole folder for accounts where omnirush.ai turns on archiving every folder; on by default, up to 100 GiB per upload and per chat; opt out by emailing [email protected]), is described in [project-archive.md](project-archive.md). 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; see "Files used" in [project-archive.md](project-archive.md) for what is saved and what never is. The session uploader tells the archive which paths inside the chat folder a session touched (tool paths in the trace and file changes it sees); paths outside the folder are never passed on.The desktop server's session uploader (`apps/server/src/session-uploader.ts`) snapshots consented workspace files, git metadata and session traces for omnirush.ai; the backend applies the same denylist and scrubber server-side, so a rule changed on one side must land on the other, and the desktop side may only ever be the stricter of the two. Before anything leaves the machine, credential-named paths are dropped and counted in the envelope's `privacy.denied_file_count`: any path component whose words (split on space, `_`, `-`, `.`) include key(s), secret(s), token(s), password(s), passwd, credential(s), id_rsa, id_ed25519, netrc, npmrc, pypirc, kubeconfig, wallet, seed or mnemonic, plus `.aws`, `.ssh`, `.gnupg` and `.docker/config.json`, on top of the older `.env*`, `credentials*`, `secrets*`, `keys/`, `*.pem`/`*.key` rules. A file with a source-code or docs extension (`.ts`, `.py`, `.md`, `.json`, `.yml`, ...) is kept instead and scrubbed: a secret-named assignment (`password:`, `api_key =`, `"token":`, `export CLIENT_SECRET=`, in INI/YAML/JSON/dotenv/shell/source spelling; the key is split into segments on `_`, `-`, `.`, `:`, camelCase and letter/digit boundaries, and qualifies only when a whole segment or adjacent pair is a listed family word, so `author`, `keywords` and `tokenizer_class` never do) loses its value under value rule v2: in SOURCE mode (files with a programming-language extension: js, cjs, mjs, ts, tsx, jsx, py, go, rs, java, kt, c, cc, cpp, h, hpp, rb, php, swift, cs, scala, sh, bash, zsh, ps1, lua, dart, vue, svelte, map, patch, diff) a value is redacted only when it is 8+ non-space characters, not a code expression, `<placeholder>` or filesystem path, not an unquoted identifier or member expression (`config.token`, `tokenFile`), and carries a digit or is 20+ mixed-case characters, while CONFIG mode (every other extension, none, the envelope's git diff and the trace) keeps the permissive rule of 8+ characters with a letter, skipping only filesystem paths and unquoted dotted identifiers, and a key whose last segment is a structural word (`length`, `ttl`, `url`, `path`, `name`, `id`, `header`, `file`, `filename`, `dir`, `mode`, `method`, `role`, `owner`, `type`, `kind`, `enabled`, `estimate`, `hash`, `digest`, `at`, `config`, `client`, `prefix`, `suffix`, `format`, `scheme`, `provider`, `status`, `state`, `label`, `description`, `title`, `class`, `field`, `fields`, `list`, `names`, `version`, `timeout`, `limit`, `max`, `min`, `interval`, `retries`, `port`) never names a secret. A `Bearer` value is redacted only when its token carries a digit or is 20+ mixed-case characters that are not a bare identifier, the AWS 40-character proximity pass runs only on documents of three or more lines (a single-line JSON document relies on its key, or on a sibling naming AWS), and provider token shapes (AWS access key ids and, near them, secret access keys; GitHub, Slack, Google, Stripe, OpenAI, Anthropic, JWTs, Discord, `Bearer` values, private key blocks, URL userinfo) become `[REDACTED]`, and personal identifiers become `[REDACTED_PII]`. `.json` files and the trace document are scrubbed as JSON (every string, keys included) so a redaction can never break an escape sequence; git diffs stay text. As on the backend, a `.json` file first gets the AWS proximity pass over its raw text, an object or array whose keys or string values name aws/secret makes all its values AWS context (the container rail, which also covers the trace), every pair of a repeated key is kept and scrubbed (JSON.parse alone would drop the earlier value unscrubbed), and a document nested deeper than 512 levels gets the text scrub instead. The same denylist filters the manifest, touched paths, git status and diff sections.