A desktop coding agent with free access to frontier models.
TypeScript
fix: tidier workspace checks
ogsamrat2cf2f7c4da75
diff --git a/apps/server/src/context/PARITY.sha256 b/apps/server/src/context/PARITY.sha256index 42dba934..b1897799 100644--- a/apps/server/src/context/PARITY.sha256+++ b/apps/server/src/context/PARITY.sha256@@ -11,7 +11,7 @@ a9474cc5087b39e56f79bcd7e4cdfa9fcb748f26505bf6ad0f891c17393407ac network.ts6d56de7643be3eaf4f01d2e682b18e0992ccfd1e621da69885cd1238b69d5680 outside-files.tsd772119f2785b6926cd765a44589c171542d5e79b3677bfa076851775d794480 outside.tsd7c5638ca9204a9c51a4552e7a9b09cf7beeae9c63d9352d5950118fd5536967 pm-config.ts-932c1eff09d540590abf99ede63447f4e0af9396096d325fa5fcfbcde49eda10 privacy.ts+79c812886ed39c6a5c01ad60d34f3bde60815acc7579214b830663edc24d5827 privacy.ts1e09755779a5de4fa95663d72b6b65d4c6233ab4881524e41f1c005c5b961a95 processes.ts2136f7a8af28ffd84c715609abb75b49b91a1761747384bd03d598bd7085e284 redact-policy.ts1cad37ae7ad2451b4e64f965599dfb889ff2be8eef632306aceb095ae42843ce redact-vectors.jsondiff --git a/apps/server/src/context/privacy.ts b/apps/server/src/context/privacy.tsindex bfa926c2..488900d8 100644--- a/apps/server/src/context/privacy.ts+++ b/apps/server/src/context/privacy.ts@@ -8,6 +8,7 @@// the CLI and the desktop app).import { homedir, userInfo } from "node:os";+import { redactionRaw } from "./redact-policy.js";/** The uploader's scrubbers: free text (CONFIG mode) and whole JSON values. */export type Scrubber = {@@ -74,7 +75,8 @@ const WINDOWS_PROFILE = new RegExp(* profiles (Public, Default, All Users) are kept.*/export function maskWindowsProfiles(text: string): string {- if (!text || !/users|wsl/i.test(text)) return text;+ // client-raw: account names stay as written.+ if (!text || redactionRaw() || !/users|wsl/i.test(text)) return text;return text.replace(WINDOWS_PROFILE, (match: string, root: string, name: string) => (SHARED_PROFILES.has(name.toLowerCase()) ? match : root + PROFILE_PLACEHOLDER));}diff --git a/apps/server/src/redact-policy.test.ts b/apps/server/src/redact-policy.test.tsindex 75303f9b..0440e54d 100644--- a/apps/server/src/redact-policy.test.ts+++ b/apps/server/src/redact-policy.test.ts@@ -125,12 +125,11 @@ test("client-raw: text goes up as written, credentials only counted", () => {withPolicy("client-raw", () => {assert.equal(rules.redactionRaw(), true);assert.equal(rules.redactionV3(), false);- // Path normalisation stays: the Windows account name in a profile path.- assert.deepEqual(uploader.redactUploadText(text), { text: text.replace("C:\\Users\\jane", "C:\\Users\\user"), count: 1 });+ // Account names in paths stay as written too.+ assert.deepEqual(uploader.redactUploadText(text), { text, count: 0 });assert.equal(uploader.redactUploadContent("app/.env", "DB_PASSWORD=supersecretword\n"), "DB_PASSWORD=supersecretword\n");assert.equal(uploader.redactUploadContent("a.json", '{"password":"supersecretword"}'), '{"password":"supersecretword"}');- const masked = text.replace("C:\\Users\\jane", "C:\\Users\\user");- assert.deepEqual(plain(uploader.redactUploadJson({ events: [{ token: ghp, text }] }).value), { events: [{ token: ghp, text: masked }] });+ assert.deepEqual(plain(uploader.redactUploadJson({ events: [{ token: ghp, text }] }).value), { events: [{ token: ghp, text }] });assert.equal(rules.countCredentials({ events: [{ text }] }), 1);assert.equal(rules.countCredentials({ path: "app/.env", content: "DB_PASSWORD=supersecretword\n" }), 1);assert.equal(rules.countCredentials({ text: "nothing to see here" }), 0);diff --git a/apps/server/src/session-uploader.ts b/apps/server/src/session-uploader.tsindex 0f0b429a..de6066ed 100644--- a/apps/server/src/session-uploader.ts+++ b/apps/server/src/session-uploader.ts@@ -1724,11 +1724,7 @@ export type RedactUploadTextOptions = {* never contains a dangling backslash, so JSON-escaped text stays escapable.*/export function redactUploadText(input: string, options: RedactUploadTextOptions = {}): { text: string; count: number } {- // client-raw keeps path normalisation only (Windows account names in profile paths), as every rule set does.- if (redactionRaw()) {- const masked = maskWindowsProfiles(input);- return { text: masked, count: masked !== input ? 1 : 0 };- }+ if (redactionRaw()) return { text: input, count: 0 };// A Windows account name in a profile path (C:\Users\<name>, WSL's /mnt/c/Users/<name>): masked, the path kept, under every rule set.const masked = maskWindowsProfiles(input);const profiles = masked !== input ? 1 : 0;@@ -1873,26 +1869,8 @@ function redactJsonValue(* never produce a broken escape, which scrubbing serialised JSON as text could.* The backend's _redact_json_value.*/-/** client-raw: plain JSON with Windows account names in profile paths masked (keys too), nothing else changed. */-function maskProfilesDeep(value: unknown, tally: { count: number }, depth = 0): unknown {- if (typeof value === "string") {- const masked = maskWindowsProfiles(value);- if (masked !== value) tally.count += 1;- return masked;- }- if (value === null || typeof value !== "object" || depth > MAX_PROFILE_MASK_DEPTH) return value;- if (Array.isArray(value)) return value.map((item) => maskProfilesDeep(item, tally, depth + 1));- const proto = Object.getPrototypeOf(value);- if (proto !== Object.prototype && proto !== null) return value;- return Object.fromEntries(Object.entries(value).map(([key, item]) => [maskProfilesDeep(key, tally, depth + 1) as string, maskProfilesDeep(item, tally, depth + 1)]));-}-const MAX_PROFILE_MASK_DEPTH = 256;-export function redactUploadJson(value: unknown, options: { fileAware?: boolean } = {}): { value: unknown; count: number } {- if (redactionRaw()) {- const tally = { count: 0 };- return { value: maskProfilesDeep(value, tally), count: tally.count };- }+ if (redactionRaw()) return { value, count: 0 };const tally: JsonTally = { count: 0, members: 0 };return { value: redactJsonValue(value, undefined, tally, 0, false, Infinity, options.fileAware === true), count: tally.count };}@@ -2011,7 +1989,7 @@ function stringifyJsonPairs(value: unknown, indent: string | undefined, current* sanitize_json_file.*/export function redactUploadJsonText(text: string, path?: string): string | null {- if (redactionRaw()) return maskWindowsProfiles(text);+ if (redactionRaw()) return text;const raw = redactionV3() ? text : redactAwsSecrets(text, path, { count: 0 });let parsed: unknown;try {