diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 480f2e94..652d5804 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,10 @@ on: branches: [main] pull_request: +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + permissions: contents: read diff --git a/.github/workflows/extension.yml b/.github/workflows/extension.yml index a1fe8737..2800845b 100644 --- a/.github/workflows/extension.yml +++ b/.github/workflows/extension.yml @@ -1,6 +1,7 @@ name: VS Code extension packages on: + workflow_call: workflow_dispatch: push: branches: [main] @@ -14,6 +15,10 @@ on: - tauri/src-tauri/** - .github/workflows/extension.yml +concurrency: + group: extension-packages-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + permissions: contents: read @@ -54,6 +59,7 @@ jobs: - uses: Swatinem/rust-cache@v2 with: workspaces: tauri/src-tauri + cache-on-failure: true - name: Install Linux native dependencies if: runner.os == 'Linux' run: | @@ -94,7 +100,11 @@ jobs: code_cli="$RUNNER_TEMP/vscode/bin/code" fi test -x "$code_binary" - "$code_cli" --user-data-dir "$RUNNER_TEMP/install-profile" --extensions-dir "$RUNNER_TEMP/codex-extensions" --install-extension openai.chatgpt@26.1002.51308 --force + for attempt in 1 2 3; do + if "$code_cli" --user-data-dir "$RUNNER_TEMP/install-profile" --extensions-dir "$RUNNER_TEMP/codex-extensions" --install-extension openai.chatgpt@26.1002.51308 --force; then break; fi + if [[ "$attempt" == 3 ]]; then exit 1; fi + sleep 5 + done codex_extension=$(find "$RUNNER_TEMP/codex-extensions" -maxdepth 1 -type d -name 'openai.chatgpt-*' -print -quit) test -n "$codex_extension" export codex_extension @@ -105,6 +115,7 @@ jobs: echo "MULTI_CODEX_TEST_EXTENSION=$codex_extension" >> "$GITHUB_ENV" echo "MULTI_CODEX_TEST_ENGINE=$codex_engine" >> "$GITHUB_ENV" - name: Test protocol, activity guards, rollback and native account storage + timeout-minutes: 5 run: npm test - name: Verify native macOS Keychain access if: runner.os == 'macOS' @@ -113,9 +124,11 @@ jobs: env: PACKAGE_TARGET: ${{ matrix.target }} run: | - npm run package -- --target "$PACKAGE_TARGET" --pre-release --out "multi-codex-$PACKAGE_TARGET-0.1.1.vsix" + npm run package:platform -- "$PACKAGE_TARGET" + package_version=$(node -p "require('./package.json').version") + echo "PACKAGE_VERSION=$package_version" >> "$GITHUB_ENV" mkdir "$RUNNER_TEMP/packaged-extension" - unzip -q "multi-codex-$PACKAGE_TARGET-0.1.1.vsix" -d "$RUNNER_TEMP/packaged-extension" + unzip -q "multi-codex-$PACKAGE_TARGET-$package_version.vsix" -d "$RUNNER_TEMP/packaged-extension" test -x "$RUNNER_TEMP/packaged-extension/extension/bin/multi-codex-account-helper" if [[ "$RUNNER_OS" == 'macOS' ]]; then codesign --verify --strict "$RUNNER_TEMP/packaged-extension/extension/bin/multi-codex-account-helper" @@ -144,7 +157,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: extension-${{ matrix.target }} - path: extension/multi-codex-${{ matrix.target }}-0.1.1.vsix + path: extension/multi-codex-${{ matrix.target }}-${{ env.PACKAGE_VERSION }}.vsix if-no-files-found: error - name: Upload synthetic test evidence if: always() diff --git a/.github/workflows/installer-smoke.yml b/.github/workflows/installer-smoke.yml index 7dd10de7..2b35a180 100644 --- a/.github/workflows/installer-smoke.yml +++ b/.github/workflows/installer-smoke.yml @@ -6,7 +6,6 @@ on: tag: description: Release whose exact DMG should be installed required: true - default: v1.3.8 permissions: contents: read @@ -30,7 +29,7 @@ jobs: source_run_id=$(python3 - <<'PY' import json, os from pathlib import Path - report = json.loads(Path(f"docs/releases/{os.environ['CANDIDATE_TAG']}-local-validation.json").read_text()) + report = json.loads(Path(f"release/evidence/{os.environ['CANDIDATE_TAG']}-local-validation.json").read_text()) assert 'v' + report['version'] == os.environ['CANDIDATE_TAG'] print(report['releaseRun'].rsplit('/', 1)[1]) PY @@ -41,7 +40,7 @@ jobs: python3 - <<'PY' import hashlib, json, os, shutil from pathlib import Path - report = json.loads(Path(f"docs/releases/{os.environ['CANDIDATE_TAG']}-local-validation.json").read_text()) + report = json.loads(Path(f"release/evidence/{os.environ['CANDIDATE_TAG']}-local-validation.json").read_text()) assets = Path(os.environ['RUNNER_TEMP']) / 'installer-assets' name = f"Multi.Codex_{report['version']}_amd64.AppImage" source = next(assets.rglob(name)) @@ -83,7 +82,7 @@ jobs: source_run_id=$(python3 - <<'PY' import json, os from pathlib import Path - report = json.loads(Path(f"docs/releases/{os.environ['CANDIDATE_TAG']}-local-validation.json").read_text()) + report = json.loads(Path(f"release/evidence/{os.environ['CANDIDATE_TAG']}-local-validation.json").read_text()) assert 'v' + report['version'] == os.environ['CANDIDATE_TAG'] print(report['releaseRun'].rsplit('/', 1)[1]) PY @@ -93,7 +92,7 @@ jobs: python3 - <<'PY' import hashlib, json, os from pathlib import Path - report = json.loads(Path(f"docs/releases/{os.environ['CANDIDATE_TAG']}-local-validation.json").read_text()) + report = json.loads(Path(f"release/evidence/{os.environ['CANDIDATE_TAG']}-local-validation.json").read_text()) assets = Path(os.environ['RUNNER_TEMP']) / 'installer-assets' name = f"Multi.Codex_{report['version']}_aarch64.dmg" expected = report['artifacts'][name] diff --git a/.github/workflows/macos-menu.yml b/.github/workflows/macos-menu.yml new file mode 100644 index 00000000..bd32b2c4 --- /dev/null +++ b/.github/workflows/macos-menu.yml @@ -0,0 +1,47 @@ +name: Packaged Mac menu validation +on: + workflow_dispatch: + inputs: + candidate_run: + description: Release workflow run containing the exact macos-package artifact + required: true +permissions: + contents: read + actions: read +jobs: + menu: + runs-on: macos-26 + timeout-minutes: 20 + steps: + - uses: actions/checkout@v4 + - name: Download exact candidate and install native launch targets + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CANDIDATE_RUN: ${{ inputs.candidate_run }} + run: | + [[ "$CANDIDATE_RUN" =~ ^[0-9]+$ ]] + for attempt in {1..24}; do + if gh run download "$CANDIDATE_RUN" --name macos-package --dir "$RUNNER_TEMP/candidate"; then break; fi + sleep 30 + done + test -n "$(find "$RUNNER_TEMP/candidate" -name '*.dmg' -print -quit)" + curl --fail --location --retry 3 https://update.code.visualstudio.com/latest/darwin-arm64/stable -o "$RUNNER_TEMP/vscode.zip" + ditto -xk "$RUNNER_TEMP/vscode.zip" /Applications + curl --fail --location --retry 3 https://persistent.oaistatic.com/codex-app-prod/ChatGPT-darwin-arm64-26.930.51102.zip -o "$RUNNER_TEMP/standalone.zip" + ditto -xk "$RUNNER_TEMP/standalone.zip" /Applications + DMG=$(find "$RUNNER_TEMP/candidate" -name '*.dmg' -print -quit) + shasum -a 256 "$DMG" > "$RUNNER_TEMP/candidate-sha256.txt" + printf 'Y\n' | hdiutil attach "$DMG" -mountpoint "$RUNNER_TEMP/candidate-volume" -nobrowse + APP=$(find "$RUNNER_TEMP/candidate-volume" -maxdepth 1 -name '*.app' -print -quit) + ditto "$APP" "$RUNNER_TEMP/Multi Codex.app" + hdiutil detach "$RUNNER_TEMP/candidate-volume" + - name: Verify menu actions, close, tray Open, Dock reopen and Quit + run: python3 release/scripts/macos-menu-smoke.py "$RUNNER_TEMP/Multi Codex.app" + - uses: actions/upload-artifact@v4 + if: always() + with: + name: macos-menu-evidence + path: | + ${{ runner.temp }}/multi-codex-menu-evidence/ + ${{ runner.temp }}/candidate-sha256.txt + if-no-files-found: warn diff --git a/.github/workflows/publish-validated.yml b/.github/workflows/publish-validated.yml index 886d26f6..58816319 100644 --- a/.github/workflows/publish-validated.yml +++ b/.github/workflows/publish-validated.yml @@ -5,7 +5,6 @@ on: tag: description: Existing draft candidate tag required: true - default: v1.3.8 permissions: contents: write jobs: @@ -35,4 +34,4 @@ jobs: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} CANDIDATE_TAG: ${{ inputs.tag }} run: | - gh release edit "$CANDIDATE_TAG" --draft=false --prerelease=false --latest --title "Multi Codex $CANDIDATE_TAG" --notes-file "docs/releases/${CANDIDATE_TAG}.md" + gh release edit "$CANDIDATE_TAG" --draft=false --prerelease=false --latest --title "Multi Codex $CANDIDATE_TAG" --notes-file "release/notes/${CANDIDATE_TAG}.md" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 898da2aa..044716b8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,6 +26,9 @@ jobs: env: RELEASE_TAG: ${{ github.ref_name }} run: | + if [[ "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]]; then + RELEASE_TAG="v$(node -p 'require("./package.json").version')" + fi [[ "$RELEASE_TAG" =~ ^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]] VERSION="${RELEASE_TAG#v}" VERSION="$VERSION" node -e ' @@ -55,6 +58,16 @@ jobs: - run: npm run test:release - run: npm run test:release-gates - run: npm run release:linux + - name: Verify install and update of the exact Linux candidate + run: | + mkdir "$RUNNER_TEMP/linux-installer-assets" + cp src-tauri/target/release/bundle/appimage/*.AppImage SHA256SUMS "$RUNNER_TEMP/linux-installer-assets/" + VERSION=$(node -p 'require("./package.json").version') + python3 scripts/linux-installer-smoke.py "$RUNNER_TEMP/linux-installer-assets" "v$VERSION" "$RUNNER_TEMP/linux-installer-result.json" + - uses: actions/upload-artifact@v4 + with: + name: linux-installer-evidence + path: ${{ runner.temp }}/linux-installer-result.json - uses: actions/upload-artifact@v4 with: name: linux-packages @@ -82,6 +95,9 @@ jobs: env: RELEASE_TAG: ${{ github.ref_name }} run: | + if [[ "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]]; then + RELEASE_TAG="v$(node -p 'require("./package.json").version')" + fi [[ "$RELEASE_TAG" =~ ^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]] VERSION="${RELEASE_TAG#v}" VERSION="$VERSION" node -e ' @@ -176,13 +192,23 @@ jobs: fi fi - name: Normalize DMG name - env: - RELEASE_TAG: ${{ github.ref_name }} run: | - VERSION="${RELEASE_TAG#v}" + VERSION=$(node -p 'require("./package.json").version') DMG=$(find src-tauri/target/aarch64-apple-darwin/release/bundle/dmg -type f -name '*.dmg' -print -quit) test -n "$DMG" mv "$DMG" "Multi.Codex_${VERSION}_aarch64.dmg" + - name: Verify install and update of the exact Mac candidate + run: | + mkdir "$RUNNER_TEMP/mac-installer-assets" + cp Multi.Codex_*_aarch64.dmg "$RUNNER_TEMP/mac-installer-assets/" + (cd "$RUNNER_TEMP/mac-installer-assets" && shasum -a 256 *.dmg > SHA256SUMS) + VERSION=$(node -p 'require("./package.json").version') + python3 scripts/macos-installer-smoke.py "$RUNNER_TEMP/mac-installer-assets" "v$VERSION" + - uses: actions/upload-artifact@v4 + if: always() + with: + name: macos-installer-evidence + path: ${{ runner.temp }}/multi-codex-macos-installer-evidence/ - uses: actions/upload-artifact@v4 with: name: macos-package @@ -197,9 +223,15 @@ jobs: path: ${{ runner.temp }}/multi-codex-macos-evidence/ if-no-files-found: warn + windows: + uses: ./.github/workflows/windows.yml + + extensions: + uses: ./.github/workflows/extension.yml + prepare-draft: if: github.event_name != 'workflow_dispatch' - needs: [linux, macos] + needs: [linux, macos, windows, extensions] runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 @@ -212,20 +244,20 @@ jobs: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | mkdir release-assets - find downloaded-assets -type f \( -name '*.AppImage' -o -name '*.deb' -o -name '*.rpm' -o -name '*.dmg' \) -exec cp {} release-assets/ \; + find downloaded-assets -type f \( -name '*.AppImage' -o -name '*.deb' -o -name '*.rpm' -o -name '*.dmg' -o -name '*_x64-setup.exe' -o -name '*.vsix' \) -exec cp {} release-assets/ \; cd release-assets mapfile -d '' ASSETS < <(find . -maxdepth 1 -type f -print0 | sort -z) - ((${#ASSETS[@]} == 4)) - cp ../scripts/install-app.sh ../scripts/update-app.sh . - ASSETS+=(./install-app.sh ./update-app.sh) + ((${#ASSETS[@]} == 9)) + cp ../scripts/install-app.sh ../scripts/update-app.sh ../scripts/install-app.ps1 ../scripts/update-app.ps1 . + ASSETS+=(./install-app.sh ./update-app.sh ./install-app.ps1 ./update-app.ps1) sha256sum "${ASSETS[@]}" | sed 's# \./# #' > SHA256SUMS ASSETS+=(SHA256SUMS) cd .. if gh release view "$GITHUB_REF_NAME" --json isDraft >/dev/null 2>&1; then [[ "$(gh release view "$GITHUB_REF_NAME" --json isDraft --jq '.isDraft')" == "true" ]] gh release upload "$GITHUB_REF_NAME" release-assets/* --clobber - gh release edit "$GITHUB_REF_NAME" --notes-file "docs/releases/${GITHUB_REF_NAME}.md" + gh release edit "$GITHUB_REF_NAME" --notes-file "release/notes/${GITHUB_REF_NAME}.md" else - gh release create "$GITHUB_REF_NAME" release-assets/* --draft --title "Multi Codex $GITHUB_REF_NAME — validation pending" --notes-file "docs/releases/${GITHUB_REF_NAME}.md" + gh release create "$GITHUB_REF_NAME" release-assets/* --draft --title "Multi Codex $GITHUB_REF_NAME — validation pending" --notes-file "release/notes/${GITHUB_REF_NAME}.md" fi echo "Draft created. Functional validation is required before publishing." diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml new file mode 100644 index 00000000..fa326e2a --- /dev/null +++ b/.github/workflows/windows.yml @@ -0,0 +1,134 @@ +name: Windows native validation +on: + workflow_call: + workflow_dispatch: + push: + branches: [main] + paths: ['tauri/**', 'extension/**', '.github/workflows/windows.yml'] + pull_request: + paths: ['tauri/**', 'extension/**', '.github/workflows/windows.yml'] +concurrency: + group: windows-native-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +permissions: + contents: read +jobs: + windows: + runs-on: windows-2025 + timeout-minutes: 50 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 24 + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + with: + workspaces: tauri/src-tauri + cache-on-failure: true + - run: npm ci + working-directory: tauri + - run: npm run build + working-directory: tauri + - run: cargo fmt --manifest-path tauri/src-tauri/Cargo.toml -- --check + - run: cargo test --locked --manifest-path tauri/src-tauri/Cargo.toml + - run: npm test + working-directory: tauri + - run: npm ci + working-directory: extension + - run: npm run build:helper + working-directory: extension + - name: Install official VS Code and Codex extension in disposable directories + shell: pwsh + run: | + $codeRoot = Join-Path $env:RUNNER_TEMP 'vscode' + Invoke-WebRequest 'https://update.code.visualstudio.com/1.140.0/win32-x64-archive/stable' -OutFile "$env:RUNNER_TEMP/vscode.zip" + Expand-Archive "$env:RUNNER_TEMP/vscode.zip" $codeRoot + $extensions = Join-Path $env:RUNNER_TEMP 'codex-extensions' + for ($attempt = 1; $attempt -le 3; $attempt++) { + & "$codeRoot/bin/code.cmd" --user-data-dir "$env:RUNNER_TEMP/install-profile" --extensions-dir $extensions --install-extension openai.chatgpt@26.1002.51308 --force + if ($LASTEXITCODE -eq 0) { break } + if ($attempt -eq 3) { throw 'Official extension installation failed after three attempts' } + Start-Sleep -Seconds 5 + } + $official = (Get-ChildItem $extensions -Directory -Filter 'openai.chatgpt-*' | Select-Object -First 1).FullName + if (!$official) { throw 'Official extension missing' } + "MULTI_CODEX_TEST_VSCODE=$codeRoot/Code.exe" >> $env:GITHUB_ENV + "MULTI_CODEX_TEST_EXTENSION=$official" >> $env:GITHUB_ENV + "MULTI_CODEX_TEST_ENGINE=$official/bin/windows-x86_64/codex.exe" >> $env:GITHUB_ENV + - name: Verify two native VS Code accounts and isolated PowerShell CLI + run: cargo test --locked --manifest-path tauri/src-tauri/Cargo.toml windows_live_launches -- --ignored --test-threads=1 + - name: Install the official signed Codex Windows MSIX in the disposable runner + shell: pwsh + run: | + $package = "$env:RUNNER_TEMP/Codex.msix" + Invoke-WebRequest 'https://persistent.oaistatic.com/codex-app-prod/ChatGPT-x64.msix' -OutFile $package + Add-AppxPackage -Path $package + $location = (Get-AppxPackage -Name OpenAI.Codex).InstallLocation + if (!$location) { throw 'The signed OpenAI.Codex package is missing' } + "MULTI_CODEX_TEST_STANDALONE=$location/app/ChatGPT.exe" >> $env:GITHUB_ENV + - name: Verify separate standalone accounts, native windows, guards and cold restart + run: cargo test --locked --manifest-path tauri/src-tauri/Cargo.toml windows_live_standalone -- --ignored --test-threads=1 + - run: npm test + working-directory: extension + - name: Package Windows VSIX and extract the exact package for UI tests + working-directory: extension + shell: pwsh + run: | + npm run package:platform -- win32-x64 + if ($LASTEXITCODE -ne 0) { throw 'VSIX packaging failed' } + $manifest = Get-Content package.json | ConvertFrom-Json + $vsix = "$($manifest.name)-win32-x64-$($manifest.version).vsix" + Copy-Item $vsix "$env:RUNNER_TEMP/extension.zip" + Expand-Archive "$env:RUNNER_TEMP/extension.zip" "$env:RUNNER_TEMP/packaged-extension" + "MULTI_CODEX_TEST_DEVELOPMENT_PATH=$env:RUNNER_TEMP/packaged-extension/extension" >> $env:GITHUB_ENV + - name: Verify packaged live attachment in real Windows VS Code + working-directory: extension + shell: pwsh + run: | + $env:MULTI_CODEX_TEST_LIVE_ATTACH='1' + node scripts/test-vscode.mjs + if ($LASTEXITCODE -ne 0) { throw 'Packaged Windows live attachment failed' } + Copy-Item .test-results/vscode-result.json .test-results/packaged-live-attachment.json + - name: Verify packaged native wrapper startup and account restoration + working-directory: extension + shell: pwsh + run: | + node scripts/test-vscode.mjs + if ($LASTEXITCODE -ne 0) { throw 'Packaged Windows startup failed' } + Copy-Item .test-results/vscode-result.json .test-results/packaged-startup.json + - uses: actions/upload-artifact@v4 + if: always() + with: + name: windows-extension-evidence + path: extension/.test-results/ + include-hidden-files: true + - uses: actions/upload-artifact@v4 + with: + name: extension-win32-x64 + path: extension/*-win32-x64-*.vsix + + - run: npm run tauri -- build --bundles nsis --config src-tauri/tauri.windows.conf.json + working-directory: tauri + - name: Normalize the manifest-derived Windows installer filename + shell: pwsh + run: | + $version = (Get-Content tauri/package.json | ConvertFrom-Json).version + $package = @(Get-ChildItem tauri/src-tauri/target/release/bundle/nsis/*.exe) + if ($package.Count -ne 1) { throw 'Expected one NSIS candidate' } + $destination = Join-Path $package[0].DirectoryName "Multi.Codex_$($version)_x64-setup.exe" + if ($package[0].FullName -ne $destination) { Move-Item $package[0].FullName $destination } + "MULTI_CODEX_TEST_INSTALLER=$destination" >> $env:GITHUB_ENV + - name: Install, update and restart the exact packaged Windows app + shell: pwsh + run: ./tauri/scripts/windows-installer-smoke.ps1 -Installer $env:MULTI_CODEX_TEST_INSTALLER + - uses: actions/upload-artifact@v4 + if: always() + with: + name: windows-installer-evidence + path: ${{ runner.temp }}/multi-codex-windows-evidence/ + - uses: actions/upload-artifact@v4 + with: + name: windows-installer + path: tauri/src-tauri/target/release/bundle/nsis/*.exe diff --git a/.gitignore b/.gitignore index 53b297c7..0d9cf3e5 100644 --- a/.gitignore +++ b/.gitignore @@ -32,4 +32,5 @@ next/tsconfig.tsbuildinfo temp/ -output/ \ No newline at end of file +output/ +/docs/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..53ce70be --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,53 @@ +# Release and contribution guidelines + +Use clear, verifiable descriptions of what changed and how it affects someone using Multi Codex. Keep package versions, release notes, the README and the website consistent. + +## Version numbers + +For future stable releases, use `MAJOR.MINOR.PATCH` and prefix Git tags with `v`: + +- Increase the major version for incompatible changes to supported behavior or interfaces, including a platform requirement that makes an existing installation unsupported. Include migration instructions. +- Increase the minor version for backward-compatible features. Reset the patch number to zero. +- Increase the patch version for backward-compatible bug fixes and maintenance. Small interface refinements can use a patch version when they do not introduce a new feature. + +For example, after `1.3.8`, a bug fix would be `1.3.9`, a new compatible feature would be `1.4.0`, and an incompatible change would be `2.0.0`. These examples are not a release schedule. + +Test-only and documentation-only changes do not normally need an app release. Versions identify packages; they do not count commits. Keep prerelease builds separate from the stable download and website's latest-version indicator. + +Treat stable versions as immutable. A later code or package change gets a new version rather than reusing a published version number. + +## Changelog entries + +The website at `/releases` presents selected user-facing updates grouped by major/minor series, newest first. A series summary describes the combined capabilities of that series; each version entry describes only changes included in that version. + +- Use concrete titles, such as “Workspace folder picker” or “Linux package checksum correction.” +- Explain the affected behavior and result. Avoid slogans, unsupported guarantees and internal test details in the short website summary. +- Use the published release date. Do not substitute the commit date or documentation update date. +- Include a link to the version's full GitHub release notes. Preserve existing version permalinks when editing copy or layout. +- Keep full package history on GitHub. Do not describe a selection of updates as every published version or invent entries to fill gaps. +- Put platform requirements, known limitations and links to validation evidence in the full notes under `release/notes/`. + +## Commit titles + +Use `type(scope): description` when a scope helps, or `type: description` otherwise. Write a short imperative description of the actual change, without a trailing period. + +- `feat(launch): add preferred CLI terminal selection` +- `fix(auth): preserve account isolation on repeated launches` +- `docs(releases): clarify changelog grouping and versioning` +- `test(installers): cover missing release assets` +- `chore(release): prepare version 1.3.9` + +Use `feat` for capabilities, `fix` for defects, `docs` for documentation, `test` for test coverage and `chore` for maintenance. Mark incompatible changes with `!` and explain them in the commit body and release notes. Describe validation in the commit body or pull request instead of crowding the title. + +## Release checklist + +1. Choose the next version based on the changes since the last stable release. +2. Synchronize the app package and lockfile, Tauri configuration, Rust package and lockfile, website package and lockfile, and `next/lib/site.ts`. The release workflow checks the app version against its tag. +3. Write full release notes in `release/notes/v.md`, including installation changes, compatibility requirements and known limitations. Link evidence without claiming checks that have not passed. +4. Complete the project's build, installer and release validation gates before publishing the stable release. +5. After publication, update `next/lib/releases.ts` with the actual publication timestamp and concise highlights. Add a series summary when a new major/minor series appears. +6. Align the README's current version and latest-change summary with the stable release, and verify the website badge, release-note links, version anchors and installation commands. + +## Website verification + +From `next/`, run `npm run build`, `npm run typecheck`, and `npx playwright test tests/site.spec.ts`. The browser checks cover grouping, chronological order, existing version permalinks, the latest download link and small-screen layout. Website copy and layout updates do not require rebuilding desktop packages. diff --git a/README.md b/README.md index 589d7961..2a612535 100644 --- a/README.md +++ b/README.md @@ -1,79 +1,17 @@ # Multi Codex -Your Codex accounts, your choice of VS Code, the Codex app, or CLI. Keep your default login untouched. +Manage Codex accounts across VS Code, the Codex app, and CLI while keeping your default login untouched. -[Website and docs](https://multi-codex.vercel.app) · [Quick start](https://multi-codex.vercel.app/docs) · [Changelog](https://multi-codex.vercel.app/releases) +**The website is the primary documentation source.** -Multi Codex — accounts +- [Installation and usage](https://multi-codex.vercel.app/docs) +- [Platform support](https://multi-codex.vercel.app/docs/platform-support) +- [VS Code extension](https://multi-codex.vercel.app/docs/extension) +- [Changelog](https://multi-codex.vercel.app/releases) +- [Downloads](https://github.com/wrestle-R/multi-codex/releases/latest) +- [Wiki](https://github.com/wrestle-R/multi-codex/wiki) +- [Contributing and release process](CONTRIBUTING.md) -Multi Codex — workspace and desktop selection +Multi Codex accounts -Install and update use the [latest release](https://github.com/wrestle-R/multi-codex/releases/latest), including its matching installer scripts. Current release: **v1.3.8**. - -Launch settings includes a **CLI terminal** selector for installed terminals, including Kitty and Ghostty. CLI launches use the selected account’s saved sign-in; install a complete Codex CLI rather than selecting the VS Code extension helper. - -Expiring usage resets appear in a small reminder at the top when they have **48 hours or less** remaining. Qualifying resets are grouped across accounts. Reminders appear at most **twice per local day**, at least **four hours apart**, with the limit preserved after restarting the app. - -## Latest changes - -**v1.3.8** improves Launch settings and the terminal picker: - -- Workspace and Launching settings have separate sections, with Save and Cancel always visible. -- The terminal picker shows Automatic and supported installed terminals, with keyboard navigation. -- A saved terminal that is no longer installed displays guidance for choosing a replacement. - -The [changelog](https://multi-codex.vercel.app/releases) groups updates by release series, newest first, with version-specific dates and links to full release notes. See [release and contribution guidelines](docs/release-guidelines.md) for versioning, changelog entries and commit titles. - -## Add an account - -Click **Add account** and choose one of three options: - -- **Sign in with browser** — use the sign-in link and one-time code to connect another account. -- **Paste JSON** — paste the contents of an existing Codex `auth.json` file. -- **Import current** — save a copy of your current Codex login without changing the original. - -Accounts appear in plan order: **Pro → Plus → Go → Free**. Usage limits refresh automatically when the app opens. - -## Linux - -AppImage for Linux x86_64. See [platform support](docs/platform-support.md) for distribution requirements and desktop integrations. - -### Install - -```bash -curl -fsSL https://github.com/wrestle-R/multi-codex/releases/latest/download/install-app.sh -o /tmp/install-multi-codex.sh -bash /tmp/install-multi-codex.sh -``` - -### Update - -```bash -curl -fsSL https://github.com/wrestle-R/multi-codex/releases/latest/download/update-app.sh -o /tmp/update-multi-codex.sh -bash /tmp/update-multi-codex.sh -``` - -## Mac - -Apple Silicon and macOS 26 or newer. This release has no Apple Developer ID signature and is not notarized; the Mac commands explicitly allow the checksum-verified unsigned build. - -Open Multi Codex once. If macOS blocks it, go to **System Settings → Privacy & Security → Open Anyway**, then confirm **Open**. [Apple's first-open instructions](https://support.apple.com/en-us/102445). The installer keeps Gatekeeper and quarantine protections in place. - -### Install - -```bash -curl -fsSL https://github.com/wrestle-R/multi-codex/releases/latest/download/install-app.sh -o /tmp/install-multi-codex.sh -MULTI_CODEX_ALLOW_UNSIGNED_MAC=1 bash /tmp/install-multi-codex.sh -``` - -### Update - -```bash -curl -fsSL https://github.com/wrestle-R/multi-codex/releases/latest/download/update-app.sh -o /tmp/update-multi-codex.sh -MULTI_CODEX_ALLOW_UNSIGNED_MAC=1 bash /tmp/update-multi-codex.sh -``` - -Updates replace the app while preserving saved accounts and profile data. Close Multi Codex before updating. To update without launching it, add `MULTI_CODEX_NO_LAUNCH=1` to the command. - -Standalone launch supports verified Codex desktop version `26.930.51102`. See [tested platforms and remaining validation](docs/platform-support.md). - -Install the Codex extension in each isolated VS Code profile before using Codex there. +Multi Codex is independent and is not affiliated with or endorsed by OpenAI. diff --git a/docs/extension-local-verification-2026-10-08.md b/docs/extension-local-verification-2026-10-08.md deleted file mode 100644 index 100a125e..00000000 --- a/docs/extension-local-verification-2026-10-08.md +++ /dev/null @@ -1,52 +0,0 @@ -# VS Code account switching and launcher: local verification - -This records the original Linux preview before the Marketplace release. For the subsequent Linux and native macOS packages, see [Marketplace release verification](extension-marketplace-verification-2026-10-08.json). The artifact hash and test counts below belong to this earlier preview. - -The Linux x64 preview attaches to an already-running official Codex backend and switches accounts without reloading VS Code, reactivating either extension, recreating the panel, restarting the backend, or creating another chat. **Initial ChatGPT attachment also needs no restart on the two verified Codex builds.** This uses a private Node compatibility hook and an experimental backend authentication API, not a public Codex extension API. - -The artifact is `extension/multi-codex-linux-x64-0.1.0.vsix`, packaged with an optimized native helper. SHA256: `a5c09e078c61410cc7e860b6d57ceb75cab316f95e254dece4ca74ca1bdefe73`. The VSIX was extracted; both runtime bundles and the helper matched the build byte-for-byte. That extracted package passed the actual VS Code checks below. - -Verified on Linux x64 with VS Code 1.140.0: - -| Official Codex extension | Bundled backend | Packaged live attachment | -| --- | --- | --- | -| 26.1002.51308 | 0.162.0-alpha.2 | Passed without any restart | -| 26.930.61225 | 0.160.1 | Passed without any restart | - -| Check | Result | -| --- | --- | -| TypeScript checking, bundle build, optimized helper and VSIX packaging | Passed | -| Extension tests, including native helper processes | 26 passed, 0 failed, 0 skipped | -| Rust tests | 85 passed, 0 failed; 3 existing desktop-session tests ignored | -| Desktop UI tests and production frontend build | 78 passed; build passed | -| Already-running official backend attachment | Same backend PID, host PID and Multi Codex activation ID | -| Actual bundled backend A → B → A | Identity verified; same process and rendered panel | -| Startup wrapper in extracted VSIX | Passed independently | -| ChatGPT → API key → ChatGPT in isolated backend | Identity verified; same process | -| Live attachment and original login file | Byte-for-byte unchanged on both builds | -| Active-account status bar and usage | Account label matched; backend limits read | -| Actual streaming turn | Switching rejected until completion | -| Existing chat continued after switching | Same thread; local model requests attributed to A, then B | -| Missing account, failed authentication, wrong identity | Previous verified identity retained/restored | -| First live switch fails before a managed selection | Original unmanaged identity restored | -| Failed rollback | New work and account switches blocked | -| Concurrent switches or work arriving during activity inspection | Refused/cancelled before unsafe authentication | -| Pre-existing hidden active thread, approvals, opaque queue notifications | Switching blocked | -| API-key adoption during live attachment | Refused before changing the original credential store | -| Fragmented UTF-8, batched frames, detachment | Original reader receives each frame once; methods restored | -| Invalid attachment framing or ambiguous backend processes | Attachment/switching fails closed | -| Standalone add/import and shared account discovery | Passed without desktop app | -| Concurrent metadata updates, leases, credential locks | No lost records; active accounts protected across processes | -| Fresh helper removes a persisted account | Passed with credential rollback support | -| Project selection on later startup | Restored; source configuration/auth unchanged | -| Incorrect private socket token; backend termination | Rejected; switching disabled after disconnection | -| Production desktop binary in live Hyprland | Tiled before Code opens, after launch, and after Code closes | -| Dependency audit and Rust formatting | Zero npm advisories; formatting passed | - -The launcher fix removes its forced floating restore state and verifies compositor state after mapping. Its previous one-shot startup operation could race GTK's maximize request. Live checks used disposable native app data and Code profiles. The existing running launcher also had its floating state corrected without restarting it. A rebuilt optimized desktop binary is available locally at `tauri/src-tauri/target/release/multi-codex-desktop`; the installed AppImage was not replaced or republished. - -The Codex tests use synthetic credentials and loopback authentication/usage/model fixtures. A disposable official-extension copy receives a fetch shim and existing-user onboarding flags; installed official-extension files and normal VS Code settings remain untouched. The backend and VS Code can still perform their own background checks. Cleanup terminates only processes whose home is inside that exact disposable fixture and removes its synthetic accounts. Runtime screenshots and detailed reports are ignored by Git and excluded from the VSIX. - -Live OAuth, real refresh-token rotation, cloud conversations, organization permissions and real quota enforcement need separate verification. Codex does not expose every queue held in the UI; clear UI-local queued follow-ups before switching. Unknown/opaque queue notifications block switching conservatively. Live attachment supports ChatGPT accounts; API keys require the isolated wrapper on a later normal startup. Unsupported or ambiguous host builds are refused without automatically reloading VS Code. macOS, Windows, remote environments and other Codex versions are not certified by this result. Older installed desktop releases do not understand extension account leases; use the updated desktop source when editing shared accounts concurrently. - -The original work was split into three source commits. Marketplace publishing was deferred at that stage; publication was subsequently authorized under the existing publisher `russeldanielpaul`. See [installation and compatibility](../extension/README.md), [summarized local test evidence](../extension/verification.json), and [publishing requirements](extension-publishing.md). diff --git a/docs/extension-startup-fix-verification-2026-10-09.md b/docs/extension-startup-fix-verification-2026-10-09.md deleted file mode 100644 index 93a97a03..00000000 --- a/docs/extension-startup-fix-verification-2026-10-09.md +++ /dev/null @@ -1,35 +0,0 @@ -# Codex startup fix — 2026-10-09 - -Multi Codex extension 0.1.3 fixes conflicts with VS Code opened by the desktop app. - -## Confirmed causes - -- A persisted `chatgpt.cliExecutable` wrapper started a new private authentication home without the current login. -- The global home used for shared account discovery also replaced the desktop account home used for configuration and resources. -- Saved project selections silently restored a previous account after startup. -- One installed profile referenced Codex 26.1002.51308 after its engine was removed by the update to 26.1007.21434. This prevented backend startup. -- The newer backend can return no token through `getAuthStatus` for a file-based ChatGPT login. Verified rollback now checks the backend routing identity against the private auth file in that case. - -## Result - -Each startup uses the launch environment’s current Codex home, with a configured/default fallback. It copies the file-based login and configuration into a private backend home, and links resources and history to the source home. Account storage remains separate. Previous project selections are ignored. Explicit account changes display a notification after identity verification and preserve the current conversation. Launcher refreshes replace files atomically. The official executable is resolved from the same VS Code installation on each startup. - -The desktop launcher source also explicitly sets `CODEX_SQLITE_HOME` to the selected account home. This source change was tested; the running installed desktop binary was not replaced. The installed extension already uses the current launch home when that variable is absent. - -## Verification - -- All 32 extension tests passed, including the native helper, fresh opens, changed launch homes, old selection files, deleted engine paths, first-switch rollback, activity guards and authentication checks. -- The Rust desktop launch environment test passed. -- Real VS Code startup and live attachment flows passed against installed Codex 26.1007.21434 with synthetic accounts and a loopback service. These checked account A → B → A, usage, a running-turn switch rejection, and continuation of the same chat as B without restarting the host, backend or panel. -- The final Linux x64 VSIX was extracted and tested in real VS Code with the same startup flow. -- Version 0.1.3 was installed into both existing profiles containing Multi Codex. Their saved launcher/configuration files were backed up and repaired to reference existing executables and the new extension. -- The seven original tracked account files (account metadata and six auth files) were unchanged by installation. No real login, account switch or chat was performed during local installation. -- Both installed launcher scripts passed shell syntax checks and reference existing engine/helper paths. - -The update takes effect when the existing VS Code windows are reopened. Browser OAuth and macOS were not tested in this Linux session. This package was installed locally; it was not published to Marketplace. - -## Artifact - -`extension/multi-codex-linux-x64-0.1.3.vsix` - -SHA-256: `e91424f0bfdc871d61ab07bbf0557bcd91b891ce081251e4a3a61745a16e37b4` diff --git a/docs/plans/launch-settings-preview-plan.md b/docs/plans/launch-settings-preview-plan.md deleted file mode 100644 index c07588e3..00000000 --- a/docs/plans/launch-settings-preview-plan.md +++ /dev/null @@ -1,68 +0,0 @@ -# Launch settings and app selection — approval preview - -Date: 2026-10-05 -Status: visual revision 2 approved by the user on 2026-10-05. Settings, welcome, detection and Mac runner work are implemented for v1.3.4. Standalone launch remains gated pending authenticated isolation on both platforms. - -## Settings and folder selection - -Keep Preferred folder with a Browse action visible. Reuse WorkspacePickerDialog for selecting the preference, with Choose this folder/Cancel and no launch side effect. Keep executable overrides and global Codex home under a collapsed Advanced disclosure. Rename Save paths to Save settings. - -Show the desktop-picker toggle only after the backend positively identifies Linux. Keep it hidden during loading, detection failure and on macOS. Keep the existing Mac direct-launch behavior. - -## First run and available apps - -The welcome screen is deliberately simple: the existing brand mark, a short welcome message, a single Get started action and an unobtrusive automatic detection status. No settings, folder fields, app-selection controls, paths or installation checklist appear on welcome. Use a short opacity/translation entrance, a 3px slow mark drift and restrained button hover; respect reduced-motion preferences. - -On welcome, read the platform from the native backend and automatically detect the installed VS Code app, Codex CLI availability (including its IDE-extension fallback), and the desktop Codex/ChatGPT app. Save setup completion and detected state. Revalidate platform/app availability at startup and before launch, since apps can later be installed or removed. An existing user's accounts and defaults are preserved. - -Show the entire Open accounts with section in settings ONLY when both apps and their dependencies are present. Hide its heading, selector and installed-status labels when only one app is available; automatically use the available target. With no usable target, give a recoverable installation action after welcome without presenting misleading launch choices. When both are present, offer VS Code extension only, Codex app only and Both. The standalone target additionally requires validated authentication isolation. Show two launch buttons only when Both is selected and both targets are usable. Never switch accounts in a running global desktop app as a fallback. - -## Isolation investigation - -Local installed desktop app: ChatGPT 26.930.51102 at /usr/lib/chatgpt, launcher /usr/bin/chatgpt. Read-only archive inspection found CODEX_HOME resolution and CODEX_ELECTRON_USER_DATA_PATH handling for desktop user data and instance locks. Mac-specific demo launch code sets both paths when opening a new app instance. These are local implementation findings, not a public stable API promise. - -Two disposable signed-out Linux instances ran concurrently with separate temporary HOME/XDG directories, Codex homes and desktop-data paths. They created separate cookie databases and desktop state. No account credentials were imported. This establishes independent signed-out instance startup only. It does not establish isolation of two authenticated identities, credential refresh, Keychain identities, or reuse of existing VS Code auth in the desktop UI. Desktop launch integration must remain gated until those pass. Probe evidence resides outside the repository at /tmp/mci-42l7ae5d/results.json. - -Public documentation: https://learn.chatgpt.com/docs/config-file/environment-variables and https://learn.chatgpt.com/docs/developer-commands . CODEX_HOME support does not by itself establish desktop browser-session isolation. - -## More thorough Mac CI using GitHub runners - -Use GitHub-hosted macOS runners; no AWS. Add isolated temp directories and controlled test credentials/mocks for executable detection, onboarding, setting migration, folder selection, direct launch and error states. Exercise paths with spaces/Unicode, empty GUI PATH and inherited environment. Assert default auth/config and installed user data are unchanged. - -Expand package verification to installation into a temporary Applications directory, restart persistence and real disposable VS Code/desktop startup; verify actual windows and child-process state instead of only process survival. For desktop isolation, run two signed-out app instances, compare their data/socket/session paths and use a controlled test account only if login can be safely automated. Save sanitized logs, screenshots and test reports as CI artifacts. Separate signed/notarized installer checks from unsigned startup checks. Record interactive sign-in/permission checks as unverified when runner automation cannot exercise them. - -## After visual approval - -1. Complete the authenticated desktop isolation proof before enabling that launch target. If it fails, report the finding and revise the scope with the user. -2. Implement the approved settings, welcome screen, detection and target-specific launch flows with backward-compatible saved settings and unchanged existing profile IDs/data paths. -3. Validate Linux and Mac CI; use demo profiles for polished real screenshots in both themes, matching the user's populated reference. Do not publish generated concept images as screenshots of the working app. -4. Commit implementation and README screenshot updates; prepare the next release and await successful builds. Preserve honest release validation/signing status. -5. Back up local app data and old executable, verify account IDs and credential files, download/checksum the exact release artifact, replace only the executable and verify startup/accounts. Keep rollback backups. Never reinstall or recreate current profiles. - -## Visual approval artifacts — revision 2 - -The earlier generated account layout is rejected as a README screenshot. Preserve the existing accounts interface, current brand mark and app-data storage total. README images must be real captures of the implemented app with realistic demo profiles, captured from a native desktop window at 1180x980 so all three populated profiles and the footer fit; include both themes. Never replace working-app screenshots with generated designs, invented storage indicators or decorative UI. - -These revision-2 images are browser-rendered design prototypes using the actual application CSS and fonts, not screenshots of implemented production features: - -- [Simple welcome](previews/welcome-v2.png) -- [Linux settings, one installed app: app-selection section hidden](previews/settings-single-v2.png) -- [Linux settings, both installed apps](previews/settings-both-v2.png) -- [Mac settings: desktop toggle hidden](previews/settings-mac-v2.png) -- [Animated interactive preview](previews/interface-preview.html) - -The preview HTML lives under docs/plans and remains a design reference; v1.3.4 contains the corresponding production settings/welcome changes. Browse demonstrates the existing folder-picker layout. It will reuse the real WorkspacePickerDialog implementation after approval. Settings/navigation in the static preview are visual prototypes, not saved preferences or app launch code. - -## v1.3.4 implementation boundary - -Repeatable standalone probe commands, interactive test instructions and current evidence are tracked in [Standalone isolation verification](standalone-isolation-verification.md). The standalone target stays disabled while authenticated checks are incomplete. - -VS Code remains the only enabled launcher. The app-choice section is completely absent unless both VS Code and the standalone app are detected; when both are installed it shows VS Code selected and the standalone choices disabled with the verification reason. No dual launch buttons are advertised as working. CODEX_HOME plus a separate desktop user-data directory is promising implementation evidence, but automated signed-out startup does not establish authenticated Linux/Mac isolation. No real user credentials were copied into the standalone probe. - -Welcome is shown only for an empty account list with incomplete setup. Existing accounts skip onboarding. Get started atomically saves setup completion and a native detection snapshot in the existing settings file; startup/settings/prelaunch query current installation state. Missing VS Code gives a recoverable installation/path message. The snapshot never overrides the detected OS. - -GitHub macOS CI and release jobs run the real disposable Keychain and VS Code startup tests, inspect the Apple Silicon bundle, start it twice in an isolated HOME with spaces/Unicode and an empty GUI PATH, require an on-screen native window, and compare unchanged global auth/config, profile metadata and legacy settings fixtures. Evidence is uploaded even on failure. Real account sign-in, permission dialogs, standalone account isolation and signing/notarization remain separate unverified checks. - -## v1.3.5 verified standalone integration - -Authenticated Linux and Mac isolation passed for desktop version 26.930.51102; see [verification](standalone-isolation-verification.md). The saved VS Code / Codex app / Both choice and target-specific buttons are now implemented. Existing settings migrate to VS Code; new users with both verified apps start with Both. One installed app is selected automatically. Unknown desktop versions fail closed because the isolation variable is internal. Each launch uses the existing Codex home and separate desktop data, with the user’s normal browser environment retained. Running-profile cleanup guards cover both apps. README captures and exact-package local verification follow release builds. diff --git a/docs/plans/previews/interface-preview.html b/docs/plans/previews/interface-preview.html deleted file mode 100644 index 0de4c5e9..00000000 --- a/docs/plans/previews/interface-preview.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - -Multi Codex — interface preview - - - - -
-
Multi Codex
-
-
- -

Welcome to Multi Codex.

-

Separate accounts. One place to launch them.

-
Linux · Ready to go
- -

Your default Codex login stays untouched.

-
-
-
-
-
LAUNCH SETTINGS
-

Folders and launching

-

A few preferences, just for you.

- -
-

The folder picker will start here.

- -
Show desktop pickerChoose a desktop before launching.
-
Advanced
-
-
-
-
-
PREFERRED FOLDER

Choose a folder

↑ Up  /home/you/Projects
▱Client work
▱Personal
▱Studio
-
Interface preview · no account data
- - - diff --git a/docs/plans/previews/settings-both-v2.png b/docs/plans/previews/settings-both-v2.png deleted file mode 100644 index fe520b09..00000000 Binary files a/docs/plans/previews/settings-both-v2.png and /dev/null differ diff --git a/docs/plans/previews/settings-mac-v2.png b/docs/plans/previews/settings-mac-v2.png deleted file mode 100644 index 1f3fa081..00000000 Binary files a/docs/plans/previews/settings-mac-v2.png and /dev/null differ diff --git a/docs/plans/previews/settings-single-v2.png b/docs/plans/previews/settings-single-v2.png deleted file mode 100644 index ea4ed57e..00000000 Binary files a/docs/plans/previews/settings-single-v2.png and /dev/null differ diff --git a/docs/plans/previews/welcome-v2.png b/docs/plans/previews/welcome-v2.png deleted file mode 100644 index 4abc5796..00000000 Binary files a/docs/plans/previews/welcome-v2.png and /dev/null differ diff --git a/docs/plans/standalone-isolation-verification.md b/docs/plans/standalone-isolation-verification.md deleted file mode 100644 index c78fe9a6..00000000 --- a/docs/plans/standalone-isolation-verification.md +++ /dev/null @@ -1,60 +0,0 @@ -# Standalone isolation verification - -The intended launch buttons share each existing profile's `codex-home` between VS Code and the standalone app. The desktop also gets its own `desktop-data` directory, separate from `vscode-user-data`. Existing account IDs and profile locations stay unchanged. Authenticated isolation passed on Linux and macOS for desktop version `26.930.51102`. Version 1.3.5 enables standalone launches only for that verified version on Linux x86_64 and Mac Apple Silicon; unknown versions remain gated. - -## Automated disposable probes - -`tauri/scripts/standalone-isolation.py` creates private temporary homes, Codex homes, desktop data and XDG paths. It clears inherited Codex/OpenAI/VS Code overrides. It never imports saved Multi Codex credentials. Its process controls check the exact disposable desktop data argument and process group before stopping a process. - -```sh -python3 tauri/scripts/standalone-isolation.py smoke /usr/lib/chatgpt/ChatGPT --output /tmp/standalone-result -``` - -The signed-out smoke test requires two concurrent instances, separate cookie databases, independent restarts and persistent per-instance storage markers. Linux checks fresh desktop window-reveal logs; macOS additionally requires visible Quartz windows belonging to each PID. This is startup/storage evidence only, not authenticated account-isolation proof. - -The manually triggered **Standalone desktop isolation probe** GitHub workflow installs the current first-party Apple Silicon desktop package into a temporary Applications directory on `macos-26`, then runs the same probe. Only its sanitized `result.json` is uploaded. Desktop state, auth files and raw logs must never be uploaded. - -## Interactive test accounts - -```sh -python3 tauri/scripts/standalone-isolation.py start /usr/lib/chatgpt/ChatGPT -``` - -This leaves two disposable windows open and prints their private temporary root. Interactive stdout/stderr goes to `/dev/null`, so a full temporary log cannot cause a Node console write exception. Sign into a different disposable account in each window, then use the printed root: - -```sh -python3 tauri/scripts/standalone-isolation.py status "$PROBE_ROOT" -python3 tauri/scripts/standalone-isolation.py checkpoint "$PROBE_ROOT" -python3 tauri/scripts/standalone-isolation.py restart "$PROBE_ROOT" a -python3 tauri/scripts/standalone-isolation.py check "$PROBE_ROOT" b -``` - -`status` reports only credential presence and SHA-256 fingerprints; it does not print tokens, emails or account IDs. `check` compares the peer credential, identity fingerprint and storage marker. A token changing from its own independent refresh needs investigation rather than being treated automatically as cross-account contamination. - -Repeat symmetrically, force an authenticated refresh, and sign out through each actual desktop window. Confirm the other window still has the original identity and can make authenticated requests. Confirm sessions remain separate and restart does not silently restore the signed-out identity from another store. Repeat on macOS, including desktop cookies and Keychain behavior. CLI-only or signed-out tests cannot approve the desktop UI's identity behavior. - -```sh -python3 tauri/scripts/standalone-isolation.py stop "$PROBE_ROOT" -``` - -Stopping retains private test data for inspection. Never commit that directory, copy production accounts into it, or reuse production tokens on a GitHub runner. - -## Results on 2026-10-05 - -- Installed Linux desktop: `openai-codex-electron` version `26.930.51102`. -- Initial signed-out Linux probe passed concurrent startup, distinct cookie databases and both independent restarts. -- A second local smoke attempt was interrupted by a desktop exiting; this is not a passing result. The initial result remains the current signed-out evidence. -- During interactive setup, `/tmp` reached its quota and Node console writes raised `UNKNOWN: unknown error, write`. The earlier stopped signed-out probe was removed after checking it had no credentials or running desktop processes. Interactive test windows were restarted with logging redirected to `/dev/null`; the first disposable login's auth file was preserved byte for byte. -- Authenticated Linux isolation passed with two different disposable accounts. Both accounts passed cold startup with fresh desktop data and existing Codex-home credentials, forced refresh with credential rotation, native desktop logout, and restart while signed out. Each operation checked the other profile's credential fingerprint and native identity; authenticated peer requests also succeeded while the peer remained signed in. These checks used the real desktop's native app-server connection and visible sign-in/profile-menu states. -- The user subsequently completed fresh sign-ins in both disposable Linux windows. Their current credentials are retained for local launch-button verification; production accounts have not been imported into the test. -- The bundled Codex CLI also recognized a disposable desktop login using the exact same Codex home without changing its credential file. -- [Mac GitHub runner probe 37338947965](https://github.com/wrestle-R/multi-codex/actions/runs/37338947965) passed on `macos-26`: two native Quartz-visible desktop windows, separate cookie databases and independent restarts with storage markers preserved. The sanitized report explicitly records authenticated isolation as **not tested**. -- [Authenticated Mac runner 37345518314](https://github.com/wrestle-R/multi-codex/actions/runs/37345518314) passed on `macos-26` with desktop version `26.930.51102`: two distinct real identities, cold reuse of existing CLI-created credentials with fresh desktop data, forced refresh and credential rotation, native desktop logout and signed-out restart, with the peer unchanged. The first authenticated attempt used the wrong bundled CLI path; the second rejected reversed A/B identity labels before running isolation checks. The passing verifier matches the exact unordered pair and requires distinct identities. Its workflow obtains fresh device-code logins on the runner using the official CLI; no local credentials are uploaded. Device sign-in instructions are encrypted to the operator's local public key before artifact upload. Only a sanitized result report is retained after verification. -- All six existing Multi Codex account IDs matched the pre-update backup, and all six existing auth files were still present after these probes. -- This verification work does not change the installed Multi Codex executable or its saved profiles. - -## Public documentation and implementation boundary - -[Official authentication documentation](https://learn.chatgpt.com/docs/auth) documents file-based credentials under `CODEX_HOME` and device-code login for headless environments. [App-server documentation](https://learn.chatgpt.com/docs/app-server) documents `account/read` with `refreshToken: true` and `account/logout`. - -Read-only inspection of the installed desktop found `CODEX_ELECTRON_USER_DATA_PATH` handling and explicit `CODEX_HOME` preservation for isolated desktop instances. This variable is an internal implementation detail, absent from the [stable public environment-variable list](https://learn.chatgpt.com/docs/config-file/environment-variables). `CODEX_HOME` alone does not isolate desktop cookies or prove separate authenticated sessions. diff --git a/docs/plans/windows-support-context.md b/docs/plans/windows-support-context.md deleted file mode 100644 index 99ee9f1e..00000000 --- a/docs/plans/windows-support-context.md +++ /dev/null @@ -1,17 +0,0 @@ -# Windows support — deferred context - -Status: deferred at the user's request on 2026-10-05. Do not include Windows implementation in the current Linux/macOS launch and settings work. - -Multi Codex is a Tauri/React app that currently launches isolated VS Code profiles. Its Rust backend relies on Unix file modes, Unix-specific APIs, Linux /proc inspection and macOS sysctl process inspection. A Windows port needs platform implementations, not just an installer change. - -Future scope: -- Introduce Windows equivalents for private directory/file access, atomic settings persistence, executable discovery, process detection, native browser opening and profile launch. -- Use Windows-native app data paths and credential-store integration. Preserve stable profile IDs and data across upgrades. -- Handle Windows paths, spaces and Unicode in both the Rust backend and folder-picker UI. -- Add Windows CI, native build/test jobs and a Tauri NSIS or MSI installer, plus a PowerShell installer/updater. -- Begin with ordinary workspace launches; defer virtual-desktop inventory/placement. -- Verify fresh install, account isolation, simultaneous/repeated launches, restart persistence, missing apps, permissions and upgrade without data loss. - -Do not assume desktop Codex/ChatGPT accepts VS Code flags or that Codex CLI credential files also authenticate desktop UI sessions. Verify the installed app version and authentication boundary first. - -Reference: https://v2.tauri.app/distribute/windows-installer/ diff --git a/extension/CHANGELOG.md b/extension/CHANGELOG.md index 0f086d96..eacb01c4 100644 --- a/extension/CHANGELOG.md +++ b/extension/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## 0.2.0 — 2026-10-09 + +- Wait for Codex initialization during account selection and report lost connections with a recovery action. +- Keep long chat history responses connected with bounded, incremental protocol framing. +- Match Windows backend executable paths across native case and separator differences. +- Add native Windows x64 support with Credential Manager, private account ACLs, authenticated named pipes, and an executable startup wrapper. +- Refresh all saved accounts from the top-bar Check Usage action, with progress, independent failures, remaining percentages and reset times. +- Keep active Windows wrappers intact during reactivation and wait for account/backend processes to release their handles during cleanup. +- Verify matching Linux x64, macOS arm64/x64 and Windows x64 VSIX files; filenames and protocol versions derive from the extension manifest. +- Keep the website as the primary setup and compatibility guide. + ## 0.1.3 — 2026-10-09 - Start every Codex backend with the current launch home’s login, configuration, resources and history. diff --git a/extension/README.md b/extension/README.md index d0aacb43..65b0320e 100644 --- a/extension/README.md +++ b/extension/README.md @@ -8,14 +8,14 @@ Manage saved accounts and change the account used by the **existing official Cod - Share saved accounts with the Multi Codex desktop app, or use the extension on its own. - Block account changes while the backend reports active work or uncertain activity. -**Linux and macOS pre-release.** Platform packages target Linux x64, Apple Silicon Macs and Intel Macs. The Mac native helper requires macOS 26 or newer. The extension is free and open source. Your Codex subscription or API usage is billed separately. Multi Codex is an independent project and is not affiliated with or endorsed by OpenAI. +**Linux, macOS and Windows pre-release.** Platform packages target Linux x64, Apple Silicon Macs, Intel Macs and Windows x64. The Mac native helper requires macOS 26 or newer. The extension is free and open source. Your Codex subscription or API usage is billed separately. Multi Codex is an independent project and is not affiliated with or endorsed by OpenAI. -This preview uses an experimental Codex backend authentication API. Live attachment uses a private Node process/stdio compatibility hook; later startups use Codex's development-only executable setting. It is not an official OpenAI extension API integration. This release targets local VS Code on Linux x64 and macOS arm64/x64. Remote SSH, containers, WSL, Windows, Linux ARM64 and vscode.dev are not supported yet. +This preview uses an experimental Codex backend authentication API. Live attachment uses a private Node process/stdio compatibility hook; later startups use Codex's development-only executable setting. It is not an official OpenAI extension API integration. This release targets local VS Code on Linux x64, macOS arm64/x64 and Windows x64. Remote SSH, containers, WSL, Linux ARM64 and vscode.dev are not supported yet. ## Get started 1. Install the official `openai.chatgpt` Codex extension. -2. Install the pre-release of **Multi Codex** by **russeldanielpaul**. VS Code selects the matching platform package. For a downloaded package, run **Extensions: Install from VSIX…** and choose the Linux x64, macOS Apple Silicon (`darwin-arm64`) or macOS Intel (`darwin-x64`) VSIX for your machine. +2. Install the pre-release of **Multi Codex** by **russeldanielpaul**. VS Code selects the matching platform package. For a downloaded package, run **Extensions: Install from VSIX…** and choose the Linux x64, macOS Apple Silicon (`darwin-arm64`), macOS Intel (`darwin-x64`) or Windows x64 (`win32-x64`) VSIX for your machine. 3. Open Multi Codex in the activity bar. Existing desktop accounts appear automatically; use **+** in the Accounts toolbar to add an account if you are starting fresh. 4. Click an account row to connect switching automatically and use that account in the current official Codex panel. Hover over an account to check usage; the result appears beside its name. @@ -23,6 +23,8 @@ This preview uses an experimental Codex backend authentication API. Live attachm You do not need the Multi Codex desktop app, a separately installed Codex CLI, or the Codex desktop client. The extension uses the engine shipped inside the official VS Code extension. The VSIX contains the native account helper. +The [website](https://multi-codex.vercel.app/docs/extension) is the primary guide. Matching platform VSIX files are available from [GitHub Releases](https://github.com/wrestle-R/multi-codex/releases/latest). Artifact filenames and protocol client versions come from the extension manifest. + ## Accounts and desktop synchronization Existing desktop accounts are discovered automatically from the same local store: @@ -31,6 +33,7 @@ VS Code launched by a desktop account can inherit that profile's `CODEX_HOME`. T - Linux: `$XDG_DATA_HOME/multi-codex`, normally `~/.local/share/multi-codex`. - macOS: `~/Library/Application Support/multi-codex`. +- Windows: `%APPDATA%\multi-codex`. Without desktop accounts, the list starts empty. **Add Account** supports browser sign-in, importing the current Codex login, and importing an auth JSON file. The same saved accounts become visible to the desktop app if it is installed later. Rename and removal are available from an account's context menu. @@ -38,13 +41,13 @@ The account list refreshes every 1.5 seconds and after account changes. Both cli This repository's updated desktop service and the extension helper serialize metadata writes using a file lock. Active extension accounts hold shared leases that prevent deletion, credential replacement and cache cleanup. Older installed desktop releases do not understand these new locks: update/rebuild the desktop app before concurrently editing shared accounts there. -The active account is shown in the status bar and account list. Check active-account usage with **Multi Codex: Check Usage**, or use an account's **Check This Account's Usage** context action without switching. Usage comes from Codex's backend and displays the returned usage windows; unavailable limits are not invented. API-key billing is not a ChatGPT usage window. +The active account is shown in the status bar and account list. Check every saved account with **Multi Codex: Check All Accounts’ Usage**, or use an account's **Check This Account's Usage** context action without switching. Usage comes from Codex's backend and displays the returned usage windows; unavailable limits are not invented. API-key billing is not a ChatGPT usage window. ## How switching works On first enable, Multi Codex locates exactly one child process for the official bundled engine inside the shared local extension host. A reversible stdio adapter routes that already-running process through the bridge while retaining its original protocol reader. The bridge probes its authentication identity before enabling account changes. No installed official-extension file is changed. -The configured `chatgpt.cliExecutable` wrapper handles later normal startups, launching the **official bundled engine** with a private credential home and forwarding its normal protocol. Every normal startup reads the current launch’s `CODEX_HOME` (or the configured/default home), copies its file-based login and configuration into the private credential home, and keeps its resources and history available. Shared account storage uses the separate global home. The launcher resolves the currently installed official engine on each startup, including after extension updates. Both attachment modes use a private authenticated Unix socket to connect the account picker to the bridge. +The configured `chatgpt.cliExecutable` wrapper handles later normal startups, launching the **official bundled engine** with a private credential home and forwarding its normal protocol. Every normal startup reads the current launch’s `CODEX_HOME` (or the configured/default home), copies its file-based login and configuration into the private credential home, and keeps its resources and history available. Shared account storage uses the separate global home. The launcher resolves the currently installed official engine on each startup, including after extension updates. Both attachment modes use a private authenticated Unix socket (Linux/Mac) or Windows named pipe to connect the account picker to the bridge. When you select an account, the bridge: diff --git a/extension/package-lock.json b/extension/package-lock.json index 5555c988..4c8145be 100644 --- a/extension/package-lock.json +++ b/extension/package-lock.json @@ -1,12 +1,12 @@ { "name": "multi-codex", - "version": "0.1.3", + "version": "0.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "multi-codex", - "version": "0.1.3", + "version": "0.2.0", "license": "MIT", "devDependencies": { "@types/node": "^22.19.0", diff --git a/extension/package.json b/extension/package.json index 11feaa50..1348d060 100644 --- a/extension/package.json +++ b/extension/package.json @@ -2,7 +2,7 @@ "name": "multi-codex", "displayName": "Multi Codex", "description": "Manage Codex accounts and switch the current Codex panel without reloading VS Code.", - "version": "0.1.3", + "version": "0.2.0", "publisher": "russeldanielpaul", "private": true, "license": "MIT", @@ -16,7 +16,7 @@ "url": "https://github.com/wrestle-R/multi-codex.git", "directory": "extension" }, - "homepage": "https://github.com/wrestle-R/multi-codex/tree/main/extension", + "homepage": "https://multi-codex.vercel.app/docs/extension", "bugs": "https://github.com/wrestle-R/multi-codex/issues", "icon": "resources/icon.png", "keywords": [ @@ -84,7 +84,7 @@ }, { "command": "multiCodex.refreshUsage", - "title": "Check Usage", + "title": "Check All Accounts\u2019 Usage", "category": "Multi Codex", "icon": "$(dashboard)" }, @@ -184,11 +184,12 @@ "build": "tsc --noEmit && node scripts/build.mjs", "build:helper": "node scripts/build-helper.mjs", "typecheck": "tsc --noEmit", - "test": "npm run build && node --test tests/*.test.mjs", + "test": "npm run build && node --test --test-reporter=tap --test-timeout=120000 tests/*.test.mjs", "test:engine": "node scripts/probe-engine.mjs", "test:vscode": "npm run build && node scripts/test-vscode.mjs", "package": "npm run build && vsce package", - "test:attachment": "npm run build && MULTI_CODEX_TEST_LIVE_ATTACH=1 node scripts/test-vscode.mjs" + "test:attachment": "npm run build && MULTI_CODEX_TEST_LIVE_ATTACH=1 node scripts/test-vscode.mjs", + "package:platform": "npm run build && node scripts/package-platform.mjs" }, "devDependencies": { "@types/node": "^22.19.0", diff --git a/extension/scripts/build-helper.mjs b/extension/scripts/build-helper.mjs index e4f1170d..7764bf65 100644 --- a/extension/scripts/build-helper.mjs +++ b/extension/scripts/build-helper.mjs @@ -1,12 +1,14 @@ import { execFileSync } from 'node:child_process'; import { mkdirSync, copyFileSync, chmodSync, renameSync } from 'node:fs'; import { resolve } from 'node:path'; -if (!['linux', 'darwin'].includes(process.platform)) throw new Error('The native account helper currently supports Linux and macOS.'); +if (!['linux', 'darwin', 'win32'].includes(process.platform)) throw new Error('The native account helper supports Linux, macOS and native Windows x64.'); execFileSync('cargo', ['build', '--locked', '--release', '--bin', 'multi-codex-account-helper'], { cwd: resolve('../tauri/src-tauri'), stdio: 'inherit' }); mkdirSync('bin', { recursive: true }); -const temporary = resolve(`bin/multi-codex-account-helper.${process.pid}`); -copyFileSync(resolve('../tauri/src-tauri/target/release/multi-codex-account-helper'), temporary); -execFileSync('strip', [temporary]); chmodSync(temporary, 0o700); renameSync(temporary, resolve('bin/multi-codex-account-helper')); +const name = process.platform === 'win32' ? 'multi-codex-account-helper.exe' : 'multi-codex-account-helper'; +const temporary = resolve(`bin/${name}.${process.pid}`); +copyFileSync(resolve('../tauri/src-tauri/target/release', name), temporary); +if (process.platform !== 'win32') { execFileSync('strip', [temporary]); chmodSync(temporary, 0o700); } +renameSync(temporary, resolve('bin', name)); // Stripping changes a Mach-O executable. Restore its ad-hoc signature so the // packaged Apple Silicon helper is accepted by macOS executable verification. if (process.platform === 'darwin') { diff --git a/extension/scripts/build.mjs b/extension/scripts/build.mjs index 16777159..6adf8159 100644 --- a/extension/scripts/build.mjs +++ b/extension/scripts/build.mjs @@ -1,4 +1,6 @@ import { build } from 'esbuild'; +import { readFileSync } from 'node:fs'; +const version = JSON.parse(readFileSync('package.json', 'utf8')).version; await build({ entryPoints: ['src/extension.ts', 'src/bridge-main.ts', 'src/core.ts', 'src/vscode-tests.ts'], outdir: 'dist', outExtension: { '.js': '.cjs' }, bundle: true, platform: 'node', target: 'node20', - format: 'cjs', external: ['vscode'], sourcemap: true }); + define: { __MULTI_CODEX_VERSION__: JSON.stringify(version) }, format: 'cjs', external: ['vscode'], sourcemap: true }); diff --git a/extension/scripts/cleanup-fixture.mjs b/extension/scripts/cleanup-fixture.mjs index 11b00955..3c261e14 100644 --- a/extension/scripts/cleanup-fixture.mjs +++ b/extension/scripts/cleanup-fixture.mjs @@ -1,11 +1,14 @@ import { readdir, readFile, rm } from 'node:fs/promises'; -import { dirname, join } from 'node:path'; +import { basename, dirname, join } from 'node:path'; import { tmpdir } from 'node:os'; import { createRequire } from 'node:module'; +import { execFile } from 'node:child_process'; +import { promisify } from 'node:util'; +const exec = promisify(execFile); const { AccountClient } = createRequire(import.meta.url)('../dist/core.cjs'); export async function cleanupFixture(root, engine, helper) { - if (dirname(root) !== tmpdir() || !root.split('/').at(-1).startsWith('multi-codex-vscode-')) throw new Error('Refusing to clean an unrelated directory'); + if (dirname(root) !== tmpdir() || !basename(root).startsWith('multi-codex-vscode-')) throw new Error('Refusing to clean an unrelated directory'); const profiles = JSON.parse(await readFile(join(root, 'data', 'profiles.json'), 'utf8').catch(() => '[]')); for (const profile of profiles) { const auth = JSON.parse(await readFile(join(root, 'data', 'profiles', profile.id, 'codex-home', 'auth.json'), 'utf8')); @@ -31,17 +34,33 @@ export async function cleanupFixture(root, engine, helper) { try { process.kill(Number(name), 'SIGTERM'); } catch {} } } + // macOS has no /proc. Electron/backend plugin workers can outlive the + // editor; inspect only this user's processes and require the exact private + // fixture CODEX_HOME before sending a signal. Never bypass account guards. + if (process.platform === 'darwin') { + const { stdout } = await exec('/bin/ps', ['-E', '-ww', '-U', String(process.getuid()), '-o', 'pid=,command='], { maxBuffer: 16 * 1024 * 1024 }); + for (const line of stdout.split('\n')) { + if (!line.includes(` CODEX_HOME=${root}/`)) continue; + const pid = Number(line.match(/^\s*(\d+)\s/)?.[1]); + if (!Number.isInteger(pid) || pid <= 0 || pid === process.pid) continue; + try { process.kill(pid, 'SIGTERM'); } catch {} + } + } const client = new AccountClient(helper, engine, join(root, 'data'), join(root, 'global-home')); try { for (const profile of profiles) { let deleted = false; let lastError; - for (let attempt = 0; attempt < 20; attempt++) { + const deadline = Date.now() + 20000; + while (Date.now() < deadline) { try { await client.request('accounts/delete', { id: profile.id }); deleted = true; break; } - catch (error) { lastError = error; await new Promise(resolve => setTimeout(resolve, 50)); } + catch (error) { + if (!/Close this profile's app window before deleting it/.test(error.message)) throw error; + lastError = error; await new Promise(resolve => setTimeout(resolve, 200)); + } } if (!deleted) throw lastError; } - } finally { client.dispose(); } + } finally { await client.dispose(); } await rm(root, { recursive: true, force: true, maxRetries: 30, retryDelay: 100 }); } diff --git a/extension/scripts/package-platform.mjs b/extension/scripts/package-platform.mjs new file mode 100644 index 00000000..d13aa244 --- /dev/null +++ b/extension/scripts/package-platform.mjs @@ -0,0 +1,9 @@ +import { execFileSync } from 'node:child_process'; +import { readFileSync } from 'node:fs'; +import { createRequire } from 'node:module'; +import { dirname, resolve } from 'node:path'; +const require = createRequire(import.meta.url); +const { name, version } = JSON.parse(readFileSync('package.json', 'utf8')); +const target = process.argv[2] || `${process.platform === 'win32' ? 'win32' : process.platform}-${process.arch}`; +if (!['linux-x64', 'darwin-arm64', 'darwin-x64', 'win32-x64'].includes(target)) throw new Error(`Unsupported package target ${target}`); +execFileSync(process.execPath, [resolve(dirname(require.resolve('@vscode/vsce/package.json')), 'vsce'), 'package', '--target', target, '--pre-release', '--out', `${name}-${target}-${version}.vsix`], { stdio: 'inherit' }); diff --git a/extension/scripts/probe-engine.mjs b/extension/scripts/probe-engine.mjs index 81324e01..706e13e1 100644 --- a/extension/scripts/probe-engine.mjs +++ b/extension/scripts/probe-engine.mjs @@ -31,7 +31,7 @@ function request(method, params = {}) { }); } try { - await request('initialize', { clientInfo: { name: 'multi_codex_probe', version: '0.1.0' }, capabilities: { experimentalApi: true } }); + await request('initialize', { clientInfo: { name: 'multi_codex_probe', version: JSON.parse(await readFile(new URL('../package.json', import.meta.url), 'utf8')).version }, capabilities: { experimentalApi: true } }); child.stdin.write(JSON.stringify({ method: 'initialized' }) + '\n'); let profiles = [syntheticAuth('synthetic-account-a'), syntheticAuth('synthetic-account-b')]; if (live) { diff --git a/extension/scripts/test-vscode.mjs b/extension/scripts/test-vscode.mjs index fe16fa5c..7a9ade1b 100644 --- a/extension/scripts/test-vscode.mjs +++ b/extension/scripts/test-vscode.mjs @@ -1,5 +1,5 @@ import { spawn, execFileSync } from 'node:child_process'; -import { mkdir, mkdtemp, writeFile, readFile, readdir, symlink, stat, access, rm, rename } from 'node:fs/promises'; +import { mkdir, mkdtemp, writeFile, readFile, readdir, symlink, cp, stat, access, rm, rename } from 'node:fs/promises'; import { tmpdir, homedir } from 'node:os'; import { join, resolve } from 'node:path'; import { randomUUID } from 'node:crypto'; @@ -9,7 +9,7 @@ import { chromium } from 'playwright-core'; import { inspectWebview } from './webview-inspector.mjs'; import { cleanupFixture } from './cleanup-fixture.mjs'; import { createRequire } from 'node:module'; -const { bundledEnginePath } = createRequire(import.meta.url)('../dist/core.cjs'); +const { bundledEnginePath, helperName, wrapperName } = createRequire(import.meta.url)('../dist/core.cjs'); async function discoverExtension() { if (process.env.MULTI_CODEX_TEST_EXTENSION) return process.env.MULTI_CODEX_TEST_EXTENSION; @@ -37,15 +37,19 @@ const portProbe = createServer(); await new Promise(resolve => portProbe.listen( const debugPort = portProbe.address().port; await new Promise(resolve => portProbe.close(resolve)); const testRoot = await mkdtemp(join(tmpdir(), 'multi-codex-vscode-')); const fixture = await localService({ port: 8000 }); -const storage = join(testRoot, 'data'); const globalHome = join(testRoot, 'global-home'); const runtimeRoot = join(testRoot, 'runtime'); +const storage = join(testRoot, 'data'); const globalHome = join(testRoot, 'global-home'); +const ownStorage = join(testRoot, 'user-data', 'User', 'globalStorage', extensionId); +// The native Windows helper rejects junctions at its private runtime boundary. +// Exercise the actual VS Code storage directory rather than a fixture alias. +const runtimeRoot = process.platform === 'win32' ? join(ownStorage, 'runtime') : join(testRoot, 'runtime'); await mkdir(join(testRoot, 'workspace'), { recursive: true }); await mkdir(join(testRoot, 'user-data', 'User'), { recursive: true }); await mkdir(join(testRoot, 'extensions')); // Only the disposable copy gets a fetch shim. Every official-extension HTTP call stays local. const testExtension = join(testRoot, 'extensions', `openai.chatgpt-${packageInfo.version}`); await mkdir(testExtension); -for (const entry of await readdir(extension)) if (entry !== 'out') await symlink(join(extension, entry), join(testExtension, entry)); +for (const entry of await readdir(extension)) if (entry !== 'out') { if (process.platform === 'win32') await cp(join(extension, entry), join(testExtension, entry), { recursive: true }); else await symlink(join(extension, entry), join(testExtension, entry)); } await mkdir(join(testExtension, 'out')); -for (const entry of await readdir(join(extension, 'out'))) if (entry !== 'extension.js') await symlink(join(extension, 'out', entry), join(testExtension, 'out', entry)); +for (const entry of await readdir(join(extension, 'out'))) if (entry !== 'extension.js') { if (process.platform === 'win32') await cp(join(extension, 'out', entry), join(testExtension, 'out', entry), { recursive: true }); else await symlink(join(extension, 'out', entry), join(testExtension, 'out', entry)); } const fetchShim = `const multiCodexOriginalFetch = globalThis.fetch; globalThis.fetch = (input, options) => { const url = new URL(typeof input === 'string' ? input : input.url ?? input.toString()); if (url.protocol === 'http:' || url.protocol === 'https:') return multiCodexOriginalFetch(${JSON.stringify(fixture.origin)} + url.pathname + url.search, options); return multiCodexOriginalFetch(input, options); };\n`; const preparedUser = `\nconst multiCodexActivate = module.exports.activate; module.exports = { ...module.exports, activate: async (context, ...args) => { for (const key of ['viewed2025-09-15-nux', 'viewed2025-09-15-full-chatgpt-auth-nux', 'viewed2025-09-15-apikey-auth-nux']) await context.globalState.update(key, true); return multiCodexActivate(context, ...args); } };\n`; await writeFile(join(testExtension, 'out', 'extension.js'), fetchShim + await readFile(join(extension, 'out', 'extension.js'), 'utf8') + preparedUser); @@ -64,13 +68,14 @@ await writeFile(join(storage, 'profiles.json'), JSON.stringify(profiles), { mode // the extension host inherits a managed account's CODEX_HOME. // Exercise a visible initial storage error and repair it from the test extension. await writeFile(join(storage, 'executables.json'), 'incomplete desktop settings', { mode: 0o600 }); -await mkdir(runtimeRoot); +await mkdir(runtimeRoot, { recursive: true }); const bundledEngine = await bundledEnginePath(extension); -const configPath = join(runtimeRoot, 'bridge-config.json'); -await writeFile(configPath, JSON.stringify({ engine: bundledEngine, helper: join(developmentPath, 'bin/multi-codex-account-helper'), dataRoot: storage, globalHome, runtimeRoot }), { mode: 0o600 }); -const wrapper = join(runtimeRoot, 'codex-bridge'); +const configPath = join(runtimeRoot, process.platform === 'win32' ? 'codex-bridge.json' : 'bridge-config.json'); +await writeFile(configPath, JSON.stringify({ engine: bundledEngine, helper: join(developmentPath, 'bin', helperName), dataRoot: storage, globalHome, runtimeRoot, nodeExecutable: code, bridgeScript: join(developmentPath, 'dist/bridge-main.cjs') }), { mode: 0o600 }); +const wrapper = join(runtimeRoot, wrapperName); const quote = value => `'${value.replace(/'/g, `'"'"'`)}'`; -await writeFile(wrapper, `#!/bin/sh\nexport ELECTRON_RUN_AS_NODE=1\nexec ${quote(code)} ${quote(join(developmentPath, 'dist/bridge-main.cjs'))} --bridge-config ${quote(configPath)} "$@"\n`, { mode: 0o700 }); +if (process.platform === 'win32') await cp(join(developmentPath, 'bin', helperName), wrapper); +else await writeFile(wrapper, `#!/bin/sh\nexport ELECTRON_RUN_AS_NODE=1\nexec ${quote(code)} ${quote(join(developmentPath, 'dist/bridge-main.cjs'))} --bridge-config ${quote(configPath)} "$@"\n`, { mode: 0o700 }); await writeFile(join(testRoot, 'user-data', 'User', 'settings.json'), JSON.stringify({ 'multiCodex.dataDirectory': storage, ...(!liveAttach ? { 'chatgpt.cliExecutable': wrapper } : {}), 'chatgpt.openOnStartup': true, @@ -79,8 +84,8 @@ await writeFile(join(testRoot, 'user-data', 'User', 'settings.json'), JSON.strin 'extensions.autoCheckUpdates': false, 'workbench.startupEditor': 'none', })); // The extension's storage root is fixed by VS Code; point discovery at the same fixture runtime. -const ownStorage = join(testRoot, 'user-data', 'User', 'globalStorage', extensionId); -await mkdir(ownStorage, { recursive: true }); await symlink(runtimeRoot, join(ownStorage, 'runtime')); +await mkdir(ownStorage, { recursive: true }); +if (process.platform !== 'win32') await symlink(runtimeRoot, join(ownStorage, 'runtime'), 'dir'); const env = Object.fromEntries(Object.entries(process.env).filter(([key]) => !key.startsWith('CODEX_') && !key.startsWith('OPENAI_'))); delete env.ELECTRON_RUN_AS_NODE; delete env.VSCODE_IPC_HOOK_CLI; delete env.VSCODE_PID; const child = spawn(code, ['--user-data-dir', join(testRoot, 'user-data'), '--extensions-dir', join(testRoot, 'extensions'), @@ -126,13 +131,19 @@ const uiPolling = setInterval(async () => { if (await page.getByText('Enable switching', { exact: true }).count() || await page.getByText('Add an account', { exact: true }).count()) throw new Error('Large welcome buttons are still present'); } await page.screenshot({ path: `.test-results/panel-${phase.label.replace(/[^a-zA-Z0-9-]/g, '-')}.png` }); - uiPhases.push({ label: phase.label, frames }); - await writeFile('.test-results/panel-observations.json', JSON.stringify(uiPhases, null, 2)); + const observation = { label: phase.label, frames }; + await writeFile('.test-results/panel-observations.json', JSON.stringify([...uiPhases, observation], null, 2)); // Publish a complete acknowledgement: the extension host polls this file // concurrently, and reading a partially written JSON file is a test race. await writeFile(join(testRoot, 'ui-ack.tmp'), JSON.stringify({ label: phase.label })); await rename(join(testRoot, 'ui-ack.tmp'), join(testRoot, 'ui-ack.json')); - } catch { /* Renderer may still be starting; retry before the integration timeout. */ } + // Mark complete only after publication succeeds. Windows can briefly hold + // the old acknowledgement open; a failed replacement must remain retryable. + uiPhases.push(observation); + } catch (error) { + await writeFile('.test-results/ui-inspector-last-error.json', JSON.stringify({ message: error.message, code: error.code })).catch(() => {}); + /* Renderer or an acknowledgement file may still be busy; retry. */ + } finally { uiBusy = false; } }, 100); console.log(`Testing Codex ${packageInfo.version} in ${testRoot}`); @@ -165,6 +176,6 @@ try { process.exitCode = 1; } finally { await fixture.close(); - if (process.exitCode !== 1) await cleanupFixture(testRoot, bundledEngine, join(developmentPath, 'bin/multi-codex-account-helper')); + if (process.exitCode !== 1) await cleanupFixture(testRoot, bundledEngine, join(developmentPath, 'bin', helperName)); else console.error(`Failure artifacts retained in ${testRoot}`); } diff --git a/extension/src/accounts.ts b/extension/src/accounts.ts index f0834e56..48614417 100644 --- a/extension/src/accounts.ts +++ b/extension/src/accounts.ts @@ -1,4 +1,5 @@ import { spawn, type ChildProcessWithoutNullStreams } from 'node:child_process'; +import { spawnExecutable, terminateExecutable } from './native'; import { JsonLines, RpcPeer } from './protocol'; import type { StoredAuth } from './auth'; @@ -9,7 +10,7 @@ export class AccountClient { private closed = false; get isRunning() { return !this.closed; } constructor(helper: string, engine: string, dataRoot: string, globalHome: string) { - this.child = spawn(helper, [engine, dataRoot, globalHome], { stdio: ['pipe', 'pipe', 'pipe'] }); + this.child = spawnExecutable(helper, [engine, dataRoot, globalHome]); this.child.stderr.resume(); this.peer = new RpcPeer(new JsonLines(this.child.stdout, this.child.stdin), 'account-helper:'); const close = () => { this.closed = true; this.peer.close(); }; @@ -25,5 +26,6 @@ export class AccountClient { await this.request('accounts/lockCredential', { id }); try { return await action(); } finally { await this.request('accounts/unlockCredential', { id }).catch(() => {}); } } - dispose() { this.closed = true; this.peer.close(); this.child.stdin.end(); this.child.kill(); } + private disposal?: Promise; + dispose() { return this.disposal ??= (async () => { this.closed = true; this.peer.close(); this.child.stdin.end(); await terminateExecutable(this.child); })(); } } diff --git a/extension/src/bridge-main.ts b/extension/src/bridge-main.ts index 88bc1971..737d0f59 100644 --- a/extension/src/bridge-main.ts +++ b/extension/src/bridge-main.ts @@ -1,3 +1,4 @@ +import { controlEndpoint } from './native'; import { readFile, mkdir, writeFile } from 'node:fs/promises'; import { join } from 'node:path'; import { tmpdir } from 'node:os'; @@ -19,13 +20,13 @@ async function main() { engine, sourceHome, sessionHome: join(base.runtimeRoot, 'windows', sessionId), workspace: process.cwd(), historyHome, - socket: join(tmpdir(), `mc-${process.getuid?.() ?? 'user'}-${sessionId.slice(0, 12)}.sock`), token: randomBytes(32).toString('hex'), + socket: controlEndpoint(sessionId), token: randomBytes(32).toString('hex'), }; await prepareSessionHome(sourceHome, config.sessionHome); const bridge = new CodexBridge(config, new JsonLines(process.stdin, process.stdout), args); await bridge.listen(); await mkdir(join(base.runtimeRoot, 'connections'), { recursive: true, mode: 0o700 }); - await writeFile(join(base.runtimeRoot, 'connections', `${process.ppid}.json`), JSON.stringify({ socket: config.socket, token: config.token }), { mode: 0o600 }); + await writeFile(join(base.runtimeRoot, 'connections', `${process.env.MULTI_CODEX_HOST_PID || process.ppid}.json`), JSON.stringify({ socket: config.socket, token: config.token }), { mode: 0o600 }); await writeFile(join(config.sessionHome, 'backend.json'), JSON.stringify({ pid: bridge.backend.pid, bridgePid: process.pid }), { mode: 0o600 }); process.on('SIGTERM', () => void bridge.dispose().finally(() => process.exit(0))); process.on('SIGINT', () => void bridge.dispose().finally(() => process.exit(0))); diff --git a/extension/src/bridge.ts b/extension/src/bridge.ts index 01535673..776530ed 100644 --- a/extension/src/bridge.ts +++ b/extension/src/bridge.ts @@ -1,5 +1,6 @@ import { spawn, type ChildProcessWithoutNullStreams } from 'node:child_process'; import { createServer, type Server, type Socket } from 'node:net'; +import { spawnExecutable, terminateExecutable } from './native'; import { chmod, mkdir, readFile, rm } from 'node:fs/promises'; import { join } from 'node:path'; import { randomUUID, timingSafeEqual } from 'node:crypto'; @@ -24,6 +25,7 @@ export class CodexBridge { private accounts: AccountClient; private initializeId: string | number | undefined; private connectionFailed = false; + private connectionFailure: string | null = null; private authenticationUnverified = false; private disposed = false; private blockedWorkDuringSwitch = false; @@ -31,7 +33,7 @@ export class CodexBridge { constructor(readonly config: BridgeConfig, readonly frontend: JsonLines, args: string[], private existing?: ExistingBackend) { const env: NodeJS.ProcessEnv = { ...process.env, CODEX_HOME: config.sessionHome, CODEX_SQLITE_HOME: config.historyHome ?? config.sessionHome }; delete env.OPENAI_API_KEY; delete env.CODEX_API_KEY; delete env.ELECTRON_RUN_AS_NODE; - this.backend = existing?.child ?? spawn(config.engine, args, { env, cwd: config.workspace, stdio: ['pipe', 'pipe', 'pipe'] }); + this.backend = existing?.child ?? spawnExecutable(config.engine, args, { env, cwd: config.workspace, stdio: ['pipe', 'pipe', 'pipe'] }); // Codex diagnostics can contain workspace and account data. Never mirror them into VS Code logs. if (!existing) this.backend.stderr.resume(); this.backendLines = existing?.lines ?? new JsonLines(this.backend.stdout, this.backend.stdin); @@ -39,15 +41,23 @@ export class CodexBridge { this.accounts = new AccountClient(config.helper, config.engine, config.dataRoot, config.globalHome); frontend.on('message', (message: Message) => this.fromFrontend(message)); frontend.on('end', () => void this.dispose()); - frontend.on('fault', () => this.fail()); + frontend.on('fault', () => this.fail('frontend-protocol')); this.backendLines.on('message', (message: Message) => this.fromBackend(message)); - this.backendLines.on('fault', () => this.fail()); - this.backend.on('error', () => this.fail()); this.backend.on('exit', () => this.fail()); + this.backendLines.on('fault', () => this.fail('backend-protocol')); + this.backendLines.on('end', () => this.fail('backend-output-closed')); + this.backend.on('error', () => this.fail('backend-start-failed')); this.backend.on('exit', () => this.fail('backend-exited')); } async attachReady() { if (!this.existing) throw new Error('No existing backend'); // Read the current identity for rollback before allowing any mutation. - this.selectedAuth = await this.currentAuth(); + const deadline = Date.now() + 10000; + for (;;) { + try { this.selectedAuth = await this.currentAuth(); break; } + catch (error) { + if (Date.now() >= deadline || this.connectionFailed || !(error instanceof Error) || !/not initialized/i.test(error.message)) throw error; + await new Promise(resolve => setTimeout(resolve, 100)); + } + } if (this.selectedAuth?.OPENAI_API_KEY) { throw new Error('Live attachment requires a ChatGPT login. API-key switching uses the isolated bridge on the next Codex startup.'); } @@ -78,7 +88,7 @@ export class CodexBridge { await mkdir(this.config.sessionHome, { recursive: true, mode: 0o700 }); this.server = createServer(socket => this.accept(socket)); await new Promise((resolve, reject) => { this.server!.once('error', reject); this.server!.listen(this.config.socket, resolve); }); - await chmod(this.config.socket, 0o600); + if (process.platform !== 'win32') await chmod(this.config.socket, 0o600); } private accept(socket: Socket) { const lines = new JsonLines(socket, socket, 2 * 1024 * 1024); let authorized = false; @@ -141,7 +151,7 @@ export class CodexBridge { } catch { this.backendLines.send({ id, error: { code: -32000, message: 'The saved account needs fresh credentials. Sign in again in Multi Codex.' } }); } finally { this.credentialRequests.delete(id); this.activity.pendingApprovals.delete(id); this.broadcast(); } } - state() { return { ...this.activity.snapshot(), selectedId: this.selectedId, sourceHome: this.config.sourceHome ?? this.config.globalHome, bridgePid: process.pid, backendPid: this.backend.pid, instanceId: this.instanceId, connectionFailed: this.connectionFailed, authenticationUnverified: this.authenticationUnverified }; } + state() { return { ...this.activity.snapshot(), ...(this.connectionFailed ? { canSwitch: false, reason: this.connectionFailure?.includes('protocol') ? 'Codex protocol connection could no longer be verified. Save your work and reopen Codex, then retry.' : 'Codex backend disconnected. Save your work and reopen Codex, then retry.' } : {}), selectedId: this.selectedId, sourceHome: this.config.sourceHome ?? this.config.globalHome, bridgePid: process.pid, backendPid: this.backend.pid, instanceId: this.instanceId, connectionFailed: this.connectionFailed, connectionFailure: this.connectionFailure, authenticationUnverified: this.authenticationUnverified }; } private broadcast() { for (const client of this.clients.keys()) client.send({ method: 'state/changed', params: this.state() }); } async switchAccount(id: string) { if (typeof id !== 'string' || !id) throw new Error('Select a saved account'); @@ -221,6 +231,15 @@ export class CodexBridge { default: throw new Error('Unknown bridge request'); } } - private fail() { this.connectionFailed = true; this.activity.ready = false; this.backendRpc.close(); this.broadcast(); } - async dispose() { if (this.disposed) return; this.disposed = true; this.fail(); this.accounts.dispose(); if (this.existing) this.existing.restore(); else this.backend.kill(); for (const [client, socket] of this.clients) { client.send({ method: 'disconnected' }); socket.end(); socket.destroy(); } this.server?.close(); await rm(this.config.socket, { force: true }); } + private fail(reason: string) { if (this.connectionFailed) return; this.connectionFailure = reason; this.connectionFailed = true; this.activity.ready = false; this.backendRpc.close(); this.broadcast(); } + private disposal?: Promise; + dispose() { return this.disposal ??= (async () => { + this.disposed = true; this.fail('bridge-disposed'); + for (const [client, socket] of this.clients) { client.send({ method: 'disconnected' }); socket.end(); socket.destroy(); } + const serverClosed = this.server ? new Promise(resolve => this.server!.close(() => resolve())) : Promise.resolve(); + if (this.existing) this.existing.restore(); + await Promise.all([this.accounts.dispose(), this.existing ? Promise.resolve() : terminateExecutable(this.backend), serverClosed]); + if (process.platform !== 'win32') await rm(this.config.socket, { force: true }); + })(); } + } diff --git a/extension/src/connection.ts b/extension/src/connection.ts new file mode 100644 index 00000000..ac4569b1 --- /dev/null +++ b/extension/src/connection.ts @@ -0,0 +1,12 @@ +export async function waitForReady( + read: () => Promise, timeoutMs = 15000, +): Promise { + const deadline = Date.now() + timeoutMs; + for (;;) { + const state = await read(); + if (state.connectionFailed) throw new Error(state.reason || 'Codex backend disconnected. Save your work and reopen Codex, then retry.'); + if (state.ready) return state; + if (Date.now() >= deadline) throw new Error('Codex did not finish connecting. Open its panel, wait for startup to finish, then retry.'); + await new Promise(resolve => setTimeout(resolve, Math.min(100, Math.max(1, deadline - Date.now())))); + } +} diff --git a/extension/src/core.ts b/extension/src/core.ts index 368ecfe3..f53004e7 100644 --- a/extension/src/core.ts +++ b/extension/src/core.ts @@ -8,3 +8,7 @@ export * from './stdio-tap'; export * from './platform'; export * from './storage'; export * from './startup'; + +export * from './native'; +export * from './usage'; +export * from './connection'; diff --git a/extension/src/extension.ts b/extension/src/extension.ts index 9bb958e6..88554cda 100644 --- a/extension/src/extension.ts +++ b/extension/src/extension.ts @@ -1,9 +1,12 @@ import * as vscode from 'vscode'; import { randomBytes, randomUUID } from 'node:crypto'; -import { access, mkdir, readFile, rename, rm, writeFile } from 'node:fs/promises'; +import { access, copyFile, mkdir, readFile, rename, rm, writeFile } from 'node:fs/promises'; import { join } from 'node:path'; import { homedir, tmpdir } from 'node:os'; -import { spawn } from 'node:child_process'; +import { execFile } from 'node:child_process'; +import { promisify } from 'node:util'; +import { controlEndpoint, helperName, wrapperName, spawnExecutable, terminateExecutable } from './native'; +import { usageSummary, refreshAllAccounts } from './usage'; import { AccountClient, type Account } from './accounts'; import { BridgeClient } from './client'; import { JsonLines, RpcPeer } from './protocol'; @@ -12,6 +15,8 @@ import { CodexBridge } from './bridge'; import { findCodexBackend, tapBackend } from './stdio-tap'; import { bundledEnginePath } from './platform'; import { resolveAccountPaths } from './storage'; +import { extensionVersion } from './version'; +import { waitForReady } from './connection'; function quote(value: string) { return `'${value.replace(/'/g, `'"'"'`)}'`; } class AccountsTree implements vscode.TreeDataProvider { @@ -20,16 +25,21 @@ class AccountsTree implements vscode.TreeDataProvider { accounts: Account[] = []; state: any = null; usage = new Map(); + checkedAt = new Map(); + checking = new Set(); refresh() { this.emitter.fire(); } getChildren() { return this.accounts; } getTreeItem(account: Account) { const item = new vscode.TreeItem(account.name); item.id = account.id; const active = this.state?.selectedId === account.id; - item.description = [active ? 'Active' : account.accountTier ?? account.authMode, this.usage.get(account.id)].filter(Boolean).join(' · '); + item.description = [active ? `Active · ${account.accountTier ?? account.authMode}` : account.accountTier ?? account.authMode, this.checking.has(account.id) ? 'Checking usage…' : this.usage.get(account.id)].filter(Boolean).join(' · '); item.tooltip = [account.name, account.accountTier ?? account.authMode, active ? 'Currently used by Codex' : 'Click to use this account in the current Codex window', this.usage.get(account.id), account.notes].filter(Boolean).join('\n'); item.contextValue = 'multiCodexAccount'; - item.iconPath = new vscode.ThemeIcon(active ? 'check' : 'account'); + item.iconPath = new vscode.ThemeIcon(this.checking.has(account.id) ? 'sync~spin' : active ? 'pass-filled' : account.error ? 'warning' : 'account', active ? new vscode.ThemeColor('testing.iconPassed') : undefined); + const checked = this.checkedAt.get(account.id); + if (checked) item.tooltip += `\nChecked ${new Date(checked).toLocaleTimeString()}`; + if (account.error) item.tooltip += `\n${account.error}`; item.command = { command: 'multiCodex.switchAccount', title: 'Switch account', arguments: [account] }; return item; } @@ -45,8 +55,10 @@ export async function activate(context: vscode.ExtensionContext) { context.subscriptions.push(status, view); let accounts: AccountClient | undefined; let bridge: BridgeClient | undefined; let runtimeRoot = ''; let engine = ''; let helper = ''; let root = ''; let globalHome = ''; - let monitor: NodeJS.Timeout | undefined; let connecting = false; let accountsRefreshing = false; + let monitor: NodeJS.Timeout | undefined; let connectionPending: Promise | undefined; let connectedSocket = ''; let accountsRefreshing = false; let usage: any = null; let usageAt = 0; + let refreshingUsage: Promise | undefined; + const usageOperations = new Map>(); let setupPending: Promise | undefined; let preparePending: Promise | undefined; let storageError = ''; function display() { @@ -59,7 +71,7 @@ export async function activate(context: vscode.ExtensionContext) { : !tree.accounts.length ? 'No saved accounts yet. Use + above to sign in or import an account.' : setupPending ? 'Connecting to Codex…' : state?.switching ? 'Switching account…' - : state?.ready && !state.canSwitch ? state.reason + : state?.connectionFailed || state?.ready && !state.canSwitch ? state.reason : undefined; status.text = setupPending ? '$(sync~spin) Connecting Codex…' : state?.switching ? '$(sync~spin) Switching Codex…' : account ? `$(account) ${account.name}` : state?.ready ? '$(account) Codex · Current home' : '$(account) Multi Codex'; status.tooltip = storageError || (!bridge ? 'Choose an account to connect to Codex automatically' : state?.reason ?? (account ? `Codex is using ${account.name}` : `Codex started from ${state?.sourceHome ?? globalHome}\nChoose an account to change this window’s login`)); @@ -73,16 +85,23 @@ export async function activate(context: vscode.ExtensionContext) { finally { accountsRefreshing = false; } } async function connect() { - if (!runtimeRoot || bridge || connecting) return; connecting = true; + if (!runtimeRoot || bridge && !bridge.state?.connectionFailed) return; + if (connectionPending) return connectionPending; + connectionPending = discoverConnection(); + try { await connectionPending; } finally { connectionPending = undefined; } + } + async function discoverConnection() { try { const registration = JSON.parse(await readFile(join(runtimeRoot, 'connections', `${process.pid}.json`), 'utf8')); + if (bridge && registration.socket === connectedSocket) return; + bridge?.dispose(); bridge = undefined; bridge = await BridgeClient.connect(registration.socket, registration.token); + connectedSocket = registration.socket; const thisBridge = bridge; thisBridge.on('state', () => display()); thisBridge.on('close', () => { if (bridge === thisBridge) { bridge = undefined; display(); } }); display(); } catch { /* Discovery is expected to fail until the backend starts through the bridge. */ } - finally { connecting = false; } } async function prepare() { if (preparePending) return preparePending; @@ -100,15 +119,16 @@ export async function activate(context: vscode.ExtensionContext) { root = paths.dataRoot; globalHome = paths.globalHome; engine = await bundledEnginePath(codex.extensionPath); runtimeRoot = join(context.globalStorageUri.fsPath, 'runtime'); - helper = join(context.extensionPath, 'bin', 'multi-codex-account-helper'); await access(helper); + helper = join(context.extensionPath, 'bin', helperName); await access(helper); await mkdir(root, { recursive: true, mode: 0o700 }); await mkdir(runtimeRoot, { recursive: true, mode: 0o700 }); - accounts?.dispose(); + if (process.platform === 'win32') await promisify(execFile)(helper, ['--protect-directory', runtimeRoot], { windowsHide: true }); + await accounts?.dispose(); accounts = new AccountClient(helper, engine, root, globalHome); // Refresh an existing launcher before another normal Codex startup. Account // discovery's global home must never replace an inherited desktop account home. - if (vscode.workspace.getConfiguration('chatgpt').get('cliExecutable') === join(runtimeRoot, 'codex-bridge')) await writeBridgeLauncher(); + if (vscode.workspace.getConfiguration('chatgpt').get('cliExecutable') === join(runtimeRoot, wrapperName)) await writeBridgeLauncher(); try { await refreshAccounts(); } - catch (error) { accounts.dispose(); accounts = undefined; throw error; } + catch (error) { await accounts.dispose(); accounts = undefined; throw error; } if (monitor) clearInterval(monitor); monitor = setInterval(() => { void connect(); void refreshAccounts().catch(() => {}); }, 1500); context.subscriptions.push({ dispose() { if (monitor) clearInterval(monitor); bridge?.dispose(); accounts?.dispose(); } }); @@ -123,12 +143,22 @@ export async function activate(context: vscode.ExtensionContext) { async function configureBridge() { if (!accounts?.isRunning) await prepare(); const current = vscode.workspace.getConfiguration('chatgpt').get('cliExecutable'); - const wrapper = join(runtimeRoot, 'codex-bridge'); + const wrapper = join(runtimeRoot, wrapperName); if (current && current !== wrapper) throw new Error('Codex already has a custom executable. Restore its bundled executable before enabling Multi Codex.'); await writeBridgeLauncher(); if (current !== wrapper) await context.globalState.update('previousCliExecutable', current ?? null); await vscode.workspace.getConfiguration('chatgpt').update('cliExecutable', wrapper, vscode.ConfigurationTarget.Global); await connect(); + if (!bridge) { + const codex = vscode.extensions.getExtension('openai.chatgpt')!; + if (!codex.isActive) await codex.activate(); + await vscode.commands.executeCommand('chatgpt.openSidebar'); + const deadline = Date.now() + 15000; + while (!bridge && !findCodexBackend(engine) && Date.now() < deadline) { + await new Promise(resolve => setTimeout(resolve, 100)); + await connect(); + } + } if (!bridge) { const child = findCodexBackend(engine); if (child) { @@ -139,7 +169,7 @@ export async function activate(context: vscode.ExtensionContext) { const tap = tapBackend(child); const live = new CodexBridge({ engine, helper, dataRoot: root, globalHome, sessionHome, workspace, sourceHome: process.env.CODEX_HOME || globalHome, attached: true, - socket: join(tmpdir(), `mc-${process.getuid?.() ?? 'user'}-${session.slice(0, 12)}.sock`), token: randomBytes(32).toString('hex') }, tap.frontend, [], tap); + socket: controlEndpoint(session), token: randomBytes(32).toString('hex') }, tap.frontend, [], tap); try { await live.attachReady(); await live.listen(); bridge = await BridgeClient.connect(live.config.socket, live.config.token); @@ -157,15 +187,27 @@ export async function activate(context: vscode.ExtensionContext) { } async function writeBridgeLauncher() { const config = { engine, helper, dataRoot: root, globalHome, startupHome: process.env.CODEX_HOME || globalHome, - officialExtensionPath: vscode.extensions.getExtension('openai.chatgpt')!.extensionPath, runtimeRoot }; - const configPath = join(runtimeRoot, 'bridge-config.json'); + officialExtensionPath: vscode.extensions.getExtension('openai.chatgpt')!.extensionPath, runtimeRoot, nodeExecutable: process.execPath, bridgeScript: join(context.extensionPath, 'dist', 'bridge-main.cjs') }; + const configPath = join(runtimeRoot, process.platform === 'win32' ? 'codex-bridge.json' : 'bridge-config.json'); async function replaceFile(path: string, contents: string, mode: number) { const temporary = `${path}.${randomUUID()}.tmp`; try { await writeFile(temporary, contents, { mode }); await rename(temporary, path); } finally { await rm(temporary, { force: true }); } } await replaceFile(configPath, JSON.stringify(config), 0o600); - const wrapper = join(runtimeRoot, 'codex-bridge'); + const wrapper = join(runtimeRoot, wrapperName); + if (process.platform === 'win32') { + const source = await readFile(helper); + const existing = await readFile(wrapper).catch((error: NodeJS.ErrnoException) => { if (error.code !== 'ENOENT') throw error; return undefined; }); + // An active Windows executable is locked. Reactivation of the same + // extension only refreshes its config, without rewriting its wrapper. + if (existing?.equals(source)) return; + const temporary = `${wrapper}.${randomUUID()}.tmp`; + try { await copyFile(helper, temporary); await rename(temporary, wrapper); } + catch (error) { throw new Error(`Could not update the Codex wrapper. Close Codex windows using Multi Codex and retry. ${error instanceof Error ? error.message : error}`); } + finally { await rm(temporary, { force: true }); } + return; + } await replaceFile(wrapper, `#!/bin/sh\nexport ELECTRON_RUN_AS_NODE=1\nexec ${quote(process.execPath)} ${quote(join(context.extensionPath, 'dist', 'bridge-main.cjs'))} --bridge-config ${quote(configPath)} "$@"\n`, 0o700); } async function switchAccount(accountOrId?: Account | string) { @@ -177,35 +219,51 @@ export async function activate(context: vscode.ExtensionContext) { } await connect(); if (!bridge) await setupBridge(); if (!bridge) throw new Error('Codex could not connect. Open its panel and retry.'); - const state = await bridge.request('state'); + const activeBridge = bridge; + const state = await vscode.window.withProgress({ location: vscode.ProgressLocation.Notification, title: 'Connecting to Codex', cancellable: false }, () => waitForReady(() => activeBridge.request('state'))); if (!state.canSwitch) throw new Error(state.reason); - await vscode.window.withProgress({ location: vscode.ProgressLocation.Notification, title: 'Switching Codex account', cancellable: false }, async () => { await bridge!.request('switch', { id }); }); - bridge.state = await bridge.request('state'); usage = null; usageAt = 0; display(); + if (bridge !== activeBridge) throw new Error('Codex reconnected while preparing the account switch. Retry your selection.'); + await vscode.window.withProgress({ location: vscode.ProgressLocation.Notification, title: 'Switching Codex account', cancellable: false }, async () => { await activeBridge.request('switch', { id }); }); + activeBridge.state = await activeBridge.request('state'); usage = null; usageAt = 0; display(); const selected = tree.accounts.find(account => account.id === id); void vscode.window.showInformationMessage(`Codex is now using ${selected?.name ?? 'the selected account'}. Login verified. This window’s conversations and home resources are preserved.`); } async function refreshUsage() { - if (!accounts?.isRunning) await prepare(); - await connect(); - if (!bridge?.state.selectedId) { - const selected = await vscode.window.showQuickPick(tree.accounts.map(account => ({ label: account.name, description: account.accountTier ?? account.authMode, account })), { title: 'Check account usage' }); - return selected ? checkAccountUsage(selected.account) : undefined; - } - usage = await bridge.request('usage'); usageAt = Date.now(); - const windows = [usage.rateLimits?.primary, usage.rateLimits?.secondary].filter(Boolean); - const text = windows.map((window: any) => `${Math.max(0, 100 - window.usedPercent)}% left (${window.windowDurationMins >= 10080 ? 'weekly' : 'short-term'})`).join(' · '); - status.tooltip = `${status.tooltip}\n${text}\nChecked ${new Date(usageAt).toLocaleTimeString()}`; - tree.usage.set(bridge.state.selectedId, text || 'Usage unavailable'); display(); return usage; + if (refreshingUsage) return refreshingUsage; + refreshingUsage = (async () => { + if (!accounts?.isRunning) await prepare(); + await refreshAccounts(); await connect(); + const saved = [...tree.accounts]; + if (!saved.length) { void vscode.window.showInformationMessage('Add an account to check usage.'); return; } + await vscode.window.withProgress({ location: { viewId: 'multiCodex.accounts' }, title: 'Checking all accounts' }, async progress => { + let finished = 0; let failed = 0; + await refreshAllAccounts(saved, checkAccountUsage, (account, error) => { + finished++; if (error) { failed++; tree.usage.set(account.id, 'Check failed'); } + progress.report({ message: `${finished}/${saved.length} accounts`, increment: 100 / saved.length }); display(); + }); + if (failed) void vscode.window.showWarningMessage(`Checked ${saved.length} accounts. ${failed} could not refresh; use the account’s usage action to retry and see its error.`); + }); + })(); + try { await refreshingUsage; } finally { refreshingUsage = undefined; } + } + function checkAccountUsage(account: Account): Promise { + const existing = usageOperations.get(account.id); if (existing) return existing; + const pending = readAccountUsage(account).finally(() => usageOperations.delete(account.id)); + usageOperations.set(account.id, pending); return pending; } - async function checkAccountUsage(account: Account) { + async function readAccountUsage(account: Account) { if (!accounts?.isRunning) await prepare(); if (!tree.accounts.some(saved => saved.id === account.id)) throw new Error('Account not found'); - const result = bridge?.state.selectedId === account.id ? await bridge.request('usage') - : await accounts!.withCredentialLock(account.id, async () => { await accounts!.credential(account.id); return withAccountBackend(engine, join(root, 'profiles', account.id, 'codex-home'), rpc => rpc.request('account/rateLimits/read')); }); - const windows = [result.rateLimits?.primary, result.rateLimits?.secondary].filter(Boolean); - tree.usage.set(account.id, windows.map((window: any) => `${Math.max(0, 100 - window.usedPercent)}% left (${window.windowDurationMins >= 10080 ? 'weekly' : 'short-term'})`).join(' · ') || 'Usage unavailable'); - display(); return result; + tree.checking.add(account.id); display(); + try { + const result = bridge?.state.selectedId === account.id ? await bridge.request('usage') + : await accounts!.withCredentialLock(account.id, async () => { await accounts!.credential(account.id); return withAccountBackend(engine, join(root, 'profiles', account.id, 'codex-home'), rpc => rpc.request('account/rateLimits/read')); }); + tree.usage.set(account.id, usageSummary(result)); tree.checkedAt.set(account.id, Date.now()); + if (bridge?.state.selectedId === account.id) { usage = result; usageAt = Date.now(); } + return result; + } finally { tree.checking.delete(account.id); display(); } } + async function addAccount() { if (!accounts?.isRunning) await prepare(); const name = await vscode.window.showInputBox({ title: 'Account name', prompt: 'A label for this Codex account', validateInput: value => !value.trim() ? 'Enter an account name' : undefined }); @@ -225,10 +283,10 @@ export async function activate(context: vscode.ExtensionContext) { await writeFile(join(directory, 'config.toml'), 'cli_auth_credentials_store = "file"\n[analytics]\nenabled = false\n', { mode: 0o600 }); const loginEnvironment: NodeJS.ProcessEnv = { ...process.env, CODEX_HOME: directory, CODEX_SQLITE_HOME: directory }; delete loginEnvironment.OPENAI_API_KEY; delete loginEnvironment.CODEX_API_KEY; delete loginEnvironment.ELECTRON_RUN_AS_NODE; - const child = spawn(engine, ['app-server'], { env: loginEnvironment, stdio: ['pipe', 'pipe', 'pipe'] }); + const child = spawnExecutable(engine, ['app-server'], { env: loginEnvironment }); child.stderr.resume(); const lines = new JsonLines(child.stdout, child.stdin); const rpc = new RpcPeer(lines, 'login:'); try { - await rpc.request('initialize', { clientInfo: { name: 'multi_codex_login', version: '0.1.0' } }); lines.send({ method: 'initialized' }); + await rpc.request('initialize', { clientInfo: { name: 'multi_codex_login', version: extensionVersion } }); lines.send({ method: 'initialized' }); await vscode.window.withProgress({ location: vscode.ProgressLocation.Notification, title: 'Finish signing in to Codex in your browser', cancellable: true }, async (_, cancellation) => { const complete: Promise = new Promise((resolve, reject) => { lines.on('message', message => { if (message.method === 'account/login/completed') message.params?.success ? resolve() : reject(new Error('Codex sign-in did not complete')); }); @@ -246,7 +304,7 @@ export async function activate(context: vscode.ExtensionContext) { } finally { if (timeout) clearTimeout(timeout); } const authJson = await readFile(join(directory, 'auth.json'), 'utf8'); await accounts!.request('accounts/add', { name, authJson }); }); - } finally { rpc.close(); child.kill(); const fs = await import('node:fs/promises'); await fs.rm(directory, { recursive: true, force: true }); } + } finally { rpc.close(); await terminateExecutable(child); const fs = await import('node:fs/promises'); await fs.rm(directory, { recursive: true, force: true }); } await refreshAccounts(); } function command(name: string, action: (...args: any[]) => Promise) { @@ -261,13 +319,17 @@ export async function activate(context: vscode.ExtensionContext) { command('multiCodex.addAccount', addAccount); command('multiCodex.renameAccount', async (account: Account) => { const name = await vscode.window.showInputBox({ title: 'Rename account', value: account.name }); if (name) { await accounts!.request('accounts/rename', { id: account.id, name }); await refreshAccounts(); } }); command('multiCodex.removeAccount', async (account: Account) => { if (bridge?.state.selectedId === account.id) throw new Error('Switch away from this account before removing it.'); const answer = await vscode.window.showWarningMessage(`Remove saved account “${account.name}”?`, { modal: true }, 'Remove'); if (answer === 'Remove') { await accounts!.request('accounts/delete', { id: account.id }); await refreshAccounts(); } }); - command('multiCodex.disableSwitching', async () => { const wrapper = join(runtimeRoot, 'codex-bridge'); const settings = vscode.workspace.getConfiguration('chatgpt'); if (settings.get('cliExecutable') === wrapper) await settings.update('cliExecutable', context.globalState.get('previousCliExecutable', null), vscode.ConfigurationTarget.Global); vscode.window.showInformationMessage('The bundled Codex executable will be restored the next time Codex starts.'); }); + command('multiCodex.disableSwitching', async () => { const wrapper = join(runtimeRoot, wrapperName); const settings = vscode.workspace.getConfiguration('chatgpt'); if (settings.get('cliExecutable') === wrapper) await settings.update('cliExecutable', context.globalState.get('previousCliExecutable', null), vscode.ConfigurationTarget.Global); vscode.window.showInformationMessage('The bundled Codex executable will be restored the next time Codex starts.'); }); try { await prepare(); } catch { /* Storage errors are shown inline with a retry action. */ } return { activationId, refreshAccounts, switchAccount, enableSwitching: setupBridge, - async getState() { await connect(); return { activationId, extensionHostPid: process.pid, accounts: tree.accounts, storageError, panelMessage: view.message, bridge: bridge ? await bridge.request('state') : null }; }, + async getState() { await connect(); return { activationId, extensionHostPid: process.pid, accounts: tree.accounts, storageError, panelMessage: view.message, usageSummaries: Object.fromEntries(tree.usage), bridge: bridge ? await bridge.request('state') : null }; }, ...(process.env.MULTI_CODEX_TEST_MODE === '1' ? { - testBackendInfo() { return { pid: findCodexBackend(engine)?.pid, activationId, hostPid: process.pid }; }, + testBackendInfo() { + const children = ((process as any)._getActiveHandles?.() ?? []).filter((handle: any) => typeof handle.spawnfile === 'string') + .map((child: any) => ({ executable: child.spawnfile, appServer: child.spawnargs?.includes('app-server'), alive: child.exitCode === null && !child.killed })); + return { pid: findCodexBackend(engine)?.pid, expectedEngine: engine, children, activationId, hostPid: process.pid }; + }, async testStopAccountHelper() { const child = accounts?.child; if (!child || !accounts?.isRunning) return; diff --git a/extension/src/native.ts b/extension/src/native.ts new file mode 100644 index 00000000..6f3068a5 --- /dev/null +++ b/extension/src/native.ts @@ -0,0 +1,32 @@ +import { spawn, type ChildProcess, type SpawnOptionsWithoutStdio } from 'node:child_process'; +import { join } from 'node:path'; +import { tmpdir } from 'node:os'; +import { createHash } from 'node:crypto'; + +export const helperName = process.platform === 'win32' ? 'multi-codex-account-helper.exe' : 'multi-codex-account-helper'; +export const wrapperName = process.platform === 'win32' ? 'codex-bridge.exe' : 'codex-bridge'; +export function controlEndpoint(id: string, platform = process.platform) { + const shortId = createHash('sha256').update(id).digest('hex').slice(0, 16); + return platform === 'win32' ? `\\\\.\\pipe\\multi-codex-${id}` : join(tmpdir(), `mc-${process.getuid?.() ?? 'user'}-${shortId}.sock`); +} +/** Native production binaries and JavaScript protocol fixtures use identical streams. */ +export function spawnExecutable(binary: string, args: string[], options: SpawnOptionsWithoutStdio = {}) { + return binary.endsWith('.mjs') + ? spawn(process.execPath, [binary, ...args], { ...options, env: { ...(options.env ?? process.env), ELECTRON_RUN_AS_NODE: '1' }, stdio: ['pipe', 'pipe', 'pipe'] }) + : spawn(binary, args, { ...options, windowsHide: true, stdio: ['pipe', 'pipe', 'pipe'] }); +} + +/** Reap the process and close our pipes before removing its private home. */ +export async function terminateExecutable(child: ChildProcess) { + if (child.pid && child.exitCode === null && child.signalCode === null) { + await new Promise(resolve => { + const done = () => { clearTimeout(timeout); child.off('exit', done); child.off('close', done); resolve(); }; + child.once('exit', done); child.once('close', done); + const timeout = setTimeout(() => child.kill('SIGKILL'), 3000); + child.kill(); + }); + } + // Descendants can inherit a pipe after the parent exits. They must not hold + // extension disposal open indefinitely; these streams belong to this client. + child.stdin?.destroy(); child.stdout?.destroy(); child.stderr?.destroy(); +} diff --git a/extension/src/platform.ts b/extension/src/platform.ts index e97f9106..f47e9e3d 100644 --- a/extension/src/platform.ts +++ b/extension/src/platform.ts @@ -30,15 +30,15 @@ export async function startupEnginePath(savedEngine: string, officialExtensionPa /** Resolve only this official extension's native executable, never another installation. */ export async function bundledEnginePath(extensionPath: string, platform = process.platform, architecture = process.arch): Promise { - if (!['x64', 'arm64'].includes(architecture) || !['linux', 'darwin'].includes(platform)) { + if (!['x64', 'arm64'].includes(architecture) || !['linux', 'darwin', 'win32'].includes(platform) || (platform === 'win32' && architecture !== 'x64')) { throw new Error(`Multi Codex does not support ${platform} ${architecture}.`); } const cpu = architecture === 'arm64' ? 'aarch64' : 'x86_64'; const directories = platform === 'darwin' ? [`macos-${cpu}`, architecture === 'arm64' ? 'darwin-arm64' : 'darwin-x86_64', `darwin-${cpu}`] - : [`linux-${cpu}`]; + : platform === 'win32' ? [`windows-${cpu}`] : [`linux-${cpu}`]; for (const directory of new Set(directories)) { - const path = join(extensionPath, 'bin', directory, 'codex'); + const path = join(extensionPath, 'bin', directory, platform === 'win32' ? 'codex.exe' : 'codex'); try { await access(path, constants.X_OK); return path; } catch { /* Try the older official layout. */ } } throw new Error(`The official Codex extension has no executable for ${platform} ${architecture}. Reinstall its matching platform build.`); diff --git a/extension/src/protocol.ts b/extension/src/protocol.ts index 7e56ad16..ac36df87 100644 --- a/extension/src/protocol.ts +++ b/extension/src/protocol.ts @@ -3,25 +3,47 @@ import { randomUUID } from 'node:crypto'; import type { Writable, Readable } from 'node:stream'; export type Message = { id?: string | number; method?: string; params?: any; result?: any; error?: { code: number; message: string } }; +export const MAX_CODEX_PROTOCOL_BYTES = 128 * 1024 * 1024; + +export class JsonLineBuffer { + private chunks: string[] = []; + private bytes = 0; + private discarding = false; + constructor(private complete: (line: string) => void, private fault: (error: Error) => void, + private maxBytes = MAX_CODEX_PROTOCOL_BYTES) {} + push(chunk: string) { + let offset = 0; + while (offset < chunk.length) { + const newline = chunk.indexOf('\n', offset); + const part = chunk.slice(offset, newline < 0 ? chunk.length : newline); + if (!this.discarding) { + this.bytes += Buffer.byteLength(part); + if (this.bytes > this.maxBytes) { + this.chunks = []; this.bytes = 0; this.discarding = true; + this.fault(new Error('Protocol frame too large')); + } else this.chunks.push(part); + } + if (newline >= 0) { + const line = this.discarding ? undefined : this.chunks.join(''); + this.chunks = []; this.bytes = 0; this.discarding = false; + if (line?.trim()) this.complete(line); + } + offset = newline < 0 ? chunk.length : newline + 1; + } + } + takeTail() { const tail = this.chunks.join(''); this.chunks = []; this.bytes = 0; return tail; } +} export class JsonLines extends EventEmitter { - private buffer = ''; - constructor(input: Readable, private output: Writable, maxBytes = 8 * 1024 * 1024) { + constructor(input: Readable, private output: Writable, maxBytes = MAX_CODEX_PROTOCOL_BYTES) { super(); input.setEncoding('utf8'); - input.on('data', (chunk: string) => { - this.buffer += chunk; - let offset: number; - while ((offset = this.buffer.indexOf('\n')) >= 0) { - const line = this.buffer.slice(0, offset); this.buffer = this.buffer.slice(offset + 1); - if (Buffer.byteLength(line) > maxBytes) { this.emit('fault', new Error('Protocol frame too large')); continue; } - if (!line.trim()) continue; - let message; - try { message = JSON.parse(line); } catch { this.emit('fault', new Error('Invalid protocol frame')); continue; } - if (!message || typeof message !== 'object' || Array.isArray(message)) { this.emit('fault', new Error('Invalid protocol frame')); continue; } - this.emit('message', message); - } - if (Buffer.byteLength(this.buffer) > maxBytes) { this.buffer = ''; this.emit('fault', new Error('Protocol buffer too large')); } - }); + const buffer = new JsonLineBuffer(line => { + let message; + try { message = JSON.parse(line); } catch { this.emit('fault', new Error('Invalid protocol frame')); return; } + if (!message || typeof message !== 'object' || Array.isArray(message)) { this.emit('fault', new Error('Invalid protocol frame')); return; } + this.emit('message', message); + }, error => this.emit('fault', error), maxBytes); + input.on('data', (chunk: string) => buffer.push(chunk)); input.on('end', () => this.emit('end')); input.on('error', () => this.emit('fault', new Error('Protocol connection failed'))); output.on('error', () => this.emit('fault', new Error('Protocol write failed'))); diff --git a/extension/src/startup.ts b/extension/src/startup.ts index d0d20ffb..99029564 100644 --- a/extension/src/startup.ts +++ b/extension/src/startup.ts @@ -15,11 +15,12 @@ export async function prepareSessionHome(sourceHome: string, sessionHome: string await mkdir(sourceHome, { recursive: true, mode: 0o700 }); for (const name of ['sessions', 'archived_sessions', 'skills', 'rules', 'plugins', 'memories', 'prompts']) { await mkdir(join(sourceHome, name), { recursive: true, mode: 0o700 }); - await symlink(join(sourceHome, name), join(sessionHome, name)); + await symlink(join(sourceHome, name), join(sessionHome, name), process.platform === 'win32' ? 'junction' : 'dir'); } try { await readFile(join(sourceHome, 'AGENTS.md')); - await symlink(join(sourceHome, 'AGENTS.md'), join(sessionHome, 'AGENTS.md')); + if (process.platform === 'win32') await copyFile(join(sourceHome, 'AGENTS.md'), join(sessionHome, 'AGENTS.md')); + else await symlink(join(sourceHome, 'AGENTS.md'), join(sessionHome, 'AGENTS.md')); } catch (error) { if ((error as NodeJS.ErrnoException).code !== 'ENOENT') throw error; } let originalConfig = ''; try { originalConfig = await readFile(join(sourceHome, 'config.toml'), 'utf8'); } diff --git a/extension/src/stdio-tap.ts b/extension/src/stdio-tap.ts index 68e9a4ce..37abcf8c 100644 --- a/extension/src/stdio-tap.ts +++ b/extension/src/stdio-tap.ts @@ -1,14 +1,26 @@ import { ChildProcess, type ChildProcessWithoutNullStreams } from 'node:child_process'; import { PassThrough, Writable } from 'node:stream'; import { StringDecoder } from 'node:string_decoder'; -import { JsonLines } from './protocol'; +import { JsonLines, JsonLineBuffer } from './protocol'; +import { realpathSync } from 'node:fs'; +import { win32 } from 'node:path'; + +export function sameExecutablePath(first: string, second: string, platform = process.platform): boolean { + if (platform !== 'win32') return first === second; + const canonical = (path: string) => { + try { path = realpathSync.native(path); } catch { /* The caller also verifies a live child. */ } + return win32.normalize(path).replace(/^\\\\\?\\/, '').toLowerCase(); + }; + return canonical(first) === canonical(second); +} // Node has no public API for enumerating an already-running extension's children. // Keep this compatibility hook in one place; never fall back to another process. export function findCodexBackend(engine: string): ChildProcessWithoutNullStreams | undefined { const handles = (process as any)._getActiveHandles?.(); if (!Array.isArray(handles)) return; - const matches = handles.filter((child: any) => child instanceof ChildProcess && child.spawnfile === engine + const matches = handles.filter((child: any) => child instanceof ChildProcess && typeof child.spawnfile === 'string' + && (sameExecutablePath(child.spawnfile, engine) || (engine.endsWith('.mjs') && child.spawnargs?.some((arg: string) => sameExecutablePath(arg, engine)))) && child.spawnargs?.includes('app-server') && child.pid && child.exitCode === null && !child.killed && child.stdin?.writable && !child.stdin.destroyed && child.stdout?.readable && !child.stdout.destroyed); if (matches.length > 1) throw new Error('Multiple Codex backends are running in this extension host. Live attachment was refused.'); @@ -19,33 +31,26 @@ export function tapBackend(child: ChildProcessWithoutNullStreams) { const input = new PassThrough(); const backendInput = new PassThrough(); const oldWrite = child.stdin.write; const oldEmit = child.stdout.emit; const decoder = new StringDecoder('utf8'); - let incoming = ''; let restored = false; + let restored = false; const backendOutput = new Writable({ write(chunk, encoding, callback) { oldWrite.call(child.stdin, chunk, encoding, callback); } }); const frontendOutput = new Writable({ write(chunk, _encoding, callback) { oldEmit.call(child.stdout, 'data', Buffer.from(chunk)); callback(); } }); const frontend = new JsonLines(input, frontendOutput); const lines = new JsonLines(backendInput, backendOutput); + const incoming = new JsonLineBuffer(line => { + try { JSON.parse(line); } + catch { + oldEmit.call(child.stdout, 'data', Buffer.from(line + '\n')); + lines.emit('fault', new Error('Codex protocol framing could not be verified')); + return; + } + backendInput.write(line + '\n'); + }, error => lines.emit('fault', error)); const interceptedWrite = function (this: any, chunk: any, encoding?: any, callback?: any) { return input.write(chunk, encoding, callback); } as typeof child.stdin.write; const interceptedEmit = function (this: any, event: string | symbol, ...args: any[]): boolean { if (event !== 'data') return oldEmit.call(this, event, ...args); - incoming += typeof args[0] === 'string' ? args[0] : decoder.write(args[0]); - let offset: number; - while ((offset = incoming.indexOf('\n')) >= 0) { - const line = incoming.slice(0, offset + 1); incoming = incoming.slice(offset + 1); - try { JSON.parse(line); } - catch { - // Attachment in the middle of a frame must not damage Codex's own reader. - oldEmit.call(this, 'data', Buffer.from(line)); - lines.emit('fault', new Error('Codex protocol framing could not be verified')); - continue; - } - backendInput.write(line); - } - if (Buffer.byteLength(incoming) > 8 * 1024 * 1024) { - oldEmit.call(this, 'data', Buffer.from(incoming)); incoming = ''; - lines.emit('fault', new Error('Codex protocol frame is too large')); - } + incoming.push(typeof args[0] === 'string' ? args[0] : decoder.write(args[0])); return true; } as typeof child.stdout.emit; child.stdin.write = interceptedWrite; child.stdout.emit = interceptedEmit; @@ -53,7 +58,7 @@ export function tapBackend(child: ChildProcessWithoutNullStreams) { if (restored) return; restored = true; if (child.stdin.write === interceptedWrite) child.stdin.write = oldWrite; if (child.stdout.emit === interceptedEmit) child.stdout.emit = oldEmit; - const tail = incoming + decoder.end(); incoming = ''; + const tail = incoming.takeTail() + decoder.end(); if (tail) oldEmit.call(child.stdout, 'data', Buffer.from(tail)); } return { child, frontend, lines, restore }; diff --git a/extension/src/storage.ts b/extension/src/storage.ts index f7bc7799..89ca6a7a 100644 --- a/extension/src/storage.ts +++ b/extension/src/storage.ts @@ -5,7 +5,8 @@ import { homedir } from 'node:os'; export function defaultDataDirectory(platform = process.platform, home = homedir(), env = process.env): string { if (platform === 'darwin') return join(home, 'Library', 'Application Support', 'multi-codex'); if (platform === 'linux') return join(env.XDG_DATA_HOME && isAbsolute(env.XDG_DATA_HOME) ? env.XDG_DATA_HOME : join(home, '.local', 'share'), 'multi-codex'); - throw new Error('Multi Codex supports local Linux and macOS.'); + if (platform === 'win32') return join(env.APPDATA || join(home, 'AppData', 'Roaming'), 'multi-codex'); + throw new Error('Multi Codex supports local Linux, macOS and Windows.'); } async function canonicalPath(path: string): Promise { diff --git a/extension/src/usage.ts b/extension/src/usage.ts new file mode 100644 index 00000000..5a9dbd7d --- /dev/null +++ b/extension/src/usage.ts @@ -0,0 +1,25 @@ +export function usageSummary(result: any, now = Date.now()) { + const windows = [result?.rateLimits?.primary, result?.rateLimits?.secondary].filter(Boolean); + const summaries = windows.map((window: any) => { + const duration = window.windowDurationMins; + const label = duration >= 10080 ? 'Weekly' : duration ? `${duration / 60}h` : 'Usage'; + if (!Number.isFinite(window.usedPercent)) return `${label}: unavailable`; + const left = Math.max(0, Math.min(100, 100 - window.usedPercent)); + const reset = Number(window.resetsAt) * 1000; + const minutes = Math.ceil((reset - now) / 60000); + const time = Number.isFinite(reset) && reset > now ? minutes >= 1440 ? `${Math.ceil(minutes / 1440)}d` : minutes >= 60 ? `${Math.ceil(minutes / 60)}h` : `${minutes}m` : ''; + return `${label}: ${Math.round(left)}% left${time ? ` · resets in ${time}` : ''}`; + }); + return summaries.join(' · ') || 'Usage unavailable'; +} + +/** Bound background backends and keep one failed account from cancelling the rest. */ +export async function refreshAllAccounts(accounts: T[], check: (account: T) => Promise, complete: (account: T, error?: unknown) => void, concurrency = 2) { + let next = 0; + await Promise.all(Array.from({ length: Math.min(concurrency, accounts.length) }, async () => { + while (next < accounts.length) { + const account = accounts[next++]; + try { await check(account); complete(account); } catch (error) { complete(account, error); } + } + })); +} diff --git a/extension/src/version.ts b/extension/src/version.ts new file mode 100644 index 00000000..03894a57 --- /dev/null +++ b/extension/src/version.ts @@ -0,0 +1,2 @@ +declare const __MULTI_CODEX_VERSION__: string; +export const extensionVersion = __MULTI_CODEX_VERSION__; diff --git a/extension/src/vscode-tests.ts b/extension/src/vscode-tests.ts index b6f308d1..0577d957 100644 --- a/extension/src/vscode-tests.ts +++ b/extension/src/vscode-tests.ts @@ -29,7 +29,8 @@ export async function run() { checks.push('Desktop accounts discovered despite inherited managed CODEX_HOME'); await vscode.commands.executeCommand('chatgpt.openSidebar'); if (process.env.MULTI_CODEX_TEST_LIVE_ATTACH === '1') { - const before = api.testBackendInfo(); + const before = await waitFor(() => Promise.resolve(api.testBackendInfo()), value => !!value.pid) + .catch(error => { throw new Error(`${error.message}: ${JSON.stringify(api.testBackendInfo())}`); }); assert.ok(before.pid, 'The original Codex backend must already be running'); await api.switchAccount(saved.accounts.find((account: any) => account.name === 'Account A').id); const after = await api.getState(); @@ -99,6 +100,15 @@ export async function run() { await verifyStable(); assert.equal((await api.getState()).accounts.length, 2); checks.push('Account discovery recovered after helper termination while Codex stayed running'); + const usageBefore = await verifyStable(); + await vscode.commands.executeCommand('multiCodex.refreshUsage'); + const allUsage = await verifyStable(); + assert.equal(allUsage.bridge.selectedId, usageBefore.bridge.selectedId, 'Checking all usage changed the selected account'); + for (const account of [a,b]) { + assert.match(allUsage.usageSummaries[account.id], /90% left/, 'Top-bar usage missed a saved account'); + assert.match(allUsage.usageSummaries[account.id], /80% left/, 'Weekly usage must also be visible'); + } + checks.push('Top-bar Check Usage refreshes every saved account without changing the account, chat or backend'); await vscode.commands.executeCommand('multiCodex.checkAccountUsage', b); await vscode.commands.executeCommand('workbench.view.extension.multiCodex'); if (process.env.MULTI_CODEX_UI_TEST === '1') { diff --git a/extension/src/worker.ts b/extension/src/worker.ts index f46d1994..406b9181 100644 --- a/extension/src/worker.ts +++ b/extension/src/worker.ts @@ -1,14 +1,15 @@ -import { spawn } from 'node:child_process'; +import { extensionVersion } from './version'; +import { spawnExecutable, terminateExecutable } from './native'; import { JsonLines, RpcPeer } from './protocol'; export async function withAccountBackend(engine: string, home: string, action: (rpc: RpcPeer) => Promise): Promise { const env: NodeJS.ProcessEnv = { ...process.env, CODEX_HOME: home, CODEX_SQLITE_HOME: home }; delete env.OPENAI_API_KEY; delete env.CODEX_API_KEY; delete env.ELECTRON_RUN_AS_NODE; - const child = spawn(engine, ['app-server'], { env, stdio: ['pipe', 'pipe', 'pipe'] }); + const child = spawnExecutable(engine, ['app-server'], { env }); child.stderr.resume(); const lines = new JsonLines(child.stdout, child.stdin); const rpc = new RpcPeer(lines, 'worker:'); child.on('error', () => rpc.close()); child.on('exit', () => rpc.close()); try { - await rpc.request('initialize', { clientInfo: { name: 'multi_codex_account', version: '0.1.0' } }); lines.send({ method: 'initialized' }); + await rpc.request('initialize', { clientInfo: { name: 'multi_codex_account', version: extensionVersion } }); lines.send({ method: 'initialized' }); return await action(rpc); - } finally { rpc.close(); child.kill(); } + } finally { rpc.close(); await terminateExecutable(child); } } diff --git a/extension/tests/attachment.test.mjs b/extension/tests/attachment.test.mjs index f2f5f81c..029a0a14 100644 --- a/extension/tests/attachment.test.mjs +++ b/extension/tests/attachment.test.mjs @@ -6,12 +6,19 @@ import { tmpdir } from 'node:os'; import { join, resolve } from 'node:path'; import { createRequire } from 'node:module'; import { syntheticAuth } from './fixtures/local-service.mjs'; -const { CodexBridge, JsonLines, RpcPeer, findCodexBackend, tapBackend } = createRequire(import.meta.url)('../dist/core.cjs'); +const { controlEndpoint, spawnExecutable, CodexBridge, JsonLines, RpcPeer, findCodexBackend, tapBackend, sameExecutablePath } = createRequire(import.meta.url)('../dist/core.cjs'); + +test('Windows backend discovery accepts native case and separator variants while keeping executable identity exact', () => { + assert.equal(sameExecutablePath('D:\\Extensions\\Codex\\codex.exe', 'd:/extensions/codex/codex.exe', 'win32'), true); + assert.equal(sameExecutablePath('\\\\?\\D:\\Extensions\\Codex\\codex.exe', 'd:/extensions/codex/codex.exe', 'win32'), true); + assert.equal(sameExecutablePath('D:\\Extensions\\Codex\\codex.exe', 'd:/other/codex.exe', 'win32'), false); + assert.equal(sameExecutablePath('/extensions/Codex/codex', '/extensions/codex/codex', 'linux'), false); +}); async function setup(t, before = async () => {}) { const root = await mkdtemp(join(tmpdir(), 'mc-attachment-test-')); const engine = resolve('tests/fixtures/fake-engine.mjs'); - const child = spawn(engine, ['app-server'], { stdio: 'pipe' }); + const child = spawnExecutable(engine, ['app-server']); const peer = new RpcPeer(new JsonLines(child.stdout, child.stdin), 'original:'); await peer.request('initialize'); await peer.request('account/login/start', { type: 'chatgptAuthTokens', accessToken: syntheticAuth('synthetic-account-a').tokens.access_token }); @@ -20,7 +27,7 @@ async function setup(t, before = async () => {}) { const tap = tapBackend(child); const home = join(root, 'home'); await mkdir(home); const bridge = new CodexBridge({ engine, helper: resolve('tests/fixtures/fake-accounts.mjs'), dataRoot: root, globalHome: root, - sessionHome: home, socket: join(root, 'bridge.sock'), token: 'attachment-fixture', workspace: root, attached: true }, tap.frontend, [], tap); + sessionHome: home, socket: controlEndpoint(root.replace(/[^a-zA-Z0-9]/g, '')), token: 'attachment-fixture', workspace: root, attached: true }, tap.frontend, [], tap); t.after(async () => { await bridge.dispose(); peer.close(); child.kill(); await rm(root, { recursive: true, force: true }); }); await bridge.attachReady(); return { bridge, peer, child, tap, write, emit }; @@ -68,6 +75,16 @@ test('fragmented UTF-8 frames and batched frames reach the original reader exact assert.deepEqual(seen, ['A ✓ 🙂 B', 'A ✓ 🙂 B', 'A ✓ 🙂 B']); assert.equal(bridge.state().connectionFailed, false); }); +test('live attachment preserves a long chat response above 8 MiB without losing the connection', async t => { + const { bridge, peer, child } = await setup(t); + const seen = []; + peer.lines.on('message', message => { if (message.method === 'fixture/history') seen.push(message.params.history.length); }); + const history = 'x'.repeat(9 * 1024 * 1024); + const frame = Buffer.from(JSON.stringify({ method: 'fixture/history', params: { history } }) + '\n'); + for (let offset = 0; offset < frame.length; offset += 32767) child.stdout.emit('data', frame.subarray(offset, offset + 32767)); + assert.deepEqual(seen, [history.length]); assert.equal(bridge.state().connectionFailed, false); + assert.equal((await peer.request('fixture/control')).held, false); +}); test('an incomplete pre-attachment frame is preserved and disables switching', async t => { const { bridge, child } = await setup(t); child.stdout.emit('data', Buffer.from('tail-of-an-existing-frame\n')); @@ -76,8 +93,8 @@ test('an incomplete pre-attachment frame is preserved and disables switching', a }); test('backend discovery refuses ambiguous children and never selects a different executable', async t => { const engine = resolve('tests/fixtures/fake-engine.mjs'); - const first = spawn(engine, ['app-server'], { stdio: 'pipe' }); - const second = spawn(engine, ['app-server'], { stdio: 'pipe' }); + const first = spawnExecutable(engine, ['app-server']); + const second = spawnExecutable(engine, ['app-server']); t.after(() => { first.kill(); second.kill(); }); assert.throws(() => findCodexBackend(engine), /Multiple Codex backends/); assert.equal(findCodexBackend('/not-the-official-codex'), undefined); diff --git a/extension/tests/bridge.test.mjs b/extension/tests/bridge.test.mjs index 14cc04bb..87f98673 100644 --- a/extension/tests/bridge.test.mjs +++ b/extension/tests/bridge.test.mjs @@ -5,13 +5,13 @@ import { mkdtemp, chmod, mkdir, rm } from 'node:fs/promises'; import { tmpdir } from 'node:os'; import { join, resolve } from 'node:path'; import { createRequire } from 'node:module'; -const { CodexBridge, JsonLines, RpcPeer, BridgeClient } = createRequire(import.meta.url)('../dist/core.cjs'); +const { controlEndpoint, spawnExecutable, CodexBridge, JsonLines, RpcPeer, BridgeClient } = createRequire(import.meta.url)('../dist/core.cjs'); async function setup(t) { const root = await mkdtemp(join(tmpdir(), 'mc-bridge-test-')); const engine = resolve('tests/fixtures/fake-engine.mjs'); const helper = resolve('tests/fixtures/fake-accounts.mjs'); await chmod(engine, 0o755); await chmod(helper, 0o755); await mkdir(join(root, 'home')); const input = new PassThrough(); const output = new PassThrough(); - const bridge = new CodexBridge({ engine, helper, dataRoot: root, globalHome: root, sessionHome: join(root, 'home'), socket: join(root, 'bridge.sock'), token: 'private-test-token', workspace: root }, new JsonLines(input, output), ['app-server']); + const bridge = new CodexBridge({ engine, helper, dataRoot: root, globalHome: root, sessionHome: join(root, 'home'), socket: controlEndpoint(root.replace(/[^a-zA-Z0-9]/g, '')), token: 'private-test-token', workspace: root }, new JsonLines(input, output), ['app-server']); const peer = new RpcPeer(new JsonLines(output, input), 'frontend:'); await bridge.listen(); await peer.request('initialize'); input.write(JSON.stringify({ method: 'initialized' }) + '\n'); const client = await BridgeClient.connect(bridge.config.socket, bridge.config.token); @@ -68,6 +68,7 @@ test('backend termination closes requests and disables account changes', async t await assert.rejects(() => peer.request('fixture/crash', {}, 100), /closed|timed out/); await until(() => client.request('state'), state => state.connectionFailed); await assert.rejects(() => client.request('switch', { id: 'b' }), /connecting/); + assert.match((await client.request('state')).reason, /backend disconnected/); assert.equal(bridge.activity.ready, false); }); test('ChatGPT and API-key modes can switch both ways in the same backend', async t => { diff --git a/extension/tests/connection.test.mjs b/extension/tests/connection.test.mjs new file mode 100644 index 00000000..4826ab0e --- /dev/null +++ b/extension/tests/connection.test.mjs @@ -0,0 +1,20 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { createRequire } from 'node:module'; +const { waitForReady } = createRequire(import.meta.url)('../dist/core.cjs'); + +test('early account selection waits for initialization without clearing active-work guards', async () => { + let initialized = false; + const pending = waitForReady(async () => ({ ready: initialized, canSwitch: false, reason: 'A Codex chat is still running.' }), 1000); + setTimeout(() => { initialized = true; }, 20); + const state = await pending; + assert.equal(state.ready, true); + assert.equal(state.canSwitch, false); + assert.match(state.reason, /still running/); +}); +test('a dead backend reports disconnection immediately rather than waiting for initialization', async () => { + await assert.rejects(waitForReady(async () => ({ ready: false, connectionFailed: true })), /backend disconnected/); +}); +test('a backend that never initializes stops waiting and gives a retry action', async () => { + await assert.rejects(waitForReady(async () => ({ ready: false }), 30), /Open its panel.*retry/); +}); diff --git a/extension/tests/fixtures/fake-engine.mjs b/extension/tests/fixtures/fake-engine.mjs index 6a50073c..60294b42 100755 --- a/extension/tests/fixtures/fake-engine.mjs +++ b/extension/tests/fixtures/fake-engine.mjs @@ -5,7 +5,7 @@ import { readFile } from 'node:fs/promises'; import { join } from 'node:path'; let token = null; let authMethod = null; let mode = ''; let held; let threadStatus = 'idle'; let fileAuth = true; let withholdFileToken = false; -const initial = await readFile(join(process.env.CODEX_HOME, 'auth.json'), 'utf8').then(JSON.parse).catch(() => null); +const initial = await readFile(join(process.env.CODEX_HOME || '', 'auth.json'), 'utf8').then(JSON.parse).catch(() => null); if (initial) { token = initial.OPENAI_API_KEY || initial.tokens?.access_token || null; authMethod = initial.OPENAI_API_KEY ? 'apikey' : token ? 'chatgpt' : null; } const send = message => process.stdout.write(JSON.stringify(message) + '\n'); for await (const line of createInterface({ input: process.stdin })) { diff --git a/extension/tests/native-helper.test.mjs b/extension/tests/native-helper.test.mjs index bd94f75f..2b9305c2 100644 --- a/extension/tests/native-helper.test.mjs +++ b/extension/tests/native-helper.test.mjs @@ -1,17 +1,40 @@ import test from 'node:test'; import assert from 'node:assert/strict'; -import { mkdtemp, mkdir, writeFile, readFile, rm } from 'node:fs/promises'; +import { mkdtemp, mkdir, writeFile, readFile, rm, symlink } from 'node:fs/promises'; import { join, resolve } from 'node:path'; import { tmpdir } from 'node:os'; import { createRequire } from 'node:module'; +import { execFile } from 'node:child_process'; +import { promisify } from 'node:util'; import { syntheticAuth } from './fixtures/local-service.mjs'; -const { AccountClient } = createRequire(import.meta.url)('../dist/core.cjs'); +const { AccountClient, helperName } = createRequire(import.meta.url)('../dist/core.cjs'); const engine = process.env.MULTI_CODEX_TEST_ENGINE; +test('packaged helper protects Windows runtime and inherited child files', { skip: !engine || process.platform !== 'win32' }, async () => { + const root = await mkdtemp(join(tmpdir(), 'mc-runtime-acl-')); + const helper = resolve('bin', helperName); + try { + await promisify(execFile)(helper, ['--protect-directory', root], { windowsHide: true }); + const child = join(root, 'bridge-config.json'); + await writeFile(child, '{}'); + // Windows PowerShell can inherit PowerShell 7's module path on the runner. + // Read NTFS security directly through .NET instead of autoloading Get-Acl. + const script = `$ErrorActionPreference='Stop'; $ProgressPreference='SilentlyContinue'; Set-StrictMode -Version Latest; $owner=[Security.Principal.WindowsIdentity]::GetCurrent().User.Value; $a=[IO.Directory]::GetAccessControl($env:MULTI_CODEX_TEST_DIRECTORY); $b=[IO.File]::GetAccessControl([IO.Path]::Combine($env:MULTI_CODEX_TEST_DIRECTORY,'bridge-config.json')); @{owner=$owner;protected=$a.AreAccessRulesProtected;directory=@($a.GetAccessRules($true,$true,[Security.Principal.SecurityIdentifier]) | ForEach-Object {$_.IdentityReference.Value});child=@($b.GetAccessRules($true,$true,[Security.Principal.SecurityIdentifier]) | ForEach-Object {$_.IdentityReference.Value})} | ConvertTo-Json -Compress`; + const { stdout } = await promisify(execFile)('powershell.exe', ['-NoProfile', '-NonInteractive', '-EncodedCommand', Buffer.from(script, 'utf16le').toString('base64')], { windowsHide: true, env: { ...process.env, MULTI_CODEX_TEST_DIRECTORY: root } }); + const acl = JSON.parse(stdout); + assert.equal(acl.protected, true); + for (const identities of [acl.directory, acl.child]) assert.deepEqual([...new Set(identities)].sort(), [acl.owner, 'S-1-5-18'].sort()); + await assert.rejects(() => promisify(execFile)(helper, ['--protect-directory', '.'], { windowsHide: true })); + const linked = join(root, 'linked-runtime'); + await symlink(root, linked, 'junction'); + try { await assert.rejects(() => promisify(execFile)(helper, ['--protect-directory', linked], { windowsHide: true })); } + finally { await rm(linked); } + } finally { await rm(root, { recursive: true, force: true }); } +}); test('native storage supports standalone add/import, shared discovery and cross-process leases', { skip: !engine }, async () => { const root = await mkdtemp(join(tmpdir(), 'mc-native-test-')); const home = join(root, 'default'); await mkdir(home); const authJson = JSON.stringify(syntheticAuth('synthetic-account-a')); await writeFile(join(home, 'auth.json'), authJson); - const helper = resolve('bin/multi-codex-account-helper'); const data = join(root, 'data'); + const helper = resolve('bin', helperName); const data = join(root, 'data'); const first = new AccountClient(helper, engine, data, home); const second = new AccountClient(helper, engine, data, home); try { assert.deepEqual(await first.list(), []); @@ -36,12 +59,12 @@ test('native storage supports standalone add/import, shared discovery and cross- assert.equal((await first.list()).length, 6); const cold = new AccountClient(helper, engine, data, home); try { await cold.request('accounts/delete', { id: active.id }); } - finally { cold.dispose(); } + finally { await cold.dispose(); } assert.equal((await second.list()).length, 5, 'A fresh helper could not remove a persisted account'); } finally { for (const profile of await first.list().catch(() => [])) { await first.request('accounts/release', { id: profile.id }).catch(() => {}); await second.request('accounts/release', { id: profile.id }).catch(() => {}); } for (const profile of await first.list().catch(() => [])) { await first.request('accounts/unlockCredential', { id: profile.id }).catch(() => {}); await second.request('accounts/unlockCredential', { id: profile.id }).catch(() => {}); } for (const profile of await first.list().catch(() => [])) await first.request('accounts/delete', { id: profile.id }).catch(() => {}); - first.dispose(); second.dispose(); await rm(root, { recursive: true, force: true }); + await Promise.all([first.dispose(), second.dispose()]); await rm(root, { recursive: true, force: true, maxRetries: 20, retryDelay: 100 }); } }); diff --git a/extension/tests/native.test.mjs b/extension/tests/native.test.mjs new file mode 100644 index 00000000..5339ce6f --- /dev/null +++ b/extension/tests/native.test.mjs @@ -0,0 +1,34 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { once } from 'node:events'; +import { join } from 'node:path'; +import { tmpdir } from 'node:os'; +import { randomUUID } from 'node:crypto'; +import { createRequire } from 'node:module'; +import { createServer, createConnection } from 'node:net'; +const { AccountClient, controlEndpoint } = createRequire(import.meta.url)('../dist/core.cjs'); + +test('independent control servers with a shared long ID prefix remain separate', async () => { + const prefix = `shared-long-directory-prefix-${randomUUID()}`; + const paths = [controlEndpoint(`${prefix}-account-a`), controlEndpoint(`${prefix}-account-b`)]; + const servers = paths.map((_, index) => createServer(socket => socket.end(String(index)))); + try { + await Promise.all(servers.map((server, index) => new Promise((resolve, reject) => { server.once('error', reject); server.listen(paths[index], resolve); }))); + const answers = await Promise.all(paths.map(path => new Promise((resolve, reject) => { + let received = ''; const socket = createConnection(path); + socket.on('data', chunk => { received += chunk; }); socket.once('error', reject); socket.once('end', () => resolve(received)); + }))); + assert.deepEqual(answers, ['0', '1']); + } finally { await Promise.all(servers.map(server => new Promise(resolve => server.close(resolve)))); } +}); + +test('a missing native helper can be disposed so Refresh can reconnect', { timeout: 2000 }, async () => { + const missing = join(tmpdir(), `missing-multi-codex-${randomUUID()}`); + const client = new AccountClient(missing, missing, tmpdir(), tmpdir()); + await once(client.child, 'error'); + assert.equal(client.isRunning, false); + await assert.rejects(() => client.list(), /unavailable/); + await client.dispose(); + assert.equal(client.child.stdin.destroyed, true); + assert.equal(client.child.stdout.destroyed, true); +}); diff --git a/extension/tests/persistence.test.mjs b/extension/tests/persistence.test.mjs index f64ca89a..d22f01bc 100644 --- a/extension/tests/persistence.test.mjs +++ b/extension/tests/persistence.test.mjs @@ -9,7 +9,7 @@ import { createRequire } from 'node:module'; import { syntheticAuth } from './fixtures/local-service.mjs'; const { JsonLines, RpcPeer, BridgeClient, startupHomes } = createRequire(import.meta.url)('../dist/core.cjs'); -test('startup uses the current launch home and ignores stale configured history', () => { +test('startup uses the current launch home and ignores stale configured history', { skip: process.platform === 'win32' }, () => { const base = { globalHome: '/global', startupHome: '/configured', historyHome: '/stale-history' }; assert.deepEqual(startupHomes(base, { CODEX_HOME: '/current' }), { sourceHome: '/current', historyHome: '/current' }); assert.deepEqual(startupHomes(base, { CODEX_HOME: '/current', CODEX_SQLITE_HOME: '/history' }), { sourceHome: '/current', historyHome: '/history' }); @@ -46,7 +46,7 @@ test('each open preserves the current login and resources, ignoring old project running = await start(currentHome); const homes = await running.peer.request('fixture/homes'); assert.equal(homes.history, currentHome); - assert.equal((await stat(join(homes.home, 'auth.json'))).mode & 0o777, 0o600); + if (process.platform !== 'win32') assert.equal((await stat(join(homes.home, 'auth.json'))).mode & 0o777, 0o600); assert.equal(await readlink(join(homes.home, 'skills')), join(currentHome, 'skills')); assert.equal(await readlink(join(homes.home, 'sessions')), join(currentHome, 'sessions')); assert.equal((await running.peer.request('getAuthStatus')).authToken, JSON.parse(originalAuth).tokens.access_token); diff --git a/extension/tests/platform.test.mjs b/extension/tests/platform.test.mjs index 2cc42a5d..72052526 100644 --- a/extension/tests/platform.test.mjs +++ b/extension/tests/platform.test.mjs @@ -9,7 +9,7 @@ const { bundledEnginePath, startupEnginePath } = createRequire(import.meta.url)( test('engine discovery resolves official Mac and Linux layouts and rejects unavailable platforms', async () => { const root = await mkdtemp(join(tmpdir(), 'mc-platform-')); async function executable(directory) { - const path = join(root, 'bin', directory, 'codex'); + const path = join(root, 'bin', directory, directory.startsWith('windows-') ? 'codex.exe' : 'codex'); await mkdir(join(root, 'bin', directory), { recursive: true }); await writeFile(path, '#!/bin/sh\nexit 0\n', { mode: 0o700 }); return path; @@ -21,7 +21,10 @@ test('engine discovery resolves official Mac and Linux layouts and rejects unava assert.equal(await bundledEnginePath(root, 'darwin', 'arm64'), arm); assert.equal(await bundledEnginePath(root, 'darwin', 'x64'), intel); assert.equal(await bundledEnginePath(root, 'linux', 'x64'), linux); - await assert.rejects(() => bundledEnginePath(root, 'win32', 'x64'), /does not support/); + const windows = await executable('windows-x86_64'); + assert.equal(await bundledEnginePath(root, 'win32', 'x64'), windows); + await assert.rejects(() => bundledEnginePath(root, 'freebsd', 'x64'), /does not support/); + await assert.rejects(() => bundledEnginePath(root, 'win32', 'arm64'), /does not support/); await assert.rejects(() => bundledEnginePath(root, 'linux', 'arm64'), /no executable/); await rm(arm); const legacy = await executable('darwin-arm64'); @@ -36,10 +39,10 @@ test('startup follows the installed official extension after an update removes t const oldEngine = join(old, 'bin', 'linux-x86_64', 'codex'); try { const cpu = process.arch === 'arm64' ? 'aarch64' : 'x86_64'; - const directory = process.platform === 'darwin' ? `macos-${cpu}` : `linux-${cpu}`; + const directory = process.platform === 'darwin' ? `macos-${cpu}` : process.platform === 'win32' ? `windows-${cpu}` : `linux-${cpu}`; await mkdir(join(current, 'bin', directory), { recursive: true }); await writeFile(join(current, 'package.json'), JSON.stringify({ publisher: 'openai', name: 'chatgpt' })); - await writeFile(join(current, 'bin', directory, 'codex'), '#!/bin/sh\nexit 0\n', { mode: 0o700 }); + await writeFile(join(current, 'bin', directory, directory.startsWith('windows-') ? 'codex.exe' : 'codex'), '#!/bin/sh\nexit 0\n', { mode: 0o700 }); await writeFile(join(root, 'extensions.json'), JSON.stringify([{ identifier: { id: 'openai.chatgpt' }, relativeLocation: 'openai.chatgpt-2.0.0' }])); const expected = await bundledEnginePath(current); assert.equal(await startupEnginePath(oldEngine), expected); diff --git a/extension/tests/protocol.test.mjs b/extension/tests/protocol.test.mjs new file mode 100644 index 00000000..fbce6570 --- /dev/null +++ b/extension/tests/protocol.test.mjs @@ -0,0 +1,24 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { PassThrough } from 'node:stream'; +import { createRequire } from 'node:module'; +const { JsonLines } = createRequire(import.meta.url)('../dist/core.cjs'); + +test('a long chat response exceeding the former 8 MiB limit arrives once across fragmented chunks', () => { + const input = new PassThrough(); const output = new PassThrough(); + const lines = new JsonLines(input, output); + const messages = []; const faults = []; + lines.on('message', message => messages.push(message)); lines.on('fault', error => faults.push(error)); + const history = 'x'.repeat(9 * 1024 * 1024) + '🙂'; + const bytes = Buffer.from(JSON.stringify({ id: 'history', result: { history } }) + '\n'); + for (let offset = 0; offset < bytes.length; offset += 32767) input.write(bytes.subarray(offset, offset + 32767)); + assert.deepEqual(faults, []); assert.equal(messages.length, 1); assert.equal(messages[0].result.history, history); +}); +test('oversized malformed input faults once and discards through its newline before reading another frame', () => { + const input = new PassThrough(); const lines = new JsonLines(input, new PassThrough(), 32); + const messages = []; const faults = []; + lines.on('message', message => messages.push(message)); lines.on('fault', error => faults.push(error)); + input.write('x'.repeat(33)); input.write('still the oversized frame\n{"id":"next"}\n'); + assert.equal(faults.length, 1); assert.match(faults[0].message, /too large/); + assert.deepEqual(messages, [{ id: 'next' }]); +}); diff --git a/extension/tests/storage.test.mjs b/extension/tests/storage.test.mjs index 9db880a5..e98accde 100644 --- a/extension/tests/storage.test.mjs +++ b/extension/tests/storage.test.mjs @@ -7,10 +7,11 @@ import { createRequire } from 'node:module'; const { defaultDataDirectory, resolveAccountPaths } = createRequire(import.meta.url)('../dist/core.cjs'); test('storage discovers the desktop directory on Mac and honors only absolute Linux XDG paths', () => { - assert.equal(defaultDataDirectory('linux', '/home/user', {}), '/home/user/.local/share/multi-codex'); - assert.equal(defaultDataDirectory('linux', '/home/user', { XDG_DATA_HOME: '/custom/data' }), '/custom/data/multi-codex'); - assert.equal(defaultDataDirectory('linux', '/home/user', { XDG_DATA_HOME: 'relative' }), '/home/user/.local/share/multi-codex'); - assert.equal(defaultDataDirectory('darwin', '/Users/user', {}), '/Users/user/Library/Application Support/multi-codex'); + assert.equal(defaultDataDirectory('linux', '/home/user', {}), join('/home/user', '.local/share/multi-codex')); + assert.equal(defaultDataDirectory('linux', '/home/user', { XDG_DATA_HOME: '/custom/data' }), join('/custom/data', 'multi-codex')); + assert.equal(defaultDataDirectory('linux', '/home/user', { XDG_DATA_HOME: 'relative' }), join('/home/user', '.local/share/multi-codex')); + assert.equal(defaultDataDirectory('darwin', '/Users/user', {}), join('/Users/user', 'Library/Application Support/multi-codex')); + assert.equal(defaultDataDirectory('win32', '/Users/user', { APPDATA: '/roaming' }), join('/roaming', 'multi-codex')); }); test('app-launched account home cannot hide desktop accounts, including through symlinks', async () => { @@ -20,7 +21,7 @@ test('app-launched account home cannot hide desktop accounts, including through const global = join(home, 'configured-global'); await mkdir(profile, { recursive: true }); await writeFile(join(root, 'executables.json'), JSON.stringify({ globalCodexHome: global })); - await symlink(profile, join(home, 'profile-alias')); + await symlink(profile, join(home, 'profile-alias'), process.platform === 'win32' ? 'junction' : 'dir'); try { for (const inherited of [profile, join(home, 'profile-alias')]) { const paths = await resolveAccountPaths({ platform: 'linux', home, env: { CODEX_HOME: inherited } }); diff --git a/extension/tests/usage.test.mjs b/extension/tests/usage.test.mjs new file mode 100644 index 00000000..5ee189b0 --- /dev/null +++ b/extension/tests/usage.test.mjs @@ -0,0 +1,20 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { createRequire } from 'node:module'; +const { usageSummary, refreshAllAccounts } = createRequire(import.meta.url)('../dist/core.cjs'); +test('all-account refresh bounds backends and continues after an account fails', async () => { + let running = 0; let peak = 0; const results = []; + await refreshAllAccounts(['a', 'b', 'c', 'd'], async id => { + running++; peak = Math.max(peak, running); + await new Promise(resolve => setTimeout(resolve, 5)); running--; + if (id === 'b') throw new Error('Expired account'); + }, (id, error) => results.push([id, Boolean(error)])); + assert.equal(peak, 2); assert.equal(results.length, 4); + assert.deepEqual(results.find(([id]) => id === 'b'), ['b', true]); +}); +test('usage labels preserve windows, reset times and unknown limits', () => { + const now = 1800000000000; + assert.match(usageSummary({ rateLimits: { primary: { windowDurationMins: 300, usedPercent: 29, resetsAt: now / 1000 + 7200 }, secondary: { windowDurationMins: 10080, usedPercent: 68 } } }, now), /5h: 71% left · resets in 2h · Weekly: 32% left/); + assert.equal(usageSummary({}), 'Usage unavailable'); + assert.match(usageSummary({ rateLimits: { primary: { usedPercent: undefined } } }), /unavailable/); +}); diff --git a/next/app/docs/[guide]/page.tsx b/next/app/docs/[guide]/page.tsx new file mode 100644 index 00000000..7f54f100 --- /dev/null +++ b/next/app/docs/[guide]/page.tsx @@ -0,0 +1,16 @@ +import { readFile } from "node:fs/promises" +import { join } from "node:path" +import { notFound } from "next/navigation" +import Link from "next/link" +import Markdown from "react-markdown" +import remarkGfm from "remark-gfm" + +const guides = ["platform-support", "extension", "extension-publishing", "release-guidelines"] +export function generateStaticParams() { return guides.map(guide => ({ guide })) } +export const dynamicParams = false +export default async function Guide({ params }: { params: Promise<{ guide: string }> }) { + const { guide } = await params + if (!guides.includes(guide)) notFound() + const content = await readFile(join(process.cwd(), "content/guides", `${guide}.md`), "utf8") + return
{content}
+} diff --git a/next/app/docs/page.tsx b/next/app/docs/page.tsx index 864ace7c..a24c3dca 100644 --- a/next/app/docs/page.tsx +++ b/next/app/docs/page.tsx @@ -7,17 +7,18 @@ import workspaceLight from "@/public/images/workspace-light.png" import workspaceDark from "@/public/images/workspace-dark.png" export const metadata: Metadata = { title: "Documentation", description: "Install Multi Codex, add accounts, choose a terminal and understand usage reset reminders." } -const sections = [["installation", "Installation"], ["vscode", "VS Code extension"], ["first-account", "Your first account"], ["launching", "Launch a workspace"], ["terminals", "Choose a terminal"], ["reminders", "Reset reminders"], ["updates", "Update the app"], ["troubleshooting", "Troubleshooting"]] as const +const sections = [["installation", "Installation"], ["menu-bar", "Mac menu bar"], ["vscode", "VS Code extension"], ["first-account", "Your first account"], ["launching", "Launch a workspace"], ["terminals", "Choose a terminal"], ["reminders", "Reset reminders"], ["updates", "Update the app"], ["troubleshooting", "Troubleshooting"]] as const export default function Docs() { return

GET COMFORTABLE

A workspace
for each account.

Everything you need to install Multi Codex and get your accounts working side by side.

-
01 / INSTALLATION

Start with the launcher.

Choose your platform below. The installer downloads the latest release, verifies its checksum, and installs the app.

Platform support

Linux packages target x86_64: AppImage, DEB and RPM. Mac builds target Apple Silicon on macOS 26 or newer. The Mac release is unsigned and unnotarized, so the command includes an explicit opt-in.

See platform requirements and validation →

Prefer a manual install? Download a package from GitHub Releases.

-
VS CODE EXTENSION

Switch accounts in the window you’re using.

Install the free pre-release of Multi Codex from the VS Code Marketplace. It works with the official Codex extension on Linux x64 and macOS 26+ on Intel and Apple Silicon. The desktop app and a separate Codex CLI installation are optional.

  1. Open Multi Codex in the activity bar

    The extension reads the same local account store as the desktop app. Your saved accounts appear automatically under the same OS user.

  2. Add an account if you’re starting fresh

    Use + at the top of Accounts to sign in with a browser or import an existing login. Adding an account here also makes it available to the desktop app.

  3. Click the account you want to use

    The extension connects switching automatically on compatible Codex builds. It keeps the current window and chat open, and blocks switching during observed active work or approvals.

  4. Check usage from the account row

    Hover over an account and use its usage icon. Available limits appear beside the account name. Use Refresh at the top to read account changes from the desktop app.

Install the pre-release
Compatibility

This preview uses private Codex integration hooks. Clear queued follow-ups before switching. If a backend is incompatible, the extension shows an error and keeps the window open. Local VS Code is supported; remote SSH, containers, WSL and browser editors are not supported.

Read extension compatibility details →

If saved desktop accounts are missing, check that VS Code runs as the same OS user. For a custom account store, set Multi Codex: Data Directory to the desktop app’s account directory and use Refresh.

+
01 / INSTALLATION

Start with the launcher.

Choose your platform below. The installer downloads the latest release, verifies its checksum, and installs the app.

Platform support

Linux packages target x86_64: AppImage, DEB and RPM. Mac builds target Apple Silicon on macOS 26 or newer. Windows installers target native x64. The Mac release is unsigned and unnotarized, so the command includes an explicit opt-in.

See platform requirements and validation →

Prefer a manual install? Download a package from GitHub Releases.

+
VS CODE EXTENSION

Switch accounts in the window you’re using.

Install the free pre-release of Multi Codex from the VS Code Marketplace. It works with the official Codex extension on Linux x64, macOS 26+ on Intel and Apple Silicon, and Windows x64. The desktop app and a separate Codex CLI installation are optional.

For version 0.2.0, download the matching platform VSIX from GitHub and use Extensions: Install from VSIX… if the version or platform is not available in Marketplace yet.

  1. Open Multi Codex in the activity bar

    The extension reads the same local account store as the desktop app. Your saved accounts appear automatically under the same OS user.

  2. Add an account if you’re starting fresh

    Use + at the top of Accounts to sign in with a browser or import an existing login. Adding an account here also makes it available to the desktop app.

  3. Click the account you want to use

    The extension connects switching automatically on compatible Codex builds. It keeps the current window and chat open, and blocks switching during observed active work or approvals.

  4. Check all accounts at once

    Use Check Usage at the top of Accounts to refresh every saved account. Remaining limits and reset times appear beside each name, with progress while checking. Use an account’s usage icon to check just that account. Refresh reads account changes from the desktop app.

Install the pre-release
Compatibility

This preview uses private Codex integration hooks. Clear queued follow-ups before switching. If a backend is incompatible, the extension shows an error and keeps the window open. Local VS Code is supported; remote SSH, containers, WSL and browser editors are not supported.

Read extension compatibility details →

If saved desktop accounts are missing, check that VS Code runs as the same OS user. For a custom account store, set Multi Codex: Data Directory to the desktop app’s account directory and use Refresh.

+
02 / YOUR FIRST ACCOUNT

Add a login of your own.

Open Multi Codex, click Add account, give it a name, and choose how to connect it:

  1. Sign in with browser

    Follow the sign-in link and enter the one-time code to connect a ChatGPT account.

  2. Import current

    Save a copy of your existing Codex login. Your original login stays in place.

  3. Paste JSON

    Paste an existing Codex auth.json into the desktop app. Keep it private; never paste credentials into a website or GitHub issue.

Accounts appear in plan order: Pro, Plus, Go, then Free. Usage refreshes when the app opens.

-
03 / LAUNCH A WORKSPACE

Pick an account. Pick a folder.

Use the account row to launch VS Code, the Codex desktop app, or CLI. Choose a project folder. Desktop selection is Linux-only for VS Code and the Codex desktop app on supported desktop environments. On macOS, the app launches after you choose a folder. CLI launches open in your selected terminal. Set a preferred folder in Launch settings to make the next launch quicker.

Linux only · Choose where VS Code or the Codex desktop app opens.

Each account uses its own saved credentials, conversations and application data. The CLI uses that account’s Codex and SQLite homes.

Install your tools first

Install the Codex extension inside each isolated VS Code profile. Interactive CLI launches require a complete Codex CLI installation. Standalone launch currently supports the verified Codex desktop version 26.930.51102.

-
04 / CHOOSE A TERMINAL

The terminal you already like.

Open Launch settings → CLI terminal. Select an installed terminal and save. The choice applies to your next CLI launch.

Linux

Konsole, GNOME Terminal, XFCE Terminal, xterm, Kitty, Ghostty, Alacritty, Foot

macOS

Terminal, Kitty, Ghostty, Alacritty

Automatic uses the first supported terminal found. The dropdown shows Automatic and installed terminals only. If a chosen terminal is later removed, the app asks you to select another.

You can set the full path to your Codex executable in the Advanced section. Use an executable path without quotes or extra arguments.

-
05 / RESET REMINDERS

A quiet heads-up.

When available usage resets expire within 48 hours, a small reminder appears at the top of the app. Multiple resets across accounts are grouped into one popup.

  • At most two reminders per local calendar day.
  • At least four hours between reminders, including across midnight.
  • The limit is saved across app restarts.
  • Expired, used, undated or stale reset details do not trigger a reminder.

Click View resets to see the accounts, then open an account for exact expiry details. Dismiss the popup with ×. It also closes after a minute when you are not interacting with it. The app checks fresh usage periodically while open; it does not send reminders while closed.

-
06 / UPDATE THE APP

Fresh app. Familiar accounts.

Close Multi Codex, then run the update command for your platform. The updater verifies the download before replacing the application and preserves saved accounts and profile data.

For an update without reopening the app, add MULTI_CODEX_NO_LAUNCH=1 before bash. Keep a backup of important local data as part of your normal workflow.

+
03 / LAUNCH A WORKSPACE

Pick an account. Pick a folder.

Use the account row to launch VS Code, the Codex desktop app, or CLI. Choose a project folder. Desktop selection is Linux-only for VS Code and the Codex desktop app on supported desktop environments. On macOS and Windows, the app launches on the current desktop after you choose a folder. CLI launches open in your selected terminal. Set a preferred folder in Launch settings to make the next launch quicker.

Linux only · Choose where VS Code or the Codex desktop app opens.

Each account uses its own saved credentials, conversations and application data. The CLI uses that account’s Codex and SQLite homes.

Install your tools first

Install the Codex extension inside each isolated VS Code profile. Interactive CLI launches require a complete Codex CLI installation. Standalone launch requires an individually verified Codex desktop build. Check supported versions before installing or updating Codex.

+
04 / CHOOSE A TERMINAL

The terminal you already like.

Open Launch settings → CLI terminal. Select an installed terminal and save. The choice applies to your next CLI launch.

Linux

Konsole, GNOME Terminal, XFCE Terminal, xterm, Kitty, Ghostty, Alacritty, Foot

macOS

Terminal, Kitty, Ghostty, Alacritty

Windows

Windows Terminal, PowerShell

Automatic uses the first supported terminal found. The dropdown shows Automatic and installed terminals only. If a chosen terminal is later removed, the app asks you to select another.

You can set the full path to your Codex executable in the Advanced section. Use an executable path without quotes or extra arguments.

+
05 / RESET REMINDERS

A quiet heads-up.

When available usage resets expire within 48 hours, a small reminder appears at the top of the app. Multiple resets across accounts are grouped into one popup.

  • At most two reminders per local calendar day.
  • At least four hours between reminders, including across midnight.
  • The limit is saved across app restarts.
  • Expired, used, undated or stale reset details do not trigger a reminder.

Click View resets to see the accounts, then open an account for exact expiry details. Dismiss the popup with ×. It also closes after a minute when you are not interacting with it. The app checks fresh usage periodically while running. On Mac, closing the window keeps the menu-bar app running; Quit exits it.

+
06 / UPDATE THE APP

Fresh app. Familiar accounts.

Quit Multi Codex, then run the update command for your platform. The updater verifies the download before replacing the application and preserves saved accounts and profile data.

For an update without reopening the app, add MULTI_CODEX_NO_LAUNCH=1 before bash on Linux/Mac, or add -NoLaunch to the Windows command. Keep a backup of important local data as part of your normal workflow.

07 / TROUBLESHOOTING

A few common questions.

The CLI closes immediately or says it has no complete local package.

A VS Code extension helper can be discovered in your PATH even though it cannot start the interactive CLI. Install the full official Codex CLI, then select its executable in Launch settings. Multi Codex skips known extension helpers for interactive launches.

Why does the CLI ask me to sign in?

Launch CLI from the saved account’s row to use that account’s sign-in. Running codex separately in a terminal uses its default home instead. If an account’s credentials have expired or been revoked, reconnect that account in Multi Codex.

macOS blocks the first open.

This release is unsigned. After attempting to open it, go to System Settings → Privacy & Security → Open Anyway and confirm Open. See Apple’s first-open instructions. Do not disable Gatekeeper.

Why is my terminal missing?

Only installed supported terminals appear in the dropdown. Install your terminal, reopen Launch settings, and select it. If your saved terminal has been removed, its selection shows a warning until you choose an installed replacement. On Mac, install supported apps in Applications or your user’s Applications folder.

I do not see a reset reminder.

The reminder needs fresh usage details containing available reset credits with a known expiry within 48 hours. It will also wait if you have already seen two today or the last reminder was less than four hours ago. Use an account’s Refresh button to check current details.

Still stuck? Report an issue → with the error and platform details. Leave out credentials and personal conversation data.

} diff --git a/next/app/globals.css b/next/app/globals.css index 2cc84e17..b4070f00 100644 --- a/next/app/globals.css +++ b/next/app/globals.css @@ -87,7 +87,7 @@ h1, h2, h3, p { margin-top: 0; } .getting-started h2, .notes-section h2 { font-size: 43px; letter-spacing: -1.8px; line-height: 1.1; font-weight: 600; } .getting-started > div > p:not(.eyebrow) { max-width: 320px; color: var(--muted); font-size: 15px; } .install-box { min-width: 0; padding: 20px; border: 1px solid var(--panel-border); border-radius: 10px; background: var(--panel); } -.install-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 19px; } +.install-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 19px; } .platform-tabs { display: flex; gap: 4px; padding: 3px; border-radius: 5px; background: var(--tabs); } .platform-tabs button { padding: 7px 14px; border-radius: 4px; color: var(--muted); background: transparent; font-size: 12px; } .platform-tabs button[aria-pressed="true"] { color: var(--ink); background: var(--paper); box-shadow: 0 1px 3px var(--tab-shadow); } @@ -318,3 +318,12 @@ code { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; } .extension-steps p { font-size: 14px; margin: 0; } @media (max-width: 900px) { .extension-section { grid-template-columns: 1fr; gap: 36px; } } @media (max-width: 600px) { .extension-section { padding-top: 40px; padding-bottom: 40px; } .site-footer > div { flex-wrap: wrap; row-gap: 12px; } } + +.markdown-guide { overflow-wrap: anywhere; } +.markdown-guide h1 { font-size: clamp(2rem, 4vw, 3.5rem); margin-bottom: 2rem; } +.markdown-guide h2, .markdown-guide h3 { margin-top: 2rem; } +.markdown-guide p, .markdown-guide ul, .markdown-guide ol { margin: 1rem 0; line-height: 1.7; } +.markdown-guide li { margin-left: 1.5rem; } +.markdown-guide pre { overflow-x: auto; padding: 1rem; background: var(--panel); } +.markdown-guide table { display: block; overflow-x: auto; border-collapse: collapse; } +.markdown-guide td, .markdown-guide th { padding: .75rem; border: 1px solid var(--border); text-align: left; } diff --git a/next/app/page.tsx b/next/app/page.tsx index f54467d5..016dfdde 100644 --- a/next/app/page.tsx +++ b/next/app/page.tsx @@ -11,11 +11,11 @@ export default function Home() {

YOUR ACCOUNTS. YOUR WORKSPACES.

A little order
for all your
Codex accounts.

Keep your logins together. Launch separate workspaces with the desktop app, or switch accounts in your current VS Code window.

-

LinuxApple Silicon MacOpen source

+

LinuxApple Silicon MacWindows x64Open source

ONE LAUNCHER, YOUR WHOLE LINEUP
Everything in its own space.Your default login stays yours.
01

Accounts stay separate.

Each account has its own saved sign-in, conversations and app data.

02

Launch your way.

VS Code, Codex desktop, or CLI in your favorite installed terminal.

03

Keep an eye on usage.

Limits at a glance, with quiet reminders before your usage resets expire.

SMALL SETUP. MORE ROOM TO WORK.

Up and running
in a few minutes.

Install the launcher. Add an account. Choose a folder and make it your own.

Follow the quick start
-

ALREADY IN VS CODE?

Your accounts.
The same window.

Use your saved desktop accounts inside VS Code, or start with the extension on its own. Choose an account to switch the current Codex panel and check its usage.

Install from Marketplace

Free pre-release · Linux x64 · macOS 26+ on Intel and Apple Silicon

  1. 01

    Install the extension

    Choose the pre-release of Multi Codex. The official Codex extension is required; the desktop app and Codex CLI are optional.

  2. 02

    Find your saved accounts

    Open Multi Codex in the activity bar. Existing desktop accounts appear automatically. Use + to add your first account if you’re starting fresh.

  3. 03

    Choose an account

    Click its row to use it in the current Codex window. Switching is blocked while Codex is working.

Extension setup and compatibility
+

ALREADY IN VS CODE?

Your accounts.
The same window.

Use your saved desktop accounts inside VS Code, or start with the extension on its own. Choose an account to switch the current Codex panel and check its usage.

Install from Marketplace

Free pre-release · Linux x64 · macOS 26+ on Intel and Apple Silicon · Windows x64

  1. 01

    Install the extension

    Choose the pre-release of Multi Codex. The official Codex extension is required; the desktop app and Codex CLI are optional.

  2. 02

    Find your saved accounts

    Open Multi Codex in the activity bar. Existing desktop accounts appear automatically. Use + to add your first account if you’re starting fresh.

  3. 03

    Choose an account

    Click its row to use it in the current Codex window. Switching is blocked while Codex is working.

Extension setup and compatibility

A FEW THOUGHTFUL DETAILS

Fits into your day.

Your terminal, your choice

Choose Kitty, Ghostty, Terminal, Konsole and other supported terminals in Launch settings.

A heads-up before resets expire

Available resets expiring within 48 hours appear together. At most twice a day, at least four hours apart.

Six palettes. Light and dark.

Sage, Ocean, Sand, Rose, Plum and Orange. A quieter home for your accounts, whatever the hour.

OPEN SOURCE, THROUGH AND THROUGH

Have a look under the hood.

View on GitHub
diff --git a/next/components/install-box.tsx b/next/components/install-box.tsx index 6c04bc76..7cdaa54f 100644 --- a/next/components/install-box.tsx +++ b/next/components/install-box.tsx @@ -3,7 +3,7 @@ import { useState } from "react" import { installCommand } from "@/lib/site" export function InstallBox({ update = false }: { update?: boolean }) { - const [platform, setPlatform] = useState<"linux" | "mac">("linux") + const [platform, setPlatform] = useState<"linux" | "mac" | "windows">("linux") const [copied, setCopied] = useState(false) const [error, setError] = useState(false) const command = installCommand(platform, update) @@ -12,10 +12,10 @@ export function InstallBox({ update = false }: { update?: boolean }) { catch { setError(true) } } return
- {(["linux", "mac"] as const).map(value => )} + {(["linux", "mac", "windows"] as const).map(value => )}
{command}
-

{platform === "linux" ? "Linux x86_64 · AppImage" : "Apple Silicon · macOS 26+ · Unsigned build, explicit opt-in"}

+

{platform === "linux" ? "Linux x86_64 · AppImage" : platform === "windows" ? "Windows x64 · PowerShell · Per-user installer" : "Apple Silicon · macOS 26+ · Unsigned build, explicit opt-in"}

{platform === "mac" ?

If macOS blocks the first open, use System Settings → Privacy & Security → Open Anyway. The installer preserves Gatekeeper protections.

: null} {copied ? "Command copied to clipboard." : ""} {error ?

Clipboard access is unavailable. Select and copy the command above.

: null} diff --git a/docs/extension-publishing.md b/next/content/guides/extension-publishing.md similarity index 69% rename from docs/extension-publishing.md rename to next/content/guides/extension-publishing.md index ac501b2f..66234c9a 100644 --- a/docs/extension-publishing.md +++ b/next/content/guides/extension-publishing.md @@ -1,6 +1,12 @@ # VS Code Marketplace publishing requirements -The owner authorized Marketplace publication under the existing publisher **russeldanielpaul**. [Multi Codex 0.1.1](https://marketplace.visualstudio.com/items?itemName=russeldanielpaul.multi-codex) is published as a free pre-release for Linux x64, macOS Apple Silicon and macOS Intel. All three packages passed native tests and Marketplace validation. Their public downloads match the tested artifacts byte-for-byte; see [release evidence and checksums](extension-marketplace-verification-2026-10-09.json). The [original 0.1.0 evidence](extension-marketplace-verification-2026-10-08.json) remains available. +## Version 0.2.0 manual upload + +The v1.4.0 desktop release includes four matching extension v0.2.0 pre-release VSIX files: Linux x64, macOS arm64, macOS x64 and Windows x64. Download them from [GitHub Releases](https://github.com/wrestle-R/multi-codex/releases/tag/v1.4.0). Upload each tested file as an update to the existing **russeldanielpaul.multi-codex** extension. Marketplace availability for v0.2.0 remains pending the owner’s manual upload and Marketplace validation. Use **Extensions: Install from VSIX…** when the matching version or platform is not available in Marketplace yet. + +## Previous Marketplace release + +The owner authorized Marketplace publication under the existing publisher **russeldanielpaul**. [Multi Codex 0.1.1](https://marketplace.visualstudio.com/items?itemName=russeldanielpaul.multi-codex) is published as a free pre-release for Linux x64, macOS Apple Silicon and macOS Intel. All three packages passed native tests and Marketplace validation. Their public downloads match the tested artifacts byte-for-byte; see [release evidence and checksums](https://github.com/wrestle-R/multi-codex/blob/main/release/evidence/extension-marketplace-verification-2026-10-09.json). The [original 0.1.0 evidence](https://github.com/wrestle-R/multi-codex/blob/main/release/evidence/extension-marketplace-verification-2026-10-08.json) remains available. Version 0.1.1 fixes desktop account discovery when VS Code inherits a managed account's `CODEX_HOME`, and replaces the welcome buttons with a native account list and inline usage. The first account selection attaches automatically. The corrected reader found all six accounts in the owner's existing desktop store without changing its metadata. Native tests on all three platforms verified live attachment, account switching, chat continuation, activity guards and recovery from storage/helper errors without restarting VS Code, either extension or the Codex backend. The website now links to the public Marketplace listing; the publisher management URL is for the owner only. @@ -14,7 +20,7 @@ There is no separate “VS Code account.” Marketplace uses your Microsoft acco ## Package -The extension needs a manifest, version, README, license, a PNG/JPEG Marketplace icon, and the compiled extension plus a native helper for the declared platform. Repository/support links, a changelog and the icon are included. This release targets Linux x64, macOS Apple Silicon and macOS Intel (macOS 26+), with separate `linux-x64`, `darwin-arm64` and `darwin-x64` VSIX packages under one extension ID. Windows, remote, browser and Linux ARM64 are unsupported. +The extension needs a manifest, version, README, license, a PNG/JPEG Marketplace icon, and the compiled extension plus a native helper for the declared platform. Repository/support links, a changelog and the icon are included. The extension targets Linux x64, macOS Apple Silicon and macOS Intel (macOS 26+), plus native Windows x64. Four target-specific VSIX files (`linux-x64`, `darwin-arm64`, `darwin-x64`, `win32-x64`) share one extension ID. Remote, browser, WSL and Linux ARM64 are unsupported. Filenames derive from `package.json`; use `npm run package:platform -- ` instead of typing a version into a workflow. The native package workflow builds and tests the extracted VSIX on each target operating system, including real VS Code/Codex attachment, identity routing, activity guards and startup restoration. It also checks native Mac Keychain access. Real browser sign-in, credential rotation, quotas and cloud permissions remain separate live-validation limits. The attachment uses private Node hooks and experimental Codex authentication, so publish it with an accurate pre-release description and its queue/API-key limitations. No saved account, auth file, token, local report, or development dependency belongs in the VSIX. @@ -32,7 +38,7 @@ Set `MULTI_CODEX_TEST_ENGINE` to the official VS Code extension's bundled engine ## Upload -For a manual upload, sign in to the publisher management page, choose **New extension → Visual Studio Code**, and upload a tested VSIX. Add the other tested platform packages as updates to the same extension and version. A CLI personal access token is unnecessary for this browser upload. Wait for Marketplace validation for every platform before treating the release as available on that platform. +For this manual update, sign in to [the existing publisher](https://marketplace.visualstudio.com/manage/publishers/russeldanielpaul), select **Multi Codex**, and upload each tested VSIX as an update to the same extension and version. Create a new extension only for an initial publication under a new extension ID. A CLI personal access token is unnecessary for this browser upload. Wait for Marketplace validation for every platform before treating the release as available on that platform. For command-line publishing, use `vsce` with an authorized Marketplace identity. Microsoft's current documentation recommends Microsoft Entra authentication for automation; global Azure DevOps PATs are scheduled to retire on December 1, 2026. If using an eligible PAT before then, its scope is **Marketplace: Manage**, and it must belong to an account authorized for that publisher. Keep credentials in a secret store, never in source or chat. diff --git a/next/content/guides/extension.md b/next/content/guides/extension.md new file mode 100644 index 00000000..3dab7555 --- /dev/null +++ b/next/content/guides/extension.md @@ -0,0 +1,111 @@ +# Multi Codex + +Manage saved accounts and change the account used by the **existing official Codex panel**. Account switches leave VS Code, Multi Codex, the Codex webview and its backend running. An existing local chat can continue using the newly selected account. + +- Add accounts using browser sign-in or import an existing Codex login. +- Select accounts from the activity bar or status bar. +- Check account usage without switching accounts. +- Share saved accounts with the Multi Codex desktop app, or use the extension on its own. +- Block account changes while the backend reports active work or uncertain activity. + +**Linux, macOS and Windows pre-release.** Platform packages target Linux x64, Apple Silicon Macs, Intel Macs and Windows x64. The Mac native helper requires macOS 26 or newer. The extension is free and open source. Your Codex subscription or API usage is billed separately. Multi Codex is an independent project and is not affiliated with or endorsed by OpenAI. + +This preview uses an experimental Codex backend authentication API. Live attachment uses a private Node process/stdio compatibility hook; later startups use Codex's development-only executable setting. It is not an official OpenAI extension API integration. This release targets local VS Code on Linux x64, macOS arm64/x64 and Windows x64. Remote SSH, containers, WSL, Linux ARM64 and vscode.dev are not supported yet. + +## Version 0.2.0 downloads + +All four platform packages are included in [Multi Codex v1.4.0 on GitHub](https://github.com/wrestle-R/multi-codex/releases/tag/v1.4.0). The owner uploads Marketplace updates separately. If v0.2.0 or your target platform is not listed yet, download its VSIX and use **Extensions: Install from VSIX…**. + +## Get started + +1. Install the official `openai.chatgpt` Codex extension. +2. Install the pre-release of **Multi Codex** by **russeldanielpaul**. VS Code selects the matching platform package. For a downloaded package, run **Extensions: Install from VSIX…** and choose the Linux x64, macOS Apple Silicon (`darwin-arm64`), macOS Intel (`darwin-x64`) or Windows x64 (`win32-x64`) VSIX for your machine. +3. Open Multi Codex in the activity bar. Existing desktop accounts appear automatically; use **+** in the Accounts toolbar to add an account if you are starting fresh. +4. Click an account row to connect switching automatically and use that account in the current official Codex panel. Hover over an account to check usage; the result appears beside its name. + +**On the verified Codex build, initial attachment and account changes need no restart or reload at all.** The bridge attaches to the existing backend without replacing its process or restarting either extension. An incompatible or ambiguous backend is refused; VS Code is never automatically reloaded. See the compatibility limits below. + +You do not need the Multi Codex desktop app, a separately installed Codex CLI, or the Codex desktop client. The extension uses the engine shipped inside the official VS Code extension. The VSIX contains the native account helper. + +The [website](https://multi-codex.vercel.app/docs/extension) is the primary guide. Matching platform VSIX files are available from [GitHub Releases](https://github.com/wrestle-R/multi-codex/releases/latest). Artifact filenames and protocol client versions come from the extension manifest. + +## Accounts and desktop synchronization + +Existing desktop accounts are discovered automatically from the same local store: + +VS Code launched by a desktop account can inherit that profile's `CODEX_HOME`. The extension keeps shared account storage separate from that managed profile and resolves the global home from desktop settings or the default home. Account loading failures appear in the panel; use **Refresh** to retry after correcting a setting. No account needs to be copied or added again. + +- Linux: `$XDG_DATA_HOME/multi-codex`, normally `~/.local/share/multi-codex`. +- macOS: `~/Library/Application Support/multi-codex`. +- Windows: `%APPDATA%\multi-codex`. + +Without desktop accounts, the list starts empty. **Add Account** supports browser sign-in, importing the current Codex login, and importing an auth JSON file. The same saved accounts become visible to the desktop app if it is installed later. Rename and removal are available from an account's context menu. + +The account list refreshes every 1.5 seconds and after account changes. Both clients read the same `profiles.json`, use the same profile IDs and share the existing OS keyring integration. There is no cloud synchronization service. `multiCodex.dataDirectory` and `multiCodex.globalCodexHome` can override the store and source Codex home using absolute paths. + +This repository's updated desktop service and the extension helper serialize metadata writes using a file lock. Active extension accounts hold shared leases that prevent deletion, credential replacement and cache cleanup. Older installed desktop releases do not understand these new locks: update/rebuild the desktop app before concurrently editing shared accounts there. + +The active account is shown in the status bar and account list. Check every saved account with **Multi Codex: Check All Accounts’ Usage**, or use an account's **Check This Account's Usage** context action without switching. Usage comes from Codex's backend and displays the returned usage windows; unavailable limits are not invented. API-key billing is not a ChatGPT usage window. + +## How switching works + +On first enable, Multi Codex locates exactly one child process for the official bundled engine inside the shared local extension host. A reversible stdio adapter routes that already-running process through the bridge while retaining its original protocol reader. The bridge probes its authentication identity before enabling account changes. No installed official-extension file is changed. + +The configured `chatgpt.cliExecutable` wrapper handles later normal startups, launching the **official bundled engine** with a private credential home and forwarding its normal protocol. Every normal startup reads the current launch’s `CODEX_HOME` (or the configured/default home), copies its file-based login and configuration into the private credential home, and keeps its resources and history available. Shared account storage uses the separate global home. The launcher resolves the currently installed official engine on each startup, including after extension updates. Both attachment modes use a private authenticated Unix socket (Linux/Mac) or Windows named pipe to connect the account picker to the bridge. + +When you select an account, the bridge: + +1. Takes an exclusive switching guard and refuses newly submitted work during authentication. +2. Protects the saved account with a lease and reads its current credential privately. +3. Asks the backend for every loaded thread and verifies each is idle. +4. Calls `account/login/start` with the selected external ChatGPT tokens. The isolated startup bridge also supports API keys. +5. Reads the adopted authentication identity and checks it against the selected account. +6. Shows a verified-login confirmation, releases the previous account's lease, and allows work again. + +Authentication failures and mismatched identities trigger verified rollback to the previous account. If rollback cannot be verified, switching stays blocked. The wrapper does not patch the installed official extension, overwrite its default auth file, invoke `workbench.action.reloadWindow`, or open another project window. + +Live ChatGPT attachment changes in-memory authentication without changing the original login file. API-key switching is refused in this mode because the backend would write its original credential store; it is available through the isolated wrapper on a later normal startup. Credentials in that wrapper are private to each backend. Existing session directories, resources and the SQLite history home remain available from the source Codex home. Selecting an account intentionally preserves the current conversation; this is **not a guarantee that prior conversation content is isolated between accounts**. Cloud conversations, organization-specific tools and permissions may depend on the selected account. Account selection applies to this running window. Each later startup begins with the current launch home’s login; old project selections are ignored. The status bar indicates when Codex is using the current home and shows its path in the tooltip. + +Expired external tokens are refreshed through a short-lived bundled backend using the saved account's home. Credential-operation locks serialize refresh/usage operations between extension windows. Browser sign-in and real token rotation require OpenAI connectivity; these live flows are not covered by the offline fixture tests. + +## Connection recovery + +Account selection waits for backend initialization. If the backend or protocol connection is lost, the extension reports the failure and keeps switching blocked. Save your work and reopen Codex or VS Code to start a fresh backend. Long chat responses no longer hit the former 8 MiB bridge limit. A failed connection is never treated as a verified idle session. + +## Switching guards and limits + +Switching is blocked while the bridge observes a submitted/running turn, active thread, subagent, compaction, command/process, approval, requested input, token refresh or known queued message. Concurrent switches are rejected. Loaded-thread inspection catches active chats outside the visible panel. Missing accounts, backend disconnection, unknown activity and opaque queue notifications fail closed. + +**Codex does not expose every queue held in the panel's UI.** The current IDE backend emits a queue-change notification without exposing a reliable queue-inspection method. That notification blocks switching conservatively. Purely UI-local queued follow-ups may be invisible until submitted. Clear queued follow-ups before changing accounts; the guard cannot promise atomic queue isolation without cooperation from the official extension. Uncertain queue state may require closing Codex's backend at a safe time before switching becomes available again. + +Live attachment was verified on Linux x64 with VS Code 1.140.0 against Codex extension 26.1002.51308 / backend 0.162.0-alpha.2 and Codex extension 26.930.61225 / backend 0.160.1. It relies on Node's private `_getActiveHandles` API and reversible stream method interception, not a public Codex integration contract. Future host or Codex changes can make it unavailable. Multiple matching processes, an API-key current login, broken framing, or failed identity verification stop attachment safely. A backend that cannot attach can use the isolated wrapper on its next normal startup; this fallback does not promise restart-free initial setup. + +Only this window's bridged backend is switched. Existing unbridged VS Code windows and other Codex clients keep their own accounts. This is not automatic quota-based account rotation. A Codex update may change experimental authentication or executable behavior; identity verification and activity checks must pass before a switch is accepted. + +To restore the bundled executable setting, run **Multi Codex: Disable Account Switching** and reopen VS Code when convenient. If uninstalling first, remove the `chatgpt.cliExecutable` setting manually. Disable/enable never triggers an automatic reload. + +## Development and local verification + +Use Node 22+ (Node 24 recommended), Rust and the platform's native build dependencies. + +```bash +cd extension +npm ci +npm run build:helper +npm test +npm run test:vscode +npm run test:attachment +npm run package -- --target linux-x64 --pre-release +``` + +`npm test` runs guard, protocol bridge, rollback, identity and concurrency tests. Set `MULTI_CODEX_TEST_ENGINE` to the official extension's bundled engine to include native account-store integration tests and to run `npm run test:engine`. + +`test:vscode` discovers the newest locally installed official extension, launches a disposable VS Code profile, creates synthetic accounts, and serves authentication routing, usage and model responses on loopback. Port 8000 must be available. `test:attachment` starts the official backend without a preconfigured bridge and verifies that enabling Multi Codex keeps the already-running process and both extensions alive; it also checks that the original login remains byte-for-byte unchanged. Both modes record stable extension-host/activation/backend IDs, test A → B → A, block switching during a real streaming backend turn and continue that same thread as B. It also inspects the rendered Codex webview via CDP. A **disposable copy** of the official extension gets a test-only fetch shim so its web requests go to the local fixture and its saved onboarding flags are initialized for an existing-user scenario; installed extension files are untouched. OAuth, first-use onboarding, cloud authorization, real quota enforcement and OS keyring availability on other systems still need live/platform verification. + +Local results and screenshots are written to `.test-results/`. Tests never install into your normal VS Code profile, publish a package or push Git changes. VS Code itself may perform its own built-in background checks; the Codex fixture uses synthetic credentials and local responses. + +The **VS Code extension packages** workflow builds each native helper on its target operating system. It tests the extracted VSIX in real VS Code with the official Codex extension, checks live attachment and isolated startup, and uploads installable packages only after those checks pass. These fixtures verify account routing and activity guards; they do not certify real OAuth, subscription limits or cloud permissions. + +## Support + +Report problems or request platform support in [GitHub Issues](https://github.com/wrestle-R/multi-codex/issues). Include your operating system, VS Code version, Codex extension version and the command that failed. Never include auth files, tokens or private conversation content. diff --git a/docs/platform-support.md b/next/content/guides/platform-support.md similarity index 64% rename from docs/platform-support.md rename to next/content/guides/platform-support.md index 70749c69..b4866b6f 100644 --- a/docs/platform-support.md +++ b/next/content/guides/platform-support.md @@ -1,6 +1,6 @@ -# Platform support for v1.3.6 +# Platform support -v1.3.6 adds isolated CLI launch, a color theme picker, plan ordering and automatic usage refresh. Linux and [macOS 26 Apple Silicon CI](https://github.com/wrestle-R/multi-codex/actions/runs/37562655635) passed, including native Mac Terminal, Keychain, VS Code, standalone launch and packaged startup/restart checks. Release packages undergo exact-asset installer verification before publication; broader package/distribution coverage remains open. Apple Developer ID signing and notarization are optional and are not configured. The Mac release requires explicit unsigned-install opt-in and may require first-open approval in macOS Privacy & Security. +Multi Codex v1.4 adds native Windows x64 support, a Mac menu-bar account picker, and a persistent maximized launcher. The VS Code extension uses separate manifest-derived packages for Linux x64, macOS arm64/x64, and Windows x64. Release publication requires native platform checks and validation of the exact downloadable packages. | Environment | Launch and desktop behavior | Evidence and remaining limits | | --- | --- | --- | @@ -8,19 +8,36 @@ v1.3.6 adds isolated CLI launch, a color theme picker, plan ordering and automat | Linux x86_64, GNOME Shell 45–51 | Optional picker through the bundled Shell extension | Contract/source tests passed; live GNOME and packaged Wayland/X11 validation pending | | Linux x86_64, KDE Plasma 6 | Optional picker through an on-demand KWin script | Isolated KWin 6.7.5 Wayland inventory and placement checks passed; packaged/X11 validation pending | | Other Linux desktops | Current-desktop launch when placement is unavailable | No desktop-placement support claim; distribution-specific package checks pending | +| Windows x64 | VS Code and CLI launch on the current desktop; no virtual-desktop picker | Native Windows GitHub runner exercises Credential Manager, private ACLs, locking, two-account VS Code/CLI guards, packaged VSIX switching, and exact NSIS install/update/restart. Fixtures exercise local isolation; real OAuth and token rotation require connectivity. | | Apple Silicon macOS 26 | VS Code or verified Codex app opens on the current desktop; no desktop picker or Spaces control | Authenticated isolation on a [Mac GitHub runner](https://github.com/wrestle-R/multi-codex/actions/runs/37345518314) and [native launch/package CI](https://github.com/wrestle-R/multi-codex/actions/runs/37359106358) passed; [real DMG install/update and native startup/restart](https://github.com/wrestle-R/multi-codex/actions/runs/37563569940) passed with account/chat fixtures; signing/notarization and wider functional checks pending | -Standalone isolation is enabled only for desktop app version `26.930.51102` on Linux x86_64 and macOS arm64. Other versions and architectures fail closed until tested. Linux releases use AppImage, DEB and RPM; their availability does not mean every distribution/version has been tested. macOS 27, Intel Macs and Windows have no validation claim. Linux requires its usual session bus, native libraries and credential-store dependencies. +Standalone isolation is enabled only for desktop app version `26.930.51102` on Linux x86_64 and macOS arm64, and the official Windows x64 MSIX app build `26.930.61225`. Other versions and architectures fail closed until tested. Linux releases use AppImage, DEB and RPM; their availability does not mean every distribution/version has been tested. The desktop launcher has no macOS 27 or Intel Mac validation claim; the extension separately supports both Mac architectures. Windows support targets native x64; WSL, Remote SSH, containers and Windows virtual-desktop placement are outside this scope. Linux requires its usual session bus, native libraries and credential-store dependencies. ## Launch settings and account data The first-run welcome saves platform and installed-app detection; installed apps are checked again later. Launch settings offers **VS Code**, **Codex**, **All available** and **CLI only**, disabling unavailable targets. The CLI button appears alongside the selected apps whenever a CLI is available. Existing launch preferences remain in place, and an unverified standalone version cannot be selected. -**Preferred folder + Browse** uses the built-in folder picker. The saved folder is its starting location on each launch; a different project can be chosen then. On Linux, **Show desktop picker** is on by default and can be turned off. The option does not appear on macOS. Mac launches continue on the current desktop after the folder choice. Executable paths and global Codex home are under Advanced. +**Preferred folder + Browse** uses the built-in folder picker. The saved folder is its starting location on each launch; a different project can be chosen then. On Linux, **Show desktop picker** is on by default and can be turned off. The option does not appear on macOS or Windows. Mac and Windows launches continue on the current desktop after the folder choice. Executable paths and global Codex home are under Advanced. -Each account keeps its existing `profiles//codex-home` for VS Code, standalone and CLI launches. Standalone desktop cookies and app state use a separate `desktop-data` directory for that account; VS Code keeps its separate user-data directory and extensions. The app preserves the normal browser HOME for sign-in links. A desktop sign-out stays signed out on restart and does not silently restore stale credentials from the keyring. Editing or deleting an account and cleaning its cache are blocked while an app or CLI is using it. The global auth file is not changed by an isolated launch. [Linux and Mac authenticated isolation evidence](releases/v1.3.5-auth-isolation.json) +Each account keeps its existing `profiles//codex-home` for VS Code, standalone and CLI launches. Standalone desktop cookies and app state use a separate `desktop-data` directory for that account; VS Code keeps its separate user-data directory and extensions. The app preserves the normal browser HOME for sign-in links. A desktop sign-out stays signed out on restart and does not silently restore stale credentials from the keyring. Editing or deleting an account and cleaning its cache are blocked while an app or CLI is using it. The global auth file is not changed by an isolated launch. [Linux and Mac authenticated isolation evidence](https://github.com/wrestle-R/multi-codex/blob/main/release/evidence/v1.3.5-auth-isolation.json) -Managed data stays in the existing platform data directory plus `multi-codex`: normally `$XDG_DATA_HOME/multi-codex` or `~/.local/share/multi-codex` on Linux, and `~/Library/Application Support/multi-codex` on macOS. Upgrades do not relocate profiles. Global import uses a nonempty inherited `CODEX_HOME`, then the saved global-home setting, then `~/.codex`. Override paths must be absolute executable files and are passed directly, never interpreted as shell commands. Empty executable fields restore automatic discovery; changing the global home requires restarting Multi Codex. +Managed data stays in the existing platform data directory plus `multi-codex`: normally `$XDG_DATA_HOME/multi-codex` or `~/.local/share/multi-codex` on Linux, and `~/Library/Application Support/multi-codex` on macOS, and `%APPDATA%\multi-codex` on Windows. Upgrades do not relocate profiles. Global import uses a nonempty inherited `CODEX_HOME`, then the saved global-home setting, then `~/.codex`. Override paths must be absolute executable files and are passed directly, never interpreted as shell commands. Empty executable fields restore automatic discovery; changing the global home requires restarting Multi Codex. + +## Mac menu bar and launcher window + +The menu-bar icon lists saved accounts. Each account submenu offers only installed supported targets: **Open VS Code**, **Open Codex**, and **Open CLI**. Launches reuse folder preferences and account safety guards. **Open Multi Codex** restores the maximized main window; **Refresh All Usage** checks all accounts. Closing the window leaves the menu-bar process running. **Quit Multi Codex** exits the launcher and leaves separately launched tools open. + +On Hyprland, the launcher monitors its own mapped window and restores maximization after desktop changes or accidental floating restores, without moving it or stealing focus. Other platforms restore maximization when the main window regains focus. The live Linux test covers three desktop switches and repair of the floating screenshot state. + +## Windows launch and installation + +Use the website's Windows PowerShell install/update commands or the release's `Multi.Codex__x64-setup.exe`. Installation is per-user. The scripts select the current release's Windows asset dynamically and verify its SHA-256 before running NSIS. Updates preserve account and conversation data, which remain outside the application directory. + +Windows accounts use Credential Manager and protected directories granting access to the current user and SYSTEM. The launcher and extension share `%APPDATA%\multi-codex`. The extension contains a native account helper, an executable startup wrapper and authenticated named pipes. It supports live account switching in local native VS Code without changing PowerShell's persistent execution policy. + +VS Code discovery prefers native `Code.exe`; CLI discovery resolves npm's native `codex.exe`. Advanced settings accept absolute `.exe` paths. PowerShell and Windows Terminal launches encode the command as UTF-16, quote literal paths, and clear inherited credential overrides before selecting the account home. Running-profile detection recognizes native editor arguments and the private encoded-command marker, preventing deletion or cache cleanup during use. + +Standalone Codex discovery reads the installed **OpenAI.Codex** MSIX location rather than guessing a WindowsApps path. Unverified desktop versions remain disabled. The official package passed native runner checks with two independent app windows and account homes, deletion/cache guards, unchanged peer/global credential files, and two cold starts. Windows runner credentials are inert fixtures; real browser sign-in, credential rotation and cloud permissions were not exercised by that test. ## macOS launch checks @@ -60,7 +77,7 @@ Plasma 6 uses the bundled `tauri/platform/kde/bridge.js`. Each request loads an ## Release validation -The tag workflow initially builds a draft and uploads checksums with the exact assets and matching install/update scripts. The [Publish tested release workflow](../.github/workflows/publish-validated.yml) requires the six `releaseChecks` in [the validation manifest](releases/v1.3.6-validation.json): Linux/Mac builds, installer verification and authenticated account isolation. It also downloads and verifies all four packages and both installer scripts against the recorded hashes before publishing as the latest stable release. The manifest records actual outcomes with environment, tester, time, evidence and SHA-256. Rebuilding, changing or signing an artifact changes what must be validated. +The tag workflow initially builds a draft and uploads checksums with the exact assets and matching install/update scripts. The [Publish tested release workflow](https://github.com/wrestle-R/multi-codex/blob/main/.github/workflows/publish-validated.yml) requires the platform `releaseChecks` in [the validation manifest](https://github.com/wrestle-R/multi-codex/blob/main/release/evidence/v1.4.0-validation.json): Linux/Mac/Windows builds and installer checks, account isolation, all four packaged extension targets, launcher behavior and the Mac menu. It also downloads and verifies all five app packages, four VSIX files and four installer scripts against the recorded hashes before publishing as the latest stable release. The manifest records actual outcomes with environment, tester, time, evidence and SHA-256. Rebuilding, changing or signing an artifact changes what must be validated. ```bash cd tauri diff --git a/docs/release-guidelines.md b/next/content/guides/release-guidelines.md similarity index 97% rename from docs/release-guidelines.md rename to next/content/guides/release-guidelines.md index 7fc8ffb1..53ce70be 100644 --- a/docs/release-guidelines.md +++ b/next/content/guides/release-guidelines.md @@ -25,7 +25,7 @@ The website at `/releases` presents selected user-facing updates grouped by majo - Use the published release date. Do not substitute the commit date or documentation update date. - Include a link to the version's full GitHub release notes. Preserve existing version permalinks when editing copy or layout. - Keep full package history on GitHub. Do not describe a selection of updates as every published version or invent entries to fill gaps. -- Put platform requirements, known limitations and links to validation evidence in the full notes under `docs/releases/`. +- Put platform requirements, known limitations and links to validation evidence in the full notes under `release/notes/`. ## Commit titles @@ -43,7 +43,7 @@ Use `feat` for capabilities, `fix` for defects, `docs` for documentation, `test` 1. Choose the next version based on the changes since the last stable release. 2. Synchronize the app package and lockfile, Tauri configuration, Rust package and lockfile, website package and lockfile, and `next/lib/site.ts`. The release workflow checks the app version against its tag. -3. Write full release notes in `docs/releases/v.md`, including installation changes, compatibility requirements and known limitations. Link evidence without claiming checks that have not passed. +3. Write full release notes in `release/notes/v.md`, including installation changes, compatibility requirements and known limitations. Link evidence without claiming checks that have not passed. 4. Complete the project's build, installer and release validation gates before publishing the stable release. 5. After publication, update `next/lib/releases.ts` with the actual publication timestamp and concise highlights. Add a series summary when a new major/minor series appears. 6. Align the README's current version and latest-change summary with the stable release, and verify the website badge, release-note links, version anchors and installation commands. diff --git a/next/lib/site.ts b/next/lib/site.ts index ff08c3ac..928f516b 100644 --- a/next/lib/site.ts +++ b/next/lib/site.ts @@ -1,8 +1,10 @@ +import { releaseHistory } from "./releases" export const repository = "https://github.com/wrestle-R/multi-codex" export const latestRelease = `${repository}/releases/latest` export const vscodeMarketplace = "https://marketplace.visualstudio.com/items?itemName=russeldanielpaul.multi-codex" -export const version = "1.3.8" -export const installCommand = (platform: "linux" | "mac", update = false) => { +export const version = releaseHistory[0].tag.slice(1) +export const installCommand = (platform: "linux" | "mac" | "windows", update = false) => { const action = update ? "update" : "install" + if (platform === "windows") return `Invoke-WebRequest ${latestRelease}/download/${action}-app.ps1 -OutFile "$env:TEMP/${action}-multi-codex.ps1"\npowershell -NoProfile -ExecutionPolicy Bypass -File "$env:TEMP/${action}-multi-codex.ps1"` return `curl -fsSL ${latestRelease}/download/${action}-app.sh -o /tmp/${action}-multi-codex.sh\n${platform === "mac" ? "MULTI_CODEX_ALLOW_UNSIGNED_MAC=1 " : ""}bash /tmp/${action}-multi-codex.sh` } diff --git a/next/package-lock.json b/next/package-lock.json index 2f509b18..5552ee2f 100644 --- a/next/package-lock.json +++ b/next/package-lock.json @@ -1,17 +1,19 @@ { "name": "multi-codex-docs", - "version": "1.3.8", + "version": "1.4.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "multi-codex-docs", - "version": "1.3.8", + "version": "1.4.0", "dependencies": { "botid": "1.5.11", "next": "16.3.8", "react": "19.2.0", - "react-dom": "19.2.0" + "react-dom": "19.2.0", + "react-markdown": "^10.1.0", + "remark-gfm": "^4.0.1" }, "devDependencies": { "@playwright/test": "1.56.1", @@ -751,6 +753,54 @@ "tslib": "^2.8.0" } }, + "node_modules/@types/debug": { + "version": "4.1.13", + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.13.tgz", + "integrity": "sha512-KSVgmQmzMwPlmtljOomayoR89W4FynCAi3E8PPs7vmDVPe84hT+vGPKkJfThkmXs0x0jAaa9U8uW8bbfyS2fWw==", + "license": "MIT", + "dependencies": { + "@types/ms": "*" + } + }, + "node_modules/@types/estree": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", + "license": "MIT" + }, + "node_modules/@types/estree-jsx": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/estree-jsx/-/estree-jsx-1.0.5.tgz", + "integrity": "sha512-52CcUVNFyfb1A2ALocQw/Dd1BQFNmSdkuC3BkZ6iqhdMfQz7JWOFRuJFloOzjk+6WijU56m9oKXFAXc7o3Towg==", + "license": "MIT", + "dependencies": { + "@types/estree": "*" + } + }, + "node_modules/@types/hast": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.5.tgz", + "integrity": "sha512-rp/ezSWaD1m44dPKICGhiskI13nVr7qTloFwDa/IYkhhf5nzwP+zIQcIJh3WIFSBOy/H1PzB40jPjMDksN4F+g==", + "license": "MIT", + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/@types/mdast": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz", + "integrity": "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==", + "license": "MIT", + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/@types/ms": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz", + "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==", + "license": "MIT" + }, "node_modules/@types/node": { "version": "22.19.0", "resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.0.tgz", @@ -758,115 +808,1269 @@ "dev": true, "license": "MIT", "dependencies": { - "undici-types": "~6.21.0" + "undici-types": "~6.21.0" + } + }, + "node_modules/@types/react": { + "version": "19.2.2", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.2.tgz", + "integrity": "sha512-6mDvHUFSjyT2B2yeNx2nUgMxh9LtOWvkhIU3uePn2I2oyNymUAX1NIsdgviM4CH+JSrp2D2hsMvJOkxY+0wNRA==", + "license": "MIT", + "dependencies": { + "csstype": "^3.0.2" + } + }, + "node_modules/@types/react-dom": { + "version": "19.2.2", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.2.tgz", + "integrity": "sha512-9KQPoO6mZCi7jcIStSnlOWn2nEF3mNmyr3rIAsGnAbQKYbRLyqmeSc39EVgtxXVia+LMT8j3knZLAZAh+xLmrw==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "@types/react": "^19.2.0" + } + }, + "node_modules/@types/unist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", + "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", + "license": "MIT" + }, + "node_modules/@ungap/structured-clone": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.4.0.tgz", + "integrity": "sha512-1mEZtMKPM09vDmQt5y7YvmN2+DFTP7Tg0EWXdic8/C6VRnpb33e4ghisCIE3WZjsE2N8mf+QV1Zqh7ZFYLWInQ==", + "license": "ISC" + }, + "node_modules/bail": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/bail/-/bail-2.0.2.tgz", + "integrity": "sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/baseline-browser-mapping": { + "version": "2.11.27", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.27.tgz", + "integrity": "sha512-ElY12DaROGuan+lMmZ8Cvo/ZUbXPe7Enc/9VU/b1T3Kp4dwytRcNdR8DoSJN5SNJT/CuvcCA0DHDVmMOCePdRQ==", + "license": "Apache-2.0", + "bin": { + "baseline-browser-mapping": "dist/cli.cjs" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/botid": { + "version": "1.5.11", + "resolved": "https://registry.npmjs.org/botid/-/botid-1.5.11.tgz", + "integrity": "sha512-KOO1A3+/vFVJk5aFoG3sNwiogKFPVR+x4aw4gQ1b2e0XoE+i5xp48/EZn+WqR07jRHeDGwHWQUOtV5WVm7xiww==", + "peerDependencies": { + "next": "*", + "react": "^18.0.0 || ^19.0.0" + }, + "peerDependenciesMeta": { + "next": { + "optional": true + }, + "react": { + "optional": true + } + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001814", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001814.tgz", + "integrity": "sha512-/Uaf1lAzr59XcMpW0o96WoEfr+VXK2OX4U9AgFoiSHsVJ4HppnIFUjtYzsyDH2+tgANaQb2/oxYGwCPapN1FpA==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "CC-BY-4.0" + }, + "node_modules/ccount": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", + "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz", + "integrity": "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities-html4": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-2.1.0.tgz", + "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities-legacy": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz", + "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-reference-invalid": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-2.0.1.tgz", + "integrity": "sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/client-only": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", + "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==", + "license": "MIT" + }, + "node_modules/comma-separated-tokens": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz", + "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/csstype": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", + "license": "MIT" + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decode-named-character-reference": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.3.0.tgz", + "integrity": "sha512-GtpQYB283KrPp6nRw50q3U9/VfOutZOe103qlN7BPP6Ad27xYnOIWv4lPzo8HCAL+mMZofJ9KEy30fq6MfaK6Q==", + "license": "MIT", + "dependencies": { + "character-entities": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "license": "Apache-2.0", + "optional": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/devlop": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/devlop/-/devlop-1.1.0.tgz", + "integrity": "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==", + "license": "MIT", + "dependencies": { + "dequal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/escape-string-regexp": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", + "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/estree-util-is-identifier-name": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/estree-util-is-identifier-name/-/estree-util-is-identifier-name-3.0.0.tgz", + "integrity": "sha512-hFtqIDZTIUZ9BXLb8y4pYGyk6+wekIivNVTcmvk8NoOh+VeRn5y6cEHzbURrWbfp1fIqdVipilzj+lfaadNZmg==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "license": "MIT" + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/hast-util-to-jsx-runtime": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/hast-util-to-jsx-runtime/-/hast-util-to-jsx-runtime-2.3.6.tgz", + "integrity": "sha512-zl6s8LwNyo1P9uw+XJGvZtdFF1GdAkOg8ujOw+4Pyb76874fLps4ueHXDhXWdk6YHQ6OgUtinliG7RsYvCbbBg==", + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/unist": "^3.0.0", + "comma-separated-tokens": "^2.0.0", + "devlop": "^1.0.0", + "estree-util-is-identifier-name": "^3.0.0", + "hast-util-whitespace": "^3.0.0", + "mdast-util-mdx-expression": "^2.0.0", + "mdast-util-mdx-jsx": "^3.0.0", + "mdast-util-mdxjs-esm": "^2.0.0", + "property-information": "^7.0.0", + "space-separated-tokens": "^2.0.0", + "style-to-js": "^1.0.0", + "unist-util-position": "^5.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-whitespace": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-3.0.0.tgz", + "integrity": "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/html-url-attributes": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/html-url-attributes/-/html-url-attributes-3.0.1.tgz", + "integrity": "sha512-ol6UPyBWqsrO6EJySPz2O7ZSr856WDrEzM5zMqp+FJJLGMW35cLYmmZnl0vztAZxRUoNZJFTCohfjuIJ8I4QBQ==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/inline-style-parser": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.2.7.tgz", + "integrity": "sha512-Nb2ctOyNR8DqQoR0OwRG95uNWIC0C1lCgf5Naz5H6Ji72KZ8OcFZLz2P5sNgwlyoJ8Yif11oMuYs5pBQa86csA==", + "license": "MIT" + }, + "node_modules/is-alphabetical": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.1.tgz", + "integrity": "sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-alphanumerical": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-2.0.1.tgz", + "integrity": "sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw==", + "license": "MIT", + "dependencies": { + "is-alphabetical": "^2.0.0", + "is-decimal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-decimal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-2.0.1.tgz", + "integrity": "sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-hexadecimal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-2.0.1.tgz", + "integrity": "sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-plain-obj": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", + "integrity": "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/longest-streak": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-3.1.0.tgz", + "integrity": "sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/markdown-table": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-3.0.4.tgz", + "integrity": "sha512-wiYz4+JrLyb/DqW2hkFJxP7Vd7JuTDm77fvbM8VfEQdmSMqcImWeeRbHwZjBjIFki/VaMK2BhFi7oUUZeM5bqw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/mdast-util-find-and-replace": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/mdast-util-find-and-replace/-/mdast-util-find-and-replace-3.0.3.tgz", + "integrity": "sha512-xPgpDNl0/OXHsI7TlaIs22lWnH3KlpvZdXG1ET/m/YT2Hhdkx8lJV4kLphE6l9simyM4KPDFBwas08BgEob6Jw==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "escape-string-regexp": "^5.0.0", + "unist-util-is": "^6.0.0", + "unist-util-visit-parents": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-from-markdown": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-2.1.0.tgz", + "integrity": "sha512-KRLgmPaP2H1ul2bpoJkOS+9pAcDAAj9Nu1mqLnh8NLeJG5tlvj42TH80PIGBpROWlRXLk0lDrWNuZCFy/tsB4A==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "mdast-util-to-string": "^4.0.0", + "micromark": "^4.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-decode-string": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unist-util-stringify-position": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm/-/mdast-util-gfm-3.1.0.tgz", + "integrity": "sha512-0ulfdQOM3ysHhCJ1p06l0b0VKlhU0wuQs3thxZQagjcjPrlFRqY215uZGHHJan9GEAXd9MbfPjFJz+qMkVR6zQ==", + "license": "MIT", + "dependencies": { + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-gfm-autolink-literal": "^2.0.0", + "mdast-util-gfm-footnote": "^2.0.0", + "mdast-util-gfm-strikethrough": "^2.0.0", + "mdast-util-gfm-table": "^2.0.0", + "mdast-util-gfm-task-list-item": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-autolink-literal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-autolink-literal/-/mdast-util-gfm-autolink-literal-2.0.1.tgz", + "integrity": "sha512-5HVP2MKaP6L+G6YaxPNjuL0BPrq9orG3TsrZ9YXbA3vDw/ACI4MEsnoDpn6ZNm7GnZgtAcONJyPhOP8tNJQavQ==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "ccount": "^2.0.0", + "devlop": "^1.0.0", + "mdast-util-find-and-replace": "^3.0.0", + "micromark-util-character": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-footnote": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-footnote/-/mdast-util-gfm-footnote-2.1.0.tgz", + "integrity": "sha512-sqpDWlsHn7Ac9GNZQMeUzPQSMzR6Wv0WKRNvQRg0KqHh02fpTz69Qc1QSseNX29bhz1ROIyNyxExfawVKTm1GQ==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.1.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-strikethrough": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-strikethrough/-/mdast-util-gfm-strikethrough-2.0.1.tgz", + "integrity": "sha512-OuJHqvr455pwu2OaOrir7dbzqs4jlWKOtlu9L6GjcIjjQwNyw02VntQsr/Ek6/A13vgnXfUhBekWRUP1OkNivw==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-table": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-table/-/mdast-util-gfm-table-2.0.0.tgz", + "integrity": "sha512-78UEvebzz/rJIxLvE7ZtDd/vIQ0RHv+3Mh5DR96p7cS7HsBhYIICDBCu8csTNWNO6tBWfqXPWekRuj2FNOGOZg==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "markdown-table": "^3.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-task-list-item": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-task-list-item/-/mdast-util-gfm-task-list-item-2.0.0.tgz", + "integrity": "sha512-IrtvNvjxC1o06taBAVJznEnkiHxLFTzgonUdy8hzFVeDun0uTjxxrRGVaNFqkU1wJR3RBPEfsxmU6jDWPofrTQ==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-mdx-expression": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-mdx-expression/-/mdast-util-mdx-expression-2.0.1.tgz", + "integrity": "sha512-J6f+9hUp+ldTZqKRSg7Vw5V6MqjATc+3E4gf3CFNcuZNWD8XdyI6zQ8GqH7f8169MM6P7hMBRDVGnn7oHB9kXQ==", + "license": "MIT", + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-mdx-jsx": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/mdast-util-mdx-jsx/-/mdast-util-mdx-jsx-3.2.0.tgz", + "integrity": "sha512-lj/z8v0r6ZtsN/cGNNtemmmfoLAFZnjMbNyLzBafjzikOM+glrjNHPlf6lQDOTccj9n5b0PPihEBbhneMyGs1Q==", + "license": "MIT", + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "ccount": "^2.0.0", + "devlop": "^1.1.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0", + "parse-entities": "^4.0.0", + "stringify-entities": "^4.0.0", + "unist-util-stringify-position": "^4.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-mdxjs-esm": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-mdxjs-esm/-/mdast-util-mdxjs-esm-2.0.1.tgz", + "integrity": "sha512-EcmOpxsZ96CvlP03NghtH1EsLtr0n9Tm4lPUJUBccV9RwUOneqSycg19n5HGzCf+10LozMRSObtVr3ee1WoHtg==", + "license": "MIT", + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-phrasing": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-phrasing/-/mdast-util-phrasing-4.1.0.tgz", + "integrity": "sha512-TqICwyvJJpBwvGAMZjj4J2n0X8QWp21b9l0o7eXyVJ25YNWYbJDVIyD1bZXE6WtV6RmKJVYmQAKWa0zWOABz2w==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-hast": { + "version": "13.2.1", + "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.1.tgz", + "integrity": "sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "@ungap/structured-clone": "^1.0.0", + "devlop": "^1.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "trim-lines": "^3.0.0", + "unist-util-position": "^5.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-markdown": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-2.2.0.tgz", + "integrity": "sha512-2Jn/ADrHFFyyniBMi0bncTbJqU78K3/TEYvzvwrWWzD9MYPUa/Gm4r3nOeKFQg/PDM5BsbDYdc8ackW4NTY6NA==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "longest-streak": "^3.0.0", + "mdast-util-phrasing": "^4.0.0", + "mdast-util-to-string": "^4.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-decode-string": "^2.0.0", + "micromark-util-html-tag-name": "^2.0.0", + "unist-util-visit": "^5.0.0", + "zwitch": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-4.0.0.tgz", + "integrity": "sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/micromark/-/micromark-4.0.3.tgz", + "integrity": "sha512-oGYfQzHSG5dOMovQcJ3fyTmZlWAWpi0XA0sJwJs+i6OT88o1+Jtw/8z0CmdowSLxGhhFK89rQ/oXph/wN02PNw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "@types/debug": "^4.0.0", + "debug": "^4.0.0", + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-core-commonmark": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-combine-extensions": "^2.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-edit-map": "^1.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-core-commonmark": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/micromark-core-commonmark/-/micromark-core-commonmark-2.0.4.tgz", + "integrity": "sha512-wxEeE8v8XVvOrxn1TZj74qYhAtTQsSqufHVS3uNVyT1MupXxhyaHk8/9xDNPh9BmL77QNDgWTkZ3RsYHB2ry7w==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-factory-destination": "^2.0.0", + "micromark-factory-label": "^2.0.0", + "micromark-factory-space": "^2.1.0", + "micromark-factory-title": "^2.0.0", + "micromark-factory-whitespace": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-edit-map": "^1.0.0", + "micromark-util-html-tag-name": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.3" + } + }, + "node_modules/micromark-extension-gfm": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm/-/micromark-extension-gfm-3.0.0.tgz", + "integrity": "sha512-vsKArQsicm7t0z2GugkCKtZehqUm31oeGBV/KVSorWSy8ZlNAv7ytjFhvaryUiCUJYqs+NoE6AFhpQvBTM6Q4w==", + "license": "MIT", + "dependencies": { + "micromark-extension-gfm-autolink-literal": "^2.0.0", + "micromark-extension-gfm-footnote": "^2.0.0", + "micromark-extension-gfm-strikethrough": "^2.0.0", + "micromark-extension-gfm-table": "^2.0.0", + "micromark-extension-gfm-tagfilter": "^2.0.0", + "micromark-extension-gfm-task-list-item": "^2.0.0", + "micromark-util-combine-extensions": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-autolink-literal": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-autolink-literal/-/micromark-extension-gfm-autolink-literal-2.1.0.tgz", + "integrity": "sha512-oOg7knzhicgQ3t4QCjCWgTmfNhvQbDDnJeVu9v81r7NltNCVmhPy1fJRX27pISafdjL+SVc4d3l48Gb6pbRypw==", + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-footnote": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-footnote/-/micromark-extension-gfm-footnote-2.1.0.tgz", + "integrity": "sha512-/yPhxI1ntnDNsiHtzLKYnE3vf9JZ6cAisqVDauhp4CEHxlb4uoOTxOCJ+9s51bIB8U1N1FJ1RXOKTIlD5B/gqw==", + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-core-commonmark": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-strikethrough": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-strikethrough/-/micromark-extension-gfm-strikethrough-2.1.0.tgz", + "integrity": "sha512-ADVjpOOkjz1hhkZLlBiYA9cR2Anf8F4HqZUO6e5eDcPQd0Txw5fxLzzxnEkSkfnD0wziSGiv7sYhk/ktvbf1uw==", + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-table": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-table/-/micromark-extension-gfm-table-2.1.2.tgz", + "integrity": "sha512-pRzm4kDTu0MjlmBkxmS9yYhw60nncfcEwu9NNdPFSQEFXS95ZKyIIyTSHu/o3ReBUrLKYEq+7YaXCRn/bPB4MA==", + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-tagfilter": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-tagfilter/-/micromark-extension-gfm-tagfilter-2.0.0.tgz", + "integrity": "sha512-xHlTOmuCSotIA8TW1mDIM6X2O1SiX5P9IuDtqGonFhEK0qgRI4yeC6vMxEV2dgyr2TiD+2PQ10o+cOhdVAcwfg==", + "license": "MIT", + "dependencies": { + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-task-list-item": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-task-list-item/-/micromark-extension-gfm-task-list-item-2.1.0.tgz", + "integrity": "sha512-qIBZhqxqI6fjLDYFTBIa4eivDMnP+OZqsNwmQ3xNLE4Cxwc+zfQEfbs6tzAo2Hjq+bh6q5F+Z8/cksrLFYWQQw==", + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-factory-destination": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-destination/-/micromark-factory-destination-2.0.1.tgz", + "integrity": "sha512-Xe6rDdJlkmbFRExpTOmRj9N3MaWmbAgdpSrBQvCFqhezUn4AHqJHbaEnfbVYYiexVSs//tqOdY/DxhjdCiJnIA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-label": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-label/-/micromark-factory-label-2.0.1.tgz", + "integrity": "sha512-VFMekyQExqIW7xIChcXn4ok29YE3rnuyveW3wZQWWqF4Nv9Wk5rgJ99KzPvHjkmPXF93FXIbBp6YdW3t71/7Vg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-space": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-factory-space/-/micromark-factory-space-2.1.0.tgz", + "integrity": "sha512-fS8hnLIjnjvdQIj39Geug8wWsR0HrYZ43KShKxNfwT7t2LOHo/LbWZEzEaSOjwtjdCsjoE6syHhonEzW0zv0+Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-title": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-title/-/micromark-factory-title-2.0.1.tgz", + "integrity": "sha512-5bZ+3CjhAd9eChYTHsjy6TGxpOFSKgKKJPJxr293jTbfry2KDoWkhBb6TcPVB4NmzaPhMs1Frm9AZH7OD4Cjzw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-whitespace": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-whitespace/-/micromark-factory-whitespace-2.0.1.tgz", + "integrity": "sha512-Ob0nuZ3PKt/n0hORHyvoD9uZhr+Za8sFoP+OnMcnWK5lngSzALgQYKMr9RJVOWLqQYuyn6ulqGWSXdwf6F80lQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-character": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.1.1.tgz", + "integrity": "sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-chunked": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-chunked/-/micromark-util-chunked-2.0.1.tgz", + "integrity": "sha512-QUNFEOPELfmvv+4xiNg2sRYeS/P84pTW0TCgP5zc9FpXetHY0ab7SxKyAQCNCc1eK0459uoLI1y5oO5Vc1dbhA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-classify-character": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-classify-character/-/micromark-util-classify-character-2.0.1.tgz", + "integrity": "sha512-K0kHzM6afW/MbeWYWLjoHQv1sgg2Q9EccHEDzSkxiP/EaagNzCm7T/WMKZ3rjMbvIpvBiZgwR3dKMygtA4mG1Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-combine-extensions": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-combine-extensions/-/micromark-util-combine-extensions-2.0.1.tgz", + "integrity": "sha512-OnAnH8Ujmy59JcyZw8JSbK9cGpdVY44NKgSM7E9Eh7DiLS2E9RNQf0dONaGDzEG9yjEl5hcqeIsj4hfRkLH/Bg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-chunked": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-decode-numeric-character-reference": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/micromark-util-decode-numeric-character-reference/-/micromark-util-decode-numeric-character-reference-2.0.2.tgz", + "integrity": "sha512-ccUbYk6CwVdkmCQMyr64dXz42EfHGkPQlBj5p7YVGzq8I7CtjXZJrubAYezf7Rp+bjPseiROqe7G6foFd+lEuw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-decode-string": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-decode-string/-/micromark-util-decode-string-2.0.1.tgz", + "integrity": "sha512-nDV/77Fj6eH1ynwscYTOsbK7rR//Uj0bZXBwJZRfaLEJ1iGBR6kIfNmlNqaqJf649EP0F3NWNdeJi03elllNUQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "decode-named-character-reference": "^1.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-edit-map": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/micromark-util-edit-map/-/micromark-util-edit-map-1.0.0.tgz", + "integrity": "sha512-Pa2ljlsEL6sVwFaYeyrOLSYbQt73JvGbPOYFq+9AElXiSnfI5Q4465RRZ1sHv7lDjDOnGRDDaqPXqClqWK/q1Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-types": "^2.0.0" } }, - "node_modules/@types/react": { - "version": "19.2.2", - "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.2.tgz", - "integrity": "sha512-6mDvHUFSjyT2B2yeNx2nUgMxh9LtOWvkhIU3uePn2I2oyNymUAX1NIsdgviM4CH+JSrp2D2hsMvJOkxY+0wNRA==", - "dev": true, + "node_modules/micromark-util-encode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-2.0.1.tgz", + "integrity": "sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-html-tag-name": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-html-tag-name/-/micromark-util-html-tag-name-2.0.1.tgz", + "integrity": "sha512-2cNEiYDhCWKI+Gs9T0Tiysk136SnR13hhO8yW6BGNyhOC4qYFnwF1nKfD3HFAIXA5c45RrIG1ub11GiXeYd1xA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-normalize-identifier": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-normalize-identifier/-/micromark-util-normalize-identifier-2.0.1.tgz", + "integrity": "sha512-sxPqmo70LyARJs0w2UclACPUUEqltCkJ6PhKdMIDuJ3gSf/Q+/GIe3WKl0Ijb/GyH9lOpUkRAO2wp0GVkLvS9Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], "license": "MIT", "dependencies": { - "csstype": "^3.0.2" + "micromark-util-symbol": "^2.0.0" } }, - "node_modules/@types/react-dom": { - "version": "19.2.2", - "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.2.tgz", - "integrity": "sha512-9KQPoO6mZCi7jcIStSnlOWn2nEF3mNmyr3rIAsGnAbQKYbRLyqmeSc39EVgtxXVia+LMT8j3knZLAZAh+xLmrw==", - "dev": true, + "node_modules/micromark-util-resolve-all": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-resolve-all/-/micromark-util-resolve-all-2.0.1.tgz", + "integrity": "sha512-VdQyxFWFT2/FGJgwQnJYbe1jjQoNTS4RjglmSjTUlpUMa95Htx9NHeYW4rGDJzbjvCsl9eLjMQwGeElsqmzcHg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], "license": "MIT", - "peerDependencies": { - "@types/react": "^19.2.0" + "dependencies": { + "micromark-util-types": "^2.0.0" } }, - "node_modules/baseline-browser-mapping": { - "version": "2.11.27", - "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.27.tgz", - "integrity": "sha512-ElY12DaROGuan+lMmZ8Cvo/ZUbXPe7Enc/9VU/b1T3Kp4dwytRcNdR8DoSJN5SNJT/CuvcCA0DHDVmMOCePdRQ==", - "license": "Apache-2.0", - "bin": { - "baseline-browser-mapping": "dist/cli.cjs" - }, - "engines": { - "node": ">=6.0.0" + "node_modules/micromark-util-sanitize-uri": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-2.0.1.tgz", + "integrity": "sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-symbol": "^2.0.0" } }, - "node_modules/botid": { - "version": "1.5.11", - "resolved": "https://registry.npmjs.org/botid/-/botid-1.5.11.tgz", - "integrity": "sha512-KOO1A3+/vFVJk5aFoG3sNwiogKFPVR+x4aw4gQ1b2e0XoE+i5xp48/EZn+WqR07jRHeDGwHWQUOtV5WVm7xiww==", - "peerDependencies": { - "next": "*", - "react": "^18.0.0 || ^19.0.0" - }, - "peerDependenciesMeta": { - "next": { - "optional": true + "node_modules/micromark-util-subtokenize": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-util-subtokenize/-/micromark-util-subtokenize-2.1.0.tgz", + "integrity": "sha512-XQLu552iSctvnEcgXw6+Sx75GflAPNED1qx7eBJ+wydBb2KCbRZe+NwvIEEMM83uml1+2WSXpBAcp9IUCgCYWA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" }, - "react": { - "optional": true + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" } + ], + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" } }, - "node_modules/caniuse-lite": { - "version": "1.0.30001814", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001814.tgz", - "integrity": "sha512-/Uaf1lAzr59XcMpW0o96WoEfr+VXK2OX4U9AgFoiSHsVJ4HppnIFUjtYzsyDH2+tgANaQb2/oxYGwCPapN1FpA==", + "node_modules/micromark-util-symbol": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-2.0.1.tgz", + "integrity": "sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q==", "funding": [ { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" }, { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-types": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-2.0.3.tgz", + "integrity": "sha512-oxB2Ik03hI0gv+VNn9tnh1t1YEe9MDPptViAEgfdf3YQHsn0pzGTgCdlSCJXcwhqm8phaEuM7zeEu3QQzVBrPg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" }, { - "type": "github", - "url": "https://github.com/sponsors/ai" + "type": "OpenCollective", + "url": "https://opencollective.com/unified" } ], - "license": "CC-BY-4.0" - }, - "node_modules/client-only": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", - "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==", "license": "MIT" }, - "node_modules/csstype": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", - "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", - "dev": true, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "license": "MIT" }, - "node_modules/detect-libc": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", - "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", - "license": "Apache-2.0", - "optional": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "hasInstallScript": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, "node_modules/nanoid": { "version": "3.3.20", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz", @@ -938,6 +2142,31 @@ } } }, + "node_modules/parse-entities": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-4.0.2.tgz", + "integrity": "sha512-GG2AQYWoLgL877gQIKeRPGO1xF9+eG1ujIb5soS5gPvLQ1y2o8FL90w2QWNdf9I361Mpp7726c+lj3U0qK1uGw==", + "license": "MIT", + "dependencies": { + "@types/unist": "^2.0.0", + "character-entities-legacy": "^3.0.0", + "character-reference-invalid": "^2.0.0", + "decode-named-character-reference": "^1.0.0", + "is-alphanumerical": "^2.0.0", + "is-decimal": "^2.0.0", + "is-hexadecimal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/parse-entities/node_modules/@types/unist": { + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.11.tgz", + "integrity": "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==", + "license": "MIT" + }, "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", @@ -1004,6 +2233,16 @@ "node": "^10 || ^12 || >=14" } }, + "node_modules/property-information": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.2.0.tgz", + "integrity": "sha512-IAtzIB6sUiWaJYrX9smp3V46pBGbBeLFRGdh25kg1334VcBlD8HzhPeNIWQH9zhGmo2itIe25EHt9dQP7G5hmg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/react": { "version": "19.2.0", "resolved": "https://registry.npmjs.org/react/-/react-19.2.0.tgz", @@ -1025,6 +2264,99 @@ "react": "^19.2.0" } }, + "node_modules/react-markdown": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/react-markdown/-/react-markdown-10.1.0.tgz", + "integrity": "sha512-qKxVopLT/TyA6BX3Ue5NwabOsAzm0Q7kAPwq6L+wWDwisYs7R8vZ0nRXqq6rkueboxpkjvLGU9fWifiX/ZZFxQ==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "hast-util-to-jsx-runtime": "^2.0.0", + "html-url-attributes": "^3.0.0", + "mdast-util-to-hast": "^13.0.0", + "remark-parse": "^11.0.0", + "remark-rehype": "^11.0.0", + "unified": "^11.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "peerDependencies": { + "@types/react": ">=18", + "react": ">=18" + } + }, + "node_modules/remark-gfm": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-gfm/-/remark-gfm-4.0.1.tgz", + "integrity": "sha512-1quofZ2RQ9EWdeN34S79+KExV1764+wCUGop5CPL1WGdD0ocPpu91lzPGbwWMECpEpd42kJGQwzRfyov9j4yNg==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-gfm": "^3.0.0", + "micromark-extension-gfm": "^3.0.0", + "remark-parse": "^11.0.0", + "remark-stringify": "^11.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-parse": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-11.0.0.tgz", + "integrity": "sha512-FCxlKLNGknS5ba/1lmpYijMUzX2esxW5xQqjWxw2eHFfS2MSdaHVINFmhjo+qN1WhZhNimq0dZATN9pH0IDrpA==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-from-markdown": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-rehype": { + "version": "11.1.2", + "resolved": "https://registry.npmjs.org/remark-rehype/-/remark-rehype-11.1.2.tgz", + "integrity": "sha512-Dh7l57ianaEoIpzbp0PC9UKAdCSVklD8E5Rpw7ETfbTl3FqcOOgq5q2LVDhgGCkaBv7p24JXikPdvhhmHvKMsw==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "mdast-util-to-hast": "^13.0.0", + "unified": "^11.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-stringify": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-11.0.0.tgz", + "integrity": "sha512-1OSmLd3awB/t8qdoEOMazZkNsfVTeY4fTsgzcQFdXNq8ToTN4ZGwrMnlda4K6smTFKD+GRV6O48i6Z4iKgPPpw==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-to-markdown": "^2.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/scheduler": { "version": "0.27.0", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz", @@ -1103,6 +2435,48 @@ "node": ">=0.10.0" } }, + "node_modules/space-separated-tokens": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz", + "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/stringify-entities": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz", + "integrity": "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==", + "license": "MIT", + "dependencies": { + "character-entities-html4": "^2.0.0", + "character-entities-legacy": "^3.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/style-to-js": { + "version": "1.1.21", + "resolved": "https://registry.npmjs.org/style-to-js/-/style-to-js-1.1.21.tgz", + "integrity": "sha512-RjQetxJrrUJLQPHbLku6U/ocGtzyjbJMP9lCNK7Ag0CNh690nSH8woqWH9u16nMjYBAok+i7JO1NP2pOy8IsPQ==", + "license": "MIT", + "dependencies": { + "style-to-object": "1.0.14" + } + }, + "node_modules/style-to-object": { + "version": "1.0.14", + "resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-1.0.14.tgz", + "integrity": "sha512-LIN7rULI0jBscWQYaSswptyderlarFkjQ+t79nzty8tcIAceVomEVlLzH5VP4Cmsv6MtKhs7qaAiwlcp+Mgaxw==", + "license": "MIT", + "dependencies": { + "inline-style-parser": "0.2.7" + } + }, "node_modules/styled-jsx": { "version": "5.1.6", "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.6.tgz", @@ -1126,6 +2500,26 @@ } } }, + "node_modules/trim-lines": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz", + "integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/trough": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/trough/-/trough-2.2.0.tgz", + "integrity": "sha512-tmMpK00BjZiUyVyvrBK7knerNgmgvcV/KLVyuma/SC+TQN167GrMRciANTz09+k3zW8L8t60jWO1GpfkZdjTaw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/tslib": { "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", @@ -1152,6 +2546,131 @@ "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", "dev": true, "license": "MIT" + }, + "node_modules/unified": { + "version": "11.0.5", + "resolved": "https://registry.npmjs.org/unified/-/unified-11.0.5.tgz", + "integrity": "sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "bail": "^2.0.0", + "devlop": "^1.0.0", + "extend": "^3.0.0", + "is-plain-obj": "^4.0.0", + "trough": "^2.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-is": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.1.tgz", + "integrity": "sha512-LsiILbtBETkDz8I9p1dQ0uyRUWuaQzd/cuEeS1hoRSyW5E5XGmTzlwY1OrNzzakGowI9Dr/I8HVaw4hTtnxy8g==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-position": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-5.0.0.tgz", + "integrity": "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-stringify-position": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-4.0.0.tgz", + "integrity": "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-5.1.0.tgz", + "integrity": "sha512-m+vIdyeCOpdr/QeQCu2EzxX/ohgS8KbnPDgFni4dQsfSCtpz8UqDyY5GjRru8PDKuYn7Fq19j1CQ+nJSsGKOzg==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0", + "unist-util-visit-parents": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit-parents": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-6.0.2.tgz", + "integrity": "sha512-goh1s1TBrqSqukSc8wrjwWhL0hiJxgA8m4kFxGlQ+8FYQ3C/m11FcTs4YYem7V664AhHVvgoQLk890Ssdsr2IQ==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vfile": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz", + "integrity": "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vfile-message": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-4.0.3.tgz", + "integrity": "sha512-QTHzsGd1EhbZs4AsQ20JX1rC3cOlt/IWJruk893DfLRr57lcnOeMaWG4K0JrRta4mIJZKth2Au3mM3u03/JWKw==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-stringify-position": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/zwitch": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", + "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } } } } diff --git a/next/package.json b/next/package.json index 3ba18015..5aba3608 100644 --- a/next/package.json +++ b/next/package.json @@ -1,6 +1,6 @@ { "name": "multi-codex-docs", - "version": "1.3.8", + "version": "1.4.0", "private": true, "scripts": { "dev": "next dev", @@ -13,7 +13,9 @@ "botid": "1.5.11", "next": "16.3.8", "react": "19.2.0", - "react-dom": "19.2.0" + "react-dom": "19.2.0", + "react-markdown": "^10.1.0", + "remark-gfm": "^4.0.1" }, "devDependencies": { "@playwright/test": "1.56.1", diff --git a/next/tests/site.spec.ts b/next/tests/site.spec.ts index 9d5503d5..0b578231 100644 --- a/next/tests/site.spec.ts +++ b/next/tests/site.spec.ts @@ -101,3 +101,23 @@ test("screenshots load and troubleshooting answers and missing pages are usable" await page.getByRole("link", { name: /Back to Multi Codex/ }).click() await expect(page).toHaveURL(/\/$/) }) + + +test("Windows commands, menu-bar behavior and migrated detailed guides are accessible", async ({ page }) => { + await page.goto("/docs") + const install = page.locator("#installation .install-box") + await install.getByRole("button", { name: "Windows", exact: true }).click() + await expect(install.locator("code")).toContainText("install-app.ps1") + await expect(install.locator("code")).toContainText("$env:TEMP") + await expect(page.locator("#menu-bar")).toContainText("Quit Multi Codex") + await expect(page.locator("#vscode")).toContainText("every saved account") + for (const guide of ["platform-support", "extension", "extension-publishing", "release-guidelines"]) { + await page.goto(`/docs/${guide}`) + await expect(page.getByRole("heading", { level: 1 })).toBeVisible() + await expect(page.getByRole("navigation", { name: "Detailed guides" })).toBeVisible() + for (const width of [320,768,1440]) { + await page.setViewportSize({ width, height: 900 }) + expect(await page.evaluate(() => document.documentElement.scrollWidth)).toBe(width) + } + } +}) diff --git a/next/tests/theme.spec.ts b/next/tests/theme.spec.ts index 8cda2ae9..2f134a74 100644 --- a/next/tests/theme.spec.ts +++ b/next/tests/theme.spec.ts @@ -89,7 +89,7 @@ test("docs explain Linux-only desktop placement and show screenshots matching a await page.emulateMedia({ colorScheme: "light" }) await page.goto("/docs#launching") await expect(page.locator("#launching")).toContainText("Desktop selection is Linux-only") - await expect(page.locator("#launching")).toContainText("On macOS, the app launches after you choose a folder.") + await expect(page.locator("#launching")).toContainText("On macOS and Windows, the app launches on the current desktop after you choose a folder.") await expect(page.locator("#terminals")).toContainText("installed terminals only") const screenshot = page.getByRole("img", { name: "Multi Codex Linux desktop selection interface" }) await expect(screenshot).toHaveAttribute("src", /workspace-light/) diff --git a/docs/extension-0.1.3-packages.json b/release/evidence/extension-0.1.3-packages.json similarity index 100% rename from docs/extension-0.1.3-packages.json rename to release/evidence/extension-0.1.3-packages.json diff --git a/docs/extension-marketplace-verification-2026-10-08.json b/release/evidence/extension-marketplace-verification-2026-10-08.json similarity index 100% rename from docs/extension-marketplace-verification-2026-10-08.json rename to release/evidence/extension-marketplace-verification-2026-10-08.json diff --git a/docs/extension-marketplace-verification-2026-10-09.json b/release/evidence/extension-marketplace-verification-2026-10-09.json similarity index 100% rename from docs/extension-marketplace-verification-2026-10-09.json rename to release/evidence/extension-marketplace-verification-2026-10-09.json diff --git a/docs/releases/screenshots/v1.3.0/desktop-picker-dark.png b/release/evidence/screenshots/v1.3.0/desktop-picker-dark.png similarity index 100% rename from docs/releases/screenshots/v1.3.0/desktop-picker-dark.png rename to release/evidence/screenshots/v1.3.0/desktop-picker-dark.png diff --git a/docs/releases/screenshots/v1.3.0/desktop-picker-light.png b/release/evidence/screenshots/v1.3.0/desktop-picker-light.png similarity index 100% rename from docs/releases/screenshots/v1.3.0/desktop-picker-light.png rename to release/evidence/screenshots/v1.3.0/desktop-picker-light.png diff --git a/docs/releases/screenshots/v1.3.0/desktop-picker-narrow.png b/release/evidence/screenshots/v1.3.0/desktop-picker-narrow.png similarity index 100% rename from docs/releases/screenshots/v1.3.0/desktop-picker-narrow.png rename to release/evidence/screenshots/v1.3.0/desktop-picker-narrow.png diff --git a/docs/releases/screenshots/v1.3.0/launch-settings.png b/release/evidence/screenshots/v1.3.0/launch-settings.png similarity index 100% rename from docs/releases/screenshots/v1.3.0/launch-settings.png rename to release/evidence/screenshots/v1.3.0/launch-settings.png diff --git a/docs/releases/v1.3.0-validation.json b/release/evidence/v1.3.0-validation.json similarity index 100% rename from docs/releases/v1.3.0-validation.json rename to release/evidence/v1.3.0-validation.json diff --git a/docs/releases/v1.3.1-validation.json b/release/evidence/v1.3.1-validation.json similarity index 100% rename from docs/releases/v1.3.1-validation.json rename to release/evidence/v1.3.1-validation.json diff --git a/docs/releases/v1.3.2-validation.json b/release/evidence/v1.3.2-validation.json similarity index 100% rename from docs/releases/v1.3.2-validation.json rename to release/evidence/v1.3.2-validation.json diff --git a/docs/releases/v1.3.3-validation.json b/release/evidence/v1.3.3-validation.json similarity index 100% rename from docs/releases/v1.3.3-validation.json rename to release/evidence/v1.3.3-validation.json diff --git a/docs/releases/v1.3.4-validation.json b/release/evidence/v1.3.4-validation.json similarity index 100% rename from docs/releases/v1.3.4-validation.json rename to release/evidence/v1.3.4-validation.json diff --git a/docs/releases/v1.3.5-auth-isolation.json b/release/evidence/v1.3.5-auth-isolation.json similarity index 100% rename from docs/releases/v1.3.5-auth-isolation.json rename to release/evidence/v1.3.5-auth-isolation.json diff --git a/docs/releases/v1.3.5-installer-validation.json b/release/evidence/v1.3.5-installer-validation.json similarity index 100% rename from docs/releases/v1.3.5-installer-validation.json rename to release/evidence/v1.3.5-installer-validation.json diff --git a/docs/releases/v1.3.5-linux-installer-validation.json b/release/evidence/v1.3.5-linux-installer-validation.json similarity index 100% rename from docs/releases/v1.3.5-linux-installer-validation.json rename to release/evidence/v1.3.5-linux-installer-validation.json diff --git a/docs/releases/v1.3.5-local-validation.json b/release/evidence/v1.3.5-local-validation.json similarity index 100% rename from docs/releases/v1.3.5-local-validation.json rename to release/evidence/v1.3.5-local-validation.json diff --git a/docs/releases/v1.3.5-publication-validation.json b/release/evidence/v1.3.5-publication-validation.json similarity index 100% rename from docs/releases/v1.3.5-publication-validation.json rename to release/evidence/v1.3.5-publication-validation.json diff --git a/docs/releases/v1.3.5-validation.json b/release/evidence/v1.3.5-validation.json similarity index 97% rename from docs/releases/v1.3.5-validation.json rename to release/evidence/v1.3.5-validation.json index 43e6c394..d70a157a 100644 --- a/docs/releases/v1.3.5-validation.json +++ b/release/evidence/v1.3.5-validation.json @@ -103,7 +103,7 @@ "publishedAt": "2026-10-06T06:28:44Z", "publicationRun": "https://github.com/wrestle-R/multi-codex/actions/runs/37423934315", "latestReleaseVerified": true, - "publicInstallerEvidence": "docs/releases/v1.3.5-publication-validation.json" + "publicInstallerEvidence": "release/evidence/v1.3.5-publication-validation.json" }, "releaseChecks": { "linux-build": { @@ -137,7 +137,7 @@ "linux-isolation": { "status": "passed", "environment": "Linux x86_64; Codex desktop 26.930.51102", - "evidence": "docs/releases/v1.3.5-auth-isolation.json", + "evidence": "release/evidence/v1.3.5-auth-isolation.json", "testedAt": "2026-10-06T00:05:50+05:30", "testedBy": "Codex automation with user sign-in" }, diff --git a/docs/releases/v1.3.6-installer-validation.json b/release/evidence/v1.3.6-installer-validation.json similarity index 100% rename from docs/releases/v1.3.6-installer-validation.json rename to release/evidence/v1.3.6-installer-validation.json diff --git a/docs/releases/v1.3.6-linux-installer-validation.json b/release/evidence/v1.3.6-linux-installer-validation.json similarity index 100% rename from docs/releases/v1.3.6-linux-installer-validation.json rename to release/evidence/v1.3.6-linux-installer-validation.json diff --git a/docs/releases/v1.3.6-linux-native-validation.json b/release/evidence/v1.3.6-linux-native-validation.json similarity index 100% rename from docs/releases/v1.3.6-linux-native-validation.json rename to release/evidence/v1.3.6-linux-native-validation.json diff --git a/docs/releases/v1.3.6-local-validation.json b/release/evidence/v1.3.6-local-validation.json similarity index 100% rename from docs/releases/v1.3.6-local-validation.json rename to release/evidence/v1.3.6-local-validation.json diff --git a/docs/releases/v1.3.6-validation.json b/release/evidence/v1.3.6-validation.json similarity index 98% rename from docs/releases/v1.3.6-validation.json rename to release/evidence/v1.3.6-validation.json index 5e580cb2..16ef02ba 100644 --- a/docs/releases/v1.3.6-validation.json +++ b/release/evidence/v1.3.6-validation.json @@ -103,7 +103,7 @@ "publishedAt": "2026-10-07T02:49:39Z", "publicationRun": "https://github.com/wrestle-R/multi-codex/actions/runs/37563811833", "latestReleaseVerified": true, - "localUpgradeEvidence": "docs/releases/v1.3.6-local-validation.json" + "localUpgradeEvidence": "release/evidence/v1.3.6-local-validation.json" }, "releaseChecks": { "linux-build": { @@ -137,7 +137,7 @@ "linux-isolation": { "status": "passed", "environment": "Linux x86_64; Codex desktop 26.930.51102", - "evidence": "docs/releases/v1.3.5-auth-isolation.json", + "evidence": "release/evidence/v1.3.5-auth-isolation.json", "testedAt": "2026-10-06T00:05:50+05:30", "testedBy": "Codex automation with user sign-in", "carriedForwardFrom": "v1.3.5", diff --git a/docs/releases/v1.3.7-linux-installer-validation.json b/release/evidence/v1.3.7-linux-installer-validation.json similarity index 100% rename from docs/releases/v1.3.7-linux-installer-validation.json rename to release/evidence/v1.3.7-linux-installer-validation.json diff --git a/docs/releases/v1.3.7-linux-native-validation.json b/release/evidence/v1.3.7-linux-native-validation.json similarity index 100% rename from docs/releases/v1.3.7-linux-native-validation.json rename to release/evidence/v1.3.7-linux-native-validation.json diff --git a/docs/releases/v1.3.7-local-validation.json b/release/evidence/v1.3.7-local-validation.json similarity index 98% rename from docs/releases/v1.3.7-local-validation.json rename to release/evidence/v1.3.7-local-validation.json index c4662b72..707b3e28 100644 --- a/docs/releases/v1.3.7-local-validation.json +++ b/release/evidence/v1.3.7-local-validation.json @@ -112,5 +112,5 @@ "previousAppImageRetained": true, "note": "Compared against the immediate pre-upgrade baseline; intentional CLI executable and terminal preference changes were backed up separately." }, - "websiteValidation": "docs/releases/v1.3.7-website-validation.json" + "websiteValidation": "release/evidence/v1.3.7-website-validation.json" } diff --git a/docs/releases/v1.3.7-validation.json b/release/evidence/v1.3.7-validation.json similarity index 97% rename from docs/releases/v1.3.7-validation.json rename to release/evidence/v1.3.7-validation.json index b69e4d76..b1252eea 100644 --- a/docs/releases/v1.3.7-validation.json +++ b/release/evidence/v1.3.7-validation.json @@ -104,8 +104,8 @@ "latestReleaseVerifiedAt": "2026-10-07T05:33:24.717285+00:00", "publishRun": "https://github.com/wrestle-R/multi-codex/actions/runs/37576313561", "localUpgrade": "passed", - "dataPreservation": "docs/releases/v1.3.7-local-validation.json", - "websiteValidation": "docs/releases/v1.3.7-website-validation.json" + "dataPreservation": "release/evidence/v1.3.7-local-validation.json", + "websiteValidation": "release/evidence/v1.3.7-website-validation.json" }, "releaseChecks": { "linux-build": { @@ -139,7 +139,7 @@ "linux-isolation": { "status": "passed", "environment": "Linux x86_64; Codex desktop 26.930.51102", - "evidence": "docs/releases/v1.3.5-auth-isolation.json", + "evidence": "release/evidence/v1.3.5-auth-isolation.json", "testedAt": "2026-10-06T00:05:50+05:30", "testedBy": "Codex automation with user sign-in", "carriedForwardFrom": "v1.3.5", diff --git a/docs/releases/v1.3.7-website-validation.json b/release/evidence/v1.3.7-website-validation.json similarity index 100% rename from docs/releases/v1.3.7-website-validation.json rename to release/evidence/v1.3.7-website-validation.json diff --git a/docs/releases/v1.3.8-installer-validation.json b/release/evidence/v1.3.8-installer-validation.json similarity index 100% rename from docs/releases/v1.3.8-installer-validation.json rename to release/evidence/v1.3.8-installer-validation.json diff --git a/docs/releases/v1.3.8-linux-installer-validation.json b/release/evidence/v1.3.8-linux-installer-validation.json similarity index 100% rename from docs/releases/v1.3.8-linux-installer-validation.json rename to release/evidence/v1.3.8-linux-installer-validation.json diff --git a/docs/releases/v1.3.8-local-validation.json b/release/evidence/v1.3.8-local-validation.json similarity index 96% rename from docs/releases/v1.3.8-local-validation.json rename to release/evidence/v1.3.8-local-validation.json index 634c921c..84066e81 100644 --- a/docs/releases/v1.3.8-local-validation.json +++ b/release/evidence/v1.3.8-local-validation.json @@ -25,7 +25,7 @@ "liveChromiumAndMobile": 20 }, "debPackageVersion": "1.3.8", - "settingsBrowserChecks": "docs/releases/v1.3.8-settings-validation.json", + "settingsBrowserChecks": "release/evidence/v1.3.8-settings-validation.json", "localInstallerChecks": { "tag": "v1.3.8", "appImageSha256": "75608cbfce6c6bde5716124d1413b16baa840f611fbbbe20e6c510dc99a07a41", @@ -67,7 +67,7 @@ "authenticatedDesktopIsolation": "not tested", "signingAndNotarization": "optional; not verified by this startup smoke test" }, - "websiteValidation": "docs/releases/v1.3.8-website-validation.json", + "websiteValidation": "release/evidence/v1.3.8-website-validation.json", "installerRun": "https://github.com/wrestle-R/multi-codex/actions/runs/37734192047", "linuxCiInstallerChecks": { "tag": "v1.3.8", diff --git a/docs/releases/v1.3.8-settings-validation.json b/release/evidence/v1.3.8-settings-validation.json similarity index 100% rename from docs/releases/v1.3.8-settings-validation.json rename to release/evidence/v1.3.8-settings-validation.json diff --git a/docs/releases/v1.3.8-validation.json b/release/evidence/v1.3.8-validation.json similarity index 96% rename from docs/releases/v1.3.8-validation.json rename to release/evidence/v1.3.8-validation.json index 82aa0379..35e7c931 100644 --- a/docs/releases/v1.3.8-validation.json +++ b/release/evidence/v1.3.8-validation.json @@ -101,7 +101,7 @@ "releaseUrl": "https://github.com/wrestle-R/multi-codex/releases/tag/v1.3.8", "publishedAt": "2026-10-07T06:27:55Z", "website": "https://multi-codex.vercel.app", - "websiteValidation": "docs/releases/v1.3.8-website-validation.json", + "websiteValidation": "release/evidence/v1.3.8-website-validation.json", "packageBuildRun": "https://github.com/wrestle-R/multi-codex/actions/runs/37732606176", "latestReleaseVerifiedAt": "2026-10-08T05:53:18.748328+00:00", "installerRun": "https://github.com/wrestle-R/multi-codex/actions/runs/37734192047", @@ -139,7 +139,7 @@ "linux-isolation": { "status": "passed", "environment": "Linux x86_64; Codex desktop 26.930.51102", - "evidence": "docs/releases/v1.3.5-auth-isolation.json", + "evidence": "release/evidence/v1.3.5-auth-isolation.json", "testedAt": "2026-10-06T00:05:50+05:30", "testedBy": "Codex automation with user sign-in", "carriedForwardFrom": "v1.3.5", @@ -157,5 +157,5 @@ "currentRegressionEvidence": "https://github.com/wrestle-R/multi-codex/actions/runs/37732607598" } }, - "settingsValidation": "docs/releases/v1.3.8-settings-validation.json" + "settingsValidation": "release/evidence/v1.3.8-settings-validation.json" } diff --git a/docs/releases/v1.3.8-website-validation.json b/release/evidence/v1.3.8-website-validation.json similarity index 100% rename from docs/releases/v1.3.8-website-validation.json rename to release/evidence/v1.3.8-website-validation.json diff --git a/release/evidence/v1.4.0-extension-local-validation.json b/release/evidence/v1.4.0-extension-local-validation.json new file mode 100644 index 00000000..96fdc2c7 --- /dev/null +++ b/release/evidence/v1.4.0-extension-local-validation.json @@ -0,0 +1,51 @@ +{ + "passed": true, + "checks": [ + "Visible storage error recovered with Refresh without restarting the extension or VS Code", + "Desktop accounts discovered despite inherited managed CODEX_HOME", + "Attached to an already-running official Codex backend without restarting either extension or VS Code", + "First account selection connected automatically without an Enable switching button", + "Codex opens with the inherited home\u2019s current login before any account selection", + "Selected Account A", + "Selected Account B", + "Selected Account A", + "A \u2192 B \u2192 A verified in official Codex backend; VS Code, Multi Codex and backend stayed running", + "Usage read through the official bundled backend", + "Switch rejected during an actual in-progress Codex turn", + "Switch allowed after the actual turn completed", + "Existing chat continued after switching accounts without creating a new thread", + "Missing account leaves the previous verified account active", + "Account discovery recovered after helper termination while Codex stayed running", + "Top-bar Check Usage refreshes every saved account without changing the account, chat or backend", + "Native account list shows saved accounts and inline usage without welcome buttons" + ], + "hostPid": 126895, + "backendPid": 126947, + "activationId": "301cb67e-1ab6-4088-b757-738631edce8a", + "bridgeInstanceId": "bf1124e4-96d3-498e-ad22-d373fb9a95b7", + "codexVersion": "26.1007.21434", + "fixtureRequests": 106, + "panelPhases": [ + "5-Account A", + "6-Account B", + "7-Account A", + "continued-Account B", + "accounts-list Account B" + ], + "generationAccounts": [ + "synthetic-account-a", + "synthetic-account-b" + ], + "panelStayedMounted": true, + "statusBarAccountVerified": true, + "accountsPanelVerified": true, + "liveAttachment": true, + "platform": "linux", + "architecture": "x64", + "extensionId": "russeldanielpaul.multi-codex", + "originalLoginUnchanged": true, + "appVersion": "1.4.0", + "extensionVersion": "0.2.0", + "testedAt": "2026-10-09T06:06:06.232248+00:00", + "testedBy": "Codex local native VS Code test" +} diff --git a/release/evidence/v1.4.0-launcher-window-validation.json b/release/evidence/v1.4.0-launcher-window-validation.json new file mode 100644 index 00000000..e1e39bc1 --- /dev/null +++ b/release/evidence/v1.4.0-launcher-window-validation.json @@ -0,0 +1,34 @@ +{ + "passed": true, + "before": { + "floating": false, + "fullscreen": 1, + "size": [ + 1908, + 1148 + ] + }, + "afterLaunch": { + "floating": false, + "fullscreen": 1, + "size": [ + 1908, + 1148 + ] + }, + "afterClose": { + "floating": false, + "fullscreen": 1, + "size": [ + 1908, + 1148 + ] + }, + "desktopSwitchCycles": 3, + "repairedFloatingRestore": true, + "temporaryData": true, + "version": "1.4.0", + "environment": "Hyprland 0.56.2 / Linux x86_64, live desktop", + "testedAt": "2026-10-09T05:38:38.562916+00:00", + "testedBy": "Codex local native desktop test" +} diff --git a/docs/website/changelog-verification-2026-10-08.md b/release/evidence/website/changelog-verification-2026-10-08.md similarity index 100% rename from docs/website/changelog-verification-2026-10-08.md rename to release/evidence/website/changelog-verification-2026-10-08.md diff --git a/docs/website/issues-validation-2026-10-07.json b/release/evidence/website/issues-validation-2026-10-07.json similarity index 100% rename from docs/website/issues-validation-2026-10-07.json rename to release/evidence/website/issues-validation-2026-10-07.json diff --git a/docs/website/themes-validation-2026-10-07.json b/release/evidence/website/themes-validation-2026-10-07.json similarity index 100% rename from docs/website/themes-validation-2026-10-07.json rename to release/evidence/website/themes-validation-2026-10-07.json diff --git a/docs/website/timeline-and-appearance-validation-2026-10-07.json b/release/evidence/website/timeline-and-appearance-validation-2026-10-07.json similarity index 100% rename from docs/website/timeline-and-appearance-validation-2026-10-07.json rename to release/evidence/website/timeline-and-appearance-validation-2026-10-07.json diff --git a/docs/releases/v1.3.0-local-verification.md b/release/notes/v1.3.0-local-verification.md similarity index 100% rename from docs/releases/v1.3.0-local-verification.md rename to release/notes/v1.3.0-local-verification.md diff --git a/docs/releases/v1.3.0.md b/release/notes/v1.3.0.md similarity index 100% rename from docs/releases/v1.3.0.md rename to release/notes/v1.3.0.md diff --git a/docs/releases/v1.3.1-local-verification.md b/release/notes/v1.3.1-local-verification.md similarity index 100% rename from docs/releases/v1.3.1-local-verification.md rename to release/notes/v1.3.1-local-verification.md diff --git a/docs/releases/v1.3.1.md b/release/notes/v1.3.1.md similarity index 100% rename from docs/releases/v1.3.1.md rename to release/notes/v1.3.1.md diff --git a/docs/releases/v1.3.2.md b/release/notes/v1.3.2.md similarity index 100% rename from docs/releases/v1.3.2.md rename to release/notes/v1.3.2.md diff --git a/docs/releases/v1.3.3.md b/release/notes/v1.3.3.md similarity index 100% rename from docs/releases/v1.3.3.md rename to release/notes/v1.3.3.md diff --git a/docs/releases/v1.3.4-local-verification.md b/release/notes/v1.3.4-local-verification.md similarity index 100% rename from docs/releases/v1.3.4-local-verification.md rename to release/notes/v1.3.4-local-verification.md diff --git a/docs/releases/v1.3.4.md b/release/notes/v1.3.4.md similarity index 100% rename from docs/releases/v1.3.4.md rename to release/notes/v1.3.4.md diff --git a/docs/releases/v1.3.5-readiness.md b/release/notes/v1.3.5-readiness.md similarity index 100% rename from docs/releases/v1.3.5-readiness.md rename to release/notes/v1.3.5-readiness.md diff --git a/docs/releases/v1.3.5.md b/release/notes/v1.3.5.md similarity index 88% rename from docs/releases/v1.3.5.md rename to release/notes/v1.3.5.md index b58b03e5..00f92e97 100644 --- a/docs/releases/v1.3.5.md +++ b/release/notes/v1.3.5.md @@ -6,7 +6,7 @@ A simple first-run welcome detects the platform and installed apps. When both la **Preferred folder + Browse** uses the built-in folder picker. Executable paths and global Codex home stay under Advanced. Linux users can turn off the desktop picker; Mac users never see the desktop toggle or desktop picker, and launch on the current desktop. A repeated VS Code launch opens another window. A repeated standalone launch uses that account's own desktop instance. -Two different disposable accounts passed native standalone credential reuse, refresh, logout, peer isolation and signed-out restart checks on Linux and a [Mac GitHub runner](https://github.com/wrestle-R/multi-codex/actions/runs/37345518314). The standalone launch option is enabled only for Codex desktop version `26.930.51102` on Linux x86_64 and Apple Silicon macOS; unknown versions stay disabled until tested. The [sanitized isolation evidence](https://github.com/wrestle-R/multi-codex/blob/main/docs/releases/v1.3.5-auth-isolation.json) records the completed checks without credentials. +Two different disposable accounts passed native standalone credential reuse, refresh, logout, peer isolation and signed-out restart checks on Linux and a [Mac GitHub runner](https://github.com/wrestle-R/multi-codex/actions/runs/37345518314). The standalone launch option is enabled only for Codex desktop version `26.930.51102` on Linux x86_64 and Apple Silicon macOS; unknown versions stay disabled until tested. The [sanitized isolation evidence](https://github.com/wrestle-R/multi-codex/blob/main/release/evidence/v1.3.5-auth-isolation.json) records the completed checks without credentials. The launch path preserves the browser's normal HOME, uses private short aliases for long Mac profile paths, and discovers the CLI bundled with the standalone app when needed. Editing, deletion and cache cleanup are guarded while either app uses an account. A deliberate standalone sign-out remains signed out; a later usage check cannot silently restore stale keyring credentials. These changes protect existing account data during launch and refresh. @@ -16,18 +16,18 @@ Launches preserve existing per-account Codex settings. Credential and sign-out w Local frontend and Rust suites, production frontend build, formatting, packaging and installer checks passed. [Mac native CI](https://github.com/wrestle-R/multi-codex/actions/runs/37413567375) also passed Keychain and VS Code checks, launched the official standalone app twice with private paths containing spaces and Unicode, observed an on-screen native window, and built and inspected the Apple Silicon app/DMG. These CI fixtures are separate from the authenticated isolation run. -The [release build](https://github.com/wrestle-R/multi-codex/actions/runs/37413915283) completed all four packages and checksums. The downloaded AppImage passed real native button clicks, folder selection, all three launch choices, restart, live limits, desktop placement and repeat-window behavior on Arch/Hyprland. A running-profile delete was refused after restarting the launcher. The local upgrade preserved all six saved account records and credential files; a full backup and consistent SQLite snapshots were retained. [Sanitized local package and upgrade evidence](https://github.com/wrestle-R/multi-codex/blob/main/docs/releases/v1.3.5-local-validation.json) +The [release build](https://github.com/wrestle-R/multi-codex/actions/runs/37413915283) completed all four packages and checksums. The downloaded AppImage passed real native button clicks, folder selection, all three launch choices, restart, live limits, desktop placement and repeat-window behavior on Arch/Hyprland. A running-profile delete was refused after restarting the launcher. The local upgrade preserved all six saved account records and credential files; a full backup and consistent SQLite snapshots were retained. [Sanitized local package and upgrade evidence](https://github.com/wrestle-R/multi-codex/blob/main/release/evidence/v1.3.5-local-validation.json) VS Code needs the official Codex extension installed inside each isolated VS Code profile. The standalone version allowlist remains `26.930.51102`; the newer `26.930.61225` has not completed authenticated isolation verification. Mac CI uses the pinned [official archived build](https://persistent.oaistatic.com/codex-app-prod/ChatGPT-darwin-arm64-26.930.51102.zip). Published at the repository owner's request using the exact tested packages. The Mac DMG has no Apple Developer ID signature and is not notarized. The README Mac commands explicitly opt into the checksum-verified unsigned package; the installer applies a local ad-hoc signature if needed, and macOS still controls first-open approval. [Apple's Open Anyway instructions](https://support.apple.com/en-us/102445) -The actual DMG install and update passed on a [Mac runner](https://github.com/wrestle-R/multi-codex/actions/runs/37423651379), including unsigned-install rejection, explicit opt-in, signature integrity, installed app startup/restart, staging cleanup and unchanged account/chat sentinels. [Installer evidence](https://github.com/wrestle-R/multi-codex/blob/main/docs/releases/v1.3.5-installer-validation.json) +The actual DMG install and update passed on a [Mac runner](https://github.com/wrestle-R/multi-codex/actions/runs/37423651379), including unsigned-install rejection, explicit opt-in, signature integrity, installed app startup/restart, staging cleanup and unchanged account/chat sentinels. [Installer evidence](https://github.com/wrestle-R/multi-codex/blob/main/release/evidence/v1.3.5-installer-validation.json) -The same run passed AppImage install/update on Ubuntu, verifying the exact installed asset and preserved account/chat and default-login sentinels. These installer tests use the original release-build packages and substitute draft release URL resolution before publication. Native Linux launch and authenticated isolation checks are separate. [Linux installer evidence](https://github.com/wrestle-R/multi-codex/blob/main/docs/releases/v1.3.5-linux-installer-validation.json) +The same run passed AppImage install/update on Ubuntu, verifying the exact installed asset and preserved account/chat and default-login sentinels. These installer tests use the original release-build packages and substitute draft release URL resolution before publication. Native Linux launch and authenticated isolation checks are separate. [Linux installer evidence](https://github.com/wrestle-R/multi-codex/blob/main/release/evidence/v1.3.5-linux-installer-validation.json) -Install and update scripts are included in the release and its checksums. README commands follow the latest release automatically. Publication requires successful Linux/Mac builds, installer verification, authenticated isolation and all six asset hashes. Developer ID signing and notarization are optional and were not performed. Broader installed-package checks remain pending in the [validation manifest](https://github.com/wrestle-R/multi-codex/blob/main/docs/releases/v1.3.5-validation.json). [Platform support and validation details](https://github.com/wrestle-R/multi-codex/blob/main/docs/platform-support.md) +Install and update scripts are included in the release and its checksums. README commands follow the latest release automatically. Publication requires successful Linux/Mac builds, installer verification, authenticated isolation and all six asset hashes. Developer ID signing and notarization are optional and were not performed. Broader installed-package checks remain pending in the [validation manifest](https://github.com/wrestle-R/multi-codex/blob/main/release/evidence/v1.3.5-validation.json). [Platform support and validation details](https://multi-codex.vercel.app/docs/platform-support) -The [publication workflow](https://github.com/wrestle-R/multi-codex/actions/runs/37423934315) passed and published v1.3.5 as the latest stable release. GitHub's latest-release API and redirect were verified, and both live public Linux README scripts preserved six disposable account/chat fixtures during install/update. [Publication evidence](https://github.com/wrestle-R/multi-codex/blob/main/docs/releases/v1.3.5-publication-validation.json). End-user macOS first-open approval was not automated. +The [publication workflow](https://github.com/wrestle-R/multi-codex/actions/runs/37423934315) passed and published v1.3.5 as the latest stable release. GitHub's latest-release API and redirect were verified, and both live public Linux README scripts preserved six disposable account/chat fixtures during install/update. [Publication evidence](https://github.com/wrestle-R/multi-codex/blob/main/release/evidence/v1.3.5-publication-validation.json). End-user macOS first-open approval was not automated. -[Remaining validation checklist](https://github.com/wrestle-R/multi-codex/blob/main/docs/releases/v1.3.5-readiness.md) +[Remaining validation checklist](https://github.com/wrestle-R/multi-codex/blob/main/release/evidence/v1.3.5-readiness.md) diff --git a/docs/releases/v1.3.6.md b/release/notes/v1.3.6.md similarity index 87% rename from docs/releases/v1.3.6.md rename to release/notes/v1.3.6.md index 3f666ad8..921e13eb 100644 --- a/docs/releases/v1.3.6.md +++ b/release/notes/v1.3.6.md @@ -10,8 +10,8 @@ Saved accounts, credentials, conversations, profile paths and launch preferences Packages: Linux x86_64 AppImage, DEB and RPM; Apple Silicon macOS 26+ DMG. The Mac package has no Apple Developer ID signature or notarization and requires the README's explicit unsigned-install opt-in and macOS first-open approval. -Release verification and its limits are recorded in the [validation manifest](https://github.com/wrestle-R/multi-codex/blob/main/docs/releases/v1.3.6-validation.json). Authenticated standalone isolation evidence is carried forward from v1.3.5 for the unchanged desktop version allowlist; this release also checks native launch and profile guards. Broader distribution and desktop validation remains pending. +Release verification and its limits are recorded in the [validation manifest](https://github.com/wrestle-R/multi-codex/blob/main/release/evidence/v1.3.6-validation.json). Authenticated standalone isolation evidence is carried forward from v1.3.5 for the unchanged desktop version allowlist; this release also checks native launch and profile guards. Broader distribution and desktop validation remains pending. [Mac/Linux CI](https://github.com/wrestle-R/multi-codex/actions/runs/37562655635), [release builds](https://github.com/wrestle-R/multi-codex/actions/runs/37563021224), and [exact-package installer verification](https://github.com/wrestle-R/multi-codex/actions/runs/37563569940) passed. The downloaded Linux AppImage also passed native startup/restart on Arch/Hyprland with unchanged account, chat and default-login fixtures. -The [publication workflow](https://github.com/wrestle-R/multi-codex/actions/runs/37563811833) published these exact packages as the latest stable release. The local Linux installation was updated through the public latest-release updater, matched the published checksum, and opened with all six saved accounts and all three launch buttons per account. Credentials and settings remained unchanged, and all 490 protected files retained their existing data, including conversation prefixes. A full private backup, 61 consistent SQLite snapshots and the previous launcher were retained. [Sanitized upgrade evidence](https://github.com/wrestle-R/multi-codex/blob/main/docs/releases/v1.3.6-local-validation.json). +The [publication workflow](https://github.com/wrestle-R/multi-codex/actions/runs/37563811833) published these exact packages as the latest stable release. The local Linux installation was updated through the public latest-release updater, matched the published checksum, and opened with all six saved accounts and all three launch buttons per account. Credentials and settings remained unchanged, and all 490 protected files retained their existing data, including conversation prefixes. A full private backup, 61 consistent SQLite snapshots and the previous launcher were retained. [Sanitized upgrade evidence](https://github.com/wrestle-R/multi-codex/blob/main/release/evidence/v1.3.6-local-validation.json). diff --git a/docs/releases/v1.3.7.md b/release/notes/v1.3.7.md similarity index 86% rename from docs/releases/v1.3.7.md rename to release/notes/v1.3.7.md index 83b393f6..ac37f169 100644 --- a/docs/releases/v1.3.7.md +++ b/release/notes/v1.3.7.md @@ -10,11 +10,11 @@ The Orange theme preview now uses dark colors in dark mode. Its light-mode previ Saved accounts, credentials, conversations and existing preferences are preserved during updates. Packages: Linux x86_64 AppImage, DEB and RPM; Apple Silicon macOS 26+ DMG. The Mac package remains unsigned and unnotarized; follow the README’s explicit unsigned-install opt-in. -Validation is recorded in the [release manifest](https://github.com/wrestle-R/multi-codex/blob/main/docs/releases/v1.3.7-validation.json). Broader distro/desktop checks remain pending. Authenticated standalone desktop evidence is carried forward for the unchanged desktop version and command construction; terminal choice and interactive discovery are checked separately. +Validation is recorded in the [release manifest](https://github.com/wrestle-R/multi-codex/blob/main/release/evidence/v1.3.7-validation.json). Broader distro/desktop checks remain pending. Authenticated standalone desktop evidence is carried forward for the unchanged desktop version and command construction; terminal choice and interactive discovery are checked separately. The [showcase and docs website](https://multi-codex.vercel.app) lives in the repository’s `next` folder. Local and [Mac/Linux browser checks](https://github.com/wrestle-R/multi-codex/actions/runs/37575600054) pass across desktop Chromium, desktop WebKit and mobile Chromium, including navigation, viewport sizing, copyable commands and missing pages. -[App CI](https://github.com/wrestle-R/multi-codex/actions/runs/37565958194), [Mac/Linux packages](https://github.com/wrestle-R/multi-codex/actions/runs/37575095291) and [exact-package installer checks](https://github.com/wrestle-R/multi-codex/actions/runs/37575974153) passed. The exact AppImage also passed native startup/restart on Arch/Hyprland with unchanged account, chat and default-login fixtures. Local launches in Konsole and Kitty reused the selected real account without another sign-in. [Sanitized evidence](https://github.com/wrestle-R/multi-codex/blob/main/docs/releases/v1.3.7-local-validation.json). +[App CI](https://github.com/wrestle-R/multi-codex/actions/runs/37565958194), [Mac/Linux packages](https://github.com/wrestle-R/multi-codex/actions/runs/37575095291) and [exact-package installer checks](https://github.com/wrestle-R/multi-codex/actions/runs/37575974153) passed. The exact AppImage also passed native startup/restart on Arch/Hyprland with unchanged account, chat and default-login fixtures. Local launches in Konsole and Kitty reused the selected real account without another sign-in. [Sanitized evidence](https://github.com/wrestle-R/multi-codex/blob/main/release/evidence/v1.3.7-local-validation.json). -The stable release is published and installed locally with a checksum matching the published AppImage. The post-upgrade comparison preserved all six account IDs and 550 protected files, with zero missing or changed files; credentials, settings and existing conversation contents remain intact. A backup and the previous AppImage are retained. The installed native UI shows all six accounts and CLI controls, and the desktop launcher identifies v1.3.7. The public website passed all nine browser checks after deployment; [live-site evidence](https://github.com/wrestle-R/multi-codex/blob/main/docs/releases/v1.3.7-website-validation.json). +The stable release is published and installed locally with a checksum matching the published AppImage. The post-upgrade comparison preserved all six account IDs and 550 protected files, with zero missing or changed files; credentials, settings and existing conversation contents remain intact. A backup and the previous AppImage are retained. The installed native UI shows all six accounts and CLI controls, and the desktop launcher identifies v1.3.7. The public website passed all nine browser checks after deployment; [live-site evidence](https://github.com/wrestle-R/multi-codex/blob/main/release/evidence/v1.3.7-website-validation.json). diff --git a/docs/releases/v1.3.8.md b/release/notes/v1.3.8.md similarity index 88% rename from docs/releases/v1.3.8.md rename to release/notes/v1.3.8.md index 271a9712..669ef0e2 100644 --- a/docs/releases/v1.3.8.md +++ b/release/notes/v1.3.8.md @@ -12,6 +12,6 @@ Linux x86_64 packages: AppImage, DEB and RPM. Apple Silicon Mac: macOS 26 or new ## Downloads and verification -Use the matching install or update script from the [latest release](https://github.com/wrestle-R/multi-codex/releases/latest). Package and installer validation is tracked in the [release manifest](https://github.com/wrestle-R/multi-codex/blob/main/docs/releases/v1.3.8-validation.json). Broader platform checks are tracked separately. +Use the matching install or update script from the [latest release](https://github.com/wrestle-R/multi-codex/releases/latest). Package and installer validation is tracked in the [release manifest](https://github.com/wrestle-R/multi-codex/blob/main/release/evidence/v1.3.8-validation.json). Broader platform checks are tracked separately. [Website and documentation](https://multi-codex.vercel.app). diff --git a/release/notes/v1.4.0.md b/release/notes/v1.4.0.md new file mode 100644 index 00000000..afc9e64b --- /dev/null +++ b/release/notes/v1.4.0.md @@ -0,0 +1,20 @@ +# Multi Codex v1.4.0 + +Windows x64 support for the desktop launcher and companion VS Code extension, account actions in the macOS menu bar, all-account extension usage refresh, and persistent launcher maximization across desktop changes. + +The matching extension is v0.2.0. Download the VSIX for Linux x64, macOS arm64/x64, or Windows x64. Package filenames derive from the extension manifest. + +## Changes + +- Native Windows account storage, protected file ACLs, credential-store integration, executable discovery, VS Code and terminal launches, NSIS installer, and PowerShell install/update scripts. +- Windows extension uses authenticated named pipes and a native executable bridge; desktop and extension share accounts and account locks. +- Extension toolbar checks every saved account with bounded concurrency, progress, reset times, and independent error handling. +- macOS menu bar lets you select an account and open installed supported launch targets. Closing the window keeps the app running; Quit exits it. +- The Hyprland launcher preserves its tiled maximized state after focus and desktop changes. +- The website is the primary documentation source. README links there; release metadata is under release/ and docs/ is untracked. + +## Validation + +Candidate validation is in progress. Do not publish until native CI, packaged VSIX tests, and installer/isolation gates pass for the exact release assets. + +Initial Windows scope is native x64. WSL/Remote SSH and Windows virtual-desktop placement are deferred. Standalone Windows Codex isolation must pass its exact-version verification before it is enabled. diff --git a/release/scripts/macos-menu-smoke.py b/release/scripts/macos-menu-smoke.py new file mode 100644 index 00000000..9b0be912 --- /dev/null +++ b/release/scripts/macos-menu-smoke.py @@ -0,0 +1,147 @@ +#!/usr/bin/env python3 +"""Verify native menu, close, reopen and Quit using a disposable packaged app.""" +import hashlib +import json +import os +from pathlib import Path +import subprocess +import sys +import tempfile +import time + +app = Path(sys.argv[1]).resolve() +binary_name = subprocess.check_output([ + '/usr/libexec/PlistBuddy', '-c', 'Print :CFBundleExecutable', + str(app / 'Contents/Info.plist'), +], text=True).strip() +report_dir = Path(os.environ['RUNNER_TEMP']) / 'multi-codex-menu-evidence' +report_dir.mkdir(exist_ok=True) + +def script(source): + result = subprocess.run(['osascript', '-e', source], capture_output=True, text=True, timeout=20) + if result.returncode: + raise RuntimeError(result.stderr.strip()) + return result.stdout.strip() + +def wait_for(label, condition): + deadline = time.monotonic() + 30 + last_error = None + while time.monotonic() < deadline: + try: + if condition(): + return + except RuntimeError as error: + last_error = str(error) + time.sleep(.5) + raise RuntimeError(f'Timed out: {label}; last UI error: {last_error}') + +with tempfile.TemporaryDirectory(prefix='Multi Codex menu 測試 ') as temporary: + home = Path(temporary) + data = home / 'Library/Application Support/multi-codex' + data.mkdir(parents=True) + profile_id = '00000000-0000-4000-8000-000000000001' + profiles = [{'id': profile_id, 'name': 'Menu test account', 'authMode': 'apikey', + 'createdAt': '2026-10-09T00:00:00Z', 'updatedAt': '2026-10-09T00:00:00Z'}] + metadata = json.dumps(profiles).encode() + (data / 'profiles.json').write_bytes(metadata) + (data / 'profiles.json').chmod(0o600) + env = {key: value for key, value in os.environ.items() + if not key.startswith(('CODEX_', 'VSCODE_', 'OPENAI_')) + and key not in ('ELECTRON_RUN_AS_NODE', 'NODE_OPTIONS')} + env.update(HOME=str(home), XDG_DATA_HOME=str(home / 'data'), PATH='/usr/bin:/bin:/usr/sbin:/sbin') + with (report_dir / 'application.log').open('wb') as log: + process = subprocess.Popen([str(app / 'Contents/MacOS' / binary_name)], + env=env, stdout=log, stderr=subprocess.STDOUT) + prefix = f'tell application "System Events" to tell first application process whose unix id is {process.pid}\n' + def ui(command): + return script(prefix + command + '\nend tell') + def window_count(): + return int(ui('return count of windows')) + def open_menu(): + ui('click menu bar item 1 of menu bar 2') + def account_actions(): + open_menu() + ui('click menu item "Menu test account" of menu 1 of menu bar item 1 of menu bar 2') + actions = ui('return name of every menu item of menu 1 of menu item "Menu test account" of menu 1 of menu bar item 1 of menu bar 2') + ui('key code 53') + ui('key code 53') + return actions + def replace_metadata(contents): + temporary_metadata = data / 'profiles.menu-test.tmp' + temporary_metadata.write_bytes(contents) + temporary_metadata.chmod(0o600) + temporary_metadata.replace(data / 'profiles.json') + checks = [] + moved_codex = None + try: + wait_for('native main window', lambda: window_count() > 0) + open_menu() + names = ui('return name of every menu item of menu 1 of menu bar item 1 of menu bar 2') + for expected in ('Open Multi Codex', 'Menu test account', 'Refresh All Usage', 'Quit Multi Codex'): + assert expected in names, f'Missing menu action: {expected}: {names}' + ui('click menu item "Menu test account" of menu 1 of menu bar item 1 of menu bar 2') + actions = ui('return name of every menu item of menu 1 of menu item "Menu test account" of menu 1 of menu bar item 1 of menu bar 2') + for expected in ('Open VS Code', 'Open Codex', 'Open CLI'): + assert expected in actions, f'Missing installed target: {expected}: {actions}' + ui('key code 53') + checks.append('Native account menu contains all three installed supported launch targets') + ui('key code 53') + profiles[0]['name'] = 'Renamed menu account' + replace_metadata(json.dumps(profiles).encode()) + def renamed_visible(): + open_menu() + names = ui('return name of every menu item of menu 1 of menu bar item 1 of menu bar 2') + ui('key code 53') + return 'Renamed menu account' in names + wait_for('menu reflecting account edits', renamed_visible) + replace_metadata(metadata) + def original_visible(): + open_menu() + names = ui('return name of every menu item of menu 1 of menu bar item 1 of menu bar 2') + ui('key code 53') + return 'Menu test account' in names + wait_for('restored account label', original_visible) + checks.append('Native menu updates account names without restarting') + codex_app = next((path for path in (Path('/Applications/Codex.app'), Path('/Applications/ChatGPT.app')) if path.exists()), None) + assert codex_app, 'The disposable runner must have the pinned Codex fixture' + moved_codex = home / 'Codex-away.app' + codex_app.rename(moved_codex) + wait_for('menu hiding an uninstalled Codex target', lambda: 'Open Codex' not in account_actions()) + assert 'Open VS Code' in account_actions(), 'Installed VS Code disappeared' + moved_codex.rename(codex_app) + moved_codex = None + wait_for('menu restoring the supported Codex target', lambda: 'Open Codex' in account_actions()) + checks.append('Native menu removes and restores launch targets when installed apps change') + ui('click first button of window 1 whose subrole is "AXCloseButton"') + wait_for('close hiding the main window', lambda: window_count() == 0) + assert process.poll() is None, 'Close exited the app' + open_menu() + ui('click menu item "Open Multi Codex" of menu 1 of menu bar item 1 of menu bar 2') + wait_for('tray reopening the same main window', lambda: window_count() > 0) + checks.append('Close hides the window and tray Open restores it in the same process') + ui('click first button of window 1 whose subrole is "AXCloseButton"') + wait_for('second close', lambda: window_count() == 0) + subprocess.run(['open', '-a', str(app)], check=True, timeout=20) + wait_for('Dock/LaunchServices reopen', lambda: window_count() > 0) + assert process.poll() is None + checks.append('Dock/LaunchServices reopen restores the hidden main window') + open_menu() + ui('click menu item "Quit Multi Codex" of menu 1 of menu bar item 1 of menu bar 2') + assert process.wait(timeout=15) == 0, 'Quit did not exit cleanly' + checks.append('Quit exits the native application cleanly') + assert (data / 'profiles.json').read_bytes() == metadata + result = {'passed': True, 'checks': checks, 'accountMetadataUnchanged': True, + 'metadataSha256': hashlib.sha256(metadata).hexdigest(), + 'authenticatedLaunches': 'Not tested by this menu probe'} + (report_dir / 'result.json').write_text(json.dumps(result, indent=2) + '\n') + print(json.dumps(result, indent=2)) + finally: + if moved_codex and moved_codex.exists(): + moved_codex.rename(codex_app) + if process.poll() is None: + process.terminate() + try: + process.wait(timeout=10) + except subprocess.TimeoutExpired: + process.kill() + process.wait(timeout=5) diff --git a/scripts/install-app.ps1 b/scripts/install-app.ps1 new file mode 100644 index 00000000..e9c62efe --- /dev/null +++ b/scripts/install-app.ps1 @@ -0,0 +1,27 @@ +[CmdletBinding()] +param([switch]$NoLaunch, [string]$InstallDirectory = (Join-Path $env:LOCALAPPDATA 'Multi Codex')) +$ErrorActionPreference = 'Stop' +if (![Environment]::Is64BitOperatingSystem -or $env:PROCESSOR_ARCHITECTURE -notin @('AMD64', 'x86') -or ($env:PROCESSOR_ARCHITEW6432 -and $env:PROCESSOR_ARCHITEW6432 -ne 'AMD64')) { throw 'Multi Codex requires native Windows x64.' } +if (Get-Process -Name 'multi-codex-desktop' -ErrorAction SilentlyContinue) { throw 'Close Multi Codex before installing or updating. Saved accounts will be preserved.' } +if (![System.IO.Path]::IsPathRooted($InstallDirectory)) { throw 'InstallDirectory must be an absolute path.' } +$release = Invoke-RestMethod 'https://api.github.com/repos/wrestle-R/multi-codex/releases/latest' +$installer = @($release.assets | Where-Object { $_.name -match '_x64-setup\.exe$' }) +$sums = @($release.assets | Where-Object { $_.name -eq 'SHA256SUMS' }) +if ($installer.Count -ne 1 -or $sums.Count -ne 1) { throw 'The latest release has no unique Windows installer and checksum manifest.' } +$temporary = Join-Path ([IO.Path]::GetTempPath()) ('multi-codex-install-' + [guid]::NewGuid()) +New-Item -ItemType Directory -Path $temporary | Out-Null +try { + $package = Join-Path $temporary $installer[0].name + Invoke-WebRequest $installer[0].browser_download_url -OutFile $package + $manifest = (Invoke-WebRequest $sums[0].browser_download_url).Content + $pattern = '(?m)^([a-fA-F0-9]{64})\s+\*?' + [regex]::Escape($installer[0].name) + '\r?$' + $matches = [regex]::Matches($manifest, $pattern) + if ($matches.Count -ne 1 -or (Get-FileHash $package -Algorithm SHA256).Hash -ne $matches[0].Groups[1].Value) { throw 'Windows installer checksum verification failed.' } + # NSIS requires /D to be the final argument; it handles spaces itself. + $process = Start-Process -FilePath $package -ArgumentList "/S /D=$InstallDirectory" -Wait -PassThru + if ($process.ExitCode -ne 0) { throw "Windows installer failed with exit code $($process.ExitCode)." } + $application = Join-Path $InstallDirectory 'multi-codex-desktop.exe' + if (!(Test-Path -LiteralPath $application -PathType Leaf)) { throw 'The installed app executable is missing.' } + if (!$NoLaunch) { Start-Process -FilePath $application } + Write-Host "Multi Codex $($release.tag_name) installed. Saved accounts and profile data were preserved." +} finally { Remove-Item -LiteralPath $temporary -Recurse -Force } diff --git a/scripts/update-app.ps1 b/scripts/update-app.ps1 new file mode 100644 index 00000000..e9c62efe --- /dev/null +++ b/scripts/update-app.ps1 @@ -0,0 +1,27 @@ +[CmdletBinding()] +param([switch]$NoLaunch, [string]$InstallDirectory = (Join-Path $env:LOCALAPPDATA 'Multi Codex')) +$ErrorActionPreference = 'Stop' +if (![Environment]::Is64BitOperatingSystem -or $env:PROCESSOR_ARCHITECTURE -notin @('AMD64', 'x86') -or ($env:PROCESSOR_ARCHITEW6432 -and $env:PROCESSOR_ARCHITEW6432 -ne 'AMD64')) { throw 'Multi Codex requires native Windows x64.' } +if (Get-Process -Name 'multi-codex-desktop' -ErrorAction SilentlyContinue) { throw 'Close Multi Codex before installing or updating. Saved accounts will be preserved.' } +if (![System.IO.Path]::IsPathRooted($InstallDirectory)) { throw 'InstallDirectory must be an absolute path.' } +$release = Invoke-RestMethod 'https://api.github.com/repos/wrestle-R/multi-codex/releases/latest' +$installer = @($release.assets | Where-Object { $_.name -match '_x64-setup\.exe$' }) +$sums = @($release.assets | Where-Object { $_.name -eq 'SHA256SUMS' }) +if ($installer.Count -ne 1 -or $sums.Count -ne 1) { throw 'The latest release has no unique Windows installer and checksum manifest.' } +$temporary = Join-Path ([IO.Path]::GetTempPath()) ('multi-codex-install-' + [guid]::NewGuid()) +New-Item -ItemType Directory -Path $temporary | Out-Null +try { + $package = Join-Path $temporary $installer[0].name + Invoke-WebRequest $installer[0].browser_download_url -OutFile $package + $manifest = (Invoke-WebRequest $sums[0].browser_download_url).Content + $pattern = '(?m)^([a-fA-F0-9]{64})\s+\*?' + [regex]::Escape($installer[0].name) + '\r?$' + $matches = [regex]::Matches($manifest, $pattern) + if ($matches.Count -ne 1 -or (Get-FileHash $package -Algorithm SHA256).Hash -ne $matches[0].Groups[1].Value) { throw 'Windows installer checksum verification failed.' } + # NSIS requires /D to be the final argument; it handles spaces itself. + $process = Start-Process -FilePath $package -ArgumentList "/S /D=$InstallDirectory" -Wait -PassThru + if ($process.ExitCode -ne 0) { throw "Windows installer failed with exit code $($process.ExitCode)." } + $application = Join-Path $InstallDirectory 'multi-codex-desktop.exe' + if (!(Test-Path -LiteralPath $application -PathType Leaf)) { throw 'The installed app executable is missing.' } + if (!$NoLaunch) { Start-Process -FilePath $application } + Write-Host "Multi Codex $($release.tag_name) installed. Saved accounts and profile data were preserved." +} finally { Remove-Item -LiteralPath $temporary -Recurse -Force } diff --git a/tauri/package-lock.json b/tauri/package-lock.json index fd8ddeb6..f0cd2af0 100644 --- a/tauri/package-lock.json +++ b/tauri/package-lock.json @@ -1,12 +1,12 @@ { "name": "multi-codex-desktop", - "version": "1.3.8", + "version": "1.4.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "multi-codex-desktop", - "version": "1.3.8", + "version": "1.4.0", "dependencies": { "@fontsource/bricolage-grotesque": "^5.2.10", "@fontsource/outfit": "^5.2.8", diff --git a/tauri/package.json b/tauri/package.json index 0be8b5d9..8adc9ea4 100644 --- a/tauri/package.json +++ b/tauri/package.json @@ -1,7 +1,7 @@ { "name": "multi-codex-desktop", "private": true, - "version": "1.3.8", + "version": "1.4.0", "type": "module", "scripts": { "dev": "vite", diff --git a/tauri/scripts/release-gates.mjs b/tauri/scripts/release-gates.mjs index 468c6106..b8b12f3e 100644 --- a/tauri/scripts/release-gates.mjs +++ b/tauri/scripts/release-gates.mjs @@ -8,6 +8,12 @@ export const requiredChecks = [ 'linux-build', 'macos-build', 'linux-installer', 'macos-installer', 'linux-isolation', 'macos-isolation', ] +export const crossPlatformChecks = [ + 'windows-build', 'windows-installer', 'windows-isolation', + 'extension-linux-x64', 'extension-darwin-arm64', 'extension-darwin-x64', 'extension-win32-x64', + 'launcher-window', 'macos-menu-bar', +] +export const extensionTargets = ['linux-x64', 'darwin-arm64', 'darwin-x64', 'win32-x64'] export const fullValidationChecks = [ 'packaged-macos-26-arm64', 'packaged-debian-ubuntu', 'packaged-fedora', 'packaged-arch', @@ -18,7 +24,9 @@ export const fullValidationChecks = [ export function evaluate(report, version, artifactDirectory, { fullValidation = false } = {}) { const failures = [] if (report.version !== version || report.schemaVersion !== 1) failures.push('Validation report version/schema does not match the candidate') - const checks = requiredChecks.map(id => [id, report.releaseChecks?.[id]]) + const [major, minor] = version.split('.').map(Number) + const crossPlatform = major > 1 || (major === 1 && minor >= 4) + const checks = [...requiredChecks, ...(crossPlatform ? crossPlatformChecks : [])].map(id => [id, report.releaseChecks?.[id]]) if (fullValidation) checks.push(...fullValidationChecks.map(id => [id, report.checks?.[id]])) for (const [id, check] of checks) { if (check?.status !== 'passed') failures.push(`${id}: ${check?.reason || 'functional validation is pending'}`) @@ -32,6 +40,12 @@ export function evaluate(report, version, artifactDirectory, { fullValidation = 'install-app.sh', 'update-app.sh', ] + if (crossPlatform) { + const extensionVersion = report.extensionVersion + if (!/^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$/.test(extensionVersion ?? '')) failures.push('Matching extension manifest version is required') + else for (const target of extensionTargets) assets.push(`multi-codex-${target}-${extensionVersion}.vsix`) + assets.push(`Multi.Codex_${version}_x64-setup.exe`, 'install-app.ps1', 'update-app.ps1') + } for (const name of assets) { const expected = report.artifacts?.[name] if (!/^[a-f0-9]{64}$/.test(expected ?? '')) failures.push(`${name}: validated artifact SHA256 is missing`) @@ -46,9 +60,12 @@ export function evaluate(report, version, artifactDirectory, { fullValidation = if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) { const version = JSON.parse(readFileSync(resolve(root, 'tauri/package.json'), 'utf8')).version - const report = JSON.parse(readFileSync(resolve(root, `docs/releases/v${version}-validation.json`), 'utf8')) + const report = JSON.parse(readFileSync(resolve(root, `release/evidence/v${version}-validation.json`), 'utf8')) const artifactDirectory = process.argv.slice(2).find(argument => argument !== '--full-validation') + const extensionVersion = JSON.parse(readFileSync(resolve(root, 'extension/package.json'), 'utf8')).version const failures = evaluate(report, version, artifactDirectory, { fullValidation: process.argv.includes('--full-validation') }) + const [major, minor] = version.split('.').map(Number) + if ((major > 1 || (major === 1 && minor >= 4)) && report.extensionVersion !== extensionVersion) failures.push('Validation report extension version does not match the committed manifest') if (failures.length) { console.error(`Release v${version} is blocked:\n${failures.map(f => `- ${f}`).join('\n')}`) process.exitCode = 1 diff --git a/tauri/scripts/release-gates.test.mjs b/tauri/scripts/release-gates.test.mjs index 842916ce..0d6c7ff3 100644 --- a/tauri/scripts/release-gates.test.mjs +++ b/tauri/scripts/release-gates.test.mjs @@ -4,7 +4,7 @@ import { mkdtempSync, writeFileSync, rmSync } from 'node:fs' import { tmpdir } from 'node:os' import { join } from 'node:path' import { createHash } from 'node:crypto' -import { evaluate, requiredChecks } from './release-gates.mjs' +import { evaluate, requiredChecks, crossPlatformChecks, extensionTargets } from './release-gates.mjs' function releaseChecks() { return Object.fromEntries(requiredChecks.map(id => [id, { status: 'passed', evidence: 'record', environment: 'test runner', testedBy: 'tester', testedAt: '2026-10-03T00:00:00Z' }])) @@ -40,3 +40,19 @@ test('requires the exact packages that were functionally tested', () => { assert.ok(evaluate(report, '1.3.1', directory).some(error => error.includes('does not match'))) } finally { rmSync(directory, { recursive: true, force: true }) } }) + + +test('new platform releases cannot bypass Windows, packaged extension or menu validation', () => { + const version = '1.4.0', extensionVersion = '0.2.0'; + const report = { version, extensionVersion, schemaVersion: 1, releaseChecks: releaseChecks(), artifacts: {} }; + const names = [`Multi.Codex_${version}_amd64.AppImage`, `Multi.Codex_${version}_amd64.deb`, `Multi.Codex-${version}-1.x86_64.rpm`, `Multi.Codex_${version}_aarch64.dmg`, `Multi.Codex_${version}_x64-setup.exe`, 'install-app.sh', 'update-app.sh', 'install-app.ps1', 'update-app.ps1', ...extensionTargets.map(target => `multi-codex-${target}-${extensionVersion}.vsix`)]; + for (const name of names) report.artifacts[name] = 'a'.repeat(64); + assert.ok(evaluate(report, version).some(error => error.includes('windows-installer'))); + assert.ok(evaluate(report, version).some(error => error.includes('extension-win32-x64'))); + for (const check of crossPlatformChecks) report.releaseChecks[check] = { status: 'passed', evidence: 'exact packaged candidate run', environment: 'native runner', testedBy: 'tester', testedAt: '2026-10-09T00:00:00Z' }; + assert.deepEqual(evaluate(report, version), []); + delete report.artifacts[`multi-codex-win32-x64-${extensionVersion}.vsix`]; + assert.ok(evaluate(report, version).some(error => error.includes('win32-x64'))); + delete report.extensionVersion; + assert.ok(evaluate(report, version).some(error => error.includes('manifest version'))); +}) diff --git a/tauri/scripts/test-launcher-window.mjs b/tauri/scripts/test-launcher-window.mjs index c14e44c3..9aedfd1e 100644 --- a/tauri/scripts/test-launcher-window.mjs +++ b/tauri/scripts/test-launcher-window.mjs @@ -7,11 +7,15 @@ import { mkdtemp, mkdir, rm, writeFile } from 'node:fs/promises'; import { tmpdir } from 'node:os'; import { join, resolve } from 'node:path'; const exec = promisify(execFile); +const target = process.env.MULTI_CODEX_TEST_LAUNCH_TARGET || 'vscode'; +if (!['vscode', 'standalone'].includes(target)) throw new Error('Choose vscode or standalone for the launch check'); +const externalClass = target === 'standalone' ? /chatgpt|codex/i : /code/i; if (!process.env.HYPRLAND_INSTANCE_SIGNATURE) throw new Error('A live Hyprland session is required'); const root = await mkdtemp(join(tmpdir(), 'multi-codex-launcher-')); const env = { ...process.env, XDG_DATA_HOME: join(root, 'data'), XDG_CONFIG_HOME: join(root, 'config'), CODEX_HOME: join(root, 'codex-home') }; -delete env.ELECTRON_RUN_AS_NODE; delete env.APPIMAGE; delete env.VSCODE_IPC_HOOK_CLI; +for (const key of ['ELECTRON_RUN_AS_NODE', 'APPIMAGE', 'VSCODE_IPC_HOOK_CLI', 'NODE_OPTIONS', 'OPENAI_API_KEY', 'CODEX_API_KEY']) delete env[key]; await mkdir(env.CODEX_HOME, { recursive: true }); await mkdir(join(root, 'workspace')); +await writeFile(join(env.CODEX_HOME, 'config.toml'), 'cli_auth_credentials_store = "file"\n', { mode: 0o600 }); const launcher = process.env.MULTI_CODEX_TEST_LAUNCHER || resolve('src-tauri/target/debug/multi-codex-desktop'); const app = spawn(launcher, [], { env, stdio: ['ignore', 'pipe', 'pipe'] }); let diagnostics = ''; @@ -32,20 +36,34 @@ async function stop(child) { } try { const before = await until(async () => (await clients()).find(c => c.pid === app.pid), c => c && c.fullscreen === 1 && !c.floating); + const originalWorkspace = before.workspace.id; const addresses = new Set((await clients()).map(c => c.address)); - code = spawn('/usr/share/code/code', ['--user-data-dir', join(root, 'code-user'), '--extensions-dir', join(root, 'code-extensions'), - '--disable-extensions', '--skip-welcome', '--skip-release-notes', '--disable-gpu', '--no-sandbox', '--ozone-platform=x11', join(root, 'workspace')], { env, stdio: 'ignore' }); - await until(clients, list => list.some(c => !addresses.has(c.address) && /code/i.test(c.class))); + code = target === 'standalone' + ? spawn(process.env.MULTI_CODEX_TEST_STANDALONE || '/usr/lib/chatgpt/ChatGPT', ['--user-data-dir', join(root, 'desktop-user'), '--disable-gpu', '--no-sandbox', '--ozone-platform=x11'], { env, stdio: 'ignore' }) + : spawn('/usr/share/code/code', ['--user-data-dir', join(root, 'code-user'), '--extensions-dir', join(root, 'code-extensions'), + '--disable-extensions', '--skip-welcome', '--skip-release-notes', '--disable-gpu', '--no-sandbox', '--ozone-platform=x11', join(root, 'workspace')], { env, stdio: 'ignore' }); + await until(clients, list => list.some(c => !addresses.has(c.address) && externalClass.test(c.class))); // Let focus and maximize transitions settle after the new window maps. await new Promise(resolve => setTimeout(resolve, 1000)); - const afterLaunch = (await clients()).find(c => c.pid === app.pid); + const afterLaunch = await until(async () => (await clients()).find(c => c.pid === app.pid), c => c && c.fullscreen === 1 && !c.floating); assert.ok(afterLaunch, 'The launcher disappeared'); assert.equal(afterLaunch.floating, false, 'Launching Code turned Multi Codex into a floating popup'); + for (let cycle = 0; cycle < 3; cycle++) { + await exec('hyprctl', ['eval', `hl.dispatch(hl.dsp.focus({workspace=${originalWorkspace + 20}}))`]); + await new Promise(resolve => setTimeout(resolve, 300)); + await exec('hyprctl', ['eval', `hl.dispatch(hl.dsp.focus({workspace=${originalWorkspace}}))`]); + const restored = await until(async () => (await clients()).find(c => c.pid === app.pid), c => c && c.fullscreen === 1 && !c.floating); + assert.equal(restored.workspace.id, originalWorkspace, 'The launcher moved desktops'); + } + // Reproduce the screenshot state after startup; the long-lived guard must + // repair it without stealing focus or moving the launcher. + await exec('hyprctl', ['eval', `local w=hl.get_window('address:${before.address}'); assert(w); hl.dispatch(hl.dsp.window.fullscreen_state({internal=0,client=0,window=w})); hl.dispatch(hl.dsp.window.float({action='set',window=w}))`]); + await until(async () => (await clients()).find(c => c.pid === app.pid), c => c && c.fullscreen === 1 && !c.floating); code.kill('SIGTERM'); - await until(clients, list => !list.some(c => !addresses.has(c.address) && /code/i.test(c.class))); + await until(clients, list => !list.some(c => !addresses.has(c.address) && externalClass.test(c.class))); const afterClose = (await clients()).find(c => c.pid === app.pid); assert.equal(afterClose.floating, false, 'The launcher retained a floating restore state'); const details = value => ({ floating: value.floating, fullscreen: value.fullscreen, size: value.size }); - const report = { passed: true, before: details(before), afterLaunch: details(afterLaunch), afterClose: details(afterClose), temporaryData: true }; + const report = { passed: true, target, before: details(before), afterLaunch: details(afterLaunch), afterClose: details(afterClose), desktopSwitchCycles: 3, repairedFloatingRestore: true, temporaryData: true }; await mkdir('test-results', { recursive: true }); await writeFile('test-results/launcher-window.json', JSON.stringify(report, null, 2)); console.log(JSON.stringify(report, null, 2)); } catch (error) { diff --git a/tauri/scripts/windows-installer-smoke.ps1 b/tauri/scripts/windows-installer-smoke.ps1 new file mode 100644 index 00000000..97cc7d05 --- /dev/null +++ b/tauri/scripts/windows-installer-smoke.ps1 @@ -0,0 +1,100 @@ +[CmdletBinding()] +param([Parameter(Mandatory)][string]$Installer) +$ErrorActionPreference = 'Stop' +$candidateInstallerPath = (Resolve-Path -LiteralPath $Installer).Path +$root = Join-Path $env:RUNNER_TEMP ('Multi Codex Windows 工具 O''Brien ' + [guid]::NewGuid()) +$install = Join-Path $root 'application' +$evidence = Join-Path $env:RUNNER_TEMP 'multi-codex-windows-evidence' +New-Item -ItemType Directory -Path $root,$evidence | Out-Null +$oldRoaming = $env:APPDATA; $oldHome = $env:CODEX_HOME +$env:APPDATA = Join-Path $root 'roaming' +$env:CODEX_HOME = Join-Path $root 'global-home' +$data = Join-Path $env:APPDATA 'multi-codex' +$profile = Join-Path $data 'profiles/00000000-0000-4000-8000-000000000000/codex-home' +New-Item -ItemType Directory -Path $profile,$env:CODEX_HOME | Out-Null +$fixtures = @{ + (Join-Path $data 'profiles.json') = "[]`n" + (Join-Path $data 'executables.json') = '{"codePath":null,"codexPath":null,"globalCodexHome":null}' + (Join-Path $profile 'auth.json') = '{"fixture":"private-profile-sentinel"}' + (Join-Path $profile 'session.jsonl') = '{"fixture":"conversation-preservation"}' + (Join-Path $env:CODEX_HOME 'auth.json') = '{"fixture":"default-login-sentinel"}' +} +foreach ($entry in $fixtures.GetEnumerator()) { [IO.File]::WriteAllText($entry.Key,$entry.Value) } +function Assert-Fixtures { + foreach ($entry in $fixtures.GetEnumerator()) { + if ([IO.File]::ReadAllText($entry.Key) -cne $entry.Value) { throw "Installer/startup modified $($entry.Key)" } + } +} +# Substitute only release transport. Both published scripts perform their real +# checksum validation and execute the exact candidate's native NSIS installer. +# Keep fixture transport state distinct from installer-local variables: PowerShell +# resolves names dynamically and the invoked script uses $installer for metadata. +$packageName = Split-Path $candidateInstallerPath -Leaf +$candidateChecksumValid = $true +function Invoke-RestMethod { + param([string]$Uri) + if ($Uri -ne 'https://api.github.com/repos/wrestle-R/multi-codex/releases/latest') { throw 'Unexpected metadata request' } + return @{ tag_name = 'candidate-under-test'; assets = @( + @{ name=$packageName; browser_download_url='https://fixture.invalid/installer' }, + @{ name='SHA256SUMS'; browser_download_url='https://fixture.invalid/sums' } + ) } +} +function Invoke-WebRequest { + param([string]$Uri,[string]$OutFile) + if ($Uri -eq 'https://fixture.invalid/installer') { Copy-Item -LiteralPath $candidateInstallerPath -Destination $OutFile; return } + if ($Uri -ne 'https://fixture.invalid/sums') { throw 'Unexpected asset request' } + $hash = if ($candidateChecksumValid) { (Get-FileHash -LiteralPath $candidateInstallerPath -Algorithm SHA256).Hash } else { '0' * 64 } + return @{ Content = "$hash $packageName`n" } +} +Add-Type @' +using System; +using System.Runtime.InteropServices; +public static class LauncherWindows { + [DllImport("user32.dll")] public static extern bool IsZoomed(IntPtr window); + [DllImport("user32.dll")] public static extern bool IsWindowVisible(IntPtr window); + [DllImport("user32.dll")] public static extern IntPtr SendMessage(IntPtr window, uint msg, IntPtr wParam, IntPtr lParam); +} +'@ +function Check-Window { + $application = Join-Path $install 'multi-codex-desktop.exe' + $app = Start-Process -FilePath $application -PassThru + try { + $deadline = [DateTime]::UtcNow.AddSeconds(45) + do { + $app.Refresh() + if ($app.HasExited) { throw "Packaged Windows app exited with $($app.ExitCode)" } + if ($app.MainWindowHandle -ne 0 -and [LauncherWindows]::IsWindowVisible($app.MainWindowHandle)) { break } + Start-Sleep -Milliseconds 250 + } while ([DateTime]::UtcNow -lt $deadline) + if ($app.MainWindowHandle -eq 0) { throw 'Packaged app has no native window' } + if (![LauncherWindows]::IsZoomed($app.MainWindowHandle)) { throw 'Launcher did not start maximized' } + Start-Sleep -Seconds 3 + $app.Refresh() + if ($app.HasExited) { throw 'Launcher stopped after startup' } + [void][LauncherWindows]::SendMessage($app.MainWindowHandle,0x0010,[IntPtr]::Zero,[IntPtr]::Zero) + if (!$app.WaitForExit(15000)) { throw 'Windows close did not exit the launcher' } + Assert-Fixtures + } finally { if (!$app.HasExited) { Stop-Process -Id $app.Id -Force; $app.WaitForExit() } } +} +try { + $scriptsRoot = (Resolve-Path (Join-Path $PSScriptRoot '../../scripts')).Path + $candidateChecksumValid = $false + $rejected = $false + try { & (Join-Path $scriptsRoot 'install-app.ps1') -NoLaunch -InstallDirectory $install } + catch { if ($_.Exception.Message -notmatch 'checksum verification failed') { throw }; $rejected=$true } + if (!$rejected -or (Test-Path $install)) { throw 'Checksum mismatch must reject installation before executing it' } + $candidateChecksumValid = $true + & (Join-Path $scriptsRoot 'install-app.ps1') -NoLaunch -InstallDirectory $install + Assert-Fixtures + Check-Window + & (Join-Path $scriptsRoot 'update-app.ps1') -NoLaunch -InstallDirectory $install + Assert-Fixtures + Check-Window + Check-Window + $result = @{ passed=$true; install=$true; update=$true; restart=$true; nativeVisibleWindow=$true; maximized=$true; closeExits=$true; checksumMismatchRejected=$true; profileAndConversationFixturesPreserved=$true; unicodeAndSpacedPaths=$true; installerSHA256=(Get-FileHash $candidateInstallerPath -Algorithm SHA256).Hash.ToLower(); authenticatedAccounts='synthetic fixtures; no real credentials'; environment=[Environment]::OSVersion.VersionString; testedAt=[DateTime]::UtcNow.ToString('o') } + $result | ConvertTo-Json | Set-Content (Join-Path $evidence 'installer-result.json') + $result | ConvertTo-Json +} finally { + $env:APPDATA=$oldRoaming; $env:CODEX_HOME=$oldHome + Remove-Item -LiteralPath $root -Recurse -Force +} diff --git a/tauri/src-tauri/Cargo.lock b/tauri/src-tauri/Cargo.lock index 83117a13..b41824b5 100644 --- a/tauri/src-tauri/Cargo.lock +++ b/tauri/src-tauri/Cargo.lock @@ -2073,6 +2073,30 @@ dependencies = [ "log", ] +[[package]] +name = "libappindicator" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03589b9607c868cc7ae54c0b2a22c8dc03dd41692d48f2d7df73615c6a95dc0a" +dependencies = [ + "glib", + "gtk", + "gtk-sys", + "libappindicator-sys", + "log", +] + +[[package]] +name = "libappindicator-sys" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e9ec52138abedcc58dc17a7c6c0c00a2bdb4f3427c7f63fa97fd0d859155caf" +dependencies = [ + "gtk-sys", + "libloading", + "once_cell", +] + [[package]] name = "libc" version = "0.2.189" @@ -2088,6 +2112,16 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "libloading" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +dependencies = [ + "cfg-if", + "winapi", +] + [[package]] name = "libredox" version = "0.1.23" @@ -2220,7 +2254,7 @@ dependencies = [ [[package]] name = "multi-codex-desktop" -version = "1.3.8" +version = "1.4.0" dependencies = [ "base64 0.22.1", "chrono", @@ -2231,11 +2265,13 @@ dependencies = [ "libc", "serde", "serde_json", + "sysinfo", "tauri", "tauri-build", "tempfile", "toml_edit 0.25.13+spec-1.1.0", "uuid", + "windows-sys 0.61.2", "zbus", ] @@ -2269,6 +2305,15 @@ version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" +[[package]] +name = "ntapi" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3b335231dfd352ffb0f8017f3b6027a4917f7df785ea2143d8af2adc66980ae" +dependencies = [ + "winapi", +] + [[package]] name = "num" version = "0.4.3" @@ -2491,10 +2536,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" dependencies = [ "bitflags 2.13.1", + "block2", "objc2", "objc2-core-foundation", ] +[[package]] +name = "objc2-io-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33fafba39597d6dc1fb709123dfa8289d39406734be322956a69f0931c73bb15" +dependencies = [ + "libc", + "objc2-core-foundation", +] + [[package]] name = "objc2-io-surface" version = "0.3.2" @@ -3566,6 +3622,20 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "sysinfo" +version = "0.37.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16607d5caffd1c07ce073528f9ed972d88db15dd44023fa57142963be3feb11f" +dependencies = [ + "libc", + "memchr", + "ntapi", + "objc2-core-foundation", + "objc2-io-kit", + "windows", +] + [[package]] name = "system-deps" version = "6.2.2" @@ -3680,6 +3750,7 @@ dependencies = [ "tauri-utils", "thiserror 2.0.20", "tokio", + "tray-icon", "url", "webkit2gtk", "webview2-com", @@ -4188,6 +4259,28 @@ dependencies = [ "once_cell", ] +[[package]] +name = "tray-icon" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "045979e3f037cd18ad1cb2a419dfda133c5c29c9f3453370079f2255d46c257e" +dependencies = [ + "crossbeam-channel", + "dirs", + "libappindicator", + "muda", + "objc2", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation", + "once_cell", + "png 0.18.1", + "serde", + "thiserror 2.0.20", + "windows-sys 0.61.2", +] + [[package]] name = "try-lock" version = "0.2.5" diff --git a/tauri/src-tauri/Cargo.toml b/tauri/src-tauri/Cargo.toml index 953c5231..280c5302 100644 --- a/tauri/src-tauri/Cargo.toml +++ b/tauri/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "multi-codex-desktop" -version = "1.3.8" +version = "1.4.0" description = "Run isolated Codex accounts in separate VS Code windows" default-run = "multi-codex-desktop" authors = ["Russell Daniel Paul"] @@ -26,7 +26,7 @@ fs2 = "0.4" keyring = "4.2" serde = { version = "1", features = ["derive"] } serde_json = "1" -tauri = { version = "2.11.2", default-features = false, features = ["wry", "x11", "dbus", "image-png"] } +tauri = { version = "2.11.2", default-features = false, features = ["wry", "x11", "dbus", "image-png", "tray-icon"] } tempfile = "3" toml_edit = "0.25" uuid = { version = "1", features = ["v4", "serde"] } @@ -40,3 +40,7 @@ libc = "0.2" [dev-dependencies] tempfile = "3" + +[target.'cfg(windows)'.dependencies] +sysinfo = "0.37" +windows-sys = { version = "0.61", features = ["Win32_Foundation", "Win32_Security", "Win32_Security_Authorization", "Win32_System_Threading", "Win32_System_Memory"] } diff --git a/tauri/src-tauri/icons/menu-bar.png b/tauri/src-tauri/icons/menu-bar.png new file mode 100644 index 00000000..3c798049 Binary files /dev/null and b/tauri/src-tauri/icons/menu-bar.png differ diff --git a/tauri/src-tauri/icons/menu-bar.svg b/tauri/src-tauri/icons/menu-bar.svg new file mode 100644 index 00000000..a702fd97 --- /dev/null +++ b/tauri/src-tauri/icons/menu-bar.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/tauri/src-tauri/src/account_menu.rs b/tauri/src-tauri/src/account_menu.rs new file mode 100644 index 00000000..4a98546b --- /dev/null +++ b/tauri/src-tauri/src/account_menu.rs @@ -0,0 +1,177 @@ +//! Native menu bar uses the same account and launch flow as the main window. +use crate::launch_targets::LaunchTargets; +#[cfg(target_os = "macos")] +use crate::AppState; +#[cfg(target_os = "macos")] +use tauri::menu::{Menu, MenuItem, PredefinedMenuItem, Submenu}; +#[cfg(target_os = "macos")] +use tauri::{Emitter, Manager}; + +pub fn launch_actions(targets: &LaunchTargets) -> Vec<(&'static str, &'static str)> { + let mut actions = Vec::new(); + if targets.vscode_installed { + actions.push(("vscode", "Open VS Code")); + } + if targets.standalone_installed && targets.standalone_verified { + actions.push(("standalone", "Open Codex")); + } + if targets.codex_cli_available { + actions.push(("cli", "Open CLI")); + } + actions +} + +#[cfg(target_os = "macos")] +pub fn menu(app: &tauri::AppHandle) -> tauri::Result> { + let menu = Menu::new(app)?; + menu.append(&MenuItem::with_id( + app, + "open", + "Open Multi Codex", + true, + None::<&str>, + )?)?; + let actions = launch_actions(&crate::launch_targets::detect()); + let service = app.state::(); + let profiles = service.service.list_profiles().unwrap_or_default(); + if profiles.is_empty() { + menu.append(&MenuItem::with_id( + app, + "add", + "Add account…", + true, + None::<&str>, + )?)?; + } + for profile in profiles { + let account = Submenu::new(app, &profile.metadata.name, !actions.is_empty())?; + for (target, label) in &actions { + account.append(&MenuItem::with_id( + app, + format!("launch:{target}:{}", profile.metadata.id), + *label, + true, + None::<&str>, + )?)?; + } + menu.append(&account)?; + } + menu.append(&PredefinedMenuItem::separator(app)?)?; + menu.append(&MenuItem::with_id( + app, + "refresh", + "Refresh All Usage", + true, + None::<&str>, + )?)?; + menu.append(&MenuItem::with_id( + app, + "quit", + "Quit Multi Codex", + true, + None::<&str>, + )?)?; + Ok(menu) +} + +#[cfg(target_os = "macos")] +pub fn show(app: &tauri::AppHandle) { + if let Some(window) = app.get_webview_window("main") { + let _ = window.show(); + let _ = window.unminimize(); + let _ = window.maximize(); + let _ = window.set_focus(); + } +} + +#[cfg(target_os = "macos")] +pub fn setup(app: &tauri::AppHandle) -> tauri::Result<()> { + let initial_menu = menu(app)?; + // A monochrome template adapts to both light and dark macOS menu bars. + let icon = tauri::image::Image::from_bytes(include_bytes!("../icons/menu-bar.png"))?; + tauri::tray::TrayIconBuilder::with_id("accounts") + .icon(icon) + .icon_as_template(true) + .tooltip("Multi Codex") + .menu(&initial_menu) + .on_menu_event(|app, event| { + let id = event.id.as_ref(); + match id { + "quit" => app.exit(0), + "open" | "add" => { + show(app); + if id == "add" { + let _ = app.emit("account-menu-add", ()); + } + } + "refresh" => { + let _ = app.emit("account-menu-refresh", ()); + } + _ => { + if let Some(value) = id.strip_prefix("launch:") { + if let Some((target, account)) = value.split_once(':') { + show(app); + let _ = app.emit( + "account-menu-launch", + serde_json::json!({"target":target,"id":account}), + ); + } + } + } + } + }) + .build(app)?; + // Update after account edits in either the app or extension, and after apps + // are installed/removed. Build menus only when the visible model changes. + let handle = app.clone(); + std::thread::spawn(move || { + let mut previous = String::new(); + loop { + let state = handle.state::(); + let profiles = state.service.list_profiles().unwrap_or_default(); + let fingerprint = format!( + "{:?}:{:?}", + profiles + .iter() + .map(|p| (&p.metadata.id, &p.metadata.name)) + .collect::>(), + launch_actions(&crate::launch_targets::detect()) + ); + if fingerprint != previous { + if let Ok(menu) = menu(&handle) { + if let Some(tray) = handle.tray_by_id("accounts") { + let _ = tray.set_menu(Some(menu)); + } + } + previous = fingerprint; + } + std::thread::sleep(std::time::Duration::from_secs(5)); + } + }); + Ok(()) +} + +#[cfg(test)] +mod tests { + use super::*; + #[test] + fn account_actions_only_include_installed_verified_targets() { + let mut targets = LaunchTargets { + platform: "macos".into(), + vscode_installed: false, + codex_cli_available: false, + standalone_installed: false, + standalone_verified: false, + standalone_version: None, + }; + assert!(launch_actions(&targets).is_empty()); + targets.vscode_installed = true; + targets.standalone_installed = true; + assert_eq!(launch_actions(&targets), [("vscode", "Open VS Code")]); + targets.standalone_verified = true; + targets.codex_cli_available = true; + assert_eq!(launch_actions(&targets).len(), 3); + targets.standalone_installed = false; + assert_eq!(launch_actions(&targets).len(), 2); + } +} diff --git a/tauri/src-tauri/src/bin/account-helper.rs b/tauri/src-tauri/src/bin/account-helper.rs index 796a2109..7b2d58c4 100644 --- a/tauri/src-tauri/src/bin/account-helper.rs +++ b/tauri/src-tauri/src/bin/account-helper.rs @@ -1,4 +1,7 @@ fn main() { + if multi_codex_lib::run_bridge_launcher().is_err() { + std::process::exit(1); + } if multi_codex_lib::run_account_helper().is_err() { eprintln!("Multi Codex account helper could not start."); std::process::exit(1); diff --git a/tauri/src-tauri/src/desktop_environment.rs b/tauri/src-tauri/src/desktop_environment.rs index 6d45e745..ca6af62d 100644 --- a/tauri/src-tauri/src/desktop_environment.rs +++ b/tauri/src-tauri/src/desktop_environment.rs @@ -136,6 +136,9 @@ struct HyprMonitor { } pub fn backend() -> &'static str { + if cfg!(target_os = "windows") { + return "windows"; + } if cfg!(target_os = "macos") { return "macos"; } @@ -173,6 +176,7 @@ pub fn inventory() -> Result { "hyprland" => hypr_inventory(), #[cfg(target_os = "linux")] "gnome" | "kde" => crate::linux_desktops::inventory(backend()), + "windows" => Ok(unsupported_inventory("windows", "Windows virtual desktop placement is unavailable. Apps open on the current desktop.".into())), "macos" => Ok(unsupported_inventory("macos", "Native macOS Spaces enumeration and verified placement have not passed the release feasibility gate. Opening on the current desktop is available.".into())), _ => Ok(unsupported_inventory("unsupported", "Desktop control is available on Hyprland, GNOME with the Multi Codex extension, and KDE Plasma 6. Opening on the current desktop is available.".into())), } @@ -380,32 +384,29 @@ pub fn configure_main_window() { if backend() != "hyprland" { return; } + static MONITORING: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(false); + if MONITORING.swap(true, std::sync::atomic::Ordering::Relaxed) { + return; + } let pid = std::process::id(); - thread::spawn(move || { - let deadline = Instant::now() + WINDOW_WAIT; - while Instant::now() < deadline { - if let Ok(clients) = hypr_json::>("clients") { - if let Some(client) = clients - .into_iter() - .find(|client| client.pid == pid && client.mapped) - { - if !client.floating && client.fullscreen == 1 { - return; - } - if valid_address(&client.address) { - let _ = crate::process::output( - Command::new("hyprctl") - .args(["eval", &main_window_lua(&client.address)]), - Duration::from_secs(3), - ); - } - // The first map can precede GTK's maximize request. Verify - // compositor state on the next poll rather than assuming - // the first command took effect. + thread::spawn(move || loop { + if let Ok(clients) = hypr_json::>("clients") { + if let Some(client) = clients + .into_iter() + .find(|client| client.pid == pid && client.mapped) + { + // GTK/compositor focus transitions can restore a floating window + // long after startup. Keep its tiled, maximized state throughout + // launches and desktop changes without focusing or moving it. + if (client.floating || client.fullscreen != 1) && valid_address(&client.address) { + let _ = crate::process::output( + Command::new("hyprctl").args(["eval", &main_window_lua(&client.address)]), + Duration::from_secs(3), + ); } } - thread::sleep(POLL_INTERVAL); } + thread::sleep(Duration::from_millis(250)); }); } @@ -431,7 +432,7 @@ fn main_window_lua(address: &str) -> String { "local w=hl.get_window('address:{address}'); assert(w); \ hl.dispatch(hl.dsp.window.fullscreen_state({{internal=0,client=0,window=w}})); \ hl.dispatch(hl.dsp.window.float({{action='unset',window=w}})); \ - hl.dispatch(hl.dsp.window.fullscreen({{mode='maximized',action='set',window=w}}))" + hl.dispatch(hl.dsp.window.fullscreen_state({{internal=1,client=1,window=w}}))" ) } fn move_window_lua(address: &str, workspace: i32) -> String { diff --git a/tauri/src-tauri/src/desktop_integration.rs b/tauri/src-tauri/src/desktop_integration.rs index 72bb8a8a..fdd2caa2 100644 --- a/tauri/src-tauri/src/desktop_integration.rs +++ b/tauri/src-tauri/src/desktop_integration.rs @@ -1,7 +1,9 @@ +#![cfg(unix)] use serde::Serialize; use std::env; use std::fs::{self, File}; use std::io::{self, Write}; +#[cfg(unix)] use std::os::unix::fs::PermissionsExt; use std::path::{Path, PathBuf}; use std::process::{Command, Stdio}; diff --git a/tauri/src-tauri/src/extension_accounts.rs b/tauri/src-tauri/src/extension_accounts.rs index 431ef4c6..d171fcc0 100644 --- a/tauri/src-tauri/src/extension_accounts.rs +++ b/tauri/src-tauri/src/extension_accounts.rs @@ -12,7 +12,7 @@ impl AuthRecognizer for BundledRecognizer { tempfile::tempdir().map_err(|_| "Could not prepare credential validation")?; profiles::write_private_file(&directory.path().join("auth.json"), auth.as_bytes())?; profiles::write_codex_config(directory.path())?; - let output = std::process::Command::new(&self.0) + let output = crate::process::background(&mut std::process::Command::new(&self.0)) .args(["login", "status"]) .env("CODEX_HOME", directory.path()) .env_remove("OPENAI_API_KEY") @@ -29,6 +29,15 @@ impl AuthRecognizer for BundledRecognizer { pub fn run_account_helper() -> profiles::Result<()> { let args: Vec<_> = std::env::args_os().skip(1).collect(); + if args.len() == 2 && args[0] == "--protect-directory" { + let path = PathBuf::from(&args[1]); + let metadata = std::fs::symlink_metadata(&path) + .map_err(|_| "The private runtime directory is unavailable")?; + if !path.is_absolute() || !metadata.is_dir() || metadata.file_type().is_symlink() { + return Err("The private runtime must be an absolute directory, not a link".into()); + } + return crate::file_security::protect(&path, true); + } if args.len() != 3 { return Err("Expected engine, data directory and global Codex home".into()); } @@ -147,3 +156,52 @@ fn dispatch( _ => Err("Unknown account helper method".into()), } } + +/// Windows uses a native executable wrapper, avoiding cmd.exe and shell quoting. +pub fn run_bridge_launcher() -> profiles::Result { + #[cfg(windows)] + { + let executable = + std::env::current_exe().map_err(|_| "Could not resolve bridge launcher")?; + let config = executable.with_extension("json"); + if !config.is_file() { + return Ok(false); + } + let settings: Value = serde_json::from_slice( + &std::fs::read(&config).map_err(|_| "Could not read bridge config")?, + ) + .map_err(|_| "Invalid bridge config")?; + let mut command = std::process::Command::new( + settings["nodeExecutable"] + .as_str() + .ok_or("Missing bridge runtime")?, + ); + command + .arg( + settings["bridgeScript"] + .as_str() + .ok_or("Missing bridge script")?, + ) + .arg("--bridge-config") + .arg(config) + .args(std::env::args_os().skip(1)) + .env("ELECTRON_RUN_AS_NODE", "1"); + let mut system = sysinfo::System::new(); + system.refresh_processes( + sysinfo::ProcessesToUpdate::Some(&[sysinfo::Pid::from_u32(std::process::id())]), + true, + ); + if let Some(parent) = system + .process(sysinfo::Pid::from_u32(std::process::id())) + .and_then(|p| p.parent()) + { + command.env("MULTI_CODEX_HOST_PID", parent.as_u32().to_string()); + } + let status = command + .status() + .map_err(|_| "Could not start bridge runtime")?; + std::process::exit(status.code().unwrap_or(1)); + } + #[cfg(not(windows))] + Ok(false) +} diff --git a/tauri/src-tauri/src/file_security.rs b/tauri/src-tauri/src/file_security.rs new file mode 100644 index 00000000..bebdeae2 --- /dev/null +++ b/tauri/src-tauri/src/file_security.rs @@ -0,0 +1,122 @@ +//! Platform permissions and durable replacement for private account data. +use crate::profiles::Result; +use std::path::Path; + +#[cfg(unix)] +pub fn protect(path: &Path, directory: bool) -> Result<()> { + use std::os::unix::fs::PermissionsExt; + std::fs::set_permissions( + path, + std::fs::Permissions::from_mode(if directory { 0o700 } else { 0o600 }), + ) + .map_err(|e| format!("Could not protect {}: {e}", path.display())) +} + +#[cfg(windows)] +pub fn protect(path: &Path, directory: bool) -> Result<()> { + use std::os::windows::ffi::OsStrExt; + use std::ptr::null_mut; + use windows_sys::Win32::{ + Foundation::{CloseHandle, LocalFree}, + Security::{ + Authorization::{ + ConvertSidToStringSidW, ConvertStringSecurityDescriptorToSecurityDescriptorW, + SetNamedSecurityInfoW, SE_FILE_OBJECT, + }, + GetSecurityDescriptorDacl, GetTokenInformation, TokenUser, TOKEN_QUERY, TOKEN_USER, + }, + System::Threading::{GetCurrentProcess, OpenProcessToken}, + }; + // Apply a protected DACL granting only this user and SYSTEM access. New child + // files inherit the directory ACL, so credentials are private at creation. + unsafe { + let mut token = null_mut(); + if OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &mut token) == 0 { + return Err("Could not inspect Windows account identity".into()); + } + let mut size = 0; + GetTokenInformation(token, TokenUser, null_mut(), 0, &mut size); + let mut bytes = vec![0u64; (size as usize).div_ceil(8)]; + let success = + GetTokenInformation(token, TokenUser, bytes.as_mut_ptr().cast(), size, &mut size); + CloseHandle(token); + if success == 0 { + return Err("Could not read Windows account identity".into()); + } + let user = &*(bytes.as_ptr().cast::()); + let mut sid = null_mut(); + if ConvertSidToStringSidW(user.User.Sid, &mut sid) == 0 { + return Err("Could not encode Windows account identity".into()); + } + let mut length = 0; + while *sid.add(length) != 0 { + length += 1; + } + let identity = String::from_utf16_lossy(std::slice::from_raw_parts(sid, length)); + LocalFree(sid.cast()); + let inherit = if directory { "OICI" } else { "" }; + let sddl: Vec = format!("D:P(A;{inherit};FA;;;{identity})(A;{inherit};FA;;;SY)") + .encode_utf16() + .chain(Some(0)) + .collect(); + let mut descriptor = null_mut(); + if ConvertStringSecurityDescriptorToSecurityDescriptorW( + sddl.as_ptr(), + 1, + &mut descriptor, + null_mut(), + ) == 0 + { + return Err("Could not prepare private Windows permissions".into()); + } + let mut present = 0; + let mut defaulted = 0; + let mut acl = null_mut(); + if GetSecurityDescriptorDacl(descriptor, &mut present, &mut acl, &mut defaulted) == 0 { + LocalFree(descriptor); + return Err("Could not read private Windows permissions".into()); + } + let path: Vec = path.as_os_str().encode_wide().chain(Some(0)).collect(); + let result = SetNamedSecurityInfoW( + path.as_ptr(), + SE_FILE_OBJECT, + 0x00000004 | 0x80000000, + null_mut(), + null_mut(), + acl, + null_mut(), + ); + LocalFree(descriptor); + if result != 0 { + return Err(format!( + "Could not protect Windows account data (error {result})" + )); + } + } + Ok(()) +} + +pub fn sync_directory(path: &Path) -> Result<()> { + #[cfg(unix)] + std::fs::File::open(path) + .and_then(|f| f.sync_all()) + .map_err(|e| format!("Could not sync data directory: {e}"))?; + #[cfg(windows)] + let _ = path; // Persisted file handles are flushed; Windows does not support Unix directory fsync. + Ok(()) +} + +pub fn lock_file(path: &Path) -> Result { + let mut options = std::fs::OpenOptions::new(); + options.read(true).write(true).create(true).truncate(false); + #[cfg(unix)] + { + use std::os::unix::fs::OpenOptionsExt; + options.mode(0o600); + } + let file = options + .open(path) + .map_err(|_| "Could not open private account lock")?; + protect(path, false)?; + Ok(file) +} diff --git a/tauri/src-tauri/src/launch_targets.rs b/tauri/src-tauri/src/launch_targets.rs index b9a6c0af..8606375e 100644 --- a/tauri/src-tauri/src/launch_targets.rs +++ b/tauri/src-tauri/src/launch_targets.rs @@ -31,12 +31,15 @@ pub fn detect() -> LaunchTargets { } fn verified_version(platform: &str, architecture: &str, version: Option<&str>) -> bool { - // This internal desktop isolation API was exercised with two real identities, - // cold credential reuse, refresh and logout. Unknown versions fail closed. + // Linux and Mac have authenticated isolation evidence. Windows additionally + // has native signed-MSIX, two-home and cold-restart runner coverage with + // inert credentials. Only these exact platform builds are enabled. matches!( - (platform, architecture), - ("linux", "x86_64") | ("macos", "aarch64") - ) && version == Some("26.930.51102") + (platform, architecture, version), + ("linux", "x86_64", Some("26.930.51102")) + | ("macos", "aarch64", Some("26.930.51102")) + | ("windows", "x86_64", Some("26.930.61225")) + ) } fn find_standalone( @@ -81,12 +84,12 @@ pub(crate) fn bundled_standalone_cli() -> Option { let cli = if std::env::consts::OS == "macos" { resources.join("codex-cli/CodexCLI.app/Contents/MacOS/codex") } else { - resources.join("codex") + resources.join(if cfg!(windows) { "codex.exe" } else { "codex" }) }; crate::profiles::is_executable_file(&cli).then_some(cli) } -fn desktop_version(binary: &Path) -> Option { +pub(crate) fn desktop_version(binary: &Path) -> Option { let parent = binary.parent()?; for archive in [ parent.join("resources/app.asar"), @@ -141,6 +144,8 @@ fn standalone_candidates( .map(|name| root.join(format!("{name}.app/Contents/MacOS/{name}"))) }) .collect(), + #[cfg(windows)] + "windows" => crate::windows_platform::standalone_candidates(home, path.as_deref()), "linux" => { // `codex` is also the CLI name: never treat it as the desktop app. let mut candidates: Vec<_> = path @@ -189,6 +194,13 @@ mod tests { fn unknown_versions_and_unverified_architectures_cannot_launch() { assert!(verified_version("linux", "x86_64", Some("26.930.51102"))); assert!(verified_version("macos", "aarch64", Some("26.930.51102"))); + assert!(verified_version("windows", "x86_64", Some("26.930.61225"))); + assert!(!verified_version( + "windows", + "aarch64", + Some("26.930.61225") + )); + assert!(!verified_version("windows", "x86_64", Some("26.930.51102"))); assert!(!verified_version("linux", "x86_64", Some("26.931.1"))); assert!(!verified_version("macos", "x86_64", Some("26.930.51102"))); assert!(!verified_version("linux", "x86_64", None)); diff --git a/tauri/src-tauri/src/lib.rs b/tauri/src-tauri/src/lib.rs index 229f74af..033ce4b5 100644 --- a/tauri/src-tauri/src/lib.rs +++ b/tauri/src-tauri/src/lib.rs @@ -1,8 +1,15 @@ +#[cfg(any(target_os = "macos", test))] +mod account_menu; #[cfg(target_os = "linux")] mod application_icons; mod desktop_environment; +#[cfg(unix)] +mod desktop_integration; +#[cfg(windows)] +#[path = "windows_integration.rs"] mod desktop_integration; mod extension_accounts; +mod file_security; mod launch; mod launch_targets; #[cfg(target_os = "linux")] @@ -12,8 +19,10 @@ mod profiles; mod settings; mod terminals; mod usage; +#[cfg(windows)] +mod windows_platform; -pub use extension_accounts::run_account_helper; +pub use extension_accounts::{run_account_helper, run_bridge_launcher}; use desktop_integration::{DesktopIntegration, DesktopIntegrationStatus}; use profiles::{ @@ -187,7 +196,20 @@ async fn open_device_login_browser() -> Result { Ok(true) }).await.map_err(|_| "Could not open the default browser".to_string())? } - #[cfg(not(target_os = "macos"))] + #[cfg(windows)] + { + use std::os::windows::process::CommandExt; + Command::new("rundll32.exe") + .args([ + "url.dll,FileProtocolHandler", + "https://auth.openai.com/codex/device", + ]) + .creation_flags(0x08000000) + .spawn() + .map_err(|_| "Could not open the default browser".to_string())?; + Ok(true) + } + #[cfg(target_os = "linux")] Ok(false) } @@ -557,7 +579,7 @@ pub fn run() { eprintln!("Multi Codex could not initialize desktop integration: {error}"); std::process::exit(1); }); - tauri::Builder::default() + let app = tauri::Builder::default() .manage(AppState { service: Arc::new(service), launches: Arc::new(Mutex::new(launch::LaunchCoordinator::default())), @@ -572,8 +594,26 @@ pub fn run() { window.set_icon(icon)?; } desktop_environment::configure_main_window(); + #[cfg(target_os = "macos")] + account_menu::setup(app.handle())?; Ok(()) }) + .on_window_event(|window, event| { + #[cfg(target_os = "macos")] + if window.label() == "main" { + if let tauri::WindowEvent::CloseRequested { api, .. } = event { + api.prevent_close(); + let _ = window.hide(); + } + } + if window.label() == "main" + && desktop_environment::backend() != "hyprland" + && matches!(event, tauri::WindowEvent::Focused(true)) + && !window.is_maximized().unwrap_or(false) + { + let _ = window.maximize(); + } + }) .invoke_handler(tauri::generate_handler![ get_desktop_inventory, get_executable_settings, @@ -602,8 +642,14 @@ pub fn run() { get_desktop_integration_status, install_desktop_integration, ]) - .run(tauri::generate_context!()) - .expect("error while running Multi Codex"); + .build(tauri::generate_context!()) + .expect("error while building Multi Codex"); + app.run(|_app, _event| { + #[cfg(target_os = "macos")] + if matches!(_event, tauri::RunEvent::Reopen { .. }) { + account_menu::show(_app); + } + }); } #[cfg(test)] diff --git a/tauri/src-tauri/src/process.rs b/tauri/src-tauri/src/process.rs index 6829b22d..007a2f47 100644 --- a/tauri/src-tauri/src/process.rs +++ b/tauri/src-tauri/src/process.rs @@ -4,7 +4,35 @@ use std::process::{Command, Output, Stdio}; use std::thread; use std::time::{Duration, Instant}; +pub fn background(command: &mut Command) -> &mut Command { + #[cfg(windows)] + { + use std::os::windows::process::CommandExt; + command.creation_flags(0x08000000); + } + command +} + +pub fn spawn(command: &mut Command) -> std::io::Result { + background(command); + #[cfg(target_os = "linux")] + let deadline = Instant::now() + Duration::from_millis(250); + loop { + match command.spawn() { + // A concurrent fork can briefly retain a recently closed writable + // executable handle until exec closes it. Retry Linux ETXTBSY only; + // a failed spawn has not started the requested process. + #[cfg(target_os = "linux")] + Err(error) if error.raw_os_error() == Some(26) && Instant::now() < deadline => { + thread::sleep(Duration::from_millis(10)); + } + result => return result, + } + } +} + pub fn output(command: &mut Command, timeout: Duration) -> Result { + background(command); let mut child = command .stdin(Stdio::null()) .stdout(Stdio::piped()) @@ -51,3 +79,38 @@ pub fn output(command: &mut Command, timeout: Duration) -> Result ProfileService { { crate::terminals::launch(terminal, &binary, &args, &workspace) } + #[cfg(windows)] + { + crate::windows_platform::launch_cli( + terminal, + &binary, + codex, + &paths.codex_home, + &workspace, + ) + } #[cfg(target_os = "macos")] { if terminal != crate::terminals::Terminal::Terminal { @@ -790,6 +801,10 @@ impl ProfileService { if !profile.auth_mode.eq_ignore_ascii_case("chatgpt") { return Err("Live limits are available only for ChatGPT accounts".to_string()); } + // Usage can rotate tokens. Reuse extension locks so another client + // cannot refresh, replace or delete this account before the child exits. + let _lease = self.extension_lease(id)?; + let _credential_lock = self.extension_credential_lock(id)?; self.current_profile_credential(id)?; let paths = self.profile_paths(id)?; let result = read_profile_limits(&paths.codex_home); @@ -859,21 +874,13 @@ impl ProfileService { } fn metadata_write_lock(&self) -> Result { - use std::os::unix::fs::OpenOptionsExt; let path = self.data_root.join(".profiles.lock"); if let Ok(metadata) = fs::symlink_metadata(&path) { if !metadata.is_file() || metadata.file_type().is_symlink() { return Err("Account lock must be a regular file".into()); } } - let file = fs::OpenOptions::new() - .read(true) - .write(true) - .create(true) - .truncate(false) - .mode(0o600) - .open(path) - .map_err(|_| "Could not open account lock")?; + let file = crate::file_security::lock_file(&path)?; fs2::FileExt::lock_exclusive(&file).map_err(|_| "Could not lock account changes")?; Ok(file) } @@ -900,15 +907,7 @@ impl ProfileService { return Err("Extension lease must be a regular file".into()); } } - use std::os::unix::fs::OpenOptionsExt; - let file = fs::OpenOptions::new() - .read(true) - .write(true) - .create(true) - .truncate(false) - .mode(0o600) - .open(path) - .map_err(|_| "Could not open extension account lease")?; + let file = crate::file_security::lock_file(&path)?; fs2::FileExt::lock_shared(&file) .map_err(|_| "Could not protect the active extension account")?; Ok(file) @@ -924,12 +923,15 @@ impl ProfileService { Ok(metadata) if metadata.is_file() && !metadata.file_type().is_symlink() => {} _ => return Err("Extension lease must be a regular file".into()), } - let file = File::open(path).map_err(|_| "Could not inspect extension account lease")?; + let file = fs::OpenOptions::new() + .read(true) + .write(true) + .open(path) + .map_err(|_| "Could not inspect extension account lease")?; Ok(fs2::FileExt::try_lock_exclusive(&file).is_err()) } pub(crate) fn extension_credential_lock(&self, id: &str) -> Result { - use std::os::unix::fs::OpenOptionsExt; validate_id(id)?; let path = self .profile_paths(id)? @@ -940,14 +942,7 @@ impl ProfileService { return Err("Credential lock must be a regular file".into()); } } - let file = fs::OpenOptions::new() - .read(true) - .write(true) - .create(true) - .truncate(false) - .mode(0o600) - .open(path) - .map_err(|_| "Could not open credential lock")?; + let file = crate::file_security::lock_file(&path)?; fs2::FileExt::try_lock_exclusive(&file) .map_err(|_| "Another window is refreshing this account. Retry in a moment.")?; Ok(file) @@ -1275,9 +1270,7 @@ fn canonical_workspace(workspace: &Path) -> Result { pub fn default_service() -> Result> { let home = dirs::home_dir().ok_or_else(|| "Home directory is unavailable".to_string())?; - let data_root = dirs::data_dir() - .ok_or_else(|| "Data directory is unavailable".to_string())? - .join("multi-codex"); + let data_root = crate::settings::data_root()?; let codex_home = crate::settings::global_codex_home( &home, env::var_os("CODEX_HOME"), @@ -1403,9 +1396,7 @@ fn atomic_write_metadata(root: &Path, profiles: &[ProfileMetadata]) -> Result<() write_private_file(&temp_path, &bytes)?; fs::rename(&temp_path, &destination) .map_err(|error| format!("Could not save profile metadata: {error}"))?; - File::open(root) - .and_then(|directory| directory.sync_all()) - .map_err(|error| format!("Could not sync profile metadata: {error}"))?; + crate::file_security::sync_directory(root)?; Ok(()) } @@ -1455,13 +1446,11 @@ fn reclaimable_size(profile_root: &Path) -> Result { } pub(crate) fn set_owner_only_dir(path: &Path) -> Result<()> { - fs::set_permissions(path, fs::Permissions::from_mode(0o700)) - .map_err(|error| format!("Could not protect {}: {error}", path.display())) + crate::file_security::protect(path, true) } fn set_owner_only_file(path: &Path) -> Result<()> { - fs::set_permissions(path, fs::Permissions::from_mode(0o600)) - .map_err(|error| format!("Could not protect {}: {error}", path.display())) + crate::file_security::protect(path, false) } fn read_persisted_credential(path: &Path) -> Result { @@ -1529,17 +1518,13 @@ pub(crate) fn write_private_file(path: &Path, bytes: &[u8]) -> Result<()> { } let mut temp = tempfile::NamedTempFile::new_in(parent) .map_err(|error| format!("Could not create protected temporary file: {error}"))?; - temp.as_file() - .set_permissions(fs::Permissions::from_mode(0o600)) - .map_err(|error| format!("Could not protect temporary file: {error}"))?; + crate::file_security::protect(temp.path(), false)?; temp.write_all(bytes) .and_then(|_| temp.as_file().sync_all()) .map_err(|error| format!("Could not write protected file: {error}"))?; temp.persist(path) .map_err(|error| format!("Could not replace protected file: {}", error.error))?; - File::open(parent) - .and_then(|directory| directory.sync_all()) - .map_err(|error| format!("Could not sync protected file directory: {error}")) + crate::file_security::sync_directory(parent) } fn remove_private_file(path: &Path) -> Result<()> { @@ -1755,6 +1740,12 @@ fn is_extension_cli(path: &Path) -> bool { } fn interactive_codex_with(path: Option<&OsStr>, home: &Path) -> Option { + #[cfg(windows)] + if let Some(found) = + crate::windows_platform::resolve("codex", path, home).filter(|p| !is_extension_cli(p)) + { + return Some(found); + } let paths = path .map(env::split_paths) .into_iter() @@ -1765,7 +1756,7 @@ fn interactive_codex_with(path: Option<&OsStr>, home: &Path) -> Option PathBuf::from("/opt/homebrew/bin/codex"), PathBuf::from("/usr/local/bin/codex"), ]; - #[cfg(target_os = "linux")] + #[cfg(not(target_os = "macos"))] let platform_paths: [PathBuf; 0] = []; paths .chain([ @@ -1784,6 +1775,10 @@ fn require_codex_command(path: Option<&OsStr>, home: &Path) -> Result { } fn resolve_command_with(name: &str, path: Option<&OsStr>, home: &Path) -> Option { + #[cfg(windows)] + if let Some(found) = crate::windows_platform::resolve(name, path, home) { + return Some(found); + } if let Some(candidate) = path.and_then(|paths| { env::split_paths(paths) .map(|directory| directory.join(name)) @@ -1833,11 +1828,18 @@ fn resolve_command_with(name: &str, path: Option<&OsStr>, home: &Path) -> Option } pub(crate) fn is_executable_file(path: &Path) -> bool { - fs::metadata(path) - .is_ok_and(|metadata| metadata.is_file() && metadata.permissions().mode() & 0o111 != 0) + #[cfg(unix)] + return fs::metadata(path).is_ok_and(|m| m.is_file() && m.permissions().mode() & 0o111 != 0); + #[cfg(windows)] + return path.is_file() + && path + .extension() + .is_some_and(|ext| ext.eq_ignore_ascii_case("exe")); } fn find_extension_codex(home: &Path) -> Option { + #[cfg(windows)] + const PLATFORM: &str = "windows-x86_64"; #[cfg(all(target_os = "linux", target_arch = "x86_64"))] const PLATFORM: &str = "linux-x86_64"; #[cfg(all(target_os = "linux", target_arch = "aarch64"))] @@ -1847,6 +1849,7 @@ fn find_extension_codex(home: &Path) -> Option { #[cfg(all(target_os = "macos", target_arch = "aarch64"))] const PLATFORM: &str = "darwin-arm64"; #[cfg(not(any( + windows, all(target_os = "linux", target_arch = "x86_64"), all(target_os = "linux", target_arch = "aarch64"), all(target_os = "macos", target_arch = "x86_64"), @@ -1883,9 +1886,16 @@ fn find_extension_codex_for_platform(home: &Path, platform: &str) -> Option Result bool { + #[cfg(windows)] + if crate::windows_platform::process_uses_home(pid, vscode_home) { + return true; + } if vscode_home .file_name() .is_some_and(|name| name == "codex-home") @@ -2020,6 +2034,8 @@ pub(crate) fn process_uses_profile(pid: u32, vscode_home: &Path) -> bool { let environment = fs::read(format!("/proc/{pid}/environ")).ok(); #[cfg(target_os = "macos")] let environment = macos_process_info(pid); + #[cfg(windows)] + let environment: Option> = None; if environment.is_some_and(|bytes| { bytes .split(|byte| *byte == 0) @@ -2231,7 +2247,7 @@ fn profile_process_running(vscode_home: &Path) -> bool { .any(|pid| process_uses_profile(pid, vscode_home)) } -#[cfg(test)] +#[cfg(all(test, unix))] mod tests { use super::*; #[test] @@ -2415,6 +2431,39 @@ mod tests { assert!(service.list_profiles().unwrap().is_empty()); } + #[test] + fn desktop_usage_refuses_a_peer_credential_refresh_before_starting_a_backend() { + let (_temp, service) = fixture(); + let profile = service.add_profile(sample_input("Shared account")).unwrap(); + let credential_lock = service + .extension_credential_lock(&profile.metadata.id) + .unwrap(); + let before = fs::read( + service + .profile_paths(&profile.metadata.id) + .unwrap() + .codex_home + .join("auth.json"), + ) + .unwrap(); + assert!(service + .check_profile_limits(&profile.metadata.id) + .unwrap_err() + .contains("Another window is refreshing")); + assert_eq!( + fs::read( + service + .profile_paths(&profile.metadata.id) + .unwrap() + .codex_home + .join("auth.json") + ) + .unwrap(), + before + ); + drop(credential_lock); + service.delete_profile(&profile.metadata.id).unwrap(); + } #[test] fn concurrent_account_additions_preserve_every_record() { let (_temp, service) = fixture(); @@ -3974,3 +4023,16 @@ mod tests { assert_eq!(profile.metadata.notes.as_deref(), Some("Keep this")); } } + +#[cfg(windows)] +fn process_arguments(pid: u32) -> Option>> { + crate::windows_platform::process_arguments(pid) +} +#[cfg(windows)] +fn profile_process_running(home: &Path) -> bool { + crate::windows_platform::profile_running(home) +} + +#[cfg(all(test, windows))] +#[path = "profiles_windows_tests.rs"] +mod windows_tests; diff --git a/tauri/src-tauri/src/profiles_windows_tests.rs b/tauri/src-tauri/src/profiles_windows_tests.rs new file mode 100644 index 00000000..18c0d32e --- /dev/null +++ b/tauri/src-tauri/src/profiles_windows_tests.rs @@ -0,0 +1,291 @@ +//! Native Windows checks use disposable homes and inert API-key fixtures. +use super::*; +use std::sync::Mutex; + +#[derive(Default)] +struct MemorySecrets(Mutex>); +impl SecretStore for MemorySecrets { + fn set(&self, id: &str, value: &str) -> Result<()> { + self.0.lock().unwrap().insert(id.into(), value.into()); + Ok(()) + } + fn get(&self, id: &str) -> Result { + self.0 + .lock() + .unwrap() + .get(id) + .cloned() + .ok_or("missing fixture credential".into()) + } + fn delete(&self, id: &str) -> Result<()> { + self.0.lock().unwrap().remove(id); + Ok(()) + } +} +struct AcceptAuth; +impl AuthRecognizer for AcceptAuth { + fn recognize(&self, _: &str) -> Result<()> { + Ok(()) + } +} + +fn fixture() -> (tempfile::TempDir, ProfileService) { + let temp = tempfile::tempdir().unwrap(); + let root = temp + .path() + .canonicalize() + .unwrap() + .join("Windows test 工具 O'Brien"); + let service = ProfileService::new( + root.join("data"), + root.join("global"), + root.join("extensions"), + MemorySecrets::default(), + AcceptAuth, + ) + .unwrap(); + fs::create_dir_all(&service.global_codex_home).unwrap(); + fs::write( + service.global_codex_home.join("auth.json"), + b"untouched-global-sentinel", + ) + .unwrap(); + (temp, service) +} +fn add(service: &ProfileService, label: &str) -> ProfileView { + service + .add_profile(SaveProfileInput { + name: label.into(), + notes: None, + auth_json: format!( + r#"{{"auth_mode":"apikey","OPENAI_API_KEY":"inert-windows-fixture-{label}"}}"# + ), + }) + .unwrap() +} + +#[test] +fn windows_accounts_survive_restart_and_keep_peer_and_global_data_private() { + let (temp, service) = fixture(); + let first = add(&service, "first"); + let second = add(&service, "second"); + let first_path = service.profile_paths(&first.metadata.id).unwrap(); + let second_path = service.profile_paths(&second.metadata.id).unwrap(); + let peer = fs::read(second_path.codex_home.join("auth.json")).unwrap(); + let data = service.data_root.clone(); + let global = service.global_codex_home.clone(); + let extensions = service.data_root.join("unused-shared-extensions"); + // Export/import uses persistent private files; simulate a fresh native process. + let restored = ProfileService::new( + data, + global.clone(), + extensions, + MemorySecrets::default(), + AcceptAuth, + ) + .unwrap(); + assert_eq!(restored.list_profiles().unwrap().len(), 2); + assert_eq!( + restored + .current_profile_credential(&first.metadata.id) + .unwrap(), + fs::read_to_string(first_path.codex_home.join("auth.json")).unwrap() + ); + restored.delete_profile(&first.metadata.id).unwrap(); + assert_eq!( + fs::read(second_path.codex_home.join("auth.json")).unwrap(), + peer + ); + assert_eq!( + fs::read(global.join("auth.json")).unwrap(), + b"untouched-global-sentinel" + ); + assert!(!first_path.codex_home.exists()); + assert!(restored.profile_paths("../escape").is_err()); + drop(temp); +} + +struct NativeCleanup(Vec); +impl Drop for NativeCleanup { + fn drop(&mut self) { + // Electron can create a worker while the first process snapshot is being + // inspected. Recheck only these disposable homes after killing a tree. + for _ in 0..3 { + let mut system = sysinfo::System::new_all(); + system.refresh_processes(sysinfo::ProcessesToUpdate::All, true); + for process in system.processes().values() { + if self.0.iter().any(|home| { + process_uses_profile(process.pid().as_u32(), home) + || process.cmd().windows(2).any(|p| { + p[0].to_string_lossy() + .eq_ignore_ascii_case("-EncodedCommand") + && crate::windows_platform::command_uses_home( + &p[1].to_string_lossy(), + home, + ) + }) + }) { + let _ = Command::new("taskkill.exe") + .args(["/PID", &process.pid().as_u32().to_string(), "/T", "/F"]) + .output(); + } + } + std::thread::sleep(Duration::from_secs(1)); + } + } +} +fn wait_for(label: &str, mut condition: impl FnMut() -> bool) { + eprintln!("Waiting for {label}"); + let end = Instant::now() + Duration::from_secs(60); + while Instant::now() < end { + if condition() { + return; + } + std::thread::sleep(Duration::from_millis(250)); + } + panic!("Native Windows launch did not satisfy {label}"); +} +fn visible(home: &Path) -> bool { + let system = sysinfo::System::new_all(); + system.processes().values().filter(|p| process_uses_profile(p.pid().as_u32(), home)).any(|p| { + crate::process::output(Command::new("powershell.exe").args(["-NoProfile", "-NonInteractive", "-Command", &format!("if ((Get-Process -Id {} -ErrorAction SilentlyContinue).MainWindowHandle -eq 0) {{ exit 1 }}",p.pid())]), Duration::from_secs(5)).is_ok_and(|o| o.status.success()) + }) +} + +#[test] +#[ignore = "requires native Windows VS Code and Codex fixture installations"] +fn windows_live_launches_keep_two_accounts_isolated_and_block_mutation() { + let (_temp, service) = fixture(); + let first = add(&service, "first"); + let second = add(&service, "second"); + let workspace = service.data_root.join("project 工具 O'Brien"); + fs::create_dir_all(&workspace).unwrap(); + let a = service.profile_paths(&first.metadata.id).unwrap(); + let b = service.profile_paths(&second.metadata.id).unwrap(); + let originals = [ + fs::read(a.codex_home.join("auth.json")).unwrap(), + fs::read(b.codex_home.join("auth.json")).unwrap(), + ]; + let homes = vec![ + a.vscode_home.clone(), + b.vscode_home.clone(), + a.codex_home.clone(), + b.codex_home.clone(), + a.desktop_home.clone(), + b.desktop_home.clone(), + ]; + let cleanup = NativeCleanup(homes.clone()); + let code = PathBuf::from(env::var_os("MULTI_CODEX_TEST_VSCODE").expect("VS Code fixture path")); + for profile in [&first, &second] { + service + .launch_profile_with_command(&profile.metadata.id, &workspace, &code) + .unwrap(); + } + for (profile, paths) in [(&first, &a), (&second, &b)] { + wait_for("visible VS Code window and active account guard", || { + visible(&paths.vscode_home) && service.is_running(&profile.metadata.id).unwrap() + }); + assert!(service.delete_profile(&profile.metadata.id).is_err()); + assert!(service.clear_profile_cache(&profile.metadata.id).is_err()); + } + drop(cleanup); + for p in [&first, &second] { + wait_for("VS Code cleanup releasing the account guard", || { + !service.is_running(&p.metadata.id).unwrap() + }); + } + // Exercise the exact native PowerShell launch and marker-based CLI safety guard. + let cli = + PathBuf::from(env::var_os("MULTI_CODEX_TEST_ENGINE").expect("native Codex fixture path")); + let cleanup = NativeCleanup(homes); + service + .launch_cli_profile_with_command(&first.metadata.id, &workspace, &cli) + .unwrap(); + wait_for("PowerShell CLI account guard", || { + service.is_running(&first.metadata.id).unwrap() + }); + assert!(service.delete_profile(&first.metadata.id).is_err()); + assert!(service.clear_profile_cache(&first.metadata.id).is_err()); + drop(cleanup); + wait_for("PowerShell CLI cleanup releasing the account guard", || { + !service.is_running(&first.metadata.id).unwrap() + }); + assert_eq!( + fs::read(a.codex_home.join("auth.json")).unwrap(), + originals[0] + ); + assert_eq!( + fs::read(b.codex_home.join("auth.json")).unwrap(), + originals[1] + ); + assert_eq!( + fs::read(service.global_codex_home.join("auth.json")).unwrap(), + b"untouched-global-sentinel" + ); +} + +#[test] +#[ignore = "opens disposable native Codex desktop windows from the official MSIX"] +fn windows_live_standalone_launch_and_restart_preserve_two_private_homes() { + let (_temp, service) = fixture(); + let binary = PathBuf::from( + env::var_os("MULTI_CODEX_TEST_STANDALONE").expect("official standalone fixture"), + ); + assert_eq!( + crate::launch_targets::desktop_version(&binary).as_deref(), + Some("26.930.61225"), + "Moving official download must not expand the tested-version allowlist" + ); + assert_eq!( + crate::launch_targets::resolve_standalone().unwrap(), + fs::canonicalize(&binary).unwrap(), + "Production discovery must resolve the installed signed MSIX" + ); + let detected = crate::launch_targets::detect(); + assert!(detected.standalone_installed && detected.standalone_verified); + let first = add(&service, "first"); + let second = add(&service, "second"); + let a = service.profile_paths(&first.metadata.id).unwrap(); + let b = service.profile_paths(&second.metadata.id).unwrap(); + let originals = [ + fs::read(a.codex_home.join("auth.json")).unwrap(), + fs::read(b.codex_home.join("auth.json")).unwrap(), + ]; + let workspace = service.data_root.join("project 工具 O'Brien"); + fs::create_dir_all(&workspace).unwrap(); + for attempt in 1..=2 { + let cleanup = NativeCleanup(vec![a.desktop_home.clone(), b.desktop_home.clone()]); + for (p, paths) in [(&first, &a), (&second, &b)] { + service + .launch_standalone_profile(&p.metadata.id, &workspace) + .unwrap(); + wait_for("visible standalone window and active account guard", || { + visible(&paths.desktop_home) && service.is_running(&p.metadata.id).unwrap() + }); + assert!( + service.delete_profile(&p.metadata.id).is_err(), + "Desktop launch {attempt} must protect account deletion" + ); + assert!(service.clear_profile_cache(&p.metadata.id).is_err()); + assert!(paths.desktop_home.join("Local State").is_file()); + } + assert_eq!( + fs::read(a.codex_home.join("auth.json")).unwrap(), + originals[0] + ); + assert_eq!( + fs::read(b.codex_home.join("auth.json")).unwrap(), + originals[1] + ); + assert_eq!( + fs::read(service.global_codex_home.join("auth.json")).unwrap(), + b"untouched-global-sentinel" + ); + assert!(!a.vscode_home.exists() && !b.vscode_home.exists()); + drop(cleanup); + wait_for("standalone cleanup releasing both account guards", || { + !service.is_running(&first.metadata.id).unwrap() + && !service.is_running(&second.metadata.id).unwrap() + }); + } +} diff --git a/tauri/src-tauri/src/settings.rs b/tauri/src-tauri/src/settings.rs index f950e8dc..171b45b9 100644 --- a/tauri/src-tauri/src/settings.rs +++ b/tauri/src-tauri/src/settings.rs @@ -1,7 +1,7 @@ use crate::profiles::Result; use serde::{Deserialize, Serialize}; use std::fs; -use std::io::Write; +#[cfg(all(test, unix))] use std::os::unix::fs::PermissionsExt; use std::path::{Path, PathBuf}; @@ -37,6 +37,14 @@ pub struct ExecutableSettings { } pub fn data_root() -> Result { + #[cfg(windows)] + if let Some(path) = std::env::var_os("APPDATA").filter(|v| !v.is_empty()) { + let path = PathBuf::from(path); + if !path.is_absolute() { + return Err("APPDATA must be an absolute path".into()); + } + return Ok(path.join("multi-codex")); + } dirs::data_dir() .map(|p| p.join("multi-codex")) .ok_or_else(|| "App data directory is unavailable".into()) @@ -103,21 +111,10 @@ pub fn save(mut settings: ExecutableSettings) -> Result { } fn save_to(root: &Path, settings: &ExecutableSettings) -> Result<()> { - fs::create_dir_all(root).map_err(|e| e.to_string())?; - fs::set_permissions(root, fs::Permissions::from_mode(0o700)).map_err(|e| e.to_string())?; - let mut temp = tempfile::NamedTempFile::new_in(root).map_err(|e| e.to_string())?; - temp.as_file() - .set_permissions(fs::Permissions::from_mode(0o600)) - .map_err(|e| e.to_string())?; - temp.write_all(&serde_json::to_vec_pretty(settings).map_err(|e| e.to_string())?) - .map_err(|e| e.to_string())?; - temp.as_file().sync_all().map_err(|e| e.to_string())?; - temp.persist(root.join("executables.json")) - .map_err(|e| e.to_string())?; - fs::File::open(root) - .and_then(|f| f.sync_all()) - .map_err(|e| e.to_string())?; - Ok(()) + crate::profiles::write_private_file( + &root.join("executables.json"), + &serde_json::to_vec_pretty(settings).map_err(|e| e.to_string())?, + ) } pub fn global_codex_home( @@ -136,7 +133,7 @@ pub fn global_codex_home( Ok(path) } -#[cfg(test)] +#[cfg(all(test, unix))] mod tests { use super::*; #[test] diff --git a/tauri/src-tauri/src/terminals.rs b/tauri/src-tauri/src/terminals.rs index fc302621..fc33a66a 100644 --- a/tauri/src-tauri/src/terminals.rs +++ b/tauri/src-tauri/src/terminals.rs @@ -8,6 +8,8 @@ use std::process::{Command, Stdio}; pub enum Terminal { #[default] Automatic, + PowerShell, + WindowsTerminal, Terminal, Kitty, Ghostty, @@ -31,6 +33,8 @@ impl Terminal { fn label(self) -> &'static str { match self { Self::Automatic => "Automatic", + Self::PowerShell => "PowerShell", + Self::WindowsTerminal => "Windows Terminal", Self::Terminal => "Terminal", Self::Kitty => "Kitty", Self::Ghostty => "Ghostty", @@ -45,6 +49,8 @@ impl Terminal { fn command(self) -> &'static str { match self { + Self::PowerShell => "powershell", + Self::WindowsTerminal => "wt", Self::Kitty => "kitty", Self::Ghostty => "ghostty", Self::Konsole => "konsole", @@ -68,6 +74,8 @@ impl Terminal { } fn candidates() -> &'static [Terminal] { + #[cfg(windows)] + return &[Terminal::WindowsTerminal, Terminal::PowerShell]; #[cfg(target_os = "linux")] return &[ Terminal::Konsole, @@ -214,6 +222,7 @@ mod tests { assert!(choose_with(Terminal::Automatic, &supported, |_| None).is_err()); } + #[cfg(unix)] #[test] fn native_terminal_arguments_keep_isolated_command_as_separate_arguments() { let root = tempfile::tempdir().unwrap(); diff --git a/tauri/src-tauri/src/usage.rs b/tauri/src-tauri/src/usage.rs index e7b8db56..8c304e68 100644 --- a/tauri/src-tauri/src/usage.rs +++ b/tauri/src-tauri/src/usage.rs @@ -55,16 +55,17 @@ fn read_with_command( timeout: Duration, checked_at: DateTime, ) -> Result { - let mut child = Command::new(codex) - .args(["app-server", "--stdio"]) - // Use the profile's durable home so a token refreshed by Codex is not discarded with a - // temporary directory. Each Multi Codex profile already has its own isolated CODEX_HOME. - .env("CODEX_HOME", codex_home) - .stdin(Stdio::piped()) - .stdout(Stdio::piped()) - .stderr(Stdio::piped()) - .spawn() - .map_err(|_| "Codex CLI is required to check live limits".to_string())?; + let mut child = crate::process::spawn( + Command::new(codex) + .args(["app-server", "--stdio"]) + // Use the profile's durable home so a token refreshed by Codex is not discarded with a + // temporary directory. Each Multi Codex profile already has its own isolated CODEX_HOME. + .env("CODEX_HOME", codex_home) + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()), + ) + .map_err(|_| "Codex CLI is required to check live limits".to_string())?; let stderr = child .stderr @@ -320,7 +321,7 @@ fn find_window(snapshot: Option<&Value>, duration_mins: i64) -> Result Result { + Ok(Self) + } + pub fn status(&self) -> DesktopIntegrationStatus { + DesktopIntegrationStatus { + available: false, + installed: true, + desktop_shortcut: false, + version: env!("CARGO_PKG_VERSION").into(), + source: "package".into(), + } + } + pub fn install(&self, _: bool) -> Result { + Ok(self.status()) + } +} diff --git a/tauri/src-tauri/src/windows_platform.rs b/tauri/src-tauri/src/windows_platform.rs new file mode 100644 index 00000000..3a2fc51f --- /dev/null +++ b/tauri/src-tauri/src/windows_platform.rs @@ -0,0 +1,404 @@ +//! Windows-native discovery, process inspection and isolated terminal launches. +use crate::profiles::Result; +use base64::{engine::general_purpose::STANDARD, Engine}; +use std::{ + ffi::OsStr, + path::{Path, PathBuf}, + process::{Command, Stdio}, + sync::{Mutex, OnceLock}, + time::{Duration, Instant}, +}; +use sysinfo::{ProcessRefreshKind, ProcessesToUpdate, System, UpdateKind}; + +pub fn resolve(name: &str, path: Option<&OsStr>, home: &Path) -> Option { + let mut candidates = Vec::new(); + if name == "code" { + for root in [ + std::env::var_os("LOCALAPPDATA") + .map(PathBuf::from) + .unwrap_or_else(|| home.join("AppData/Local")), + std::env::var_os("ProgramFiles") + .map(PathBuf::from) + .unwrap_or_default(), + std::env::var_os("ProgramFiles(x86)") + .map(PathBuf::from) + .unwrap_or_default(), + ] { + candidates.extend([ + root.join("Programs/Microsoft VS Code/Code.exe"), + root.join("Microsoft VS Code/Code.exe"), + ]); + } + } + for directory in path.map(std::env::split_paths).into_iter().flatten() { + candidates.push(directory.join(format!("{name}.exe"))); + if name == "code" { + candidates.push(directory.join("../Code.exe")); + } + // npm's codex.cmd delegates to a native executable. Use that executable + // directly to avoid cmd.exe quoting and script-execution-policy changes. + if name == "codex" { + candidates.push(directory.join("node_modules/@openai/codex/node_modules/@openai/codex-win32-x64/vendor/x86_64-pc-windows-msvc/codex/codex.exe")); + candidates.push( + directory.join( + "node_modules/@openai/codex/vendor/x86_64-pc-windows-msvc/codex/codex.exe", + ), + ); + } + } + if name == "codex" { + if let Some(roaming) = std::env::var_os("APPDATA") { + let npm = PathBuf::from(roaming).join("npm"); + candidates.push(npm.join("node_modules/@openai/codex/node_modules/@openai/codex-win32-x64/vendor/x86_64-pc-windows-msvc/codex/codex.exe")); + } + } + candidates + .into_iter() + .find(|p| crate::profiles::is_executable_file(p)) +} + +/// Query registered MSIX locations instead of relying on aliases or privileged +/// enumeration of Program Files/WindowsApps. Cache this slow package query. +pub fn standalone_candidates(home: &Path, path: Option<&OsStr>) -> Vec { + static PACKAGES: OnceLock, Instant)>> = OnceLock::new(); + let mut cache = PACKAGES + .get_or_init(|| Mutex::new((Vec::new(), Instant::now() - Duration::from_secs(60)))) + .lock() + .unwrap_or_else(|p| p.into_inner()); + if cache.1.elapsed() > Duration::from_secs(30) { + cache.0 = crate::process::output( + Command::new("powershell.exe").env_remove("PSModulePath").args([ + "-NoLogo", + "-NoProfile", + "-NonInteractive", + "-Command", + "$ErrorActionPreference = 'Stop'; Get-AppxPackage -Name OpenAI.Codex | ForEach-Object { $_.InstallLocation }", + ]), + // Appx module initialization on a cold Windows installation can + // exceed five seconds. Let Windows PowerShell construct its own + // module path instead of inheriting PowerShell 7's module paths. + Duration::from_secs(15), + ) + .ok() + .filter(|o| o.status.success()) + .map(|o| { + String::from_utf8_lossy(&o.stdout) + .lines() + .map(|line| PathBuf::from(line.trim()).join("app/ChatGPT.exe")) + .collect() + }) + .unwrap_or_default(); + cache.1 = Instant::now(); + } + let mut candidates = cache.0.clone(); + candidates.extend( + path.map(std::env::split_paths) + .into_iter() + .flatten() + .map(|dir| dir.join("ChatGPT.exe")), + ); + candidates.push(home.join("AppData/Local/Programs/Codex/ChatGPT.exe")); + candidates +} + +fn snapshot() -> std::sync::MutexGuard<'static, (System, Instant)> { + static SNAPSHOT: OnceLock> = OnceLock::new(); + let mut guard = SNAPSHOT + .get_or_init(|| Mutex::new((System::new(), Instant::now() - Duration::from_secs(2)))) + .lock() + .unwrap_or_else(|p| p.into_inner()); + if guard.1.elapsed() > Duration::from_millis(400) { + guard.0.refresh_processes_specifics( + ProcessesToUpdate::All, + true, + ProcessRefreshKind::nothing().with_cmd(UpdateKind::Always), + ); + guard.1 = Instant::now(); + } + guard +} + +pub fn process_arguments(pid: u32) -> Option>> { + snapshot().0.process(sysinfo::Pid::from_u32(pid)).map(|p| { + p.cmd() + .iter() + .map(|a| a.to_string_lossy().as_bytes().to_vec()) + .collect() + }) +} + +fn arguments_use_home(args: &[String], home: &Path) -> bool { + args.iter().enumerate().any(|(index, arg)| { + if Path::new(arg) == home { + return true; + } + let value = arg.strip_prefix("--user-data-dir=").or_else(|| { + (index > 0 && args[index - 1] == "--user-data-dir").then_some(arg.as_str()) + }); + value.is_some_and(|value| { + Path::new(value) == home + || std::fs::canonicalize(value) + .ok() + .zip(std::fs::canonicalize(home).ok()) + .is_some_and(|(a, b)| a == b) + }) + }) || args.windows(2).any(|pair| { + pair[0].eq_ignore_ascii_case("-EncodedCommand") && command_uses_home(&pair[1], home) + }) +} + +pub fn process_uses_home(pid: u32, home: &Path) -> bool { + snapshot() + .0 + .process(sysinfo::Pid::from_u32(pid)) + .is_some_and(|p| { + let args: Vec<_> = p + .cmd() + .iter() + .map(|s| s.to_string_lossy().into_owned()) + .collect(); + arguments_use_home(&args, home) + }) +} + +pub fn profile_running(home: &Path) -> bool { + snapshot().0.processes().values().any(|p| { + let args: Vec<_> = p + .cmd() + .iter() + .map(|s| s.to_string_lossy().into_owned()) + .collect(); + arguments_use_home(&args, home) + }) +} + +fn decoded_home(command: &str) -> Option { + let bytes = STANDARD.decode(command).ok()?; + let utf16: Vec<_> = bytes + .chunks_exact(2) + .map(|b| u16::from_le_bytes([b[0], b[1]])) + .collect(); + let script = String::from_utf16(&utf16).ok()?; + let marker = script.lines().next()?.strip_prefix("# MULTI_CODEX_HOME=")?; + Some(PathBuf::from( + String::from_utf8(STANDARD.decode(marker).ok()?).ok()?, + )) +} + +pub(crate) fn command_uses_home(command: &str, home: &Path) -> bool { + decoded_home(command).is_some_and(|p| p == home) +} + +fn quote(value: &Path) -> String { + format!("'{}'", value.to_string_lossy().replace('\'', "''")) +} + +pub fn cli_script(codex: &Path, home: &Path, workspace: &Path) -> String { + format!("# MULTI_CODEX_HOME={}\n$ErrorActionPreference='Stop'; Get-ChildItem Env: | Where-Object {{ $_.Name -match '^(CODEX_|OPENAI_|VSCODE_)' -or $_.Name -in @('ELECTRON_RUN_AS_NODE','NODE_OPTIONS') }} | ForEach-Object {{ Remove-Item -LiteralPath ('Env:' + $_.Name) }}; $env:CODEX_HOME={}; $env:CODEX_SQLITE_HOME={}; & {} -C {}; exit $LASTEXITCODE", STANDARD.encode(home.to_string_lossy().as_bytes()), quote(home), quote(home), quote(codex), quote(workspace)) +} + +pub fn launch_cli( + terminal: crate::terminals::Terminal, + binary: &Path, + codex: &Path, + home: &Path, + workspace: &Path, +) -> Result<()> { + use std::os::windows::process::CommandExt; + let script = cli_script(codex, home, workspace); + let bytes: Vec<_> = script.encode_utf16().flat_map(u16::to_le_bytes).collect(); + let encoded = STANDARD.encode(bytes); + if terminal != crate::terminals::Terminal::WindowsTerminal { + spawn_console(binary, &encoded, workspace)?; + return Ok(()); + } + let mut command = Command::new(binary); + if terminal == crate::terminals::Terminal::WindowsTerminal { + command + .args(["new-tab", "--startingDirectory"]) + .arg(workspace) + .arg("powershell.exe"); + } + command + .args(["-NoLogo", "-NoProfile", "-EncodedCommand"]) + .arg(encoded) + .current_dir(workspace) + .creation_flags(0x00000010) + .stdin(Stdio::null()) + .stdout(Stdio::null()) + .stderr(Stdio::null()) + .spawn() + .map_err(|e| format!("Could not open Windows terminal: {e}"))?; + Ok(()) +} + +fn spawn_console(binary: &Path, encoded_script: &str, workspace: &Path) -> Result { + use std::os::windows::ffi::OsStrExt; + use windows_sys::Win32::{ + Foundation::CloseHandle, + System::Threading::{ + CreateProcessW, CREATE_NEW_CONSOLE, PROCESS_INFORMATION, STARTUPINFOW, + }, + }; + let application: Vec = binary.as_os_str().encode_wide().chain(Some(0)).collect(); + let directory: Vec = workspace.as_os_str().encode_wide().chain(Some(0)).collect(); + let mut command: Vec = std::iter::once('"' as u16) + .chain(binary.as_os_str().encode_wide()) + .chain(format!("\" -NoLogo -NoProfile -EncodedCommand {encoded_script}").encode_utf16()) + .chain(Some(0)) + .collect(); + let startup = STARTUPINFOW { + cb: std::mem::size_of::() as u32, + ..Default::default() + }; + let mut process = PROCESS_INFORMATION::default(); + // Leave STARTF_USESTDHANDLES unset so Windows supplies the new console's + // input/output handles. Rust's redirected/inherited handles can otherwise + // leave an interactive CLI attached to NUL or the launcher's logging pipe. + // SAFETY: buffers are live, NUL-terminated UTF-16; command is mutable; + // no handles are inherited. Successful process/thread handles are closed. + let started = unsafe { + CreateProcessW( + application.as_ptr(), + command.as_mut_ptr(), + std::ptr::null(), + std::ptr::null(), + 0, + CREATE_NEW_CONSOLE, + std::ptr::null(), + directory.as_ptr(), + &startup, + &mut process, + ) + }; + if started == 0 { + return Err(format!( + "Could not open Windows terminal: {}", + std::io::Error::last_os_error() + )); + } + unsafe { + CloseHandle(process.hThread); + CloseHandle(process.hProcess); + } + Ok(process.dwProcessId) +} + +#[cfg(test)] +mod tests { + use super::*; + #[test] + fn new_powershell_console_has_interactive_standard_handles() { + let root = tempfile::tempdir().unwrap(); + let result = root.path().join("console.json"); + let binary = PathBuf::from(std::env::var_os("SystemRoot").unwrap()) + .join("System32/WindowsPowerShell/v1.0/powershell.exe"); + let script = format!( + "$ErrorActionPreference='Stop'; [IO.File]::WriteAllText({}, (@{{input=[Console]::IsInputRedirected; output=[Console]::IsOutputRedirected; error=[Console]::IsErrorRedirected}} | ConvertTo-Json -Compress)); Start-Sleep -Seconds 30", + quote(&result) + ); + let bytes: Vec<_> = script.encode_utf16().flat_map(u16::to_le_bytes).collect(); + let pid = spawn_console(&binary, &STANDARD.encode(bytes), root.path()).unwrap(); + let deadline = Instant::now() + Duration::from_secs(15); + while !result.is_file() && Instant::now() < deadline { + std::thread::sleep(Duration::from_millis(100)); + } + let contents = std::fs::read_to_string(result); + let _ = Command::new("taskkill.exe") + .args(["/PID", &pid.to_string(), "/T", "/F"]) + .output(); + let actual: serde_json::Value = serde_json::from_str(&contents.unwrap()).unwrap(); + assert_eq!( + actual, + serde_json::json!({"input":false,"output":false,"error":false}) + ); + } + #[test] + fn powershell_command_round_trips_unicode_and_quotes_without_interpolation() { + let home = Path::new("C:\\Users\\Test User\\工具 '$x\\codex-home"); + let script = cli_script( + Path::new("C:\\cli\\codex.exe"), + home, + Path::new("C:\\project '$x"), + ); + let bytes: Vec<_> = script.encode_utf16().flat_map(u16::to_le_bytes).collect(); + assert_eq!(decoded_home(&STANDARD.encode(bytes)).as_deref(), Some(home)); + assert!(script.contains("''$x")); + assert!(script.contains("Remove-Item -LiteralPath")); + } + #[test] + fn live_process_detection_refreshes_command_arguments_and_releases_on_exit() { + let root = tempfile::tempdir().unwrap(); + let home = root.path().join("codex-home"); + let script = format!( + "# MULTI_CODEX_HOME={}\nStart-Sleep -Seconds 30", + STANDARD.encode(home.to_string_lossy().as_bytes()) + ); + let bytes: Vec<_> = script.encode_utf16().flat_map(u16::to_le_bytes).collect(); + let mut child = crate::process::background(&mut Command::new("powershell.exe")) + .args(["-NoProfile", "-NonInteractive", "-EncodedCommand"]) + .arg(STANDARD.encode(bytes)) + .spawn() + .unwrap(); + let end = Instant::now() + Duration::from_secs(5); + while !process_uses_home(child.id(), &home) && Instant::now() < end { + std::thread::sleep(Duration::from_millis(100)); + } + let detected = process_uses_home(child.id(), &home) && profile_running(&home); + let unrelated = profile_running(&root.path().join("other")); + child.kill().unwrap(); + child.wait().unwrap(); + std::thread::sleep(Duration::from_millis(500)); + assert!( + detected, + "Process inventory must explicitly request command arguments" + ); + assert!(!unrelated); + assert!(!profile_running(&home)); + } + #[test] + fn canonical_windows_prefixes_identify_the_same_profile_but_not_a_neighbor() { + let root = tempfile::tempdir().unwrap(); + let home = root.path().join("Profile 工具 O'Brien"); + std::fs::create_dir_all(&home).unwrap(); + let canonical = std::fs::canonicalize(&home).unwrap(); + assert!(arguments_use_home( + &[format!("--user-data-dir={}", home.display())], + &canonical + )); + assert!(arguments_use_home( + &["--user-data-dir".into(), home.display().to_string()], + &canonical + )); + assert!(!arguments_use_home( + &[format!("--user-data-dir={}-other", home.display())], + &canonical + )); + } + #[test] + fn native_credential_store_round_trip() { + use crate::profiles::{KeyringSecretStore, SecretStore}; + let id = uuid::Uuid::new_v4().to_string(); + let store = KeyringSecretStore; + store.set(&id, "windows-synthetic-ci-credential").unwrap(); + assert_eq!(store.get(&id).unwrap(), "windows-synthetic-ci-credential"); + store.delete(&id).unwrap(); + assert!(store.get(&id).is_err()); + } + #[test] + fn private_atomic_files_replace_and_lock_on_windows() { + let root = tempfile::tempdir().unwrap(); + let home = root.path().join("space 工具"); + std::fs::create_dir_all(&home).unwrap(); + let path = home.join("auth.json"); + crate::profiles::write_private_file(&path, b"first").unwrap(); + crate::profiles::write_private_file(&path, b"second").unwrap(); + assert_eq!(std::fs::read(&path).unwrap(), b"second"); + let lock = crate::file_security::lock_file(&home.join("lock")).unwrap(); + fs2::FileExt::lock_exclusive(&lock).unwrap(); + let peer = crate::file_security::lock_file(&home.join("lock")).unwrap(); + assert!(fs2::FileExt::try_lock_exclusive(&peer).is_err()); + drop(lock); + assert!(fs2::FileExt::try_lock_exclusive(&peer).is_ok()); + } +} diff --git a/tauri/src-tauri/tauri.conf.json b/tauri/src-tauri/tauri.conf.json index 40d3dc39..3cd4c00e 100644 --- a/tauri/src-tauri/tauri.conf.json +++ b/tauri/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "Multi Codex", - "version": "1.3.8", + "version": "1.4.0", "identifier": "com.multicodex.desktop", "build": { "beforeDevCommand": "npm run dev", diff --git a/tauri/src-tauri/tauri.windows.conf.json b/tauri/src-tauri/tauri.windows.conf.json new file mode 100644 index 00000000..1a78c469 --- /dev/null +++ b/tauri/src-tauri/tauri.windows.conf.json @@ -0,0 +1,8 @@ +{ + "bundle": { + "targets": ["nsis"], + "icon": ["icons/icon.ico"], + "resources": {}, + "windows": { "nsis": { "installMode": "currentUser" } } + } +} diff --git a/tauri/src/App.test.tsx b/tauri/src/App.test.tsx index 91c93ea2..63ae05eb 100644 --- a/tauri/src/App.test.tsx +++ b/tauri/src/App.test.tsx @@ -1,4 +1,4 @@ -import { cleanup, fireEvent, render, screen, waitFor, within } from "@testing-library/react" +import { act, cleanup, fireEvent, render, screen, waitFor, within } from "@testing-library/react" import userEvent from "@testing-library/user-event" import { afterEach, beforeEach, describe, expect, it, vi } from "vitest" import App, { formatStorage } from "./App" @@ -34,6 +34,12 @@ const api = vi.hoisted(() => ({ })) vi.mock("./lib/desktop-api", () => api) +const menuEvents = vi.hoisted(() => new Map unknown>()) +vi.mock("@tauri-apps/api/event", () => ({ listen: vi.fn(async (name: string, handler: (event: any) => unknown) => { + menuEvents.set(name, handler) + return () => menuEvents.delete(name) +}) })) + const profile: Profile = { id: "2c7f23ba-b2c0-4f67-a963-7749cc13f1e2", @@ -47,6 +53,7 @@ const profile: Profile = { let deviceLoginListener: ((event: { id: string; output?: string; completed: boolean; error?: string }) => void) | undefined beforeEach(() => { + menuEvents.clear() localStorage.clear() api.getTerminalOptions.mockReset().mockResolvedValue([{ id: "automatic", label: "Automatic", available: true }, { id: "konsole", label: "Konsole", available: true }, { id: "kitty", label: "Kitty", available: true }, { id: "ghostty", label: "Ghostty", available: false }]) api.listProfiles.mockReset().mockResolvedValue([profile]) @@ -120,7 +127,7 @@ beforeEach(() => { }) }) -afterEach(() => cleanup()) +afterEach(() => { cleanup(); vi.unstubAllGlobals() }) describe("Multi Codex", () => { it("formats storage using compact binary units", () => { @@ -1076,3 +1083,39 @@ it("groups expiring resets at the top, opens account details, and keeps the dism await new Promise(resolve => setTimeout(resolve, 300)) expect(screen.queryByRole("complementary", { name: "Expiring usage resets" })).not.toBeInTheDocument() }) + + +it.each(["vscode", "standalone", "cli"] as const)("Mac account menu reuses folder preferences and launch guards for %s", async target => { + vi.stubGlobal("__TAURI_INTERNALS__", {}) + const user = userEvent.setup() + api.getLaunchTargets.mockResolvedValue({ platform: "macos", vscodeInstalled: true, codexCliAvailable: true, standaloneInstalled: true, standaloneVerified: true }) + api.getLaunchEnvironment.mockResolvedValue({ defaultWorkspace: "/Users/test/Projects", capabilities: { backend: "macos", enumerateDesktops: false, enumerateWindows: false, moveWindows: false, reason: null } }) + api.getExecutableSettings.mockResolvedValue({ preferredWorkspace: "/Users/test/Client project", launchMode: "vscode" }) + const view = render() + await waitFor(() => expect(menuEvents.has("account-menu-launch")).toBe(true)) + await act(async () => { await menuEvents.get("account-menu-launch")!({ payload: { id: profile.id, target } }) }) + expect(api.launchProfile).not.toHaveBeenCalled() + expect(api.launchStandaloneProfile).not.toHaveBeenCalled() + expect(api.launchCliProfile).not.toHaveBeenCalled() + await user.click(await screen.findByRole("button", { name: "Choose this folder" })) + const launcher = target === "vscode" ? api.launchProfile : target === "standalone" ? api.launchStandaloneProfile : api.launchCliProfile + await waitFor(() => expect(launcher).toHaveBeenCalledWith(...(target === "cli" ? [profile.id, "/Users/test/Client project"] : [profile.id, "/Users/test/Client project", null, null]))) + expect(api.getDesktopInventory).not.toHaveBeenCalled() + view.unmount() + expect(menuEvents.size).toBe(0) +}) + +it("Mac menu refresh checks every saved account without opening a launch dialog", async () => { + vi.stubGlobal("__TAURI_INTERNALS__", {}) + const peer = { ...profile, id: "00000000-0000-4000-8000-000000000001", name: "Work" } + api.listProfiles.mockResolvedValue([profile,peer]) + render() + await waitFor(() => expect(api.checkProfileLimits).toHaveBeenCalledTimes(2)) + await waitFor(() => expect(screen.getByRole("button", { name: "Refresh all" })).not.toBeDisabled()) + api.checkProfileLimits.mockClear() + await act(async () => { menuEvents.get("account-menu-refresh")!({ payload: null }) }) + await waitFor(() => expect(api.checkProfileLimits).toHaveBeenCalledTimes(2)) + expect(api.checkProfileLimits).toHaveBeenCalledWith(profile.id) + expect(api.checkProfileLimits).toHaveBeenCalledWith(peer.id) + expect(screen.queryByRole("dialog")).not.toBeInTheDocument() +}) diff --git a/tauri/src/App.tsx b/tauri/src/App.tsx index 68ddc9ab..d39416fe 100644 --- a/tauri/src/App.tsx +++ b/tauri/src/App.tsx @@ -1,3 +1,4 @@ +import { listen } from "@tauri-apps/api/event" import { orderProfilesByPlan } from "./lib/profile-order" import { useProfileLimits } from "./components/use-profile-limits" import { ThemePicker } from "./components/theme-picker" @@ -395,7 +396,7 @@ export default function App() { if (target === 'cli' && !targets.codexCliAvailable) throw new Error("Codex CLI was not found. Set its executable path in Launch settings.") const settings = await getExecutableSettings() setLaunchMode(settings.launchMode ?? 'vscode') - setHideDesktopPicker(environment.capabilities.backend === "macos" || Boolean(settings.hideDesktopPicker)) + setHideDesktopPicker(environment.capabilities.backend === "macos" || environment.capabilities.backend === "windows" || Boolean(settings.hideDesktopPicker)) setFolderRequest({ profile, target, initialPath: settings.preferredWorkspace || environment.defaultWorkspace }) } catch (error) { const message = error instanceof Error ? error.message : String(error) @@ -405,6 +406,29 @@ export default function App() { await refresh() } + const menuActions = useRef({ launch: handleLaunch, refresh: handleRefreshAllLimits, add: () => setDialogProfile(null) }) + menuActions.current = { launch: handleLaunch, refresh: handleRefreshAllLimits, add: () => setDialogProfile(null) } + useEffect(() => { + if (!(window as Window & { __TAURI_INTERNALS__?: unknown }).__TAURI_INTERNALS__) return + let disposed = false + const stops: (() => void)[] = [] + const subscribe = async () => { + const bindings = await Promise.all([ + listen<{ id: string; target: LaunchTarget }>("account-menu-launch", async ({ payload }) => { + if (!["vscode", "standalone", "cli"].includes(payload.target)) return + const saved = await listProfiles() + const account = saved.find(profile => profile.id === payload.id) + if (account) await menuActions.current.launch(account, payload.target) + }), + listen("account-menu-refresh", () => void menuActions.current.refresh()), + listen("account-menu-add", () => menuActions.current.add()), + ]) + if (disposed) bindings.forEach(stop => stop()); else stops.push(...bindings) + } + void subscribe() + return () => { disposed = true; stops.forEach(stop => stop()) } + }, []) + async function completeFolderSelection(workspace: string) { if (!folderRequest) return const request = folderRequest diff --git a/tauri/src/lib/types.ts b/tauri/src/lib/types.ts index 6d2f7ba2..09a9fcb7 100644 --- a/tauri/src/lib/types.ts +++ b/tauri/src/lib/types.ts @@ -146,7 +146,7 @@ export interface ExecutableSettings { cliTerminal?: TerminalId } -export type TerminalId = "automatic" | "terminal" | "kitty" | "ghostty" | "konsole" | "gnomeTerminal" | "xfceTerminal" | "alacritty" | "foot" | "xterm" +export type TerminalId = "automatic" | "powerShell" | "windowsTerminal" | "terminal" | "kitty" | "ghostty" | "konsole" | "gnomeTerminal" | "xfceTerminal" | "alacritty" | "foot" | "xterm" export interface TerminalOption { id: TerminalId label: string