Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b450846
IDE: one desktop seam for every Electron import of the main process (…
aMonteSl Dec 4, 2026
e3175e6
IDE spike (R1): log scheme requests, page loads and probe progress; p…
aMonteSl Dec 4, 2026
c8111fc
IDE: window.codexr built once for both shells, plus the Tauri bridge …
aMonteSl Dec 4, 2026
6f674d4
IDE: the Node sidecar of the Tauri build, on the shared boot sequence…
aMonteSl Dec 4, 2026
faaf0de
IDE: the Tauri 2 shell runs the real IDE with the Node sidecar (#480,…
aMonteSl Dec 4, 2026
d160e8a
Merge branch 'claude/project-thread-urap9o' of https://github.com/Cod…
claude Dec 4, 2026
74d3cb6
docs(ide): R1 spike results on the three OS: go, no CEF fallback (#479)
aMonteSl Dec 4, 2026
6bcd213
docs(ide): Tauri walking skeleton: what runs, deviations, first numbe…
aMonteSl Dec 4, 2026
d13d9f9
ci(ide): bench the Tauri build on the three OS beside Electron (#480)
aMonteSl Dec 4, 2026
d1674f5
IDE: tauri.mjs runs on Windows (main-module check with fileURLToPath)…
aMonteSl Dec 4, 2026
1ed8de2
IDE (Tauri): open the window at launch, hidden until loaded; the side…
aMonteSl Dec 4, 2026
fafe876
IDE (Tauri): serve the app on Windows; the bench prints the app's std…
aMonteSl Dec 4, 2026
f997d2e
IDE: the terminal cursor blinks from a timer, not an infinite CSS ani…
aMonteSl Dec 4, 2026
cc9d948
IDE (Tauri): no WebKitGTK DMA-BUF renderer where there is no GPU rend…
aMonteSl Dec 4, 2026
266c700
docs(ide): Tauri skeleton start-up, idle and memory work, with before…
aMonteSl Dec 4, 2026
0473832
IDE (Tauri): allow the IDE commands from http://codexr.localhost, the…
aMonteSl Dec 4, 2026
40ef1b2
ci(ide): Tauri bench job allows user namespaces on Linux, as the Elec…
aMonteSl Dec 4, 2026
51f24d2
feat(ide): Tauri bridge forwards page errors to the core log; IPC tra…
aMonteSl Dec 4, 2026
69fc611
core: a host may serve the scene libraries itself; the IDE does (#483)
aMonteSl Dec 4, 2026
f029115
IDE (Tauri): the scene view beside the code in a second webview, with…
aMonteSl Dec 4, 2026
8b4cfaf
IDE: honest Enter XR on Tauri; no dead button (#483)
aMonteSl Dec 4, 2026
76992de
docs(ide): R5 scene view on Tauri: what works, deviations, what is le…
aMonteSl Dec 4, 2026
8b45923
IDE: the Node debugger drops the inspector's 'Debugger ending on' lin…
aMonteSl Dec 4, 2026
d1104ef
ci(ide): bench traces the first Tauri run's stderr with timings, to f…
aMonteSl Dec 4, 2026
6d5648d
ci(ide): bench trace satisfies the curly rule (#480)
aMonteSl Dec 4, 2026
c559d28
ci(ide): Tauri start-up diagnostics: event delivery on the core log, …
aMonteSl Dec 4, 2026
62efaf5
IDE (Tauri): start-up timing trace under CODEXR_IPC_TRACE (core setup…
aMonteSl Dec 4, 2026
b962852
IDE (Tauri): trace IPC answers and the page when a bench step stalls …
aMonteSl Dec 4, 2026
2ecd7ef
IDE (Tauri): one Tauri host in the sidecar on Windows, so IPC handler…
aMonteSl Dec 4, 2026
9ccbb06
ci(ide): Linux bench in a session bus of its own for both shells; tem…
aMonteSl Dec 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 85 additions & 1 deletion .github/workflows/ide-bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,17 @@ 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'
paths:
- '.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
Expand Down Expand Up @@ -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'
Expand All @@ -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
15 changes: 10 additions & 5 deletions apps/ide/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,25 @@ 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=<dir>` | 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

```
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/
```
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion apps/ide/electron-builder.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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/**',
Expand Down
18 changes: 17 additions & 1 deletion apps/ide/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
},
{
Expand Down
3 changes: 3 additions & 0 deletions apps/ide/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
40 changes: 37 additions & 3 deletions apps/ide/scripts/bench.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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=<dir>] [--out=<file.json>] [--label=<name>] -- <command> [args...]
// node scripts/bench.mjs [--runs=5] [--idle-seconds=20] [--folder=<dir>] [--out=<file.json>] [--label=<name>] [--trace-first] -- <command> [args...]
// With no command it launches the built Electron IDE (npm run build first).
//
// One run: spawn the app with --codexr-bench --folder=<dir>; the renderer's driver
Expand All @@ -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('--');
Expand All @@ -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];
Expand Down Expand Up @@ -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) => {
Expand All @@ -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');
Expand Down
Loading
Loading