Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

feat: recycle media through OS facilities PortOS owns instead of the trash package (#12246)

[._.]/ Adam Eivy548af3dbf099
diff --git a/docs/DEPS.md b/docs/DEPS.md
index 139350b3c3..919e6d032c 100644
--- a/docs/DEPS.md
+++ b/docs/DEPS.md
@@ -42,7 +42,7 @@ Before removing a Tier 3 candidate, run a transitive-dep check (`npm ls <pkg>`).
| `sharp` | 1 | KEEP | image processing | Native, widely-audited |
| `socket.io` | 1 | KEEP | realtime | Foundational |
| `socket.io-client` | 1 | KEEP | server-to-client | Paired with socket.io |
-| `trash` | 2 | KEEP | Recoverable image/video history deletion (`server/lib/trashFiles.js`) | Native macOS Trash and Windows Recycle Bin helpers plus Linux XDG trash; avoids maintaining platform deletion/restore semantics. Lazy-loaded, literal paths only, no permanent-delete fallback |
+| `trash` | — | REPLACED | Recoverable image/video history deletion (`server/lib/trashFiles.js`) | Issue #12246 → PortOS-owned adapters in `server/lib/nativeTrash.js` / `nativeTrashXdg.js` (ADR `docs/decisions/2026-10-18-native-trash-without-dependency.md`): `osascript` + `NSFileManager.trashItemAtURL` per file on macOS, Windows PowerShell 5.1 + shell32 `SHFileOperationW` with a fixed-drive pre-flight, freedesktop Trash 1.0 on `node:fs` for Linux. Removed the package's 57 lockfile entries, its ad-hoc-signed macOS binary and unsigned Windows executable |
| `undici` | 1 | KEEP | HTTP client | Node core team project |
| `ws` | 1 | KEEP | remote desktop + browser WebSockets | Foundational WebSocket transport; also used transitively by Socket.IO |
| `zod` | 1 | KEEP | input validation | Widely-audited |
diff --git a/docs/IMAGE_GALLERY.md b/docs/IMAGE_GALLERY.md
index cf4f721987..951a7e59a0 100644
--- a/docs/IMAGE_GALLERY.md
+++ b/docs/IMAGE_GALLERY.md
@@ -88,6 +88,18 @@ a `<filename>.metadata.json` snapshot of that video's history record, preserving
its prompt/settings without moving the shared history store. Temporary render
cleanup still permanently removes temporary files.
+Recycling uses facilities the operating system already ships, with no
+third-party package or bundled binary: on macOS each file is trashed in its
+own `osascript` process so Finder keeps a *Put Back* record for every one; on
+Linux files land in the freedesktop trash (`~/.local/share/Trash` or the
+volume's `.Trash-<uid>`) under their original names, where `gio`, `trash-cli`
+and desktop file managers can list and restore them; on Windows the Recycle
+Bin is used through the shell, and a file the shell could not recycle — one
+on a volume without a Recycle Bin (a network share or removable media), one
+larger than that volume's Recycle Bin capacity, or any file when the Recycle
+Bin is disabled for the volume — is refused and left in place rather than
+permanently deleted.
+
Recycling errors fail the request; there is no permanent-delete fallback.
History and derived index rows are retired only after the file operation
confirms the files are gone. Native recycling can partially succeed, so after
diff --git a/docs/decisions/2026-10-18-native-trash-without-dependency.md b/docs/decisions/2026-10-18-native-trash-without-dependency.md
index 6cbeccac38..8a8d4710f6 100644
--- a/docs/decisions/2026-10-18-native-trash-without-dependency.md
+++ b/docs/decisions/2026-10-18-native-trash-without-dependency.md
@@ -1,7 +1,7 @@
# ADR: Recycle media through OS facilities PortOS owns, not the `trash` package
**Date:** 2026-10-18
-**Status:** Accepted — macOS and Linux mechanisms proven; the Windows mechanism is specified and must pass its acceptance checks in the implementing PR before any adapter ships
+**Status:** Accepted — macOS and Linux mechanisms proven; the Windows mechanism is specified and must pass its acceptance checks in the implementing PR before any adapter ships. Implemented by issue #12246 (`server/lib/nativeTrash.js`, `server/lib/nativeTrashXdg.js`); the POC harnesses now import the production scripts. Windows checks executed on a `windows-latest` runner: check 2 passed on the `DriveType` pre-flight; check 3 showed that `FOF_WANTNUKEWARNING` makes the shell block on a confirmation no unattended process can answer (the deadline kill left the file intact), so the adapter adds the `BitBucket` `MaxCapacity` / `NukeOnDelete` pre-check — the shell-recorded value when present, else the OS default of 10% of the first 40 GB plus 5% of the rest, which matched the values the shell wrote for two fresh volumes; check 6 measured 0.5 s per batch after first use (4.2 s on a cold runner), so the P/Invoke stays and the `Microsoft.VisualBasic` call is not needed. PowerShell also serialises a redirected error stream as CLIXML, so the report is written to stdout on both paths
**Evidence:** [Native trash feasibility study](../research/2026-10-18-native-trash-feasibility.md) (issue #12231)
## Question
@@ -141,8 +141,8 @@ replaces the adapter and records the removal in `docs/DEPS.md`.
executables.
- macOS deletes spawn one short-lived `osascript` per file (deletion batches
are a handful of files; ~50 ms each).
-- Windows deletes pay an `Add-Type` compile per batch unless check 6 moves the
- adapter to the no-compile VisualBasic call.
+- Windows deletes pay an `Add-Type` compile per batch (about 0.5 s once the
+ runtime is warm); check 6 confirmed that is well inside the deadline.
- WSL installs recycle into an XDG trash on the mounted drive rather than the
Windows Recycle Bin; documented, recoverable, out of scope.
- If a future macOS release changes the per-process Put Back behaviour, the
diff --git a/docs/research/assets/native-trash-poc/README.md b/docs/research/assets/native-trash-poc/README.md
index 5dbabb8774..c6dd39a539 100644
--- a/docs/research/assets/native-trash-poc/README.md
+++ b/docs/research/assets/native-trash-poc/README.md
@@ -8,10 +8,11 @@ removes everything it created, including from the Trash / Recycle Bin.
| File | Platform | Status |
|------|----------|--------|
-| `mac-poc.mjs` | macOS — `/usr/bin/osascript -l JavaScript` + `NSFileManager.trashItemAtURL` | Executed 2026-10-18 on macOS 26.6 (home volume + RAM-disk volume) |
-| `xdgTrash.mjs` | Linux — proposed PortOS-owned freedesktop Trash 1.0 adapter (`node:fs` only) | Executed 2026-10-18 in Docker (Debian bookworm, GLib 2.74, trash-cli 0.17) |
+| `mac-poc.mjs` | macOS — `/usr/bin/osascript -l JavaScript` + `NSFileManager.trashItemAtURL`; runs the production `MACOS_TRASH_SCRIPT` | Executed 2026-10-18 on macOS 26.6 (home volume + RAM-disk volume); re-run 2026-10-19 on macOS 27 against `server/lib/nativeTrash.js` (#12246) |
+| `xdgTrash.mjs` | Linux — re-exports the production adapter `server/lib/nativeTrashXdg.js` (freedesktop Trash 1.0, `node:fs` only) | Executed 2026-10-18 in Docker (Debian bookworm, GLib 2.74, trash-cli 0.17) as the proposed adapter, since shipped unchanged (#12246) |
| `linux-poc.mjs`, `linux-docker-run.sh` | Linux harness: home trash, `$topdir/.Trash-$uid`, sticky `$topdir/.Trash/$uid`, refusal, `gio trash` / `trash-cli` interop | Executed with the adapter above |
-| `windows-poc.mjs` | Windows — Windows PowerShell 5.1 + shell32 `SHFileOperationW` (`FOF_ALLOWUNDO`) | **Not executed** — no Windows host; exits non-zero unless every acceptance check passes, including the two operator-supplied refusal scenarios |
+| `windows-poc.mjs` | Windows — Windows PowerShell 5.1 + shell32 `SHFileOperationW` (`FOF_ALLOWUNDO`); runs the production `WINDOWS_TRASH_SCRIPT` | Executed 2026-10-19 on a GitHub `windows-latest` runner (Windows PowerShell 5.1, Node 22) against `server/lib/nativeTrash.js`: `PASS` on all six checks, with the no-bin volume supplied as a mapped loopback share and the over-capacity file against a pinned 10 MB `MaxCapacity` (#12246). Exits non-zero unless every acceptance check passes, including the two operator-supplied refusal scenarios |
These are investigation tools, not product code: nothing under `server/` imports
-them, and the implementation plan in the ADR owns the production versions.
+them. They import the production scripts and adapter from `server/lib/` so a
+re-run proves what ships, not a copy.
diff --git a/docs/research/assets/native-trash-poc/linux-docker-run.sh b/docs/research/assets/native-trash-poc/linux-docker-run.sh
index b924102d93..8650c8ac09 100755
--- a/docs/research/assets/native-trash-poc/linux-docker-run.sh
+++ b/docs/research/assets/native-trash-poc/linux-docker-run.sh
@@ -8,12 +8,16 @@
# reference implementations. Usage: linux-docker-run.sh <this directory>
set -u
POC_DIR="$1"
+# The repository layout is reproduced under /home/node/repo so the `xdgTrash.mjs`
+# shim's relative re-export of server/lib/nativeTrashXdg.js resolves in the container.
+REPO_ROOT="$(cd "$POC_DIR/../../../.." && pwd)"
docker run --rm \
--tmpfs /mnt/vol:uid=1000,gid=1000,mode=755 \
--tmpfs /mnt/vol2:uid=0,gid=0,mode=755 \
--tmpfs /mnt/vol3:uid=0,gid=0,mode=755 \
--tmpfs /mnt/vol4:uid=0,gid=0,mode=755 \
-v "$POC_DIR:/poc:ro" \
+ -v "$REPO_ROOT/server/lib:/home/node/repo/server/lib:ro" \
node:22-bookworm bash -c '
set -e
export DEBIAN_FRONTEND=noninteractive
@@ -22,6 +26,7 @@ apt-get install -y -qq libglib2.0-bin trash-cli >/dev/null 2>&1
mkdir -m 777 /mnt/vol2/pub /mnt/vol3/pub /mnt/vol4/pub /tmp/evil
ln -s /tmp/evil /mnt/vol2/.Trash-1000
mkdir -m 1777 /mnt/vol3/.Trash
-cp -r /poc /home/node/poc && chown -R node:node /home/node/poc
-su node -c "cd /home/node/poc && HOME=/home/node node linux-poc.mjs"
+mkdir -p /home/node/repo/docs/research/assets
+cp -r /poc /home/node/repo/docs/research/assets/native-trash-poc && chown -R node:node /home/node/repo/docs
+su node -c "cd /home/node/repo/docs/research/assets/native-trash-poc && HOME=/home/node node linux-poc.mjs"
'
diff --git a/docs/research/assets/native-trash-poc/linux-poc.mjs b/docs/research/assets/native-trash-poc/linux-poc.mjs
index 09c0983150..a4db13971e 100644
--- a/docs/research/assets/native-trash-poc/linux-poc.mjs
+++ b/docs/research/assets/native-trash-poc/linux-poc.mjs
@@ -1,4 +1,4 @@
-// Linux harness for xdgTrash.mjs (issue #12231 study). Run through
+// Linux harness for the XDG adapter (issue #12231 study; production module `server/lib/nativeTrashXdg.js`). Run through
// linux-docker-run.sh, which provides the extra volumes it expects. Exits 1 when
// any assertion fails so a broken adapter cannot produce a passing-looking report.
import { trashXdg } from './xdgTrash.mjs';
diff --git a/docs/research/assets/native-trash-poc/mac-poc.mjs b/docs/research/assets/native-trash-poc/mac-poc.mjs
index c9f8102101..c32a243613 100644
--- a/docs/research/assets/native-trash-poc/mac-poc.mjs
+++ b/docs/research/assets/native-trash-poc/mac-poc.mjs
@@ -12,32 +12,9 @@ import { join, basename, dirname } from 'node:path';
import { setTimeout as sleep } from 'node:timers/promises';
const execFileAsync = promisify(execFile);
-// The script PortOS would embed. `$()` (typed nil) is the out-parameter idiom that
-// works on macOS 26; `Ref()` crashes osascript after the move succeeds.
-const JXA = `
-ObjC.import('Foundation');
-ObjC.import('stdlib');
-function run(argv) {
- const fm = $.NSFileManager.defaultManager;
- const results = [];
- let failed = false;
- for (const path of argv) {
- const trashedUrl = $();
- const error = $();
- const ok = fm.trashItemAtURLResultingItemURLError($.NSURL.fileURLWithPath(path), trashedUrl, error);
- if (ok) results.push({ path, trashedPath: ObjC.unwrap(trashedUrl.path) });
- else {
- failed = true;
- results.push({ path, code: Number(error.code), domain: ObjC.unwrap(error.domain), error: ObjC.unwrap(error.localizedDescription) });
- }
- }
- const out = JSON.stringify(results);
- if (failed) {
- $.NSFileHandle.fileHandleWithStandardError.writeData($(out).dataUsingEncoding($.NSUTF8StringEncoding));
- $.exit(1);
- }
- return out;
-}`;
+// The exact script `server/lib/nativeTrash.js` embeds, so this harness proves
+// the production body rather than a copy of it.
+import { MACOS_TRASH_SCRIPT as JXA } from '../../../../server/lib/nativeTrash.js';
async function osascriptTrash(paths) {
const started = Date.now();
@@ -46,7 +23,7 @@ async function osascriptTrash(paths) {
return { ok: true, ms: Date.now() - started, results: JSON.parse(stdout.trim()) };
} catch (error) {
let results = null;
- try { results = JSON.parse(String(error.stderr || '').trim()); } catch {}
+ try { results = JSON.parse(String(error.stdout || '').trim()); } catch {}
return { ok: false, ms: Date.now() - started, exitCode: error.code, killed: error.killed, results, stderr: results ? undefined : String(error.stderr || '').trim().slice(0, 300) };
}
}
diff --git a/docs/research/assets/native-trash-poc/windows-poc.mjs b/docs/research/assets/native-trash-poc/windows-poc.mjs
index 68dedeec46..47ece9d42e 100644
--- a/docs/research/assets/native-trash-poc/windows-poc.mjs
+++ b/docs/research/assets/native-trash-poc/windows-poc.mjs
@@ -31,60 +31,11 @@ import { tmpdir } from 'node:os';
import { join, basename, parse } from 'node:path';
const execFileAsync = promisify(execFile);
-const POWERSHELL = join(process.env.SystemRoot || 'C:\\Windows', 'System32', 'WindowsPowerShell', 'v1.0', 'powershell.exe');
-// Paths travel in an environment variable (newline-separated; newlines are illegal in
-// Windows file names) so no path ever touches PowerShell's parser.
-const SCRIPT = String.raw`
-$ErrorActionPreference = 'Stop'
-Add-Type -TypeDefinition @'
-using System;
-using System.IO;
-using System.Runtime.InteropServices;
-public static class PortOSRecycle {
- // 64-bit layout (no Pack): PortOS runs under 64-bit Node; Pack=1 is the x86 layout.
- [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
- public struct SHFILEOPSTRUCT {
- public IntPtr hwnd; public uint wFunc;
- [MarshalAs(UnmanagedType.LPWStr)] public string pFrom;
- [MarshalAs(UnmanagedType.LPWStr)] public string pTo;
- public ushort fFlags;
- [MarshalAs(UnmanagedType.Bool)] public bool fAnyOperationsAborted;
- public IntPtr hNameMappings;
- [MarshalAs(UnmanagedType.LPWStr)] public string lpszProgressTitle;
- }
- [DllImport("shell32.dll", CharSet = CharSet.Unicode)]
- static extern int SHFileOperationW(ref SHFILEOPSTRUCT op);
- const uint FO_DELETE = 3;
- // FOF_SILENT | FOF_NOCONFIRMATION | FOF_ALLOWUNDO | FOF_NOERRORUI | FOF_WANTNUKEWARNING
- const ushort FLAGS = 0x0004 | 0x0010 | 0x0040 | 0x0400 | 0x4000;
- public static int Recycle(string path, out bool aborted) {
- var op = new SHFILEOPSTRUCT { wFunc = FO_DELETE, pFrom = path + "\0\0", fFlags = FLAGS };
- int rc = SHFileOperationW(ref op);
- aborted = op.fAnyOperationsAborted;
- return rc;
- }
- // Pre-flight: only a Fixed drive owns a $Recycle.Bin; shares and removable media
- // would otherwise be permanently deleted by the shell under FOF_NOCONFIRMATION.
- public static string DriveType(string path) {
- return new DriveInfo(Path.GetPathRoot(path)).DriveType.ToString();
- }
-}
-'@
-$results = @()
-$failed = $false
-foreach ($path in ($env:PORTOS_TRASH_PATHS -split [char]10 | Where-Object { $_ -ne '' })) {
- if (-not (Test-Path -LiteralPath $path)) { $failed = $true; $results += @{ path = $path; code = 2; error = 'missing' }; continue }
- $type = [PortOSRecycle]::DriveType($path)
- if ($type -ne 'Fixed') { $failed = $true; $results += @{ path = $path; code = -1; error = "no recycle bin on $type drive" }; continue }
- $aborted = $false
- $rc = [PortOSRecycle]::Recycle($path, [ref]$aborted)
- if ($rc -ne 0 -or $aborted -or (Test-Path -LiteralPath $path)) { $failed = $true; $results += @{ path = $path; code = $rc; aborted = $aborted } }
- else { $results += @{ path = $path; recycled = $true } }
-}
-$json = ConvertTo-Json -Compress -InputObject @($results)
-if ($failed) { [Console]::Error.WriteLine($json); exit 1 }
-[Console]::Out.WriteLine($json)
-`;
+// The exact script and PowerShell path `server/lib/nativeTrash.js` uses, so this
+// harness proves the production body rather than a copy of it.
+import { WINDOWS_TRASH_SCRIPT as SCRIPT } from '../../../../server/lib/nativeTrash.js';
+import { windowsPowerShell51Path } from '../../../../server/lib/processEnv.js';
+const POWERSHELL = windowsPowerShell51Path();
async function powershellRecycle(paths) {
const started = Date.now();
@@ -95,7 +46,7 @@ async function powershellRecycle(paths) {
return { ok: true, ms: Date.now() - started, results: [].concat(JSON.parse(stdout.trim())) };
} catch (error) {
let results = null;
- try { results = [].concat(JSON.parse(String(error.stderr || '').trim())); } catch {}
+ try { results = [].concat(JSON.parse(String(error.stdout || '').replace(/^\uFEFF/, '').trim())); } catch {}
return { ok: false, ms: Date.now() - started, exitCode: error.code, killed: error.killed, results, stderr: results ? undefined : String(error.stderr || '').trim().slice(0, 500) };
}
}
diff --git a/docs/research/assets/native-trash-poc/xdgTrash.mjs b/docs/research/assets/native-trash-poc/xdgTrash.mjs
index cbe487b5ad..fe2d1c0d97 100644
--- a/docs/research/assets/native-trash-poc/xdgTrash.mjs
+++ b/docs/research/assets/native-trash-poc/xdgTrash.mjs
@@ -1,133 +1,5 @@
-// Proposed PortOS-owned Linux adapter (issue #12231 study): freedesktop.org Trash specification 1.0,
-// built on node:fs only. One file per call; the caller owns batching and
-// post-operation verification, exactly like the macOS/Windows helpers.
-import { lstat, mkdir, open, realpath, rename, unlink } from 'node:fs/promises';
-import { basename, dirname, extname, isAbsolute, join, relative, resolve } from 'node:path';
-import { homedir } from 'node:os';
-
-const NAME_MAX_BYTES = 255;
-const INFO_SUFFIX = '.trashinfo';
-
-const homeTrashDir = () => {
- const dataHome = process.env.XDG_DATA_HOME;
- return join(dataHome && isAbsolute(dataHome) ? dataHome : join(homedir(), '.local', 'share'), 'Trash');
-};
-const missing = error => { if (error.code === 'ENOENT') return null; throw error; };
-const refuse = (message, code) => Object.assign(new Error(message), { code });
-
-// Device of a path that may not exist yet (the home trash before first use):
-// the nearest existing ancestor decides.
-async function deviceOf(path) {
- for (let dir = path; ; dir = dirname(dir)) {
- const info = await lstat(dir).catch(missing);
- if (info) return info.dev;
- if (dirname(dir) === dir) throw refuse(`No existing ancestor for ${path}`, 'ENOENT');
- }
-}
-
-// Mount point of `path`: the highest ancestor still on the same device.
-async function topDirOf(path, dev) {
- let dir = dirname(path);
- for (;;) {
- const parent = dirname(dir);
- if (parent === dir) return dir;
- if ((await lstat(parent)).dev !== dev) return dir;
- dir = parent;
- }
-}
-
-// Spec §"Trash directories": prefer $topdir/.Trash/$uid when $topdir/.Trash is a
-// sticky, non-symlink directory; otherwise $topdir/.Trash-$uid. A .Trash that
-// fails the checks MUST NOT be used.
-async function topDirTrash(topDir, uid) {
- const shared = join(topDir, '.Trash');
- const info = await lstat(shared).catch(missing);
- if (info?.isDirectory() && !info.isSymbolicLink() && (info.mode & 0o1000) !== 0) return join(shared, String(uid));
- return join(topDir, `.Trash-${uid}`);
-}
-
-// The home trash serves every file on the device the home trash itself lives on
-// (XDG_DATA_HOME may sit on another volume than $HOME); anything else gets the
-// per-volume trash of its own mount point.
-async function trashLocation(absPath) {
- const home = homeTrashDir();
- const fileDev = (await lstat(absPath)).dev;
- if (fileDev === await deviceOf(home)) return { dir: home, topDir: null };
- const topDir = await topDirOf(absPath, fileDev);
- return { dir: await topDirTrash(topDir, process.getuid()), topDir };
-}
-
-// A per-user trash directory and its files/ and info/ children must be real
-// directories owned by the caller. On a shared volume anyone can pre-create
-// `.Trash-<uid>` as a symlink into a directory they control; following it would
-// move the user's files there and report success. Re-check after creating, so a
-// link planted between the probe and the mkdir is caught as well.
-async function ensureOwnedDir(path, uid) {
- let info = await lstat(path).catch(missing);
- if (!info) {
- await mkdir(path, { recursive: true, mode: 0o700 });
- info = await lstat(path);
- }
- if (info.isSymbolicLink() || !info.isDirectory() || info.uid !== uid) {
- throw refuse(`Trash directory is not a directory owned by this user: ${path}`, 'TRASH_DIR_UNSAFE');
- }
-}
-
-// RFC 2396 escaping as the spec requires: every byte outside the unreserved set,
-// keeping '/' as the segment separator.
-const encodePath = path => path.split('/').map(encodeURIComponent).join('/');
-const pad = n => String(n).padStart(2, '0');
-const deletionDate = (d = new Date()) => `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}T${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`;
-const exists = path => lstat(path).then(() => true, error => { if (error.code === 'ENOENT') return false; throw error; });
-
-// Name inside files/: the original basename, `stem.N.ext` on collision, shortened
-// by whole code points when `<name>.trashinfo` would exceed NAME_MAX — the stem
-// first (the extension keeps the file recognisable), then the extension itself.
-// The complete original path always survives in the info file.
-function trashName(base, attempt) {
- const suffix = attempt === 0 ? '' : `.${attempt}`;
- const budget = NAME_MAX_BYTES - Buffer.byteLength(INFO_SUFFIX) - Buffer.byteLength(suffix);
- let ext = extname(base);
- const stem = Array.from(base.slice(0, base.length - ext.length));
- while (stem.length > 1 && Buffer.byteLength(stem.join('') + ext) > budget) stem.pop();
- while (Buffer.byteLength(stem.join('') + ext) > budget) ext = Array.from(ext).slice(0, -1).join('');
- return `${stem.join('')}${suffix}${ext}`;
-}
-
-export async function trashXdg(path) {
- // Device and mount-point discovery need the physical parent: through a directory
- // symlink into another volume, lexical ancestors would place the volume trash
- // below the real mount root where no trash tool looks. The final component is
- // kept as given so a source that is itself a symlink is what gets recycled.
- const given = resolve(path);
- const absPath = join(await realpath(dirname(given)), basename(given));
- const { dir, topDir } = await trashLocation(absPath);
- const uid = process.getuid();
- const filesDir = join(dir, 'files');
- const infoDir = join(dir, 'info');
- for (const directory of [dir, filesDir, infoDir]) await ensureOwnedDir(directory, uid);
- const base = basename(absPath);
- const recordedPath = topDir ? relative(topDir, absPath) : absPath;
- for (let attempt = 0; attempt < 1000; attempt++) {
- const name = trashName(base, attempt);
- const infoPath = join(infoDir, `${name}${INFO_SUFFIX}`);
- const target = join(filesDir, name);
- // The info file is the atomic reservation (O_EXCL); an orphan in files/ also blocks the name.
- let handle;
- try { handle = await open(infoPath, 'wx', 0o600); } catch (error) { if (error.code === 'EEXIST') continue; throw error; }
- try {
- if (await exists(target)) { await handle.close(); handle = null; await unlink(infoPath); continue; }
- await handle.writeFile(`[Trash Info]\nPath=${encodePath(recordedPath)}\nDeletionDate=${deletionDate()}\n`);
- await handle.close();
- handle = null;
- await rename(absPath, target);
- return { trashedPath: target, infoPath };
- } catch (error) {
- // Nothing moved: EXDEV (no usable per-volume trash), EACCES, etc. surface as a bounded refusal.
- if (handle) await handle.close().catch(() => {});
- await unlink(infoPath).catch(() => {});
- throw error;
- }
- }
- throw refuse('No free name in the trash directory', 'TRASH_NAME_EXHAUSTED');
-}
+// The Linux adapter moved into the server as `server/lib/nativeTrashXdg.js`
+// (issue #12246). This shim keeps `linux-poc.mjs` and the study's links working
+// against the production module; `linux-docker-run.sh` reproduces the repository
+// layout inside the container so the relative path resolves there too.
+export { trashXdg } from '../../../../server/lib/nativeTrashXdg.js';
diff --git a/server/envExampleDrift.test.js b/server/envExampleDrift.test.js
index 57a73ea8b4..15c90eec46 100644
--- a/server/envExampleDrift.test.js
+++ b/server/envExampleDrift.test.js
@@ -87,6 +87,7 @@ const INHERITED_ENV = {
DYLD_LIBRARY_PATH: 'macOS dynamic-loader path, passed through to child processes',
LD_LIBRARY_PATH: 'Linux dynamic-loader path, passed through to child processes',
XDG_CACHE_HOME: 'XDG base-directory spec, set by the desktop environment',
+ XDG_DATA_HOME: 'XDG base-directory spec, set by the desktop environment (home trash location on Linux)',
// Injected by a toolchain PortOS runs under.
NODE_ENV: 'set by the launcher (pm2) and forced to "test" by vitest.config.js',
diff --git a/server/lib/README.md b/server/lib/README.md
index d3fa347130..b95dad6de2 100644
--- a/server/lib/README.md
+++ b/server/lib/README.md
@@ -464,7 +464,7 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub
| `glabArgs.js` | `GLAB_JSON_ARGS`, `withGlabJson(args)` — pure `glab` argv conventions. The JSON output flag is `--output json`, NOT `-F json`: on `glab issue list` (and only there) `-F` is `--output-format` (details/ids/urls), so `-F json` is accepted, ignored, and answers with the human table at exit 0. Shared by all three `glab` runners so the spelling has one definition; guarded tree-wide by `services/gitlab.glabFlags.test.js`. |
| `killWithEscalation.js` | `killWithEscalation(proc, {label, stillRunning, delayMs=8000})` — shared SIGTERM→grace→SIGKILL cancel-escalation for spawn-based media jobs. Sends SIGTERM, then escalates to SIGKILL after `delayMs` only when `stillRunning()` holds and the child hasn't exited (`exitCode===null && signalCode===null`). The timer is unref'd and the callback is try/catch-wrapped (runs outside the request lifecycle). Converges musicVideo/render, videoTimeline, imageGen local+codex, videoGen, loraTraining, and the yt-dlp track import cancel paths. |
| `npmGlobalBin.js` | `adoptNpmGlobalBinDir()` — puts the directory `npm install --global` actually writes to onto `process.env.PATH`, from one cached `npm prefix -g`. npm resolves its prefix through a config cascade (cli flags, `npm_config_*`, project/user/global npmrc, a builtin npmrc that interpolates env vars), so guessing it from `%APPDATA%`/`$HOME` reproduces the bug on the next host — only npm can answer. Exists because a host whose npm prefix is NOT the directory its Node installer put on PATH (a machine-wide Windows prefix vs the per-user `%APPDATA%\npm` default, `NPM_CONFIG_PREFIX`, nvm/Volta) installed `codex` successfully and then reported it unrunnable, advising a restart that inherits the same PATH. Called at boot in BOTH processes that spawn provider CLIs (`services/bootstrap.js`, `cos-runner/index.js`) and again from `providerRuntimeInstaller.js`'s probe, because on a first install the prefix directory did not exist when boot looked. |
-| `processEnv.js` | `stripDebugMallocEnv(env)` / `safeChildProcessEnv(extra)` — drop macOS `Malloc*` debug env vars before spawning a child. `safeChildProcessOptions(options)` adds that sanitized environment plus `windowsHide: true`, preventing detached PM2 subprocesses from opening transient Windows console UI; `buildSafeCliBaseEnv(env, provider)` allowlists runtime/delivery essentials and only the selected CLI's ambient provider auth before an AI CLI inherits the server environment. Route Node→Python and other background CLI spawns through the process helpers. Also `whichFirst(name)` — first-hit `which`/`where` PATH probe (safe options, 5s timeout, direct PATH fallback on probe failure) returning the absolute binary path or `null`; `whichFirstSync(name)` provides the same contract without the await; `findCommandOnPath(name, { env, cwd })` resolves an executable from the exact child environment without needing `which` itself on that PATH. `adoptPathDirs(dirs)` appends the ones that exist and are not already there to THIS process's `process.env.PATH` (case-insensitively on Windows), which fixes this process AND every child, since the env builders above derive from `process.env` — the only fix that reaches a CLI launched by BARE NAME through node-pty. Shared by `npmGlobalBin.js` and `services/llamaServerManager.js`'s winget-shim adoption. |
+| `processEnv.js` | `stripDebugMallocEnv(env)` / `safeChildProcessEnv(extra)` — drop macOS `Malloc*` debug env vars before spawning a child. `safeChildProcessOptions(options)` adds that sanitized environment plus `windowsHide: true`, preventing detached PM2 subprocesses from opening transient Windows console UI; `buildSafeCliBaseEnv(env, provider)` allowlists runtime/delivery essentials and only the selected CLI's ambient provider auth before an AI CLI inherits the server environment. Route Node→Python and other background CLI spawns through the process helpers. Also `whichFirst(name)` — first-hit `which`/`where` PATH probe (safe options, 5s timeout, direct PATH fallback on probe failure) returning the absolute binary path or `null`; `whichFirstSync(name)` provides the same contract without the await; `findCommandOnPath(name, { env, cwd })` resolves an executable from the exact child environment without needing `which` itself on that PATH. `adoptPathDirs(dirs)` appends the ones that exist and are not already there to THIS process's `process.env.PATH` (case-insensitively on Windows), which fixes this process AND every child, since the env builders above derive from `process.env` — the only fix that reaches a CLI launched by BARE NAME through node-pty. Shared by `npmGlobalBin.js` and `services/llamaServerManager.js`'s winget-shim adoption. `windowsPowerShell51Path(env)` is the fixed Windows PowerShell 5.1 location under `SystemRoot`, shared by `interactiveShellResolver.js` and `nativeTrash.js`. |
| `branchUpstreamGuard.js` | `enforceSafeBranchUpstream(repo, branch)` / `readBranchUpstream` / `isSafeBranchUpstream` — the agent-branch upstream invariant (#4172): a branch handed to a CoS agent tracks either NOTHING or its OWN ref, never `refs/heads/main`. `git worktree add -b <b> <path> origin/main` does not leave the branch untracked — `branch.autoSetupMerge` records `merge=refs/heads/main` — and `/do:pr` derives its push destination from that config (`git push <remote> HEAD:<merge>`), so the agent's work lands straight on the default branch with no PR. Prevention is `--no-track` at the `worktreeManager.js` creation sites; this is the backstop that also REPAIRS branches created before the fix (drops the bogus upstream, logs it) and throws only if the repair doesn't take. Fails CLOSED: `readBranchUpstream` returns `null` for could-not-read (distinct from `''` = genuinely unset), and an unverifiable upstream is refused rather than waved through — `worktreeManager.js` undoes the `worktree add` on refusal so the throw can't strand a tree. Pairs with `primaryCheckoutGuard.js`, which catches the other way agent work reaches `main`. |
| `primaryCheckoutGuard.js` | `capturePrimaryCheckoutState(path)` / `detectPrimaryCheckoutDrift(baseline, {agentBranch})` + `PRIMARY_CHECKOUT_MUTATED_REASON`/`_CATEGORY` — the branch-jack detector (#3680): stamps the PRIMARY checkout's branch + HEAD onto a worktree agent's metadata at spawn (`agentLifecycle.js`) and re-reads it in the shared finalize path (`agentFinalization.js`), so a worktree-isolated agent that commits to the primary is recorded as a FAILURE naming the drifted branch, the commit count, and the `git reset --hard` recovery — instead of a silent "completed". Detect-and-report only: the reset discards commits, so it stays a human decision. Non-throwing (runs outside the request lifecycle); an unreadable checkout reports no drift rather than inventing one. `resolveRemoteDefaultRef(path)` resolves local origin/HEAD, origin/main, then origin/master to `{ref, sha}` or null without fetching; also used by run-window diffs. |
| `ptySpawnDiagnostics.js` | `diagnosePtySpawnFailure(err, {cwd, probeCwd, runtimeProbe})` + `probePtyRuntime(pty, cwd)` and the `PTY_UNAVAILABLE_PREFIX` / `PTY_WORKSPACE_MISSING_PREFIX` markers — turns node-pty’s one opaque `posix_spawn failed: No such file or directory` into a named fault. The executable is already cleared upstream (PATH resolve + `--version` probe), so a throw is either a `cwd` that vanished (cheap `existsSync`) or a PTY layer that cannot fork AT ALL — proven by re-forking a known-good command in a known-good directory; `diagnosed: false` means neither matched, and the caller re-throws rather than inventing a cause. **Retry policy is the caller’s and the two faults differ:** `agentTuiSpawning.js` matches only the PTY-layer prefix, mapping it to the actionable `runner-pty-unavailable` so the task blocks once with the repair, while a reaped workspace falls through to the retrying `spawn-rejected` because the next attempt provisions a fresh worktree. The motivating outage: an `npm ci` inside a CoS worktree emptied the primary checkout’s `server/node_modules` through a symlink, deleting the `spawn-helper` binary node-pty execs on every fork, while the already-loaded binding left the runner process itself looking healthy. |
@@ -922,4 +922,5 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub
- `mediaFileInfo.js`: `withMediaFileSize(kind, record)` / `withMediaFileSizes(items, kind?)` add current original-file byte sizes to bounded image/video pages; missing or unreadable files have no size.
- `trashFiles.js`: `trashFiles(paths)` moves existing literal paths to the host OS Trash/Recycle Bin, guards test data, and propagates failures without permanent-delete fallback.
-- `nativeTrash.js`: `moveToNativeTrash(paths)` executes the pinned package native recycling helpers on macOS/Windows with hidden windows and a deadline; Linux uses the package XDG adapter. No local-directory or permanent-delete fallback.
+- `nativeTrash.js`: `moveToNativeTrash(paths)` recycles through OS facilities PortOS owns — one hidden, deadline-bound `osascript` (`NSFileManager.trashItemAtURL`, exported `MACOS_TRASH_SCRIPT`) per file on macOS so each gets Finder Put Back; one Windows PowerShell 5.1 `-EncodedCommand` run (shell32 `SHFileOperationW` with `FOF_ALLOWUNDO`, exported `WINDOWS_TRASH_SCRIPT`, paths in `PORTOS_TRASH_PATHS`, fixed-drive pre-flight) per batch; `trashXdg` per file on Linux. Refusals reject with a coded error (`TRASH_REFUSED` + per-file `report`, `TRASH_DEADLINE`, `TRASH_UNPARSABLE`, `TRASH_UNSUPPORTED_PLATFORM`); no local-directory or permanent-delete fallback.
+- `nativeTrashXdg.js`: `trashXdg(path)` moves one file into the freedesktop Trash 1.0 directory serving its volume on `node:fs` alone (original names, RFC 2396 `Path=`, `O_EXCL` info reservation, NAME_MAX-bounded names, physical-parent mount discovery, an owned trash directory is tightened to 0700 and `TRASH_DIR_UNSAFE` refuses a symlinked or foreign-owned one, a sticky shared `.Trash` that cannot hold the per-user directory falls back to `.Trash-<uid>`, refuses instead of copying across devices); `_topDirTrash(topDir, uid)` (test hook) applies the sticky `$topdir/.Trash` rule.
diff --git a/server/lib/index.js b/server/lib/index.js
index 9bb45d901f..204b34bb79 100644
--- a/server/lib/index.js
+++ b/server/lib/index.js
@@ -321,6 +321,7 @@ export * from './fileCore.js';
export * from './mediaFileInfo.js';
export * from './trashFiles.js';
export * from './nativeTrash.js';
+export * from './nativeTrashXdg.js';
export * as fileUtils from './fileUtils.js';
export * from './fileWriteQueue.js';
export * from './forgeIssueCli.js';
diff --git a/server/lib/interactiveShellResolver.js b/server/lib/interactiveShellResolver.js
index 73ae4a83a5..63a1d7c1f4 100644
--- a/server/lib/interactiveShellResolver.js
+++ b/server/lib/interactiveShellResolver.js
@@ -57,7 +57,7 @@
import { existsSync, readdirSync } from 'fs';
import { win32 } from 'path';
-import { findCommandOnPath } from './processEnv.js';
+import { findCommandOnPath, windowsPowerShell51Path } from './processEnv.js';
// The Windows branch below assembles WINDOWS paths, so it joins with win32
// semantics rather than the host's. On Windows the two are identical; off it,
@@ -122,10 +122,7 @@ function resolveWindowsShell(env, exists, readdir, findOnPath) {
if (onPath) return onPath;
// Windows PowerShell 5.1 — present on every supported Windows.
- const ps5 = join(
- env.SystemRoot || 'C:\\Windows',
- 'System32', 'WindowsPowerShell', 'v1.0', 'powershell.exe',
- );
+ const ps5 = windowsPowerShell51Path(env);
if (exists(ps5)) return ps5;
return env.COMSPEC || 'cmd.exe';
diff --git a/server/lib/nativeTrash.js b/server/lib/nativeTrash.js
index 5ad45a5df1..4ef56b70bc 100644
--- a/server/lib/nativeTrash.js
+++ b/server/lib/nativeTrash.js
@@ -1,18 +1,209 @@
-/** OS recycling adapter using the pinned trash package's native helper assets. */
+/**
+ * OS recycling adapters PortOS owns — no third-party package, no bundled
+ * binary (ADR docs/decisions/2026-10-18-native-trash-without-dependency.md).
+ *
+ * `moveToNativeTrash(paths)` dispatches on `process.platform`:
+ * - darwin: `/usr/bin/osascript -l JavaScript` running `MACOS_TRASH_SCRIPT`
+ * (`NSFileManager.trashItemAtURL`), ONE process per file — the OS writes a
+ * Finder "Put Back" record only for the first trashItem call in a process.
+ * - win32: Windows PowerShell 5.1 running `WINDOWS_TRASH_SCRIPT` (shell32
+ * `SHFileOperationW` with `FOF_ALLOWUNDO`), one process per batch, the paths
+ * delivered in `PORTOS_TRASH_PATHS` so none touches PowerShell's parser.
+ * - linux: `trashXdg()` per file (freedesktop Trash 1.0 on `node:fs`).
+ *
+ * Every adapter fails closed: a refusal rejects with a bounded coded Error and
+ * the original file still in place. There is deliberately no permanent-delete
+ * fallback and no fallback directory; `trashFiles.js` verifies afterwards that
+ * each path is gone before callers retire history rows.
+ *
+ * Both scripts share one contract: a JSON array of per-file results on stdout,
+ * and the exit code decides success. Nothing is read from stderr — PowerShell
+ * serialises a redirected error stream as CLIXML, and osascript mixes its own
+ * diagnostics into it.
+ */
import { promisify } from 'node:util';
-import { fileURLToPath } from 'node:url';
+import { execFile } from './childProcess.js';
+import { codedError } from './codedError.js';
+import { windowsPowerShell51Path } from './processEnv.js';
+import { trashXdg } from './nativeTrashXdg.js';
+
+const execFileAsync = promisify(execFile);
+export const NATIVE_TRASH_DEADLINE_MS = 30_000;
+
+// JXA with the ObjC bridge. `$()` (typed nil) is the out-parameter idiom that
+// works on current macOS; `Ref()` crashes osascript after the move succeeds.
+export const MACOS_TRASH_SCRIPT = `
+ObjC.import('Foundation');
+ObjC.import('stdlib');
+function run(argv) {
+ const fm = $.NSFileManager.defaultManager;
+ const results = [];
+ let failed = false;
+ for (const path of argv) {
+ const trashedUrl = $();
+ const error = $();
+ const ok = fm.trashItemAtURLResultingItemURLError($.NSURL.fileURLWithPath(path), trashedUrl, error);
+ if (ok) results.push({ path, trashedPath: ObjC.unwrap(trashedUrl.path) });
+ else {
+ failed = true;
+ results.push({ path, code: Number(error.code), domain: ObjC.unwrap(error.domain), error: ObjC.unwrap(error.localizedDescription) });
+ }
+ }
+ const out = JSON.stringify(results);
+ if (failed) {
+ $.NSFileHandle.fileHandleWithStandardOutput.writeData($(out).dataUsingEncoding($.NSUTF8StringEncoding));
+ $.exit(1);
+ }
+ return out;
+}`;
+
+// Windows PowerShell 5.1 + .NET Framework P/Invoke. The DriveType pre-flight
+// is load-bearing: under FOF_NOCONFIRMATION the shell permanently deletes what
+// it cannot recycle (network shares, removable media), so only a Fixed drive —
+// the only kind that owns a $Recycle.Bin — is ever handed to the shell, and
+// UNC paths never reach DriveInfo (it throws on them). It must run before the
+// capacity check so a UNC root never reaches GetVolumeNameForVolumeMountPoint.
+// The capacity / disabled-bin pre-flight is advisory: FOF_WANTNUKEWARNING makes
+// the shell block on a confirmation no unattended process can answer
+// (reproduced on the windows-latest runner), so the deadline kill is the data
+// guard and a stale capacity value costs time, not files.
+export const WINDOWS_TRASH_SCRIPT = String.raw`
+$ErrorActionPreference = 'Stop'
+$ProgressPreference = 'SilentlyContinue'
+[Console]::OutputEncoding = New-Object System.Text.UTF8Encoding $false
+Add-Type -TypeDefinition @'
+using System;
+using System.IO;
+using System.Runtime.InteropServices;
+public static class PortOSRecycle {
+ // 64-bit layout (no Pack): PortOS runs under 64-bit Node; Pack=1 is the x86 layout.
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
+ public struct SHFILEOPSTRUCT {
+ public IntPtr hwnd; public uint wFunc;
+ [MarshalAs(UnmanagedType.LPWStr)] public string pFrom;
+ [MarshalAs(UnmanagedType.LPWStr)] public string pTo;
+ public ushort fFlags;
+ [MarshalAs(UnmanagedType.Bool)] public bool fAnyOperationsAborted;
+ public IntPtr hNameMappings;
+ [MarshalAs(UnmanagedType.LPWStr)] public string lpszProgressTitle;
+ }
+ [DllImport("shell32.dll", CharSet = CharSet.Unicode)]
+ static extern int SHFileOperationW(ref SHFILEOPSTRUCT op);
+ const uint FO_DELETE = 3;
+ // FOF_SILENT | FOF_NOCONFIRMATION | FOF_ALLOWUNDO | FOF_NOERRORUI | FOF_WANTNUKEWARNING
+ const ushort FLAGS = 0x0004 | 0x0010 | 0x0040 | 0x0400 | 0x4000;
+ public static int Recycle(string path, out bool aborted) {
+ var op = new SHFILEOPSTRUCT { wFunc = FO_DELETE, pFrom = path + "\0\0", fFlags = FLAGS };
+ int rc = SHFileOperationW(ref op);
+ aborted = op.fAnyOperationsAborted;
+ return rc;
+ }
+ public static string DriveType(string path) {
+ string root = Path.GetPathRoot(path);
+ if (root == null || root.StartsWith(@"\\")) return "Network";
+ return new DriveInfo(root).DriveType.ToString();
+ }
+ [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
+ static extern bool GetVolumeNameForVolumeMountPoint(string mountPoint, System.Text.StringBuilder volumeName, uint bufferLength);
+ // Recycle Bin capacity the shell honours for the volume at root, in bytes:
+ // the per-volume HKCU BitBucket MaxCapacity (MB) once the shell has recorded
+ // one, else the OS default (10% of the first 40 GB plus 5% of the rest).
+ // 0 means recycling is disabled for the volume (NukeOnDelete or policy).
+ public static long BinCapacityBytes(string root) {
+ foreach (var hive in new[] { Microsoft.Win32.Registry.CurrentUser, Microsoft.Win32.Registry.LocalMachine }) {
+ using (var policy = hive.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\Explorer")) {
+ if (policy != null && Convert.ToInt32(policy.GetValue("NoRecycleFiles", 0)) != 0) return 0;
+ }
+ }
+ long capacityMb = -1;
+ var volume = new System.Text.StringBuilder(64);
+ if (GetVolumeNameForVolumeMountPoint(root, volume, 64)) {
+ var guid = System.Text.RegularExpressions.Regex.Match(volume.ToString(), @"\{[0-9A-Fa-f-]+\}");
+ if (guid.Success) {
+ using (var key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Explorer\BitBucket\Volume\" + guid.Value)) {
+ if (key != null) {
+ if (Convert.ToInt32(key.GetValue("NukeOnDelete", 0)) != 0) return 0;
+ object max = key.GetValue("MaxCapacity");
+ if (max != null) capacityMb = Convert.ToInt64(max);
+ }
+ }
+ }
+ }
+ if (capacityMb < 0) {
+ long totalMb = new DriveInfo(root).TotalSize / (1024L * 1024L);
+ capacityMb = totalMb <= 40960 ? totalMb / 10 : 4096 + (totalMb - 40960) / 20;
+ }
+ return capacityMb * 1024L * 1024L;
+ }
+}
+'@
+$results = @()
+$failed = $false
+foreach ($path in ($env:PORTOS_TRASH_PATHS -split [char]10 | Where-Object { $_ -ne '' })) {
+ if (-not (Test-Path -LiteralPath $path)) { $failed = $true; $results += @{ path = $path; code = 2; error = 'missing' }; continue }
+ $type = [PortOSRecycle]::DriveType($path)
+ if ($type -ne 'Fixed') { $failed = $true; $results += @{ path = $path; code = -1; error = "no recycle bin on $type drive" }; continue }
+ $capacity = [PortOSRecycle]::BinCapacityBytes([IO.Path]::GetPathRoot($path))
+ if ($capacity -le 0) { $failed = $true; $results += @{ path = $path; code = -2; error = 'recycle bin disabled on this volume' }; continue }
+ $size = (Get-Item -LiteralPath $path -Force).Length
+ if ($size -gt $capacity) { $failed = $true; $results += @{ path = $path; code = -3; error = 'file larger than the recycle bin capacity'; size = $size; capacity = $capacity }; continue }
+ $aborted = $false
+ $rc = [PortOSRecycle]::Recycle($path, [ref]$aborted)
+ if ($rc -ne 0 -or $aborted -or (Test-Path -LiteralPath $path)) { $failed = $true; $results += @{ path = $path; code = $rc; aborted = $aborted } }
+ else { $results += @{ path = $path; recycled = $true } }
+}
+[Console]::Out.WriteLine((ConvertTo-Json -Compress -InputObject @($results)))
+if ($failed) { exit 1 }
+`;
+
+const WINDOWS_ENCODED_SCRIPT = Buffer.from(WINDOWS_TRASH_SCRIPT, 'utf16le').toString('base64');
+
+// Both scripts print one JSON array; anything else is treated as no report.
+function parseReport(text) {
+ try {
+ const parsed = JSON.parse(String(text ?? '').replace(/^\uFEFF/, '').trim());
+ return Array.isArray(parsed) ? parsed : [parsed];
+ } catch {
+ return null;
+ }
+}
+
+// Run a reporting script to completion. The per-file report rides on the
+// rejection for diagnostics only; nothing here or upstream reads it to choose
+// another deletion strategy.
+async function runReportingScript(file, args, options, label) {
+ let stdout;
+ try {
+ ({ stdout } = await execFileAsync(file, args, { ...options, timeout: NATIVE_TRASH_DEADLINE_MS }));
+ } catch (error) {
+ if (error.killed) throw codedError(`${label} recycle exceeded the ${NATIVE_TRASH_DEADLINE_MS}ms deadline`, 'TRASH_DEADLINE');
+ throw Object.assign(codedError(`${label} recycle refused`, 'TRASH_REFUSED'), { exitCode: error.code, report: parseReport(error.stdout) });
+ }
+ const report = parseReport(stdout);
+ if (!report) throw codedError(`${label} recycle produced no report`, 'TRASH_UNPARSABLE');
+ return report;
+}
export async function moveToNativeTrash(paths) {
- const binary = { darwin: 'macos-trash', win32: 'windows-trash.exe' }[process.platform];
- if (binary) {
- // Own the spawn: Windows must stay console-free, and macOS must not use
- // the package's fallback to a working-directory .Trash outside the OS bin.
- const command = fileURLToPath(new URL(`./lib/${binary}`, import.meta.resolve('trash')));
- const { execFile } = await import('./childProcess.js');
- await promisify(execFile)(command, paths, { timeout: 30_000 });
- return;
- }
- if (process.platform !== 'linux') throw new Error('Native trash is unavailable on this platform');
- const { default: trash } = await import('trash');
- await trash(paths, { glob: false });
+ switch (process.platform) {
+ case 'darwin':
+ for (const path of paths) {
+ await runReportingScript('/usr/bin/osascript', ['-l', 'JavaScript', '-e', MACOS_TRASH_SCRIPT, path], {}, 'macOS');
+ }
+ return;
+ case 'win32':
+ // PowerShell 7 is not a substitute: the script targets the .NET Framework Add-Type compiler.
+ await runReportingScript(
+ windowsPowerShell51Path(),
+ ['-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-EncodedCommand', WINDOWS_ENCODED_SCRIPT],
+ { env: { ...process.env, PORTOS_TRASH_PATHS: paths.join('\n') } },
+ 'Windows',
+ );
+ return;
+ case 'linux':
+ for (const path of paths) await trashXdg(path);
+ return;
+ default:
+ throw codedError('Native trash is unavailable on this platform', 'TRASH_UNSUPPORTED_PLATFORM');
+ }
}
diff --git a/server/lib/nativeTrash.test.js b/server/lib/nativeTrash.test.js
index 1789b87e86..ec430d49a6 100644
--- a/server/lib/nativeTrash.test.js
+++ b/server/lib/nativeTrash.test.js
@@ -1,36 +1,116 @@
import { afterEach, describe, expect, it, vi } from 'vitest';
-import { existsSync } from 'node:fs';
+import { promisify } from 'node:util';
import { pinPlatform } from './testHelper.js';
-import { moveToNativeTrash } from './nativeTrash.js';
+import { windowsPowerShell51Path } from './processEnv.js';
+import { MACOS_TRASH_SCRIPT, NATIVE_TRASH_DEADLINE_MS, WINDOWS_TRASH_SCRIPT, moveToNativeTrash } from './nativeTrash.js';
+
+const state = vi.hoisted(() => ({ execFile: vi.fn(), trashXdg: vi.fn() }));
+// The module only ever calls `promisify(execFile)`, which resolves to `{ stdout, stderr }`.
+vi.mock('./childProcess.js', () => ({ execFile: Object.assign(() => {}, { [promisify.custom]: (...args) => state.execFile(...args) }) }));
+vi.mock('./nativeTrashXdg.js', () => ({ trashXdg: (...args) => state.trashXdg(...args) }));
+
+const PATHS = ['/synthetic/scene[1].png', '/synthetic/a sp ace.mp4'];
+const refusal = (fields) => Object.assign(new Error('Command failed'), fields);
-const state = vi.hoisted(() => ({ execFile: vi.fn(), trash: vi.fn() }));
-vi.mock('./childProcess.js', () => ({ execFile: (...args) => state.execFile(...args) }));
-vi.mock('trash', () => ({ default: state.trash }));
let restore;
afterEach(() => { restore?.(); vi.resetAllMocks(); });
-describe('native recycling adapter', () => {
- it.each([['darwin', 'macos-trash'], ['win32', 'windows-trash.exe']])('uses a hidden, bounded native helper on %s', async (platform, binary) => {
- restore = pinPlatform(platform);
- state.execFile.mockImplementation((_command, _args, _options, callback) => { callback(null, '', ''); });
- await moveToNativeTrash(['/synthetic/scene[1].png']);
- expect(state.execFile).toHaveBeenCalledWith(expect.stringContaining(binary), ['/synthetic/scene[1].png'], { timeout: 30_000 }, expect.any(Function));
- expect(existsSync(state.execFile.mock.calls[0][0])).toBe(true);
- expect(state.trash).not.toHaveBeenCalled();
+describe('macOS adapter', () => {
+ it('spawns osascript once per file with the embedded JXA script, no shell, and a deadline', async () => {
+ restore = pinPlatform('darwin');
+ state.execFile.mockResolvedValue({ stdout: '[{"path":"x","trashedPath":"y"}]', stderr: '' });
+ await moveToNativeTrash(PATHS);
+ expect(state.execFile.mock.calls).toEqual(PATHS.map(path => [
+ '/usr/bin/osascript', ['-l', 'JavaScript', '-e', MACOS_TRASH_SCRIPT, path], { timeout: NATIVE_TRASH_DEADLINE_MS },
+ ]));
+ expect(state.trashXdg).not.toHaveBeenCalled();
+ });
+
+ it('embeds the Foundation call and reports on stdout only', () => {
+ expect(MACOS_TRASH_SCRIPT).toContain('trashItemAtURLResultingItemURLError');
+ expect(MACOS_TRASH_SCRIPT).toContain('$.exit(1)');
+ expect(MACOS_TRASH_SCRIPT).not.toContain('fileHandleWithStandardError');
+ });
+
+ it('stops at the first refused file and surfaces the per-file report', async () => {
+ restore = pinPlatform('darwin');
+ const report = [{ path: PATHS[0], code: 4, domain: 'NSCocoaErrorDomain', error: 'missing' }];
+ state.execFile.mockRejectedValue(refusal({ code: 1, stdout: `${JSON.stringify(report)}\n`, stderr: '' }));
+ await expect(moveToNativeTrash(PATHS)).rejects.toMatchObject({ code: 'TRASH_REFUSED', exitCode: 1, report });
+ expect(state.execFile).toHaveBeenCalledTimes(1);
+ });
+});
+
+describe('Windows adapter', () => {
+ it('runs Windows PowerShell 5.1 once per batch with the encoded script and the paths in the environment', async () => {
+ restore = pinPlatform('win32');
+ state.execFile.mockResolvedValue({ stdout: '[{"path":"x","recycled":true}]', stderr: '' });
+ await moveToNativeTrash(PATHS);
+ expect(state.execFile).toHaveBeenCalledTimes(1);
+ const [file, args, options] = state.execFile.mock.calls[0];
+ expect(file).toBe(windowsPowerShell51Path());
+ expect(args.slice(0, 5)).toEqual(['-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-EncodedCommand']);
+ expect(Buffer.from(args[5], 'base64').toString('utf16le')).toBe(WINDOWS_TRASH_SCRIPT);
+ expect(options.timeout).toBe(NATIVE_TRASH_DEADLINE_MS);
+ expect(options.env.PORTOS_TRASH_PATHS).toBe(PATHS.join('\n'));
+ expect(options.env.PATH ?? options.env.Path).toBeDefined();
+ expect(state.trashXdg).not.toHaveBeenCalled();
});
- it('uses literal paths for Linux XDG trash', async () => {
+ it('runs the drive-type pre-flight before the capacity check and reports on stdout only', () => {
+ // A UNC root must be refused by DriveType before GetVolumeNameForVolumeMountPoint sees it.
+ expect(WINDOWS_TRASH_SCRIPT.indexOf("$type -ne 'Fixed'")).toBeLessThan(WINDOWS_TRASH_SCRIPT.indexOf('::BinCapacityBytes('));
+ // PowerShell serialises a redirected error stream as CLIXML, which would hide the report.
+ expect(WINDOWS_TRASH_SCRIPT).not.toContain('[Console]::Error');
+ });
+
+ it('rejects a deadline kill without any further attempt', async () => {
+ restore = pinPlatform('win32');
+ state.execFile.mockRejectedValue(refusal({ killed: true, signal: 'SIGTERM', code: null }));
+ await expect(moveToNativeTrash(PATHS)).rejects.toMatchObject({ code: 'TRASH_DEADLINE' });
+ expect(state.execFile).toHaveBeenCalledTimes(1);
+ });
+
+ it('rejects unparsable output as a failure', async () => {
+ restore = pinPlatform('win32');
+ state.execFile.mockResolvedValue({ stdout: 'Add-Type : compile error', stderr: '' });
+ await expect(moveToNativeTrash(PATHS)).rejects.toMatchObject({ code: 'TRASH_UNPARSABLE' });
+ });
+
+ it('reads the refusal report from stdout and ignores the CLIXML error stream', async () => {
+ restore = pinPlatform('win32');
+ const report = [{ path: PATHS[0], code: -1, error: 'no recycle bin on Network drive' }];
+ state.execFile.mockRejectedValue(refusal({ code: 1, stdout: `\uFEFF${JSON.stringify(report)}\r\n`, stderr: '#< CLIXML\r\n<Objs Version="1.1.0.1"></Objs>' }));
+ await expect(moveToNativeTrash(PATHS)).rejects.toMatchObject({ code: 'TRASH_REFUSED', exitCode: 1, report });
+ });
+
+ it('keeps a refusal with no report bounded', async () => {
+ restore = pinPlatform('win32');
+ state.execFile.mockRejectedValue(refusal({ code: 1, stdout: '', stderr: 'At line:1 char:1 ...' }));
+ await expect(moveToNativeTrash(PATHS)).rejects.toMatchObject({ code: 'TRASH_REFUSED', exitCode: 1, report: null });
+ });
+});
+
+describe('Linux adapter', () => {
+ it('recycles each literal path through the XDG adapter and spawns nothing', async () => {
restore = pinPlatform('linux');
- state.trash.mockResolvedValueOnce();
- await moveToNativeTrash(['/synthetic/scene[1].png']);
- expect(state.trash).toHaveBeenCalledWith(['/synthetic/scene[1].png'], { glob: false });
+ state.trashXdg.mockResolvedValue({});
+ await moveToNativeTrash(PATHS);
+ expect(state.trashXdg.mock.calls).toEqual(PATHS.map(path => [path]));
expect(state.execFile).not.toHaveBeenCalled();
});
+
+ it('propagates the adapter refusal code and stops', async () => {
+ restore = pinPlatform('linux');
+ state.trashXdg.mockRejectedValueOnce(Object.assign(new Error('unsafe'), { code: 'TRASH_DIR_UNSAFE' }));
+ await expect(moveToNativeTrash(PATHS)).rejects.toMatchObject({ code: 'TRASH_DIR_UNSAFE' });
+ expect(state.trashXdg).toHaveBeenCalledTimes(1);
+ });
});
-it('does not fall back when the native macOS operation is rejected', async () => {
- restore = pinPlatform('darwin');
- state.execFile.mockImplementation((_command, _args, _options, callback) => { callback(new Error('trash unavailable')); });
- await expect(moveToNativeTrash(['/synthetic/scene.png'])).rejects.toThrow('trash unavailable');
- expect(state.trash).not.toHaveBeenCalled();
+it('rejects any other platform without touching the filesystem or spawning', async () => {
+ restore = pinPlatform('freebsd');
+ await expect(moveToNativeTrash(PATHS)).rejects.toMatchObject({ code: 'TRASH_UNSUPPORTED_PLATFORM' });
+ expect(state.execFile).not.toHaveBeenCalled();
+ expect(state.trashXdg).not.toHaveBeenCalled();
});
diff --git a/server/lib/nativeTrashXdg.js b/server/lib/nativeTrashXdg.js
new file mode 100644
index 0000000000..cfdf11640e
--- /dev/null
+++ b/server/lib/nativeTrashXdg.js
@@ -0,0 +1,178 @@
+/**
+ * Linux recycling adapter: freedesktop.org Trash specification 1.0 on `node:fs`
+ * only (ADR docs/decisions/2026-10-18-native-trash-without-dependency.md).
+ * One file per call; the caller (`nativeTrash.js` → `trashFiles.js`) owns
+ * batching and post-operation verification. Entries keep their original
+ * names, so `gio trash`, `trash-cli` and desktop file managers list and
+ * restore them like their own.
+ *
+ * Fails closed: there is no cross-device copy and no fallback directory. A
+ * volume without a usable per-volume trash surfaces `EXDEV`/`EACCES` with the
+ * original left in place.
+ */
+import { chmod, lstat, mkdir, open, realpath, rename, stat, unlink } from 'node:fs/promises';
+import { basename, dirname, extname, isAbsolute, join, relative, resolve } from 'node:path';
+import { homedir } from 'node:os';
+import { codedError } from './codedError.js';
+
+const NAME_MAX_BYTES = 255;
+const INFO_SUFFIX = '.trashinfo';
+
+const homeTrashDir = () => {
+ const dataHome = process.env.XDG_DATA_HOME;
+ return join(dataHome && isAbsolute(dataHome) ? dataHome : join(homedir(), '.local', 'share'), 'Trash');
+};
+const missing = error => { if (error.code === 'ENOENT') return null; throw error; };
+
+// Device of a path that may not exist yet (the home trash before first use):
+// the nearest existing ancestor decides. `stat` follows a symlinked ancestor
+// (an XDG_DATA_HOME pointing at another filesystem) to the device the trash
+// would really be created on; a symlinked trash directory itself is still
+// refused by ensureOwnedDir.
+async function deviceOf(path) {
+ for (let dir = path; ; dir = dirname(dir)) {
+ const info = await stat(dir).catch(missing);
+ if (info) return info.dev;
+ if (dirname(dir) === dir) throw codedError(`No existing ancestor for ${path}`, 'ENOENT');
+ }
+}
+
+// Mount point of `path`: the highest ancestor still on the same device.
+async function topDirOf(path, dev) {
+ let dir = dirname(path);
+ for (;;) {
+ const parent = dirname(dir);
+ if (parent === dir) return dir;
+ if ((await lstat(parent)).dev !== dev) return dir;
+ dir = parent;
+ }
+}
+
+/**
+ * Spec §"Trash directories": prefer `$topdir/.Trash/$uid` when `$topdir/.Trash`
+ * is a sticky, non-symlink directory; otherwise `$topdir/.Trash-$uid`. A
+ * `.Trash` that fails the checks MUST NOT be used.
+ */
+export async function _topDirTrash(topDir, uid) {
+ const shared = join(topDir, '.Trash');
+ const info = await lstat(shared).catch(missing);
+ if (info?.isDirectory() && !info.isSymbolicLink() && (info.mode & 0o1000) !== 0) return join(shared, String(uid));
+ return join(topDir, `.Trash-${uid}`);
+}
+
+// The home trash serves every file on the device the home trash itself lives on
+// (XDG_DATA_HOME may sit on another volume than $HOME); anything else gets the
+// per-volume trash of its own mount point.
+async function trashLocation(absPath) {
+ const home = homeTrashDir();
+ const fileDev = (await lstat(absPath)).dev;
+ if (fileDev === await deviceOf(home)) return { dir: home, topDir: null };
+ const topDir = await topDirOf(absPath, fileDev);
+ return { dir: await _topDirTrash(topDir, process.getuid()), topDir };
+}
+
+// A per-user trash directory and its files/ and info/ children must be real
+// directories owned by the caller and private to them (0700, as the spec
+// creates them). On a shared volume anyone can pre-create `.Trash-<uid>` as a
+// symlink into a directory they control, and a group/world-writable trash
+// directory would let them swap `files/` for such a link between this check
+// and the move; either would carry the user's files off and report success. A
+// merely readable directory would expose a file that was private in its
+// source directory. An owned real directory with wider bits is tightened in
+// place — the caller owns it, so chmod cannot escalate anything — and
+// re-checked; anything else is refused. Checked parent-first by the caller, so
+// by the time files/ and info/ are probed nobody else can write their parent.
+async function ensureOwnedDir(path, uid) {
+ let info = await lstat(path).catch(missing);
+ if (!info) {
+ await mkdir(path, { recursive: true, mode: 0o700 });
+ info = await lstat(path);
+ }
+ const ownedDir = () => !info.isSymbolicLink() && info.isDirectory() && info.uid === uid;
+ if (ownedDir() && (info.mode & 0o077) !== 0) {
+ await chmod(path, 0o700);
+ info = await lstat(path);
+ }
+ if (!ownedDir() || (info.mode & 0o077) !== 0) {
+ throw codedError(`Trash directory is not a private directory owned by this user: ${path}`, 'TRASH_DIR_UNSAFE');
+ }
+}
+
+async function prepareTrashDir(dir, uid) {
+ for (const directory of [dir, join(dir, 'files'), join(dir, 'info')]) await ensureOwnedDir(directory, uid);
+}
+
+// RFC 2396 escaping as the spec requires: every byte outside the unreserved set,
+// keeping '/' as the segment separator.
+const encodePath = path => path.split('/').map(encodeURIComponent).join('/');
+const pad = n => String(n).padStart(2, '0');
+const deletionDate = (d = new Date()) => `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}T${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`;
+const exists = path => lstat(path).catch(missing).then(Boolean);
+
+// Name inside files/: the original basename, `stem.N.ext` on collision, shortened
+// by whole code points when `<name>.trashinfo` would exceed NAME_MAX — the stem
+// first (the extension keeps the file recognisable), then the extension itself.
+// The complete original path always survives in the info file.
+function trashName(base, attempt) {
+ const suffix = attempt === 0 ? '' : `.${attempt}`;
+ const budget = NAME_MAX_BYTES - Buffer.byteLength(INFO_SUFFIX) - Buffer.byteLength(suffix);
+ let ext = extname(base);
+ const stem = Array.from(base.slice(0, base.length - ext.length));
+ while (stem.length > 1 && Buffer.byteLength(stem.join('') + ext) > budget) stem.pop();
+ while (Buffer.byteLength(stem.join('') + ext) > budget) ext = Array.from(ext).slice(0, -1).join('');
+ return `${stem.join('')}${suffix}${ext}`;
+}
+
+/**
+ * Move one file into the XDG trash that serves its volume. Resolves with the
+ * trashed payload path and its `.trashinfo` path; rejects with a coded error
+ * (`ENOENT`, `EXDEV`, `EACCES`, `TRASH_DIR_UNSAFE` for a symlinked or foreign-owned
+ * trash directory, `TRASH_NAME_EXHAUSTED`)
+ * and the original untouched on any refusal.
+ */
+export async function trashXdg(path) {
+ // Device and mount-point discovery need the physical parent: through a directory
+ // symlink into another volume, lexical ancestors would place the volume trash
+ // below the real mount root where no trash tool looks. The final component is
+ // kept as given so a source that is itself a symlink is what gets recycled.
+ const given = resolve(path);
+ const absPath = join(await realpath(dirname(given)), basename(given));
+ const uid = process.getuid();
+ let { dir, topDir } = await trashLocation(absPath);
+ try {
+ await prepareTrashDir(dir, uid);
+ } catch (error) {
+ // Spec: a sticky shared $topdir/.Trash whose per-user directory cannot be
+ // created falls back to $topdir/.Trash-$uid (gio and trash-cli do the same).
+ const sharedPerUser = topDir && dir === join(topDir, '.Trash', String(uid)) && ['EACCES', 'EPERM'].includes(error.code);
+ if (!sharedPerUser) throw error;
+ dir = join(topDir, `.Trash-${uid}`);
+ await prepareTrashDir(dir, uid);
+ }
+ const filesDir = join(dir, 'files');
+ const infoDir = join(dir, 'info');
+ const base = basename(absPath);
+ const recordedPath = topDir ? relative(topDir, absPath) : absPath;
+ for (let attempt = 0; attempt < 1000; attempt++) {
+ const name = trashName(base, attempt);
+ const infoPath = join(infoDir, `${name}${INFO_SUFFIX}`);
+ const target = join(filesDir, name);
+ // The info file is the atomic reservation (O_EXCL); an orphan in files/ also blocks the name.
+ let handle;
+ try { handle = await open(infoPath, 'wx', 0o600); } catch (error) { if (error.code === 'EEXIST') continue; throw error; }
+ try {
+ if (await exists(target)) { await handle.close(); handle = null; await unlink(infoPath); continue; }
+ await handle.writeFile(`[Trash Info]\nPath=${encodePath(recordedPath)}\nDeletionDate=${deletionDate()}\n`);
+ await handle.close();
+ handle = null;
+ await rename(absPath, target);
+ return { trashedPath: target, infoPath };
+ } catch (error) {
+ // Nothing moved: EXDEV (no usable per-volume trash), EACCES, etc. surface as a bounded refusal.
+ if (handle) await handle.close().catch(() => {});
+ await unlink(infoPath).catch(() => {});
+ throw error;
+ }
+ }
+ throw codedError('No free name in the trash directory', 'TRASH_NAME_EXHAUSTED');
+}
diff --git a/server/lib/nativeTrashXdg.test.js b/server/lib/nativeTrashXdg.test.js
new file mode 100644
index 0000000000..fe1d050043
--- /dev/null
+++ b/server/lib/nativeTrashXdg.test.js
@@ -0,0 +1,255 @@
+// Real temp-filesystem contract for the Linux freedesktop Trash adapter. The
+// home trash is pointed at a temp XDG_DATA_HOME beside the sources so every
+// case runs on one device; the cross-device cases use /dev/shm when it is a
+// different device (Linux CI) and skip elsewhere.
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { chmod, lstat, mkdir, mkdtemp, readdir, readFile, readlink, realpath, rm, symlink, writeFile } from 'node:fs/promises';
+import { tmpdir } from 'node:os';
+import { basename, join } from 'node:path';
+import { _topDirTrash, trashXdg } from './nativeTrashXdg.js';
+
+const state = vi.hoisted(() => ({ homedir: null, renameError: null }));
+vi.mock('node:os', async (importOriginal) => {
+ const actual = await importOriginal();
+ return { ...actual, homedir: () => state.homedir ?? actual.homedir() };
+});
+vi.mock('node:fs/promises', async (importOriginal) => {
+ const actual = await importOriginal();
+ return { ...actual, rename: (...args) => (state.renameError ? Promise.reject(state.renameError) : actual.rename(...args)) };
+});
+
+const DATE_SHAPE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/;
+const exists = path => lstat(path).then(() => true, () => false);
+const readInfo = async (infoPath) => {
+ const text = await readFile(infoPath, 'utf8');
+ const [header, pathLine, dateLine, trailing] = text.split('\n');
+ expect(header).toBe('[Trash Info]');
+ expect(trailing).toBe('');
+ expect(dateLine.replace('DeletionDate=', '')).toMatch(DATE_SHAPE);
+ return pathLine.replace('Path=', '');
+};
+
+// A second writable device, when the host offers one next to the temp root.
+async function otherDevice(rootDev) {
+ const info = await lstat('/dev/shm').catch(() => null);
+ return info?.isDirectory() && info.dev !== rootDev ? '/dev/shm' : null;
+}
+
+describe.skipIf(process.platform === 'win32')('XDG trash adapter', () => {
+ let root;
+ let src;
+ let homeTrash;
+
+ beforeEach(async () => {
+ root = await realpath(await mkdtemp(join(tmpdir(), 'portos-xdg-')));
+ src = join(root, 'src');
+ await mkdir(src);
+ await mkdir(join(root, 'home'));
+ state.homedir = join(root, 'home');
+ vi.stubEnv('XDG_DATA_HOME', join(root, 'xdg'));
+ homeTrash = join(root, 'xdg', 'Trash');
+ });
+ afterEach(async () => {
+ state.renameError = null;
+ state.homedir = null;
+ vi.unstubAllEnvs();
+ await rm(root, { recursive: true, force: true });
+ });
+
+ it('keeps the original name, escapes Path per RFC 2396 and stamps a local DeletionDate', async () => {
+ expect(root).toMatch(/^[A-Za-z0-9/._-]+$/);
+ const cases = [
+ ['a sp ace.txt', 'a%20sp%20ace.txt'],
+ ['scene[1].png', 'scene%5B1%5D.png'],
+ ['100%#?.txt', '100%25%23%3F.txt'],
+ ['ünï 🎬.txt', '%C3%BCn%C3%AF%20%F0%9F%8E%AC.txt'],
+ ];
+ for (const [name, escaped] of cases) {
+ const path = join(src, name);
+ await writeFile(path, `payload:${name}`);
+ const { trashedPath, infoPath } = await trashXdg(path);
+ expect(trashedPath).toBe(join(homeTrash, 'files', name));
+ expect(infoPath).toBe(join(homeTrash, 'info', `${name}.trashinfo`));
+ expect(await exists(path)).toBe(false);
+ expect(await readFile(trashedPath, 'utf8')).toBe(`payload:${name}`);
+ expect(await readInfo(infoPath)).toBe(`${root}/src/${escaped}`);
+ }
+ expect((await lstat(homeTrash)).mode & 0o777).toBe(0o700);
+ });
+
+ it('suffixes a colliding name through the O_EXCL info reservation and never overwrites an orphan payload', async () => {
+ const path = join(src, 'plain.txt');
+ const names = [];
+ for (const round of [0, 1]) {
+ await writeFile(path, `round ${round}`);
+ names.push(basename((await trashXdg(path)).trashedPath));
+ }
+ expect(names).toEqual(['plain.txt', 'plain.1.txt']);
+ await writeFile(join(homeTrash, 'files', 'plain.2.txt'), 'orphan');
+ await writeFile(path, 'round 2');
+ expect(basename((await trashXdg(path)).trashedPath)).toBe('plain.3.txt');
+ expect(await readFile(join(homeTrash, 'files', 'plain.2.txt'), 'utf8')).toBe('orphan');
+ expect(await exists(join(homeTrash, 'info', 'plain.2.txt.trashinfo'))).toBe(false);
+ });
+
+ it('removes the reservation and leaves the original when the move fails', async () => {
+ const path = join(src, 'kept.txt');
+ await writeFile(path, 'kept');
+ state.renameError = Object.assign(new Error('cross-device link not permitted'), { code: 'EXDEV' });
+ await expect(trashXdg(path)).rejects.toMatchObject({ code: 'EXDEV' });
+ expect(await readFile(path, 'utf8')).toBe('kept');
+ expect(await readdir(join(homeTrash, 'info'))).toEqual([]);
+ expect(await readdir(join(homeTrash, 'files'))).toEqual([]);
+ });
+
+ it('rejects a missing source with ENOENT', async () => {
+ await expect(trashXdg(join(src, 'nope.txt'))).rejects.toMatchObject({ code: 'ENOENT' });
+ });
+
+ it.each([
+ ['the trash root is a symlink', dir => symlink(join(dir, '..', 'evil'), join(dir, 'Trash'))],
+ ['files/ is a symlink', async dir => { await mkdir(join(dir, 'Trash'), { mode: 0o700 }); await symlink(join(dir, '..', 'evil'), join(dir, 'Trash', 'files')); }],
+ ])('refuses the trash directory when %s and moves nothing', async (_label, plant) => {
+ await mkdir(join(root, 'evil'));
+ await mkdir(join(root, 'xdg'));
+ await plant(join(root, 'xdg'));
+ const path = join(src, 'victim.txt');
+ await writeFile(path, 'victim');
+ await expect(trashXdg(path)).rejects.toMatchObject({ code: 'TRASH_DIR_UNSAFE' });
+ expect(await readFile(path, 'utf8')).toBe('victim');
+ expect(await readdir(join(root, 'evil'))).toEqual([]);
+ });
+
+ it.each([
+ ['a 255-byte basename', `${'a'.repeat(251)}.txt`],
+ ['a 250-character extension', `f.${'x'.repeat(250)}`],
+ ['a multibyte stem', `${'🎬'.repeat(62)}.png`],
+ ])('shortens %s to fit NAME_MAX with the .trashinfo suffix and keeps the full path', async (_label, name) => {
+ const path = join(src, name);
+ await writeFile(path, 'long');
+ const { trashedPath, infoPath } = await trashXdg(path);
+ const trashed = basename(trashedPath);
+ expect(trashed.length).toBeLessThan(name.length);
+ expect(Buffer.byteLength(`${trashed}.trashinfo`)).toBeLessThanOrEqual(255);
+ expect(Buffer.from(trashed).toString()).toBe(trashed);
+ expect(trashed).not.toContain('�');
+ expect(await readFile(trashedPath, 'utf8')).toBe('long');
+ expect(decodeURIComponent(await readInfo(infoPath))).toBe(path);
+ });
+
+ it.each([
+ ['world-writable', 0o777],
+ ['publicly readable', 0o755],
+ ['group-writable files/', 0o770],
+ ])('tightens an owned %s trash directory to 0700 before moving anything', async (_label, mode) => {
+ const target = mode === 0o770 ? join(homeTrash, 'files') : homeTrash;
+ await mkdir(target, { recursive: true, mode: 0o700 });
+ await chmod(target, mode);
+ const path = join(src, 'private.txt');
+ await writeFile(path, 'private', { mode: 0o644 });
+ await trashXdg(path);
+ for (const directory of [homeTrash, join(homeTrash, 'files'), join(homeTrash, 'info')]) {
+ expect((await lstat(directory)).mode & 0o777).toBe(0o700);
+ }
+ expect(await readFile(join(homeTrash, 'files', 'private.txt'), 'utf8')).toBe('private');
+ });
+
+ it('recycles a symlink source itself rather than its target', async () => {
+ await writeFile(join(src, 'target.txt'), 'target');
+ await symlink('target.txt', join(src, 'link.txt'));
+ const { trashedPath } = await trashXdg(join(src, 'link.txt'));
+ expect(await readFile(join(src, 'target.txt'), 'utf8')).toBe('target');
+ expect(await readlink(trashedPath)).toBe('target.txt');
+ });
+
+ it('chooses $topdir/.Trash/$uid only for a sticky real directory', async () => {
+ const uid = process.getuid();
+ const top = join(root, 'vol');
+ await mkdir(top);
+ expect(await _topDirTrash(top, uid)).toBe(join(top, `.Trash-${uid}`));
+ await mkdir(join(top, '.Trash'), { mode: 0o777 });
+ expect(await _topDirTrash(top, uid)).toBe(join(top, `.Trash-${uid}`));
+ await chmod(join(top, '.Trash'), 0o1777);
+ expect(await _topDirTrash(top, uid)).toBe(join(top, '.Trash', String(uid)));
+ const linked = join(root, 'vol2');
+ await mkdir(linked);
+ await symlink(join(top, '.Trash'), join(linked, '.Trash'));
+ expect(await _topDirTrash(linked, uid)).toBe(join(linked, `.Trash-${uid}`));
+ });
+
+ describe('across devices', () => {
+ let other = null;
+ let otherRoot = null;
+ beforeEach(async () => {
+ other = await otherDevice((await lstat(root)).dev);
+ if (other) otherRoot = await realpath(await mkdtemp(join(other, 'portos-xdg-')));
+ });
+ afterEach(async () => {
+ if (otherRoot) await rm(otherRoot, { recursive: true, force: true });
+ otherRoot = null;
+ });
+
+ it('uses the physical parent volume trash through a directory symlink and records a topdir-relative path', async ({ skip }) => {
+ if (!otherRoot) skip();
+ const uid = process.getuid();
+ await mkdir(join(otherRoot, 'media'));
+ await writeFile(join(otherRoot, 'media', 'file.txt'), 'remote');
+ await symlink(join(otherRoot, 'media'), join(src, 'link'));
+ const { trashedPath, infoPath } = await trashXdg(join(src, 'link', 'file.txt'));
+ try {
+ const volumeTrash = await _topDirTrash(other, uid);
+ expect(trashedPath).toBe(join(volumeTrash, 'files', 'file.txt'));
+ expect(await readFile(trashedPath, 'utf8')).toBe('remote');
+ expect(await readInfo(infoPath)).toBe(`${basename(otherRoot)}/media/file.txt`);
+ expect(await exists(join(otherRoot, 'media', 'file.txt'))).toBe(false);
+ } finally {
+ await rm(trashedPath, { force: true });
+ await rm(infoPath, { force: true });
+ }
+ });
+
+ it('falls back to .Trash-<uid> when the sticky shared .Trash cannot hold a per-user directory', async ({ skip }) => {
+ if (!otherRoot) skip();
+ const uid = process.getuid();
+ const shared = join(other, '.Trash');
+ if (await exists(shared)) skip();
+ await mkdir(shared, { mode: 0o1500 });
+ await chmod(shared, 0o1500);
+ await writeFile(join(otherRoot, 'file.txt'), 'fallback');
+ let trashed;
+ try {
+ trashed = await trashXdg(join(otherRoot, 'file.txt'));
+ expect(trashed.trashedPath).toBe(join(other, `.Trash-${uid}`, 'files', 'file.txt'));
+ expect(await readInfo(trashed.infoPath)).toBe(`${basename(otherRoot)}/file.txt`);
+ } finally {
+ await rm(shared, { recursive: true, force: true });
+ if (trashed) { await rm(trashed.trashedPath, { force: true }); await rm(trashed.infoPath, { force: true }); }
+ }
+ });
+
+ it('probes the home-trash device through a symlinked XDG_DATA_HOME before the trash exists', async ({ skip }) => {
+ if (!otherRoot) skip();
+ await mkdir(join(otherRoot, 'xdg'));
+ await symlink(join(otherRoot, 'xdg'), join(root, 'xdg-link'));
+ vi.stubEnv('XDG_DATA_HOME', join(root, 'xdg-link'));
+ await mkdir(join(otherRoot, 'src'));
+ const path = join(otherRoot, 'src', 'file.txt');
+ await writeFile(path, 'through the link');
+ const { trashedPath, infoPath } = await trashXdg(path);
+ expect(trashedPath).toBe(join(root, 'xdg-link', 'Trash', 'files', 'file.txt'));
+ expect(await readFile(join(otherRoot, 'xdg', 'Trash', 'files', 'file.txt'), 'utf8')).toBe('through the link');
+ expect(await readInfo(infoPath)).toBe(path);
+ });
+
+ it('serves a file on the XDG_DATA_HOME device from the home trash even when $HOME is elsewhere', async ({ skip }) => {
+ if (!otherRoot) skip();
+ vi.stubEnv('XDG_DATA_HOME', join(otherRoot, 'xdg'));
+ await mkdir(join(otherRoot, 'src'));
+ const path = join(otherRoot, 'src', 'file.txt');
+ await writeFile(path, 'data-home volume');
+ const { trashedPath, infoPath } = await trashXdg(path);
+ expect(trashedPath).toBe(join(otherRoot, 'xdg', 'Trash', 'files', 'file.txt'));
+ expect(await readInfo(infoPath)).toBe(path);
+ });
+ });
+});
diff --git a/server/lib/processEnv.js b/server/lib/processEnv.js
index 1960450ef4..ed4baa9d11 100644
--- a/server/lib/processEnv.js
+++ b/server/lib/processEnv.js
@@ -13,7 +13,7 @@
import { execFile, execFileSync } from './childProcess.js';
import { promisify } from 'util';
import { accessSync, constants, existsSync, statSync } from 'fs';
-import { delimiter, isAbsolute, join, resolve } from 'path';
+import { delimiter, isAbsolute, join, resolve, win32 } from 'path';
const execFileAsync = promisify(execFile);
const IS_WIN = process.platform === 'win32';
@@ -184,6 +184,15 @@ const canExecute = (candidate) => {
* @param {{env?: NodeJS.ProcessEnv|object, cwd?: string}} [options]
* @returns {string|null}
*/
+/**
+ * Windows PowerShell 5.1's fixed location — it ships with every supported
+ * Windows, so this is the shell resolver's last PowerShell probe and the one
+ * host `nativeTrash.js` targets for its .NET Framework `Add-Type` script.
+ */
+export function windowsPowerShell51Path(env = process.env) {
+ return win32.join(env.SystemRoot || 'C:\\Windows', 'System32', 'WindowsPowerShell', 'v1.0', 'powershell.exe');
+}
+
export function findCommandOnPath(name, { env = process.env, cwd = process.cwd() } = {}) {
if (!name || typeof name !== 'string') return null;
diff --git a/server/package-lock.json b/server/package-lock.json
index b9b6ef295d..e52e01a04d 100644
--- a/server/package-lock.json
+++ b/server/package-lock.json
@@ -24,7 +24,6 @@
"socket.io": "4.8.4",
"socket.io-client": "4.8.4",
"three": "0.186.1",
- "trash": "10.1.1",
"undici": "8.12.1",
"ws": "8.22.0",
"zod": "4.6.7"
@@ -917,41 +916,6 @@
"@jridgewell/sourcemap-codec": "^1.4.14"
}
},
- "node_modules/@nodelib/fs.scandir": {
- "version": "2.1.5",
- "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
- "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==",
- "license": "MIT",
- "dependencies": {
- "@nodelib/fs.stat": "2.0.5",
- "run-parallel": "^1.1.9"
- },
- "engines": {
- "node": ">= 8"
- }
- },
- "node_modules/@nodelib/fs.stat": {
- "version": "2.0.5",
- "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz",
- "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==",
- "license": "MIT",
- "engines": {
- "node": ">= 8"
- }
- },
- "node_modules/@nodelib/fs.walk": {
- "version": "1.2.8",
- "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz",
- "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==",
- "license": "MIT",
- "dependencies": {
- "@nodelib/fs.scandir": "2.1.5",
- "fastq": "^1.6.0"
- },
- "engines": {
- "node": ">= 8"
- }
- },
"node_modules/@novnc/novnc": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/@novnc/novnc/-/novnc-1.7.0.tgz",
@@ -1328,45 +1292,12 @@
"license": "MIT",
"peer": true
},
- "node_modules/@sindresorhus/df": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/@sindresorhus/df/-/df-3.1.1.tgz",
- "integrity": "sha512-SME/vtXaJcnQ/HpeV6P82Egy+jThn11IKfwW8+/XVoRD0rmPHVTeKMtww1oWdVnMykzVPjmrDN9S8NBndPEHCQ==",
- "license": "MIT",
- "dependencies": {
- "execa": "^2.0.1"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/@sindresorhus/merge-streams": {
- "version": "2.3.0",
- "resolved": "https://registry.npmjs.org/@sindresorhus/merge-streams/-/merge-streams-2.3.0.tgz",
- "integrity": "sha512-LtoMMhxAlorcGhmFYI+LhPgbPZCkgP6ra1YL604EeF6U98pLlQ3iWIGMdWSC+vWmPBWBNgmDBAhnAobLROJmwg==",
- "license": "MIT",
- "engines": {
- "node": ">=18"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
"node_modules/@socket.io/component-emitter": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.2.tgz",
"integrity": "sha512-9BCxFwvbGg/RsZK9tjXd8s4UcwR0MWeFQ1XEKIQVVvAGJyINdrqKMcTRyLoK8Rse1GjzLV9cwjWV1olXRWEXVA==",
"license": "MIT"
},
- "node_modules/@stroncium/procfs": {
- "version": "1.2.1",
- "resolved": "https://registry.npmjs.org/@stroncium/procfs/-/procfs-1.2.1.tgz",
- "integrity": "sha512-X1Iui3FUNZP18EUvysTHxt+Avu2nlVzyf90YM8OYgP6SGzTzzX/0JgObfO1AQQDzuZtNNz29bVh8h5R97JrjxA==",
- "license": "CC0-1.0",
- "engines": {
- "node": ">=8"
- }
- },
"node_modules/@tootallnate/quickjs-emscripten": {
"version": "0.23.0",
"resolved": "https://registry.npmjs.org/@tootallnate/quickjs-emscripten/-/quickjs-emscripten-0.23.0.tgz",
@@ -1836,18 +1767,6 @@
"url": "https://paulmillr.com/funding/"
}
},
- "node_modules/chunkify": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/chunkify/-/chunkify-5.0.0.tgz",
- "integrity": "sha512-G8dj/3/Gm+1yL4oWSdwIxihZWFlgC4V2zYtIApacI0iPIRKBHlBGOGAiDUBZgrj4H8MBA8g8fPFwnJrWF3wl7Q==",
- "license": "MIT",
- "engines": {
- "node": ">=18"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
"node_modules/cli-tableau": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/cli-tableau/-/cli-tableau-2.0.1.tgz",
@@ -2009,20 +1928,6 @@
"integrity": "sha512-/f6gpQuxDaqXu+1kwQYSckUglPaOrHdbIlBAu0YuW8/Cdb45XwXYNUBXg3r/9Mo6n540Kn/smKcZWko5x99KrQ==",
"license": "MIT"
},
- "node_modules/cross-spawn": {
- "version": "7.0.6",
- "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
- "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
- "license": "MIT",
- "dependencies": {
- "path-key": "^3.1.0",
- "shebang-command": "^2.0.0",
- "which": "^2.0.1"
- },
- "engines": {
- "node": ">= 8"
- }
- },
"node_modules/culori": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/culori/-/culori-4.0.2.tgz",
@@ -2144,15 +2049,6 @@
"node": ">= 0.8"
}
},
- "node_modules/end-of-stream": {
- "version": "1.4.5",
- "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz",
- "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==",
- "license": "MIT",
- "dependencies": {
- "once": "^1.4.0"
- }
- },
"node_modules/engine.io": {
"version": "6.6.11",
"resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.6.11.tgz",
@@ -2358,26 +2254,6 @@
"integrity": "sha512-JEPTiaOt9f04oa6NOkc4aH+nVp5I3wEjpHbIPqfgCdD5v5bUzy7xQqwcVO2aDQgOWhI28da57HksMrzK9HlRxg==",
"license": "MIT"
},
- "node_modules/execa": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/execa/-/execa-2.1.0.tgz",
- "integrity": "sha512-Y/URAVapfbYy2Xp/gb6A0E7iR8xeqOCXsuuaoMn7A5PzrXUK84E1gyiEfq0wQd/GHA6GsoHWwhNq8anb0mleIw==",
- "license": "MIT",
- "dependencies": {
- "cross-spawn": "^7.0.0",
- "get-stream": "^5.0.0",
- "is-stream": "^2.0.0",
- "merge-stream": "^2.0.0",
- "npm-run-path": "^3.0.0",
- "onetime": "^5.1.0",
- "p-finally": "^2.0.0",
- "signal-exit": "^3.0.2",
- "strip-final-newline": "^2.0.0"
- },
- "engines": {
- "node": "^8.12.0 || >=9.7.0"
- }
- },
"node_modules/expect-type": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.4.0.tgz",
@@ -2446,37 +2322,12 @@
"follow-redirects": "^1.14.0"
}
},
- "node_modules/fast-glob": {
- "version": "3.3.3",
- "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz",
- "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==",
- "license": "MIT",
- "dependencies": {
- "@nodelib/fs.stat": "^2.0.2",
- "@nodelib/fs.walk": "^1.2.3",
- "glob-parent": "^5.1.2",
- "merge2": "^1.3.0",
- "micromatch": "^4.0.8"
- },
- "engines": {
- "node": ">=8.6.0"
- }
- },
"node_modules/fast-json-patch": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/fast-json-patch/-/fast-json-patch-3.1.1.tgz",
"integrity": "sha512-vf6IHUX2SBcA+5/+4883dsIjpBTqmfBjmYiWK1savxQmFk4JfBMLa7ynTYOs1Rolp/T1betJxHiGD3g1Mn8lUQ==",
"license": "MIT"
},
- "node_modules/fastq": {
- "version": "1.20.3",
- "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.3.tgz",
- "integrity": "sha512-XKv5nnLs6nLF71NgiKJLIZFLkPyIEuOselLG7ujZnGrRfQK8HpvY+WqKhAJUAdLomwVHErVS4LfxFlPq0/FTAw==",
- "license": "ISC",
- "dependencies": {
- "reusify": "^1.0.4"
- }
- },
"node_modules/fdir": {
"version": "6.5.0",
"resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
@@ -2695,21 +2546,6 @@
"node": ">= 0.4"
}
},
- "node_modules/get-stream": {
- "version": "5.2.0",
- "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz",
- "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==",
- "license": "MIT",
- "dependencies": {
- "pump": "^3.0.0"
- },
- "engines": {
- "node": ">=8"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
"node_modules/get-uri": {
"version": "6.0.5",
"resolved": "https://registry.npmjs.org/get-uri/-/get-uri-6.0.5.tgz",
@@ -2736,26 +2572,6 @@
"node": ">= 6"
}
},
- "node_modules/globby": {
- "version": "14.1.0",
- "resolved": "https://registry.npmjs.org/globby/-/globby-14.1.0.tgz",
- "integrity": "sha512-0Ia46fDOaT7k4og1PDW4YbodWWr3scS2vAr2lTbsplOt2WkKp0vQbkI9wKis/T5LV/dqPjO3bpS/z6GTJB82LA==",
- "license": "MIT",
- "dependencies": {
- "@sindresorhus/merge-streams": "^2.1.0",
- "fast-glob": "^3.3.3",
- "ignore": "^7.0.3",
- "path-type": "^6.0.0",
- "slash": "^5.1.0",
- "unicorn-magic": "^0.3.0"
- },
- "engines": {
- "node": ">=18"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
"node_modules/google-auth-library": {
"version": "11.0.2",
"resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-11.0.2.tgz",
@@ -2922,15 +2738,6 @@
"url": "https://opencollective.com/express"
}
},
- "node_modules/ignore": {
- "version": "7.0.12",
- "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.12.tgz",
- "integrity": "sha512-/8UvqAPU9DGTI9k4mxtf49U37Isfwr8Uts96+SBHIkFxPJnHS0Ew4f00sM4Scd8V8EjM0jUNtVDdv1kPdt35lg==",
- "license": "MIT",
- "engines": {
- "node": ">= 4"
- }
- },
"node_modules/inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
@@ -2967,21 +2774,6 @@
"node": ">=8"
}
},
- "node_modules/is-docker": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz",
- "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==",
- "license": "MIT",
- "bin": {
- "is-docker": "cli.js"
- },
- "engines": {
- "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
"node_modules/is-extglob": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
@@ -3003,24 +2795,6 @@
"node": ">=0.10.0"
}
},
- "node_modules/is-inside-container": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz",
- "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==",
- "license": "MIT",
- "dependencies": {
- "is-docker": "^3.0.0"
- },
- "bin": {
- "is-inside-container": "cli.js"
- },
- "engines": {
- "node": ">=14.16"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
"node_modules/is-number": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
@@ -3030,57 +2804,12 @@
"node": ">=0.12.0"
}
},
- "node_modules/is-path-inside": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-4.0.0.tgz",
- "integrity": "sha512-lJJV/5dYS+RcL8uQdBDW9c9uWFLLBNRyFhnAKXw5tVqLlKZ4RMGZKv+YQ/IA3OhD+RpbJa1LLFM1FQPGyIXvOA==",
- "license": "MIT",
- "engines": {
- "node": ">=12"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
"node_modules/is-promise": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz",
"integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==",
"license": "MIT"
},
- "node_modules/is-stream": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz",
- "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==",
- "license": "MIT",
- "engines": {
- "node": ">=8"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
- "node_modules/is-wsl": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.1.tgz",
- "integrity": "sha512-e6rvdUCiQCAuumZslxRJWR/Doq4VpPR82kqclvcS0efgt430SlGIk05vdCN58+VrzgtIcfNODjozVielycD4Sw==",
- "license": "MIT",
- "dependencies": {
- "is-inside-container": "^1.0.0"
- },
- "engines": {
- "node": ">=16"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
- "node_modules/isexe": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
- "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
- "license": "ISC"
- },
"node_modules/js-tokens": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-10.0.0.tgz",
@@ -3514,46 +3243,6 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
- "node_modules/merge-stream": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
- "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==",
- "license": "MIT"
- },
- "node_modules/merge2": {
- "version": "1.4.1",
- "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
- "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==",
- "license": "MIT",
- "engines": {
- "node": ">= 8"
- }
- },
- "node_modules/micromatch": {
- "version": "4.0.8",
- "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz",
- "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==",
- "license": "MIT",
- "dependencies": {
- "braces": "^3.0.3",
- "picomatch": "^2.3.1"
- },
- "engines": {
- "node": ">=8.6"
- }
- },
- "node_modules/micromatch/node_modules/picomatch": {
- "version": "2.3.2",
- "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz",
- "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==",
- "license": "MIT",
- "engines": {
- "node": ">=8.6"
- },
- "funding": {
- "url": "https://github.com/sponsors/jonschlinkert"
- }
- },
"node_modules/mime-db": {
"version": "1.54.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz",
@@ -3579,50 +3268,6 @@
"url": "https://opencollective.com/express"
}
},
- "node_modules/mimic-fn": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",
- "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",
- "license": "MIT",
- "engines": {
- "node": ">=6"
- }
- },
- "node_modules/mount-point": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/mount-point/-/mount-point-3.0.0.tgz",
- "integrity": "sha512-jAhfD7ZCG+dbESZjcY1SdFVFqSJkh/yGbdsifHcPkvuLRO5ugK0Ssmd9jdATu29BTd4JiN+vkpMzVvsUgP3SZA==",
- "license": "MIT",
- "dependencies": {
- "@sindresorhus/df": "^1.0.1",
- "pify": "^2.3.0",
- "pinkie-promise": "^2.0.1"
- },
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/mount-point/node_modules/@sindresorhus/df": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/@sindresorhus/df/-/df-1.0.1.tgz",
- "integrity": "sha512-1Hyp7NQnD/u4DSxR2DGW78TF9k7R0wZ8ev0BpMAIzA6yTQSHqNb5wTuvtcPYf4FWbVse2rW7RgDsyL8ua2vXHw==",
- "license": "MIT",
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/move-file": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/move-file/-/move-file-4.1.0.tgz",
- "integrity": "sha512-YE06K9XLIvMlqSfoZTl32qvbZLPgL70Za41wS8pEhsSOhy71xz2fn8J07nuz/LEEtPSuUzLUFGAJSx499eKDSw==",
- "license": "MIT",
- "engines": {
- "node": ">=20"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
"node_modules/ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
@@ -3748,18 +3393,6 @@
"node": ">=0.10.0"
}
},
- "node_modules/npm-run-path": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-3.1.0.tgz",
- "integrity": "sha512-Dbl4A/VfiVGLgQv29URL9xshU8XDY1GeLy+fsaZ1AA8JDSfjvr5P5+pzRbWqRSBxk6/DW7MIh8lTM/PaGnP2kg==",
- "license": "MIT",
- "dependencies": {
- "path-key": "^3.0.0"
- },
- "engines": {
- "node": ">=8"
- }
- },
"node_modules/object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
@@ -3825,51 +3458,6 @@
"wrappy": "1"
}
},
- "node_modules/onetime": {
- "version": "5.1.2",
- "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz",
- "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==",
- "license": "MIT",
- "dependencies": {
- "mimic-fn": "^2.1.0"
- },
- "engines": {
- "node": ">=6"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
- "node_modules/os-homedir": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
- "integrity": "sha512-B5JU3cabzk8c67mRRd3ECmROafjYMXbuzlwtqdM8IbS8ktlTix8aFGb2bAGKrSRIlnfKwovGUUr72JUPyOb6kQ==",
- "license": "MIT",
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/p-finally": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-2.0.1.tgz",
- "integrity": "sha512-vpm09aKwq6H9phqRQzecoDpD8TmVyGw70qmWlyq5onxY7tqyTTFVvxMykxQSQKILBSFlbXpypIw2T1Ml7+DDtw==",
- "license": "MIT",
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/p-map": {
- "version": "7.1.1",
- "resolved": "https://registry.npmjs.org/p-map/-/p-map-7.1.1.tgz",
- "integrity": "sha512-6Lh3jQPLthYujSrlw6ccWXBGZTkoTCz27Hd92g79LH/kjAbgoEu0t442cCCNbegPSJsA0lwDX8z0bcKtkpA32g==",
- "license": "MIT",
- "engines": {
- "node": ">=18"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
"node_modules/pac-proxy-agent": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/pac-proxy-agent/-/pac-proxy-agent-7.2.0.tgz",
@@ -3911,15 +3499,6 @@
"node": ">= 0.8"
}
},
- "node_modules/path-key": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
- "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
- "license": "MIT",
- "engines": {
- "node": ">=8"
- }
- },
"node_modules/path-to-regexp": {
"version": "8.4.2",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.4.2.tgz",
@@ -3930,18 +3509,6 @@
"url": "https://opencollective.com/express"
}
},
- "node_modules/path-type": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/path-type/-/path-type-6.0.0.tgz",
- "integrity": "sha512-Vj7sf++t5pBD637NSfkxpHSMfWaeig5+DKWLhcqIYx6mWQz5hdJTGDVMQiJcw1ZYkhs7AazKDGpRVji1LJCZUQ==",
- "license": "MIT",
- "engines": {
- "node": ">=18"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
"node_modules/pg": {
"version": "8.23.1",
"resolved": "https://registry.npmjs.org/pg/-/pg-8.23.1.tgz",
@@ -4064,36 +3631,6 @@
"node": ">=18"
}
},
- "node_modules/pify": {
- "version": "2.3.0",
- "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
- "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==",
- "license": "MIT",
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/pinkie": {
- "version": "2.0.4",
- "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz",
- "integrity": "sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg==",
- "license": "MIT",
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/pinkie-promise": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz",
- "integrity": "sha512-0Gni6D4UcLTbv9c57DfxDGdr41XfgUjqWZu492f0cIGr16zDU06BWP/RAEvOuo7CQ0CNjHaLlM59YJJFm3NWlw==",
- "license": "MIT",
- "dependencies": {
- "pinkie": "^2.0.0"
- },
- "engines": {
- "node": ">=0.10.0"
- }
- },
"node_modules/playwright-core": {
"version": "1.64.1",
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.64.1.tgz",
@@ -4287,18 +3824,6 @@
"node": ">=0.10.0"
}
},
- "node_modules/powershell-utils": {
- "version": "0.2.1",
- "resolved": "https://registry.npmjs.org/powershell-utils/-/powershell-utils-0.2.1.tgz",
- "integrity": "sha512-C+y9x90UElAddDZmV4qOx9W53B61PO7cIqWz2dQsWlwswuq4mr8NEwytdGKboYbQlGZ3awrkTeNvcZiZNHnQ8A==",
- "license": "MIT",
- "engines": {
- "node": ">=20"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
"node_modules/proxy-addr": {
"version": "2.0.8",
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.8.tgz",
@@ -4341,16 +3866,6 @@
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
"license": "MIT"
},
- "node_modules/pump": {
- "version": "3.0.4",
- "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.4.tgz",
- "integrity": "sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA==",
- "license": "MIT",
- "dependencies": {
- "end-of-stream": "^1.1.0",
- "once": "^1.3.1"
- }
- },
"node_modules/qs": {
"version": "6.16.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.16.0.tgz",
@@ -4367,26 +3882,6 @@
"url": "https://github.com/sponsors/ljharb"
}
},
- "node_modules/queue-microtask": {
- "version": "1.2.3",
- "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
- "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==",
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/feross"
- },
- {
- "type": "patreon",
- "url": "https://www.patreon.com/feross"
- },
- {
- "type": "consulting",
- "url": "https://feross.org/support"
- }
- ],
- "license": "MIT"
- },
"node_modules/range-parser": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
@@ -4424,16 +3919,6 @@
"url": "https://paulmillr.com/funding/"
}
},
- "node_modules/reusify": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz",
- "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==",
- "license": "MIT",
- "engines": {
- "iojs": ">=1.0.0",
- "node": ">=0.10.0"
- }
- },
"node_modules/rolldown": {
"version": "1.2.14",
"resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.14.tgz",
@@ -4485,29 +3970,6 @@
"node": ">= 18"
}
},
- "node_modules/run-parallel": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz",
- "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==",
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/feross"
- },
- {
- "type": "patreon",
- "url": "https://www.patreon.com/feross"
- },
- {
- "type": "consulting",
- "url": "https://feross.org/support"
- }
- ],
- "license": "MIT",
- "dependencies": {
- "queue-microtask": "^1.2.2"
- }
- },
"node_modules/run-series": {
"version": "1.1.9",
"resolved": "https://registry.npmjs.org/run-series/-/run-series-1.1.9.tgz",
@@ -4666,27 +4128,6 @@
}
}
},
- "node_modules/shebang-command": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
- "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
- "license": "MIT",
- "dependencies": {
- "shebang-regex": "^3.0.0"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/shebang-regex": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
- "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
- "license": "MIT",
- "engines": {
- "node": ">=8"
- }
- },
"node_modules/side-channel": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.1.tgz",
@@ -4759,24 +4200,6 @@
"url": "https://github.com/sponsors/ljharb"
}
},
- "node_modules/signal-exit": {
- "version": "3.0.7",
- "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
- "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
- "license": "ISC"
- },
- "node_modules/slash": {
- "version": "5.1.0",
- "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz",
- "integrity": "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==",
- "license": "MIT",
- "engines": {
- "node": ">=14.16"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
"node_modules/smart-buffer": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",
@@ -4958,15 +4381,6 @@
"dev": true,
"license": "MIT"
},
- "node_modules/strip-final-newline": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz",
- "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==",
- "license": "MIT",
- "engines": {
- "node": ">=6"
- }
- },
"node_modules/supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
@@ -5053,29 +4467,6 @@
"node": ">=0.6"
}
},
- "node_modules/trash": {
- "version": "10.1.1",
- "resolved": "https://registry.npmjs.org/trash/-/trash-10.1.1.tgz",
- "integrity": "sha512-L/mu8sfblMwaS+exj1MxpmihlIRwVQyB6ieKuTTmBJG0lXWBPfx3pMGQG8i3NT/S8vvNZrflDUOp+j0o7Cnxzw==",
- "license": "MIT",
- "dependencies": {
- "@stroncium/procfs": "^1.2.1",
- "chunkify": "^5.0.0",
- "globby": "^14.1.0",
- "is-path-inside": "^4.0.0",
- "move-file": "^4.1.0",
- "p-map": "^7.0.3",
- "powershell-utils": "^0.2.0",
- "wsl-utils": "^0.4.0",
- "xdg-trashdir": "^3.1.0"
- },
- "engines": {
- "node": ">=20"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
"node_modules/tslib": {
"version": "2.8.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
@@ -5142,18 +4533,6 @@
"integrity": "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==",
"license": "MIT"
},
- "node_modules/unicorn-magic": {
- "version": "0.3.0",
- "resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.3.0.tgz",
- "integrity": "sha512-+QBBXBCvifc56fsbuxZQ6Sic3wqqc3WWaqxs58gvJrcOuN83HGTCwz3oS5phzU9LthRNE9VrJCFCLUgHeeFnfA==",
- "license": "MIT",
- "engines": {
- "node": ">=18"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
"node_modules/unpipe": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
@@ -5169,18 +4548,6 @@
"integrity": "sha512-XdVKMF4SJ0nP/O7XIPB0JwAEuT9lDIYnNsK8yGVe43y0AWoKeJNdv3ZNWh7ksJ6KqQFjOO6ox/VEitLnaVNufw==",
"license": "BSD"
},
- "node_modules/user-home": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/user-home/-/user-home-2.0.0.tgz",
- "integrity": "sha512-KMWqdlOcjCYdtIJpicDSFBQ8nFwS2i9sslAd6f4+CBGcU4gist2REnr2fxj2YocvJFxSF3ZOHLYLVZnUxv4BZQ==",
- "license": "MIT",
- "dependencies": {
- "os-homedir": "^1.0.0"
- },
- "engines": {
- "node": ">=0.10.0"
- }
- },
"node_modules/vary": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
@@ -5361,21 +4728,6 @@
"node": ">= 8"
}
},
- "node_modules/which": {
- "version": "2.0.2",
- "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
- "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
- "license": "ISC",
- "dependencies": {
- "isexe": "^2.0.0"
- },
- "bin": {
- "node-which": "bin/node-which"
- },
- "engines": {
- "node": ">= 8"
- }
- },
"node_modules/why-is-node-running": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-3.2.1.tgz",
@@ -5416,58 +4768,6 @@
}
}
},
- "node_modules/wsl-utils": {
- "version": "0.4.0",
- "resolved": "https://registry.npmjs.org/wsl-utils/-/wsl-utils-0.4.0.tgz",
- "integrity": "sha512-9YmF+2sFEd+T7TkwlmE337F0IVzfDvDknhtpBQxxXzEOfgPphGlFYpyx0cTuCIFj8/p+sqwBYAeGxOMNSzPPDA==",
- "license": "MIT",
- "dependencies": {
- "is-wsl": "^3.1.0",
- "powershell-utils": "^0.1.0"
- },
- "engines": {
- "node": ">=20"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
- "node_modules/wsl-utils/node_modules/powershell-utils": {
- "version": "0.1.0",
- "resolved": "https://registry.npmjs.org/powershell-utils/-/powershell-utils-0.1.0.tgz",
- "integrity": "sha512-dM0jVuXJPsDN6DvRpea484tCUaMiXWjuCn++HGTqUWzGDjv5tZkEZldAJ/UMlqRYGFrD/etByo4/xOuC/snX2A==",
- "license": "MIT",
- "engines": {
- "node": ">=20"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
- "node_modules/xdg-basedir": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz",
- "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==",
- "license": "MIT",
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/xdg-trashdir": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/xdg-trashdir/-/xdg-trashdir-3.1.0.tgz",
- "integrity": "sha512-N1XQngeqMBoj9wM4ZFadVV2MymImeiFfYD+fJrNlcVcOHsJFFQe7n3b+aBoTPwARuq2HQxukfzVpQmAk1gN4sQ==",
- "license": "MIT",
- "dependencies": {
- "@sindresorhus/df": "^3.1.1",
- "mount-point": "^3.0.0",
- "user-home": "^2.0.0",
- "xdg-basedir": "^4.0.0"
- },
- "engines": {
- "node": ">=10"
- }
- },
"node_modules/xmlhttprequest-ssl": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.1.2.tgz",
diff --git a/server/package.json b/server/package.json
index bcb54f8c15..448ea0e989 100644
--- a/server/package.json
+++ b/server/package.json
@@ -37,7 +37,6 @@
"socket.io": "4.8.4",
"socket.io-client": "4.8.4",
"three": "0.186.1",
- "trash": "10.1.1",
"undici": "8.12.1",
"ws": "8.22.0",
"zod": "4.6.7"