diff --git a/.github/workflows/ide-bench.yml b/.github/workflows/ide-bench.yml index 679020603..66dc48d56 100644 --- a/.github/workflows/ide-bench.yml +++ b/.github/workflows/ide-bench.yml @@ -18,6 +18,8 @@ on: - '.github/workflows/ide-bench.yml' - 'apps/ide/scripts/bench.mjs' - 'apps/ide/scripts/benchSizes.mjs' + - 'apps/ide/scripts/tauri.mjs' + - 'apps/ide/src-tauri/**' push: branches: - 'claude/project-thread-urap9o' @@ -25,6 +27,8 @@ on: - '.github/workflows/ide-bench.yml' - 'apps/ide/scripts/bench.mjs' - 'apps/ide/scripts/benchSizes.mjs' + - 'apps/ide/scripts/tauri.mjs' + - 'apps/ide/src-tauri/**' permissions: contents: read @@ -73,9 +77,12 @@ jobs: run: node apps/ide/scripts/benchSizes.mjs --label=electron --out=apps/ide/bench-sizes-electron-${{ runner.os }}.json # Same build, run from the workspace (the packaged app adds nothing the bench measures). + # Both shells run in a session bus of their own, as on a desktop: the runner's systemd + # user bus activates portals that cannot reach the virtual display, and GTK (Tauri) + # waits 25 s + 2 x 5 s on them at start-up (measured, #480); Electron is unaffected. - name: Bench (Linux, virtual display) if: runner.os == 'Linux' - run: xvfb-run -a -s "-screen 0 1920x1080x24" node apps/ide/scripts/bench.mjs --runs=6 --idle-seconds=20 --out=apps/ide/bench-electron-${{ runner.os }}.json + run: xvfb-run -a -s "-screen 0 1920x1080x24" dbus-run-session -- node apps/ide/scripts/bench.mjs --runs=6 --idle-seconds=20 --out=apps/ide/bench-electron-${{ runner.os }}.json - name: Bench if: runner.os != 'Linux' @@ -100,3 +107,80 @@ jobs: name: ide-bench-electron-${{ runner.os }} if-no-files-found: warn path: apps/ide/bench-*.json + + # The same bench on the Tauri build (epic #477). Until R12 bundles a Node runtime, the + # sidecar runs on the runner's Node (CODEXR_NODE); sizes come with the Tauri bundler (R12). + tauri: + name: tauri (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [windows-latest, ubuntu-latest, macos-latest] + env: + CARGO_TERM_COLOR: never + ELECTRON_SKIP_BINARY_DOWNLOAD: '1' + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version-file: .nvmrc + cache: npm + + - name: Install + run: npm ci + + - name: Tauri system libraries (Linux) + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y libwebkit2gtk-4.1-dev libxdo-dev libssl-dev libayatana-appindicator3-dev librsvg2-dev + + # As for the Electron job: Ubuntu 24.04 restricts unprivileged user namespaces, which + # WebKitGTK's bubblewrap sandbox needs too (desktop Ubuntu ships an AppArmor profile for it). + # Without this the first page load stalls ~35 s on the runner. + - name: Allow the web sandbox (Linux) + if: runner.os == 'Linux' + run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 + + - name: Rust toolchain + run: rustup toolchain install stable --profile minimal && rustup default stable + + - name: Build (web, sidecar, bridge, Rust core) + run: npm run tauri:build --workspace=code-xr-ide + + - name: Bench (Linux, virtual display) + if: runner.os == 'Linux' + shell: bash + run: CODEXR_NODE="$(node -p process.execPath)" xvfb-run -a -s "-screen 0 1920x1080x24" dbus-run-session -- node apps/ide/scripts/bench.mjs --label=tauri --runs=6 --idle-seconds=20 --out=apps/ide/bench-tauri-${{ runner.os }}.json -- apps/ide/src-tauri/target/release/codexr-ide + + - name: Bench + if: runner.os != 'Linux' + shell: bash + run: | + exe=apps/ide/src-tauri/target/release/codexr-ide + if [ "$RUNNER_OS" = "Windows" ]; then exe="$exe.exe"; fi + CODEXR_NODE="$(node -p process.execPath)" node apps/ide/scripts/bench.mjs --label=tauri --runs=6 --idle-seconds=20 --out=apps/ide/bench-tauri-${{ runner.os }}.json -- "$exe" + + - name: Summary + if: always() + shell: bash + run: | + { + echo "### Tauri on ${{ runner.os }}" + echo '```json' + node -e "const r=require('./apps/ide/bench-tauri-${{ runner.os }}.json');console.log(JSON.stringify({first:r.first,median:r.median},null,2))" || true + echo '```' + } >> "$GITHUB_STEP_SUMMARY" + node -e "const r=require('./apps/ide/bench-tauri-${{ runner.os }}.json');console.log(JSON.stringify({first:r.first,median:r.median,byProcess:r.results.at(-1).byProcess},null,2))" || true + + - name: Keep the numbers + if: always() + uses: actions/upload-artifact@v4 + with: + name: ide-bench-tauri-${{ runner.os }} + if-no-files-found: warn + path: apps/ide/bench-*.json diff --git a/apps/ide/README.md b/apps/ide/README.md index fc99ec634..a1774a832 100644 --- a/apps/ide/README.md +++ b/apps/ide/README.md @@ -15,6 +15,7 @@ Run them from the repository root after `npm ci`: | `npm run ide:start` | Build, then run the built IDE (no dev server). | | `npm run ide:smoke` | Build, launch the IDE hidden with `--codexr-smoke`, probe the security baseline from inside the real renderer, open a terminal with the default profile and read back the output of `echo codexr-smoke`, exit 0 or 1. On Linux without a display use `xvfb-run -a npm run ide:smoke`. | | `npm run ide:test` | Typecheck (Node and web targets separately), lint with zero warnings, unit tests. Part of the root `npm test`. | +| `npm run tauri:start --workspace=code-xr-ide -- --folder=` | The Tauri 2 build (epic #477, walking skeleton): web build, Node sidecar and bridge into `out/`, `cargo build --release` in `src-tauri/`, then run it (arguments after `--` go to the app). `tauri:build` only builds, `tauri:run` runs the last build. Needs Rust and Tauri's system libraries; the sidecar runs on `CODEXR_NODE` (default: the Node running the script). See [`docs/ide/tauri-migration.md`](../../docs/ide/tauri-migration.md#walking-skeleton). | | `npm run dist --workspace=code-xr-ide` | Build the installers for the OS it runs on into `apps/ide/release/` (#20): AppImage and `.deb` on Linux, an NSIS `.exe` on Windows, a `.dmg` on macOS. See [Installers](#installers-20). | ## Layout @@ -22,13 +23,17 @@ Run them from the repository root after `npm ci`: ``` apps/ide/ ├── src/ -│ ├── main/ Electron main process (Node): window, menu, IPC handlers, app protocol, hardening -│ ├── preload/ the only bridge to the renderer: exposes window.codexr +│ ├── main/ Electron main process (Node): window, menu, IPC handlers, app protocol, hardening; +│ │ boot.ts is the boot sequence both shells share, host/desktop.ts the desktop seam +│ ├── preload/ the only bridge to the renderer: exposes window.codexr (built by codexrApi.ts) +│ ├── bridge/ the Tauri build's window.codexr (the same object over Tauri's invoke) +│ ├── sidecar/ the Tauri build's Node sidecar: main's services, desktop answered by the Rust core │ ├── renderer/ the workbench UI (browser code, no Node, no Electron) │ │ └── public/file-icons/ bundled SVG icons (#138), published with the renderer │ └── shared/ the renderer <-> main contract (api.ts), imported by all three ├── test/ unit tests (node:test, TypeScript run by Node's type stripping) -├── scripts/ build, dev, start and smoke runners (Vite's JS API), syncFileIcons.mjs +├── src-tauri/ the Tauri 2 shell (Rust core) of the walking skeleton (#480-#482) +├── scripts/ build, dev, start and smoke runners (Vite's JS API), syncFileIcons.mjs, tauri.mjs ├── THIRD_PARTY_NOTICES.md licences of bundled third-party material └── out/ build output, git-ignored: main/index.cjs, preload/index.cjs, renderer/ ``` @@ -374,8 +379,8 @@ The parsers (`statusParser.ts`, `blameParser.ts`) are pure and unit-tested on st ### Adding a capability to the renderer 1. Add the method to `CodeXRApi` and a channel to `IPC_CHANNELS` (`src/shared/api.ts`). -2. Expose it in `src/preload/index.ts`, one member per channel. Never expose `ipcRenderer` or a generic `invoke`. -3. Register the handler in `src/main/ipc.ts` through `handle()`, which already rejects untrusted frames. Validate every argument: the renderer is untrusted. +2. Expose it in `src/preload/codexrApi.ts` (shared by the Electron preload and the Tauri bridge), one member per channel. Never expose `ipcRenderer` or a generic `invoke`. +3. Register the handler in `src/main/ipc.ts` through `handle()`, which already rejects untrusted frames. Import Electron only through `src/main/host/desktop.ts`, and add what you use to `src/sidecar/tauriHost.ts` too. Validate every argument: the renderer is untrusted. 4. Add a unit test for any pure logic, and extend the smoke probe if the capability is security-relevant. ## Agent-first workbench (epic #265) diff --git a/apps/ide/electron-builder.config.cjs b/apps/ide/electron-builder.config.cjs index 2ca32141b..57ea0ccd5 100644 --- a/apps/ide/electron-builder.config.cjs +++ b/apps/ide/electron-builder.config.cjs @@ -37,7 +37,8 @@ module.exports = { directories: { output: 'release', buildResources: 'build-resources' }, // No space in a file name (productName has one): easier to download and script. artifactName: 'Code-XR-IDE-${version}-${arch}.${ext}', - files: ['out/**/*', 'package.json', 'THIRD_PARTY_NOTICES.md', '!**/*.map'], + // The Tauri build's sidecar and bridge (scripts/tauri.mjs) are not part of the Electron app. + files: ['out/**/*', '!out/sidecar/**', '!out/bridge/**', 'package.json', 'THIRD_PARTY_NOTICES.md', '!**/*.map'], asarUnpack: [ '**/node_modules/node-pty/**', '**/node_modules/typescript-language-server/**', diff --git a/apps/ide/eslint.config.mjs b/apps/ide/eslint.config.mjs index c4d1c033e..470affa48 100644 --- a/apps/ide/eslint.config.mjs +++ b/apps/ide/eslint.config.mjs @@ -60,7 +60,23 @@ export default [ }, }, { - files: ['src/main/**/*.ts', 'test/**/*.ts'], + // #481: the Tauri bridge is the preload of the Tauri build: a browser script, src/shared and the API builder only. + files: ['src/bridge/**/*.ts'], + languageOptions: { globals: globals.browser }, + rules: { + 'no-restricted-imports': ['error', { patterns: [{ group: ['electron', 'electron/*', 'node:*', '../main/*', '../sidecar/*', '@codexr/core/*', '@codexr/logging/*'], message: 'The bridge runs in the page: it may only use src/shared and src/preload/codexrApi.ts.' }] }], + }, + }, + { + // #483: the scene view's bridge in the Tauri build runs in an analysis page: src/shared only. + files: ['src/sceneBridge/**/*.ts'], + languageOptions: { globals: globals.browser }, + rules: { + 'no-restricted-imports': ['error', { patterns: [{ group: ['electron', 'electron/*', 'node:*', '../main/*', '../sidecar/*', '../preload/*', '../renderer/*', '@codexr/core/*', '@codexr/logging/*'], message: 'The scene bridge runs in an analysis page: it may only use src/shared.' }] }], + }, + }, + { + files: ['src/main/**/*.ts', 'src/sidecar/**/*.ts', 'test/**/*.ts'], languageOptions: { globals: globals.node }, }, { diff --git a/apps/ide/package.json b/apps/ide/package.json index 16fff7603..c01ff535f 100644 --- a/apps/ide/package.json +++ b/apps/ide/package.json @@ -11,6 +11,9 @@ "build": "node scripts/build.mjs", "start": "node scripts/build.mjs && node scripts/start.mjs", "smoke": "node scripts/build.mjs && node scripts/smoke.mjs", + "tauri:build": "node scripts/tauri.mjs build", + "tauri:start": "node scripts/tauri.mjs start", + "tauri:run": "node scripts/tauri.mjs run", "dist": "npm run compile --workspace=code-xr && node scripts/build.mjs && node ../../node_modules/electron-builder/cli.js --config electron-builder.config.cjs --publish never", "typecheck": "node scripts/coreTypes.mjs && node ../../node_modules/typescript/bin/tsc -p tsconfig.node.json && node ../../node_modules/typescript/bin/tsc -p tsconfig.web.json", "lint": "node ../../node_modules/eslint/bin/eslint.js src test scripts eslint.config.mjs --max-warnings 0", diff --git a/apps/ide/scripts/bench.mjs b/apps/ide/scripts/bench.mjs index 69637bb43..f71415add 100644 --- a/apps/ide/scripts/bench.mjs +++ b/apps/ide/scripts/bench.mjs @@ -2,7 +2,7 @@ // so the same numbers can be taken for any desktop shell (Electron today, the next one after). // // Usage: -// node scripts/bench.mjs [--runs=5] [--idle-seconds=20] [--folder=] [--out=] [--label=] -- [args...] +// node scripts/bench.mjs [--runs=5] [--idle-seconds=20] [--folder=] [--out=] [--label=] [--trace-first] -- [args...] // With no command it launches the built Electron IDE (npm run build first). // // One run: spawn the app with --codexr-bench --folder=; the renderer's driver @@ -25,6 +25,7 @@ import { IDE_ROOT } from './viteConfigs.mjs'; const RESULT_PREFIX = 'CODEXR_BENCH_RESULT '; const READY_TIMEOUT_MS = 180_000; const SETTLE_MS = 5_000; +const STDERR_TAIL_LINES = 60; const argv = process.argv.slice(2); const separator = argv.indexOf('--'); @@ -35,7 +36,13 @@ const runs = Number(options.runs ?? 5); const idleSeconds = Number(options['idle-seconds'] ?? 20); const folder = path.resolve(options.folder ?? path.join(IDE_ROOT, '..', '..')); const label = options.label ?? 'electron'; +// --trace-first: the first run's stderr, each line with its time since launch (where a slow start goes). +const traceFirst = options['trace-first'] !== undefined; let command = separator === -1 ? [] : argv.slice(separator + 1); +// A relative path to the app (a CI build) is resolved here: Windows cannot spawn one with forward slashes. +if (command.length > 0 && /[\\/]/.test(command[0]) && fs.existsSync(command[0])) { + command[0] = path.resolve(command[0]); +} if (command.length === 0) { const { electronBinary, launchFlags } = await import('./electronBinary.mjs'); command = [electronBinary(), ...launchFlags(), IDE_ROOT]; @@ -134,6 +141,9 @@ async function oneRun(index) { env: { ...process.env, CODEXR_IDE_DEV_SERVER_URL: '' }, }); let stdout = ''; + // The app's last stderr lines, printed when a run fails (a CI log is the only place they show). + const stderrTail = []; + let stderrPartial = ''; const report = await new Promise((resolve, reject) => { const timer = setTimeout(() => reject(new Error(`no ${RESULT_PREFIX.trim()} after ${READY_TIMEOUT_MS / 1000}s`)), READY_TIMEOUT_MS); child.stdout.on('data', (chunk) => { @@ -144,8 +154,32 @@ async function oneRun(index) { resolve(JSON.parse(line.slice(RESULT_PREFIX.length))); } }); - child.stderr.on('data', () => { /* drained so the app never blocks on a full pipe */ }); - child.on('exit', (code) => { clearTimeout(timer); reject(new Error(`the app exited with ${code} before reporting`)); }); + // Drained so the app never blocks on a full pipe; the last lines are kept. + child.stderr.on('data', (chunk) => { + const lines = (stderrPartial + chunk).split(/\r?\n/); + stderrPartial = lines.pop() ?? ''; + if (traceFirst && index === 0) { + const at = Math.round(performance.now() - started); + for (const line of lines) { + if (line.trim() !== '') { + console.error(`[bench] +${at} ms ${line}`); + } + } + } + stderrTail.push(...lines); + stderrTail.splice(0, Math.max(0, stderrTail.length - STDERR_TAIL_LINES)); + }); + // A moment for the pipes to deliver the last lines before failing. + child.on('exit', (code) => { clearTimeout(timer); setTimeout(() => reject(new Error(`the app exited with ${code} before reporting`)), 300); }); + }).catch((error) => { + killTree(child); + const tail = [...stderrTail, stderrPartial].filter((line) => line.trim() !== ''); + console.error(`[bench] run ${index} failed: ${error.message}. The app's last ${tail.length} stderr lines:\n${tail.join('\n')}`); + const out = stdout.trim(); + if (out) { + console.error(`[bench] its stdout:\n${out.split(/\r?\n/).slice(-20).join('\n')}`); + } + throw error; }); const readyMs = performance.now() - started; const startupCpuMs = sum(treeOf(child.pid, preexisting), 'cpuMs'); diff --git a/apps/ide/scripts/tauri.mjs b/apps/ide/scripts/tauri.mjs new file mode 100644 index 000000000..b11f05f19 --- /dev/null +++ b/apps/ide/scripts/tauri.mjs @@ -0,0 +1,155 @@ +// The Tauri build of the IDE (#480-#482, epic #477), beside the Electron one. +// +// node scripts/tauri.mjs build web build (scripts/build.mjs) + the Node sidecar + the +// bridges into out/, then `cargo build --release` in src-tauri +// node scripts/tauri.mjs start [-- args] build, then run the Tauri app (args go to the app, e.g. --folder=) +// node scripts/tauri.mjs run [-- args] run the last build +// +// The Rust core starts the sidecar on CODEXR_NODE (default: the Node running +// this script); packaging a Node runtime as externalBin is R12. +import { spawn, spawnSync } from 'node:child_process'; +import fs from 'node:fs'; +import os from 'node:os'; +import path from 'node:path'; +import zlib from 'node:zlib'; +import { fileURLToPath } from 'node:url'; +import { build } from 'vite'; +import { IDE_ROOT, bridgeConfig, nodeTargetConfig, sceneBridgeConfig } from './viteConfigs.mjs'; + +export const TAURI_DIR = path.join(IDE_ROOT, 'src-tauri'); +export const TAURI_BINARY = path.join(TAURI_DIR, 'target', 'release', process.platform === 'win32' ? 'codexr-ide.exe' : 'codexr-ide'); + +function cargoCommand() { + const home = path.join(os.homedir(), '.cargo', 'bin', process.platform === 'win32' ? 'cargo.exe' : 'cargo'); + return fs.existsSync(home) ? home : 'cargo'; +} + +// -- Build-time icons ---------------------------------------------------------- +// tauri-build wants an RGBA icon (and a .ico on Windows) for the binary; they +// are generated here, git-ignored, so no binary is committed. The window shows +// the real Code-XR logo, loaded at run time (src-tauri/src/host.rs). The +// installers' icons come with packaging (R12). + +function crc32(buffer) { + let crc = -1; + for (const byte of buffer) { + crc ^= byte; + for (let k = 0; k < 8; k += 1) { + crc = (crc >>> 1) ^ (0xedb88320 & -(crc & 1)); + } + } + return (crc ^ -1) >>> 0; +} + +function pngChunk(type, data) { + const length = Buffer.alloc(4); + length.writeUInt32BE(data.length); + const body = Buffer.concat([Buffer.from(type, 'ascii'), data]); + const crc = Buffer.alloc(4); + crc.writeUInt32BE(crc32(body)); + return Buffer.concat([length, body, crc]); +} + +function makePng(size) { + const header = Buffer.alloc(13); + header.writeUInt32BE(size, 0); + header.writeUInt32BE(size, 4); + header[8] = 8; // bit depth + header[9] = 6; // RGBA + const raw = Buffer.alloc((size * 4 + 1) * size); + for (let y = 0; y < size; y += 1) { + for (let x = 0; x < size; x += 1) { + raw.set([0x2b, 0x4a, 0x6b, 0xff], y * (size * 4 + 1) + 1 + x * 4); + } + } + return Buffer.concat([ + Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]), + pngChunk('IHDR', header), + pngChunk('IDAT', zlib.deflateSync(raw)), + pngChunk('IEND', Buffer.alloc(0)), + ]); +} + +function makeIco(png, size) { + const header = Buffer.alloc(22); + header.writeUInt16LE(1, 2); // icon + header.writeUInt16LE(1, 4); // one image + header[6] = size; + header[7] = size; + header.writeUInt16LE(1, 10); // planes + header.writeUInt16LE(32, 12); // bits per pixel + header.writeUInt32LE(png.length, 14); + header.writeUInt32LE(22, 18); + return Buffer.concat([header, png]); +} + +function writeIcons() { + const dir = path.join(TAURI_DIR, 'icons'); + fs.mkdirSync(dir, { recursive: true }); + const png = makePng(32); + fs.writeFileSync(path.join(dir, 'icon.png'), png); + fs.writeFileSync(path.join(dir, 'icon.ico'), makeIco(png, 32)); +} + +// -- Build and run --------------------------------------------------------------- + +/** + * The sidecar must hold one copy of the Tauri host: two (the seam and a direct + * import resolving to different ids) split its IPC handler map and its core + * connection, and every window.codexr call fails. It happened on Windows. + */ +function assertOneTauriHost(bundle) { + const copies = fs.readFileSync(bundle, 'utf8').split('No handler registered for').length - 1; + if (copies !== 1) { + throw new Error(`The sidecar bundle holds ${copies} copies of src/sidecar/tauriHost.ts, not one: check the desktop seam alias in scripts/viteConfigs.mjs.`); + } +} + +export async function buildTauri() { + // The web build is the Electron one (renderer, extension host, MCP, local agent...). + const web = spawnSync(process.execPath, [path.join(IDE_ROOT, 'scripts', 'build.mjs')], { stdio: 'inherit' }); + if (web.status !== 0) { + throw new Error(`scripts/build.mjs failed (${web.status})`); + } + await build(nodeTargetConfig('sidecar')); + assertOneTauriHost(path.join(IDE_ROOT, 'out', 'sidecar', 'index.cjs')); + await build(bridgeConfig()); + await build(sceneBridgeConfig()); + writeIcons(); + const locked = fs.existsSync(path.join(TAURI_DIR, 'Cargo.lock')) ? ['--locked'] : []; + const cargo = spawnSync(cargoCommand(), ['build', '--release', ...locked], { cwd: TAURI_DIR, stdio: 'inherit' }); + if (cargo.status !== 0) { + throw new Error(`cargo build failed (${cargo.status})`); + } + console.log(`[code-xr-ide] Tauri build: ${path.relative(process.cwd(), TAURI_BINARY)} (sidecar in out/sidecar, bridges in out/bridge and out/sceneBridge)`); +} + +export function runTauri(args) { + if (!fs.existsSync(TAURI_BINARY)) { + throw new Error(`No Tauri build at ${TAURI_BINARY}: run \`npm run tauri:build\` first.`); + } + const child = spawn(TAURI_BINARY, args, { + stdio: 'inherit', + env: { ...process.env, CODEXR_NODE: process.env.CODEXR_NODE || process.execPath }, + }); + child.on('exit', (code, signal) => process.exit(code ?? (signal ? 1 : 0))); +} + +// fileURLToPath, not URL.pathname: on Windows the latter is /D:/... and never matches argv[1]. +if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) { + const [command = 'build', ...rest] = process.argv.slice(2); + const appArgs = rest[0] === '--' ? rest.slice(1) : rest; + try { + if (command === 'build' || command === 'start') { + await buildTauri(); + } + if (command === 'start' || command === 'run') { + runTauri(appArgs); + } else if (command !== 'build') { + throw new Error(`Unknown command ${command}: build, start or run.`); + } + } catch (error) { + console.error(`[code-xr-ide] ${error instanceof Error ? error.message : String(error)}`); + process.exit(1); + } +} diff --git a/apps/ide/scripts/viteConfigs.mjs b/apps/ide/scripts/viteConfigs.mjs index 4d47e8254..9851fbb07 100644 --- a/apps/ide/scripts/viteConfigs.mjs +++ b/apps/ide/scripts/viteConfigs.mjs @@ -8,9 +8,16 @@ // a separate process run with ELECTRON_RUN_AS_NODE) // out/extensionHost/index.cjs extension host (#259: a Node child process on Electron's own Node) // out/localAgent/index.cjs the local-model ACP agent (#312: a child process per chat, ELECTRON_RUN_AS_NODE) +// +// The Tauri build (#480-#483, scripts/tauri.mjs) adds three more: +// out/sidecar/index.cjs the Node sidecar: the main process's services on plain Node, +// with src/main/host/desktop.ts swapped for src/sidecar/tauriHost.ts +// out/bridge/index.js window.codexr for the Tauri webview (an IIFE the Rust core injects) +// out/sceneBridge/index.js CodeXRHostBridge for the Tauri scene view (an IIFE the Rust core injects) import { builtinModules } from 'node:module'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; +import { normalizePath } from 'vite'; export const IDE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..'); export const OUT_DIR = path.join(IDE_ROOT, 'out'); @@ -24,7 +31,8 @@ export const LOGGING_SRC = path.resolve(IDE_ROOT, '..', 'vscode-extension', 'src /** #311: local models (presets, discovery, agent loop), shared with the VS Code extension. Pure TypeScript, bundled from source. */ export const LOCAL_MODELS_SRC = path.resolve(IDE_ROOT, '..', '..', 'packages', 'local-models', 'src'); -const NODE_EXTERNALS = ['electron', /^electron\//, ...builtinModules, ...builtinModules.map((m) => `node:${m}`)]; +const BUILTIN_EXTERNALS = [...builtinModules, ...builtinModules.map((m) => `node:${m}`)]; +const NODE_EXTERNALS = ['electron', /^electron\//, ...BUILTIN_EXTERNALS]; /** * Native modules cannot be bundled: they load their compiled `.node` file * from their own package folder at run time. node-pty (#137, the terminal) @@ -33,7 +41,35 @@ const NODE_EXTERNALS = ['electron', /^electron\//, ...builtinModules, ...builtin */ const MAIN_NATIVE_EXTERNALS = ['node-pty']; -/** @param {'main' | 'preload' | 'scenePreload' | 'codexrMcp' | 'extensionHost' | 'localAgent'} target @param {{ dev?: boolean }} [opts] */ +/** #482: the seam the sidecar build swaps (see src/main/host/desktop.ts). */ +const DESKTOP_SEAM = path.join(IDE_ROOT, 'src', 'main', 'host', 'desktop.ts'); +// Vite's own spelling of the id (forward slashes): with Windows backslashes the seam and +// the sidecar's `./tauriHost.ts` were two modules, so ipc.ts registered its handlers in a +// second copy whose map nobody read ("No handler registered", Windows only). +const TAURI_HOST = normalizePath(path.join(IDE_ROOT, 'src', 'sidecar', 'tauriHost.ts')); + +/** + * The sidecar's resolver: the desktop seam resolves to the Tauri host, and a + * direct `electron` import anywhere in the bundle fails the build (it would + * bundle the npm package's path stub and break at run time). + */ +function tauriSeamPlugin() { + return { + name: 'codexr-tauri-desktop-seam', + enforce: 'pre', + resolveId(source, importer) { + if (source === 'electron' || source.startsWith('electron/')) { + throw new Error(`The sidecar cannot import ${source} (from ${importer}): import src/main/host/desktop.ts instead.`); + } + if (importer && source.endsWith('host/desktop.ts') && path.resolve(path.dirname(importer), source) === DESKTOP_SEAM) { + return TAURI_HOST; + } + return null; + }, + }; +} + +/** @param {'main' | 'preload' | 'scenePreload' | 'codexrMcp' | 'extensionHost' | 'localAgent' | 'sidecar'} target @param {{ dev?: boolean }} [opts] */ export function nodeTargetConfig(target, opts = {}) { return { configFile: false, @@ -51,15 +87,58 @@ export function nodeTargetConfig(target, opts = {}) { // A sandboxed preload cannot load local files: everything but // electron itself must be bundled in. The main process follows // the same rule so out/ is self-contained, native modules aside. - external: target === 'main' ? [...NODE_EXTERNALS, ...MAIN_NATIVE_EXTERNALS] : NODE_EXTERNALS, + external: target === 'main' ? [...NODE_EXTERNALS, ...MAIN_NATIVE_EXTERNALS] + // #482: no electron in the sidecar, not even as an external (tauriSeamPlugin rejects it). + : target === 'sidecar' ? [...BUILTIN_EXTERNALS, ...MAIN_NATIVE_EXTERNALS] : NODE_EXTERNALS, output: { format: 'cjs', entryFileNames: 'index.cjs' }, }, }, ssr: { noExternal: true }, + plugins: target === 'sidecar' ? [tauriSeamPlugin()] : [], resolve: { alias: [{ find: /^@codexr\/core\//, replacement: `${CORE_SRC}/` }, { find: /^@codexr\/logging\//, replacement: `${LOGGING_SRC}/` }, { find: /^@codexr\/local-models\//, replacement: `${LOCAL_MODELS_SRC}/` }] }, }; } +/** + * #481: the Tauri bridge, one IIFE with no exports, injected by the Rust core + * before the page's scripts. WebKit (macOS, Linux) runs it too: ES2022. + * @param {{ dev?: boolean }} [opts] + */ +export function bridgeConfig(opts = {}) { + return { + configFile: false, + root: IDE_ROOT, + logLevel: 'warn', + mode: opts.dev ? 'development' : 'production', + build: { + outDir: path.join(OUT_DIR, 'bridge'), + emptyOutDir: true, + target: 'es2022', + minify: false, + sourcemap: false, + lib: { entry: path.join(IDE_ROOT, 'src', 'bridge', 'index.ts'), formats: ['iife'], name: 'codexrBridge', fileName: () => 'index.js' }, + }, + }; +} + +/** + * #483: the scene view's bridge in the Tauri build, one IIFE with no exports, + * injected by the Rust core into the scene webview before the analysis page's + * scripts. The three engines run it: ES2022. + * @param {{ dev?: boolean }} [opts] + */ +export function sceneBridgeConfig(opts = {}) { + const config = bridgeConfig(opts); + return { + ...config, + build: { + ...config.build, + outDir: path.join(OUT_DIR, 'sceneBridge'), + lib: { entry: path.join(IDE_ROOT, 'src', 'sceneBridge', 'index.ts'), formats: ['iife'], name: 'codexrSceneBridge', fileName: () => 'index.js' }, + }, + }; +} + /** @param {{ dev?: boolean }} [opts] */ export function rendererConfig(opts = {}) { return { diff --git a/apps/ide/src-tauri/.gitignore b/apps/ide/src-tauri/.gitignore new file mode 100644 index 000000000..ec87f1e40 --- /dev/null +++ b/apps/ide/src-tauri/.gitignore @@ -0,0 +1,4 @@ +target/ +gen/ +icons/ +permissions/autogenerated/ diff --git a/apps/ide/src-tauri/Cargo.lock b/apps/ide/src-tauri/Cargo.lock new file mode 100644 index 000000000..ec4726563 --- /dev/null +++ b/apps/ide/src-tauri/Cargo.lock @@ -0,0 +1,5892 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures 0.2.17", +] + +[[package]] +name = "aho-corasick" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba" +dependencies = [ + "memchr", +] + +[[package]] +name = "alloc-no-stdlib" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2fb6cfd47bf496ff64095c20eaba0c201404ee38714d4142fcfa1dc334fcc7a" + +[[package]] +name = "alloc-stdlib" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5c1865780388bfa186411ab5f247819487fc4864c6e9c3106611fa347586e1" +dependencies = [ + "alloc-no-stdlib", +] + +[[package]] +name = "android_system_properties" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "204ddd8b860c1ff4b89d3cef1d23180caa4d0c34d34c9c2b009bc441ffb94d0f" +dependencies = [ + "libc", +] + +[[package]] +name = "anyhow" +version = "1.0.105" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2cb931c189b85683d69a5cfad41d4d418671e1ac413dd209f3f2fc31e3cfd902" + +[[package]] +name = "arboard" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aeb9553e62312c8756a5979254fc6d7da8bbeb5986a1e17037fab932f7037917" +dependencies = [ + "clipboard-win", + "image", + "log", + "objc2", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation", + "parking_lot", + "percent-encoding", + "windows-sys 0.61.2", + "wl-clipboard-rs", + "x11rb", +] + +[[package]] +name = "async-broadcast" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532" +dependencies = [ + "event-listener", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-channel" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2" +dependencies = [ + "concurrent-queue", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-executor" +version = "1.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f426a31126c735126297bc5ea7a521263c9faff4f63ca415267ee625651c4f37" +dependencies = [ + "async-task", + "concurrent-queue", + "fastrand", + "futures-lite", + "pin-project-lite", + "slab", +] + +[[package]] +name = "async-io" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc" +dependencies = [ + "autocfg", + "cfg-if", + "concurrent-queue", + "futures-io", + "futures-lite", + "parking", + "polling", + "rustix", + "slab", + "windows-sys 0.61.2", +] + +[[package]] +name = "async-lock" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0876700b0d007ad25d5508865a4259c3af9af6d296bf663a0d586d0bc3369f6f" +dependencies = [ + "event-listener", + "event-listener-strategy", + "pin-project-lite", +] + +[[package]] +name = "async-process" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc50921ec0055cdd8a16de48773bfeec5c972598674347252c0399676be7da75" +dependencies = [ + "async-channel", + "async-io", + "async-lock", + "async-signal", + "async-task", + "blocking", + "cfg-if", + "event-listener", + "futures-lite", + "rustix", +] + +[[package]] +name = "async-recursion" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f8abc12baad266b1c8cec146854c195b5864b4221d4b2ca7296a7ae82d9e451" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "async-signal" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52b5aaafa020cf5053a01f2a60e8ff5dccf550f0f77ec54a4e47285ac2bab485" +dependencies = [ + "async-io", + "async-lock", + "atomic-waker", + "cfg-if", + "futures-core", + "futures-io", + "rustix", + "signal-hook-registry", + "slab", + "windows-sys 0.61.2", +] + +[[package]] +name = "async-task" +version = "4.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73fde82d895a41b0f864a3657264424d9804474e343edc5ca2a4a804218736" + +[[package]] +name = "async-trait" +version = "0.1.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "atk" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "780a62f5d3373a8461bdc9258527bd03fe9299779446681199005712b24cc1d7" +dependencies = [ + "atk-sys", + "glib", + "libc", +] + +[[package]] +name = "atk-sys" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56fd0f13d1dedae306538653b8e42034a2260d1ac3ee920e7a5c31475d7184a5" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps 9.0.1", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" + +[[package]] +name = "bit-set" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56d87354e4229f54a44f7bf2435906a4656dba36026ab6eaca629a2c436a691c" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72503af1e72be411d74ca45cd6b309878fcb35354e252fc2a3a8bda3a97082a0" + +[[package]] +name = "bitflags" +version = "2.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" +dependencies = [ + "serde_core", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block-buffer" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2f6c7dbe95a6ed67ad9f18e57daf93a2f034c524b99fd2b76d18fdfeb6660aa" +dependencies = [ + "hybrid-array", +] + +[[package]] +name = "block-padding" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block2" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" +dependencies = [ + "objc2", +] + +[[package]] +name = "blocking" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a70e4329df6cb94385eed412ec92375c3cdd8a6e502493d1229b6414e4036dfa" +dependencies = [ + "async-channel", + "async-task", + "futures-io", + "futures-lite", + "piper", +] + +[[package]] +name = "brotli" +version = "9.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8aa80dae1bf2461007e6b64308edc7c59b1aca84e5b0fc59dc0a22606d897a86" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", + "brotli-decompressor", +] + +[[package]] +name = "brotli-decompressor" +version = "6.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "968e28b51837a735d00f25c8d10cca6ab376cec4813a65bb8eab1bbce97502c2" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", +] + +[[package]] +name = "bs58" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "bumpalo" +version = "3.20.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87a0cf66fd1eb2fb7b822cb78370d82303750809bc6ba855f3f58e517d3238db" + +[[package]] +name = "bytemuck" +version = "1.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797" + +[[package]] +name = "byteorder" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34fb07aac3b9f547c7af8dc897dfe73c10847b6c71130c364bdd7891d979c816" + +[[package]] +name = "byteorder-lite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" + +[[package]] +name = "bytes" +version = "1.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "776dfebd015e2d8732c684a2c71003674ccb49457b539b9e82151ba38e96dd7c" +dependencies = [ + "serde", +] + +[[package]] +name = "cairo-rs" +version = "0.22.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bf7f026ae17fe688938438ec1da2b69f69832f1428a17258f6ee9a7f6e1815" +dependencies = [ + "bitflags", + "cairo-sys-rs", + "glib", + "libc", +] + +[[package]] +name = "cairo-sys-rs" +version = "0.22.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee548131103ad8f698c6725669647b9c757b3b66992dd6a026037596417bee21" +dependencies = [ + "glib-sys", + "libc", + "system-deps 9.0.1", +] + +[[package]] +name = "camino" +version = "1.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbbad30e4b4c14a39e3cc8aed085a12a327257c316619c93581e017bc52be591" +dependencies = [ + "serde_core", +] + +[[package]] +name = "cargo-platform" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd0061da739915fae12ea00e16397555ed4371a6bb285431aab930f61b0aa4ba" +dependencies = [ + "serde", + "serde_core", +] + +[[package]] +name = "cargo_metadata" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef987d17b0a113becdd19d3d0022d04d7ef41f9efe4f3fb63ac44ba61df3ade9" +dependencies = [ + "camino", + "cargo-platform", + "semver", + "serde", + "serde_json", + "thiserror 2.0.21", +] + +[[package]] +name = "cargo_toml" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82f4b26e751e711a5302649417f2da046dce6391b2ea30a4820f37462314f0b9" +dependencies = [ + "semver", + "serde", + "toml", +] + +[[package]] +name = "cbc" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6" +dependencies = [ + "cipher", +] + +[[package]] +name = "cc" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53b4e5299ae8fd0d9e848f3efafd5b4feed729b8c731df9d62375cb1efdc3f4e" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" + +[[package]] +name = "cfb" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a347dcabdae9c31b0825fd6a8bed285ec9c2acb89c47827126d52fa4f59cece3" +dependencies = [ + "fnv", + "uuid", + "web-time", +] + +[[package]] +name = "cfg-expr" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edd44d82755fb9210fb10d9daf8dd7e522da0efe1d5f263cffc5db07725663ff" +dependencies = [ + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cfg-if" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" + +[[package]] +name = "cfg_aliases" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" + +[[package]] +name = "chrono" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" +dependencies = [ + "iana-time-zone", + "num-traits", + "serde", + "windows-link 0.2.1", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common 0.1.7", + "inout", +] + +[[package]] +name = "clipboard-win" +version = "5.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "052af7878466feccda12ba7a6a67d019d712f296809559b47c12c8cc196d3a9a" +dependencies = [ + "error-code", +] + +[[package]] +name = "codexr-ide" +version = "0.1.0" +dependencies = [ + "base64 0.22.1", + "getrandom 0.3.4", + "keyring", + "serde", + "serde_json", + "tauri", + "tauri-build", + "tauri-plugin-clipboard-manager", + "tauri-plugin-dialog", + "tauri-plugin-opener", + "tauri-plugin-single-instance", + "tokio", + "trash", +] + +[[package]] +name = "combine" +version = "4.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4356eba6976435498d05a311ee9fc486da3bc81c200d3f0d7dd9703b41913f92" +dependencies = [ + "bytes", + "memchr", +] + +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "const-oid" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be95d4a884358a21a199689323c29e9256b4a1b315e22f183d155422041d3a9a" + +[[package]] +name = "cookie" +version = "0.18.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d55f2d6c30eeec7d5c6f98bd4395d4abb1895629eab97ee6522d340623615f8a" +dependencies = [ + "time", + "version_check", +] + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "core-graphics" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "064badf302c3194842cf2c5d61f56cc88e54a759313879cdf03abdd27d0c3b97" +dependencies = [ + "bitflags", + "core-foundation 0.10.1", + "core-graphics-types", + "foreign-types", + "libc", +] + +[[package]] +name = "core-graphics-types" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb" +dependencies = [ + "bitflags", + "core-foundation 0.10.1", + "libc", +] + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "cpufeatures" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd9ae8fcb3ea71b0b26338b4ffb13006bb175de8fd07921089a906ce7e5e6945" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98b0cc327b5bc766e7fda9c9260cc0fa81b43a8e240440422dff70788e3f9ef1" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" + +[[package]] +name = "crunchy" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "crypto-common" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453" +dependencies = [ + "hybrid-array", +] + +[[package]] +name = "cssparser" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11119743ad110e8c1bdccd930d7f5c30c99e5fc76a7b63ec9807e84eef0c5f59" +dependencies = [ + "cssparser-macros", + "dtoa-short", + "itoa", + "phf", + "smallvec", +] + +[[package]] +name = "cssparser-macros" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d045de693cb712d0b22c6a64be5b953f67b3ce00ab5ad3dd5d8b441886ab8e1a" +dependencies = [ + "quote", + "syn 3.0.10", +] + +[[package]] +name = "ctor" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea691ed9f36489d087419b8b2ba3ef27d89621380b4178c73e2445a379e4e0f4" +dependencies = [ + "link-section", +] + +[[package]] +name = "darling" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed17f5901b6630b993ca003def43f2f8ef4014fc13b047b57aad617ff32bc2ec" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6837e2cf7485aaae18f86181d2f0e9a7ed297a025e220aeabf63fdebd3a2ddff" +dependencies = [ + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 3.0.10", +] + +[[package]] +name = "darling_macro" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ac7135c3ef02b2f7833bbeb1be5ba7f966dcde8a87c6b87f65a778d71a02785" +dependencies = [ + "darling_core", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "dbus" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ab69f03cc8c4340c9c8e315114e1658e6775a9b16a04357973aa21cec22b32e" +dependencies = [ + "libc", + "libdbus-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "dbus-secret-service" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f09471353f53b2f583ca422638cfe48a375050cdcb9e46a442b04123e74163f5" +dependencies = [ + "aes", + "block-padding", + "cbc", + "dbus", + "fastrand", + "hkdf", + "libc", + "num", + "once_cell", + "sha2 0.10.9", + "zeroize", +] + +[[package]] +name = "deranged" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e9de72ce2ad1f90dc62fa25f0f430ef85eb4b0d8fa0be4f30373bc40a21d28e" +dependencies = [ + "serde_core", +] + +[[package]] +name = "derive_more" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "syn 2.0.119", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer 0.10.4", + "crypto-common 0.1.7", + "subtle", +] + +[[package]] +name = "digest" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2" +dependencies = [ + "block-buffer 0.12.1", + "const-oid", + "crypto-common 0.2.2", +] + +[[package]] +name = "dirs" +version = "7.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d57d423b3c82e89b9a24ca3091fee61f456a26edbd28d26c65906f4bc1dcd8f" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys 0.101.0", +] + +[[package]] +name = "dispatch2" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38" +dependencies = [ + "bitflags", + "block2", + "libc", + "objc2", +] + +[[package]] +name = "displaydoc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "dlopen2" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e2c5bd4158e66d1e215c49b837e11d62f3267b30c92f1d171c4d3105e3dc4d4" +dependencies = [ + "dlopen2_derive", + "libc", + "once_cell", + "winapi", +] + +[[package]] +name = "dlopen2_derive" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fbbb781877580993a8707ec48672673ec7b81eeba04cfd2310bd28c08e47c8f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "dom_query" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b35b4f772a1a8b88e5545a67c2d3a62a93d4edccc5a68f2145fe52e39c96d275" +dependencies = [ + "bit-set", + "cssparser", + "foldhash 0.2.0", + "html5ever", + "precomputed-hash", + "selectors", + "tendril", +] + +[[package]] +name = "downcast-rs" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" + +[[package]] +name = "dpi" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76" +dependencies = [ + "serde", +] + +[[package]] +name = "dtoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c3cf4824e2d5f025c7b531afcb2325364084a16806f6d47fbc1f5fbd9960590" + +[[package]] +name = "dtoa-short" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd1511a7b6a56299bd043a9c167a6d2bfb37bf84a6dfceaba651168adfb43c87" +dependencies = [ + "dtoa", +] + +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + +[[package]] +name = "dyn-clone" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" + +[[package]] +name = "embed-resource" +version = "3.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6168487b5e7eb2673e6efe1200b1848016e436a6ca0b8031bf04bd9d493a249f" +dependencies = [ + "cc", + "memchr", + "rustc_version", + "toml", + "vswhom", + "winreg", +] + +[[package]] +name = "embed_plist" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ef6b89e5b37196644d8796de5268852ff179b44e96276cf4290264843743bb7" + +[[package]] +name = "endi" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66b7e2430c6dff6a955451e2cfc438f09cea1965a9d6f87f7e3b90decc014099" + +[[package]] +name = "enumflags2" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1027f7680c853e056ebcec683615fb6fbbc07dbaa13b4d5d9442b146ded4ecef" +dependencies = [ + "enumflags2_derive", + "serde", +] + +[[package]] +name = "enumflags2_derive" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67c78a4d8fdf9953a5c9d458f9efe940fd97a0cab0941c075a813ac594733827" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "equivalent" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826" + +[[package]] +name = "erased-serde" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e59b668157f32d3459d4bd634861a06ffa2503a461ca5f0916b9f0252605e66" +dependencies = [ + "serde", + "serde_core", + "typeid", +] + +[[package]] +name = "errno" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e35d6e78f4cebb90e51d543db8fe41528851d6deeef6ef21ebd4bfdc1e784776" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "error-code" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5343afd4a8365a643ac588dab4cf234a190c7f6c88c9f6dd6ffe00837661b7" + +[[package]] +name = "event-listener" +version = "5.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a23add41df1562121a9393cb065eab5146a1242410f23a644851e90cfd669d2" +dependencies = [ + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" +dependencies = [ + "event-listener", + "pin-project-lite", +] + +[[package]] +name = "fastrand" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" + +[[package]] +name = "fax" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caf1079563223d5d59d83c85886a56e586cfd5c1a26292e971a0fa266531ac5a" + +[[package]] +name = "fdeflate" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" +dependencies = [ + "simd-adler32", +] + +[[package]] +name = "field-offset" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f" +dependencies = [ + "memoffset", + "rustc_version", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f35b0b9b788e7109a8eb0607f5c8a13495edee3ef8e246f60f0664a7cd25b277" + +[[package]] +name = "fixedbitset" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5905ec755cc8386d7928353e4d356d2be3e89e81e5ca01fe630a1ca4d08dc175" + +[[package]] +name = "flate2" +version = "1.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "626d4928326b646e70f65ed36fc7cf9f206bdb68a0019ee7c6b4709da4e084c4" +dependencies = [ + "crc32fast", + "miniz_oxide 0.9.1", + "zlib-rs", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + +[[package]] +name = "foreign-types" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" +dependencies = [ + "foreign-types-macros", + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-macros" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea5190182e6915eb873ddbc16e23b711b6eb1f9c00a0d0a3a91b5f6228475225" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "foreign-types-shared" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" + +[[package]] +name = "form_urlencoded" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afa489199eaffb1211795df1c6236ce1ad0d41a6fa45250add73e3b02420f06e" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" + +[[package]] +name = "futures-executor" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "031b47cf1a3c6cc8bc2fc76cd437f521619387907d469316e7c0bc278f1f5432" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed" + +[[package]] +name = "futures-lite" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28aadd44bf60a243dd4f49b467a5ff30fee9e4dbaed326795d433ffa8a561730" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "parking", + "pin-project-lite", +] + +[[package]] +name = "futures-macro" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "futures-sink" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d" + +[[package]] +name = "futures-task" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" + +[[package]] +name = "futures-util" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" +dependencies = [ + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "slab", +] + +[[package]] +name = "gdk" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50b79a7fa8b0e9fe6c77118e48cc00a23eb41052c190434d9cda7746418efca6" +dependencies = [ + "cairo-rs", + "gdk-pixbuf", + "gdk-sys", + "gio", + "glib", + "libc", + "pango", +] + +[[package]] +name = "gdk-pixbuf" +version = "0.22.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aabb44971913eb9f7bf6747f6e88889386007d8ce8cfd1ca2735751b664e7079" +dependencies = [ + "gdk-pixbuf-sys", + "gio", + "glib", + "libc", +] + +[[package]] +name = "gdk-pixbuf-sys" +version = "0.22.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d5209294ba3775f9b650bf78bfadeba4332089f2329b3e2f6ce0a4957a45bff" +dependencies = [ + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "system-deps 9.0.1", +] + +[[package]] +name = "gdk-sys" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "463ac2e2f204918dcaeb3c34810bd7fe94448d2b8d4fa13a5ab45a4fc3e88e50" +dependencies = [ + "cairo-sys-rs", + "gdk-pixbuf-sys", + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "pango-sys", + "pkg-config", + "system-deps 9.0.1", +] + +[[package]] +name = "gdkwayland-sys" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82559ece0c0952519a3513ecd90638e5db59e00c851f1d3ea05ac7ff2a46942e" +dependencies = [ + "gdk-sys", + "glib-sys", + "gobject-sys", + "libc", + "pkg-config", + "system-deps 9.0.1", +] + +[[package]] +name = "gdkx11" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bad7a698a74652ddba8dc348f9933f6f209fbcf3ab318f2c1fd72c6b2fa99505" +dependencies = [ + "gdk", + "gdkx11-sys", + "gio", + "glib", + "libc", + "x11", +] + +[[package]] +name = "gdkx11-sys" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a103facf2056ce28125a49501f98beb01d1e3c9477257a8e05cfc5d3d677709e" +dependencies = [ + "cairo-sys-rs", + "gdk-sys", + "glib-sys", + "libc", + "system-deps 9.0.1", + "x11", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "gethostname" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8" +dependencies = [ + "rustix", + "windows-link 0.2.1", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi 5.3.0", + "wasip2", +] + +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", +] + +[[package]] +name = "gio" +version = "0.22.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "536990682bab3b8bf68a78d298ccae69702a114290b096edf2bec6eb2e4013b3" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "gio-sys", + "glib", + "libc", + "pin-project-lite", + "smallvec", +] + +[[package]] +name = "gio-sys" +version = "0.22.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9c253490f9a475047f109bf6ccb68c407e9d186b7bfab01849188f4e669e669" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps 9.0.1", + "windows-sys 0.61.2", +] + +[[package]] +name = "glib" +version = "0.22.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9c4cbf1972a07741ae5ce9b23a582a90efc69745fc713f8b037b8d962f604da" +dependencies = [ + "bitflags", + "futures-channel", + "futures-core", + "futures-executor", + "futures-task", + "futures-util", + "gio-sys", + "glib-macros", + "glib-sys", + "gobject-sys", + "libc", + "memchr", + "smallvec", +] + +[[package]] +name = "glib-macros" +version = "0.22.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4014e54e2049108c93cf278b64e89f490849402e09b455a25dfa2098cc35093" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "glib-sys" +version = "0.22.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b01e8b94529c2698b98f765b887f1e001b76195c1e25d1139aa9336019e745d" +dependencies = [ + "libc", + "system-deps 9.0.1", +] + +[[package]] +name = "glob" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b" + +[[package]] +name = "gobject-sys" +version = "0.22.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07595c9ba696bd9819cb6a8df39f08078f3dd679508fe052dd558492c2053834" +dependencies = [ + "glib-sys", + "libc", + "system-deps 9.0.1", +] + +[[package]] +name = "gtk" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a86cafafc177054a1d555a0b302044d2b5f82e1c1e23d152a7ba252dc6bfced0" +dependencies = [ + "atk", + "cairo-rs", + "field-offset", + "futures-channel", + "gdk", + "gdk-pixbuf", + "gio", + "glib", + "gtk-sys", + "gtk3-macros", + "libc", + "pango", + "pkg-config", +] + +[[package]] +name = "gtk-sys" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0e6f055c4a2ce6598b32373595b0c9985f1c7cc448afe4f09fee33fb738b488" +dependencies = [ + "atk-sys", + "cairo-sys-rs", + "gdk-pixbuf-sys", + "gdk-sys", + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "pango-sys", + "system-deps 9.0.1", +] + +[[package]] +name = "gtk3-macros" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fcce21fcb0c4c4fc48bab8d4eee5aacdb361f85d234756430e6e793bd3d95cf" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "half" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" +dependencies = [ + "cfg-if", + "crunchy", + "zerocopy", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash 0.1.5", +] + +[[package]] +name = "hashbrown" +version = "0.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "735eaa21a6a5ffb2e84362faaeb90c05ba8e19797ca30428478cb6ea3a4921bc" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e17592d60ebacc7d5e169f4663c5f84f9161cc90328abcfe8456f41e4dfcb284" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "html5ever" +version = "0.40.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "456a1a377e608e555d22ddab27ac0114bc7a7b4199078108e34c2aeae6c9b130" +dependencies = [ + "log", + "markup5ever", + "memchr", +] + +[[package]] +name = "http" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a07dc2d082802d1782faa5b3c8ac252f3a4fc89f51e76c3f37dc2d1a5b857c05" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "hybrid-array" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27f864f10dfb56725ce5ce5472bc52252c8f93a4ab86327122cebf62c5f59a17" +dependencies = [ + "typenum", +] + +[[package]] +name = "hyper" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "229c6ff5584df4c6becbfe00567128bac768c8cd32ebc8a8366bd81ed072e8f3" +dependencies = [ + "atomic-waker", + "bytes", + "futures-core", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-util" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddc03d96684f9226b8a787cdb71488417b53ab5ea8fdb1dac946cb9431cc8bff" +dependencies = [ + "base64 0.23.1", + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "httparse", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "ico" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d75e94d66081e4d8dcd098bd8dc5254800fea14a26389b298410158d834de167" +dependencies = [ + "byteorder", + "png", +] + +[[package]] +name = "icu_collections" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe090a42a0d3140fed8c63263ed1fecc02422cb2f4bfe55cd8de2de1b8e105dd" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25d29b57c17c6528d0dc4c2141cfa2d08200465acb537a3909c8b9b8a4a984c0" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "404a3b8c486f205c87fe7f23ab6894d84a4ad76d6e4671ae1981ba7def87c599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20f0088bfb7441f7a37fa0c9e20cb1e9cba1cac6b9ce8cd2a6dc44294f8e8cbc" + +[[package]] +name = "icu_properties" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ea83d991c56158f7cf898bf86436c1dfe7c07ee82fe88951f2695c9f37a379f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98f29af82d02b163fe50161388350e743bb3107cc8e8c2f7314cb505faddfcf" + +[[package]] +name = "icu_provider" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413099315636c588ee8f011190b329b971a09a8fae9d157e01dcae8379468514" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "image" +version = "0.25.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85ab80394333c02fe689eaf900ab500fbd0c2213da414687ebf995a65d5a6104" +dependencies = [ + "bytemuck", + "byteorder-lite", + "moxcms", + "num-traits", + "png", + "tiff", +] + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" +dependencies = [ + "equivalent", + "hashbrown 0.17.2", + "serde", + "serde_core", +] + +[[package]] +name = "infer" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4200d433cbd5178df7797c9c2e75b348b728e39631cf14520d1e2fc424201f4" +dependencies = [ + "cfb", +] + +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "block-padding", + "generic-array", +] + +[[package]] +name = "ipnet" +version = "2.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "007d6e6b91097094791302ccc6cd0588e0700ddac5c6829035bcd71eff4dc433" + +[[package]] +name = "is-docker" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "928bae27f42bc99b60d9ac7334e3a21d10ad8f1835a4e12ec3ec0464765ed1b3" +dependencies = [ + "once_cell", +] + +[[package]] +name = "is-wsl" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "173609498df190136aa7dea1a91db051746d339e18476eed5ca40521f02d7aa5" +dependencies = [ + "is-docker", + "once_cell", +] + +[[package]] +name = "itoa" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4" + +[[package]] +name = "javascriptcore-rs" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7481d6ae0ba570cd25ac36481911395bb00715859d520da3444ad77c08762baa" +dependencies = [ + "bitflags", + "glib", + "javascriptcore-rs-sys", +] + +[[package]] +name = "javascriptcore-rs-sys" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6d0ad3598dd4db3a85224e1447764b62f3762c9298892474a2cf3ccd1cd11ff" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps 9.0.1", +] + +[[package]] +name = "jiff" +version = "0.2.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175dc66334db3b9ab9985bf8b61cfed50dc16d20964bb47f9e479adcae984a7f" +dependencies = [ + "jiff-core 0.1.8", + "jiff-static 0.2.46", + "jiff-tzdb-platform 0.1.3", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", + "windows-link 0.2.1", +] + +[[package]] +name = "jiff" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "379ed44bd4e16d3926160e2b3a78b79ca0952ef5c037f124f554842ba272ef92" +dependencies = [ + "jiff-core 1.1.0", + "jiff-static 1.1.0", + "jiff-tzdb-platform 1.0.0", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", + "windows-link 0.2.1", +] + +[[package]] +name = "jiff-core" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e599b80292e597019b8b3e392de3f4bea2959ddfb8c7dff60e035e9e311a2c1b" +dependencies = [ + "log", +] + +[[package]] +name = "jiff-core" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0df46fc314b4f458aee614afcd8676ed6cb3637413aa359d47d2646cbc038b79" +dependencies = [ + "log", +] + +[[package]] +name = "jiff-static" +version = "0.2.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7b1af7547d47354bc438d797e3854601bde8f8d185780c5ba4ab27afa54f1ba" +dependencies = [ + "jiff-core 0.1.8", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "jiff-static" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27b729c549d3efb5855b3c80b0ee8ee1850d56330a127382fe2760965741c1f3" +dependencies = [ + "jiff-core 1.1.0", + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "jiff-tzdb" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0980fca2cc272465bd60e82397607ba9f33add9e48defd77923301bbd03808f2" + +[[package]] +name = "jiff-tzdb" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12e71a1b68a875a44a33bb7a1dd84392cb77145a3367a552a3cfe6a4f5cf3afc" + +[[package]] +name = "jiff-tzdb-platform" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "875a5a69ac2bab1a891711cf5eccbec1ce0341ea805560dcd90b7a2e925132e8" +dependencies = [ + "jiff-tzdb 0.1.10", +] + +[[package]] +name = "jiff-tzdb-platform" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc65b284afcfa8f6cf189c7274c805505314a7ab975c60e1f548bff56525420e" +dependencies = [ + "jiff-tzdb 1.0.0", +] + +[[package]] +name = "jni" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" +dependencies = [ + "cesu8", + "cfg-if", + "combine", + "jni-sys 0.3.1", + "log", + "thiserror 1.0.69", + "walkdir", + "windows-sys 0.45.0", +] + +[[package]] +name = "jni-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258" +dependencies = [ + "jni-sys 0.4.1", +] + +[[package]] +name = "jni-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2" +dependencies = [ + "jni-sys-macros", +] + +[[package]] +name = "jni-sys-macros" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" +dependencies = [ + "quote", + "syn 2.0.119", +] + +[[package]] +name = "js-sys" +version = "0.3.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dc09d2154098bbf4ef54eab6b117a3c24cbbffe94046b16ee6d6d4510584d3a" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + +[[package]] +name = "json-patch" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa295c8f71b9bad32d060e0e145f96dcba0cc6c6171e129646140d1c96b05617" +dependencies = [ + "jsonptr", + "serde", + "serde_json", + "thiserror 2.0.21", +] + +[[package]] +name = "jsonptr" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72c22d99362c7aac7d77efab6b49c2181674b165d7e6e7c755b3432ded64bf51" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "keyboard-types" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fbe853b403ae61a04233030ae8a79d94975281ed9770a1f9e246732b534b28d" +dependencies = [ + "bitflags", + "serde", +] + +[[package]] +name = "keyring" +version = "3.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eebcc3aff044e5944a8fbaf69eb277d11986064cba30c468730e8b9909fb551c" +dependencies = [ + "byteorder", + "dbus-secret-service", + "log", + "secret-service", + "security-framework 2.11.1", + "security-framework 3.7.0", + "windows-sys 0.60.2", + "zeroize", +] + +[[package]] +name = "libappindicator" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f57fd42f20edd22ee374ebcedda7bdecd1d5d1e76f11880d9ff2898ed2150d76" +dependencies = [ + "gtk", + "libappindicator-sys", +] + +[[package]] +name = "libappindicator-sys" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b76d3d67eb285f611b14654cd097f52eb7e83acc2b59913147f8ac695b61149" +dependencies = [ + "gtk-sys", + "libloading", +] + +[[package]] +name = "libc" +version = "0.2.191" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" + +[[package]] +name = "libdbus-sys" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "328c4789d42200f1eeec05bd86c9c13c7f091d2ba9a6ea35acdf51f31bc0f043" +dependencies = [ + "pkg-config", +] + +[[package]] +name = "libloading" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1832accd5a4ca2795ace4d05d15c4039be15b62d3b950eff99746a990e3cc10" +dependencies = [ + "cfg-if", + "windows-link 0.2.1", +] + +[[package]] +name = "libredox" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61ff90caf6077a803a240f62fdbe88645a890bbca49ef8174c3cb0404362171d" +dependencies = [ + "libc", +] + +[[package]] +name = "link-section" +version = "0.19.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d9aae57673c1a235149777a74d152f3210ebd3e3b13346d2cdb6809e566bd3c" + +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + +[[package]] +name = "litemap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d15f86d12da44cd8d4ec3c73984537eb7f4cadcb9776a575a0a8a05ca11005c" + +[[package]] +name = "markup5ever" +version = "0.40.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ab3dc68ac4a0f5719e560136778c1ee716e296030d75dbd4484e37e39e3a842" +dependencies = [ + "log", + "tendril", + "web_atoms", +] + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "mime" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5848f5a9e8117cf94f2f90faac24a87ff81600ff8628c1e3deaab572e76bfa1" + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "miniz_oxide" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "mio" +version = "1.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20521a903f02b0a573cd6840e9d0a5a0cc043d361fe924092cd70f8556cc9c4a" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "moxcms" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb85c154ba489f01b25c0d36ae69a87e4a1c73a72631fc6c0eb6dde34a73e44b" +dependencies = [ + "num-traits", + "pxfm", +] + +[[package]] +name = "muda" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe2b1ef95ccb2983c8459d869337c0d5a9e2a2c52b32a994f185111cb59f9b52" +dependencies = [ + "crossbeam-channel", + "dpi", + "gtk", + "keyboard-types", + "libc", + "objc2", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-foundation", + "png", + "serde", + "thiserror 2.0.21", + "windows-sys 0.61.2", +] + +[[package]] +name = "ndk" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" +dependencies = [ + "bitflags", + "jni-sys 0.3.1", + "log", + "ndk-sys", + "num_enum", + "raw-window-handle", + "thiserror 1.0.69", +] + +[[package]] +name = "ndk-context" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" + +[[package]] +name = "ndk-sys" +version = "0.6.0+11769913" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873" +dependencies = [ + "jni-sys 0.3.1", +] + +[[package]] +name = "new_debug_unreachable" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" + +[[package]] +name = "nix" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" +dependencies = [ + "bitflags", + "cfg-if", + "cfg_aliases", + "libc", + "memoffset", +] + +[[package]] +name = "nom" +version = "8.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405" +dependencies = [ + "memchr", +] + +[[package]] +name = "num" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" +dependencies = [ + "num-bigint", + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-complex" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-conv" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" + +[[package]] +name = "num-integer" +version = "0.1.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c92800bd69a1eac91786bcfe9da64a897eb72911b8dc3095decbd07429e8048b" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" +dependencies = [ + "num-bigint", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_enum" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26" +dependencies = [ + "num_enum_derive", + "rustversion", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "objc2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08849bbd4767dfae9457696856ae1c84fe4e0281bbe4a7abff2d0e06fb7981f8" +dependencies = [ + "objc2-encode", + "objc2-exception-helper", +] + +[[package]] +name = "objc2-app-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c" +dependencies = [ + "bitflags", + "block2", + "objc2", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation", + "objc2-quartz-core", + "objc2-uniform-type-identifiers", +] + +[[package]] +name = "objc2-cloud-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73ad74d880bb43877038da939b7427bba67e9dd42004a18b809ba7d87cee241c" +dependencies = [ + "bitflags", + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-core-data" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b402a653efbb5e82ce4df10683b6b28027616a2715e90009947d50b8dd298fa" +dependencies = [ + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-core-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +dependencies = [ + "bitflags", + "dispatch2", + "objc2", +] + +[[package]] +name = "objc2-core-graphics" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" +dependencies = [ + "bitflags", + "dispatch2", + "objc2", + "objc2-core-foundation", + "objc2-io-surface", +] + +[[package]] +name = "objc2-core-image" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5d563b38d2b97209f8e861173de434bd0214cf020e3423a52624cd1d989f006" +dependencies = [ + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-core-location" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca347214e24bc973fc025fd0d36ebb179ff30536ed1f80252706db19ee452009" +dependencies = [ + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-core-text" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cde0dfb48d25d2b4862161a4d5fcc0e3c24367869ad306b0c9ec0073bfed92d" +dependencies = [ + "bitflags", + "objc2", + "objc2-core-foundation", + "objc2-core-graphics", +] + +[[package]] +name = "objc2-encode" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" + +[[package]] +name = "objc2-exception-helper" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7a1c5fbb72d7735b076bb47b578523aedc40f3c439bea6dfd595c089d79d98a" +dependencies = [ + "cc", +] + +[[package]] +name = "objc2-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" +dependencies = [ + "bitflags", + "block2", + "libc", + "objc2", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-io-surface" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d" +dependencies = [ + "bitflags", + "objc2", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-quartz-core" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f" +dependencies = [ + "bitflags", + "objc2", + "objc2-core-foundation", + "objc2-foundation", +] + +[[package]] +name = "objc2-ui-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d87d638e33c06f577498cbcc50491496a3ed4246998a7fbba7ccb98b1e7eab22" +dependencies = [ + "bitflags", + "block2", + "objc2", + "objc2-cloud-kit", + "objc2-core-data", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-core-image", + "objc2-core-location", + "objc2-core-text", + "objc2-foundation", + "objc2-quartz-core", + "objc2-user-notifications", +] + +[[package]] +name = "objc2-uniform-type-identifiers" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7902ac02859fc1f7045f8b598c63f1ae0cc7efeaa06a9bc9f3d9a3c955974fa4" +dependencies = [ + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-user-notifications" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9df9128cbbfef73cda168416ccf7f837b62737d748333bfe9ab71c245d76613e" +dependencies = [ + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-web-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2e5aaab980c433cf470df9d7af96a7b46a9d892d521a2cbbb2f8a4c16751e7f" +dependencies = [ + "bitflags", + "block2", + "objc2", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-foundation", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "open" +version = "5.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d8c8b8e725ad26404d6896eb2f064294a0a7b4f1d9120210d85544684c4ca95" +dependencies = [ + "dunce", + "is-wsl", + "libc", +] + +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + +[[package]] +name = "ordered-stream" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50" +dependencies = [ + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "os_pipe" +version = "1.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54a351c59c9045dfd196da7bc84279dbe6d891c2fc0bb19b988de169dd60f1c9" +dependencies = [ + "libc", + "windows-sys 0.101.0", +] + +[[package]] +name = "pango" +version = "0.22.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b2022dbbd82e1c42bd950a6f1df9b98c796e725dce5ec275e03cbf9772e4efa" +dependencies = [ + "gio", + "glib", + "pango-sys", +] + +[[package]] +name = "pango-sys" +version = "0.22.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd6be7bdb6cde4c49703315c1818a14382ce500dce57179a8d05f1c5efe4955f" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps 9.0.1", +] + +[[package]] +name = "parking" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link 0.2.1", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "petgraph" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455" +dependencies = [ + "fixedbitset", + "hashbrown 0.15.5", + "indexmap 2.14.2", +] + +[[package]] +name = "phf" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "010378780309880b08997fae13be7834dba947d36393bd372f2b1556deb2a2f6" +dependencies = [ + "phf_macros", + "phf_shared", + "serde", +] + +[[package]] +name = "phf_codegen" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41b585a510fb76fdebead6897982ef2a03a21d8e6cbcca904999742a4afc6ffe" +dependencies = [ + "phf_generator", + "phf_shared", +] + +[[package]] +name = "phf_generator" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aeb62e0959d5a1bebc965f4d15d9e2b7cea002b6b0f5ba8cde6cc26738467100" +dependencies = [ + "fastrand", + "phf_shared", +] + +[[package]] +name = "phf_macros" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fa8d0ca26d424d27630da600c6624696e7dec8bf7b3b492b383c5dc49e5e085" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "phf_shared" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6fd9027e2d9319be6349febd1db4e8d02aa544921200c9b777720ac34a3aa89" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f120c8d5021b34abd2f2ffd7ee96687cbcd6c54a3e68d86b6169f4a5cd480ffe" + +[[package]] +name = "piper" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c835479a4443ded371d6c535cbfd8d31ad92c5d23ae9770a61bc155e4992a3c1" +dependencies = [ + "atomic-waker", + "fastrand", + "futures-io", +] + +[[package]] +name = "pkg-config" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548" + +[[package]] +name = "plist" +version = "1.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7a42747bbcc4374e6922a15040dccacf720e4ce48a77e668f7116b9aa19a0a" +dependencies = [ + "base64 0.23.1", + "indexmap 2.14.2", + "quick-xml 0.42.0", + "serde", + "time", +] + +[[package]] +name = "png" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61" +dependencies = [ + "bitflags", + "crc32fast", + "fdeflate", + "flate2", + "miniz_oxide 0.8.9", +] + +[[package]] +name = "polling" +version = "3.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ef68681b8567f8908e84dbaf3e0ca8d6200671d9c4b6b791b6ced20341465bb" +dependencies = [ + "cfg-if", + "concurrent-queue", + "hermit-abi", + "pin-project-lite", + "rustix", + "windows-sys 0.101.0", +] + +[[package]] +name = "portable-atomic" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85" + +[[package]] +name = "portable-atomic-util" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "potential_utf" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" +dependencies = [ + "zerovec", +] + +[[package]] +name = "powerfmt" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a6394b9e965e73d0a289ee54f589087e2c676aedf60885baf52c76b771e4958" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + +[[package]] +name = "proc-macro-crate" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" +dependencies = [ + "toml_edit", +] + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "pxfm" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d55d956fa96f5ec02be2e13af0e20391a5aa83d6a074e3ad368959d0fab299ea" + +[[package]] +name = "quick-error" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" + +[[package]] +name = "quick-xml" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e660451e55124f798a69a5af3f49ccfbefbd41910eefd25caf2393e1f3473ec1" +dependencies = [ + "memchr", +] + +[[package]] +name = "quick-xml" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41b1177fdf999d2321d3fb46ff47159d9c1fb9ad66a4879f8c50a0b504615e9b" +dependencies = [ + "memchr", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "rand" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.17", +] + +[[package]] +name = "raw-window-handle" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags", +] + +[[package]] +name = "redox_users" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60dc65c0ff1a7ae1294b0c67b9f14baf70b644404010370171787bfac1038fc0" +dependencies = [ + "libredox", + "thiserror 2.0.21", +] + +[[package]] +name = "ref-cast" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e440fb4e4b4147295338efb76001ab9e4efc0e5839df2c47fc5ac2381d365c3" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92ecd8964f8453721699a1ed72037b0db49ce2f5a5138486ee89bed6f67cdf3a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "regex" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9807af0e638c12e753aa1b4e601791bf2a8f71274023c8bbeec12fc149950857" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d60ef07df457506a0a1a2073112eb4aae5733dbd2813c3da77d1b0fd441158" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d902046e6a28a1e4c3cab97258a0ce11e994903f01c2d97a9447a0b3df85f4f6" + +[[package]] +name = "reqwest" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16a1cfa75cc186dd73d5818e510e042e40927bccc9c236b061cea97e1eb08029" +dependencies = [ + "base64 0.23.1", + "bytes", + "futures-core", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-util", + "js-sys", + "log", + "percent-encoding", + "pin-project-lite", + "serde", + "serde_json", + "sync_wrapper", + "tokio", + "tokio-util", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-streams", + "web-sys", +] + +[[package]] +name = "rfd" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4b9d4857b10297ffb0f64cae711e983a7aeaee561848d56d429d3858bd8ed93" +dependencies = [ + "block2", + "dispatch2", + "glib-sys", + "gobject-sys", + "gtk-sys", + "js-sys", + "libc", + "log", + "objc2", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-foundation", + "objc2-uniform-type-identifiers", + "percent-encoding", + "raw-window-handle", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustc-hash" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5e76742e5294153d4dde1207dbec5bdd81eef6fabdc0d2118babadabfd858aa" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustversion" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "schemars" +version = "0.8.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fbf2ae1b8bc8e02df939598064d22402220cd5bbcca1c76f7d6a310974d5615" +dependencies = [ + "dyn-clone", + "indexmap 1.9.3", + "schemars_derive", + "serde", + "serde_json", + "url", + "uuid", +] + +[[package]] +name = "schemars" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "schemars" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab508826f74a77ca9d5aba6ff19b522583ee3eaf28a19384ff3d0e5835fadf6e" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "schemars_derive" +version = "0.8.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32e265784ad618884abaea0600a9adf15393368d840e0222d101a072f3f7534d" +dependencies = [ + "proc-macro2", + "quote", + "serde_derive_internals", + "syn 2.0.119", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "secret-service" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4d35ad99a181be0a60ffcbe85d680d98f87bdc4d7644ade319b87076b9dbfd4" +dependencies = [ + "aes", + "cbc", + "futures-util", + "generic-array", + "hkdf", + "num", + "once_cell", + "rand", + "serde", + "sha2 0.10.9", + "zbus 4.4.0", +] + +[[package]] +name = "security-framework" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +dependencies = [ + "bitflags", + "core-foundation 0.9.4", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" +dependencies = [ + "bitflags", + "core-foundation 0.10.1", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "selectors" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8322aebea94a6cc288ff884e8a49bdbceef60206c400c6c46d22e62fc4fd91a6" +dependencies = [ + "bitflags", + "cssparser", + "derive_more", + "log", + "new_debug_unreachable", + "precomputed-hash", + "rustc-hash", + "servo_arc", + "smallvec", +] + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" +dependencies = [ + "serde", + "serde_core", +] + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde-untagged" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9faf48a4a2d2693be24c6289dbe26552776eb7737074e6722891fadbe6c5058" +dependencies = [ + "erased-serde", + "serde", + "serde_core", + "typeid", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "serde_derive_internals" +version = "0.29.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "serde_json" +version = "1.0.154" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_repr" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d3b1629de253c70a0508c3899572da79ca359fdab27c7920ff00406df418906" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "serde_spanned" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c187e0a369471c550af028cba56d4f4fa2a489ad28151ae95a4d340a2a8b782" +dependencies = [ + "serde_core", +] + +[[package]] +name = "serde_with" +version = "3.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56cb1ca7c93ae63d6439b5250f6b6b040f7e121f32e5dd2f5d523dd4149b3204" +dependencies = [ + "base64 0.23.1", + "bs58", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.14.2", + "jiff 0.2.46", + "jiff 1.1.0", + "schemars 0.9.0", + "schemars 1.2.3", + "serde_core", + "serde_json", + "serde_with_macros", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "3.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cff15a7c864bbec77d9586ca6822bc7c369bdf19e9243134a62b0b51ce26b31f" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "serialize-to-javascript" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04f3666a07a197cdb77cdf306c32be9b7f598d7060d50cfd4d5aa04bfd92f6c5" +dependencies = [ + "serde", + "serde_json", + "serialize-to-javascript-impl", +] + +[[package]] +name = "serialize-to-javascript-impl" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "772ee033c0916d670af7860b6e1ef7d658a4629a6d0b4c8c3e67f09b3765b75d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "servo_arc" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4eceb519ec34d8290aaf6e46f435102f2bfa63f22b05a144fb16ab266d3b198" +dependencies = [ + "stable_deref_trait", +] + +[[package]] +name = "sha1" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8" +dependencies = [ + "cfg-if", + "cpufeatures 0.2.17", + "digest 0.10.7", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures 0.2.17", + "digest 0.10.7", +] + +[[package]] +name = "sha2" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "820083d430c52864bf834423fc988cbcf61685d6f9d22a765a64e3f6cfe3521c" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.1", + "digest 0.11.3", +] + +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "simd-adler32" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea" + +[[package]] +name = "siphasher" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33f4fe9184a62d842c9ef383018f3306d8ba224fd9d836f56d7288308847c256" + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.16.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3244542535d5de959d90ec55d1b5ff0fd2bb7b1310223907d5f11932847f7b59" + +[[package]] +name = "socket2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "softbuffer" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aac18da81ebbf05109ab275b157c22a653bb3c12cf884450179942f81bcbf6c3" +dependencies = [ + "bytemuck", + "js-sys", + "ndk", + "objc2", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation", + "objc2-quartz-core", + "raw-window-handle", + "redox_syscall", + "tracing", + "wasm-bindgen", + "web-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "soup3" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d38b59ff6d302538efd337e15d04d61c5b909ec223c60ae4061d74605a962a" +dependencies = [ + "futures-channel", + "gio", + "glib", + "libc", + "soup3-sys", +] + +[[package]] +name = "soup3-sys" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79d5d25225bb06f83b78ff8cc35973b56d45fcdd21af6ed6d2bbd67f5a6f9bea" +dependencies = [ + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "system-deps 7.0.8", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "static_vcruntime" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff7589a1859b09232522bb9edf076ca7fcf14ded96685d3fa629db73023ffbb7" + +[[package]] +name = "string_cache" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffa8a5dbe8b3f0bbe29d4c3225daafaeead63afdc1b65fc4c01a1384166038e6" +dependencies = [ + "new_debug_unreachable", + "parking_lot", + "phf_shared", + "precomputed-hash", +] + +[[package]] +name = "string_cache_codegen" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "928dcdf75e47626b3617a976ec205d9f057584c371c1f23b782129268d0e6edc" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "swift-rs" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cefd87076fd385308ee4aff597256c902f1fbb4d031de1558efc12f8ffefadd9" +dependencies = [ + "base64 0.21.7", + "serde", + "serde_json", +] + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "system-deps" +version = "7.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "396a35feb67335377e0251fcbc1092fc85c484bd4e3a7a54319399da127796e7" +dependencies = [ + "cfg-expr", + "heck", + "pkg-config", + "toml", + "version-compare", +] + +[[package]] +name = "system-deps" +version = "9.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db551ad38aac61d5e0343e0eeeb0163be3115c4e23b6a025959570ee0c03c67d" +dependencies = [ + "cfg-expr", + "heck", + "pkg-config", + "toml", + "version-compare", +] + +[[package]] +name = "tao" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "018765afffb658648fbdfa825af8f117ceee0499296811802d8359663932e7b7" +dependencies = [ + "async-channel", + "bitflags", + "block2", + "core-foundation 0.10.1", + "core-graphics", + "crossbeam-channel", + "dbus", + "dispatch2", + "dlopen2", + "dpi", + "gdkwayland-sys", + "gdkx11-sys", + "gtk", + "jni", + "libc", + "log", + "ndk", + "ndk-context", + "ndk-sys", + "objc2", + "objc2-app-kit", + "objc2-foundation", + "objc2-ui-kit", + "parking_lot", + "percent-encoding", + "raw-window-handle", + "tao-macros", + "unicode-segmentation", + "url", + "windows", + "windows-core", + "windows-version", + "x11-dl", +] + +[[package]] +name = "tao-macros" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f7eeb6d99155545da6150a1795945f16ac9c178deb2a5f2e74d776107bd5849" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "target-lexicon" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca" + +[[package]] +name = "tauri" +version = "2.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad570590a6620bd7a767910958cdc581308bef2ccae4a2b794f0347aa5169b75" +dependencies = [ + "anyhow", + "bytes", + "cookie", + "dirs", + "dunce", + "embed_plist", + "getrandom 0.3.4", + "glob", + "gtk", + "heck", + "http", + "image", + "jni", + "libc", + "log", + "mime", + "muda", + "objc2", + "objc2-app-kit", + "objc2-foundation", + "objc2-ui-kit", + "objc2-web-kit", + "percent-encoding", + "plist", + "raw-window-handle", + "reqwest", + "serde", + "serde_json", + "serde_repr", + "serialize-to-javascript", + "swift-rs", + "tauri-build", + "tauri-macros", + "tauri-runtime", + "tauri-runtime-wry", + "tauri-utils", + "thiserror 2.0.21", + "tokio", + "tray-icon", + "url", + "webkit2gtk", + "webview2-com", + "window-vibrancy", + "windows", +] + +[[package]] +name = "tauri-build" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97cc0781e9d66f684d7150507d5423fc05322312ddfd12f24c30e833cf183153" +dependencies = [ + "anyhow", + "cargo_toml", + "dirs", + "glob", + "json-patch", + "semver", + "serde_json", + "static_vcruntime", + "strsim", + "tauri-utils", + "tauri-winres", + "walkdir", +] + +[[package]] +name = "tauri-codegen" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c0e6d4ad77790f6da7ac445f1a8908211785e5324bb6a9662582f3ac127231" +dependencies = [ + "base64 0.23.1", + "brotli", + "ico", + "json-patch", + "plist", + "png", + "proc-macro2", + "quote", + "semver", + "serde_json", + "sha2 0.11.3", + "syn 2.0.119", + "tauri-utils", + "thiserror 2.0.21", + "uuid", + "walkdir", +] + +[[package]] +name = "tauri-macros" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "564854181dbca954a49e852140be2d810c4fc3e882538e8f530bb197bd69cfec" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.119", + "tauri-codegen", + "tauri-utils", +] + +[[package]] +name = "tauri-plugin" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ace389bb5d5ac6379af1e50981a7860e254157c8d333627473a2c9d23134047" +dependencies = [ + "anyhow", + "glob", + "plist", + "schemars 0.8.22", + "serde", + "serde_json", + "tauri-utils", + "walkdir", +] + +[[package]] +name = "tauri-plugin-clipboard-manager" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9be5ed8d94c33afe8377e885119069f6508780659271d0a25cfc54d441f2bc81" +dependencies = [ + "arboard", + "log", + "serde", + "serde_json", + "tauri", + "tauri-plugin", + "thiserror 2.0.21", +] + +[[package]] +name = "tauri-plugin-dialog" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96f4dcf1a6c6009f4a58928e8a523b95465e982d12c58db054a1ea7c6c8e1a0f" +dependencies = [ + "log", + "raw-window-handle", + "rfd", + "serde", + "serde_json", + "tauri", + "tauri-plugin", + "tauri-plugin-fs", + "thiserror 2.0.21", + "url", +] + +[[package]] +name = "tauri-plugin-fs" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a1649dc7e9429b2f32164fb6614abff8bc10ed8802fa186cef72df4276eed20" +dependencies = [ + "anyhow", + "dunce", + "glob", + "log", + "objc2-foundation", + "percent-encoding", + "schemars 0.8.22", + "serde", + "serde_json", + "serde_repr", + "tauri", + "tauri-plugin", + "tauri-utils", + "thiserror 2.0.21", + "toml", + "url", +] + +[[package]] +name = "tauri-plugin-opener" +version = "2.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54592c6718b42ab198bf11bda6a428a3553ca2f2f8e506df56f6a063ec328331" +dependencies = [ + "dunce", + "glob", + "objc2-app-kit", + "objc2-foundation", + "open", + "schemars 0.8.22", + "serde", + "serde_json", + "tauri", + "tauri-plugin", + "thiserror 2.0.21", + "url", + "windows", + "zbus 5.19.0", +] + +[[package]] +name = "tauri-plugin-single-instance" +version = "2.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "726b6da0dd5bd1344f84f4108a622c07d01923baacb5c803a605189672c5352f" +dependencies = [ + "serde", + "serde_json", + "tauri", + "thiserror 2.0.21", + "tokio", + "tracing", + "windows-sys 0.61.2", + "zbus 5.19.0", +] + +[[package]] +name = "tauri-runtime" +version = "2.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ebc9c0fc7a10f26169edd4adcc8798030cd025b2621791fe7f7e0330105c68" +dependencies = [ + "cookie", + "dpi", + "gtk", + "http", + "jni", + "objc2", + "objc2-ui-kit", + "objc2-web-kit", + "raw-window-handle", + "serde", + "serde_json", + "tauri-utils", + "thiserror 2.0.21", + "url", + "webkit2gtk", + "webview2-com", + "windows", +] + +[[package]] +name = "tauri-runtime-wry" +version = "2.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34a8d0c102664aaec2d2bfc4e8c4375e253a4192f574bb4352517c152643c6a8" +dependencies = [ + "gtk", + "http", + "jni", + "log", + "objc2", + "objc2-app-kit", + "percent-encoding", + "raw-window-handle", + "softbuffer", + "tao", + "tauri-runtime", + "tauri-utils", + "url", + "webkit2gtk", + "webview2-com", + "windows", + "wry", +] + +[[package]] +name = "tauri-utils" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b3bb2217a2c5632f25a375c305f5a1f9b3beaa7b0614a21e79f297b6b3cbc92" +dependencies = [ + "anyhow", + "brotli", + "cargo_metadata", + "ctor", + "dom_query", + "dunce", + "glob", + "http", + "infer", + "json-patch", + "log", + "memchr", + "phf", + "plist", + "proc-macro2", + "quote", + "regex", + "schemars 0.8.22", + "semver", + "serde", + "serde-untagged", + "serde_json", + "serde_with", + "swift-rs", + "thiserror 2.0.21", + "toml", + "url", + "urlpattern", + "uuid", + "walkdir", +] + +[[package]] +name = "tauri-winres" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c52bb6904475a6ca662f15ef787f18ade61d5740a1ee12c45d3b748efdb6f796" +dependencies = [ + "dunce", + "embed-resource", + "toml", +] + +[[package]] +name = "tempfile" +version = "3.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" +dependencies = [ + "fastrand", + "getrandom 0.4.3", + "once_cell", + "rustix", + "windows-sys 0.61.2", +] + +[[package]] +name = "tendril" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fed54709c5b3a53d09bb1c113ea4f5ceafd1e772ddcb0030a82e1d56c087b08" +dependencies = [ + "new_debug_unreachable", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" +dependencies = [ + "thiserror-impl 2.0.21", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "tiff" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63feaf3343d35b6ca4d50483f94843803b0f51634937cc2ec519fc32232bc52" +dependencies = [ + "fax", + "flate2", + "half", + "quick-error", + "weezl", + "zune-jpeg", +] + +[[package]] +name = "time" +version = "0.3.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb87b95ec50ddfa440816d227a17b2ccbdda963a316a727fda0fc4334f7d134" +dependencies = [ + "deranged", + "num-conv", + "powerfmt", + "serde_core", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109" + +[[package]] +name = "time-macros" +version = "0.2.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e689342a48d2ea927c87ea50cabf8594854bf940e9310208848d680d668ed85" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tinystr" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abc840c238154d58f9e86b2792261edfde565a17696e1cda1a449de27979801a" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee" + +[[package]] +name = "tokio" +version = "1.54.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3" +dependencies = [ + "bytes", + "libc", + "mio", + "pin-project-lite", + "socket2", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-util" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e464cf451ba96ebfc6f9b6542f17ee8b8956e33f1e40d9690624e59d7a7f8a4b" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml" +version = "1.2.3+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b1f26e9485c1fa43ee89fe76e9f3fb9e2e52bb227f8594b4d687496b83d073" +dependencies = [ + "indexmap 2.14.2", + "serde_core", + "serde_spanned", + "toml_datetime", + "toml_parser", + "toml_writer", + "winnow", +] + +[[package]] +name = "toml_datetime" +version = "1.1.3+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "173f25c883cd2176a2d8212155638c0a60d484a9d84546d270866f40f56b6e49" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_edit" +version = "0.25.21+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88497dab46de5bf343ec66b05c251e48c6213f3e9170c70a70a823f7abe886a4" +dependencies = [ + "indexmap 2.14.2", + "toml_datetime", + "toml_parser", + "winnow", +] + +[[package]] +name = "toml_parser" +version = "1.1.7+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb28d6e049a9766c3bd91a8326e6179f5b132dec87906bb97018ef7a2f3431a" +dependencies = [ + "winnow", +] + +[[package]] +name = "toml_writer" +version = "1.2.0+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "009dbb7700f11c55ef83aebbe4c0e9cf1f1ac0844bd8d6f00dc38f302026e13a" + +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840" +dependencies = [ + "bitflags", + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", + "url", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "trash" +version = "5.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7363f9516b65bd2e855f4e6c3338b1a98efc2773c25349c958908897e1170ded" +dependencies = [ + "jiff 1.1.0", + "libc", + "log", + "objc2", + "objc2-foundation", + "once_cell", + "percent-encoding", + "scopeguard", + "urlencoding", + "windows", + "windows-core", +] + +[[package]] +name = "tray-icon" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19886363e700addca09f3787a1394eda88a80c89b9305f96effb9ea5ce09146d" +dependencies = [ + "crossbeam-channel", + "dirs", + "libappindicator", + "muda", + "objc2", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation", + "png", + "serde", + "thiserror 2.0.21", + "windows-sys 0.61.2", +] + +[[package]] +name = "tree_magic_mini" +version = "3.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8765b90061cba6c22b5831f675da109ae5561588290f9fa2317adab2714d5a6" +dependencies = [ + "memchr", + "nom", + "petgraph", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "typeid" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c" + +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + +[[package]] +name = "uds_windows" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e" +dependencies = [ + "memoffset", + "tempfile", + "windows-sys 0.61.2", +] + +[[package]] +name = "unicode-ident" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" + +[[package]] +name = "unicode-segmentation" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" + +[[package]] +name = "url" +version = "2.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f00cd2407bb42c0ef17be88d4cf020f5cceffd121665bac9b8b9493a369b3b1a" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", + "serde_derive", +] + +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + +[[package]] +name = "urlpattern" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df16f50ef4cc145211879a3867ba757076b25dfee812040dcb0658bd9ae7904b" +dependencies = [ + "icu_properties", + "regex", + "serde", + "url", +] + +[[package]] +name = "utf8_iter" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af3bd9d3e571c26fcce9d033b87ea5ab061b8d2ffe9b7a5675d810d68f03edf0" +dependencies = [ + "utf_types", +] + +[[package]] +name = "utf_types" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a3b425286980a367278453f3b6d28cdcb134b574e5a35824a6ff5eebad50bb6" + +[[package]] +name = "uuid" +version = "1.29.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c14b15dffa2f4bd712103e857140aa04a4f2ff6e955c77d7eb8e53ee02a3b64" +dependencies = [ + "getrandom 0.4.3", + "js-sys", + "serde_core", + "wasm-bindgen", +] + +[[package]] +name = "version-compare" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03c2856837ef78f57382f06b2b8563a2f512f7185d732608fd9176cb3b8edf0e" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "vswhom" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be979b7f07507105799e854203b470ff7c78a1639e330a58f183b5fea574608b" +dependencies = [ + "libc", + "vswhom-sys", +] + +[[package]] +name = "vswhom-sys" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb067e4cbd1ff067d1df46c9194b5de0e98efd2810bbc95c5d5e5f25a3231150" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "walkdir" +version = "2.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42e295b7452c4604982280d8586001fcad9b8b201cac67bca9771e7a7475403" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec4cdd0dd910afe868b7ef477227d8d538b46b3075031afee8a9f2acb0a2ed0b" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.4+wasi-0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0181c14ddd6c7b8b0b0132a5f1ea2f32be0d893cd3ea97b6e3b28886b8a3d1c" +dependencies = [ + "cfg-if", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e14e0327cb5368ad60ccb22d04a9827a693c95a926d8d125e9fa39e0baec501" +dependencies = [ + "js-sys", + "tokio", + "wasm-bindgen", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e931a02a39abdbf66966fc35902b5ed58344750a70885bed4ebb3d8eaf28ed9" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ca4b54280e455bd831e33a6b8e734baf432fe63fbc35c42ac14ce67a043a53a" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 3.0.10", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b1f9c3798725016c6ee5f2f57869ec0831e8bbc0ab0310a86e787e97f41389e" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wasm-streams" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1ec4f6517c9e11ae630e200b2b65d193279042e28edd4a2cda233e46670bbb" +dependencies = [ + "futures-util", + "js-sys", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "wayland-backend" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38a91b4eaddff87b1cd1074985e3713da4af2c49742d1b356b2c01670a67a078" +dependencies = [ + "cc", + "downcast-rs", + "rustix", + "smallvec", + "wayland-sys", +] + +[[package]] +name = "wayland-client" +version = "0.31.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3c36a0f861ad76d0901f2800b46321410d9f73f2ea88aac0650d86c32688073" +dependencies = [ + "bitflags", + "rustix", + "wayland-backend", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols" +version = "0.32.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23d0c813de3daa2ed6520af85a3bd49b0e722a3078506899aa9686fea58dc4b6" +dependencies = [ + "bitflags", + "wayland-backend", + "wayland-client", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-wlr" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb04e52f7836d7c7976c78ca0250d61e33873c34156a2a1fc9474828ec268234" +dependencies = [ + "bitflags", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-scanner" +version = "0.31.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "338e30461b3a2b67d70eb30a6d89f8e0c93a833e07d2ae89085cd070c4a00ac0" +dependencies = [ + "proc-macro2", + "quick-xml 0.41.0", + "quote", +] + +[[package]] +name = "wayland-sys" +version = "0.31.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8eab23fefc9e41f8e841df4a9c707e8a8c4ed26e944ef69297184de2785e3be" +dependencies = [ + "pkg-config", +] + +[[package]] +name = "web-sys" +version = "0.3.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7d179596ff5ec0f6de4db64d54011bde6289cc49603d3a6e4ce3f329207ab88" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web_atoms" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7572660c8890448ba236b7376f27e389c6a7e1c70195622faced601f855c0ada" +dependencies = [ + "phf", + "phf_codegen", + "string_cache", + "string_cache_codegen", +] + +[[package]] +name = "webkit2gtk" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c626604de3cf25b809e97bdb771509428fbfa6f0b9ed45ef2e8eacedeee3c8" +dependencies = [ + "bitflags", + "cairo-rs", + "gdk", + "gdk-sys", + "gio", + "gio-sys", + "glib", + "glib-sys", + "gobject-sys", + "gtk", + "gtk-sys", + "javascriptcore-rs", + "libc", + "once_cell", + "soup3", + "webkit2gtk-sys", +] + +[[package]] +name = "webkit2gtk-sys" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99707dd86d56ab2cc7a35b083220067d28f293194f349df3afc92427f230a95b" +dependencies = [ + "bitflags", + "cairo-sys-rs", + "gdk-sys", + "gio-sys", + "glib-sys", + "gobject-sys", + "gtk-sys", + "javascriptcore-rs-sys", + "libc", + "pkg-config", + "soup3-sys", + "system-deps 9.0.1", +] + +[[package]] +name = "webview2-com" +version = "0.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f89fca7a704cee10dcb3654c1dbb8941d1783132f1917358af75bec37a7d7e6" +dependencies = [ + "webview2-com-macros", + "webview2-com-sys", + "windows", + "windows-core", +] + +[[package]] +name = "webview2-com-macros" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a921c1b6914c367b2b823cd4cde6f96beec77d30a939c8199bb377cf9b9b54" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "webview2-com-sys" +version = "0.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3a07132775117d6065853d9d1178157b8c90e228de47129d6bce2c7edebedfb" +dependencies = [ + "thiserror 2.0.21", + "windows", + "windows-core", +] + +[[package]] +name = "weezl" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "window-vibrancy" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "111e51caca442cafd9bab396628ac4d814880eaea4e63dfd76a12e9f342b5580" +dependencies = [ + "objc2", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-foundation", + "objc2-quartz-core", + "raw-window-handle", + "windows-sys 0.61.2", + "windows-version", +] + +[[package]] +name = "windows" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" +dependencies = [ + "windows-collections", + "windows-core", + "windows-future", + "windows-numerics", +] + +[[package]] +name = "windows-collections" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" +dependencies = [ + "windows-core", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link 0.2.1", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-future" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" +dependencies = [ + "windows-core", + "windows-link 0.2.1", + "windows-threading", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-link" +version = "0.101.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4e57b2aae53a240c62b65069a63eaf8d5fa747f5d0d8e670c5210a98847bce4" + +[[package]] +name = "windows-numerics" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" +dependencies = [ + "windows-core", + "windows-link 0.2.1", +] + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.5", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-sys" +version = "0.101.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eed2df9f5f458664c87437f6758f0d93085b06433bf66b2b84c23c19f3d2012c" +dependencies = [ + "windows-link 0.101.0", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm 0.52.6", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.53.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +dependencies = [ + "windows-link 0.2.1", + "windows_aarch64_gnullvm 0.53.1", + "windows_aarch64_msvc 0.53.1", + "windows_i686_gnu 0.53.1", + "windows_i686_gnullvm 0.53.1", + "windows_i686_msvc 0.53.1", + "windows_x86_64_gnu 0.53.1", + "windows_x86_64_gnullvm 0.53.1", + "windows_x86_64_msvc 0.53.1", +] + +[[package]] +name = "windows-threading" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-version" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4060a1da109b9d0326b7262c8e12c84df67cc0dbc9e33cf49e01ccc2eb63631" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_i686_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" + +[[package]] +name = "winnow" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3b93199df0ab874cdf0c6a94f0a0dc3423fe41f1cafb62b8bd7b1deb277aef" +dependencies = [ + "memchr", +] + +[[package]] +name = "winreg" +version = "0.56.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d6f32a0ff4a9f6f01231eb2059cc85479330739333e0e58cadf03b6af2cca10" +dependencies = [ + "cfg-if", + "windows-sys 0.61.2", +] + +[[package]] +name = "wit-bindgen" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "wl-clipboard-rs" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "959c7ac3b8afde864f7a7448ac16f29b2b83350b7eccbf77fb781c3999aa6848" +dependencies = [ + "libc", + "log", + "os_pipe", + "rustix", + "thiserror 2.0.21", + "tree_magic_mini", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-protocols-wlr", +] + +[[package]] +name = "writeable" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" + +[[package]] +name = "wry" +version = "0.58.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9fadb3ce0a4ec6f7acddf364af8bbf14f5a1e532e5d5eed3b8141cdd3b3a774" +dependencies = [ + "base64 0.23.1", + "block2", + "cookie", + "crossbeam-channel", + "dirs", + "dom_query", + "dpi", + "dunce", + "gdkx11", + "gtk", + "http", + "javascriptcore-rs", + "jni", + "libc", + "ndk", + "objc2", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-foundation", + "objc2-ui-kit", + "objc2-web-kit", + "percent-encoding", + "raw-window-handle", + "sha2 0.11.3", + "soup3", + "tao-macros", + "thiserror 2.0.21", + "url", + "webkit2gtk", + "webkit2gtk-sys", + "webview2-com", + "windows", + "windows-core", + "windows-version", + "x11-dl", +] + +[[package]] +name = "x11" +version = "2.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "502da5464ccd04011667b11c435cb992822c2c0dbde1770c988480d312a0db2e" +dependencies = [ + "libc", + "pkg-config", +] + +[[package]] +name = "x11-dl" +version = "2.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f" +dependencies = [ + "libc", + "once_cell", + "pkg-config", +] + +[[package]] +name = "x11rb" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9993aa5be5a26815fe2c3eacfc1fde061fc1a1f094bf1ad2a18bf9c495dd7414" +dependencies = [ + "gethostname", + "rustix", + "x11rb-protocol", +] + +[[package]] +name = "x11rb-protocol" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd" + +[[package]] +name = "xdg-home" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec1cdab258fb55c0da61328dc52c8764709b249011b2cad0454c72f0bf10a1f6" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + +[[package]] +name = "yoke" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "417ef3fcf6c300b7dbd25c85531a746931c02ad536f3cf4786ed1e88223340b3" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", + "synstructure", +] + +[[package]] +name = "zbus" +version = "4.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb97012beadd29e654708a0fdb4c84bc046f537aecfde2c3ee0a9e4b4d48c725" +dependencies = [ + "async-broadcast", + "async-process", + "async-recursion", + "async-trait", + "enumflags2", + "event-listener", + "futures-core", + "futures-sink", + "futures-util", + "hex", + "nix", + "ordered-stream", + "rand", + "serde", + "serde_repr", + "sha1", + "static_assertions", + "tracing", + "uds_windows", + "windows-sys 0.52.0", + "xdg-home", + "zbus_macros 4.4.0", + "zbus_names 3.0.0", + "zvariant 4.2.0", +] + +[[package]] +name = "zbus" +version = "5.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5db4be7c075cb421e4b7ee645541604239bd243ba7c357511f4ff3a74b555907" +dependencies = [ + "async-broadcast", + "async-executor", + "async-io", + "async-lock", + "async-process", + "async-recursion", + "async-task", + "async-trait", + "blocking", + "enumflags2", + "event-listener", + "futures-core", + "futures-lite", + "hex", + "libc", + "ordered-stream", + "rustix", + "serde", + "serde_repr", + "tracing", + "uds_windows", + "uuid", + "windows-sys 0.61.2", + "winnow", + "zbus_macros 5.19.0", + "zbus_names 4.3.5", + "zvariant 5.15.1", +] + +[[package]] +name = "zbus_macros" +version = "4.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "267db9407081e90bbfa46d841d3cbc60f59c0351838c4bc65199ecd79ab1983e" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.119", + "zvariant_utils 2.1.0", +] + +[[package]] +name = "zbus_macros" +version = "5.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2990635d09ade6df1868f72f8cac69a876a90981e8bd3c40b1be413f8dc88f40" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 3.0.10", + "zbus_names 4.3.5", + "zvariant 5.15.1", + "zvariant_utils 4.2.0", +] + +[[package]] +name = "zbus_names" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b9b1fef7d021261cc16cba64c351d291b715febe0fa10dc3a443ac5a5022e6c" +dependencies = [ + "serde", + "static_assertions", + "zvariant 4.2.0", +] + +[[package]] +name = "zbus_names" +version = "4.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812a12be4ead7a59e18ea8f047d08add0066b73bc62fc1467066a2472ae088dd" +dependencies = [ + "serde", + "winnow", + "zvariant 5.15.1", +] + +[[package]] +name = "zcheapstr" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2da34e7164b75d803c3197b86e6cf61b874106fbd472c5082575a8bc5fbd0907" +dependencies = [ + "serde", +] + +[[package]] +name = "zerocopy" +version = "0.8.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cba8a86aee14fc8cc6c208af60854b3d4ab7185a9a369a12c648faa2716ff42a" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f89bca3b96ceb3cfcb4572790402f977442270d252b9a8504ebc258760c55f94" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85ccff8a4805aba1eaa4cd4afcd49f7557dd2cf5fd79ffc37f8959466effc5aa" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c50655cbb0fe3fc43170059e702f1ce5e19b84cec58dc87b037a09935c2f328" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zerotrie" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f58a2799cfe9a1670c7ea8edbd52ef8edb93cb37a7f83bf31ba9e35d9dae6a40" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3743ddbf47738d929cd1ae2e199d40d0162979dfe31aef8ae646d2bf00bf97a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "zlib-rs" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa76918995d776d9dd34d371030be228d021137449771493d56e29f77e4148ac" + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" + +[[package]] +name = "zune-core" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1a65ee146f41cb456b005bc898af3ab1495ded4ee61ac3637103f40ccacac18" + +[[package]] +name = "zune-jpeg" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27bc9d5b815bc103f142aa054f561d9187d191692ec7c2d1e2b4737f8dbd7296" +dependencies = [ + "zune-core", +] + +[[package]] +name = "zvariant" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2084290ab9a1c471c38fc524945837734fbf124487e105daec2bb57fd48c81fe" +dependencies = [ + "endi", + "enumflags2", + "serde", + "static_assertions", + "zvariant_derive 4.2.0", +] + +[[package]] +name = "zvariant" +version = "5.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80bf6d6cd6a4b601acb64cfb8284cdc643fcfa75ef26ae3c46ec8aa4e8a1fbb7" +dependencies = [ + "endi", + "enumflags2", + "serde", + "winnow", + "zcheapstr", + "zvariant_derive 5.15.1", + "zvariant_utils 4.2.0", +] + +[[package]] +name = "zvariant_derive" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73e2ba546bda683a90652bac4a279bc146adad1386f25379cf73200d2002c449" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.119", + "zvariant_utils 2.1.0", +] + +[[package]] +name = "zvariant_derive" +version = "5.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef2672456ba1cb54b5eaec136e63135b3c7495fb938e53b28a62e633496d486d" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 3.0.10", + "zvariant_utils 4.2.0", +] + +[[package]] +name = "zvariant_utils" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c51bcff7cc3dbb5055396bcf774748c3dab426b4b8659046963523cee4808340" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zvariant_utils" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bad0294361a320b694a328460dc73add56c306150f5cb6bfafc44446120008a3" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "syn 3.0.10", + "winnow", +] diff --git a/apps/ide/src-tauri/Cargo.toml b/apps/ide/src-tauri/Cargo.toml new file mode 100644 index 000000000..d41a62108 --- /dev/null +++ b/apps/ide/src-tauri/Cargo.toml @@ -0,0 +1,41 @@ +[package] +name = "codexr-ide" +version = "0.1.0" +description = "Code-XR IDE: the Tauri 2 desktop shell (Rust core) of the IDE, with the Node sidecar" +edition = "2021" +rust-version = "1.92" +license = "GPL-3.0-only" +publish = false + +# Its own workspace root: the IDE's Rust core is not part of any Cargo workspace. +[workspace] + +[[bin]] +name = "codexr-ide" +path = "src/main.rs" + +[build-dependencies] +tauri-build = { version = "2.8", features = [] } + +[dependencies] +# "unstable" turns on multiwebview (Window::add_child): the scene view beside the code (#483). +tauri = { version = "2.13", features = ["image-png", "unstable"] } +tauri-plugin-dialog = "2" +tauri-plugin-clipboard-manager = "2" +tauri-plugin-opener = "2" +tauri-plugin-single-instance = "2" +serde = { version = "1", features = ["derive"] } +serde_json = "1" +base64 = "0.22" +getrandom = "0.3" +trash = "5" +tokio = { version = "1", features = ["sync"] } +keyring = { version = "3", features = ["apple-native", "windows-native", "sync-secret-service", "crypto-rust"] } + +[profile.release] +# The size profile Tauri recommends (the R1 spike measured with it). +codegen-units = 1 +lto = true +opt-level = "s" +panic = "abort" +strip = true diff --git a/apps/ide/src-tauri/build.rs b/apps/ide/src-tauri/build.rs new file mode 100644 index 000000000..0162b289d --- /dev/null +++ b/apps/ide/src-tauri/build.rs @@ -0,0 +1,10 @@ +fn main() { + // The commands of the IDE are declared, so only a capability can allow them: + // capabilities/app.json grants codexr_ipc, codexr_events and codexr_log to the main window's local pages, + // capabilities/scene.json the scene bridge's to the scene views' loopback pages. + tauri_build::try_build( + tauri_build::Attributes::new() + .app_manifest(tauri_build::AppManifest::new().commands(&["codexr_ipc", "codexr_events", "codexr_log", "codexr_scene"])), + ) + .expect("failed to run tauri-build"); +} diff --git a/apps/ide/src-tauri/capabilities/app.json b/apps/ide/src-tauri/capabilities/app.json new file mode 100644 index 000000000..6371d15d9 --- /dev/null +++ b/apps/ide/src-tauri/capabilities/app.json @@ -0,0 +1,18 @@ +{ + "$schema": "../gen/schemas/desktop-schema.json", + "identifier": "app", + "description": "The IDE's own pages (codexr://app/, http://codexr.localhost/ on Windows) in the main window may call the IDE commands (IPC, events, error log) and nothing else. WebView2 serves the custom scheme as http://codexr.localhost/, which Tauri's ACL counts as a remote URL, so it is named here; only the core's own scheme handler answers that host.", + "windows": [ + "main" + ], + "permissions": [ + "allow-codexr-ipc", + "allow-codexr-events", + "allow-codexr-log" + ], + "remote": { + "urls": [ + "http://codexr.localhost/*" + ] + } +} diff --git a/apps/ide/src-tauri/capabilities/scene.json b/apps/ide/src-tauri/capabilities/scene.json new file mode 100644 index 000000000..21786729d --- /dev/null +++ b/apps/ide/src-tauri/capabilities/scene.json @@ -0,0 +1,11 @@ +{ + "$schema": "../gen/schemas/desktop-schema.json", + "identifier": "scene", + "description": "The scene views (webviews scene-*), on pages of the local Code-XR analysis server, may send the scene bridge's one message and nothing else.", + "webviews": ["scene-*"], + "local": false, + "remote": { + "urls": ["http://127.0.0.1:*/*", "http://localhost:*/*", "https://127.0.0.1:*/*", "https://localhost:*/*"] + }, + "permissions": ["allow-codexr-scene"] +} diff --git a/apps/ide/src-tauri/src/assets.rs b/apps/ide/src-tauri/src/assets.rs new file mode 100644 index 000000000..6c45d0511 --- /dev/null +++ b/apps/ide/src-tauri/src/assets.rs @@ -0,0 +1,168 @@ +//! The `codexr` scheme (#480): the built renderer (apps/ide/out/renderer), +//! served at `codexr://app/` on Linux and macOS and at +//! `http://codexr.localhost/` on Windows (WebView2 maps custom schemes so), +//! with the IDE's Content-Security-Policy and `nosniff` on every response, +//! as Electron's `serveRenderer` does (src/main/appProtocol.ts). +//! +//! Tauri's own CSP injection is off (`security.csp: null`, +//! `dangerousDisableAssetCspModification`): it would add nonces and hashes +//! to `style-src`, which cancel `'unsafe-inline'` that Monaco needs. The +//! policy is the one src/main/security.ts builds; the sidecar hands it over +//! when it opens the window. + +use std::path::{Component, Path, PathBuf}; + +use tauri::http::{header, Request, Response, StatusCode}; +use tauri::Url; + +use crate::host::Shell; + +pub const APP_SCHEME: &str = "codexr"; +pub const APP_HOST: &str = "app"; + +/// Whether a page URL is the IDE's own (the only pages that may call the core or be navigated to). +pub fn is_app_url(url: &Url) -> bool { + match url.scheme() { + APP_SCHEME => url.host_str() == Some(APP_HOST), + "http" | "https" if cfg!(windows) => url.host_str() == Some("codexr.localhost"), + _ => false, + } +} + +fn mime_type(path: &Path) -> &'static str { + match path.extension().and_then(|ext| ext.to_str()).map(str::to_ascii_lowercase).as_deref() { + Some("html") => "text/html; charset=utf-8", + Some("js") | Some("mjs") | Some("cjs") => "text/javascript; charset=utf-8", + Some("css") => "text/css; charset=utf-8", + Some("json") | Some("map") => "application/json", + Some("wasm") => "application/wasm", + Some("svg") => "image/svg+xml", + Some("png") => "image/png", + Some("jpg") | Some("jpeg") => "image/jpeg", + Some("gif") => "image/gif", + Some("webp") => "image/webp", + Some("ico") => "image/x-icon", + Some("ttf") => "font/ttf", + Some("otf") => "font/otf", + Some("woff") => "font/woff", + Some("woff2") => "font/woff2", + Some("txt") => "text/plain; charset=utf-8", + _ => "application/octet-stream", + } +} + +fn percent_decode(text: &str) -> Option { + let bytes = text.as_bytes(); + let mut out = Vec::with_capacity(bytes.len()); + let mut i = 0; + while i < bytes.len() { + if bytes[i] == b'%' { + let hex = std::str::from_utf8(bytes.get(i + 1..i + 3)?).ok()?; + out.push(u8::from_str_radix(hex, 16).ok()?); + i += 3; + } else { + out.push(bytes[i]); + i += 1; + } + } + String::from_utf8(out).ok() +} + +/// A file of the renderer folder for a request path, or None (outside it, missing, or a folder). +pub fn resolve_asset(root: &Path, request_path: &str) -> Option { + let decoded = percent_decode(request_path)?; + let relative = decoded.trim_start_matches('/'); + let relative = if relative.is_empty() { "index.html" } else { relative }; + let mut file = root.to_path_buf(); + for component in Path::new(relative).components() { + match component { + Component::Normal(part) => file.push(part), + _ => return None, + } + } + let real = file.canonicalize().ok()?; + let real_root = root.canonicalize().ok()?; + (real.starts_with(&real_root) && real.is_file()).then_some(real) +} + +fn plain(status: StatusCode, text: &str) -> Response> { + Response::builder() + .status(status) + .header(header::CONTENT_TYPE, "text/plain; charset=utf-8") + .header("X-Content-Type-Options", "nosniff") + .body(text.as_bytes().to_vec()) + .expect("valid response") +} + +/// Whether a request reached the app's scheme handler for the app's host. WebView2 has no +/// custom schemes: the page is `http://codexr.localhost/`, and wry hands the handler the +/// request rewritten back as `codexr://localhost/` (wry's custom_protocol_workaround). +pub fn is_app_request(scheme: Option<&str>, host: Option<&str>, windows: bool) -> bool { + match scheme { + Some(APP_SCHEME) => host == Some(APP_HOST) || (windows && host == Some("localhost")), + Some("http") | Some("https") => windows && host == Some("codexr.localhost"), + _ => false, + } +} + +pub fn serve(shell: &Shell, request: &Request>) -> Response> { + let uri = request.uri(); + if !is_app_request(uri.scheme_str(), uri.host(), cfg!(windows)) { + eprintln!("[codexr-ide] Refused a request for {uri}: not the app."); + return plain(StatusCode::NOT_FOUND, "Not found"); + } + crate::trace(format_args!("serve {}", uri.path())); + let Some(file) = resolve_asset(&shell.renderer_dir(), uri.path()) else { + eprintln!("[codexr-ide] Not found: {uri}"); + return plain(StatusCode::NOT_FOUND, "Not found"); + }; + match std::fs::read(&file) { + Ok(bytes) => Response::builder() + .status(StatusCode::OK) + .header(header::CONTENT_TYPE, mime_type(&file)) + .header("Content-Security-Policy", shell.csp()) + .header("X-Content-Type-Options", "nosniff") + .body(bytes) + .expect("valid response"), + Err(_) => plain(StatusCode::NOT_FOUND, "Not found"), + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn resolves_only_files_inside_the_renderer() { + let root = std::env::temp_dir().join(format!("codexr-assets-{}", std::process::id())); + std::fs::create_dir_all(root.join("assets")).unwrap(); + std::fs::write(root.join("index.html"), "x").unwrap(); + std::fs::write(root.join("assets").join("a b.js"), "x").unwrap(); + assert!(resolve_asset(&root, "/").unwrap().ends_with("index.html")); + assert!(resolve_asset(&root, "/assets/a%20b.js").is_some()); + assert!(resolve_asset(&root, "/../Cargo.toml").is_none()); + assert!(resolve_asset(&root, "/assets/%2e%2e/%2e%2e/etc/passwd").is_none()); + assert!(resolve_asset(&root, "/assets").is_none()); + assert!(resolve_asset(&root, "/missing.js").is_none()); + std::fs::remove_dir_all(&root).unwrap(); + } + + #[test] + fn serves_the_app_host_on_every_platform() { + assert!(is_app_request(Some("codexr"), Some("app"), false)); + assert!(!is_app_request(Some("codexr"), Some("localhost"), false)); + assert!(!is_app_request(Some("http"), Some("codexr.localhost"), false)); + // Windows: what wry hands the handler for http://codexr.localhost/index.html. + assert!(is_app_request(Some("codexr"), Some("localhost"), true)); + assert!(is_app_request(Some("http"), Some("codexr.localhost"), true)); + assert!(!is_app_request(Some("codexr"), Some("evil"), true)); + assert!(!is_app_request(Some("https"), Some("example.com"), true)); + } + + #[test] + fn only_the_app_origin_is_the_app() { + assert!(is_app_url(&Url::parse("codexr://app/index.html?locale=en").unwrap())); + assert!(!is_app_url(&Url::parse("codexr://evil/index.html").unwrap())); + assert!(!is_app_url(&Url::parse("https://example.com/").unwrap())); + } +} diff --git a/apps/ide/src-tauri/src/host.rs b/apps/ide/src-tauri/src/host.rs new file mode 100644 index 000000000..2808361a6 --- /dev/null +++ b/apps/ide/src-tauri/src/host.rs @@ -0,0 +1,462 @@ +//! What the sidecar asks of the desktop (`host.` requests, #482): the +//! Tauri side of src/sidecar/tauriHost.ts. Windows and webviews, dialogs +//! (plugin-dialog), clipboard (plugin-clipboard-manager), opening links and +//! revealing files (plugin-opener), the trash (crate `trash`), the theme and +//! one key in the OS keyring (crate `keyring`) for the secret store. + +use std::collections::HashSet; +use std::path::PathBuf; +use std::sync::{Arc, Condvar, Mutex}; +use std::time::Duration; + +use base64::Engine; +use serde_json::{json, Value}; +use tauri::image::Image; +use tauri::webview::{NewWindowResponse, PageLoadEvent}; +use tauri::{AppHandle, LogicalSize, Manager, Theme, Url, WebviewUrl, Window, WebviewWindowBuilder}; +use tauri_plugin_clipboard_manager::ClipboardExt; +use tauri_plugin_dialog::{DialogExt, MessageDialogButtons, MessageDialogKind, MessageDialogResult}; +use tauri_plugin_opener::OpenerExt; + +use crate::assets; +use crate::scene::{self, Scenes}; +use crate::sidecar::Sidecar; + +/// What the shell knows beside the sidecar: where the build is, the bridge scripts, the CSP, the scenes. +pub struct Shell { + out: PathBuf, + bridge: String, + /// The scene view's initialization script (src/sceneBridge), empty when it was not built. + scene_bridge: String, + /// The scene views open now (scene.rs). + pub scenes: Scenes, + /// The IDE's policy, handed over by the sidecar as it starts; None until then. + csp: Mutex>, + csp_ready: Condvar, + /// The URL the core loaded the main window with at launch (the sidecar checks it). + main_url: Mutex>, + closing: Mutex>, +} + +/// What is served while no policy can come any more (the sidecar died before sending it). +const LOCKED_CSP: &str = "default-src 'none'"; +/// A window whose page has not loaded by then is shown anyway. +const SHOW_ANYWAY_AFTER: Duration = Duration::from_secs(10); +/// How long a request of the page waits for the sidecar's policy. +const CSP_WAIT: Duration = Duration::from_secs(60); + +impl Shell { + pub fn new(out: PathBuf, bridge: String, scene_bridge: String) -> Self { + Self { + out, + bridge, + scene_bridge, + scenes: Scenes::default(), + csp: Mutex::new(None), + csp_ready: Condvar::new(), + main_url: Mutex::new(None), + closing: Mutex::new(HashSet::new()), + } + } + + pub fn scene_bridge(&self) -> String { + self.scene_bridge.clone() + } + + pub fn renderer_dir(&self) -> PathBuf { + self.out.join("renderer") + } + + /// The policy of the app's pages. The window loads while the sidecar boots, so its + /// first requests wait here (on the protocol's own threads) until the sidecar sends it. + pub fn csp(&self) -> String { + let guard = self.csp.lock().unwrap(); + let (guard, _) = self.csp_ready.wait_timeout_while(guard, CSP_WAIT, |csp| csp.is_none()).unwrap(); + guard.clone().unwrap_or_else(|| LOCKED_CSP.into()) + } + + pub fn set_csp(&self, csp: &str) { + crate::trace("policy received"); + *self.csp.lock().unwrap() = Some(csp.to_string()); + self.csp_ready.notify_all(); + } + + /// The sidecar is gone: nothing waits for its policy any more, and nothing loads. + pub fn release_csp(&self) { + let mut csp = self.csp.lock().unwrap(); + if csp.is_none() { + *csp = Some(LOCKED_CSP.into()); + } + self.csp_ready.notify_all(); + } + + /// A window the sidecar destroys closes without asking it again. + pub fn close_allowed(&self, label: &str) -> bool { + self.closing.lock().unwrap().contains(label) + } +} + +fn str_param<'a>(params: &'a Value, key: &str) -> Option<&'a str> { + params.get(key).and_then(Value::as_str) +} + +fn required<'a>(params: &'a Value, key: &str) -> Result<&'a str, String> { + str_param(params, key).ok_or_else(|| format!("missing {key}")) +} + +/// A window by label. Not `get_webview_window`: a window with the scene view beside +/// its page holds two webviews, and Tauri no longer sees it as a webview window (#483). +fn window_of(app: &AppHandle, params: &Value) -> Result { + let label = required(params, "window")?; + app.get_window(label).ok_or_else(|| format!("no window {label}")) +} + +/// The Code-XR logo, the file the extension uses as its icon (as Electron's window.ts does). +fn window_icon(shell: &Shell) -> Option> { + let file = shell.out.join("..").join("..").join("vscode-extension").join("resources").join("icon.png"); + Image::from_path(file).ok() +} + +pub fn show_fatal(app: &AppHandle, message: &str) { + app.dialog() + .message(message) + .title("Code-XR") + .kind(MessageDialogKind::Error) + .buttons(MessageDialogButtons::Ok) + .blocking_show(); +} + +/// The host requests answered on the reader thread, in the order they came: the +/// scene view's place (a hide after a show must not overtake it). Each only posts +/// to the event loop, so it never blocks the reader. +pub fn runs_in_order(method: &str) -> bool { + method == "host.scene.setBounds" +} + +pub fn handle(app: &AppHandle, sidecar: &Arc, op: &str, params: &Value) -> Result { + let shell = app.state::>().inner().clone(); + match op { + "window.create" => create_window(app, &shell, sidecar, params), + "window.attach" => { + // The sidecar adopts the window the core opened at launch and hands over the policy. + shell.set_csp(required(params, "csp")?); + Ok(shell.main_url.lock().unwrap().clone().map(Value::String).unwrap_or(Value::Null)) + } + "window.navigate" => { + let url: Url = required(params, "url")?.parse().map_err(|error| format!("bad url: {error}"))?; + if !assets::is_app_url(&url) { + return Err(format!("Refused to load {url}: not the app.")); + } + let label = required(params, "window")?; + app.get_webview(label).ok_or_else(|| format!("no webview {label}"))?.navigate(url).map_err(|error| error.to_string())?; + Ok(Value::Null) + } + "window.focus" => { + let window = window_of(app, params)?; + let _ = window.unminimize(); + window.set_focus().map_err(|error| error.to_string())?; + Ok(Value::Null) + } + "webview.focus" => { + // Electron's webContents.focus(): the window, then the keyboard into this webview + // (out of the scene view beside it, when the scene had it). + let label = required(params, "window")?; + let webview = app.get_webview(label).ok_or_else(|| format!("no webview {label}"))?; + let window = webview.window(); + let _ = window.unminimize(); + window.set_focus().map_err(|error| error.to_string())?; + webview.set_focus().map_err(|error| error.to_string())?; + Ok(Value::Null) + } + "window.show" => { + window_of(app, params)?.show().map_err(|error| error.to_string())?; + Ok(Value::Null) + } + "window.setTitle" => { + window_of(app, params)?.set_title(required(params, "title")?).map_err(|error| error.to_string())?; + Ok(Value::Null) + } + "window.close" | "window.destroy" => { + let window = window_of(app, params)?; + shell.closing.lock().unwrap().insert(window.label().to_string()); + window.destroy().map_err(|error| error.to_string())?; + Ok(Value::Null) + } + "dialog.open" => open_dialog(app, params), + "dialog.save" => save_dialog(app, params), + "dialog.message" => message_dialog(app, params), + "clipboard.writeText" => { + app.clipboard().write_text(required(params, "text")?.to_string()).map_err(|error| error.to_string())?; + Ok(Value::Null) + } + "clipboard.readText" => Ok(Value::String(app.clipboard().read_text().unwrap_or_default())), + "shell.openExternal" => { + let url = required(params, "url")?; + let scheme = Url::parse(url).map(|parsed| parsed.scheme().to_string()).unwrap_or_default(); + if !matches!(scheme.as_str(), "http" | "https" | "mailto") { + return Err("Only http, https and mailto links open outside the IDE.".into()); + } + app.opener().open_url(url, None::<&str>).map_err(|error| error.to_string())?; + Ok(Value::Null) + } + "shell.showItemInFolder" => { + app.opener().reveal_item_in_dir(required(params, "path")?).map_err(|error| error.to_string())?; + Ok(Value::Null) + } + "shell.openPath" => { + app.opener().open_path(required(params, "path")?, None::<&str>).map_err(|error| error.to_string())?; + Ok(Value::Null) + } + "shell.trashItem" => { + trash::delete(required(params, "path")?).map_err(|error| error.to_string())?; + Ok(Value::Null) + } + "theme.set" => { + let theme = match str_param(params, "theme") { + Some("dark") => Some(Theme::Dark), + Some("light") => Some(Theme::Light), + _ => None, + }; + app.set_theme(theme); + let dark = app.get_window("main").and_then(|window| window.theme().ok()).map(|theme| theme == Theme::Dark); + Ok(dark.map(Value::Bool).unwrap_or(Value::Null)) + } + "secrets.masterKey" => master_key(), + "app.exit" => { + let code = params.get("code").and_then(Value::as_i64).unwrap_or(0) as i32; + sidecar.begin_exit(); + app.exit(code); + Ok(Value::Null) + } + op if op.starts_with("scene.") => scene::handle(app, &shell, sidecar, op, params), + "app.info" => Ok(json!({ + "version": app.package_info().version.to_string(), + "tauri": tauri::VERSION, + "webview": tauri::webview_version().unwrap_or_default(), + })), + _ => Err(format!("Unknown host operation {op}.")), + } +} + +/// The main window, opened by the core at launch (before the sidecar is up) so the +/// webview's processes start and the page loads while the sidecar boots. `?locale=` +/// is the core's guess (locale.rs); the sidecar reloads with its own decision if they differ. +pub const MAIN_WINDOW: &str = "main"; + +pub fn main_window_url(locale: &str, bench: bool) -> Url { + let base = if cfg!(windows) { "http://codexr.localhost/index.html" } else { "codexr://app/index.html" }; + let mut url: Url = base.parse().expect("valid app URL"); + url.query_pairs_mut().append_pair("locale", locale); + if bench { + url.query_pairs_mut().append_pair("bench", "1"); + } + url +} + +pub fn open_main_window(app: &AppHandle, shell: &Arc, sidecar: &Arc, url: Url) -> Result<(), String> { + *shell.main_url.lock().unwrap() = Some(url.to_string()); + let spec = WindowSpec { label: MAIN_WINDOW.into(), url, title: "Code-XR".into(), width: 1280.0, height: 800.0, min_width: 640.0, min_height: 400.0, show: true }; + build_window(app, shell, sidecar, spec) +} + +struct WindowSpec { + label: String, + url: Url, + title: String, + width: f64, + height: f64, + min_width: f64, + min_height: f64, + show: bool, +} + +fn create_window(app: &AppHandle, shell: &Arc, sidecar: &Arc, params: &Value) -> Result { + let url: Url = required(params, "url")?.parse().map_err(|error| format!("bad url: {error}"))?; + if let Some(csp) = str_param(params, "csp") { + shell.set_csp(csp); + } + let number = |key: &str, fallback: f64| params.get(key).and_then(Value::as_f64).unwrap_or(fallback); + let spec = WindowSpec { + label: required(params, "window")?.to_string(), + url, + title: str_param(params, "title").unwrap_or("Code-XR").to_string(), + width: number("width", 1280.0), + height: number("height", 800.0), + min_width: number("minWidth", 640.0), + min_height: number("minHeight", 400.0), + show: params.get("show").and_then(Value::as_bool).unwrap_or(true), + }; + build_window(app, shell, sidecar, spec)?; + Ok(Value::Null) +} + +fn build_window(app: &AppHandle, shell: &Arc, sidecar: &Arc, spec: WindowSpec) -> Result<(), String> { + if !assets::is_app_url(&spec.url) { + return Err(format!("Refused to open {}: not the app.", spec.url)); + } + let loads = sidecar.clone(); + let load_label = spec.label.clone(); + let show = spec.show; + let mut builder = WebviewWindowBuilder::new(app, &spec.label, WebviewUrl::CustomProtocol(spec.url)) + .title(spec.title) + .inner_size(spec.width, spec.height) + .min_inner_size(spec.min_width, spec.min_height) + // Shown once the page loaded, as Electron's window waits for ready-to-show + // (src/main/window.ts). It also spares WebKitGTK a blocking wait: a visible + // view painted before its web process is up stalls the UI thread for up to + // 500 ms (DidUpdateBackingStoreState), measured in the container. + .visible(false) + // window.codexr, before the page's own scripts (src/bridge, built to out/bridge/index.js). + .initialization_script(shell.bridge.clone()) + // Navigation stays inside the app; everything else is refused, as on Electron (hardening.ts). + .on_navigation(|url| { + let allowed = assets::is_app_url(url); + if !allowed { + eprintln!("[codexr-ide] Blocked navigation to {url}"); + } + allowed + }) + .on_new_window(|url, _features| { + eprintln!("[codexr-ide] Blocked a new window for {url}"); + NewWindowResponse::Deny + }) + .on_page_load(move |webview, payload| { + if payload.event() == PageLoadEvent::Started { + eprintln!("[codexr-ide] Loading {} in {}", payload.url(), webview.label()); + } + if payload.event() == PageLoadEvent::Finished && assets::is_app_url(payload.url()) { + loads.notify("window.event", json!({ "window": load_label, "event": "loaded", "url": payload.url().as_str() })); + if show && !webview.is_visible().unwrap_or(true) { + let _ = webview.show(); + } + } + }); + if let Some(icon) = window_icon(shell) { + builder = builder.icon(icon).map_err(|error| error.to_string())?; + } + crate::trace(format_args!("building window {}", spec.label)); + let window = builder.build().map_err(|error| error.to_string())?; + crate::trace(format_args!("built window {}", spec.label)); + let _ = window.set_min_size(Some(LogicalSize::new(spec.min_width, spec.min_height))); + if show { + // Never left invisible: a page that has not loaded by now is shown as it is. + std::thread::spawn(move || { + std::thread::sleep(SHOW_ANYWAY_AFTER); + if !window.is_visible().unwrap_or(true) { + eprintln!("[codexr-ide] {} has not finished loading after {} s: showing it.", window.label(), SHOW_ANYWAY_AFTER.as_secs()); + let _ = window.show(); + } + }); + } + Ok(()) +} + +fn parent_dialog(app: &AppHandle, params: &Value) -> Option> { + str_param(params, "window").and_then(|label| app.get_window(label)) +} + +fn with_filters(mut dialog: tauri_plugin_dialog::FileDialogBuilder, params: &Value) -> tauri_plugin_dialog::FileDialogBuilder { + if let Some(filters) = params.get("filters").and_then(Value::as_array) { + for filter in filters { + let name = filter.get("name").and_then(Value::as_str).unwrap_or(""); + let extensions: Vec<&str> = filter.get("extensions").and_then(Value::as_array).map(|list| list.iter().filter_map(Value::as_str).collect()).unwrap_or_default(); + if !extensions.is_empty() && !extensions.contains(&"*") { + dialog = dialog.add_filter(name, &extensions); + } + } + } + if let Some(title) = str_param(params, "title") { + dialog = dialog.set_title(title); + } + dialog +} + +fn path_value(path: tauri_plugin_dialog::FilePath) -> Option { + path.into_path().ok().map(|path| Value::String(path.to_string_lossy().into_owned())) +} + +fn open_dialog(app: &AppHandle, params: &Value) -> Result { + let mut dialog = with_filters(app.dialog().file(), params); + if let Some(window) = parent_dialog(app, params) { + dialog = dialog.set_parent(&window); + } + if let Some(default) = str_param(params, "defaultPath") { + dialog = dialog.set_directory(default); + } + let directory = params.get("directory").and_then(Value::as_bool).unwrap_or(false); + let multiple = params.get("multiple").and_then(Value::as_bool).unwrap_or(false); + let picked: Vec = match (directory, multiple) { + (true, true) => dialog.blocking_pick_folders().unwrap_or_default(), + (true, false) => dialog.blocking_pick_folder().into_iter().collect(), + (false, true) => dialog.blocking_pick_files().unwrap_or_default(), + (false, false) => dialog.blocking_pick_file().into_iter().collect(), + }; + Ok(Value::Array(picked.into_iter().filter_map(path_value).collect())) +} + +fn save_dialog(app: &AppHandle, params: &Value) -> Result { + let mut dialog = with_filters(app.dialog().file(), params); + if let Some(window) = parent_dialog(app, params) { + dialog = dialog.set_parent(&window); + } + if let Some(default) = str_param(params, "defaultPath") { + let default = PathBuf::from(default); + if let Some(parent) = default.parent().filter(|parent| !parent.as_os_str().is_empty()) { + dialog = dialog.set_directory(parent); + } + if let Some(name) = default.file_name() { + dialog = dialog.set_file_name(name.to_string_lossy()); + } + } + Ok(dialog.blocking_save_file().and_then(path_value).unwrap_or(Value::Null)) +} + +/// Up to three buttons (plugin-dialog's limit; more is R9). Answers the index of the button pressed. +fn message_dialog(app: &AppHandle, params: &Value) -> Result { + let buttons: Vec = params.get("buttons").and_then(Value::as_array).map(|list| list.iter().filter_map(Value::as_str).map(str::to_string).collect()).unwrap_or_default(); + let cancel = params.get("cancelId").and_then(Value::as_u64).unwrap_or(0); + let kind = match str_param(params, "kind") { + Some("error") => MessageDialogKind::Error, + Some("warning") | Some("question") => MessageDialogKind::Warning, + _ => MessageDialogKind::Info, + }; + let message = match str_param(params, "detail") { + Some(detail) if !detail.is_empty() => format!("{}\n\n{detail}", required(params, "message")?), + _ => required(params, "message")?.to_string(), + }; + let choices = match buttons.as_slice() { + [] => MessageDialogButtons::Ok, + [ok] => MessageDialogButtons::OkCustom(ok.clone()), + [ok, cancel] => MessageDialogButtons::OkCancelCustom(ok.clone(), cancel.clone()), + [yes, no, cancel] => MessageDialogButtons::YesNoCancelCustom(yes.clone(), no.clone(), cancel.clone()), + _ => return Err("Dialogs with more than three buttons are not yet on Tauri (R9).".into()), + }; + let mut dialog = app.dialog().message(message).title(str_param(params, "title").unwrap_or("Code-XR")).kind(kind).buttons(choices); + if let Some(window) = parent_dialog(app, params) { + dialog = dialog.parent(&window); + } + let index = match dialog.blocking_show_with_result() { + MessageDialogResult::Custom(label) => buttons.iter().position(|button| *button == label).map(|i| i as u64).unwrap_or(cancel), + MessageDialogResult::Ok | MessageDialogResult::Yes => 0, + MessageDialogResult::No => 1, + MessageDialogResult::Cancel => cancel, + }; + Ok(Value::from(index)) +} + +/// The secret store's key: 32 random bytes kept in the OS keyring, created on first use. +fn master_key() -> Result { + let entry = keyring::Entry::new("Code-XR IDE", "secret-store-key").map_err(|error| error.to_string())?; + let key = match entry.get_password() { + Ok(key) => key, + Err(keyring::Error::NoEntry) => { + let mut bytes = [0u8; 32]; + getrandom::fill(&mut bytes).map_err(|error| error.to_string())?; + let key = base64::engine::general_purpose::STANDARD.encode(bytes); + entry.set_password(&key).map_err(|error| error.to_string())?; + key + } + Err(error) => return Err(error.to_string()), + }; + Ok(json!({ "key": key, "backend": "keyring" })) +} diff --git a/apps/ide/src-tauri/src/locale.rs b/apps/ide/src-tauri/src/locale.rs new file mode 100644 index 000000000..7e7bb1651 --- /dev/null +++ b/apps/ide/src-tauri/src/locale.rs @@ -0,0 +1,65 @@ +//! The display language the core opens the main window in (#480), before the +//! sidecar has decided it: the renderer reads `?locale=` to draw in it from the +//! first paint (CI13, #405), and the window loads while the sidecar boots. +//! +//! The guess is the sidecar's own last decision, which it keeps in the app's +//! cache folder (`startup-locale`), so the `locale` setting and the OS are read +//! in one place only (src/main/displayLanguage.ts). With no such file (first +//! start, or a benchmark run, whose settings are its own) it is the first +//! language of the environment, as the sidecar reads it (LANGUAGE, LC_ALL, +//! LANG). The sidecar checks the guess and reloads the page in its own +//! decision when they differ, so a wrong guess costs time, never the language. + +use std::path::Path; + +pub const LOCALE_FILE: &str = "startup-locale"; + +/// A language tag's primary subtag, if it looks like one (`es_ES.UTF-8` -> `es`). +fn language_of(tag: &str) -> Option { + let language = tag.trim().split(['-', '_', '.', '@']).next()?.to_ascii_lowercase(); + let valid = (2..=8).contains(&language.len()) && language.bytes().all(|byte| byte.is_ascii_lowercase()); + (valid && language != "c" && language != "posix").then_some(language) +} + +/// The first language of the environment, read like tauriHost.ts's +/// getPreferredSystemLanguages: the first of LANGUAGE, LC_ALL, LANG that is set. +pub fn environment_language(get: impl Fn(&str) -> Option) -> Option { + let value = ["LANGUAGE", "LC_ALL", "LANG"].iter().find_map(|name| get(name))?; + value.split(':').find_map(language_of) +} + +pub fn initial_locale(cache_dir: Option<&Path>, bench: bool) -> String { + let remembered = if bench { None } else { cache_dir.and_then(|dir| std::fs::read_to_string(dir.join(LOCALE_FILE)).ok()) }; + remembered + .as_deref() + .and_then(language_of) + .or_else(|| environment_language(|name| std::env::var(name).ok())) + .unwrap_or_else(|| "en".into()) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn reads_the_environment_like_the_sidecar() { + let env = |pairs: &'static [(&'static str, &'static str)]| move |name: &str| pairs.iter().find(|(key, _)| *key == name).map(|(_, value)| value.to_string()); + assert_eq!(environment_language(env(&[("LANG", "es_ES.UTF-8")])).as_deref(), Some("es")); + assert_eq!(environment_language(env(&[("LANGUAGE", "C:es"), ("LANG", "en_US.UTF-8")])).as_deref(), Some("es")); + assert_eq!(environment_language(env(&[("LC_ALL", "C.UTF-8")])), None); + assert_eq!(environment_language(env(&[])), None); + // A set LANGUAGE wins even when empty, as `??` does in tauriHost.ts. + assert_eq!(environment_language(env(&[("LANGUAGE", ""), ("LANG", "es_ES")])), None); + } + + #[test] + fn prefers_the_sidecar_s_last_decision_except_in_a_benchmark() { + let dir = std::env::temp_dir().join(format!("codexr-locale-{}", std::process::id())); + std::fs::create_dir_all(&dir).unwrap(); + std::fs::write(dir.join(LOCALE_FILE), "es\n").unwrap(); + assert_eq!(initial_locale(Some(&dir), false), "es"); + std::fs::write(dir.join(LOCALE_FILE), "../x").unwrap(); + assert_ne!(initial_locale(Some(&dir), false), "../x"); + std::fs::remove_dir_all(&dir).unwrap(); + } +} diff --git a/apps/ide/src-tauri/src/main.rs b/apps/ide/src-tauri/src/main.rs new file mode 100644 index 000000000..15dca67f0 --- /dev/null +++ b/apps/ide/src-tauri/src/main.rs @@ -0,0 +1,276 @@ +//! Code-XR IDE: the Tauri 2 desktop shell (stories R2 #480, R3 #481, R4 #482 +//! of epic #477; plan in docs/ide/tauri-migration.md). +//! +//! The walking skeleton: this Rust core owns the window, serves the built +//! renderer at `codexr://app/` (`http://codexr.localhost/` on Windows) with +//! the IDE's Content-Security-Policy, blocks navigation off the app and new +//! windows, keeps one instance, and starts the Node sidecar +//! (`out/sidecar/index.cjs`), which runs the main-process services. Every +//! `window.codexr` call is the one command `codexr_ipc`, forwarded to the +//! sidecar; events come back on a Tauri channel per webview +//! (`codexr_events`). The sidecar asks this core for the desktop: windows, +//! dialogs, clipboard, opener, trash, theme and the keyring (host.rs). + +mod assets; +mod host; +mod locale; +mod scene; +mod sidecar; + +use std::path::PathBuf; +use std::sync::Arc; + +use serde_json::{json, Value}; +use tauri::ipc::Channel; +use tauri::{Manager, RunEvent, State, WindowEvent}; + +use crate::sidecar::Sidecar; + +/// When the process started, for `trace`. +static STARTED: std::sync::OnceLock = std::sync::OnceLock::new(); + +/// A start-up timing line on stderr, only with `CODEXR_IPC_TRACE` (CI diagnostics). +pub fn trace(message: impl std::fmt::Display) { + if std::env::var_os("CODEXR_IPC_TRACE").is_some() { + let elapsed = STARTED.get().map(|started| started.elapsed().as_millis()).unwrap_or(0); + eprintln!("[codexr-ide] +{elapsed} ms {message}"); + } +} + +/// Where the IDE's build output is: `CODEXR_IDE_OUT`, or apps/ide/out next to this crate (unpackaged; R12 packages it). +fn out_dir() -> PathBuf { + std::env::var_os("CODEXR_IDE_OUT") + .map(PathBuf::from) + .unwrap_or_else(|| PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("..").join("out")) +} + +/// A `window.codexr` call: forwarded to the sidecar, which checks the channel +/// against its allow-list and the page URL against the trusted origins +/// (`isTrustedIpcCall`), exactly as Electron's main process does. +#[tauri::command] +async fn codexr_ipc(webview: tauri::Webview, sidecar: State<'_, Arc>, channel: String, args: Vec) -> Result { + let url = webview.url().map_err(|error| error.to_string())?; + if !assets::is_app_url(&url) { + eprintln!("[codexr-ide] Refused IPC {channel} from {url}"); + return Err("Refused.".into()); + } + trace(format_args!("ipc {channel}")); + let result = sidecar + .request("ipc.invoke", json!({ "window": webview.label(), "url": url.as_str(), "channel": channel, "args": args })) + .await; + match &result { + Ok(value) => trace(format_args!("ipc {channel} answered ({} bytes)", value.to_string().len())), + Err(error) => trace(format_args!("ipc {channel} failed: {error}")), + } + result +} + +/// The page's uncaught errors and console errors (forwarded by the bridge), on the +/// core's stderr: Electron's main process sees them as console-message, and +/// without them a renderer failure on a CI runner leaves no trace. Only from the app. +#[tauri::command] +fn codexr_log(webview: tauri::Webview, level: String, message: String) -> Result<(), String> { + let url = webview.url().map_err(|error| error.to_string())?; + if !assets::is_app_url(&url) { + return Err("Refused.".into()); + } + let level = if level == "warn" { "warn" } else { "error" }; + let message: String = message.chars().take(4000).collect(); + eprintln!("[codexr-ide] page {level}: {message}"); + Ok(()) +} + +/// The bridge registers its event channel once per page load. +#[tauri::command] +fn codexr_events(webview: tauri::Webview, sidecar: State<'_, Arc>, channel: Channel) -> Result<(), String> { + let url = webview.url().map_err(|error| error.to_string())?; + if !assets::is_app_url(&url) { + return Err("Refused.".into()); + } + sidecar.events.register(webview.label(), channel); + Ok(()) +} + +/// The scene view's one message to the IDE (src/sceneBridge): only from a scene +/// view (`scene-*`, capabilities/scene.json) showing its own local server's page. +/// The sidecar checks what it asks for (ipc.ts: a path inside the open folder). +#[tauri::command] +fn codexr_scene(webview: tauri::Webview, shell: State<'_, Arc>, sidecar: State<'_, Arc>, message: Value) -> Result<(), String> { + let url = webview.url().map_err(|error| error.to_string())?; + let allowed = shell.scenes.origin_of(webview.label()).is_some_and(|origin| scene::is_scene_page(&url, &origin)); + if !allowed { + eprintln!("[codexr-ide] Refused a scene message from {} ({url})", webview.label()); + return Err("Refused.".into()); + } + sidecar.notify("scene.message", json!({ "webview": webview.label(), "url": url.as_str(), "message": message })); + Ok(()) +} + +/// Set by `software_rendering_defaults` (and so taken out of the sidecar's environment). +const DMABUF_SWITCH: &str = "WEBKIT_DISABLE_DMABUF_RENDERER"; + +/// Whether this machine has a DRM render node WebKitGTK could share buffers through. +fn has_render_node(dri: &std::path::Path) -> bool { + std::fs::read_dir(dri) + .map(|entries| entries.flatten().any(|entry| entry.file_name().to_string_lossy().starts_with("renderD") && std::fs::File::open(entry.path()).is_ok())) + .unwrap_or(false) +} + +/// WebKitGTK's DMA-BUF renderer with no render node to share buffers through +/// (a VM, a container, software GL) falls back to copying every frame through +/// shared memory: there, each paint of the idle IDE cost about 25 ms of CPU and +/// the web process 200 MB more. Measured in the container (Xvfb, llvmpipe, no +/// /dev/dri), median of 4: idle CPU 11.0 % -> 1.6 %, PSS 683 -> 470 MB, WebGL +/// scenes unchanged (the R1 spike's A-Frame scene: 25-29 -> 32-33 FPS). With a +/// render node (a real GPU) nothing changes; an explicit setting always wins. +/// Returns whether it set the switch. +#[cfg(target_os = "linux")] +fn software_rendering_defaults() -> bool { + if std::env::var_os(DMABUF_SWITCH).is_some() || has_render_node(std::path::Path::new("/dev/dri")) { + return false; + } + // Before any thread starts: nothing else reads the environment yet. + std::env::set_var(DMABUF_SWITCH, "1"); + eprintln!("[codexr-ide] No GPU render node: WebKitGTK's DMA-BUF renderer is off ({DMABUF_SWITCH}=1)."); + true +} + +#[cfg(not(target_os = "linux"))] +fn software_rendering_defaults() -> bool { + false +} + +fn main() { + let _ = STARTED.set(std::time::Instant::now()); + let set_dmabuf_switch = software_rendering_defaults(); + let args: Vec = std::env::args().skip(1).collect(); + let out = out_dir(); + let bridge = match std::fs::read_to_string(out.join("bridge").join("index.js")) { + Ok(script) => script, + Err(error) => { + eprintln!("[codexr-ide] The bridge is missing ({}): run `npm run tauri:build` first. {error}", out.join("bridge").display()); + std::process::exit(1); + } + }; + // The scene view's bridge (#483); without it the scene still opens, it only cannot open files in the editor. + let scene_bridge = std::fs::read_to_string(out.join("sceneBridge").join("index.js")).unwrap_or_else(|error| { + eprintln!("[codexr-ide] The scene bridge is missing ({}): {error}", out.join("sceneBridge").display()); + String::new() + }); + // A benchmark run may start while an IDE is open, as on Electron. + let single_instance = !args.iter().any(|arg| arg == "--codexr-bench"); + let sidecar = Arc::new(Sidecar::new()); + let shell = Arc::new(host::Shell::new(out.clone(), bridge, scene_bridge)); + + trace("main"); + let mut builder = tauri::Builder::default(); + if single_instance { + let sidecar = sidecar.clone(); + builder = builder.plugin(tauri_plugin_single_instance::init(move |app, argv, _cwd| { + // A window, not a webview window: with the scene view it holds two webviews (#483). + if let Some(window) = app.get_window("main") { + let _ = window.unminimize(); + let _ = window.set_focus(); + } + sidecar.notify("app.secondInstance", json!({ "argv": argv })); + })); + } + let app = builder + .plugin(tauri_plugin_dialog::init()) + .plugin(tauri_plugin_clipboard_manager::init()) + .plugin(tauri_plugin_opener::init()) + .manage(sidecar.clone()) + .manage(shell.clone()) + .register_asynchronous_uri_scheme_protocol(assets::APP_SCHEME, { + let shell = shell.clone(); + move |_ctx, request, responder| { + let shell = shell.clone(); + // Off the webview's thread: file reads. + std::thread::spawn(move || responder.respond(assets::serve(&shell, &request))); + } + }) + .invoke_handler(tauri::generate_handler![codexr_ipc, codexr_events, codexr_log, codexr_scene]) + .on_window_event({ + let sidecar = sidecar.clone(); + let shell = shell.clone(); + move |window, event| { + let label = window.label(); + match event { + WindowEvent::CloseRequested { api, .. } => { + // The sidecar decides (unsaved editors, #14), unless it is gone. + if sidecar.is_alive() && !shell.close_allowed(label) { + api.prevent_close(); + sidecar.notify("window.event", json!({ "window": label, "event": "close-requested" })); + } + } + WindowEvent::Destroyed => { + sidecar.events.forget(label); + sidecar.notify("window.event", json!({ "window": label, "event": "destroyed" })); + } + WindowEvent::Focused(focused) => { + sidecar.notify("window.event", json!({ "window": label, "event": if *focused { "focus" } else { "blur" } })); + } + _ => {} + } + } + }) + .setup({ + let sidecar = sidecar.clone(); + let shell = shell.clone(); + let out = out.clone(); + move |app| { + trace("setup"); + // The sidecar boots while the window's web processes start and the page + // loads: its policy and its IPC answers are awaited, never failed (host.rs, + // src/sidecar/index.ts). + let cache_dir = app.path().app_cache_dir().ok(); + // The switch is the webview's alone: the sidecar's children (terminals) do not inherit it. + let unset = if set_dmabuf_switch { vec![DMABUF_SWITCH] } else { Vec::new() }; + sidecar.start(app.handle().clone(), &out, &args, cache_dir.as_deref(), &unset)?; + let bench = args.iter().any(|arg| arg == "--codexr-bench"); + let url = host::main_window_url(&locale::initial_locale(cache_dir.as_deref(), bench), bench); + eprintln!("[codexr-ide] Opening the main window on {url}"); + host::open_main_window(app.handle(), &shell, &sidecar, url)?; + Ok(()) + } + }) + .build(tauri::generate_context!()) + .expect("error while building the Code-XR IDE"); + trace("built"); + + app.run(move |app, event| match event { + RunEvent::ExitRequested { api, code, .. } => { + // The last window closed: the sidecar runs its will-quit work + // (terminals, agents, language servers) and asks to exit; it gets + // three seconds. + if code.is_none() && sidecar.is_alive() && !sidecar.is_exiting() { + api.prevent_exit(); + sidecar.begin_exit(); + let app = app.clone(); + std::thread::spawn(move || { + std::thread::sleep(std::time::Duration::from_secs(3)); + app.exit(0); + }); + } + } + RunEvent::Exit => sidecar.kill(), + _ => {} + }); +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn a_folder_without_render_nodes_has_none() { + let dir = std::env::temp_dir().join(format!("codexr-dri-{}", std::process::id())); + std::fs::create_dir_all(&dir).unwrap(); + assert!(!has_render_node(&dir.join("missing"))); + std::fs::write(dir.join("card0"), "").unwrap(); + assert!(!has_render_node(&dir)); + std::fs::write(dir.join("renderD128"), "").unwrap(); + assert!(has_render_node(&dir)); + std::fs::remove_dir_all(&dir).unwrap(); + } +} diff --git a/apps/ide/src-tauri/src/scene.rs b/apps/ide/src-tauri/src/scene.rs new file mode 100644 index 000000000..9fd4fc7a0 --- /dev/null +++ b/apps/ide/src-tauri/src/scene.rs @@ -0,0 +1,243 @@ +//! The analysis scene beside the code (#483, R5 of epic #477): the Tauri side +//! of Electron's `WebContentsView` scene view (src/main/analysis/sceneView.ts). +//! +//! The scene is a second webview of the window (`Window::add_child`, Tauri's +//! `unstable` multiwebview), laid over the slot the renderer reserves and +//! moved, resized, hidden and shown as the sidecar asks. Like Electron's, it +//! is a separate page, never an iframe of the app: it is served by the local +//! Code-XR analysis server (`http://127.0.0.1:/`), so it never reaches +//! `window.codexr`, and it runs in its own ephemeral (incognito) data store. +//! +//! Its only bridge to the IDE is the initialization script built from +//! src/sceneBridge (out/sceneBridge/index.js), which calls one command, +//! `codexr_scene`, allowed by capabilities/scene.json to webviews labelled +//! `scene-*` on loopback pages only. The core checks the label and the +//! page's origin again and forwards the message to the sidecar, where the +//! same checks as on Electron decide (ipc.ts: the path must be inside the +//! open folder). +//! +//! Navigation stays on the scene's own server and new windows are refused, +//! as on Electron (hardening.ts `allowSceneOrigin`). + +use std::collections::HashMap; +use std::sync::{Arc, Mutex}; + +use serde_json::{json, Value}; +use tauri::webview::{NewWindowResponse, PageLoadEvent}; +use tauri::{AppHandle, LogicalPosition, LogicalSize, Manager, Url, WebviewBuilder, WebviewUrl}; + +use crate::host::Shell; +use crate::sidecar::Sidecar; + +/// Every scene webview's label starts so (capabilities/scene.json grants `scene-*`). +pub const SCENE_LABEL_PREFIX: &str = "scene-"; +/// The largest side the renderer may ask for, as sceneUrl.ts `sanitizeBounds` caps it. +const MAX_SIDE: f64 = 16384.0; + +/// The scenes the sidecar opened: webview label to the origin it may show. +#[derive(Default)] +pub struct Scenes { + origins: Mutex>, +} + +impl Scenes { + fn insert(&self, label: &str, origin: String) { + self.origins.lock().unwrap().insert(label.to_string(), origin); + } + + fn remove(&self, label: &str) { + self.origins.lock().unwrap().remove(label); + } + + /// The origin the scene webview `label` was opened on, if it is a scene. + pub fn origin_of(&self, label: &str) -> Option { + self.origins.lock().unwrap().get(label).cloned() + } +} + +/// The origin of a page served by Code-XR's own local server, or None for +/// anything else: http(s) on a loopback host with an explicit port and no +/// credentials. The same rule as `localSceneOrigin` in sceneUrl.ts. +pub fn local_scene_origin(url: &Url) -> Option { + if !matches!(url.scheme(), "http" | "https") || !url.username().is_empty() || url.password().is_some() { + return None; + } + let host = url.host_str()?; + if !matches!(host, "127.0.0.1" | "localhost" | "[::1]") { + return None; + } + let port = url.port()?; + Some(format!("{}://{}:{}", url.scheme(), host, port)) +} + +/// Whether `url` is a page of the scene opened on `origin`. +pub fn is_scene_page(url: &Url, origin: &str) -> bool { + local_scene_origin(url).as_deref() == Some(origin) +} + +/// Whole, positive logical pixels for a webview's place, or None (hide it). +pub fn scene_rect(bounds: &Value) -> Option<(f64, f64, f64, f64)> { + let number = |key: &str| bounds.get(key).and_then(Value::as_f64).filter(|n| n.is_finite()); + let (x, y, width, height) = (number("x")?, number("y")?, number("width")?, number("height")?); + let clamp = |n: f64| n.round().clamp(0.0, MAX_SIDE); + let (width, height) = (clamp(width), clamp(height)); + if width < 1.0 || height < 1.0 { + return None; + } + Some((clamp(x), clamp(y), width, height)) +} + +fn label_param(params: &Value) -> Result { + let label = params.get("webview").and_then(Value::as_str).ok_or("missing webview")?; + if !label.starts_with(SCENE_LABEL_PREFIX) { + return Err(format!("{label} is not a scene view.")); + } + Ok(label.to_string()) +} + +fn scene_webview(app: &AppHandle, params: &Value) -> Result { + let label = label_param(params)?; + app.get_webview(&label).ok_or_else(|| format!("no scene view {label}")) +} + +fn place(webview: &tauri::Webview, bounds: Option<&Value>) -> Result<(), String> { + match bounds.and_then(scene_rect) { + Some((x, y, width, height)) => { + webview.set_position(LogicalPosition::new(x, y)).map_err(|error| error.to_string())?; + webview.set_size(LogicalSize::new(width, height)).map_err(|error| error.to_string())?; + webview.show().map_err(|error| error.to_string()) + } + None => webview.hide().map_err(|error| error.to_string()), + } +} + +/// The `scene.*` host operations (src/sidecar/tauriHost.ts `WebContentsView`). +/// They run on a host thread of their own (sidecar.rs), never on the main +/// thread: `add_child` waits for it, and on Windows a webview created from +/// the main thread's own call deadlocks (R1 spike). +pub fn handle(app: &AppHandle, shell: &Arc, sidecar: &Arc, op: &str, params: &Value) -> Result { + match op { + "scene.create" => create(app, shell, sidecar, params), + "scene.navigate" => { + let webview = scene_webview(app, params)?; + let url: Url = params.get("url").and_then(Value::as_str).ok_or("missing url")?.parse().map_err(|error| format!("bad url: {error}"))?; + let origin = shell.scenes.origin_of(webview.label()).ok_or("not a scene")?; + if !is_scene_page(&url, &origin) { + return Err(format!("Refused to show {url}: not this scene's server.")); + } + webview.navigate(url).map_err(|error| error.to_string())?; + Ok(Value::Null) + } + "scene.setBounds" => { + place(&scene_webview(app, params)?, params.get("bounds"))?; + Ok(Value::Null) + } + "scene.eval" => { + let script = params.get("script").and_then(Value::as_str).ok_or("missing script")?; + scene_webview(app, params)?.eval(script).map_err(|error| error.to_string())?; + Ok(Value::Null) + } + "scene.close" => { + let label = label_param(params)?; + shell.scenes.remove(&label); + if let Some(webview) = app.get_webview(&label) { + webview.close().map_err(|error| error.to_string())?; + } + sidecar.notify("window.event", json!({ "window": label, "event": "destroyed" })); + Ok(Value::Null) + } + _ => Err(format!("Unknown host operation {op}.")), + } +} + +fn create(app: &AppHandle, shell: &Arc, sidecar: &Arc, params: &Value) -> Result { + let label = label_param(params)?; + let window_label = params.get("window").and_then(Value::as_str).ok_or("missing window")?; + let window = app.get_window(window_label).ok_or_else(|| format!("no window {window_label}"))?; + let url: Url = params.get("url").and_then(Value::as_str).ok_or("missing url")?.parse().map_err(|error| format!("bad url: {error}"))?; + let origin = local_scene_origin(&url).ok_or_else(|| format!("Refused to show {url}: not a local Code-XR server."))?; + if app.get_webview(&label).is_some() { + return Err(format!("{label} already exists.")); + } + shell.scenes.insert(&label, origin.clone()); + + let navigation_origin = origin.clone(); + let loads = sidecar.clone(); + let load_label = label.clone(); + let load_origin = origin.clone(); + let builder = WebviewBuilder::new(&label, WebviewUrl::External(url)) + // Electron's in-memory `codexr-scene` partition: nothing the scene stores outlives it. + .incognito(true) + // CodeXRHostBridge, before the page's own scripts (src/sceneBridge). + .initialization_script(shell.scene_bridge()) + .on_navigation(move |url| { + let allowed = is_scene_page(url, &navigation_origin) || url.scheme() == "about"; + if !allowed { + eprintln!("[codexr-ide] Scene view: blocked navigation to {url}"); + } + allowed + }) + .on_new_window(|url, _features| { + eprintln!("[codexr-ide] Scene view: blocked a new window for {url}"); + NewWindowResponse::Deny + }) + .on_page_load(move |_webview, payload| { + if payload.event() == PageLoadEvent::Finished && is_scene_page(payload.url(), &load_origin) { + loads.notify("window.event", json!({ "window": load_label, "event": "loaded", "url": payload.url().as_str() })); + } + }); + let rect = params.get("bounds").and_then(scene_rect); + let (x, y, width, height) = rect.unwrap_or((0.0, 0.0, 1.0, 1.0)); + let webview = window + .add_child(builder, LogicalPosition::new(x, y), LogicalSize::new(width, height)) + .map_err(|error| { + shell.scenes.remove(&label); + error.to_string() + })?; + let visible = params.get("visible").and_then(Value::as_bool).unwrap_or(true); + if rect.is_none() || !visible { + let _ = webview.hide(); + } + eprintln!("[codexr-ide] Scene view {label} opened on {origin}"); + Ok(Value::Null) +} + +#[cfg(test)] +mod tests { + use super::*; + + fn url(text: &str) -> Url { + text.parse().unwrap() + } + + #[test] + fn only_a_local_server_with_a_port_is_a_scene() { + assert_eq!(local_scene_origin(&url("http://127.0.0.1:3000/index.html?x=1")).as_deref(), Some("http://127.0.0.1:3000")); + assert_eq!(local_scene_origin(&url("https://localhost:3443/")).as_deref(), Some("https://localhost:3443")); + assert_eq!(local_scene_origin(&url("http://[::1]:8080/")).as_deref(), Some("http://[::1]:8080")); + assert_eq!(local_scene_origin(&url("http://127.0.0.1/")), None); + assert_eq!(local_scene_origin(&url("http://example.org:3000/")), None); + assert_eq!(local_scene_origin(&url("http://localhost.evil.test:3000/")), None); + assert_eq!(local_scene_origin(&url("http://user:pw@127.0.0.1:3000/")), None); + assert_eq!(local_scene_origin(&url("file:///etc/passwd")), None); + assert_eq!(local_scene_origin(&url("codexr://app/index.html")), None); + } + + #[test] + fn a_scene_stays_on_its_own_server() { + let origin = "http://127.0.0.1:3000"; + assert!(is_scene_page(&url("http://127.0.0.1:3000/other.html"), origin)); + assert!(!is_scene_page(&url("http://127.0.0.1:3001/"), origin)); + assert!(!is_scene_page(&url("https://127.0.0.1:3000/"), origin)); + assert!(!is_scene_page(&url("http://localhost:3000/"), origin)); + } + + #[test] + fn bounds_are_whole_positive_pixels_or_hidden() { + assert_eq!(scene_rect(&json!({ "x": 10.4, "y": 20.6, "width": 300.2, "height": 200.5 })), Some((10.0, 21.0, 300.0, 201.0))); + assert_eq!(scene_rect(&json!({ "x": -5, "y": 0, "width": 99999, "height": 10 })), Some((0.0, 0.0, MAX_SIDE, 10.0))); + assert_eq!(scene_rect(&json!({ "x": 0, "y": 0, "width": 0, "height": 10 })), None); + assert_eq!(scene_rect(&json!({ "x": 0, "y": 0, "width": "wide", "height": 10 })), None); + assert_eq!(scene_rect(&Value::Null), None); + } +} diff --git a/apps/ide/src-tauri/src/sidecar.rs b/apps/ide/src-tauri/src/sidecar.rs new file mode 100644 index 000000000..f262c814b --- /dev/null +++ b/apps/ide/src-tauri/src/sidecar.rs @@ -0,0 +1,314 @@ +//! The Node sidecar (#482): started with the app, killed with it, spoken to +//! in JSON-RPC 2.0 over stdio, one JSON message per line. +//! +//! Core to sidecar: `ipc.invoke` (requests), `window.event`, +//! `app.secondInstance` (notifications). Sidecar to core: `webview.send` +//! (notifications, delivered on the webview's event channel) and `host.` +//! (requests, answered by host.rs). The sidecar logs to stderr only; lines +//! that start with `CODEXR_` (the benchmark's and smoke run's result lines) +//! are passed to this process's stdout, everything else to its stderr. + +use std::collections::HashMap; +use std::io::{BufRead, BufReader, Write}; +use std::path::Path; +use std::process::{Child, ChildStdin, Command, Stdio}; +use std::sync::atomic::{AtomicBool, AtomicU64, Ordering}; +use std::sync::Mutex; +use std::time::Duration; + +use serde_json::{json, Value}; +use tauri::ipc::Channel; +use tauri::{AppHandle, Manager}; +use tokio::sync::oneshot; + +use crate::host; + +type Pending = HashMap>>; + +/// Events for each webview: delivered on the channel its page registered, +/// or queued until it does (the page subscribes as it loads). +pub struct Events { + channels: Mutex>>, + queued: Mutex>>, +} + +const MAX_QUEUED: usize = 2000; + +impl Events { + fn new() -> Self { + Self { channels: Mutex::new(HashMap::new()), queued: Mutex::new(HashMap::new()) } + } + + pub fn register(&self, label: &str, channel: Channel) { + let queued = self.queued.lock().unwrap().remove(label).unwrap_or_default(); + if std::env::var_os("CODEXR_IPC_TRACE").is_some() { + eprintln!("[codexr-ide] events: {label} registered channel {}, {} queued", channel.id(), queued.len()); + } + for message in queued { + let _ = channel.send(message); + } + self.channels.lock().unwrap().insert(label.to_string(), channel); + } + + pub fn forget(&self, label: &str) { + self.channels.lock().unwrap().remove(label); + self.queued.lock().unwrap().remove(label); + } + + fn deliver(&self, label: &str, message: Value) { + if let Some(channel) = self.channels.lock().unwrap().get(label) { + if let Err(error) = channel.send(message) { + eprintln!("[codexr-ide] An event for {label} was not delivered: {error}"); + } + return; + } + let mut queued = self.queued.lock().unwrap(); + let list = queued.entry(label.to_string()).or_default(); + if list.len() < MAX_QUEUED { + list.push(message); + } + } +} + +pub struct Sidecar { + stdin: Mutex>, + child: Mutex>, + pending: Mutex, + next_id: AtomicU64, + alive: AtomicBool, + exiting: AtomicBool, + pub events: Events, +} + +/// The Node to run the sidecar on: `CODEXR_NODE`, else `node` from PATH (R12 bundles one as externalBin). +fn node_command() -> String { + std::env::var("CODEXR_NODE").unwrap_or_else(|_| "node".to_string()) +} + +impl Sidecar { + pub fn new() -> Self { + Self { + stdin: Mutex::new(None), + child: Mutex::new(None), + pending: Mutex::new(HashMap::new()), + next_id: AtomicU64::new(1), + alive: AtomicBool::new(false), + exiting: AtomicBool::new(false), + events: Events::new(), + } + } + + pub fn is_alive(&self) -> bool { + self.alive.load(Ordering::SeqCst) + } + + pub fn is_exiting(&self) -> bool { + self.exiting.load(Ordering::SeqCst) + } + + pub fn begin_exit(&self) { + self.exiting.store(true, Ordering::SeqCst); + } + + /// Starts `node out/sidecar/index.cjs ` (or `CODEXR_SIDECAR`) and the threads that serve it. + /// `cache_dir` is the app's cache folder: V8's compile cache of the sidecar lives + /// there (NODE_COMPILE_CACHE, about 45 ms of its start-up once warm) and the + /// sidecar keeps its last display language beside it (locale.rs). `unset` are + /// variables the core set for its webview only. + pub fn start(self: &std::sync::Arc, app: AppHandle, out: &Path, args: &[String], cache_dir: Option<&Path>, unset: &[&str]) -> Result<(), String> { + let script = std::env::var_os("CODEXR_SIDECAR") + .map(std::path::PathBuf::from) + .unwrap_or_else(|| out.join("sidecar").join("index.cjs")); + if !script.is_file() { + return Err(format!("The sidecar is missing ({}): run `npm run tauri:build` first.", script.display())); + } + let node = node_command(); + let mut command = Command::new(&node); + command.arg(&script).args(args).env("CODEXR_TAURI", "1"); + for name in unset { + command.env_remove(name); + } + if let Some(dir) = cache_dir { + // The sidecar takes both out of its environment before starting any child. + command.env("NODE_COMPILE_CACHE", dir.join("node-compile-cache")).env("CODEXR_CACHE_DIR", dir); + } + let mut child = command + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn() + .map_err(|error| format!("Could not start the Node sidecar with `{node}`: {error}. Set CODEXR_NODE to a Node.js 24 binary."))?; + eprintln!("[codexr-ide] Node sidecar started (pid {}, {node} {})", child.id(), script.display()); + let stdout = child.stdout.take().ok_or("no sidecar stdout")?; + let stderr = child.stderr.take().ok_or("no sidecar stderr")?; + *self.stdin.lock().unwrap() = child.stdin.take(); + *self.child.lock().unwrap() = Some(child); + self.alive.store(true, Ordering::SeqCst); + + // The sidecar's logs, and the result lines harnesses read from stdout. + std::thread::spawn(move || { + for line in BufReader::new(stderr).lines().map_while(Result::ok) { + if line.starts_with("CODEXR_") { + let mut out = std::io::stdout().lock(); + let _ = writeln!(out, "{line}"); + let _ = out.flush(); + } else { + eprintln!("{line}"); + } + } + }); + + // The protocol. + { + let this = self.clone(); + let app = app.clone(); + std::thread::spawn(move || { + for line in BufReader::new(stdout).lines().map_while(Result::ok) { + if line.trim().is_empty() { + continue; + } + match serde_json::from_str::(&line) { + Ok(message) => this.receive(&app, message), + Err(error) => eprintln!("[codexr-ide] Sidecar sent a line that is not JSON ({error}): {}", line.chars().take(200).collect::()), + } + } + }); + } + + // Supervision: a sidecar that dies while the app runs ends the app, with a message. + { + let this = self.clone(); + std::thread::spawn(move || loop { + std::thread::sleep(Duration::from_millis(200)); + let status = match this.child.lock().unwrap().as_mut() { + Some(child) => child.try_wait(), + None => return, + }; + match status { + Ok(None) => continue, + Ok(Some(status)) => { + this.died(); + app.state::>().release_csp(); + if !this.is_exiting() { + eprintln!("[codexr-ide] The Node sidecar exited unexpectedly ({status})."); + host::show_fatal(&app, &format!("The Code-XR IDE's Node process stopped ({status}). The IDE will close; its log is in the terminal that started it.")); + app.exit(1); + } + return; + } + Err(error) => { + eprintln!("[codexr-ide] Cannot watch the sidecar: {error}"); + return; + } + } + }); + } + Ok(()) + } + + fn died(&self) { + self.alive.store(false, Ordering::SeqCst); + *self.stdin.lock().unwrap() = None; + for (_, waiter) in self.pending.lock().unwrap().drain() { + let _ = waiter.send(Err("The IDE's Node process is gone.".into())); + } + } + + pub fn kill(&self) { + self.exiting.store(true, Ordering::SeqCst); + *self.stdin.lock().unwrap() = None; + if let Some(child) = self.child.lock().unwrap().as_mut() { + let _ = child.kill(); + let _ = child.wait(); + } + self.alive.store(false, Ordering::SeqCst); + } + + fn write(&self, message: &Value) -> Result<(), String> { + let mut line = serde_json::to_string(message).map_err(|error| error.to_string())?; + line.push('\n'); + let mut stdin = self.stdin.lock().unwrap(); + let writer = stdin.as_mut().ok_or("The IDE's Node process is not running.")?; + writer.write_all(line.as_bytes()).and_then(|_| writer.flush()).map_err(|error| error.to_string()) + } + + pub fn notify(&self, method: &str, params: Value) { + if self.is_alive() { + if let Err(error) = self.write(&json!({ "jsonrpc": "2.0", "method": method, "params": params })) { + eprintln!("[codexr-ide] Could not notify the sidecar ({method}): {error}"); + } + } + } + + pub async fn request(&self, method: &str, params: Value) -> Result { + let id = self.next_id.fetch_add(1, Ordering::Relaxed); + let (sender, receiver) = oneshot::channel(); + self.pending.lock().unwrap().insert(id, sender); + if let Err(error) = self.write(&json!({ "jsonrpc": "2.0", "id": id, "method": method, "params": params })) { + self.pending.lock().unwrap().remove(&id); + return Err(error); + } + receiver.await.unwrap_or_else(|_| Err("The IDE's Node process is gone.".into())) + } + + fn respond(&self, id: Value, result: Result) { + let message = match result { + Ok(value) => json!({ "jsonrpc": "2.0", "id": id, "result": value }), + Err(message) => json!({ "jsonrpc": "2.0", "id": id, "error": { "code": -32000, "message": message } }), + }; + if let Err(error) = self.write(&message) { + eprintln!("[codexr-ide] Could not answer the sidecar: {error}"); + } + } + + fn receive(self: &std::sync::Arc, app: &AppHandle, message: Value) { + if let Some(method) = message.get("method").and_then(Value::as_str) { + let params = message.get("params").cloned().unwrap_or(Value::Null); + if method == "webview.send" { + let label = params.get("window").and_then(Value::as_str).unwrap_or_default().to_string(); + let channel = params.get("channel").cloned().unwrap_or(Value::Null); + let payload = params.get("payload").cloned().unwrap_or(Value::Null); + self.events.deliver(&label, json!({ "channel": channel, "payload": payload })); + return; + } + let Some(op) = method.strip_prefix("host.") else { + eprintln!("[codexr-ide] Unknown sidecar method {method}"); + return; + }; + let id = message.get("id").cloned().filter(|id| !id.is_null()); + let op = op.to_string(); + let this = self.clone(); + let app = app.clone(); + let run = move || { + let result = host::handle(&app, &this, &op, ¶ms); + match id { + Some(id) => this.respond(id, result), + None => { + if let Err(error) = result { + eprintln!("[codexr-ide] host.{op} failed: {error}"); + } + } + } + }; + if host::runs_in_order(method) { + // Never blocks (it only posts to the event loop), and must keep its order. + run(); + } else { + // Host operations may block (dialogs, creating a webview): each runs on its own thread. + std::thread::spawn(run); + } + return; + } + let Some(id) = message.get("id").and_then(Value::as_u64) else { + return; + }; + let Some(waiter) = self.pending.lock().unwrap().remove(&id) else { + return; + }; + let result = match message.get("error") { + Some(error) => Err(error.get("message").and_then(Value::as_str).unwrap_or("Sidecar error.").to_string()), + None => Ok(message.get("result").cloned().unwrap_or(Value::Null)), + }; + let _ = waiter.send(result); + } +} diff --git a/apps/ide/src-tauri/tauri.conf.json b/apps/ide/src-tauri/tauri.conf.json new file mode 100644 index 000000000..8da7be479 --- /dev/null +++ b/apps/ide/src-tauri/tauri.conf.json @@ -0,0 +1,19 @@ +{ + "$schema": "https://schema.tauri.app/config/2", + "productName": "Code-XR", + "version": "0.1.0", + "identifier": "org.codexr.ide", + "app": { + "windows": [], + "withGlobalTauri": false, + "security": { + "csp": null, + "dangerousDisableAssetCspModification": true, + "freezePrototype": false + } + }, + "bundle": { + "active": false, + "icon": ["icons/icon.png", "icons/icon.ico"] + } +} diff --git a/apps/ide/src/bridge/index.ts b/apps/ide/src/bridge/index.ts new file mode 100644 index 000000000..01cfd2a11 --- /dev/null +++ b/apps/ide/src/bridge/index.ts @@ -0,0 +1,139 @@ +/** + * The Tauri bridge (#481): `window.codexr` in the Tauri build, the same + * frozen object the Electron preload exposes (src/preload/codexrApi.ts). + * + * The Rust core injects this script, built as one IIFE into out/bridge/, as + * an initialization script of the main webview: it runs before the page's + * own scripts, like a preload. It talks to the core only through Tauri's + * internal IPC (no @tauri-apps/api dependency): + * + * - every call is the one command `codexr_ipc { channel, args }`, which the + * core forwards to the Node sidecar, where the same allow-list and trusted + * origin check as on Electron (`isTrustedIpcCall`) decide; + * - events arrive on one Tauri channel registered with `codexr_events`, as + * `{ channel, payload }`, in order. + * + * Values cross JSON through src/shared/jsonCodec.ts (bytes, `undefined`). + */ +import type { Unsubscribe } from '../shared/api.ts'; +import { createCodexrApi, type IpcAdapter } from '../preload/codexrApi.ts'; +import { decodeValue, encodeArgs } from '../shared/jsonCodec.ts'; + +interface TauriInternals { + invoke(command: string, args?: Record): Promise; + transformCallback(callback: (data: unknown) => void, once?: boolean): number; +} + +interface ChannelMessage { + readonly index: number; + readonly message?: unknown; + readonly end?: boolean; +} + +function install(): void { + const internals = (window as unknown as { __TAURI_INTERNALS__?: TauriInternals }).__TAURI_INTERNALS__; + if (!internals) { + console.error('[codexr] Tauri internals are missing: window.codexr is not available.'); + return; + } + // Taken once, before any page script runs. + const tauriInvoke = internals.invoke.bind(internals); + const listeners = new Map void>>(); + + const dispatch = (message: unknown): void => { + if (message === null || typeof message !== 'object') { + return; + } + const { channel, payload } = message as { channel?: unknown; payload?: unknown }; + if (typeof channel !== 'string') { + return; + } + const decoded = decodeValue(payload); + for (const listener of [...(listeners.get(channel) ?? [])]) { + try { + listener(decoded); + } catch (error) { + console.error(`[codexr] A listener of ${channel} failed.`, error); + } + } + }; + + // Tauri delivers a channel's messages with an index; large ones are + // fetched and can arrive late, so they are replayed in order. + let nextIndex = 0; + const early = new Map(); + const callbackId = internals.transformCallback((data: unknown) => { + const message = data as ChannelMessage; + if (typeof message !== 'object' || message === null || typeof message.index !== 'number') { + return; + } + early.set(message.index, message); + let current = early.get(nextIndex); + while (current) { + early.delete(nextIndex); + nextIndex += 1; + if (!current.end) { + dispatch(current.message); + } + current = early.get(nextIndex); + } + }); + tauriInvoke('codexr_events', { channel: `__CHANNEL__:${callbackId}` }).catch((error: unknown) => { + console.error('[codexr] Could not subscribe to the IDE events.', error); + }); + + // The page's errors reach the core's log, as Electron's console-message does. + const forward = (level: 'error' | 'warn', parts: readonly unknown[]): void => { + const message = parts.map((part) => (part instanceof Error ? `${part.message}\n${part.stack ?? ''}` : typeof part === 'string' ? part : safeJson(part))).join(' '); + tauriInvoke('codexr_log', { level, message }).catch(() => undefined); + }; + window.addEventListener('error', (event) => forward('error', [event.message, `${event.filename}:${event.lineno}:${event.colno}`])); + window.addEventListener('unhandledrejection', (event) => forward('error', ['Unhandled rejection:', event.reason])); + const originalError = console.error.bind(console); + console.error = (...parts: unknown[]): void => { + originalError(...parts); + forward('error', parts); + }; + + const ipc: IpcAdapter = { + async invoke(channel: string, ...args: unknown[]): Promise { + let result: unknown; + try { + result = await tauriInvoke('codexr_ipc', { channel, args: encodeArgs(args) }); + } catch (error) { + // The same message shape as Electron's rejections, which the renderer strips where it shows one. + throw new Error(`Error invoking remote method '${channel}': Error: ${error instanceof Error ? error.message : String(error)}`); + } + return decodeValue(result); + }, + on(channel: string, listener: (payload: T) => void): Unsubscribe { + const wrapped = (payload: unknown): void => listener(payload as T); + let set = listeners.get(channel); + if (!set) { + set = new Set(); + listeners.set(channel, set); + } + set.add(wrapped); + return () => { + listeners.get(channel)?.delete(wrapped); + }; + }, + }; + + Object.defineProperty(window, 'codexr', { + value: createCodexrApi(ipc), + writable: false, + configurable: false, + enumerable: true, + }); +} + +function safeJson(value: unknown): string { + try { + return JSON.stringify(value) ?? String(value); + } catch { + return String(value); + } +} + +install(); diff --git a/apps/ide/src/main/agentSessions/agentCatalog.ts b/apps/ide/src/main/agentSessions/agentCatalog.ts index 0fd51324e..64814a3e7 100644 --- a/apps/ide/src/main/agentSessions/agentCatalog.ts +++ b/apps/ide/src/main/agentSessions/agentCatalog.ts @@ -5,6 +5,7 @@ import { AGENT_PRESET_IDS, type AcpAgentDefinition, type AgentAvailability, type import { isLocalServerId, LOCAL_SERVER_PRESETS, normalizeLocalBaseUrl } from '@codexr/local-models/servers.ts'; import type { AgentLaunch } from './acpConnection.ts'; import { API_KEY_ENV, type AuthMethodSpec } from './acpMapping.ts'; +import { nodeModeEnv } from '../nodeRuntime.ts'; /** * AF1/AF2: the agents a chat can use. Three presets the IDE knows how to @@ -453,7 +454,7 @@ export class AgentCatalog { const viaNode = (script: string, via: string): Resolution => ({ found: true, via, - launch: { command: execPath, args: [script, ...definition.args], env: agentEnv({ ELECTRON_RUN_AS_NODE: '1' }) }, + launch: { command: execPath, args: [script, ...definition.args], env: agentEnv({ ...nodeModeEnv() }) }, }); if (definition.local) { @@ -470,7 +471,7 @@ export class AgentCatalog { args: [script], // The key travels in the environment only, never on the command line. env: agentEnvironment(env, null, { - ELECTRON_RUN_AS_NODE: '1', + ...nodeModeEnv(), CODEXR_LOCAL_AGENT_NAME: definition.name, CODEXR_LOCAL_BASE_URL: definition.local.baseUrl, CODEXR_LOCAL_MODEL: definition.local.model, diff --git a/apps/ide/src/main/agentSessions/agentSessionsIpc.ts b/apps/ide/src/main/agentSessions/agentSessionsIpc.ts index b86874e58..f4207c9e4 100644 --- a/apps/ide/src/main/agentSessions/agentSessionsIpc.ts +++ b/apps/ide/src/main/agentSessions/agentSessionsIpc.ts @@ -1,4 +1,4 @@ -import type { IpcMainInvokeEvent } from 'electron'; +import type { IpcMainInvokeEvent } from '../host/desktop.ts'; import { AGENT_SESSION_CHANNELS } from '../../shared/agentSession.ts'; import type { AgentSessionsRuntime } from './agentSessionsRuntime.ts'; diff --git a/apps/ide/src/main/agentSessions/agentSessionsRuntime.ts b/apps/ide/src/main/agentSessions/agentSessionsRuntime.ts index e8518003f..2e6cfc301 100644 --- a/apps/ide/src/main/agentSessions/agentSessionsRuntime.ts +++ b/apps/ide/src/main/agentSessions/agentSessionsRuntime.ts @@ -1,4 +1,4 @@ -import { app, BrowserWindow, dialog, net, webContents, type WebContents } from 'electron'; +import { app, BrowserWindow, dialog, net, webContents, type WebContents } from '../host/desktop.ts'; import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; diff --git a/apps/ide/src/main/agentSessions/codexrMcpSpec.ts b/apps/ide/src/main/agentSessions/codexrMcpSpec.ts index b96409e2c..b5fcc2115 100644 --- a/apps/ide/src/main/agentSessions/codexrMcpSpec.ts +++ b/apps/ide/src/main/agentSessions/codexrMcpSpec.ts @@ -1,4 +1,5 @@ import path from 'node:path'; +import { nodeModeEnv } from '../nodeRuntime.ts'; /** * The stdio MCP server spec that hands Code-XR's analysis to an external @@ -49,6 +50,6 @@ export function codexrMcpServerSpec(options: CodexrMcpSpecOptions): CodexrMcpSer name: CODEXR_MCP_SERVER_NAME, command: options.execPath, args: [codexrMcpEntry(options.appPath), '--root', options.root, '--analysis', options.analysisDir ?? ''], - env: [{ name: 'ELECTRON_RUN_AS_NODE', value: '1' }], + env: Object.entries(nodeModeEnv()).map(([name, value]) => ({ name, value })), }; } diff --git a/apps/ide/src/main/agents/agentsIpc.ts b/apps/ide/src/main/agents/agentsIpc.ts index 0673e089f..63a484917 100644 --- a/apps/ide/src/main/agents/agentsIpc.ts +++ b/apps/ide/src/main/agents/agentsIpc.ts @@ -1,4 +1,4 @@ -import type { IpcMainInvokeEvent, WebContents } from 'electron'; +import type { IpcMainInvokeEvent, WebContents } from '../host/desktop.ts'; import { AGENT_IPC_CHANNELS, AGENT_IPC_EVENTS, type AgentChatEvent } from '../../shared/agents.ts'; import { currentWorkspaceInfo, workspaceOrNull } from '../workspace/workspaceWindows.ts'; import type { AgentServices } from './agentsRuntime.ts'; diff --git a/apps/ide/src/main/agents/agentsRuntime.ts b/apps/ide/src/main/agents/agentsRuntime.ts index 0a63e56a2..01f03f0ff 100644 --- a/apps/ide/src/main/agents/agentsRuntime.ts +++ b/apps/ide/src/main/agents/agentsRuntime.ts @@ -1,4 +1,4 @@ -import { app, BrowserWindow, dialog } from 'electron'; +import { app, BrowserWindow, dialog } from '../host/desktop.ts'; import os from 'node:os'; import path from 'node:path'; import { JsonKeyValueStore } from '../core/jsonStore.ts'; diff --git a/apps/ide/src/main/agents/electronCipher.ts b/apps/ide/src/main/agents/electronCipher.ts index 1e1b5a9f8..97d9f0475 100644 --- a/apps/ide/src/main/agents/electronCipher.ts +++ b/apps/ide/src/main/agents/electronCipher.ts @@ -1,4 +1,4 @@ -import { safeStorage } from 'electron'; +import { safeStorage } from '../host/desktop.ts'; import type { SecretCipher } from './keyVault.ts'; /** diff --git a/apps/ide/src/main/analysis/analysisService.ts b/apps/ide/src/main/analysis/analysisService.ts index 6acd62f9e..c27bee0d4 100644 --- a/apps/ide/src/main/analysis/analysisService.ts +++ b/apps/ide/src/main/analysis/analysisService.ts @@ -1,4 +1,4 @@ -import { BrowserWindow, clipboard, webContents, type WebContents } from 'electron'; +import { BrowserWindow, clipboard, DESKTOP_SHELL, webContents, type WebContents } from '../host/desktop.ts'; import { createHash } from 'node:crypto'; import path from 'node:path'; import { AnalysisOrchestrator } from '@codexr/core/analysis/analysisOrchestrator'; @@ -30,7 +30,7 @@ import { readMetrics, type FileMetrics } from '../agents/tools/analysisQueries.t import { computeMetricDelta, type MetricDeltaReport } from './metricDelta.ts'; import { followRefreshes, waitUntilSettled, type RefreshPort, type SceneUpdatedEvent, type SettleResult } from './sceneRefresh.ts'; import { closeScene, enterSceneXr, sceneSupportsImmersiveXr, showScene } from './sceneView.ts'; -import { unsupportedXrMessage } from './sceneXrPolicy.ts'; +import { ENTER_XR_IN_SCENE_MESSAGE, inIdeXrUnavailable, unsupportedXrMessage } from './sceneXrPolicy.ts'; import { sceneTargetToWorkspacePath } from './sceneEditorTarget.ts'; import type { SceneEditorTarget } from '../../shared/sceneBridge.ts'; import { localSceneOrigin, sceneTitle, targetName } from './sceneUrl.ts'; @@ -589,11 +589,11 @@ export class AnalysisService { return { ok: false, reason: 'failed', message: 'A LivePanel is a 2D page: analyse in XR to enter a scene.' }; } if (!await sceneSupportsImmersiveXr(win)) { - return { ok: false, reason: 'unsupported', message: unsupportedXrMessage(process.platform) }; + return { ok: false, reason: 'unsupported', message: unsupportedXrMessage(process.platform, DESKTOP_SHELL) }; } try { - await enterSceneXr(win); - return { ok: true }; + const entered = await enterSceneXr(win); + return entered === 'in-scene' ? { ok: true, message: ENTER_XR_IN_SCENE_MESSAGE } : { ok: true }; } catch (error) { log.error('Entering XR failed', error); return { ok: false, reason: 'failed', message: error instanceof Error ? error.message : String(error) }; @@ -759,6 +759,7 @@ export class AnalysisService { targetPath: this.ownerTarget, files, share, + xrUnavailable: inIdeXrUnavailable(DESKTOP_SHELL, process.platform) ?? undefined, }; win.webContents.send(IPC_EVENTS.analysisSceneOpened, scene); // #173: the Problems panel measures the functions of the folder the scene shows. diff --git a/apps/ide/src/main/analysis/sceneLibraries.ts b/apps/ide/src/main/analysis/sceneLibraries.ts index f7312933d..acf2f025c 100644 --- a/apps/ide/src/main/analysis/sceneLibraries.ts +++ b/apps/ide/src/main/analysis/sceneLibraries.ts @@ -1,46 +1,22 @@ /** * The scene's third-party libraries, served from the copies in the repository - * instead of their CDNs (#16). + * instead of their CDNs (#16, #483). * * Generated scenes load A-Frame, BabiaXR and friends from CDNs (pinned - * versions). Inside the IDE the scene view answers those URLs from + * versions). Inside the IDE they come from * `apps/vscode-extension/test/vendor/scene-libraries/` (the same copies, and - * licences, the offline browser harnesses use) and refuses every other - * request that leaves the machine: the project rule is no network access - * without consent, and a scene must not depend on a CDN being up. + * licences, the offline browser harnesses use): the IDE turns on the core's + * local libraries at start-up (coreRuntime.ts), so the analysis server + * rewrites the pinned URLs of the pages it sends to this machine and serves + * them itself, on both shells. The Electron scene view also still answers any + * CDN URL left from its own session and refuses every other request that + * leaves the machine: the project rule is no network access without consent, + * and a scene must not depend on a CDN being up. * - * Packaging (#20) has to ship that folder with the IDE. + * The table lives in the shared core (localSceneLibraries.ts). Packaging (#20) + * has to ship that folder with the IDE. */ - -/** [URL pattern, vendored file]: the versions the templates pin (kept in step with test/helpers/harnessBrowser.cjs). */ -export const SCENE_LIBRARIES: ReadonlyArray = [ - [/^https:\/\/aframe\.io\/releases\/1\.7\.1\/aframe(?:\.min)?\.js(?:\?|$)/, 'aframe-1.7.1.min.js'], - [/^https:\/\/unpkg\.com\/aframe-babia-components@1\.5\.0\//, 'aframe-babia-components-1.5.0.min.js'], - [/^https:\/\/cdn\.jsdelivr\.net\/gh\/(?:c-frame|donmccurdy)\/aframe-extras@v?7\.5\.4\//, 'aframe-extras-7.5.4.min.js'], - [/^https:\/\/unpkg\.com\/aframe-environment-component@1\.5\.0\//, 'aframe-environment-component-1.5.0.min.js'], - [/^https:\/\/unpkg\.com\/aframe-geometry-merger-component@2\.0\.1\//, 'aframe-geometry-merger-component-2.0.1.min.js'], - [/^https:\/\/cdnjs\.cloudflare\.com\/ajax\/libs\/html2canvas\/1\.4\.1\/html2canvas(?:\.min)?\.js(?:\?|$)/, 'html2canvas-1.4.1.min.js'], - // A-Frame's default text font (its `text` component fetches it at run time). - [/^https:\/\/cdn\.aframe\.io\/fonts\/Roboto-msdf\.json(?:\?|$)/, 'fonts/Roboto-msdf.json'], - [/^https:\/\/cdn\.aframe\.io\/fonts\/Roboto-msdf\.png(?:\?|$)/, 'fonts/Roboto-msdf.png'], -]; - -const CONTENT_TYPES: Readonly> = { - '.js': 'application/javascript; charset=utf-8', - '.json': 'application/json; charset=utf-8', - '.png': 'image/png', -}; - -/** The content type a vendored file is served with. */ -export function contentTypeOf(file: string): string { - const dot = file.lastIndexOf('.'); - return CONTENT_TYPES[dot >= 0 ? file.slice(dot) : ''] ?? 'application/octet-stream'; -} - -/** The vendored file name for a CDN URL, or null when the URL is not one of the pinned libraries. */ -export function vendoredLibraryFor(url: string): string | null { - return SCENE_LIBRARIES.find(([pattern]) => pattern.test(url))?.[1] ?? null; -} +export { contentTypeOf, SCENE_LIBRARIES, vendoredLibraryFor } from '@codexr/core/server/http/localSceneLibraries'; /** Loopback requests (the scene's own server) go through untouched. */ export function isLoopbackUrl(url: string): boolean { diff --git a/apps/ide/src/main/analysis/sceneView.ts b/apps/ide/src/main/analysis/sceneView.ts index 34a9e4cd1..13a0b09ff 100644 --- a/apps/ide/src/main/analysis/sceneView.ts +++ b/apps/ide/src/main/analysis/sceneView.ts @@ -1,4 +1,4 @@ -import { BrowserWindow, WebContentsView, desktopCapturer, dialog, net, session, type Session, type WebContents } from 'electron'; +import { BrowserWindow, DESKTOP_SHELL, WebContentsView, desktopCapturer, dialog, net, session, type Session, type WebContents } from '../host/desktop.ts'; import fs from 'node:fs/promises'; import path from 'node:path'; import type { SceneBounds } from '../../shared/api.ts'; @@ -8,6 +8,7 @@ import { localSceneOrigin } from './sceneUrl.ts'; import { allowXrPermission, XR_ARM_MS, type XrArm } from './sceneXrPolicy.ts'; import { allowScreenShareRequest, shareAudioFor, shareChoices } from './sceneScreenShare.ts'; import { contentTypeOf, isLoopbackUrl, vendoredLibraryFor } from './sceneLibraries.ts'; +import { SCENE_BRIDGE_INTERNALS } from '../../shared/sceneBridge.ts'; /** * The analysis scene beside the code (#16): a `WebContentsView` laid over the @@ -20,6 +21,12 @@ import { contentTypeOf, isLoopbackUrl, vendoredLibraryFor } from './sceneLibrari * Its only preload (src/scenePreload) exposes one call, `CodeXRHostBridge. * openInEditor`, which the main process checks against the open folder. It * may navigate only within the local server it was opened on. + * + * #483: on Tauri the same code drives a second webview of the window in the + * Rust core (src/sidecar/tauriHost.ts `WebContentsView`, src-tauri/src/ + * scene.rs); its bridge is src/sceneBridge, its libraries come from the local + * server (localSceneLibraries in the core), and the session's handlers below + * are not there yet (R9: permissions, request filtering, the screen picker). */ const SCENE_PARTITION = 'codexr-scene'; @@ -213,8 +220,12 @@ export async function sceneSupportsImmersiveXr(win: BrowserWindow): Promise { +export async function enterSceneXr(win: BrowserWindow): Promise<'entered' | 'in-scene'> { const view = views.get(win.id); const origin = view ? localSceneOrigin(view.webContents.getURL()) : null; if (!view || !origin) { @@ -222,6 +233,16 @@ export async function enterSceneXr(win: BrowserWindow): Promise { } xrArms.set(win.id, { origin, until: Date.now() + XR_ARM_MS }); setTimeout(() => xrArms.delete(win.id), XR_ARM_MS).unref(); + if (DESKTOP_SHELL === 'tauri') { + const offer: unknown = await view.webContents.executeJavaScript(`window.${SCENE_BRIDGE_INTERNALS}.offerEnterXr()`); + if (offer === 'no-scene') { + throw new Error('This scene has no XR mode (a LivePanel is a 2D page).'); + } + if (offer !== 'offered') { + throw new Error('No XR headset is available to the scene any more.'); + } + return 'in-scene'; + } const entered: unknown = await view.webContents.executeJavaScript( '(() => { const scene = document.querySelector("a-scene"); if (!scene || !scene.enterVR) { return false; } return Promise.resolve(scene.enterVR()).then(() => true); })()', true, @@ -229,6 +250,7 @@ export async function enterSceneXr(win: BrowserWindow): Promise { if (entered !== true) { throw new Error('This scene has no XR mode (a LivePanel is a 2D page).'); } + return 'entered'; } /** The URL the window's scene shows, for the smoke run and tests. */ diff --git a/apps/ide/src/main/analysis/sceneXrPolicy.ts b/apps/ide/src/main/analysis/sceneXrPolicy.ts index 2ffdc3530..833b34ffa 100644 --- a/apps/ide/src/main/analysis/sceneXrPolicy.ts +++ b/apps/ide/src/main/analysis/sceneXrPolicy.ts @@ -34,7 +34,11 @@ export function allowXrPermission(arm: XrArm | null, permission: string, request } /** Why the IDE cannot start an immersive session, for the header and the docs' support matrix. */ -export function unsupportedXrMessage(platform: NodeJS.Platform): string { +export function unsupportedXrMessage(platform: NodeJS.Platform, shell: 'electron' | 'tauri' = 'electron'): string { + if (shell === 'tauri' && platform !== 'win32') { + // #483: WKWebView and WebKitGTK have no WebXR at all (R1 spike: navigator.xr absent). + return 'This system webview has no WebXR, so the IDE cannot enter the scene in XR itself: open it in a WebXR browser with Open in browser, or on a standalone headset with On a headset.'; + } const common = 'No XR headset is available to the IDE.'; switch (platform) { case 'win32': @@ -45,3 +49,15 @@ export function unsupportedXrMessage(platform: NodeJS.Platform): string { return `${common} Chromium has no headset support on Linux: open the scene on a standalone headset instead.`; } } + +/** + * #483: why this IDE can never enter a scene in XR, or null where it can try + * (Electron everywhere, as before; Tauri on Windows, whose WebView2 exposes + * WebXR). The header then shows no dead Enter XR button. + */ +export function inIdeXrUnavailable(shell: 'electron' | 'tauri', platform: NodeJS.Platform): string | null { + return shell === 'tauri' && platform !== 'win32' ? unsupportedXrMessage(platform, shell) : null; +} + +/** #483: what the header says once a Tauri scene shows its own Enter XR button. */ +export const ENTER_XR_IN_SCENE_MESSAGE = 'Put on the headset and press Enter XR in the scene: the immersive session starts from a click inside it.'; diff --git a/apps/ide/src/main/appIcon.ts b/apps/ide/src/main/appIcon.ts index b9d0e7a55..19e3fa5f3 100644 --- a/apps/ide/src/main/appIcon.ts +++ b/apps/ide/src/main/appIcon.ts @@ -1,4 +1,4 @@ -import { app } from 'electron'; +import { app } from './host/desktop.ts'; import path from 'node:path'; /** diff --git a/apps/ide/src/main/appProtocol.ts b/apps/ide/src/main/appProtocol.ts index 1c432abf8..2895272ca 100644 --- a/apps/ide/src/main/appProtocol.ts +++ b/apps/ide/src/main/appProtocol.ts @@ -1,4 +1,4 @@ -import { net, protocol } from 'electron'; +import { net, protocol } from './host/desktop.ts'; import { pathToFileURL } from 'node:url'; import { APP_HOST, APP_SCHEME, buildContentSecurityPolicy } from './security.ts'; import { resolveRendererAsset } from './assetPath.ts'; diff --git a/apps/ide/src/main/bench.ts b/apps/ide/src/main/bench.ts index 4e7da60ba..6b0d37c03 100644 --- a/apps/ide/src/main/bench.ts +++ b/apps/ide/src/main/bench.ts @@ -10,3 +10,13 @@ export const BENCH_FLAG = '--codexr-bench'; export const BENCH_RESULT_PREFIX = 'CODEXR_BENCH_RESULT '; export const BENCH_QUERY_PARAMETER = 'bench'; + +/** A benchmark run tells the renderer to start its driver (renderer/bench/benchDriver.ts). */ +export function benchUrl(url: string, isBench: boolean): string { + if (!isBench) { + return url; + } + const parsed = new URL(url); + parsed.searchParams.set(BENCH_QUERY_PARAMETER, '1'); + return parsed.toString(); +} diff --git a/apps/ide/src/main/boot.ts b/apps/ide/src/main/boot.ts new file mode 100644 index 000000000..58554b15d --- /dev/null +++ b/apps/ide/src/main/boot.ts @@ -0,0 +1,192 @@ +import { app, type BrowserWindow } from './host/desktop.ts'; +import path from 'node:path'; +import { registerIpcHandlers } from './ipc.ts'; +import { ExtensionHostManager } from './extensions/extensionHostManager.ts'; +import { ExtensionsService } from './extensions/extensionsService.ts'; +import { fileStorage, memoryStorage, SettingsService } from './settings/settingsService.ts'; +import { KeybindingsService } from './settings/keybindingsService.ts'; +import { KEYBINDINGS_FILE_NAME } from '../shared/keybindings.ts'; +import { applyColorTheme } from './settings/theme.ts'; +import { OutputService } from './outputPanel/outputService.ts'; +import { CLAUDE_REMOTE_CONTROL_SETTING, COLOR_THEME_SETTING, formatSettingsFile } from '../shared/settings.ts'; +import { startCore, type CoreServices } from './core/coreRuntime.ts'; +import { installApplicationMenu, setAboutDependencies } from './menu.ts'; +import { checkForUpdates } from './updates/updateCheck.ts'; +import { canRepair, describeDependencies, formatDependencies } from './dependencies/dependencyReport.ts'; +import { decideDisplayLanguage } from './displayLanguage.ts'; +import { LOCALE_SETTING, type Locale } from '../shared/i18n/i18n.ts'; +import { initWorkspaceTrust } from './trust/workspaceTrust.ts'; +import { JsonKeyValueStore } from './core/jsonStore.ts'; +import { log } from './log.ts'; +import { IPC_EVENTS } from '../shared/api.ts'; +import { folderArgument } from './workspace/workspacePath.ts'; +import { initRecentFolders, openRecentFolder, recentFolderList, setWorkspace } from './workspace/workspaceWindows.ts'; +import { chooseStartupFolder } from './workspace/startupFolder.ts'; +import { createTerminalHost, type TerminalHost } from './terminal/terminalHost.ts'; +import { startAgents, type AgentServices } from './agents/agentsRuntime.ts'; +import { startAgentSessions, type AgentSessionsRuntime } from './agentSessions/agentSessionsRuntime.ts'; +import { setScenePreloadPath } from './analysis/sceneView.ts'; +import { createLspHost, type LspHost } from './lsp/lspHost.ts'; +import { stopAllDebugSessions } from './debug/debugHost.ts'; + +/** + * The IDE's boot sequence, shared by both desktop shells (#482): the + * Electron main process (index.ts) and the Tauri build's Node sidecar + * (src/sidecar/index.ts). Each shell does only what is its own around it: + * Electron registers its protocols and hardening and opens the window + * itself; the sidecar lets the Rust core do that. + */ +export interface BootOptions { + /** out/, where the bundles sit side by side (see scripts/build.mjs). */ + readonly outDir: string; + readonly argv: readonly string[]; + readonly origins: ReadonlySet; + readonly isDevelopment: boolean; + readonly isSmoke: boolean; + readonly isBench: boolean; + /** The extension host script, out of the asar archive when packaged. */ + readonly extensionHostPath: string; +} + +export interface BootedServices { + readonly core: CoreServices; + readonly terminals: TerminalHost; + readonly languageServers: LspHost; + readonly settings: SettingsService; + /** The display language decided at start-up (CI13, #405). */ + readonly locale: Locale; +} + +// #137: every pty dies with the app. `app.exit` (the smoke run) skips +// will-quit, so that path kills them itself. +let terminals: TerminalHost | null = null; +// A12: MCP server processes likewise. +let agentServices: AgentServices | null = null; +// AF1: coding agents (one process per chat) likewise; their chats are written first. +let agentSessions: AgentSessionsRuntime | null = null; +// #21: so do the language servers. +let languageServers: LspHost | null = null; + +/** Stops what the services started; both shells call it when the app quits. */ +export function stopServices(): void { + void terminals?.killAll(); + void agentServices?.mcp.closeAll(); + void agentSessions?.service.stopAll(); + void languageServers?.stopAll(); + // #180: debug sessions end their adapter and their program. + void stopAllDebugSessions(); +} + +/** Everything before the first window: services, IPC handlers, theme, language, menu. */ +export async function startServices(options: BootOptions): Promise { + const { isSmoke, isBench, isDevelopment } = options; + // #174: the Output panel collects from the first line on. + const output = new OutputService(); + output.install(); + const terminalHost = createTerminalHost({ isSmoke }); + terminals = terminalHost; + /** #16: the scene view's own preload (only `CodeXRHostBridge.openInEditor`). */ + setScenePreloadPath(path.join(options.outDir, 'scenePreload', 'index.cjs')); + const core = startCore({ isSmoke }); + setAboutDependencies({ + async describe() { + const [python, parsers, cloudflared] = await Promise.all([core.python.status(), core.python.parsersStatus(), core.cloudflared.status()]); + return { text: formatDependencies(describeDependencies(python, parsers, cloudflared)), repairable: canRepair(python, cloudflared) }; + }, + repair: () => void installDependencies(core), + }); + // #18: the user's settings; the smoke run keeps its own in memory. + // #403, CI12: no launch animation and no welcome tour over the smoke run's probes. + const settings = new SettingsService(isSmoke || isBench ? memoryStorage(formatSettingsFile({ 'workbench.startupAnimation': false, 'workbench.welcomeTour': false })) : fileStorage(path.join(app.getPath('userData'), 'settings.json'))); + // #18, part 3: the user's keybindings, likewise in memory for the smoke run. + const keybindingsFile = path.join(app.getPath('userData'), KEYBINDINGS_FILE_NAME); + const keybindings = isSmoke ? new KeybindingsService(memoryStorage(), null) : new KeybindingsService(fileStorage(keybindingsFile), keybindingsFile); + agentServices = startAgents({ isSmoke, commandRunner: terminalHost.commandRunner }); + // The smoke run may never start an agent: the service refuses to spawn there. + agentSessions = startAgentSessions({ isSmoke, terminal: terminalHost, profiles: agentServices.profiles, analysisOutput: (contents) => core.analysis.outputDirectory(contents), analysis: core.analysis, + // #456: Claude Code chats on claude.ai, from the user's settings (the smoke run never asks). + ...(isSmoke ? {} : { + claudeRemoteControlSetting: { + get: async () => (await settings.snapshot(null)).effective[CLAUDE_REMOTE_CONTROL_SETTING], + set: async (mode: 'always' | 'never') => { + await settings.update(null, 'user', CLAUDE_REMOTE_CONTROL_SETTING, mode); + }, + }, + }), + }); + // #177: workspace trust decisions, in the user-data folder (in memory for the smoke run). + const trustFile = isSmoke ? null : new JsonKeyValueStore(path.join(app.getPath('userData'), 'workspace-trust.json')); + let smokeTrust: unknown = []; + initWorkspaceTrust({ + load: () => (trustFile ? trustFile.get('folders') : smokeTrust), + save: async (decisions) => { + if (trustFile) { + await trustFile.update('folders', decisions); + } else { + smokeTrust = decisions; + } + }, + }); + const lsp = createLspHost(); + languageServers = lsp; + // #251: VS Code extensions, in the user-data folder (a throwaway one in the smoke run). + const extensions = new ExtensionsService({ + root: isSmoke ? path.join(app.getPath('temp'), `codexr-smoke-extensions-${process.pid}`) : path.join(app.getPath('userData'), 'extensions'), + settings, + disableExtensions: options.argv.includes('--disable-extensions'), + }); + // #259: the extensions' code runs in a host process per window, never here or in the renderer. + const extensionHosts = new ExtensionHostManager({ service: extensions, hostScript: options.extensionHostPath, isDevelopment }); + extensions.attachHost((handle) => extensionHosts.register(handle)); + app.on('will-quit', () => void extensionHosts.stopAll()); + registerIpcHandlers(options.origins, isDevelopment, core, terminalHost, settings, keybindings, output, agentServices, lsp, agentSessions, extensions); + const userSettings = (await settings.snapshot(null)).effective; + // #171: the stored theme, before the first window paints. + applyColorTheme(userSettings[COLOR_THEME_SETTING]); + // CI13 (#405): the display language, before the menu and the first window are built. + const locale = decideDisplayLanguage(userSettings[LOCALE_SETTING], isSmoke); + log.info(`Display language: ${locale}.`); + installApplicationMenu(isDevelopment); + if (!isSmoke && !isBench) { + await initRecentFolders(path.join(app.getPath('userData'), 'recent-folders.json'), (list) => installApplicationMenu(isDevelopment, list)) + .catch((error: unknown) => log.warn(`Recent folders unavailable: ${String(error)}`)); + } + return { core, terminals: terminalHost, languageServers: lsp, settings, locale }; +} + +/** Everything once the first window loaded: the update check, the start-up folder, the dependencies. */ +export async function afterFirstWindow(win: BrowserWindow, services: BootedServices, options: BootOptions): Promise { + const { isSmoke, isBench } = options; + // #20: an update check is a network call, so it runs unasked only once the person turned it on. + if (!isSmoke && !isBench && (await services.settings.snapshot(null)).effective['update.checkOnStartup'] === true) { + void checkForUpdates(win, { manual: false }); + } + + const startup = chooseStartupFolder(folderArgument(options.argv), recentFolderList(), isSmoke); + if (startup.kind !== 'none') { + try { + // #151: the last folder goes through the recent list, which drops it if it is gone. + const info = startup.kind === 'argument' + ? await setWorkspace(win.webContents, startup.folder) + : await openRecentFolder(win.webContents, startup.folder); + win.webContents.send(IPC_EVENTS.workspaceChanged, info); + } catch (error) { + log.warn(`Could not reopen ${startup.folder}: ${String(error)}`); + } + } + + // #154: the IDE installs its own analysis dependencies, with progress in the + // window's notifications, never in the smoke run (it must download nothing). + if (!isSmoke && !isBench) { + void installDependencies(services.core); + } +} + +/** + * #154/#160: the IDE installs what it needs with no question: the Python + * environment, then cloudflared, one download at a time. Never throws. + */ +async function installDependencies(core: CoreServices): Promise { + await core.python.ensureReady().catch((error: unknown) => log.error('Could not set up the Python environment.', error)); + await core.cloudflared.ensureInstalled(); +} diff --git a/apps/ide/src/main/codexr/analysesService.ts b/apps/ide/src/main/codexr/analysesService.ts index ae2d83a51..e495da0bb 100644 --- a/apps/ide/src/main/codexr/analysesService.ts +++ b/apps/ide/src/main/codexr/analysesService.ts @@ -1,4 +1,4 @@ -import { BrowserWindow } from 'electron'; +import { BrowserWindow } from '../host/desktop.ts'; import { listActiveAnalyses } from '@codexr/core/analysis/session/activeAnalyses'; import { UnifiedSessionRegistry } from '@codexr/core/analysis/session/sessionRegistry'; import type { HostDisposable } from '@codexr/core/host/codeXRHost'; diff --git a/apps/ide/src/main/codexr/codexrIpc.ts b/apps/ide/src/main/codexr/codexrIpc.ts index 0ed6ca609..7d9c8e2de 100644 --- a/apps/ide/src/main/codexr/codexrIpc.ts +++ b/apps/ide/src/main/codexr/codexrIpc.ts @@ -1,4 +1,4 @@ -import { shell, type IpcMainInvokeEvent } from 'electron'; +import { shell, type IpcMainInvokeEvent } from '../host/desktop.ts'; import { CODEXR_IPC_CHANNELS, parseAnalysisAction, parseParticipantRef, parseSceneMode, parseServerAction, parseSettingsPatch } from '../../shared/codexr.ts'; import type { AnalysisService } from '../analysis/analysisService.ts'; import type { AnalysesService } from './analysesService.ts'; diff --git a/apps/ide/src/main/codexr/serversService.ts b/apps/ide/src/main/codexr/serversService.ts index 1370fe200..2c0f9a1e8 100644 --- a/apps/ide/src/main/codexr/serversService.ts +++ b/apps/ide/src/main/codexr/serversService.ts @@ -1,4 +1,4 @@ -import { BrowserWindow, clipboard } from 'electron'; +import { BrowserWindow, clipboard } from '../host/desktop.ts'; import { UnifiedSessionRegistry } from '@codexr/core/analysis/session/sessionRegistry'; import { COLLABORATION_AVATARS } from '@codexr/core/collaboration/collaborationProfile'; import type { HostDisposable } from '@codexr/core/host/codeXRHost'; diff --git a/apps/ide/src/main/codexr/settingsService.ts b/apps/ide/src/main/codexr/settingsService.ts index 3ff3158d0..1f0cd2076 100644 --- a/apps/ide/src/main/codexr/settingsService.ts +++ b/apps/ide/src/main/codexr/settingsService.ts @@ -1,4 +1,4 @@ -import { BrowserWindow } from 'electron'; +import { BrowserWindow } from '../host/desktop.ts'; import { DEFAULT_COLLABORATION_PROFILE } from '@codexr/core/collaboration/collaborationProfile'; import { CollaborationProfileManager } from '@codexr/core/collaboration/collaborationProfileManager'; import { ServerSettingsManager } from '@codexr/core/server/serverSettingsManager'; diff --git a/apps/ide/src/main/core/coreRuntime.ts b/apps/ide/src/main/core/coreRuntime.ts index 937c1abe7..45a4a8af1 100644 --- a/apps/ide/src/main/core/coreRuntime.ts +++ b/apps/ide/src/main/core/coreRuntime.ts @@ -1,9 +1,10 @@ -import { app, BrowserWindow } from 'electron'; +import { app, BrowserWindow } from '../host/desktop.ts'; import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import { getHost, initializeHost } from '@codexr/core/host/hostRegistry'; import { setServerBindHost } from '@codexr/core/server/serverBindHost'; +import { setLocalSceneLibraries } from '@codexr/core/server/http/localSceneLibraries'; import { IPC_EVENTS, type HostNotification, type ProgressEvent } from '../../shared/api.ts'; import { createElectronHost } from './electronHost.ts'; import { PythonEnvironmentService } from '../python/pythonEnvironment.ts'; @@ -72,7 +73,11 @@ export function startCore(options: { readonly isSmoke: boolean }): CoreServices })); python = new PythonEnvironmentService(storageDir, (status) => broadcast(IPC_EVENTS.pythonStatusChanged, status)); // The vendored copies of the scene's CDN libraries (analysis/sceneLibraries.ts); #20 packages them. - setSceneLibrariesDir(path.join(installRoot, 'test', 'vendor', 'scene-libraries')); + // The analysis servers serve them to this machine's pages (#483: a system webview cannot + // intercept https); the Electron scene view also answers any CDN URL left from them. + const librariesDir = path.join(installRoot, 'test', 'vendor', 'scene-libraries'); + setLocalSceneLibraries(librariesDir); + setSceneLibrariesDir(librariesDir); const metrics = new FunctionMetricsService(python); const analysis = new AnalysisService(python, subscriptions, { sceneOpened: (contents, folder) => metrics.analyse(contents, folder) }); const servers = new ServersService(analysis, subscriptions); diff --git a/apps/ide/src/main/core/electronHost.ts b/apps/ide/src/main/core/electronHost.ts index e262e9c13..3458204d3 100644 --- a/apps/ide/src/main/core/electronHost.ts +++ b/apps/ide/src/main/core/electronHost.ts @@ -1,4 +1,4 @@ -import { BrowserWindow, clipboard, dialog, shell } from 'electron'; +import { BrowserWindow, clipboard, dialog, shell } from '../host/desktop.ts'; import path from 'node:path'; import type { CodeXRHost, diff --git a/apps/ide/src/main/debug/debugHost.ts b/apps/ide/src/main/debug/debugHost.ts index 989b99087..b66d713b0 100644 --- a/apps/ide/src/main/debug/debugHost.ts +++ b/apps/ide/src/main/debug/debugHost.ts @@ -1,4 +1,4 @@ -import type { IpcMainInvokeEvent, WebContents } from 'electron'; +import type { IpcMainInvokeEvent, WebContents } from '../host/desktop.ts'; import { spawn } from 'node:child_process'; import fs from 'node:fs'; import path from 'node:path'; diff --git a/apps/ide/src/main/debug/nodeAdapter.ts b/apps/ide/src/main/debug/nodeAdapter.ts index dd5026902..6da2891bc 100644 --- a/apps/ide/src/main/debug/nodeAdapter.ts +++ b/apps/ide/src/main/debug/nodeAdapter.ts @@ -50,7 +50,7 @@ interface CallFrame { const THREAD_ID = 1; const LISTENING = /Debugger listening on (ws:\/\/[^\s]+)/; /** What Node prints about the inspector, which is not the program's output. */ -const INSPECTOR_NOISE = /^(Debugger listening on |For help, see: https:\/\/nodejs\.org\/|Debugger attached\.|Waiting for the debugger to disconnect\.\.\.)/; +const INSPECTOR_NOISE = /^(Debugger listening on |For help, see: https:\/\/nodejs\.org\/|Debugger attached\.|Debugger ending on |Waiting for the debugger to disconnect\.\.\.)/; const CONNECT_TIMEOUT_MS = 15_000; const MAX_PROPERTIES = 1000; const MAX_VALUE_LENGTH = 1000; diff --git a/apps/ide/src/main/displayLanguage.ts b/apps/ide/src/main/displayLanguage.ts index f51e49b5d..e8a5c9afa 100644 --- a/apps/ide/src/main/displayLanguage.ts +++ b/apps/ide/src/main/displayLanguage.ts @@ -1,4 +1,4 @@ -import { app } from 'electron'; +import { app } from './host/desktop.ts'; import { LOCALE_QUERY_PARAMETER, resolveLocale, setLocale, type Locale } from '../shared/i18n/i18n.ts'; import { log } from './log.ts'; diff --git a/apps/ide/src/main/extensions/extensionHostManager.ts b/apps/ide/src/main/extensions/extensionHostManager.ts index 8f0872519..867ba7853 100644 --- a/apps/ide/src/main/extensions/extensionHostManager.ts +++ b/apps/ide/src/main/extensions/extensionHostManager.ts @@ -1,4 +1,4 @@ -import { app, BrowserWindow, clipboard, dialog, shell, type IpcMainInvokeEvent, type WebContents } from 'electron'; +import { app, BrowserWindow, clipboard, dialog, shell, type IpcMainInvokeEvent, type WebContents } from '../host/desktop.ts'; import { fork, type ChildProcess } from 'node:child_process'; import crypto from 'node:crypto'; import fs from 'node:fs'; @@ -26,6 +26,7 @@ import { inlineTreeIcons } from './viewIcons.ts'; import { ExtensionSettingsStore } from './extensionSettings.ts'; import type { ActivationSource, ExtensionsService } from './extensionsService.ts'; import type { LoadedExtension } from './extensionStore.ts'; +import { nodeModeEnv } from '../nodeRuntime.ts'; type Handle = (channel: string, handler: (event: IpcMainInvokeEvent, ...args: unknown[]) => unknown) => void; @@ -143,7 +144,7 @@ export class ExtensionHostManager implements ActivationSource { const child = fork(this.hostScript, [], { execPath: process.execPath, cwd: folder ?? app.getPath('home'), - env: serverEnvironment(process.env, { ELECTRON_RUN_AS_NODE: '1', CODEXR_EXTENSION_HOST: '1' }), + env: serverEnvironment(process.env, { ...nodeModeEnv(), CODEXR_EXTENSION_HOST: '1' }), stdio: ['ignore', 'pipe', 'pipe', 'ipc'], serialization: 'advanced', ...(this.isDevelopment ? { execArgv: ['--enable-source-maps'] } : {}), diff --git a/apps/ide/src/main/extensions/extensionsService.ts b/apps/ide/src/main/extensions/extensionsService.ts index e58190087..c413b68a5 100644 --- a/apps/ide/src/main/extensions/extensionsService.ts +++ b/apps/ide/src/main/extensions/extensionsService.ts @@ -1,4 +1,4 @@ -import { BrowserWindow, dialog, net, type IpcMainInvokeEvent, type WebContents } from 'electron'; +import { BrowserWindow, dialog, net, type IpcMainInvokeEvent, type WebContents } from '../host/desktop.ts'; import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; diff --git a/apps/ide/src/main/extensions/webviewServer.ts b/apps/ide/src/main/extensions/webviewServer.ts index 9be4da04d..6bd4520e7 100644 --- a/apps/ide/src/main/extensions/webviewServer.ts +++ b/apps/ide/src/main/extensions/webviewServer.ts @@ -1,4 +1,4 @@ -import { net, protocol } from 'electron'; +import { net, protocol } from '../host/desktop.ts'; import crypto from 'node:crypto'; import path from 'node:path'; import { pathToFileURL } from 'node:url'; diff --git a/apps/ide/src/main/git/gitIpc.ts b/apps/ide/src/main/git/gitIpc.ts index fe4dd69bb..e6167e76b 100644 --- a/apps/ide/src/main/git/gitIpc.ts +++ b/apps/ide/src/main/git/gitIpc.ts @@ -1,4 +1,4 @@ -import { BrowserWindow, dialog, shell, type IpcMainInvokeEvent, type MessageBoxOptions, type WebContents } from 'electron'; +import { BrowserWindow, dialog, shell, type IpcMainInvokeEvent, type MessageBoxOptions, type WebContents } from '../host/desktop.ts'; import fs from 'node:fs'; import path from 'node:path'; import { emptyGitStatus, GIT_IPC_CHANNELS, GIT_IPC_EVENTS, isGitRemoteOperation, type GitCommitResult, type GitDeleteBranchResult, type GitRemoteResult, type GitStatus } from '../../shared/git.ts'; diff --git a/apps/ide/src/main/hardening.ts b/apps/ide/src/main/hardening.ts index 704ddaa41..b5a099577 100644 --- a/apps/ide/src/main/hardening.ts +++ b/apps/ide/src/main/hardening.ts @@ -1,4 +1,4 @@ -import { app, session, type WebContents, type WebFrameMain } from 'electron'; +import { app, session, type WebContents, type WebFrameMain } from './host/desktop.ts'; import { buildContentSecurityPolicy, isAllowedNavigation } from './security.ts'; import { log } from './log.ts'; diff --git a/apps/ide/src/main/host/desktop.ts b/apps/ide/src/main/host/desktop.ts new file mode 100644 index 000000000..19949f3c4 --- /dev/null +++ b/apps/ide/src/main/host/desktop.ts @@ -0,0 +1,42 @@ +/** + * The desktop seam (#480/#482, epic #477: the move from Electron to Tauri 2). + * + * Every Node-side module of the IDE that needs the desktop (windows, dialogs, + * clipboard, the OS shell, secrets, the theme...) imports it from here, never + * from `electron` directly. This file is the Electron implementation: it only + * re-exports Electron, so the Electron build behaves exactly as before. + * + * The Tauri build (the Node sidecar, scripts/viteConfigs.mjs) swaps this + * module for `src/sidecar/tauriHost.ts`, which implements the same subset by + * asking the Rust core over JSON-RPC. Add a name here only together with its + * counterpart there. + */ +export { + app, + BrowserWindow, + clipboard, + desktopCapturer, + dialog, + ipcMain, + Menu, + nativeImage, + nativeTheme, + net, + protocol, + safeStorage, + session, + shell, + webContents, + WebContentsView, +} from 'electron'; +export type { + IpcMainInvokeEvent, + MenuItemConstructorOptions, + MessageBoxOptions, + Session, + WebContents, + WebFrameMain, +} from 'electron'; + +/** Which shell this build runs in (the sidecar's implementation says `tauri`). */ +export const DESKTOP_SHELL: 'electron' | 'tauri' = 'electron'; diff --git a/apps/ide/src/main/index.ts b/apps/ide/src/main/index.ts index 28b8c223d..bb6512214 100644 --- a/apps/ide/src/main/index.ts +++ b/apps/ide/src/main/index.ts @@ -1,50 +1,24 @@ -import { app, BrowserWindow, nativeTheme } from 'electron'; +import { app, BrowserWindow, nativeTheme } from './host/desktop.ts'; import fs from 'node:fs'; import path from 'node:path'; import { applyProcessHardening } from './hardening.ts'; import { registerAppSchemeAsPrivileged, serveRenderer } from './appProtocol.ts'; import { serveWebviews } from './extensions/webviewServer.ts'; -import { registerIpcHandlers } from './ipc.ts'; -import { ExtensionHostManager } from './extensions/extensionHostManager.ts'; -import { ExtensionsService } from './extensions/extensionsService.ts'; -import { fileStorage, memoryStorage, SettingsService } from './settings/settingsService.ts'; -import { KeybindingsService } from './settings/keybindingsService.ts'; -import { KEYBINDINGS_FILE_NAME } from '../shared/keybindings.ts'; -import { applyColorTheme } from './settings/theme.ts'; -import { OutputService } from './outputPanel/outputService.ts'; -import { CLAUDE_REMOTE_CONTROL_SETTING, COLOR_THEME_SETTING, formatSettingsFile } from '../shared/settings.ts'; -import { startCore, type CoreServices } from './core/coreRuntime.ts'; -import { installApplicationMenu, setAboutDependencies } from './menu.ts'; -import { checkForUpdates } from './updates/updateCheck.ts'; -import { canRepair, describeDependencies, formatDependencies } from './dependencies/dependencyReport.ts'; import { createMainWindow } from './window.ts'; -import { decideDisplayLanguage, withLocale } from './displayLanguage.ts'; -import { getLocale, LOCALE_SETTING } from '../shared/i18n/i18n.ts'; +import { withLocale } from './displayLanguage.ts'; +import { getLocale } from '../shared/i18n/i18n.ts'; import { runSmoke, SMOKE_FLAG, SMOKE_RESULT_PREFIX } from './smoke.ts'; -import { BENCH_FLAG, BENCH_QUERY_PARAMETER } from './bench.ts'; +import { BENCH_FLAG, benchUrl } from './bench.ts'; import { probeProgramInput } from './smokeProgramInput.ts'; -import { initWorkspaceTrust } from './trust/workspaceTrust.ts'; -import { JsonKeyValueStore } from './core/jsonStore.ts'; import { APP_ORIGIN, trustedOrigins } from './security.ts'; import { log } from './log.ts'; -import { IPC_EVENTS } from '../shared/api.ts'; -import { folderArgument } from './workspace/workspacePath.ts'; -import { initRecentFolders, openRecentFolder, recentFolderList, setWorkspace } from './workspace/workspaceWindows.ts'; -import { chooseStartupFolder } from './workspace/startupFolder.ts'; -import { createTerminalHost, type TerminalHost } from './terminal/terminalHost.ts'; -import { startAgents, type AgentServices } from './agents/agentsRuntime.ts'; -import { startAgentSessions, type AgentSessionsRuntime } from './agentSessions/agentSessionsRuntime.ts'; -import { setScenePreloadPath } from './analysis/sceneView.ts'; import { appIconPath } from './appIcon.ts'; -import { createLspHost, type LspHost } from './lsp/lspHost.ts'; -import { stopAllDebugSessions } from './debug/debugHost.ts'; +import { afterFirstWindow, startServices, stopServices, type BootOptions } from './boot.ts'; // Layout of the build output (see scripts/build.mjs): out/main/index.cjs is // this file, next to out/preload/index.cjs and out/renderer/. const OUT_DIR = path.resolve(__dirname, '..'); const PRELOAD_PATH = path.join(OUT_DIR, 'preload', 'index.cjs'); -/** #16: the scene view's own preload (only `CodeXRHostBridge.openInEditor`). */ -const SCENE_PRELOAD_PATH = path.join(OUT_DIR, 'scenePreload', 'index.cjs'); /** * #259: the extension host, a Node child process per window. Installers * unpack it from the asar archive (electron-builder.config.cjs) so it runs @@ -62,6 +36,7 @@ const isSmoke = process.argv.includes(SMOKE_FLAG); const isBench = process.argv.includes(BENCH_FLAG); const origins = trustedOrigins(devServerOrigin); +const bootOptions: BootOptions = { outDir: OUT_DIR, argv: process.argv, origins, isDevelopment, isSmoke, isBench, extensionHostPath: EXTENSION_HOST_PATH }; registerAppSchemeAsPrivileged(); applyProcessHardening(origins, devServerOrigin); @@ -82,138 +57,31 @@ if (!isSmoke && !isBench && !app.requestSingleInstanceLock()) { }); } -// #137: every pty dies with the app. `app.exit` (the smoke run) skips -// will-quit, so that path kills them itself. -let terminals: TerminalHost | null = null; -// A12: MCP server processes likewise. -let agentServices: AgentServices | null = null; -// AF1: coding agents (one process per chat) likewise; their chats are written first. -let agentSessions: AgentSessionsRuntime | null = null; -// #21: so do the language servers. -let languageServers: LspHost | null = null; -app.on('will-quit', () => { - void terminals?.killAll(); - void agentServices?.mcp.closeAll(); - void agentSessions?.service.stopAll(); - void languageServers?.stopAll(); - // #180: debug sessions end their adapter and their program. - void stopAllDebugSessions(); -}); +app.on('will-quit', stopServices); async function start(): Promise { - // #174: the Output panel collects from the first line on. - const output = new OutputService(); - output.install(); nativeTheme.themeSource = 'system'; if (!isDevelopment) { serveRenderer(RENDERER_DIR); } // #261: extensions' webviews, in development too (the dev server serves only the workbench). serveWebviews(); - const terminalHost = createTerminalHost({ isSmoke }); - terminals = terminalHost; - setScenePreloadPath(SCENE_PRELOAD_PATH); // macOS shows the dock icon, not the window's: the Code-XR logo there too. app.dock?.setIcon(appIconPath()); - const core = startCore({ isSmoke }); - setAboutDependencies({ - async describe() { - const [python, parsers, cloudflared] = await Promise.all([core.python.status(), core.python.parsersStatus(), core.cloudflared.status()]); - return { text: formatDependencies(describeDependencies(python, parsers, cloudflared)), repairable: canRepair(python, cloudflared) }; - }, - repair: () => void installDependencies(core), - }); - // #18: the user's settings; the smoke run keeps its own in memory. - // #403, CI12: no launch animation and no welcome tour over the smoke run's probes. - const settings = new SettingsService(isSmoke || isBench ? memoryStorage(formatSettingsFile({ 'workbench.startupAnimation': false, 'workbench.welcomeTour': false })) : fileStorage(path.join(app.getPath('userData'), 'settings.json'))); - // #18, part 3: the user's keybindings, likewise in memory for the smoke run. - const keybindingsFile = path.join(app.getPath('userData'), KEYBINDINGS_FILE_NAME); - const keybindings = isSmoke ? new KeybindingsService(memoryStorage(), null) : new KeybindingsService(fileStorage(keybindingsFile), keybindingsFile); - agentServices = startAgents({ isSmoke, commandRunner: terminalHost.commandRunner }); - // The smoke run may never start an agent: the service refuses to spawn there. - agentSessions = startAgentSessions({ isSmoke, terminal: terminalHost, profiles: agentServices.profiles, analysisOutput: (contents) => core.analysis.outputDirectory(contents), analysis: core.analysis, - // #456: Claude Code chats on claude.ai, from the user's settings (the smoke run never asks). - ...(isSmoke ? {} : { - claudeRemoteControlSetting: { - get: async () => (await settings.snapshot(null)).effective[CLAUDE_REMOTE_CONTROL_SETTING], - set: async (mode: 'always' | 'never') => { - await settings.update(null, 'user', CLAUDE_REMOTE_CONTROL_SETTING, mode); - }, - }, - }), - }); - // #177: workspace trust decisions, in the user-data folder (in memory for the smoke run). - const trustFile = isSmoke ? null : new JsonKeyValueStore(path.join(app.getPath('userData'), 'workspace-trust.json')); - let smokeTrust: unknown = []; - initWorkspaceTrust({ - load: () => (trustFile ? trustFile.get('folders') : smokeTrust), - save: async (decisions) => { - if (trustFile) { - await trustFile.update('folders', decisions); - } else { - smokeTrust = decisions; - } - }, - }); - const lsp = createLspHost(); - languageServers = lsp; - // #251: VS Code extensions, in the user-data folder (a throwaway one in the smoke run). - const extensions = new ExtensionsService({ - root: isSmoke ? path.join(app.getPath('temp'), `codexr-smoke-extensions-${process.pid}`) : path.join(app.getPath('userData'), 'extensions'), - settings, - disableExtensions: process.argv.includes('--disable-extensions'), - }); - // #259: the extensions' code runs in a host process per window, never here or in the renderer. - const extensionHosts = new ExtensionHostManager({ service: extensions, hostScript: EXTENSION_HOST_PATH, isDevelopment }); - extensions.attachHost((handle) => extensionHosts.register(handle)); - app.on('will-quit', () => void extensionHosts.stopAll()); - registerIpcHandlers(origins, isDevelopment, core, terminalHost, settings, keybindings, output, agentServices, lsp, agentSessions, extensions); - const userSettings = (await settings.snapshot(null)).effective; - // #171: the stored theme, before the first window paints. - applyColorTheme(userSettings[COLOR_THEME_SETTING]); - // CI13 (#405): the display language, before the menu and the first window are built. - const locale = decideDisplayLanguage(userSettings[LOCALE_SETTING], isSmoke); - log.info(`Display language: ${locale}.`); - installApplicationMenu(isDevelopment); - if (!isSmoke && !isBench) { - await initRecentFolders(path.join(app.getPath('userData'), 'recent-folders.json'), (list) => installApplicationMenu(isDevelopment, list)) - .catch((error: unknown) => log.warn(`Recent folders unavailable: ${String(error)}`)); - } + const services = await startServices(bootOptions); const win = await openMainWindow(); log.info(`Window loaded from ${win.webContents.getURL()}${isDevelopment ? ' (dev server)' : ''}.`); - // #20: an update check is a network call, so it runs unasked only once the person turned it on. - if (!isSmoke && !isBench && (await settings.snapshot(null)).effective['update.checkOnStartup'] === true) { - void checkForUpdates(win, { manual: false }); - } - - const startup = chooseStartupFolder(folderArgument(process.argv), recentFolderList(), isSmoke); - if (startup.kind !== 'none') { - try { - // #151: the last folder goes through the recent list, which drops it if it is gone. - const info = startup.kind === 'argument' - ? await setWorkspace(win.webContents, startup.folder) - : await openRecentFolder(win.webContents, startup.folder); - win.webContents.send(IPC_EVENTS.workspaceChanged, info); - } catch (error) { - log.warn(`Could not reopen ${startup.folder}: ${String(error)}`); - } - } - - // #154: the IDE installs its own analysis dependencies, with progress in the - // window's notifications, never in the smoke run (it must download nothing). - if (!isSmoke && !isBench) { - void installDependencies(core); - } + await afterFirstWindow(win, services, bootOptions); if (isSmoke) { const smoke = await runSmoke(win, origins); - const programInput = await probeProgramInput(terminalHost, win.webContents, app.getPath('temp')); + const programInput = await probeProgramInput(services.terminals, win.webContents, app.getPath('temp')); const inputFailures = programInput.filter((run) => !run.answered && !(run.name === 'node-in-ide' && process.platform === 'win32')).map((run) => `typing did not reach a program run in a terminal (${run.name}): ${JSON.stringify(run)}`); const result = { ...smoke, ok: smoke.ok && inputFailures.length === 0, failures: [...smoke.failures, ...inputFailures], programInput }; process.stdout.write(`${SMOKE_RESULT_PREFIX}${JSON.stringify(result)}\n`); - await terminalHost.killAll(); - await lsp.stopAll(); + await services.terminals.killAll(); + await services.languageServers.stopAll(); app.exit(result.ok ? 0 : 1); return; } @@ -230,36 +98,17 @@ function openMainWindow(): Promise { return createMainWindow({ preloadPath: PRELOAD_PATH, // CI13 (#405): the renderer reads its language from the URL, so it draws in it from the first paint. - url: benchUrl(withLocale(devServerUrl ?? `${APP_ORIGIN}/index.html`, getLocale())), + url: benchUrl(withLocale(devServerUrl ?? `${APP_ORIGIN}/index.html`, getLocale()), isBench), show: !isSmoke, }); } -/** A benchmark run tells the renderer to start its driver (renderer/bench/benchDriver.ts). */ -function benchUrl(url: string): string { - if (!isBench) { - return url; - } - const parsed = new URL(url); - parsed.searchParams.set(BENCH_QUERY_PARAMETER, '1'); - return parsed.toString(); -} - app.on('window-all-closed', () => { if (process.platform !== 'darwin') { app.quit(); } }); -/** - * #154/#160: the IDE installs what it needs with no question: the Python - * environment, then cloudflared, one download at a time. Never throws. - */ -async function installDependencies(core: CoreServices): Promise { - await core.python.ensureReady().catch((error: unknown) => log.error('Could not set up the Python environment.', error)); - await core.cloudflared.ensureInstalled(); -} - /** The `app.asar.unpacked` copy of a file of the archive, when there is one. */ function unpackedPath(file: string): string { const unpacked = file.replace(`app.asar${path.sep}`, `app.asar.unpacked${path.sep}`); diff --git a/apps/ide/src/main/ipc.ts b/apps/ide/src/main/ipc.ts index 3be035aa6..60416fbbc 100644 --- a/apps/ide/src/main/ipc.ts +++ b/apps/ide/src/main/ipc.ts @@ -1,4 +1,4 @@ -import { app, BrowserWindow, clipboard, ipcMain, shell, type IpcMainInvokeEvent, type WebContents } from 'electron'; +import { app, BrowserWindow, clipboard, ipcMain, shell, type IpcMainInvokeEvent, type WebContents } from './host/desktop.ts'; import type { CoreServices } from './core/coreRuntime.ts'; import { isAnalysisKind } from '../shared/analysisKinds.ts'; import { BENCH_FLAG, BENCH_RESULT_PREFIX } from './bench.ts'; diff --git a/apps/ide/src/main/lsp/lspHost.ts b/apps/ide/src/main/lsp/lspHost.ts index dd3030d8f..ac8499f7f 100644 --- a/apps/ide/src/main/lsp/lspHost.ts +++ b/apps/ide/src/main/lsp/lspHost.ts @@ -1,4 +1,4 @@ -import type { WebContents } from 'electron'; +import type { WebContents } from '../host/desktop.ts'; import fs from 'node:fs'; import { createRequire } from 'node:module'; import path from 'node:path'; diff --git a/apps/ide/src/main/lsp/lspIpc.ts b/apps/ide/src/main/lsp/lspIpc.ts index 9d53e7765..64d23e49d 100644 --- a/apps/ide/src/main/lsp/lspIpc.ts +++ b/apps/ide/src/main/lsp/lspIpc.ts @@ -1,4 +1,4 @@ -import type { IpcMainInvokeEvent } from 'electron'; +import type { IpcMainInvokeEvent } from '../host/desktop.ts'; import { LSP_IPC_CHANNELS } from '../../shared/lsp.ts'; import type { LspHost } from './lspHost.ts'; diff --git a/apps/ide/src/main/lsp/lspServers.ts b/apps/ide/src/main/lsp/lspServers.ts index 6220cbf01..c7ee1a2de 100644 --- a/apps/ide/src/main/lsp/lspServers.ts +++ b/apps/ide/src/main/lsp/lspServers.ts @@ -1,4 +1,5 @@ import path from 'node:path'; +import { nodeModeEnv } from '../nodeRuntime.ts'; /** * Which program serves each language (#21). The renderer never names one: @@ -40,7 +41,7 @@ export function typescriptServerCommand(paths: { readonly execPath: string; read name: 'typescript-language-server', command: paths.execPath, args: [paths.cliPath, '--stdio', '--log-level', '2'], - env: serverEnvironment(env, { ELECTRON_RUN_AS_NODE: '1' }), + env: serverEnvironment(env, { ...nodeModeEnv() }), initializationOptions: { hostInfo: 'code-xr-ide', tsserver: { path: paths.tsserverPath }, diff --git a/apps/ide/src/main/menu.ts b/apps/ide/src/main/menu.ts index 4e36bd8ff..34f882df1 100644 --- a/apps/ide/src/main/menu.ts +++ b/apps/ide/src/main/menu.ts @@ -1,4 +1,4 @@ -import { app, BrowserWindow, dialog, Menu, nativeImage, type MenuItemConstructorOptions } from 'electron'; +import { app, BrowserWindow, dialog, Menu, nativeImage, type MenuItemConstructorOptions } from './host/desktop.ts'; import { appIconPath } from './appIcon.ts'; import { IDE_COMMANDS, IPC_EVENTS, type IdeCommand } from '../shared/api.ts'; import { electronAccelerator, isChord, isValidKeybinding, menuAccelerator } from '../shared/keybindings.ts'; diff --git a/apps/ide/src/main/menuTemplate.ts b/apps/ide/src/main/menuTemplate.ts index 6ac62a4e9..e3b54e950 100644 --- a/apps/ide/src/main/menuTemplate.ts +++ b/apps/ide/src/main/menuTemplate.ts @@ -1,4 +1,4 @@ -import type { MenuItemConstructorOptions } from 'electron'; +import type { MenuItemConstructorOptions } from './host/desktop.ts'; import type { IdeCommand } from '../shared/api.ts'; import type { MenuToggles } from '../shared/settings.ts'; import { getLocale, t, type MessageKey } from '../shared/i18n/i18n.ts'; diff --git a/apps/ide/src/main/nodeRuntime.ts b/apps/ide/src/main/nodeRuntime.ts new file mode 100644 index 000000000..33a44b5d5 --- /dev/null +++ b/apps/ide/src/main/nodeRuntime.ts @@ -0,0 +1,21 @@ +/** + * How a child process runs the IDE's own executable as Node.js (#482). + * + * On Electron, `process.execPath` is the Electron binary, which behaves as + * Node only with `ELECTRON_RUN_AS_NODE=1`. In the Tauri build the same code + * runs in the Node sidecar, where `process.execPath` is a real Node and the + * variable is not needed: the sidecar calls `useRealNodeRuntime()` before it + * starts anything. Electron is the default so the Electron build (and the + * unit tests) see exactly what they saw before. + */ +let runAsNodeEnv: Readonly> = Object.freeze({ ELECTRON_RUN_AS_NODE: '1' }); + +/** The variables a child started as `process.execPath x'; + assert.equal( + rewriteSceneLibraryUrls(page), + `x`, + ); + // A-Frame's run-time font root, and BabiaXR's literal default font. + assert.equal(rewriteSceneLibraryUrls('a="https://cdn.aframe.io/"'), `a="${LOCAL_SCENE_LIBRARIES_ROUTE}"`); + assert.equal(rewriteSceneLibraryUrls('"https://cdn.aframe.io/fonts/Roboto-msdf.json"'), `"${LOCAL_SCENE_LIBRARIES_ROUTE}fonts/Roboto-msdf.json"`); + }); + + it('serves only the files of the table under the route', async () => { + assert.equal(localLibraryFileOf(`${LOCAL_SCENE_LIBRARIES_ROUTE}aframe-1.7.1.min.js`), 'aframe-1.7.1.min.js'); + assert.equal(localLibraryFileOf(`${LOCAL_SCENE_LIBRARIES_ROUTE}fonts/Roboto-msdf.png`), 'fonts/Roboto-msdf.png'); + assert.equal(localLibraryFileOf(`${LOCAL_SCENE_LIBRARIES_ROUTE}README.md`), null); + assert.equal(localLibraryFileOf(`${LOCAL_SCENE_LIBRARIES_ROUTE}../package.json`), null); + assert.equal(localLibraryFileOf('/aframe-1.7.1.min.js'), null); + + assert.equal(localSceneLibrariesEnabled(), false); + assert.equal(await readLocalLibrary('aframe-1.7.1.min.js'), null); + setLocalSceneLibraries(vendor); + try { + const aframe = (await readLocalLibrary('aframe-1.7.1.min.js'))?.toString('utf8') ?? ''; + assert.ok(aframe.length > 100_000); + assert.ok(!aframe.includes('"https://cdn.aframe.io/"'), 'A-Frame\'s font root still points at the CDN'); + assert.ok(aframe.includes(`"${LOCAL_SCENE_LIBRARIES_ROUTE}"`)); + const png = await readLocalLibrary('fonts/Roboto-msdf.png'); + assert.deepEqual(png?.subarray(0, 4), Buffer.from([0x89, 0x50, 0x4e, 0x47])); + assert.equal(await readLocalLibrary('README.md'), null); + } finally { + setLocalSceneLibraries(null); + } + }); }); diff --git a/apps/ide/test/sceneXr.test.ts b/apps/ide/test/sceneXr.test.ts index f7bc86be1..556569d04 100644 --- a/apps/ide/test/sceneXr.test.ts +++ b/apps/ide/test/sceneXr.test.ts @@ -1,6 +1,7 @@ import { describe, it } from 'node:test'; import assert from 'node:assert/strict'; -import { allowXrPermission, isXrPermission, unsupportedXrMessage, XR_ARM_MS } from '../src/main/analysis/sceneXrPolicy.ts'; +import { allowXrPermission, inIdeXrUnavailable, isXrPermission, unsupportedXrMessage, XR_ARM_MS } from '../src/main/analysis/sceneXrPolicy.ts'; +import { enterXrNote, enterXrState } from '../src/renderer/sceneHeaderModel.ts'; import { qrDrawing } from '@codexr/core/xr/headsetQr'; const ORIGIN = 'http://localhost:3000'; @@ -44,3 +45,26 @@ describe('qrDrawing (#19)', () => { assert.ok(drawing.path.includes(`M4 ${modules + 3}h1v1h-1z`), 'bottom-left finder corner'); }); }); + +describe('Enter XR without dead buttons (#483)', () => { + it('says which paths are left where a Tauri system webview has no WebXR', () => { + assert.equal(inIdeXrUnavailable('electron', 'linux'), null); + assert.equal(inIdeXrUnavailable('electron', 'darwin'), null); + assert.equal(inIdeXrUnavailable('tauri', 'win32'), null, 'WebView2 exposes WebXR: the button stays'); + assert.match(inIdeXrUnavailable('tauri', 'linux') ?? '', /Open in browser.*On a headset/); + assert.match(inIdeXrUnavailable('tauri', 'darwin') ?? '', /no WebXR/); + assert.equal(unsupportedXrMessage('win32', 'tauri'), unsupportedXrMessage('win32')); + assert.equal(unsupportedXrMessage('linux'), unsupportedXrMessage('linux', 'electron')); + }); + + it('hides the button, with the note, where it could never work', () => { + assert.deepEqual(enterXrState({ kind: 'project-xr' }), { visible: true, note: '' }); + assert.deepEqual(enterXrState({ kind: 'file-xr', xrUnavailable: undefined }), { visible: true, note: '' }); + assert.deepEqual(enterXrState({ kind: 'directory-livepanel' }), { visible: false, note: '' }, 'a LivePanel is a 2D page'); + assert.deepEqual(enterXrState({ kind: 'project-livepanel-deep', xrUnavailable: 'none here' }), { visible: false, note: '' }); + assert.deepEqual(enterXrState({ kind: 'directory-xr-deep', xrUnavailable: 'none here' }), { visible: false, note: 'none here' }); + assert.equal(enterXrNote({ ok: true }), ''); + assert.equal(enterXrNote({ ok: true, message: 'press it in the scene' }), 'press it in the scene'); + assert.equal(enterXrNote({ ok: false, reason: 'unsupported', message: 'no headset' }), 'no headset'); + }); +}); diff --git a/apps/ide/test/tauriSceneView.test.ts b/apps/ide/test/tauriSceneView.test.ts new file mode 100644 index 000000000..06535d333 --- /dev/null +++ b/apps/ide/test/tauriSceneView.test.ts @@ -0,0 +1,126 @@ +import { describe, it } from 'node:test'; +import assert from 'node:assert/strict'; +import vm from 'node:vm'; +import { RpcPeer } from '../src/sidecar/rpc.ts'; +import * as tauriHost from '../src/sidecar/tauriHost.ts'; +import { SCENE_EVAL_REPLY, SCENE_OPEN_IN_EDITOR_CHANNEL, sceneEvalScript, toSceneBridgeMessage } from '../src/shared/sceneBridge.ts'; + +interface Sent { + readonly id?: number; + readonly method: string; + readonly params: Record; +} + +/** The sidecar's host, connected to a fake core that answers every request with null. */ +function fakeCore(): { sent: Sent[]; peer: RpcPeer } { + const sent: Sent[] = []; + const peer = new RpcPeer({ + write: (line) => { + const message = JSON.parse(line) as Sent; + sent.push(message); + if (message.id !== undefined) { + queueMicrotask(() => peer.receive(JSON.stringify({ jsonrpc: '2.0', id: message.id, result: null }))); + } + }, + }); + tauriHost.attachCore(peer); + return { sent, peer }; +} + +const tick = (): Promise => new Promise((resolve) => setImmediate(resolve)); + +describe('Tauri scene view (#483)', () => { + it('parses only well-formed bridge messages', () => { + assert.deepEqual(toSceneBridgeMessage({ type: 'open-in-editor', target: { path: 'src/a.ts', line: 3 } }), { type: 'open-in-editor', target: { path: 'src/a.ts', line: 3 } }); + const id = '0123456789abcdef0123'; + assert.deepEqual(toSceneBridgeMessage({ type: 'eval-result', id, ok: true, value: false }), { type: 'eval-result', id, ok: true, value: false }); + assert.deepEqual(toSceneBridgeMessage({ type: 'eval-result', id, ok: false }), { type: 'eval-result', id, ok: false, value: null }); + for (const value of [null, 'x', {}, { type: 'open-in-editor', target: { path: '' } }, { type: 'eval-result', id: 'short', ok: true }, { type: 'eval-result', id, ok: 'yes' }, { type: 'run', code: '1' }]) { + assert.equal(toSceneBridgeMessage(value), null, JSON.stringify(value)); + } + }); + + it('runs an expression in the scene and answers its awaited value through the bridge', async () => { + const replies: unknown[][] = []; + const page = { [SCENE_EVAL_REPLY]: (...args: unknown[]) => replies.push(args), navigator: {} }; + const context = vm.createContext({ window: page, navigator: page.navigator, Promise }); + const id = '11111111-2222-3333-4444-555555555555'; + vm.runInContext(sceneEvalScript(id, 'navigator.xr ? navigator.xr.isSessionSupported("immersive-vr") : false'), context); + vm.runInContext(sceneEvalScript(id.replace('1', '9'), 'Promise.resolve(41).then((n) => n + 1)'), context); + vm.runInContext(sceneEvalScript(id.replace('1', '8'), 'missing.thing'), context); + await tick(); + assert.deepEqual(replies.sort((a, b) => String(a[0]).localeCompare(String(b[0]))), [ + [id, true, false], + [id.replace('1', '8'), false, 'missing is not defined'], + [id.replace('1', '9'), true, 42], + ]); + assert.throws(() => sceneEvalScript('"); evil("', '1'), /Not an evaluation id/); + }); + + it('drives a second webview of the window: made on first load, placed in order, closed', async () => { + const { sent } = fakeCore(); + const win = tauriHost.TauriBrowserWindow.adopt('main'); + const view = new tauriHost.WebContentsView({}); + const label = view.webContents.label; + assert.match(label, /^scene-\d+$/); + view.setVisible(false); + win.contentView.addChildView(view); + view.setBounds({ x: 10, y: 20, width: 300, height: 200 }); + view.setVisible(true); + assert.equal(sent.length, 0, 'nothing reaches the core before the webview exists'); + + const loading = view.webContents.loadURL('http://127.0.0.1:3000/'); + await tick(); + const create = sent.find((message) => message.method === 'host.scene.create'); + assert.deepEqual(create?.params, { window: 'main', webview: label, url: 'http://127.0.0.1:3000/', bounds: { x: 10, y: 20, width: 300, height: 200 }, visible: true }); + tauriHost.handleWindowEvent({ window: label, event: 'loaded', url: 'http://127.0.0.1:3000/' }); + await loading; + assert.equal(view.webContents.getURL(), 'http://127.0.0.1:3000/'); + + sent.length = 0; + view.setVisible(false); + view.setBounds({ x: 0, y: 0, width: 50, height: 60 }); + view.setVisible(true); + assert.deepEqual(sent.map((message) => [message.method, message.params['bounds']]), [ + ['host.scene.setBounds', null], + ['host.scene.setBounds', null], + ['host.scene.setBounds', { x: 0, y: 0, width: 50, height: 60 }], + ]); + + view.webContents.focus(); + assert.deepEqual(sent.at(-1), { jsonrpc: '2.0', method: 'host.webview.focus', params: { window: label } }); + view.webContents.close(); + assert.deepEqual(sent.at(-1), { jsonrpc: '2.0', method: 'host.scene.close', params: { webview: label } }); + }); + + it('hands the bridge\'s open-in-editor to ipcMain.on from the scene\'s main frame, and answers evaluations', async () => { + const { sent } = fakeCore(); + const win = tauriHost.TauriBrowserWindow.adopt('main'); + const view = new tauriHost.WebContentsView({}); + win.contentView.addChildView(view); + const loading = view.webContents.loadURL('http://127.0.0.1:3000/'); + await tick(); + tauriHost.handleWindowEvent({ window: view.webContents.label, event: 'loaded', url: 'http://127.0.0.1:3000/' }); + await loading; + + const heard: Array<{ sender: unknown; sameFrame: boolean; target: unknown }> = []; + tauriHost.ipcMain.on(SCENE_OPEN_IN_EDITOR_CHANNEL, (event, target) => { + heard.push({ sender: event.sender, sameFrame: event.senderFrame === event.sender.mainFrame, target }); + }); + const url = 'http://127.0.0.1:3000/'; + tauriHost.handleSceneMessage({ webview: view.webContents.label, url, message: { type: 'open-in-editor', target: { path: 'src/a.ts', line: 2 } } }); + tauriHost.handleSceneMessage({ webview: view.webContents.label, url, message: { type: 'open-in-editor', target: { path: '' } } }); + tauriHost.handleSceneMessage({ webview: 'main', url, message: { type: 'open-in-editor', target: { path: 'src/b.ts' } } }); + assert.deepEqual(heard, [{ sender: view.webContents, sameFrame: true, target: { path: 'src/a.ts', line: 2 } }]); + + const answer = view.webContents.executeJavaScript('1 + 1', true); + await tick(); + const evaluation = sent.find((message) => message.method === 'host.scene.eval'); + const id = /reply\("([0-9a-f-]+)"/.exec(String(evaluation?.params['script']))?.[1] ?? ''; + assert.ok(id); + // Another view cannot answer for this one. + tauriHost.handleSceneMessage({ webview: 'scene-999', url, message: { type: 'eval-result', id, ok: true, value: 'forged' } }); + tauriHost.handleSceneMessage({ webview: view.webContents.label, url, message: { type: 'eval-result', id, ok: true, value: 2 } }); + assert.equal(await answer, 2); + }); +}); diff --git a/apps/ide/test/tauriSidecar.test.ts b/apps/ide/test/tauriSidecar.test.ts new file mode 100644 index 000000000..2bef4f28a --- /dev/null +++ b/apps/ide/test/tauriSidecar.test.ts @@ -0,0 +1,66 @@ +import { describe, it } from 'node:test'; +import assert from 'node:assert/strict'; +import fs from 'node:fs'; +import path from 'node:path'; +import { decodeValue, encodeArgs, encodeValue } from '../src/shared/jsonCodec.ts'; +import { LineSplitter, RpcPeer } from '../src/sidecar/rpc.ts'; +import * as tauriHost from '../src/sidecar/tauriHost.ts'; +import { buildContentSecurityPolicy } from '../src/main/security.ts'; + +describe('Tauri walking skeleton (#480-#482)', () => { + it('carries bytes and undefined across JSON both ways', () => { + const value = { name: 'a.pdf', bytes: new Uint8Array([0, 1, 254, 255]), list: [new Uint8Array([7])], gone: undefined }; + const wire = JSON.parse(JSON.stringify(encodeValue(value))) as unknown; + assert.deepEqual(wire, { name: 'a.pdf', bytes: { $bytes: 'AAH+/w==' }, list: [{ $bytes: 'Bw==' }] }); + assert.deepEqual(decodeValue(wire), { name: 'a.pdf', bytes: new Uint8Array([0, 1, 254, 255]), list: [new Uint8Array([7])] }); + const args = encodeArgs(['x', undefined, 3, undefined, undefined]); + assert.deepEqual(args, ['x', { $undefined: true }, 3]); + assert.deepEqual(decodeValue(JSON.parse(JSON.stringify(args))), ['x', undefined, 3]); + }); + + it('speaks JSON-RPC 2.0 over lines: requests both ways, notifications, errors', async () => { + const written: string[] = []; + const peer = new RpcPeer({ write: (line) => written.push(line) }); + peer.onRequest('ipc.invoke', (params) => ({ echoed: params })); + peer.onRequest('fails', () => { + throw new Error('nope'); + }); + const heard: unknown[] = []; + peer.onNotification('window.event', (params) => heard.push(params)); + const splitter = new LineSplitter((line) => peer.receive(line)); + splitter.push(Buffer.from('{"jsonrpc":"2.0","id":1,"method":"ipc.invoke","params":{"a":1}}\n{"jsonrpc":"2.0","method":"window.ev')); + splitter.push(Buffer.from('ent","params":{"event":"loaded"}}\n{"jsonrpc":"2.0","id":2,"method":"fails"}\n')); + await new Promise((resolve) => setImmediate(resolve)); + assert.deepEqual(heard, [{ event: 'loaded' }]); + assert.deepEqual(written.map((line) => JSON.parse(line) as { id: number }).sort((a, b) => a.id - b.id), [ + { jsonrpc: '2.0', id: 1, result: { echoed: { a: 1 } } }, + { jsonrpc: '2.0', id: 2, error: { code: -32000, message: 'nope' } }, + ]); + const answer = peer.request('host.clipboard.readText'); + const sent = JSON.parse(written.at(-1) ?? '{}') as { id: number; method: string }; + assert.equal(sent.method, 'host.clipboard.readText'); + peer.receive(JSON.stringify({ jsonrpc: '2.0', id: sent.id, result: 'copied' })); + assert.equal(await answer, 'copied'); + const lost = peer.request('host.dialog.open'); + peer.close(); + await assert.rejects(lost, /core is gone/); + }); + + it('implements every name of the desktop seam', () => { + const seam = fs.readFileSync(path.join(import.meta.dirname, '..', 'src', 'main', 'host', 'desktop.ts'), 'utf8'); + const block = /export \{([^}]*)\} from 'electron';/.exec(seam)?.[1] ?? ''; + const names = [...block.matchAll(/\b([A-Za-z]+)\b/g)].map((match) => match[1]); + assert.ok(names.length > 10, 'the seam lists its names'); + const host = tauriHost as Record; + assert.deepEqual(names.filter((name) => name === undefined || host[name] === undefined), []); + assert.equal(host['DESKTOP_SHELL'], 'tauri'); + }); + + it('adds only Tauri IPC origins to the CSP of the Tauri build', () => { + const electron = buildContentSecurityPolicy(); + assert.match(electron, /connect-src 'self';/); + const tauri = buildContentSecurityPolicy({ extraConnectSources: ['ipc:', 'http://ipc.localhost'] }); + assert.match(tauri, /connect-src 'self' ipc: http:\/\/ipc\.localhost;/); + assert.equal(tauri.replace(" ipc: http://ipc.localhost", ''), electron); + }); +}); diff --git a/apps/ide/test/tour.test.ts b/apps/ide/test/tour.test.ts index 2d60fc845..f0de1d619 100644 --- a/apps/ide/test/tour.test.ts +++ b/apps/ide/test/tour.test.ts @@ -212,7 +212,8 @@ describe('guided tour: strings and wiring (CI12)', () => { const template = readFileSync(new URL('../src/main/menuTemplate.ts', import.meta.url), 'utf8'); assert.match(template, /command\(t\('menu\.startTour'\), 'help\.startTour'\)/); assert.equal(SETTINGS.find((setting) => setting.key === 'workbench.welcomeTour')?.default, true); - const main = readFileSync(new URL('../src/main/index.ts', import.meta.url), 'utf8'); - assert.match(main, /'workbench\.welcomeTour': false/); + // #482: the boot sequence both shells share. + const boot = readFileSync(new URL('../src/main/boot.ts', import.meta.url), 'utf8'); + assert.match(boot, /'workbench\.welcomeTour': false/); }); }); diff --git a/apps/ide/tsconfig.node.json b/apps/ide/tsconfig.node.json index 0a7b93387..213ad92b4 100644 --- a/apps/ide/tsconfig.node.json +++ b/apps/ide/tsconfig.node.json @@ -10,5 +10,5 @@ "@codexr/logging/*": ["./.core-types/platform/logging/*"] } }, - "include": ["src/main/**/*.ts", "src/preload/**/*.ts", "src/scenePreload/**/*.ts", "src/extensionHost/**/*.ts", "src/shared/**/*.ts", "src/codexrMcp/**/*.ts", "src/localAgent/**/*.ts", "test/**/*.ts"] + "include": ["src/main/**/*.ts", "src/sidecar/**/*.ts", "src/preload/**/*.ts", "src/scenePreload/**/*.ts", "src/extensionHost/**/*.ts", "src/shared/**/*.ts", "src/codexrMcp/**/*.ts", "src/localAgent/**/*.ts", "test/**/*.ts"] } diff --git a/apps/ide/tsconfig.web.json b/apps/ide/tsconfig.web.json index e8cf52c95..f465a1270 100644 --- a/apps/ide/tsconfig.web.json +++ b/apps/ide/tsconfig.web.json @@ -11,5 +11,5 @@ "@codexr/core/analysis/languages/*": ["./.core-types/core/analysis/languages/*"] } }, - "include": ["src/renderer/**/*.ts", "src/shared/**/*.ts"] + "include": ["src/renderer/**/*.ts", "src/shared/**/*.ts", "src/bridge/**/*.ts", "src/sceneBridge/**/*.ts"] } diff --git a/apps/vscode-extension/src/core/server/http/localSceneLibraries.ts b/apps/vscode-extension/src/core/server/http/localSceneLibraries.ts new file mode 100644 index 000000000..86abfaa81 --- /dev/null +++ b/apps/vscode-extension/src/core/server/http/localSceneLibraries.ts @@ -0,0 +1,127 @@ +import * as fs from 'fs'; +import * as path from 'path'; + +/** + * The scene's third-party libraries served by the analysis server itself, + * from the copies in the repository, instead of their CDNs (Code-XR IDE, + * #16 and #483). + * + * Generated scenes load A-Frame, BabiaXR and friends from CDNs (pinned + * versions). The VS Code extension keeps doing so: nothing here is active + * until a host calls `setLocalSceneLibraries`. The Code-XR IDE does, at + * start-up: the project rule is no network access without consent, and a + * scene beside the code must not depend on a CDN being up. Its Electron build + * used to answer the CDN URLs by intercepting `https` in the scene view's + * session; the system webviews of its Tauri build cannot intercept `https`, + * so the server rewrites the pinned URLs of the pages it sends to this + * machine into `LOCAL_SCENE_LIBRARIES_ROUTE`, and serves that route from + * `test/vendor/scene-libraries/` (the same copies, and licences, the offline + * browser harnesses use). + * + * Pages sent through the Cloudflare tunnel (a guest, a standalone headset) + * are not rewritten: they keep loading the CDNs, as they always have. + */ + +/** Where the vendored files are served, on the scene's own origin. */ +export const LOCAL_SCENE_LIBRARIES_ROUTE = '/__codexr/scene-libraries/'; + +/** [URL pattern, vendored file]: the versions the templates pin (kept in step with test/helpers/harnessBrowser.cjs). */ +export const SCENE_LIBRARIES: ReadonlyArray = [ + [/^https:\/\/aframe\.io\/releases\/1\.7\.1\/aframe(?:\.min)?\.js(?:\?|$)/, 'aframe-1.7.1.min.js'], + [/^https:\/\/unpkg\.com\/aframe-babia-components@1\.5\.0\//, 'aframe-babia-components-1.5.0.min.js'], + [/^https:\/\/cdn\.jsdelivr\.net\/gh\/(?:c-frame|donmccurdy)\/aframe-extras@v?7\.5\.4\//, 'aframe-extras-7.5.4.min.js'], + [/^https:\/\/unpkg\.com\/aframe-environment-component@1\.5\.0\//, 'aframe-environment-component-1.5.0.min.js'], + [/^https:\/\/unpkg\.com\/aframe-geometry-merger-component@2\.0\.1\//, 'aframe-geometry-merger-component-2.0.1.min.js'], + [/^https:\/\/cdnjs\.cloudflare\.com\/ajax\/libs\/html2canvas\/1\.4\.1\/html2canvas(?:\.min)?\.js(?:\?|$)/, 'html2canvas-1.4.1.min.js'], + // A-Frame's default text font (its `text` component fetches it at run time). + [/^https:\/\/cdn\.aframe\.io\/fonts\/Roboto-msdf\.json(?:\?|$)/, 'fonts/Roboto-msdf.json'], + [/^https:\/\/cdn\.aframe\.io\/fonts\/Roboto-msdf\.png(?:\?|$)/, 'fonts/Roboto-msdf.png'], +]; + +/** + * A-Frame builds its font URLs from this root at run time + * (`window.AFRAME_CDN_ROOT || "https://cdn.aframe.io/"`); the vendored + * folder mirrors its `fonts/` folder, so the root maps to the route. + */ +const AFRAME_CDN_ROOT = 'https://cdn.aframe.io/'; + +const CONTENT_TYPES: Readonly> = { + '.js': 'application/javascript; charset=utf-8', + '.json': 'application/json; charset=utf-8', + '.png': 'image/png', +}; + +/** The content type a vendored file is served with. */ +export function contentTypeOf(file: string): string { + const dot = file.lastIndexOf('.'); + return CONTENT_TYPES[dot >= 0 ? file.slice(dot) : ''] ?? 'application/octet-stream'; +} + +/** The vendored file name for a CDN URL, or null when the URL is not one of the pinned libraries. */ +export function vendoredLibraryFor(url: string): string | null { + return SCENE_LIBRARIES.find(([pattern]) => pattern.test(url))?.[1] ?? null; +} + +/** + * `text` with every pinned CDN URL (and A-Frame's CDN root) pointing at the + * local route instead. Any other address is left as it is. + */ +export function rewriteSceneLibraryUrls(text: string): string { + return text.replace(/https:\/\/[^\s"'`()<>]+/g, (url) => { + if (url === AFRAME_CDN_ROOT) { + return LOCAL_SCENE_LIBRARIES_ROUTE; + } + const file = vendoredLibraryFor(url); + return file ? `${LOCAL_SCENE_LIBRARIES_ROUTE}${file}` : url; + }); +} + +const SERVED_FILES: ReadonlySet = new Set(SCENE_LIBRARIES.map(([, file]) => file)); + +/** + * The vendored file a request path of the route names, or null: only the + * files of the table are served, whatever else the folder holds. + */ +export function localLibraryFileOf(pathname: string): string | null { + if (!pathname.startsWith(LOCAL_SCENE_LIBRARIES_ROUTE)) { + return null; + } + const file = pathname.slice(LOCAL_SCENE_LIBRARIES_ROUTE.length); + return SERVED_FILES.has(file) ? file : null; +} + +let librariesDir: string | null = null; +const cache = new Map(); + +/** A host serves the vendored libraries from `dir` (null turns it off, the default). */ +export function setLocalSceneLibraries(dir: string | null): void { + librariesDir = dir; + cache.clear(); +} + +/** Whether a host turned local libraries on. */ +export function localSceneLibrariesEnabled(): boolean { + return librariesDir !== null; +} + +/** + * The body of a vendored file, scripts with their own CDN URLs rewritten + * (A-Frame's font root, BabiaXR's default font), or null when it cannot be read. + */ +export async function readLocalLibrary(file: string): Promise { + if (!librariesDir || !SERVED_FILES.has(file)) { + return null; + } + const cached = cache.get(file); + if (cached) { + return cached; + } + try { + const raw = await fs.promises.readFile(path.join(librariesDir, ...file.split('/'))); + const body = file.endsWith('.js') ? Buffer.from(rewriteSceneLibraryUrls(raw.toString('utf8')), 'utf8') : raw; + cache.set(file, body); + return body; + } catch { + return null; + } +} diff --git a/apps/vscode-extension/src/core/server/http/staticAssets.ts b/apps/vscode-extension/src/core/server/http/staticAssets.ts index 421aa18da..ffddb05d0 100644 --- a/apps/vscode-extension/src/core/server/http/staticAssets.ts +++ b/apps/vscode-extension/src/core/server/http/staticAssets.ts @@ -25,7 +25,7 @@ export class StaticAssetServer { * Serve the main CodeXR page * @param res - HTTP response */ - public async serveMainPage(res: http.ServerResponse): Promise { + public async serveMainPage(res: http.ServerResponse, rewriteHtml?: (html: string) => string): Promise { let mainPagePath: string; if (this.options.mainFile) { @@ -47,7 +47,7 @@ export class StaticAssetServer { // Check if file exists and serve it if (fs.existsSync(mainPagePath)) { logger.debug(() => `Successfully found main file, serving: ${mainPagePath}`); - await this.serveFile(res, mainPagePath, 'text/html'); + await this.serveFile(res, mainPagePath, 'text/html', rewriteHtml); } else { logger.error(`Main file not found: ${mainPagePath}`); logger.error(`Current working directory: ${process.cwd()}`); @@ -72,11 +72,13 @@ export class StaticAssetServer { * @param _req - HTTP request (unused) * @param res - HTTP response * @param url - Request URL + * @param rewriteHtml - Optional rewrite of an HTML page's text (local scene libraries) */ public async serveStaticFile( _req: http.IncomingMessage, res: http.ServerResponse, - url: string + url: string, + rewriteHtml?: (html: string) => string ): Promise { // Parse URL to extract pathname without query string (WHATWG parser: // the legacy url.parse() emits DEP0169 in the extension host). @@ -99,7 +101,7 @@ export class StaticAssetServer { if (fs.existsSync(normalizedPath) && fs.statSync(normalizedPath).isFile()) { logger.debug(() => `SERVER_DEBUG: Serving file: ${normalizedPath}`); - await this.serveFile(res, normalizedPath); + await this.serveFile(res, normalizedPath, undefined, rewriteHtml); } else { logger.debug(() => `SERVER_DEBUG: File not found: ${normalizedPath}`); sendErrorResponse(res, 404, 'File not found'); @@ -111,15 +113,20 @@ export class StaticAssetServer { * @param res - HTTP response * @param filePath - Path to the file * @param contentType - Content type (optional, will be detected) + * @param rewriteHtml - Optional rewrite of the text of an HTML file */ public async serveFile( res: http.ServerResponse, filePath: string, - contentType?: string + contentType?: string, + rewriteHtml?: (html: string) => string ): Promise { try { - const content = await fs.promises.readFile(filePath); + const raw = await fs.promises.readFile(filePath); const detectedContentType = contentType || this.getContentType(filePath); + const content = rewriteHtml && detectedContentType.startsWith('text/html') + ? Buffer.from(rewriteHtml(raw.toString('utf8')), 'utf8') + : raw; const headers: Record = { 'Content-Type': detectedContentType }; if (/\.(:html|js|mjs|json|map)$/i.test(filePath)) { headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, max-age=0'; diff --git a/apps/vscode-extension/src/core/server/httpServer.ts b/apps/vscode-extension/src/core/server/httpServer.ts index 9a74f65ab..399712f83 100644 --- a/apps/vscode-extension/src/core/server/httpServer.ts +++ b/apps/vscode-extension/src/core/server/httpServer.ts @@ -13,6 +13,7 @@ import { REVEAL_IN_SCENE_MESSAGE, scenePathOf } from './analysis/sceneReveal'; import { hostMessageContext, sceneModeOptions, switchSceneMode, type SceneModeResult, type SceneModes } from './analysis/sceneModeControl'; import { addCorsHeaders, sendErrorResponse, sendJsonResponse } from './http/httpRespond'; import { StaticAssetServer } from './http/staticAssets'; +import { contentTypeOf, localLibraryFileOf, localSceneLibrariesEnabled, readLocalLibrary, rewriteSceneLibraryUrls } from './http/localSceneLibraries'; import { RemoteAccessPolicy } from './remote/remoteAccessPolicy'; import { RemotePairingApi } from './remote/remotePairingApi'; import { CollaborationSessionApi } from './collaboration/collaborationSessionApi'; @@ -493,9 +494,18 @@ export class HttpServer { res: http.ServerResponse, url: string ): Promise { + // A host that serves the scene libraries itself (the Code-XR IDE): + // pages sent to this machine load them from here, not from the CDNs. + const localLibraries = localSceneLibrariesEnabled() && !this.policy.isRemoteRequest(req); + const rewriteHtml = localLibraries ? rewriteSceneLibraryUrls : undefined; + if (localLibraries && url.startsWith('/__codexr/')) { + await this.serveLocalLibrary(res, url); + return; + } + // Root path - serve main page if (url === '/' || url === '/index.html') { - await this.staticAssets.serveMainPage(res); + await this.staticAssets.serveMainPage(res, rewriteHtml); return; } @@ -521,7 +531,19 @@ export class HttpServer { } // Static files - await this.staticAssets.serveStaticFile(req, res, url); + await this.staticAssets.serveStaticFile(req, res, url, rewriteHtml); + } + + /** A vendored scene library (localSceneLibraries.ts); anything else under the route is not found. */ + private async serveLocalLibrary(res: http.ServerResponse, url: string): Promise { + const file = localLibraryFileOf(new URL(url, 'http://codexr.local').pathname); + const body = file ? await readLocalLibrary(file) : null; + if (!file || !body) { + sendErrorResponse(res, 404, 'File not found'); + return; + } + res.writeHead(200, { 'Content-Type': contentTypeOf(file), 'Cache-Control': 'public, max-age=86400' }); + res.end(body); } /** diff --git a/apps/vscode-extension/test/servers/localSceneLibraries.test.cjs b/apps/vscode-extension/test/servers/localSceneLibraries.test.cjs new file mode 100644 index 000000000..bc5957924 --- /dev/null +++ b/apps/vscode-extension/test/servers/localSceneLibraries.test.cjs @@ -0,0 +1,84 @@ +'use strict'; + +/** + * The scene libraries a host may serve itself (core/server/http/ + * localSceneLibraries.ts, Code-XR IDE #483). Off by default: the extension's + * pages keep loading the CDNs byte for byte and the route does not exist. + * Once a host turns it on, pages sent to this machine point at the route, + * which serves the vendored copies; pages sent through the tunnel do not. + */ + +const test = require('node:test'); +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const http = require('node:http'); +const net = require('node:net'); +const os = require('node:os'); +const path = require('node:path'); + +const { createFakeVscode, withFakeVscode } = require('../helpers/fakeVscode.cjs'); + +const projectRoot = path.resolve(__dirname, '..', '..'); +const VENDOR = path.join(projectRoot, 'test', 'vendor', 'scene-libraries'); +const ROUTE = '/__codexr/scene-libraries/'; +const PAGE = 'x'; + +function getFreePort() { + return new Promise((resolve, reject) => { + const probe = net.createServer(); + probe.once('error', reject); + probe.listen(0, '127.0.0.1', () => { + const { port } = probe.address(); + probe.close(() => resolve(port)); + }); + }); +} + +function get(port, pathname, headers = {}) { + return new Promise((resolve, reject) => { + http.get({ host: '127.0.0.1', port, path: pathname, headers }, (response) => { + const chunks = []; + response.on('data', (chunk) => chunks.push(chunk)); + response.on('end', () => resolve({ status: response.statusCode, type: response.headers['content-type'], body: Buffer.concat(chunks) })); + }).on('error', reject); + }); +} + +test('local scene libraries: off by default, then served and rewritten for this machine only', async () => { + const root = fs.mkdtempSync(path.join(os.tmpdir(), 'codexr-local-libraries-')); + fs.writeFileSync(path.join(root, 'scene.html'), PAGE); + const port = await getFreePort(); + try { + await withFakeVscode(createFakeVscode(), async ({ requireOut }) => { + const libraries = requireOut('core/server/http/localSceneLibraries.js'); + const { HttpServer } = requireOut('core/server/httpServer.js'); + const server = new HttpServer({ port, host: '127.0.0.1', staticRoot: root }); + await server.start(); + try { + assert.equal(libraries.localSceneLibrariesEnabled(), false); + assert.equal((await get(port, '/scene.html')).body.toString('utf8'), PAGE); + assert.equal((await get(port, `${ROUTE}aframe-1.7.1.min.js`)).status, 404); + + libraries.setLocalSceneLibraries(VENDOR); + const local = (await get(port, '/scene.html')).body.toString('utf8'); + assert.equal(local, `x`); + const aframe = await get(port, `${ROUTE}aframe-1.7.1.min.js`); + assert.equal(aframe.status, 200); + assert.equal(aframe.type, 'application/javascript; charset=utf-8'); + assert.ok(aframe.body.length > 100000); + assert.equal((await get(port, `${ROUTE}README.md`)).status, 404); + assert.equal((await get(port, `${ROUTE}..%2Fscene.html`)).status, 404); + + // Through the Cloudflare tunnel nothing changes: a guest without the + // room's cookie is not served at all, and the route is never there for it. + assert.equal((await get(port, '/scene.html', { 'cf-connecting-ip': '198.51.100.7' })).status, 404); + assert.equal((await get(port, `${ROUTE}aframe-1.7.1.min.js`, { 'cf-connecting-ip': '198.51.100.7' })).status, 404); + } finally { + libraries.setLocalSceneLibraries(null); + await server.stop(); + } + }); + } finally { + fs.rmSync(root, { recursive: true, force: true }); + } +}); diff --git a/docs/ide/tauri-migration.md b/docs/ide/tauri-migration.md index 516e658fe..fa992177c 100644 --- a/docs/ide/tauri-migration.md +++ b/docs/ide/tauri-migration.md @@ -87,6 +87,27 @@ GitHub-hosted runners (`IDE benchmark` workflow, 6 runs, median of the 5 warm on Memory is compared per OS with the same metric before and after (Linux PSS, Windows private bytes, macOS RSS); RSS counts shared pages once per process, so it is not added across OS. +## 6b. R1 spike results (Tauri 2.13, `apps/ide/spike/tauri-engines`, GitHub runners, 4 Dec 2026) + +Verdict: **go on the three OS; no CEF fallback needed.** Every probe passed on every engine. + +| Probe | Windows (WebView2 158) | macOS (WKWebView, arm64) | Linux (WebKitGTK 2.52, Xvfb) | +|---|---|---|---| +| Monaco + TS / JSON / editor workers | pass, 1.26 s | pass, 0.88 s | pass, 3.7 s | +| xterm 6 draws rows | pass, 65 ms | pass, 85 ms | pass, 104 ms | +| pdf.js renders a page | pass, 86 ms | pass, 74 ms | pass, 199 ms | +| A-Frame + BabiaXR scene (400 animated boxes + chart), second webview | WebGL 2, 58.6 FPS | WebGL 2, 60 FPS | WebGL 2, 23 FPS | +| Same scene in an iframe | 57 FPS | 50.8 FPS | 23 FPS | +| `navigator.xr` | present | absent | absent | +| Spike binary (Rust + 18.6 MB of web assets, compressed) | 6.8 MB | 6.8 MB | 7.3 MB | + +Notes: +- All runners render in software (Windows: Microsoft Basic Render Driver; Linux: Mesa llvmpipe; WebKit masks the renderer as "Apple GPU"), so the FPS figures are lower bounds; the Linux 23 FPS is software rendering on a 4-core VM, not a WebKitGTK limit (29 FPS in the container). +- WebView2 exposes `navigator.xr`: in-IDE immersive WebXR on Windows may survive the migration; to be tried with a headset in R5. +- Creating a webview from a synchronous Tauri command deadlocks on Windows: commands that create webviews must be `async`. +- On the Linux runner the first script ran 34.6 s after spawn (cold WebKitGTK start on the VM; 1.2 s in the container). R2 measures the real IDE's start-up; if it persists, it is investigated there. +- The second webview (multiwebview, `unstable` feature) works on all three, so the scene keeps its own webview as today. + ## 7. Plan (epic, stories R0-R14) Each story is one or more PRs to `ide`, merged on green CI; the IDE keeps working at every step (Electron stays until R13). @@ -110,3 +131,82 @@ Each story is one or more PRs to `ide`, merged on green CI; the IDE keeps workin | R14 (#492) | Final benchmark + report + manual test guide | before/after table on 3 OS; guide for Adrián | Parity is checked against the existing smoke probes, the 1,200 unit tests (Node ones kept for the sidecar, Rust ones for ported code) and the manual test guide. + +## 8. Walking skeleton (R2 #480, R3 #481, R4 #482) + +State on 4 Dec 2026: `npm run tauri:start --workspace=code-xr-ide -- --folder=` builds and opens the **real IDE renderer** in a Tauri 2.13 window, with the main-process code running in a Node sidecar. The Electron build is unchanged (`build`, `smoke`, typecheck, lint, unit tests green at every commit) and stays until R13. + +``` +codexr-ide (Rust, src-tauri) node out/sidecar/index.cjs (src/sidecar) + codexr://app/ -> out/renderer + CSP header src/main/boot.ts: the same services as Electron + webview "main" + out/bridge/index.js (init) src/main/ipc.ts handlers, unchanged + codexr_ipc(channel, args) ---- ipc.invoke ----> tauriHost.ts = src/main/host/desktop.ts + codexr_events (Tauri channel) <- webview.send - (WebContents / BrowserWindow shims by label) + host.rs: dialogs, clipboard, opener, trash, <---- host. requests + theme, keyring, windows +``` + +What runs where: + +- **The seam.** Every Node-side module imports Electron through `src/main/host/desktop.ts`. That file *is* the Electron implementation (it re-exports `electron`), so the Electron build needs no alias. The sidecar build (`scripts/viteConfigs.mjs`, target `sidecar`) resolves that one module to `src/sidecar/tauriHost.ts` and fails if anything imports `electron` directly. A unit test checks `tauriHost` exports every name the seam does. +- **Boot.** `src/main/boot.ts` is the boot sequence both shells share (services, IPC handlers, theme, language, start-up folder). `src/main/index.ts` keeps Electron's own steps (protocols, hardening, window, smoke run); `src/sidecar/index.ts` asks the core for the window. +- **Protocol.** JSON-RPC 2.0, one message per line over the sidecar's stdio; the sidecar logs to stderr only (`stdio.ts`), and the core copies sidecar lines starting with `CODEXR_` to its own stdout (bench and smoke result lines). Bytes travel as `{"$bytes": base64}` and an `undefined` argument as `{"$undefined": true}` (`src/shared/jsonCodec.ts`). +- **Bridge.** `src/preload/codexrApi.ts` builds the frozen `window.codexr` from an IPC adapter. The Electron preload passes `ipcRenderer`; `src/bridge/index.ts` (an IIFE the core injects with `initialization_script`) passes Tauri's internal `invoke` and one ordered `tauri::ipc::Channel` of events, and defines `window.codexr` non-writable. Rejections keep Electron's message shape, which the renderer strips. +- **Child processes.** `src/main/nodeRuntime.ts` gives `ELECTRON_RUN_AS_NODE=1` on Electron and nothing in the sidecar (`useRealNodeRuntime()`), so the extension host, TypeScript server, MCP server, local agent and ACP agents run on the sidecar's own Node. + +Deviations from the design given for these stories: + +1. The IPC adapter is `{ invoke, on }`, where `on` returns the unsubscribe function, instead of `{ invoke, on, removeListener }`: every subscription already returned one. +2. No channel allow-list in Rust. The core forwards the webview's URL and the sidecar keeps the existing check (`ALLOWED_IPC_CHANNELS` + `isTrustedIpcCall`); Rust only refuses calls from pages that are not the app, and the capability (`capabilities/app.json`, with both commands declared in `build.rs`) grants the two commands to the main window's local pages only. Note that any script in the page can call `codexr_ipc` directly (Electron's preload hid `ipcRenderer`); Tauri's isolation pattern is the R3 follow-up if that matters. +3. Events use one Tauri channel per webview (registered by the bridge, queued until it is), not `emit_to`: no event-plugin permission is needed and the order is kept. +4. The Rust core opens the main window at launch, hidden until its page has loaded (Electron's `ready-to-show`), while the sidecar boots; the sidecar adopts it (`host.window.attach`, which hands over the CSP). Page requests wait for that CSP, and IPC calls wait until every handler is registered (`openIpc` in tauriHost.ts): nothing fails. The window's `?locale=` is the sidecar's last decision (`startup-locale` in the app's cache folder, `src-tauri/src/locale.rs`) or the environment's language; the sidecar reloads the page in its own decision if they differ. Other windows are still created by the sidecar (`host.window.create`). +5. Secrets: Electron's `safeStorage` becomes AES-256-GCM in the sidecar with one random 256-bit key kept in the OS keyring (crate `keyring`), not one keyring entry per secret. Electron's ciphertexts are not readable (R10). Without a keyring (this container has no Secret Service) the secret store reports itself unavailable, as Electron's `basic_text` case does. +6. The profile folder is the same as Electron's (`~/.config/code-xr-ide` and equivalents; `CODEXR_USER_DATA` overrides it) until the R10 migration. +7. Build-time icons are generated placeholders (no binary committed); the window shows the real logo, loaded at run time. Installer icons come with R12. +8. Menus are not built yet (logged); they were listed under R2 and move to the R9 native pieces with the About box. + +Degraded on Tauri, each with one logged "not yet on Tauri (Rn)" line, never a crash (the scene view, its bridge and Enter XR came with R5, section 9): extension webviews and the `codexr-webview:` scheme (R6), the application menu, About box, screen picker, permission handlers and dialogs with more than three buttons (R9: they answer their Cancel button), the smoke run (R11; `--codexr-smoke` starts a normal session), the Vite dev server (R2 follow-up), installers and a bundled Node (R12). The status bar still says "Electron" (cosmetic). + +Verified by running here (Linux x64 container, Xvfb, WebKitGTK 2.52, software GL): the window opens on `--folder=`, the explorer lists the folder, Monaco opens `package.json` with Git blame, the terminal runs bash and shows its prompt, settings load, Git status shows (branch, ahead/behind, the changed-file badge, in a trusted folder), and killing the sidecar shows an error dialog. Not verified: dialogs, clipboard, opener and trash (code paths compiled, not clicked), the extension host with real extensions, Windows and macOS. + +Benchmark on the same machine (`scripts/bench.mjs --runs=4 --idle-seconds=10`, Xvfb 1920x1080, monorepo opened, median of 4). "First skeleton" is the state above before the start-up and idle work; "now" is after it: + +| Metric | Electron 45, before | Electron 45, now | Tauri, first skeleton | Tauri, now | +|---|---|---|---|---| +| Spawn to usable | 972 ms | 1,005 ms | 2,223 ms | 1,627 ms | +| Renderer: workbench / editor / terminal ready | 228 / 514 / 675 ms | 221 / 503 / 674 ms | 463 / 1,036 / 1,310 ms | 516 / 1,124 / 1,411 ms | +| CPU time to get there | 1,980 ms | 2,020 ms | 3,620 ms | 3,170 ms | +| Memory, whole tree (PSS / RSS) | 447 MB / 824 MB, 7 processes | 438 MB / 821 MB | 687 MB / 875 MB, 5 processes | 472 MB / 653 MB | +| Idle CPU (10 s) | 4.6 % | 1.4 % | 12.1 % | 1.6 % | + +What changed, each measured alone (Tauri usable time / idle CPU / PSS, Electron where it applies): + +- **Window hidden until loaded.** A visible WebKitGTK view painted before its web process is up blocks the UI thread for 500 ms (strace: one futex wait in the UI thread timing out while the web process waits on its IPC socket; WebKit's wait for `DidUpdateBackingStoreState`). Showing the window once the page loaded, as Electron does, took the page's first request from about 950 to 440 ms after spawn. +- **Window at launch, sidecar in parallel.** The page's first request now comes about 300 ms after spawn, while the sidecar is still booting: usable 2,223 to 1,604 ms (both changes together). The sidecar runs with Node's compile cache (`NODE_COMPILE_CACHE` in the app's cache folder, taken out of its environment so no child inherits it): its own start-up 165 to 120 ms. Lazy-loading sidecar modules was not done: the sidecar is ready before the page's first IPC call, so it is off the critical path. +- **Idle CPU: the terminal cursor.** Counting from inside the page in a bench run (wrapped `requestAnimationFrame`/`setTimeout`/`setInterval`, a MutationObserver, `document.getAnimations()`): no rAF loop, no DOM mutation, one 5 s interval, and one running animation, xterm.js's cursor blink (`1s step-end infinite`), which the engine ticks every frame. It now blinks from a 500 ms timer with the same look (`src/renderer/terminal/cursorBlink.ts`): Electron 4.6 to 1.4 % (0.6 % with no blink at all), Tauri 11.8 to 11.0 %. While an analysis runs, its notification spinner and the agent dock's pulse animate too (that is real progress, left as it is). +- **Idle CPU and memory: WebKitGTK's DMA-BUF renderer.** With no GPU render node (VM, container, software GL) it copies every frame through shared memory: about 25 ms of CPU per paint and 200 MB more in the web process. The core sets `WEBKIT_DISABLE_DMABUF_RENDERER=1` only when `/dev/dri` has no openable `renderD*` node and the variable is unset, and keeps it out of the sidecar's environment: idle 11.0 to 1.6 %, PSS 683 to 472 MB (web process 450 to 256 MB). WebGL still works: the R1 spike's A-Frame scene went from 25-29 to 32-33 FPS with it. +- **Windows.** wry hands the scheme handler `http://codexr.localhost/` requests rewritten as `codexr://localhost/`; the handler only accepted the host `app`, so every request was a 404 on Windows and the CI bench never got its result line. Fixed (`is_app_request`, tested); the core now logs the sidecar start, the main window URL, each page load and every refused or missing request, and `bench.mjs` prints the app's last 60 stderr lines when a run fails. + +Tried without a measured win (not kept): `WEBKIT_DISABLE_COMPOSITING_MODE=1` (alone 1.5 % / 490 MB; on top of the DMA-BUF switch no change), `WEBKIT_SKIA_ENABLE_CPU_RENDERING=1` (no idle gain), `NO_AT_BRIDGE=1` and `GTK_A11Y=none` (no start-up gain), the WebKit cache model `DocumentViewer` through `with_webview` (PSS 472 to 474 MB). The Rust process (84 MB PSS, 151 MB RSS) is 35 MB of heap plus shared GTK, WebKit and Mesa libraries (libLLVM alone 16 MB, loaded by the UI process's GL context); the binary is 6 MB and already built with `lto`, `strip`, `opt-level = "s"`, `codegen-units = 1`, so build flags have nothing left to take. + +Read with care: this is software-rendered WebKitGTK in a container. Of the Tauri tree now, the web process is 256 MB PSS (Electron's renderer: 163 MB), the sidecar 109 MB, the Rust process 84 MB. The renderer itself is still about twice as slow on JavaScriptCore as on V8 here: from Monaco's chunks being requested to the next ones about 570 ms pass with the scheme handler answering each file in under 5 ms (2.7 MB in 5 ms) and IPC round trips of 0 to 35 ms (48 calls to the usable point), so that time is parse and evaluation of about 4 MB of JavaScript. CI on macOS (before these changes) showed 2.1 s before the page's time origin and 2.8 s between the explorer and Monaco; the next CI run tells how much of it the window-at-launch change takes. + +## 9. Scene view (R5 #483) + +State on 4 Dec 2026: on the Tauri build the analysis scene opens beside the code as on Electron. Verified by running here (Linux x64 container, Xvfb, WebKitGTK 2.52, software GL, a two-file project, screenshots in the project files `ide-tauri/screenshots/r5-*.png`): the folder's automatic XR analysis opens the scene in the right slot; it follows a window resize and zen mode, hides while the welcome dialog is over it and comes back after; the close button removes it and a new analysis (File, XR) opens a second one on another port; a drill-down card's *Open in editor* opens `app.py` in Monaco through the scene bridge; saving a file updates the scene live; scene text renders with the vendored font. + +``` +src/main/analysis/sceneView.ts (unchanged flow) src-tauri/src/scene.rs + new WebContentsView / addChildView / loadURL ----> host.scene.create: Window::add_child (unstable multiwebview), + setBounds / setVisible ----> host.scene.setBounds (applied in order on the reader thread) + webContents.close / focus / executeJavaScript ----> host.scene.close / webview.focus / scene.eval + ipcMain.on(SCENE_OPEN_IN_EDITOR_CHANNEL) <---- scene.message <- codexr_scene <- out/sceneBridge (init script) +``` + +- **The seam.** `src/sidecar/tauriHost.ts` implements `WebContentsView` (made in the core on its first `loadURL`, with the bounds and visibility set before), `contentView.addChildView`, and `ipcMain.on` for the scene bridge, so `sceneView.ts`, `analysisService.ts` and `ipc.ts` run unchanged. The scene webview is labelled `scene-`, incognito (Electron's in-memory partition), may navigate only on its own server's origin, and new windows are refused. +- **Bridge.** `src/sceneBridge` (an IIFE in `out/sceneBridge/index.js`, injected into the scene webview only) defines the frozen `CodeXRHostBridge.openInEditor`, as Electron's scene preload does, and talks through one command, `codexr_scene`. `capabilities/scene.json` grants it to webviews `scene-*` on loopback pages (`http(s)://127.0.0.1:*`, `localhost:*`) only; the core checks the label and the origin it opened the view on again, and the sidecar hands the message to the same `ipc.ts` listener (path inside the open folder, sender frame = main frame). +- **Offline libraries.** A system webview cannot intercept `https`, so the shared core serves them: `@codexr/core/server/http/localSceneLibraries` (off by default, the VS Code plugin is unchanged; the IDE turns it on in `coreRuntime.ts` on both shells). Pages sent to this machine get the pinned CDN URLs rewritten to `/__codexr/scene-libraries/`, served from `apps/vscode-extension/test/vendor/scene-libraries` (only the table's files); A-Frame's font root and BabiaXR's default font URL are rewritten inside the served scripts. Pages sent through the Cloudflare tunnel are not rewritten (guests and headsets keep the CDNs). The Electron scene session keeps its interception as a second line. +- **Enter XR.** A Tauri webview's `eval` returns nothing and cannot carry the person's gesture. `executeJavaScript` on a scene view runs the expression through the bridge (`sceneEvalScript`, answers matched by a random id and the view's label). Where `navigator.xr` exists (WebView2) and a headset is reported, Enter XR asks the scene to show its own Enter XR button, and the click inside the scene starts the session; the header says so. Where it does not (WKWebView, WebKitGTK: R1 spike), `SceneInfo.xrUnavailable` hides the header's Enter XR and the note points at *Open in browser* and *On a headset*: no dead button. The same change fixes the LivePanel check, which compared `startsWith('livepanel')` against kinds named `-livepanel` and never hid the button. +- **Windows by label.** A window with the scene beside its page holds two webviews, and Tauri then no longer returns it from `get_webview_window`: the host looks windows up with `get_window` and webviews with `get_webview` (the first run showed "no window main" on focus). + +Deviations: the XR permission is not armed or checked on Tauri (no webview permission handlers before R9; the in-scene click is the gesture, and WebView2 applies its own prompt); the scene's other requests are not filtered (Electron's `onBeforeRequest`; R9, or a CSP from the core in IDE mode); the screen picker stays degraded (R9, logged). Not verified by running: Enter XR on WebView2 with a headset, the eval path in a real webview (unit-tested in a VM context only, since Linux hides the button), Windows and macOS (CI), the Agent Flow view (scene-side, not exercised here). Left: R9 permission handlers and request filtering for the scene view, a headset test on Windows.