diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0b11dfe..0be3f76 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,9 +18,12 @@ jobs: with: components: clippy - uses: Swatinem/rust-cache@v2 - - name: System libraries (Linux; Rune's Wayland and keyboard backends, and Vulkan) + - name: Metal toolchain (macOS; GPUI compiles shaders) + if: runner.os == 'macOS' + run: xcrun -f metal >/dev/null 2>&1 || xcodebuild -downloadComponent MetalToolchain + - name: System libraries (Linux; GPUI's X11, Wayland and font backends) if: runner.os == 'Linux' - run: sudo apt-get update && sudo apt-get install -y libwayland-dev libxkbcommon-dev libvulkan1 zlib1g-dev + run: sudo apt-get update && sudo apt-get install -y libfontconfig-dev libwayland-dev libx11-xcb-dev libxcb1-dev libxkbcommon-x11-dev libvulkan1 zlib1g-dev - name: Build run: cargo build --locked - name: Install just diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d181513..ff30d66 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,7 @@ name: release # Push a tag like v0.2.0 to publish installers and the auto-update feed to GitHub Releases. -# Installed copies of Claudiu check this repository's releases (Velopack GithubSource) and update themselves. +# Installed copies of m4code check this repository's releases (Velopack GithubSource) and update themselves. on: push: tags: ["v*"] @@ -34,8 +34,8 @@ jobs: shell: pwsh run: | New-Item -ItemType Directory -Force dist/publish | Out-Null - Copy-Item target/release/claudiu.exe dist/publish/ - vpk pack --packId Claudiu --packVersion "${{ steps.ver.outputs.version }}" --packDir dist/publish --mainExe claudiu.exe --packTitle Claudiu --icon assets/claudiu.ico --outputDir dist/releases + Copy-Item target/release/m4code.exe dist/publish/ + vpk pack --packId m4code --packVersion "${{ steps.ver.outputs.version }}" --packDir dist/publish --mainExe m4code.exe --packTitle m4code --icon assets/m4code.ico --outputDir dist/releases - uses: actions/upload-artifact@v4 with: name: releases-win @@ -56,6 +56,8 @@ jobs: dotnet-version: 8.x - name: Install Velopack CLI run: dotnet tool install -g vpk + - name: Metal toolchain (GPUI compiles shaders; newer Xcodes ship it as a download) + run: xcrun -f metal >/dev/null 2>&1 || xcodebuild -downloadComponent MetalToolchain - name: Version from tag id: ver run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" @@ -64,15 +66,15 @@ jobs: cargo build --release --locked --target aarch64-apple-darwin cargo build --release --locked --target x86_64-apple-darwin mkdir -p dist/publish - lipo -create -output dist/publish/claudiu target/aarch64-apple-darwin/release/claudiu target/x86_64-apple-darwin/release/claudiu - codesign --force --sign - dist/publish/claudiu # lipo invalidates the per-arch signatures + lipo -create -output dist/publish/m4code target/aarch64-apple-darwin/release/m4code target/x86_64-apple-darwin/release/m4code + codesign --force --sign - dist/publish/m4code # lipo invalidates the per-arch signatures - name: Icon - run: scripts/make-icns.sh dist/claudiu.icns + run: scripts/make-icns.sh dist/m4code.icns - name: Fetch previous release (for delta updates) continue-on-error: true run: vpk download github --repoUrl "${{ github.server_url }}/${{ github.repository }}" --token "${{ secrets.GITHUB_TOKEN }}" - name: Pack - run: vpk pack --packId Claudiu --packVersion "${{ steps.ver.outputs.version }}" --packDir dist/publish --mainExe claudiu --packTitle Claudiu --icon dist/claudiu.icns --bundleId com.m4rocks.claudiu --signAppIdentity - --outputDir dist/releases + run: vpk pack --packId m4code --packVersion "${{ steps.ver.outputs.version }}" --packDir dist/publish --mainExe m4code --packTitle m4code --icon dist/m4code.icns --bundleId com.m4rocks.m4code --signAppIdentity - --outputDir dist/releases - uses: actions/upload-artifact@v4 with: name: releases-osx @@ -91,8 +93,8 @@ jobs: dotnet-version: 8.x - name: Install Velopack CLI run: dotnet tool install -g vpk - - name: System libraries (Rune's Wayland and keyboard backends, and Vulkan) - run: sudo apt-get update && sudo apt-get install -y libwayland-dev libxkbcommon-dev libvulkan1 zlib1g-dev + - name: System libraries (GPUI's X11, Wayland and font backends) + run: sudo apt-get update && sudo apt-get install -y libfontconfig-dev libwayland-dev libx11-xcb-dev libxcb1-dev libxkbcommon-x11-dev libvulkan1 zlib1g-dev - name: Version from tag id: ver run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" @@ -100,12 +102,12 @@ jobs: run: | cargo build --release --locked mkdir -p dist/publish - cp target/release/claudiu dist/publish/ + cp target/release/m4code dist/publish/ - name: Fetch previous release (for delta updates) continue-on-error: true run: vpk download github --channel linux --repoUrl "${{ github.server_url }}/${{ github.repository }}" --token "${{ secrets.GITHUB_TOKEN }}" - name: Pack - run: vpk pack --packId Claudiu --packVersion "${{ steps.ver.outputs.version }}" --packDir dist/publish --mainExe claudiu --packTitle Claudiu --icon assets/claudiu.png --channel linux --outputDir dist/releases + run: vpk pack --packId m4code --packVersion "${{ steps.ver.outputs.version }}" --packDir dist/publish --mainExe m4code --packTitle m4code --icon assets/m4code.png --channel linux --outputDir dist/releases - uses: actions/upload-artifact@v4 with: name: releases-linux @@ -126,5 +128,5 @@ jobs: run: | version="${GITHUB_REF_NAME#v}" for channel in win osx linux; do - vpk upload github --channel "$channel" --repoUrl "${{ github.server_url }}/${{ github.repository }}" --outputDir "releases-$channel" --merge --publish --releaseName "Claudiu $version" --tag "${{ github.ref_name }}" --token "${{ secrets.GITHUB_TOKEN }}" + vpk upload github --channel "$channel" --repoUrl "${{ github.server_url }}/${{ github.repository }}" --outputDir "releases-$channel" --merge --publish --releaseName "m4code $version" --tag "${{ github.ref_name }}" --token "${{ secrets.GITHUB_TOKEN }}" done diff --git a/.gitignore b/.gitignore index ae3eeea..8f6c1a7 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,6 @@ /dist /mod/tsconfig.json /mod/.claude-plugin/types/ + +# The Claude Agent SDK, when installed in the bridge folder by hand. +bridge/node_modules/ diff --git a/CLAUDE.md b/AGENTS.md similarity index 64% rename from CLAUDE.md rename to AGENTS.md index 48f981b..a70173e 100644 --- a/CLAUDE.md +++ b/AGENTS.md @@ -1,10 +1,22 @@ -# CLAUDE.md +# AGENTS.md -Claudiu is a native Rust + Rune desktop app that manages sessions around the user's existing `claude` CLI. +m4code is a native Rust + GPUI desktop app that manages sessions around the user's existing `claude` CLI. + +## Where things live + +- `src/main.rs`: app startup, menus and assets. `src/app/keymap.rs` holds the key bindings and the list Settings → Keyboard shows. +- `src/app/`: workspace state and behavior. `act.rs` dispatches actions; the other files group methods by task. `headless.rs` and `headless/` exercise the workspace on GPUI's test platform. +- `src/panels/`: workspace rendering. `workspace_view.rs` is the root view; `home.rs`, `overlays.rs`, `workspace_pickers.rs` and `settings_view.rs` draw its main sections. +- `src/harness/` and `src/thread/`: agent launch and ACP sessions, and the conversation view. +- `src/claude/`: Claude Code integration, accounts, usage, configuration and custom subagents. `acp/` handles custom subagent conversations, configuration and messages. +- `src/store.rs`: persisted app state and writes. `src/store/` holds state types and reconciliation with external sessions. +- `src/git/` and `src/github/`: local Git operations and the GitHub pane. +- `src/terminal/`: shell terminal, input and rendering. `src/lsp/` handles language servers. +- `src/skills/` manages skills; `src/visual/` renders visual output. `src/files.rs`, `src/datadir.rs`, `src/platform.rs` and `src/updater.rs` cover their named responsibilities. ## Settings -- Tracker: GitHub issues in m4rocks/claudiu +- Tracker: GitHub issues in m4rocks/m4code - Tests: when a cheap test seam exists - Commits: only when the maintainer says - Pushes and pull requests: only when the maintainer says @@ -28,6 +40,16 @@ When the m4 skills are installed, route requests through them even when phrased Work inline; spawn subagents only as the settings allow, except the plan review in m4:shape, because they spend tokens the maintainer wants to spend deliberately. +## Tokens + +Every tool call re-reads the whole conversation, so the number of calls and the length of the conversation set the cost. One session here made 472 calls on a context that averaged 208k tokens, and 251 of those calls were reads, mostly three or more in a row. + +- Put every `sed -n`, `grep` and `wc` you need next into one command. Find a function with `grep -n` and read just that function, rather than reading a file in slices; `src/panels/workspace_view.rs` alone is about 1,900 lines. +- The shell is zsh, which fails the whole command when an unquoted glob matches nothing. Quote globs, as in `--include='*.rs'`. +- Run the check in the same command as the edit it checks, such as an edit followed by `cargo build`. Build, clippy and the unit tests can share one command too. +- Look up the fields and signatures new code uses before writing it, so the first build passes. +- In a batch of features, commit each one as it passes. Once the conversation passes about 150k tokens, finish the current feature and continue the rest in a fresh session, since the commits and the tracker carry everything over. + ## Code People who don't use agents read and maintain this code, so aim for code that is obviously correct to a newcomer. Rank choices by correctness, then how easily the code reads and tests, then size; a one-liner that needs decoding is not simple. @@ -42,7 +64,7 @@ Leave nothing behind but the change: no summary files, commented-out code, debug ## Boundaries -Claudiu types into a session's terminal in one place. In editor mode, moving the keyboard to the terminal while lines are selected pastes `@path#L12-30: ` into Claude Code's input box, and leaving without typing erases it again (`terminal/view/typing.rs`, `app/selection_reference.rs`). It does this only while the cursor is in that input box. It stays a deliberate exception: messages, settings changes and every other request reach Claude Code through the mod, not the terminal. Any further typing into a PTY needs the maintainer's decision first. +Agents run as ACP servers and show in m4code's chat view (`harness/`, `thread/`); no agent runs in a PTY. The shell panel (Ctrl+J and the welcome screen's shell) is the only PTY, and m4code never types into it. In editor mode, the comment button beside the selected or hovered line adds `@path#L12-30: comment` to the chat's message box, or sends it with Cmd/Ctrl+Enter (`app/line_comment.rs`). Running an agent in a PTY, or typing into the shell, needs the maintainer's decision first. ## Enforced rules diff --git a/Cargo.lock b/Cargo.lock index f6acff0..5a78502 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,46 +4,47 @@ version = 4 [[package]] name = "accesskit" -version = "0.25.2" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e883d1d28c5fd5568c79ed2d2bd48d9f2fd3945c8974ed0f53690ceddb051be" +checksum = "d3b7f7f85a7e5f68090000ed7622545829afd484d210358702ae4cb97dd0c320" dependencies = [ + "enumn", "uuid", ] [[package]] name = "accesskit_atspi_common" -version = "0.21.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24f5baf62e34a4a6c30e3d697e4782f821a7337049c44c3b40576a27dfbb580d" +checksum = "023da0e5097f46df7092d5280b02efb9bbf8d93298daeced42652463e357d636" dependencies = [ "accesskit", "accesskit_consumer", "atspi-common", - "phf", + "phf 0.13.1", "serde", "zvariant", ] [[package]] name = "accesskit_consumer" -version = "0.39.2" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3da8f27636015191b2264ee1df681503170a632cafd832fdc1edfdd4e3a2fd3" +checksum = "5d10a236f96f87d70732e44520046785431ef01d5bcd6b041317bfadd2f88245" dependencies = [ "accesskit", - "hashbrown 0.17.1", + "hashbrown 0.16.1", ] [[package]] name = "accesskit_macos" -version = "0.27.2" +version = "0.26.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "123828ceeec755b05255e3976cb0852993202de98a0626c97dd8d34246991f84" +checksum = "ce02dc63b43f0c9296af9ac946312a2dc8814427d7a64d2d600971dac55b6076" dependencies = [ "accesskit", "accesskit_consumer", - "hashbrown 0.17.1", + "hashbrown 0.16.1", "objc2 0.5.3", "objc2-app-kit 0.2.2", "objc2-foundation 0.2.2", @@ -51,9 +52,9 @@ dependencies = [ [[package]] name = "accesskit_unix" -version = "0.24.1" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30d5192871228c54f1b0fb4a85cef000e11a3804f25d2165f14afa0daa67f3f6" +checksum = "03e156ed3802e35eefe894ef2671bc6c889303d8a7e110b5e1b48f504b91362f" dependencies = [ "accesskit", "accesskit_atspi_common", @@ -69,16 +70,25 @@ dependencies = [ [[package]] name = "accesskit_windows" -version = "0.35.2" +version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "498668b90da9995302a0055aaecad4756932333da2ddef6baee1c00844c430fc" +checksum = "106c2b961215864d1c2e703ee63269c25c4e80a577ffb2c1017b9c17dcdf83a1" dependencies = [ "accesskit", "accesskit_consumer", - "hashbrown 0.17.1", + "hashbrown 0.16.1", "static_assertions", - "windows", - "windows-core", + "windows 0.62.2", + "windows-core 0.62.2", +] + +[[package]] +name = "addr2line" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" +dependencies = [ + "gimli", ] [[package]] @@ -87,6 +97,18 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures 0.2.17", + "zeroize", +] + [[package]] name = "ahash" version = "0.8.12" @@ -94,7 +116,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" dependencies = [ "cfg-if", - "getrandom 0.3.4", + "const-random", "once_cell", "version_check", "zerocopy", @@ -125,7 +147,7 @@ dependencies = [ "piper", "polling", "regex-automata", - "rustix 1.1.5", + "rustix", "rustix-openpty", "serde", "signal-hook", @@ -135,35 +157,28 @@ dependencies = [ ] [[package]] -name = "allocator-api2" -version = "0.2.21" +name = "aligned" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" +checksum = "ee4508988c62edf04abd8d92897fca0c2995d907ce1dfeaf369dac3716a40685" +dependencies = [ + "as-slice", +] [[package]] -name = "android-activity" -version = "0.6.1" +name = "aligned-vec" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f2a1bb052857d5dd49572219344a7332b31b76405648eabac5bc68978251bcd" +checksum = "dc890384c8602f339876ded803c97ad529f3842aba97f6392b3dba0dd171769b" dependencies = [ - "android-properties", - "bitflags 2.13.2", - "cc", - "jni", - "libc", - "log", - "ndk", - "ndk-context", - "ndk-sys", - "num_enum", - "thiserror 2.0.21", + "equator", ] [[package]] -name = "android-properties" -version = "0.2.2" +name = "allocator-api2" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "android_system_properties" @@ -174,6 +189,23 @@ dependencies = [ "libc", ] +[[package]] +name = "annotate-snippets" +version = "0.12.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f211a51805bc641f3ad5b7664c77d2547af685cc33b4cd8d31964027a46f13f1" +dependencies = [ + "anstyle", + "memchr", + "unicode-width", +] + +[[package]] +name = "anstyle" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" + [[package]] name = "anyhow" version = "1.0.104" @@ -181,26 +213,37 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" [[package]] -name = "arboard" -version = "3.7.0" +name = "arbitrary" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1" + +[[package]] +name = "arc-swap" +version = "1.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aeb9553e62312c8756a5979254fc6d7da8bbeb5986a1e17037fab932f7037917" +checksum = "c049c0be4daef0b145cb3555416b3b8ef5b7888a38aea1a3a155801fe7b0810b" dependencies = [ - "clipboard-win", - "image", - "log", - "objc2 0.6.5", - "objc2-app-kit 0.3.2", - "objc2-core-foundation", - "objc2-core-graphics", - "objc2-foundation 0.3.2", - "parking_lot", - "percent-encoding", - "windows-sys 0.61.2", - "wl-clipboard-rs", - "x11rb", + "rustversion", +] + +[[package]] +name = "arg_enum_proc_macro" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", ] +[[package]] +name = "arraydeque" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d902e3d592a523def97af8f317b08ce16b7ab854c1985a0c671e6f15cebc236" + [[package]] name = "arrayref" version = "0.3.9" @@ -219,6 +262,15 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b" +[[package]] +name = "as-slice" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516" +dependencies = [ + "stable_deref_trait", +] + [[package]] name = "ash" version = "0.38.0+1.3.281" @@ -228,6 +280,24 @@ dependencies = [ "libloading", ] +[[package]] +name = "ashpd" +version = "0.13.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb8421aaa9644a5faf26735f258b669b15f063313ef8f8e2bdb28912a1a6f111" +dependencies = [ + "enumflags2", + "futures-channel", + "futures-util", + "getrandom 0.4.3", + "serde", + "serde_repr", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "zbus 5.19.0", +] + [[package]] name = "async-broadcast" version = "0.7.2" @@ -252,6 +322,18 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "async-compression" +version = "0.4.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee19bd99b43e3691acbad4e840420a4881cea6c0b66a208125a824f8fd53f5a1" +dependencies = [ + "compression-codecs", + "compression-core", + "futures-io", + "pin-project-lite", +] + [[package]] name = "async-executor" version = "1.14.0" @@ -266,6 +348,17 @@ dependencies = [ "slab", ] +[[package]] +name = "async-fs" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8034a681df4aed8b8edbd7fbe472401ecf009251c8b40556b304567052e294c5" +dependencies = [ + "async-lock", + "blocking", + "futures-lite", +] + [[package]] name = "async-io" version = "2.6.0" @@ -279,7 +372,7 @@ dependencies = [ "futures-lite", "parking", "polling", - "rustix 1.1.5", + "rustix", "slab", "windows-sys 0.61.2", ] @@ -295,6 +388,17 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "async-net" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b948000fad4873c1c9339d60f2623323a0cfd3816e5181033c6a5cb68b2accf7" +dependencies = [ + "async-io", + "blocking", + "futures-lite", +] + [[package]] name = "async-process" version = "2.5.0" @@ -310,7 +414,7 @@ dependencies = [ "cfg-if", "event-listener", "futures-lite", - "rustix 1.1.5", + "rustix", ] [[package]] @@ -336,7 +440,7 @@ dependencies = [ "cfg-if", "futures-core", "futures-io", - "rustix 1.1.5", + "rustix", "signal-hook-registry", "slab", "windows-sys 0.61.2", @@ -359,6 +463,12 @@ dependencies = [ "syn 3.0.6", ] +[[package]] +name = "atomic" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c59bdb34bc650a32731b31bd8f0829cc15d24a708ee31559e0bb34f2bc320cba" + [[package]] name = "atomic-waker" version = "1.1.2" @@ -408,6 +518,70 @@ version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" +[[package]] +name = "av-scenechange" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f321d77c20e19b92c39e7471cf986812cbb46659d2af674adc4331ef3f18394" +dependencies = [ + "aligned", + "anyhow", + "arg_enum_proc_macro", + "arrayvec", + "log", + "num-rational", + "num-traits", + "pastey", + "rayon", + "thiserror 2.0.21", + "v_frame", + "y4m", +] + +[[package]] +name = "av1-grain" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cfddb07216410377231960af4fcab838eaa12e013417781b78bd95ee22077f8" +dependencies = [ + "anyhow", + "arrayvec", + "log", + "nom 8.0.0", + "num-rational", + "v_frame", +] + +[[package]] +name = "avif-serialize" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7178fe5f7d460b13895ebb9dcb28a3a6216d2df2574a0806cb51b555d297f38" +dependencies = [ + "arrayvec", +] + +[[package]] +name = "backtrace" +version = "0.3.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide 0.8.9", + "object", + "rustc-demangle", + "windows-link 0.2.1", +] + +[[package]] +name = "base62" +version = "2.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3a647dce9631f152a99ec16cfc09267ae55fe280d5dc288964027d458076323" + [[package]] name = "base64" version = "0.22.1" @@ -420,13 +594,42 @@ version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" +[[package]] +name = "bindgen" +version = "0.72.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895" +dependencies = [ + "bitflags 2.13.2", + "cexpr", + "clang-sys", + "itertools 0.13.0", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash 2.1.3", + "shlex 1.3.0", + "syn 2.0.119", +] + [[package]] name = "bit-set" -version = "0.10.0" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34ddef2995421ab6a5c779542c81ee77c115206f4ad9d5a8e05f4ff49716a3dd" +dependencies = [ + "bit-vec 0.9.1", +] + +[[package]] +name = "bit-set" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2f926cc3060f09db9ebc5b52823d85268d24bb917e472c0c4bea35780a7d" +checksum = "56d87354e4229f54a44f7bf2435906a4656dba36026ab6eaca629a2c436a691c" dependencies = [ - "bit-vec", + "bit-vec 0.10.1", ] [[package]] @@ -435,6 +638,22 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b71798fca2c1fe1086445a7258a4bc81e6e49dcd24c8d0dd9a1e57395b603f51" +[[package]] +name = "bit-vec" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5727b15fa97d4f4fee0a3b7c3d550ed0269f54329207b86388de918604e31269" +dependencies = [ + "borsh", + "serde", +] + +[[package]] +name = "bit_field" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e4b40c7323adcfc0a41c4b88143ed58346ff65a288fc144329c5c45e05d70c6" + [[package]] name = "bitflags" version = "1.3.2" @@ -451,16 +670,27 @@ dependencies = [ ] [[package]] -name = "blake3" -version = "1.8.7" +name = "bitstream-io" +version = "4.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d9e454fc11f76977dc803893aff6304ed33d6a26efae8696573bea74baa27ae" +checksum = "7eff00be299a18769011411c9def0d827e8f2d7bf0c3dbf53633147a8867fd1f" dependencies = [ - "arrayvec", - "cc", - "cfg-if", - "constant_time_eq", - "cpufeatures", + "no_std_io2", +] + +[[package]] +name = "block" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", ] [[package]] @@ -472,6 +702,15 @@ dependencies = [ "hybrid-array", ] +[[package]] +name = "block-padding" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93" +dependencies = [ + "generic-array", +] + [[package]] name = "block2" version = "0.5.1" @@ -487,7 +726,7 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" dependencies = [ - "objc2 0.6.5", + "objc2 0.6.4", ] [[package]] @@ -503,6 +742,46 @@ dependencies = [ "piper", ] +[[package]] +name = "borsh" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "553c5d846a6ba5150c65e3b1b8ec073bcf1abc20f9b7220de384a4443ea4e20a" +dependencies = [ + "borsh-derive", + "bytes", + "cfg_aliases", +] + +[[package]] +name = "borsh-derive" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12cdfe656708a01f89b451a7d36466e6fe6c414de0aa18fc54f864f6f9ca9f56" +dependencies = [ + "once_cell", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "bstr" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bb31b46c14244e20ee9984b11bf5c992b91fb6939fea616e3512c8baecdbe5f" +dependencies = [ + "memchr", + "serde_core", +] + +[[package]] +name = "built" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c0e531d93d39c34eef561e929e8a7f86d77a5af08aac4f6d6e39976c51858e9" + [[package]] name = "bumpalo" version = "3.20.3" @@ -529,6 +808,12 @@ dependencies = [ "syn 3.0.6", ] +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + [[package]] name = "byteorder-lite" version = "0.1.0" @@ -542,31 +827,65 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" [[package]] -name = "calloop" -version = "0.13.0" +name = "bzip2" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b99da2f8558ca23c71f4fd15dc57c906239752dd27ff3c00a1d56b685b7cbfec" +checksum = "f3a53fac24f34a81bc9954b5d6cfce0c21e18ec6959f44f56e8e90e4bb7c346c" dependencies = [ - "bitflags 2.13.2", - "log", + "libbz2-rs-sys", +] + +[[package]] +name = "calloop" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43b32313e937c8721c9d17ee9bf60699a6402b4b7c2cb6ac1bee0ffcaa4b4e5e" +dependencies = [ + "bitflags 2.13.2", "polling", - "rustix 0.38.44", - "slab", - "thiserror 1.0.69", + "rustix", + "tracing", ] [[package]] name = "calloop-wayland-source" -version = "0.3.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20" +checksum = "138efcf0940a02ebf0cc8d1eff41a1682a46b431630f4c52450d6265876021fa" dependencies = [ "calloop", - "rustix 0.38.44", + "rustix", "wayland-backend", "wayland-client", ] +[[package]] +name = "cbc" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6" +dependencies = [ + "cipher", +] + +[[package]] +name = "cbindgen" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eadd868a2ce9ca38de7eeafdcec9c7065ef89b42b32f0839278d55f35c54d1ff" +dependencies = [ + "heck 0.4.1", + "indexmap", + "log", + "proc-macro2", + "quote", + "serde", + "serde_json", + "syn 2.0.119", + "tempfile", + "toml 0.8.23", +] + [[package]] name = "cc" version = "1.6.0" @@ -576,7 +895,16 @@ dependencies = [ "find-msvc-tools", "jobserver", "libc", - "shlex", + "shlex 2.0.1", +] + +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom 7.1.3", ] [[package]] @@ -591,6 +919,15 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" +[[package]] +name = "cgl" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ced0551234e87afee12411d535648dd89d2e7f34c78b753395567aff3d447ff" +dependencies = [ + "libc", +] + [[package]] name = "chacha20" version = "0.10.2" @@ -598,66 +935,103 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" dependencies = [ "cfg-if", - "cpufeatures", - "rand_core", + "cpufeatures 0.3.1", + "rand_core 0.10.1", ] [[package]] -name = "claudiu" -version = "0.9.23" +name = "chrono" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" dependencies = [ - "alacritty_terminal", - "anyhow", - "directories", - "dunce", - "futures", - "git2", - "image", - "junction", - "libc", - "lsp-types", - "notify", - "notify-rust", - "objc2 0.6.5", - "objc2-app-kit 0.3.2", - "rune", - "rune-kit", + "iana-time-zone", + "js-sys", + "num-traits", "serde", - "serde_json", - "tempfile", - "time", - "tree-sitter", - "tree-sitter-bash", - "tree-sitter-css", - "tree-sitter-gleam", - "tree-sitter-highlight", - "tree-sitter-html", - "tree-sitter-javascript", - "tree-sitter-json", - "tree-sitter-md", - "tree-sitter-rust", - "tree-sitter-toml-ng", - "tree-sitter-typescript", - "tree-sitter-yaml", - "unicode-linebreak", - "unicode-segmentation", - "unicode-width", - "ureq", - "url", - "uuid", - "velopack", - "which", - "windows-sys 0.61.2", - "winresource", + "wasm-bindgen", + "windows-link 0.2.1", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common 0.1.7", + "inout", + "zeroize", +] + +[[package]] +name = "clang-sys" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "157a8ba7b480713b56f4c09fd13fc3e0a22a5dfab8097ba61cbc5feef950788a" +dependencies = [ + "glob", + "libc", + "libloading", +] + +[[package]] +name = "cocoa" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6140449f97a6e97f9511815c5632d84c8aacf8ac271ad77c559218161a1373c" +dependencies = [ + "bitflags 1.3.2", + "block", + "cocoa-foundation 0.1.2", + "core-foundation 0.9.4", + "core-graphics 0.23.2", + "foreign-types", + "libc", + "objc", +] + +[[package]] +name = "cocoa" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad36507aeb7e16159dfe68db81ccc27571c3ccd4b76fb2fb72fc59e7a4b1b64c" +dependencies = [ + "bitflags 2.13.2", + "block", + "cocoa-foundation 0.2.1", + "core-foundation 0.10.0", + "core-graphics 0.24.0", + "foreign-types", + "libc", + "objc", +] + +[[package]] +name = "cocoa-foundation" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c6234cbb2e4c785b456c0644748b1ac416dd045799740356f8363dfe00c93f7" +dependencies = [ + "bitflags 1.3.2", + "block", + "core-foundation 0.9.4", + "core-graphics-types 0.1.3", + "libc", + "objc", ] [[package]] -name = "clipboard-win" -version = "5.4.3" +name = "cocoa-foundation" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "052af7878466feccda12ba7a6a67d019d712f296809559b47c12c8cc196d3a9a" +checksum = "81411967c50ee9a1fc11365f8c585f863a22a9697c89239c452292c40ba79b0d" dependencies = [ - "error-code", + "bitflags 2.13.2", + "block", + "core-foundation 0.10.0", + "core-graphics-types 0.2.0", + "objc", ] [[package]] @@ -678,15 +1052,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" [[package]] -name = "combine" -version = "4.6.9" +name = "compression-codecs" +version = "0.4.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4356eba6976435498d05a311ee9fc486da3bc81c200d3f0d7dd9703b41913f92" +checksum = "98fc98460ba0ad5317075d3632b8dfc45d0be8c4a49347c2a38272019717614a" dependencies = [ - "bytes", + "bzip2", + "compression-core", + "flate2", "memchr", ] +[[package]] +name = "compression-core" +version = "0.4.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e8ccc4ea9f6acc32d102c0f6d471d11d913ad15f20c04de743374861fa1d414" + [[package]] name = "concurrent-queue" version = "2.5.0" @@ -713,10 +1095,42 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6ef517f0926dd24a1582492c791b6a4818a4d94e789a334894aa15b0d12f55c" [[package]] -name = "constant_time_eq" -version = "0.4.2" +name = "const-random" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87e00182fe74b066627d63b85fd550ac2998d4b0bd86bfed477a0ae4c7c71359" +dependencies = [ + "const-random-macro", +] + +[[package]] +name = "const-random-macro" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" +dependencies = [ + "getrandom 0.2.17", + "once_cell", + "tiny-keccak", +] + +[[package]] +name = "convert_case" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "633458d4ef8c78b72454de2d54fd6ab2e60f9e02be22f3c6104cdc8a4e0fceb9" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "convert_case" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d52eff69cd5e647efe296129160853a42795992097e8af39800e1060caeea9b" +checksum = "affbf0190ed2caf063e3def54ff444b449371d55c58e513a95ab98eca50adb49" +dependencies = [ + "unicode-segmentation", +] [[package]] name = "core-foundation" @@ -728,6 +1142,16 @@ dependencies = [ "libc", ] +[[package]] +name = "core-foundation" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b55271e5c8c478ad3f38ad24ef34923091e0548492a266d19b3c0b4d82574c63" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -741,115 +1165,336 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081" dependencies = [ "bitflags 1.3.2", - "core-foundation", - "core-graphics-types", + "core-foundation 0.9.4", + "core-graphics-types 0.1.3", "foreign-types", "libc", ] [[package]] -name = "core-graphics-types" -version = "0.1.3" +name = "core-graphics" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" +checksum = "fa95a34622365fa5bbf40b20b75dba8dfa8c94c734aea8ac9a5ca38af14316f1" dependencies = [ - "bitflags 1.3.2", - "core-foundation", + "bitflags 2.13.2", + "core-foundation 0.10.0", + "core-graphics-types 0.2.0", + "foreign-types", "libc", ] [[package]] -name = "core_detect" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f8f80099a98041a3d1622845c271458a2d73e688351bf3cb999266764b81d48" - -[[package]] -name = "cpufeatures" -version = "0.3.1" +name = "core-graphics-helmer-fork" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" +checksum = "32eb7c354ae9f6d437a6039099ce7ecd049337a8109b23d73e48e8ffba8e9cd5" dependencies = [ + "bitflags 2.13.2", + "core-foundation 0.9.4", + "core-graphics-types 0.1.3", + "foreign-types", "libc", ] [[package]] -name = "crc32fast" -version = "1.5.2" +name = "core-graphics-types" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01a7799fd6b852db0e61728dde9a204c423b44d689dbd432522543614b490e78" +checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" dependencies = [ - "cfg-if", + "bitflags 1.3.2", + "core-foundation 0.9.4", + "libc", ] [[package]] -name = "crossbeam-utils" -version = "0.8.23" +name = "core-graphics-types" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" +checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb" +dependencies = [ + "bitflags 2.13.2", + "core-foundation 0.10.0", + "libc", +] [[package]] -name = "crunchy" -version = "0.2.4" +name = "core-graphics2" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" +checksum = "4416167a69126e617f8d0a214af0e3c1dbdeffcb100ddf72dcd1a1ac9893c146" +dependencies = [ + "bitflags 2.13.2", + "block", + "cfg-if", + "core-foundation 0.10.0", + "libc", +] [[package]] -name = "crypto-common" -version = "0.2.2" +name = "core-text" +version = "21.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453" +checksum = "a593227b66cbd4007b2a050dfdd9e1d1318311409c8d600dc82ba1b15ca9c130" dependencies = [ - "hybrid-array", + "core-foundation 0.10.0", + "core-graphics 0.24.0", + "foreign-types", + "libc", ] [[package]] -name = "cursor-icon" -version = "1.2.0" +name = "core-video" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f27ae1dd37df86211c42e150270f82743308803d90a6f6e6651cd730d5e1732f" +checksum = "139679cc63eb9504bdbe37e37874b0247136177655f0008588781e90863afa62" +dependencies = [ + "block", + "core-foundation 0.10.0", + "core-graphics2", + "io-surface", + "libc", + "metal", +] [[package]] -name = "data-url" -version = "0.3.2" +name = "core_detect" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be1e0bca6c3637f992fc1cc7cbc52a78c1ef6db076dbf1059c4323d6a2048376" +checksum = "7f8f80099a98041a3d1622845c271458a2d73e688351bf3cb999266764b81d48" [[package]] -name = "deranged" -version = "0.5.8" +name = "core_maths" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" +checksum = "77745e017f5edba1a9c1d854f6f3a52dac8a12dd5af5d2f54aecf61e43d80d30" +dependencies = [ + "libm", +] [[package]] -name = "digest" -version = "0.11.3" +name = "cosmic-text" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2" +checksum = "be17b688510d934ce13f48a2beba700e11583e281e0fda99c22bb256a14eda73" dependencies = [ - "block-buffer", - "const-oid", - "crypto-common", + "bitflags 2.13.2", + "fontdb", + "harfrust", + "linebender_resource_handle", + "log", + "rangemap", + "rustc-hash 2.1.3", + "self_cell", + "skrifa 0.40.0", + "smol_str", + "swash", + "sys-locale", + "unicode-bidi", + "unicode-linebreak", + "unicode-script", + "unicode-segmentation", ] [[package]] -name = "directories" -version = "6.0.0" +name = "cpufeatures" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16f5094c54661b38d03bd7e50df373292118db60b585c08a411c6d840017fe7d" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" dependencies = [ - "dirs-sys", + "libc", ] [[package]] -name = "dirs-sys" +name = "cpufeatures" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01a7799fd6b852db0e61728dde9a204c423b44d689dbd432522543614b490e78" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622f3fc73690be383c7214310406f28a90e6edeadc3cea882f9d71e495b9711a" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc74980687109a3b14c72fd458107bf0baa1da1a1a805e178d15501ba9b86d9d" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-queue" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03e8bd762f7479489c70ed6c768ddca99d7296857de437a68dcb2a94365b3fae" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" + +[[package]] +name = "crunchy" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "crypto-common" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453" +dependencies = [ + "hybrid-array", +] + +[[package]] +name = "ctor" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "914a755b7c2d4af2bdcff7ce1739e2db9a1b81a9b07123d8015786ae03c0980d" +dependencies = [ + "link-section", + "linktime-proc-macro", +] + +[[package]] +name = "cursor-icon" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f27ae1dd37df86211c42e150270f82743308803d90a6f6e6651cd730d5e1732f" + +[[package]] +name = "data-url" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be1e0bca6c3637f992fc1cc7cbc52a78c1ef6db076dbf1059c4323d6a2048376" + +[[package]] +name = "deranged" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" + +[[package]] +name = "derive_more" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" +dependencies = [ + "convert_case 0.10.0", + "proc-macro2", + "quote", + "rustc_version", + "syn 2.0.119", + "unicode-xid", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer 0.10.4", + "crypto-common 0.1.7", + "subtle", +] + +[[package]] +name = "digest" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2" +dependencies = [ + "block-buffer 0.12.1", + "const-oid", + "crypto-common 0.2.2", +] + +[[package]] +name = "directories" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16f5094c54661b38d03bd7e50df373292118db60b585c08a411c6d840017fe7d" +dependencies = [ + "dirs-sys 0.5.0", +] + +[[package]] +name = "dirs" +version = "5.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" +dependencies = [ + "dirs-sys 0.4.1", +] + +[[package]] +name = "dirs-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" +dependencies = [ + "libc", + "option-ext", + "redox_users 0.4.6", + "windows-sys 0.48.0", +] + +[[package]] +name = "dirs-sys" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" dependencies = [ "libc", "option-ext", - "redox_users", + "redox_users 0.5.3", "windows-sys 0.61.2", ] @@ -868,7 +1513,7 @@ dependencies = [ "bitflags 2.13.2", "block2 0.6.2", "libc", - "objc2 0.6.5", + "objc2 0.6.4", ] [[package]] @@ -906,18 +1551,50 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" -[[package]] -name = "dpi" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76" - [[package]] name = "dunce" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" +[[package]] +name = "dwrote" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b35532432acc8b19ceed096e35dfa088d3ea037fe4f3c085f1f97f33b4d02" +dependencies = [ + "lazy_static", + "libc", + "winapi", + "wio", +] + +[[package]] +name = "dyn-clone" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" + +[[package]] +name = "either" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "252afb9ae5eaa683babdc6a068b3f5726eb19e05070c731f9b2a23a7c3e8ed34" + +[[package]] +name = "embed-resource" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbfdaacccebec3b28e4866b8973543c7647797db5ada1bdab552e48fe665fbbd" +dependencies = [ + "cc", + "memchr", + "rustc_version", + "toml 1.1.6+spec-1.1.0", + "vswhom", + "winreg", +] + [[package]] name = "encoding_rs" version = "0.8.42" @@ -932,12 +1609,41 @@ dependencies = [ "simdutf8", ] +[[package]] +name = "encoding_rs_io" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fba3fe847045ecff794b9c138293a80db914678c453ad63fbf0c6a9eb6e00b22" +dependencies = [ + "encoding_rs", +] + [[package]] name = "endi" version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "66b7e2430c6dff6a955451e2cfc438f09cea1965a9d6f87f7e3b90decc014099" +[[package]] +name = "enum-iterator" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4549325971814bda7a44061bf3fe7e487d447cba01e4220a4b454d630d7a016" +dependencies = [ + "enum-iterator-derive", +] + +[[package]] +name = "enum-iterator-derive" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "685adfa4d6f3d765a26bc5dbc936577de9abf756c1feeb3089b01dd395034842" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "enumflags2" version = "0.7.12" @@ -959,12 +1665,54 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "enumn" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f9ed6b3789237c8a0c1c505af1c7eb2c560df6186f01b098c3a1064ea532f38" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "equator" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4711b213838dfee0117e3be6ac926007d7f433d7bbe33595975d4190cb07e6fc" +dependencies = [ + "equator-macro", +] + +[[package]] +name = "equator-macro" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44f23cf4b44bfce11a86ace86f8a73ffdec849c9fd00a386a53d278bd9e81fb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "equivalent" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "erased-serde" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2add8a07dd6a8d93ff627029c51de145e12686fbc36ecb298ac22e74cf02dec" +dependencies = [ + "serde", + "serde_core", + "typeid", +] + [[package]] name = "errno" version = "0.3.14" @@ -976,10 +1724,14 @@ dependencies = [ ] [[package]] -name = "error-code" -version = "3.4.0" +name = "etagere" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b5343afd4a8365a643ac588dab4cf234a190c7f6c88c9f6dd6ffe00837661b7" +checksum = "fc89bf99e5dc15954a60f707c1e09d7540e5cd9af85fa75caa0b510bc08c5342" +dependencies = [ + "euclid", + "svg_fmt", +] [[package]] name = "euclid" @@ -1010,11 +1762,31 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "exr" +version = "1.74.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711fe42c9964295e01ee3fba3f9fe0e1d24b98886950d68efe81b1c76e21adf3" +dependencies = [ + "bit_field", + "half", + "lebe", + "miniz_oxide 0.8.9", + "num-complex", + "pulp", + "rayon-core", + "smallvec", + "zune-inflate", +] + [[package]] name = "fastrand" version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" +dependencies = [ + "getrandom 0.4.3", +] [[package]] name = "fax" @@ -1031,6 +1803,17 @@ dependencies = [ "simd-adler32", ] +[[package]] +name = "filedescriptor" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e40758ed24c9b2eeb76c35fb0aebc66c626084edd827e07e1552279814c6682d" +dependencies = [ + "libc", + "thiserror 1.0.69", + "winapi", +] + [[package]] name = "find-msvc-tools" version = "0.1.14" @@ -1060,6 +1843,18 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4" +[[package]] +name = "float-ord" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce81f49ae8a0482e4c55ea62ebbd7e5a686af544c00b9d090bba3ff9be97b3d" + +[[package]] +name = "float_next_after" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bf7cc16383c4b8d58b9905a8509f02926ce3058053c056376248d958c9df1e8" + [[package]] name = "fluent-uri" version = "0.1.4" @@ -1070,10 +1865,28 @@ dependencies = [ ] [[package]] -name = "foldhash" -version = "0.1.5" +name = "flume" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" +checksum = "5e139bc46ca777eb5efaf62df0ab8cc5fd400866427e56c68b22e414e53bd3be" +dependencies = [ + "fastrand", + "futures-core", + "futures-sink", + "spin 0.9.9", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" [[package]] name = "foldhash" @@ -1081,6 +1894,15 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" +[[package]] +name = "font-types" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b38ad915f6dadd993ced50848a8291a543bd41ca62bc10740d5e64e2ab4cfd7" +dependencies = [ + "bytemuck", +] + [[package]] name = "font-types" version = "0.12.6" @@ -1091,25 +1913,26 @@ dependencies = [ ] [[package]] -name = "fontique" -version = "0.12.0" +name = "fontconfig-parser" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbf1df16263783918b7da396077521f92b729ef7c429444dfcf03581f1448b77" +checksum = "bbc773e24e02d4ddd8395fd30dc147524273a83e54e0f312d986ea30de5f5646" dependencies = [ - "hashbrown 0.17.1", - "linebender_resource_handle", + "roxmltree 0.20.0", +] + +[[package]] +name = "fontdb" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "457e789b3d1202543297a350643cf459f836cade38934e7a4cf6a39e7cde2905" +dependencies = [ + "fontconfig-parser", + "log", "memmap2", - "objc2 0.6.5", - "objc2-core-foundation", - "objc2-core-text", - "objc2-foundation 0.3.2", - "parlance", - "read-fonts", - "roxmltree 0.21.1", - "smallvec", - "windows", - "windows-core", - "yeslogic-fontconfig-sys", + "slotmap", + "tinyvec", + "ttf-parser", ] [[package]] @@ -1148,6 +1971,36 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "freetype-sys" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e7edc5b9669349acfda99533e9e0bcf26a51862ab43b08ee7745c55d28eb134" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + +[[package]] +name = "fsevent-sys" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76ee7a02da4d231650c7cea31349b889be2f45ddb3ef3032d2ec8185f6313fd2" +dependencies = [ + "libc", +] + +[[package]] +name = "futf" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df420e2e84819663797d1ec6544b13c5be84629e7bb00dc960d6917db2987843" +dependencies = [ + "mac", + "new_debug_unreachable", +] + [[package]] name = "futures" version = "0.3.34" @@ -1173,6 +2026,19 @@ dependencies = [ "futures-sink", ] +[[package]] +name = "futures-concurrency" +version = "7.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175cd8cca9e1d45b87f18ffa75088f2099e3c4fe5e2f83e42de112560bea8ea6" +dependencies = [ + "fixedbitset", + "futures-core", + "futures-lite", + "pin-project", + "smallvec", +] + [[package]] name = "futures-core" version = "0.3.34" @@ -1250,92 +2116,878 @@ dependencies = [ ] [[package]] -name = "gethostname" -version = "1.1.0" +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "gethostname" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8" +dependencies = [ + "rustix", + "windows-link 0.2.1", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi 5.3.0", + "wasip2", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi 6.0.0", + "rand_core 0.10.1", + "wasm-bindgen", +] + +[[package]] +name = "gif" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae047235e33e2829703574b54fdec96bfbad892062d97fed2f76022287de61b" +dependencies = [ + "color_quant", + "weezl", +] + +[[package]] +name = "gif" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee8cfcc411d9adbbaba82fb72661cc1bcca13e8bba98b364e62b2dba8f960159" +dependencies = [ + "color_quant", + "weezl", +] + +[[package]] +name = "gimli" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" + +[[package]] +name = "git2" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddddbf932745a6be37109b6112d3ee09696106f848449069d3a57bba937ab82e" +dependencies = [ + "bitflags 2.13.2", + "libc", + "libgit2-sys", + "log", +] + +[[package]] +name = "gl_generator" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d" +dependencies = [ + "khronos_api", + "log", + "xml-rs", +] + +[[package]] +name = "glob" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b" + +[[package]] +name = "globset" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07c34a9410465b45bd9787443bc7370f37735bad04b0f0cd57ff1a3186c98988" +dependencies = [ + "aho-corasick", + "bstr", + "log", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "globwalk" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93e3af942408868f6934a7b85134a3230832b9977cf66125df2f9edcfce4ddcc" +dependencies = [ + "bitflags 1.3.2", + "ignore", + "walkdir", +] + +[[package]] +name = "glow" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29038e1c483364cc6bb3cf78feee1816002e127c331a1eec55a4d202b9e1adb5" +dependencies = [ + "js-sys", + "slotmap", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "glutin_wgl_sys" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c4ee00b289aba7a9e5306d57c2d05499b2e5dc427f84ac708bd2c090212cf3e" +dependencies = [ + "gl_generator", +] + +[[package]] +name = "gpu-allocator" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51255ea7cfaadb6c5f1528d43e92a82acb2b96c43365989a28b2d44ee38f8795" +dependencies = [ + "ash", + "hashbrown 0.16.1", + "log", + "presser", + "thiserror 2.0.21", + "windows 0.62.2", +] + +[[package]] +name = "gpu-descriptor" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b89c83349105e3732062a895becfc71a8f921bb71ecbbdd8ff99263e3b53a0ca" +dependencies = [ + "bitflags 2.13.2", + "gpu-descriptor-types", + "hashbrown 0.15.5", +] + +[[package]] +name = "gpu-descriptor-types" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdf242682df893b86f33a73828fb09ca4b2d3bb6cc95249707fc684d27484b91" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "gpui-base" +version = "0.7.1" +dependencies = [ + "aho-corasick", + "anyhow", + "ashpd", + "async-channel", + "chrono", + "data-url", + "futures", + "gpui-pre", + "gpui-pre-macros", + "gpui-pre-sum-tree", + "html5ever", + "instant", + "itertools 0.13.0", + "lsp-types", + "markdown", + "markup5ever_rcdom", + "num-traits", + "objc2 0.6.4", + "objc2-app-kit 0.3.2", + "objc2-foundation 0.3.2", + "raw-window-handle", + "regex", + "ropey", + "schemars", + "serde", + "serde_json", + "smallvec", + "smol", + "tracing", + "unicode-linebreak", + "unicode-segmentation", + "web-time", + "windows 0.58.0", +] + +[[package]] +name = "gpui-component" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc8b7def8e74b0d822d3e96f6b28fb5a2c20eb7a83d30d22fa59ca8088d1159b" +dependencies = [ + "anyhow", + "chrono", + "core-text", + "enum-iterator", + "gpui-base", + "gpui-component-macros", + "gpui-kit-assets", + "gpui-pre", + "gpui-pre-macros", + "gpui-pre-sum-tree", + "instant", + "itertools 0.13.0", + "log", + "lsp-types", + "markdown", + "notify", + "num-traits", + "objc2 0.6.4", + "objc2-app-kit 0.3.2", + "objc2-foundation 0.3.2", + "once_cell", + "paste", + "raw-window-handle", + "regex", + "resvg 0.45.1", + "ropey", + "rust-i18n", + "schemars", + "serde", + "serde_json", + "serde_repr", + "smallvec", + "smol", + "tracing", + "tree-sitter", + "tree-sitter-bash", + "tree-sitter-css", + "tree-sitter-html", + "tree-sitter-javascript", + "tree-sitter-json", + "tree-sitter-md", + "tree-sitter-rust", + "tree-sitter-toml-ng", + "tree-sitter-typescript", + "tree-sitter-yaml", + "uuid", + "windows 0.58.0", +] + +[[package]] +name = "gpui-component-macros" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2968cc7f4a2bd8f51b09cfe4f1e77409951b48a0e2d48f372b010e69c3d7fb49" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "gpui-kit" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be18e0417095ebfea77ac25962961ff4e41a120ea6cb8f05a7505b682478b83e" +dependencies = [ + "gpui-base", + "gpui-component", + "gpui-kit-assets", + "gpui-pre", + "gpui-pre-platform", + "gpui-pre-web", +] + +[[package]] +name = "gpui-kit-assets" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db6c481ca987f1e6f10b1aed4d47f1b301cd1dc6f3016fac93c305f2a4f307c0" +dependencies = [ + "anyhow", + "gpui-pre", + "gpui-pre-reqwest", + "log", + "rust-embed", + "wasm-bindgen", + "wasm-bindgen-futures", +] + +[[package]] +name = "gpui-pre" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7f0bc3ebba070f8981b3f8e905a12f47d27794a30d029e59cdb9edf7a4b3360" +dependencies = [ + "accesskit", + "anyhow", + "async-channel", + "async-task", + "backtrace", + "bindgen", + "bitflags 2.13.2", + "chrono", + "core-video", + "ctor", + "derive_more", + "embed-resource", + "etagere", + "futures", + "futures-concurrency", + "getrandom 0.3.4", + "gpui-pre-collections", + "gpui-pre-http-client", + "gpui-pre-macros", + "gpui-pre-refineable", + "gpui-pre-scheduler", + "gpui-pre-shared-string", + "gpui-pre-sum-tree", + "gpui-pre-util", + "gpui-pre-util-macros", + "heapless", + "image", + "inventory", + "itertools 0.14.0", + "libc", + "log", + "lyon", + "num_cpus", + "objc2-core-foundation", + "objc2-core-video", + "parking", + "parking_lot", + "pin-project", + "pollster 0.4.0", + "postage", + "profiling", + "proptest", + "rand 0.9.5", + "raw-window-handle", + "regex", + "resvg 0.46.0", + "schemars", + "seahash", + "serde", + "serde_json", + "slotmap", + "smallvec", + "spin 0.10.1", + "strum", + "taffy", + "thiserror 2.0.21", + "ttf-parser", + "url", + "usvg 0.46.0", + "uuid", + "waker-fn", + "web-time", + "windows 0.62.2", + "zed-font-kit", + "zed-scap", +] + +[[package]] +name = "gpui-pre-apple" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfdd914311cd12894367c8b9908947bb0c27fd42f8b9a5ff7a0730551a83fa4c" +dependencies = [ + "anyhow", + "async-task", + "block2 0.6.2", + "cbindgen", + "core-foundation 0.10.0", + "core-graphics 0.24.0", + "core-video", + "derive_more", + "dispatch2", + "etagere", + "foreign-types", + "gpui-pre", + "gpui-pre-util", + "image", + "libc", + "log", + "mach2", + "metal", + "objc2 0.6.4", + "objc2-foundation 0.3.2", + "objc2-quartz-core 0.3.2", + "parking_lot", +] + +[[package]] +name = "gpui-pre-collections" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c060863025dc3b8e90febad2d1f4ffd23a5d0dcedba39d3f6b7820ea2fdd3a0" +dependencies = [ + "gpui-pre-util", + "indexmap", + "rustc-hash 2.1.3", +] + +[[package]] +name = "gpui-pre-derive-refineable" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc834f30f5f49791e214f1fde01a009c7de91c9cd0a9f31dabfed130ba39e6cf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "gpui-pre-http-client" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d2935cf82333da3f41774e5757837756408f01356197b41c817ad2666034453" +dependencies = [ + "anyhow", + "async-compression", + "bytes", + "derive_more", + "futures", + "http", + "http-body", + "log", + "parking_lot", + "serde", + "serde_json", + "serde_urlencoded", + "url", +] + +[[package]] +name = "gpui-pre-linux" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1131746fad5c87b5de74dc9c73105655b0c820a2dd4bb247586573e7cf5720e" +dependencies = [ + "accesskit", + "accesskit_unix", + "anyhow", + "as-raw-xcb-connection", + "ashpd", + "bytemuck", + "calloop", + "calloop-wayland-source", + "filedescriptor", + "futures", + "gpui-pre", + "gpui-pre-collections", + "gpui-pre-http-client", + "gpui-pre-util", + "gpui-pre-wgpu", + "libc", + "log", + "notify-rust", + "oo7", + "open", + "parking_lot", + "raw-window-handle", + "smallvec", + "smol", + "strum", + "url", + "uuid", + "wayland-backend", + "wayland-client", + "wayland-cursor", + "wayland-protocols", + "wayland-protocols-plasma", + "wayland-protocols-wlr", + "x11rb", + "xkbcommon", + "zed-scap", + "zed-xim", +] + +[[package]] +name = "gpui-pre-macos" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d756813ff1cd741a502af60fd18869e0677795936d7349642b41c49f43120c0" +dependencies = [ + "accesskit", + "accesskit_macos", + "anyhow", + "block2 0.6.2", + "cocoa 0.26.1", + "core-foundation 0.10.0", + "core-foundation-sys", + "core-graphics 0.24.0", + "core-text", + "core-video", + "ctor", + "dispatch2", + "foreign-types", + "futures", + "gpui-pre", + "gpui-pre-apple", + "gpui-pre-collections", + "gpui-pre-scheduler", + "gpui-pre-util", + "image", + "itertools 0.14.0", + "log", + "objc", + "objc2 0.6.4", + "objc2-app-kit 0.3.2", + "objc2-core-graphics", + "objc2-core-media", + "objc2-foundation 0.3.2", + "objc2-screen-capture-kit", + "objc2-user-notifications", + "parking_lot", + "pathfinder_geometry", + "raw-window-handle", + "semver", + "smallvec", + "strum", + "uuid", + "zed-font-kit", +] + +[[package]] +name = "gpui-pre-macros" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2ad26ca759364694cb55487bebff4c1b7dd6accab49990ff3cda6f7a818a9f4" +dependencies = [ + "heck 0.5.0", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "gpui-pre-perf" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fcb288a506a476b6cbf97e6ec1cc0118db43f0ca91087588afa1c2d8cd4f842" +dependencies = [ + "gpui-pre-collections", + "serde", + "serde_json", +] + +[[package]] +name = "gpui-pre-platform" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e200b7b78836f1a0fc70767d971768e88f29d8b91b697285c15fb8e373635a3e" +dependencies = [ + "anyhow", + "console_error_panic_hook", + "gpui-pre", + "gpui-pre-linux", + "gpui-pre-macos", + "gpui-pre-web", + "gpui-pre-wgpu", + "gpui-pre-windows", +] + +[[package]] +name = "gpui-pre-refineable" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4042345bb5bd3ecbc5d15b21ed128154f462a992058d7038cd397631f5462338" +dependencies = [ + "gpui-pre-derive-refineable", +] + +[[package]] +name = "gpui-pre-reqwest" +version = "0.12.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05be23908e707966824f8c51a609904b7f30739e8d915e120a53c1b995ba964c" +dependencies = [ + "base64 0.22.1", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "ipnet", + "js-sys", + "log", + "mime", + "mime_guess", + "once_cell", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-native-certs", + "rustls-pemfile", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "system-configuration", + "tokio", + "tokio-rustls", + "tokio-socks", + "tokio-util", + "tower", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-streams", + "web-sys", + "windows-registry 0.4.0", +] + +[[package]] +name = "gpui-pre-scheduler" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4acd73345bc3c09f1b98c1b21eb4459ad8336f89bb2edcef619e11c5a08456e" +dependencies = [ + "async-task", + "backtrace", + "chrono", + "flume", + "futures", + "parking_lot", + "rand 0.9.5", + "wasm_thread", + "web-time", +] + +[[package]] +name = "gpui-pre-shared-string" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "477529fd5aa90bff969785ee9a3938484d94aa5101cdf7b84719629c0345f98a" +dependencies = [ + "schemars", + "serde", + "smol_str", +] + +[[package]] +name = "gpui-pre-sum-tree" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ec0ec176d576b82aed716cf47185856b54ea9528caaf9d01787024689bfd824" +dependencies = [ + "gpui-pre-ztracing", + "heapless", + "log", + "rayon", + "tracing", +] + +[[package]] +name = "gpui-pre-util" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1635ae7d0b05400bfa211ddef6c67dc8d9f223c463022c2b3bf2c1c14c6044f" +dependencies = [ + "anyhow", + "log", + "which", +] + +[[package]] +name = "gpui-pre-util-macros" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01486fce7722e5d7d7e7bb71c719dfdcc6ed917112bdc7c56d0556fdb60d10ab" +dependencies = [ + "gpui-pre-perf", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "gpui-pre-web" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8" +checksum = "184776d0763e6889dd2842dcb1204c15055945f2bdfe926b5ef57bdbd1952a65" dependencies = [ - "rustix 1.1.5", - "windows-link", + "anyhow", + "console_error_panic_hook", + "futures", + "gpui-pre", + "gpui-pre-http-client", + "gpui-pre-scheduler", + "gpui-pre-wgpu", + "js-sys", + "log", + "parking_lot", + "raw-window-handle", + "smallvec", + "unicode-properties", + "unicode-script", + "unicode-segmentation", + "uuid", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm_thread", + "web-sys", + "web-time", ] [[package]] -name = "getrandom" -version = "0.2.17" +name = "gpui-pre-wgpu" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +checksum = "439c5421cafe1a7cf68d0c0ae5cc82b26fad6b0e6345ac98d20acaf1f2463914" dependencies = [ - "cfg-if", - "libc", - "wasi", + "anyhow", + "bytemuck", + "cosmic-text", + "etagere", + "gpui-pre", + "gpui-pre-collections", + "gpui-pre-util", + "image", + "itertools 0.14.0", + "log", + "parking_lot", + "profiling", + "raw-window-handle", + "smallvec", + "swash", + "unicode-bidi", + "unicode-segmentation", + "web-sys", + "wgpu", + "zed-font-kit", ] [[package]] -name = "getrandom" -version = "0.3.4" +name = "gpui-pre-windows" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +checksum = "371f9bb13f97e3bea2f8b8e5e81232bb74d735153c244ae67f7400e743925b1c" dependencies = [ - "cfg-if", - "libc", - "r-efi 5.3.0", - "wasip2", + "accesskit", + "accesskit_windows", + "anyhow", + "dunce", + "etagere", + "futures", + "gpui-pre", + "gpui-pre-collections", + "gpui-pre-scheduler", + "gpui-pre-util", + "image", + "itertools 0.14.0", + "log", + "parking_lot", + "rand 0.9.5", + "raw-window-handle", + "smallvec", + "uuid", + "windows 0.62.2", + "windows-core 0.62.2", + "windows-numerics 0.3.1", + "windows-registry 0.6.1", ] [[package]] -name = "getrandom" -version = "0.4.3" +name = "gpui-pre-zlog" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +checksum = "3bbe5b98630ef4bfed5a7105ec1062e78d571912bc491388f07ea22f2457c18b" dependencies = [ - "cfg-if", - "js-sys", - "libc", - "r-efi 6.0.0", - "rand_core", - "wasm-bindgen", + "anyhow", + "chrono", + "gpui-pre-collections", + "log", ] [[package]] -name = "gif" -version = "0.14.2" +name = "gpui-pre-ztracing" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee8cfcc411d9adbbaba82fb72661cc1bcca13e8bba98b364e62b2dba8f960159" +checksum = "f806400f6bda1fdd9fc627e158c0e44fb0c4b7767582a3621efcf92f4a850db7" dependencies = [ - "color_quant", - "weezl", + "gpui-pre-zlog", + "gpui-pre-ztracing-macro", + "tracing", + "tracing-subscriber", ] [[package]] -name = "git2" -version = "0.21.0" +name = "gpui-pre-ztracing-macro" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddddbf932745a6be37109b6112d3ee09696106f848449069d3a57bba937ab82e" -dependencies = [ - "bitflags 2.13.2", - "libc", - "libgit2-sys", - "log", -] +checksum = "d337c9acf058238e45ce0570d8a5958439242889492f91ae2d8e324211a61ccd" [[package]] -name = "glob" -version = "0.3.4" +name = "granit-parser" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b" +checksum = "e20f99e46474f56bd905c56e817ebddcf377a611f94c53ac4649e4d3fa3c0cd0" +dependencies = [ + "arraydeque", + "smallvec", +] [[package]] -name = "gpu-allocator" -version = "0.28.0" +name = "h2" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51255ea7cfaadb6c5f1528d43e92a82acb2b96c43365989a28b2d44ee38f8795" +checksum = "ef8e5e5a340588f4452631496976cf8636d4a7ecf600239fdc27615d2530bc16" dependencies = [ - "ash", - "hashbrown 0.16.1", - "log", - "presser", - "thiserror 2.0.21", - "windows", + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", ] [[package]] @@ -1352,16 +3004,32 @@ dependencies = [ [[package]] name = "harfrust" -version = "0.12.0" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c03d949a14aa089bbb282f7dd76a498a7f684428e4257202efc119ec010376f9" +checksum = "9da2e5ae821f6e96664977bf974d6d6a2d6682f9ccee23e62ec1d134246845f9" dependencies = [ "bitflags 2.13.2", "bytemuck", - "read-fonts", + "core_maths", + "read-fonts 0.37.0", "smallvec", ] +[[package]] +name = "hash32" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606" +dependencies = [ + "byteorder", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + [[package]] name = "hashbrown" version = "0.15.5" @@ -1387,10 +3055,29 @@ name = "hashbrown" version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" + +[[package]] +name = "heapless" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25ba4bd83f9415b58b4ed8dc5714c76e626a105be4646c02630ad730ad3b5aa4" dependencies = [ - "foldhash 0.2.0", + "hash32", + "stable_deref_trait", ] +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "hermit-abi" version = "0.5.3" @@ -1403,6 +3090,30 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hexf-parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" + +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.7", +] + [[package]] name = "home" version = "0.5.12" @@ -1412,6 +3123,20 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "html5ever" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c13771afe0e6e846f1e67d038d4cb29998a6779f93c809212e4e9c32efd244d4" +dependencies = [ + "log", + "mac", + "markup5ever", + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "http" version = "1.5.0" @@ -1422,6 +3147,29 @@ dependencies = [ "itoa", ] +[[package]] +name = "http-body" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + [[package]] name = "httparse" version = "1.10.1" @@ -1437,6 +3185,88 @@ dependencies = [ "typenum", ] +[[package]] +name = "hyper" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27b501faa50e7a26c3d3560ca625132f4078a17771f4810baf70475ae48cbe43" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "h2", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfa8e654703247911e29c23fbeaa261834bd9bb74efba2f9acddc37bfb127f53" +dependencies = [ + "http", + "hyper", + "hyper-util", + "rustls", + "rustls-native-certs", + "tokio", + "tokio-rustls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddc03d96684f9226b8a787cdb71488417b53ab5ea8fdb1dac946cb9431cc8bff" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "httparse", + "hyper", + "libc", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core 0.62.2", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + [[package]] name = "icu_collections" version = "2.3.0" @@ -1459,32 +3289,11 @@ checksum = "d56e28588da92eee5c3201a6eff33fabdd49b62269c8938d4ff050ce4d900deb" dependencies = [ "displaydoc", "litemap", - "serde", "tinystr", "writeable", "zerovec", ] -[[package]] -name = "icu_locale_fallback" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "251af8e57c9400e3eb58242fe5b8b1152b2a64fdf4cf632f923c38ccee6f2fa9" -dependencies = [ - "icu_locale_core", - "icu_locale_fallback_data", - "icu_provider", - "potential_utf", - "tinystr", - "zerovec", -] - -[[package]] -name = "icu_locale_fallback_data" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "decf2a22ec8fa68f1a0c1129a3f8583f8f8bc24e8b9ccbe98ead99f62a4dc3a8" - [[package]] name = "icu_normalizer" version = "2.3.0" @@ -1534,8 +3343,6 @@ checksum = "d27bbb9d3abbefac45d55f647c9de1d44aafcd1186eb91879afef17c396c3e73" dependencies = [ "displaydoc", "icu_locale_core", - "serde", - "stable_deref_trait", "writeable", "yoke", "zerofrom", @@ -1543,28 +3350,6 @@ dependencies = [ "zerovec", ] -[[package]] -name = "icu_segmenter" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82d07aafccd67af15d02512a6adf5896fbc5ed00f2e99b471d2efa14016db3db" -dependencies = [ - "icu_collections", - "icu_locale_fallback", - "icu_provider", - "icu_segmenter_data", - "potential_utf", - "smallvec", - "utf8_iter", - "zerovec", -] - -[[package]] -name = "icu_segmenter_data" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae293c039020f9ec10710af98d29ce6aa2051486638b49c9a6409f3b4a9e98ad" - [[package]] name = "idna" version = "1.1.0" @@ -1586,6 +3371,22 @@ dependencies = [ "icu_properties", ] +[[package]] +name = "ignore" +version = "0.4.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b69833ed729dc5aa7d19541d96d6cf8e9137194207a04916d658e43168402f" +dependencies = [ + "crossbeam-deque", + "globset", + "log", + "memchr", + "regex-automata", + "same-file", + "walkdir", + "winapi-util", +] + [[package]] name = "image" version = "0.25.10" @@ -1595,14 +3396,18 @@ dependencies = [ "bytemuck", "byteorder-lite", "color_quant", - "gif", + "exr", + "gif 0.14.2", "image-webp", "moxcms", "num-traits", "png 0.18.1", + "qoi", + "ravif", + "rayon", "tiff", - "zune-core", - "zune-jpeg", + "zune-core 0.5.3", + "zune-jpeg 0.5.15", ] [[package]] @@ -1612,7 +3417,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "525e9ff3e1a4be2fbea1fdf0e98686a6d98b4d8f937e1bf7402245af1909e8c3" dependencies = [ "byteorder-lite", - "quick-error", + "quick-error 2.0.1", ] [[package]] @@ -1621,6 +3426,18 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edcd27d72f2f071c64249075f42e205ff93c9a4c5f6c6da53e79ed9f9832c285" +[[package]] +name = "imagesize" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09e54e57b4c48b40f7aec75635392b12b3421fa26fe8b4332e63138ed278459c" + +[[package]] +name = "imgref" +version = "1.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e44b0a4eaa4c82f441d50a963f2d5f05a787240aeee097597033e72accfd22f" + [[package]] name = "indexmap" version = "2.14.2" @@ -1629,6 +3446,8 @@ checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" dependencies = [ "equivalent", "hashbrown 0.17.1", + "serde", + "serde_core", ] [[package]] @@ -1652,41 +3471,117 @@ dependencies = [ ] [[package]] -name = "itoa" -version = "1.0.18" +name = "inout" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "block-padding", + "generic-array", +] [[package]] -name = "jni" -version = "0.22.4" +name = "instant" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498" +checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" dependencies = [ "cfg-if", - "combine", - "jni-macros", - "jni-sys 0.4.1", - "log", - "simd_cesu8", - "thiserror 2.0.21", - "walkdir", - "windows-link", + "js-sys", + "wasm-bindgen", + "web-sys", ] [[package]] -name = "jni-macros" -version = "0.22.4" +name = "interpolate_name" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3" +checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60" dependencies = [ "proc-macro2", "quote", - "rustc_version", - "simd_cesu8", "syn 2.0.119", ] +[[package]] +name = "inventory" +version = "0.3.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4f0c30c76f2f4ccee3fe55a2435f691ca00c0e4bd87abe4f4a851b1d4dac39b" +dependencies = [ + "rustversion", +] + +[[package]] +name = "io-surface" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "554b8c5d64ec09a3a520fe58e4d48a73e00ff32899cdcbe32a4877afd4968b8e" +dependencies = [ + "cgl", + "core-foundation 0.10.0", + "core-foundation-sys", + "leaky-cow", +] + +[[package]] +name = "ipnet" +version = "2.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "791930b43c0d5973160d90a8f3894509f2b273430f5c5c73b668636d0287c5c0" + +[[package]] +name = "is-docker" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "928bae27f42bc99b60d9ac7334e3a21d10ad8f1835a4e12ec3ec0464765ed1b3" +dependencies = [ + "once_cell", +] + +[[package]] +name = "is-wsl" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "173609498df190136aa7dea1a91db051746d339e18476eed5ca40521f02d7aa5" +dependencies = [ + "is-docker", + "once_cell", +] + +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + [[package]] name = "jni-sys" version = "0.3.1" @@ -1746,6 +3641,23 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "khronos-egl" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76" +dependencies = [ + "libc", + "libloading", + "pkg-config", +] + +[[package]] +name = "khronos_api" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" + [[package]] name = "kqueue" version = "1.2.1" @@ -1777,18 +3689,67 @@ dependencies = [ "smallvec", ] +[[package]] +name = "kurbo" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b60dfc32f652b926df6192e55525b16d186c69d47876c3ead4da5cc9f8450e2" +dependencies = [ + "arrayvec", + "euclid", + "polycool", + "smallvec", +] + [[package]] name = "lazy_static" version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb" +[[package]] +name = "leak" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd100e01f1154f2908dfa7d02219aeab25d0b9c7fa955164192e3245255a0c73" + +[[package]] +name = "leaky-cow" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40a8225d44241fd324a8af2806ba635fc7c8a7e9a7de4d5cf3ef54e71f5926fc" +dependencies = [ + "leak", +] + +[[package]] +name = "lebe" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a79a3332a6609480d7d0c9eab957bca6b455b91bb84e66d19f5ff66294b85b8" + +[[package]] +name = "libbz2-rs-sys" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34b357333733e8260735ba5894eb928c02ecc69c78715f01a8019e7fa7f2db4c" + [[package]] name = "libc" version = "0.2.190" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce5d3ddc6d3fa000eb1536d85e147bfe31aacaba692ed6a876f95cb7c855be78" +[[package]] +name = "libfuzzer-sys" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9fd2f41a1cba099f79a0b6b6c35656cf7c03351a7bae8ff0f28f25270f929d2" +dependencies = [ + "arbitrary", + "cc", +] + [[package]] name = "libgit2-sys" version = "0.18.8+1.9.7" @@ -1805,112 +3766,301 @@ dependencies = [ name = "libloading" version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" +checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" +dependencies = [ + "cfg-if", + "windows-link 0.2.1", +] + +[[package]] +name = "libm" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" + +[[package]] +name = "libredox" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61ff90caf6077a803a240f62fdbe88645a890bbca49ef8174c3cb0404362171d" +dependencies = [ + "libc", +] + +[[package]] +name = "libz-sys" +version = "1.1.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85bc9657773828b90eeb625adff10eeac83cc21bbfd8e23a03eaa8a33c9e28d9" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "linebender_resource_handle" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" + +[[package]] +name = "link-section" +version = "0.19.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39c29a617ce3df32c08497bdc1ab6e2376e0b17948ac166a2fbe5977c5954cd9" + +[[package]] +name = "linktime-proc-macro" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e57c38c1e860fd37c604281cdfb1dd2216977fd76a50f85ba2f388ef3219616" + +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + +[[package]] +name = "litemap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" + +[[package]] +name = "litrs" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" +dependencies = [ + "serde_core", + "value-bag", +] + +[[package]] +name = "loop9" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fae87c125b03c1d2c0150c90365d7d6bcc53fb73a9acaef207d2d065860f062" +dependencies = [ + "imgref", +] + +[[package]] +name = "lru-slab" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4050469837a6ff301cd14c1f8f24f88549e6d548f24f64e2148eb0f72cebc51f" + +[[package]] +name = "lsp-types" +version = "0.97.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53353550a17c04ac46c585feb189c2db82154fc84b79c7a66c96c2c644f66071" +dependencies = [ + "bitflags 1.3.2", + "fluent-uri", + "serde", + "serde_json", + "serde_repr", +] + +[[package]] +name = "lyon" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd0578bdecb7d6d88987b8b2b1e3a4e2f81df9d0ece1078623324a567904e7b7" +dependencies = [ + "lyon_algorithms", + "lyon_tessellation", +] + +[[package]] +name = "lyon_algorithms" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdfa8785f95e57914ddb35e3b59994aeba6f5e79e9cfd03da1c269f010f36009" +dependencies = [ + "lyon_path", + "num-traits", +] + +[[package]] +name = "lyon_geom" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4336502e29e32af93cf2dad2214ed6003c17ceb5bd499df77b1de663b9042b92" dependencies = [ - "cfg-if", - "windows-link", + "arrayvec", + "euclid", + "num-traits", ] [[package]] -name = "libm" -version = "0.2.16" +name = "lyon_path" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" +checksum = "5c463f9c428b7fc5ec885dcd39ce4aa61e29111d0e33483f6f98c74e89d8621e" +dependencies = [ + "lyon_geom", + "num-traits", +] [[package]] -name = "libredox" -version = "0.1.25" +name = "lyon_tessellation" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61ff90caf6077a803a240f62fdbe88645a890bbca49ef8174c3cb0404362171d" +checksum = "43b8dcf906637ecef61b3c0740c7a4e7f27caeb31257cfac0cc579ce15be6005" dependencies = [ - "bitflags 2.13.2", - "libc", - "plain", - "redox_syscall 0.9.5", + "float_next_after", + "lyon_path", + "num-traits", ] [[package]] -name = "libz-sys" -version = "1.1.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85bc9657773828b90eeb625adff10eeac83cc21bbfd8e23a03eaa8a33c9e28d9" +name = "m4code" +version = "0.10.0" dependencies = [ - "cc", + "alacritty_terminal", + "anyhow", + "directories", + "dunce", + "futures", + "git2", + "gpui-kit", + "gpui-pre", + "image", + "junction", "libc", - "pkg-config", - "vcpkg", + "lsp-types", + "notify", + "notify-rust", + "objc2 0.6.4", + "objc2-app-kit 0.3.2", + "raw-window-handle", + "serde", + "serde_json", + "tempfile", + "time", + "tree-sitter-gleam", + "ureq", + "url", + "uuid", + "velopack", + "which", + "windows-sys 0.61.2", + "winresource", ] [[package]] -name = "linebender_resource_handle" +name = "mac" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" +checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" [[package]] -name = "linux-raw-sys" -version = "0.4.15" +name = "mac-notification-sys" +version = "0.6.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" +checksum = "fd604973958ddcc11b561193c0fb96ba146506ef2f231ef2e7c35fd2cbc9beca" +dependencies = [ + "cc", + "log", + "objc2 0.6.4", + "objc2-foundation 0.3.2", + "time", + "uuid", +] [[package]] -name = "linux-raw-sys" -version = "0.12.1" +name = "mach2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" +checksum = "6a1b95cd5421ec55b445b5ae102f5ea0e768de1f82bd3001e11f426c269c3aea" +dependencies = [ + "libc", +] [[package]] -name = "litemap" -version = "0.8.3" +name = "malloc_buf" +version = "0.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" +checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" +dependencies = [ + "libc", +] [[package]] -name = "litrs" +name = "markdown" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092" +checksum = "a5cab8f2cadc416a82d2e783a1946388b31654d391d1c7d92cc1f03e295b1deb" +dependencies = [ + "serde", + "unicode-id", +] [[package]] -name = "lock_api" -version = "0.4.14" +name = "markup5ever" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +checksum = "16ce3abbeba692c8b8441d036ef91aea6df8da2c6b6e21c7e14d3c18e526be45" dependencies = [ - "scopeguard", + "log", + "phf 0.11.3", + "phf_codegen", + "string_cache", + "string_cache_codegen", + "tendril", ] [[package]] -name = "log" -version = "0.4.34" +name = "markup5ever_rcdom" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" +checksum = "edaa21ab3701bfee5099ade5f7e1f84553fd19228cf332f13cd6e964bf59be18" +dependencies = [ + "html5ever", + "markup5ever", + "tendril", + "xml5ever", +] [[package]] -name = "lsp-types" -version = "0.97.0" +name = "maybe-rayon" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53353550a17c04ac46c585feb189c2db82154fc84b79c7a66c96c2c644f66071" +checksum = "8ea1f30cedd69f0a2954655f7188c6a834246d2bcf1e315e2ac40c4b24dc9519" dependencies = [ - "bitflags 1.3.2", - "fluent-uri", - "serde", - "serde_json", - "serde_repr", + "cfg-if", + "rayon", ] [[package]] -name = "mac-notification-sys" -version = "0.6.15" +name = "md-5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd604973958ddcc11b561193c0fb96ba146506ef2f231ef2e7c35fd2cbc9beca" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" dependencies = [ - "cc", - "log", - "objc2 0.6.5", - "objc2-foundation 0.3.2", - "time", - "uuid", + "cfg-if", + "digest 0.10.7", ] [[package]] @@ -1937,6 +4087,43 @@ dependencies = [ "autocfg", ] +[[package]] +name = "metal" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7047791b5bc903b8cd963014b355f71dc9864a9a0b727057676c1dcae5cbc15" +dependencies = [ + "bitflags 2.13.2", + "block", + "core-graphics-types 0.2.0", + "foreign-types", + "log", + "objc", + "paste", +] + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "mime_guess" +version = "2.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" +dependencies = [ + "mime", + "unicase", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "miniz_oxide" version = "0.8.9" @@ -1996,22 +4183,22 @@ checksum = "743fb55ba31b18fb1ecef6bdc9aa2743314978ac084044301a7eee33fb99a20d" [[package]] name = "naga" -version = "30.0.1" +version = "29.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a616d2fb8c89516ac2723a581f69d6c18576046bed761bd6b305e5618e6ae130" +checksum = "b2bf919621e7975acb27d881bae2fb993e0d45c8e0446e85e6272971e00dc8df" dependencies = [ "arrayvec", - "bit-set", + "bit-set 0.9.1", "bitflags 2.13.2", "cfg-if", "cfg_aliases", "codespan-reporting", "half", - "hashbrown 0.17.1", + "hashbrown 0.16.1", + "hexf-parse", "indexmap", "libm", "log", - "naga-types", "num-traits", "once_cell", "rustc-hash 1.1.0", @@ -2021,57 +4208,55 @@ dependencies = [ ] [[package]] -name = "naga-types" -version = "30.0.1" +name = "ndk-sys" +version = "0.6.0+11769913" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "590afbf58a6f4f62873cd5cff4468061844bafa1cdf399cc954537c22d768d49" +checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873" dependencies = [ - "hashbrown 0.17.1", - "indexmap", - "rustc-hash 1.1.0", - "thiserror 2.0.21", + "jni-sys 0.3.1", ] [[package]] -name = "ndk" -version = "0.9.0" +name = "new_debug_unreachable" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" + +[[package]] +name = "nix" +version = "0.31.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" +checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d" dependencies = [ "bitflags 2.13.2", - "jni-sys 0.3.1", - "log", - "ndk-sys", - "num_enum", - "raw-window-handle", - "thiserror 1.0.69", + "cfg-if", + "cfg_aliases", + "libc", ] [[package]] -name = "ndk-context" -version = "0.1.1" +name = "no_std_io2" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" +checksum = "418abd1b6d34fbf6cae440dc874771b0525a604428704c76e48b29a5e67b8003" +dependencies = [ + "memchr", +] [[package]] -name = "ndk-sys" -version = "0.6.0+11769913" +name = "nohash-hasher" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873" -dependencies = [ - "jni-sys 0.3.1", -] +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" [[package]] -name = "nix" -version = "0.31.3" +name = "nom" +version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ - "bitflags 2.13.2", - "cfg-if", - "cfg_aliases", - "libc", + "memchr", + "minimal-lexical", ] [[package]] @@ -2083,6 +4268,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "noop_proc_macro" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8" + [[package]] name = "normpath" version = "1.5.2" @@ -2094,51 +4285,160 @@ dependencies = [ [[package]] name = "notify" -version = "8.2.2" +version = "8.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c41a04a5f59df9322cc657286dd2d79f90816119b22c5f847607c850110205ab" +checksum = "4d3d07927151ff8575b7087f245456e549fea62edf0ec4e565a5ee50c8402bc3" dependencies = [ "bitflags 2.13.2", + "fsevent-sys", "inotify", "kqueue", "libc", "log", "mio", "notify-types", - "objc2-core-foundation", - "objc2-core-services", "walkdir", + "windows-sys 0.60.2", +] + +[[package]] +name = "notify-rust" +version = "4.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57da5b5d3b7809bf71858da5a2818c3404ca4688c02c8abecdda0fcdec235df3" +dependencies = [ + "futures-lite", + "log", + "mac-notification-sys", + "serde", + "tauri-winrt-notification", + "zbus 6.3.0", +] + +[[package]] +name = "notify-types" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42b8cfee0e339a0337359f3c88165702ac6e600dc01c0cc9579a92d62b08477a" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "ntapi" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3b335231dfd352ffb0f8017f3b6027a4917f7df785ea2143d8af2adc66980ae" +dependencies = [ + "winapi", +] + +[[package]] +name = "nu-ansi-term" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" +dependencies = [ "windows-sys 0.61.2", ] [[package]] -name = "notify-rust" -version = "4.19.0" +name = "num" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" +dependencies = [ + "num-bigint", + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-bigint-dig" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7f9a86e097b0d187ad0e65667c2f58b9254671e86e7dbb78036b16692eae099" +dependencies = [ + "libm", + "num-integer", + "num-iter", + "num-traits", + "once_cell", + "rand 0.9.5", + "serde", + "smallvec", + "zeroize", +] + +[[package]] +name = "num-complex" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" +dependencies = [ + "bytemuck", + "num-traits", +] + +[[package]] +name = "num-conv" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" + +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "num-integer" +version = "0.1.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57da5b5d3b7809bf71858da5a2818c3404ca4688c02c8abecdda0fcdec235df3" +checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b" dependencies = [ - "futures-lite", - "log", - "mac-notification-sys", - "serde", - "tauri-winrt-notification", - "zbus 6.2.1", + "num-traits", ] [[package]] -name = "notify-types" -version = "2.2.0" +name = "num-iter" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a437a9308232ce794b1e7fdf540d38ea37efc3c73492640c13b4c8568b8f108" +checksum = "c92800bd69a1eac91786bcfe9da64a897eb72911b8dc3095decbd07429e8048b" dependencies = [ - "bitflags 2.13.2", + "num-integer", + "num-traits", ] [[package]] -name = "num-conv" -version = "0.2.2" +name = "num-rational" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" +dependencies = [ + "num-bigint", + "num-integer", + "num-traits", +] [[package]] name = "num-traits" @@ -2151,25 +4451,34 @@ dependencies = [ ] [[package]] -name = "num_enum" -version = "0.7.6" +name = "num_cpus" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26" +checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b" dependencies = [ - "num_enum_derive", - "rustversion", + "hermit-abi", + "libc", ] [[package]] -name = "num_enum_derive" -version = "0.7.6" +name = "objc" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8" +checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.119", + "malloc_buf", + "objc_exception", +] + +[[package]] +name = "objc-foundation" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9" +dependencies = [ + "block", + "objc", + "objc_id", ] [[package]] @@ -2190,9 +4499,9 @@ dependencies = [ [[package]] name = "objc2" -version = "0.6.5" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08849bbd4767dfae9457696856ae1c84fe4e0281bbe4a7abff2d0e06fb7981f8" +checksum = "3a12a8ed07aefc768292f076dc3ac8c48f3781c8f2d5851dd3d98950e8c5a89f" dependencies = [ "objc2-encode", ] @@ -2222,8 +4531,8 @@ dependencies = [ "bitflags 2.13.2", "block2 0.6.2", "libc", - "objc2 0.6.5", - "objc2-cloud-kit 0.3.2", + "objc2 0.6.4", + "objc2-cloud-kit", "objc2-core-data 0.3.2", "objc2-core-foundation", "objc2-core-graphics", @@ -2234,34 +4543,6 @@ dependencies = [ "objc2-quartz-core 0.3.2", ] -[[package]] -name = "objc2-av-foundation" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478ae33fcac9df0a18db8302387c666b8ef08a3e2d62b510ca4fc278a384b6c0" -dependencies = [ - "bitflags 2.13.2", - "objc2 0.6.5", - "objc2-core-foundation", - "objc2-core-graphics", - "objc2-core-media", - "objc2-core-video", - "objc2-foundation 0.3.2", -] - -[[package]] -name = "objc2-cloud-kit" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009" -dependencies = [ - "bitflags 2.13.2", - "block2 0.5.1", - "objc2 0.5.3", - "objc2-core-location", - "objc2-foundation 0.2.2", -] - [[package]] name = "objc2-cloud-kit" version = "0.3.2" @@ -2269,21 +4550,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73ad74d880bb43877038da939b7427bba67e9dd42004a18b809ba7d87cee241c" dependencies = [ "bitflags 2.13.2", - "objc2 0.6.5", + "objc2 0.6.4", "objc2-foundation 0.3.2", ] -[[package]] -name = "objc2-contacts" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889" -dependencies = [ - "block2 0.5.1", - "objc2 0.5.3", - "objc2-foundation 0.2.2", -] - [[package]] name = "objc2-core-audio" version = "0.3.2" @@ -2291,7 +4561,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1eebcea8b0dbff5f7c8504f3107c68fc061a3eb44932051c8cf8a68d969c3b2" dependencies = [ "dispatch2", - "objc2 0.6.5", + "objc2 0.6.4", "objc2-core-audio-types", "objc2-core-foundation", ] @@ -2303,7 +4573,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a89f2ec274a0cf4a32642b2991e8b351a404d290da87bb6a9a9d8632490bd1c" dependencies = [ "bitflags 2.13.2", - "objc2 0.6.5", + "objc2 0.6.4", ] [[package]] @@ -2325,7 +4595,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b402a653efbb5e82ce4df10683b6b28027616a2715e90009947d50b8dd298fa" dependencies = [ "bitflags 2.13.2", - "objc2 0.6.5", + "objc2 0.6.4", "objc2-foundation 0.3.2", ] @@ -2336,10 +4606,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" dependencies = [ "bitflags 2.13.2", - "block2 0.6.2", "dispatch2", - "libc", - "objc2 0.6.5", + "objc2 0.6.4", ] [[package]] @@ -2350,7 +4618,7 @@ checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" dependencies = [ "bitflags 2.13.2", "dispatch2", - "objc2 0.6.5", + "objc2 0.6.4", "objc2-core-foundation", "objc2-io-surface", ] @@ -2373,20 +4641,18 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5d563b38d2b97209f8e861173de434bd0214cf020e3423a52624cd1d989f006" dependencies = [ - "objc2 0.6.5", + "objc2 0.6.4", "objc2-foundation 0.3.2", ] [[package]] name = "objc2-core-location" -version = "0.2.2" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781" +checksum = "ca347214e24bc973fc025fd0d36ebb179ff30536ed1f80252706db19ee452009" dependencies = [ - "block2 0.5.1", - "objc2 0.5.3", - "objc2-contacts", - "objc2-foundation 0.2.2", + "objc2 0.6.4", + "objc2-foundation 0.3.2", ] [[package]] @@ -2397,23 +4663,13 @@ checksum = "05ec576860167a15dd9fce7fbee7512beb4e31f532159d3482d1f9c6caedf31d" dependencies = [ "bitflags 2.13.2", "dispatch2", - "objc2 0.6.5", + "objc2 0.6.4", "objc2-core-audio", "objc2-core-audio-types", "objc2-core-foundation", "objc2-core-video", ] -[[package]] -name = "objc2-core-services" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583300ad934cba24ff5292aee751ecc070f7ca6b39a574cc21b7b5e588e06a0b" -dependencies = [ - "libc", - "objc2-core-foundation", -] - [[package]] name = "objc2-core-text" version = "0.3.2" @@ -2421,7 +4677,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0cde0dfb48d25d2b4862161a4d5fcc0e3c24367869ad306b0c9ec0073bfed92d" dependencies = [ "bitflags 2.13.2", - "objc2 0.6.5", + "objc2 0.6.4", "objc2-core-foundation", "objc2-core-graphics", ] @@ -2433,12 +4689,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d425caf1df73233f29fd8a5c3e5edbc30d2d4307870f802d18f00d83dc5141a6" dependencies = [ "bitflags 2.13.2", - "block2 0.6.2", - "objc2 0.6.5", + "objc2 0.6.4", "objc2-core-foundation", "objc2-core-graphics", "objc2-io-surface", - "objc2-metal 0.3.2", ] [[package]] @@ -2455,7 +4709,6 @@ checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8" dependencies = [ "bitflags 2.13.2", "block2 0.5.1", - "dispatch", "libc", "objc2 0.5.3", ] @@ -2469,7 +4722,7 @@ dependencies = [ "bitflags 2.13.2", "block2 0.6.2", "libc", - "objc2 0.6.5", + "objc2 0.6.4", "objc2-core-foundation", ] @@ -2480,22 +4733,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d" dependencies = [ "bitflags 2.13.2", - "libc", - "objc2 0.6.5", + "objc2 0.6.4", "objc2-core-foundation", - "objc2-foundation 0.3.2", -] - -[[package]] -name = "objc2-link-presentation" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398" -dependencies = [ - "block2 0.5.1", - "objc2 0.5.3", - "objc2-app-kit 0.2.2", - "objc2-foundation 0.2.2", ] [[package]] @@ -2518,9 +4757,7 @@ checksum = "a0125f776a10d00af4152d74616409f0d4a2053a6f57fa5b7d6aa2854ac04794" dependencies = [ "bitflags 2.13.2", "block2 0.6.2", - "dispatch2", - "objc2 0.6.5", - "objc2-core-foundation", + "objc2 0.6.4", "objc2-foundation 0.3.2", ] @@ -2544,96 +4781,129 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f" dependencies = [ "bitflags 2.13.2", - "objc2 0.6.5", + "objc2 0.6.4", "objc2-core-foundation", - "objc2-core-graphics", "objc2-foundation 0.3.2", "objc2-metal 0.3.2", ] [[package]] -name = "objc2-symbols" -version = "0.2.2" +name = "objc2-screen-capture-kit" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a684efe3dec1b305badae1a28f6555f6ddd3bb2c2267896782858d5a78404dc" +checksum = "74b7c5390f477482f001bc354d6571a70db7e4f8d5288e860c45521fbce11394" dependencies = [ - "objc2 0.5.3", - "objc2-foundation 0.2.2", + "block2 0.6.2", + "dispatch2", + "objc2 0.6.4", + "objc2-core-graphics", + "objc2-core-media", + "objc2-foundation 0.3.2", ] [[package]] -name = "objc2-ui-kit" -version = "0.2.2" +name = "objc2-user-notifications" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f" +checksum = "9df9128cbbfef73cda168416ccf7f837b62737d748333bfe9ab71c245d76613e" dependencies = [ "bitflags 2.13.2", - "block2 0.5.1", - "objc2 0.5.3", - "objc2-cloud-kit 0.2.2", - "objc2-core-data 0.2.2", - "objc2-core-image 0.2.2", + "block2 0.6.2", + "objc2 0.6.4", "objc2-core-location", - "objc2-foundation 0.2.2", - "objc2-link-presentation", - "objc2-quartz-core 0.2.2", - "objc2-symbols", - "objc2-uniform-type-identifiers", - "objc2-user-notifications", + "objc2-foundation 0.3.2", ] [[package]] -name = "objc2-uniform-type-identifiers" -version = "0.2.2" +name = "objc_exception" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe" +checksum = "ad970fb455818ad6cba4c122ad012fae53ae8b4795f86378bce65e4f6bab2ca4" dependencies = [ - "block2 0.5.1", - "objc2 0.5.3", - "objc2-foundation 0.2.2", + "cc", ] [[package]] -name = "objc2-user-notifications" -version = "0.2.2" +name = "objc_id" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3" +checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b" dependencies = [ - "bitflags 2.13.2", - "block2 0.5.1", - "objc2 0.5.3", - "objc2-core-location", - "objc2-foundation 0.2.2", + "objc", ] [[package]] -name = "once_cell" -version = "1.21.4" +name = "object" +version = "0.37.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" +dependencies = [ + "memchr", +] [[package]] -name = "option-ext" -version = "0.2.0" +name = "once_cell" +version = "1.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" [[package]] -name = "opuscule" -version = "0.2.2" +name = "oo7" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418827b94acaa183462024021324b6e733086466375604eb60e584c7acd4462c" +checksum = "78f2bfed90f1618b4b48dcad9307f25e14ae894e2949642c87c351601d62cebd" +dependencies = [ + "aes", + "ashpd", + "async-fs", + "async-io", + "async-lock", + "blocking", + "cbc", + "cipher", + "digest 0.10.7", + "endi", + "futures-lite", + "futures-util", + "getrandom 0.4.3", + "hkdf", + "hmac", + "md-5", + "num", + "num-bigint-dig", + "pbkdf2", + "serde", + "serde_bytes", + "sha2 0.10.9", + "subtle", + "zbus 5.19.0", + "zbus_macros 5.19.0", + "zeroize", + "zvariant", +] [[package]] -name = "orbclient" -version = "0.3.55" +name = "open" +version = "5.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5df339f526ea9a60e371768d50efc2f2508c7203290731565d1f7a6f71d21747" +checksum = "aa576c76302b7b808eecc68061e67336c47833ef9d22caa74dda10fa9675eebc" dependencies = [ + "is-wsl", "libc", - "libredox", ] +[[package]] +name = "openssl-probe" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" + +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + [[package]] name = "ordered-float" version = "5.5.0" @@ -2653,16 +4923,6 @@ dependencies = [ "pin-project-lite", ] -[[package]] -name = "os_pipe" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967" -dependencies = [ - "libc", - "windows-sys 0.61.2", -] - [[package]] name = "parking" version = "2.2.1" @@ -2687,65 +4947,50 @@ checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.5.18", + "redox_syscall", "smallvec", - "windows-link", + "windows-link 0.2.1", ] [[package]] -name = "parlance" -version = "0.1.1" +name = "paste" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73072a9470554c8e794778acece2312661218aaabb635600957d952cf01c716e" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] -name = "parley" -version = "0.12.0" +name = "pastey" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61bd0c0c1737f0b3d3726dc06b225083af213b61913e4fbae1670613a106c6ce" -dependencies = [ - "fontique", - "hashbrown 0.17.1", - "linebender_resource_handle", - "parlance", - "parley_engine", - "smallvec", -] +checksum = "35fb2e5f958ec131621fdd531e9fc186ed768cbe395337403ae56c17a74c68ec" [[package]] -name = "parley_data" -version = "0.12.0" +name = "pathfinder_geometry" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c43b63f808f6cc8f4a3b07de0d62a977bddd2e0bb5c232bd9e93ba8ef92e5e4b" +checksum = "0b7b7e7b4ea703700ce73ebf128e1450eb69c3a8329199ffbfb9b2a0418e5ad3" dependencies = [ - "icu_collections", - "icu_properties", + "log", + "pathfinder_simd", ] [[package]] -name = "parley_emoji" -version = "0.12.0" +name = "pathfinder_simd" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c4482d912d7671a7cd2089794f90ef3bb5f5f8c738230fb0fcd50fa020f0ed3" +checksum = "4500030c302e4af1d423f36f3b958d1aecb6c04184356ed5a833bf6b60435777" +dependencies = [ + "rustc_version", +] [[package]] -name = "parley_engine" -version = "0.12.0" +name = "pbkdf2" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b74c0d373e462e504ad4436710a39f099e18e848e1ee711f70cd2dcd5a69b290" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" dependencies = [ - "fontique", - "harfrust", - "hashbrown 0.17.1", - "icu_locale_core", - "icu_normalizer", - "icu_properties", - "icu_segmenter", - "linebender_resource_handle", - "parlance", - "parley_data", - "parley_emoji", - "skrifa", + "digest 0.10.7", + "hmac", ] [[package]] @@ -2755,55 +5000,82 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] -name = "petgraph" -version = "0.8.3" +name = "phf" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455" +checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" dependencies = [ - "fixedbitset", - "hashbrown 0.15.5", - "indexmap", + "phf_shared 0.11.3", ] [[package]] name = "phf" -version = "0.14.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "010378780309880b08997fae13be7834dba947d36393bd372f2b1556deb2a2f6" +checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf" dependencies = [ "phf_macros", - "phf_shared", + "phf_shared 0.13.1", "serde", ] +[[package]] +name = "phf_codegen" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aef8048c789fa5e851558d709946d6d79a8ff88c0440c587967f8e94bfb1216a" +dependencies = [ + "phf_generator 0.11.3", + "phf_shared 0.11.3", +] + [[package]] name = "phf_generator" -version = "0.14.0" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" +dependencies = [ + "phf_shared 0.11.3", + "rand 0.8.8", +] + +[[package]] +name = "phf_generator" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aeb62e0959d5a1bebc965f4d15d9e2b7cea002b6b0f5ba8cde6cc26738467100" +checksum = "135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737" dependencies = [ "fastrand", - "phf_shared", + "phf_shared 0.13.1", ] [[package]] name = "phf_macros" -version = "0.14.0" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812f032b54b1e759ccd5f8b6677695d5268c588701effba24601f6932f8269ef" +dependencies = [ + "phf_generator 0.13.1", + "phf_shared 0.13.1", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "phf_shared" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fa8d0ca26d424d27630da600c6624696e7dec8bf7b3b492b383c5dc49e5e085" +checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" dependencies = [ - "phf_generator", - "phf_shared", - "proc-macro2", - "quote", - "syn 2.0.119", + "siphasher", ] [[package]] name = "phf_shared" -version = "0.14.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6fd9027e2d9319be6349febd1db4e8d02aa544921200c9b777720ac34a3aa89" +checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266" dependencies = [ "siphasher", ] @@ -2857,12 +5129,6 @@ version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548" -[[package]] -name = "plain" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" - [[package]] name = "png" version = "0.17.16" @@ -2899,15 +5165,30 @@ dependencies = [ "concurrent-queue", "hermit-abi", "pin-project-lite", - "rustix 1.1.5", + "rustix", "windows-sys 0.61.2", ] [[package]] name = "pollster" -version = "1.0.1" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5da3b0203fd7ee5720aa0b5e790b591aa5d3f41c3ed2c34a3a393382198af2f7" + +[[package]] +name = "pollster" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f3a9f18d041e6d0e102a0a46750538147e5e8992d3b4873aaafee2520b00ce3" + +[[package]] +name = "polycool" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc6355899e1c9462875b6757c79f3caa011a1fdae12bbb1a2e72dd1f234f8336" +checksum = "50596ddc09eb5ad5f75cacd40209568e66df71baf86e1499a0e99c4cff12a5a6" +dependencies = [ + "arrayvec", +] [[package]] name = "portable-atomic" @@ -2924,14 +5205,29 @@ dependencies = [ "portable-atomic", ] +[[package]] +name = "postage" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af3fb618632874fb76937c2361a7f22afd393c982a2165595407edc75b06d3c1" +dependencies = [ + "atomic", + "crossbeam-queue", + "futures", + "log", + "parking_lot", + "pin-project", + "pollster 0.2.5", + "static_assertions", + "thiserror 1.0.69", +] + [[package]] name = "potential_utf" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" dependencies = [ - "serde_core", - "writeable", "zerovec", ] @@ -2941,19 +5237,44 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a6394b9e965e73d0a289ee54f589087e2c676aedf60885baf52c76b771e4958" +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + [[package]] name = "presser" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa" +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn 2.0.119", +] + [[package]] name = "proc-macro-crate" version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" dependencies = [ - "toml_edit", + "toml_edit 0.25.15+spec-1.1.0", ] [[package]] @@ -2970,24 +5291,97 @@ name = "profiling" version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d595e54a326bc53c1c197b32d295e14b169e3cfeaa8dc82b529f947fba6bcf5" +dependencies = [ + "profiling-procmacros", +] + +[[package]] +name = "profiling-procmacros" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4488a4a36b9a4ba6b9334a32a39971f77c1436ec82c38707bce707699cc3bbcb" +dependencies = [ + "quote", + "syn 2.0.119", +] [[package]] -name = "pulldown-cmark" -version = "0.13.6" +name = "proptest" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3db2be46835f013dd3f4fa7f5f7402c537787b54ebb6fe2b94bbdd7e2669bb7b" +checksum = "b8530004ccb15eae51c7e40009fbe317f341f804db54dc033eec1c50be28cfa0" dependencies = [ + "bit-set 0.11.1", + "bit-vec 0.10.1", "bitflags 2.13.2", - "memchr", - "unicase", + "chacha20", + "core_detect", + "num-traits", + "proptest-macro", + "rand 0.10.3", + "rand_xorshift", + "regex-syntax", + "rusty-fork", + "tempfile", + "unarray", +] + +[[package]] +name = "proptest-macro" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e99782ea31698c2206c6887c1220d2f594b291c26cb9ec5b6d7cf175320bc212" +dependencies = [ + "convert_case 0.11.0", + "proc-macro2", + "quote", + "syn 3.0.6", ] +[[package]] +name = "pulp" +version = "0.22.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046aa45b989642ec2e4717c8e72d677b13edd831a4d3b6cf37d9a3e54912496a" +dependencies = [ + "bytemuck", + "cfg-if", + "libm", + "num-complex", + "paste", + "pulp-wasm-simd-flag", + "raw-cpuid", + "reborrow", + "version_check", +] + +[[package]] +name = "pulp-wasm-simd-flag" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d8f70e07b9c3962945a74e59ca1c511bba65b6419468acc217c457d93f3c740" + [[package]] name = "pxfm" version = "0.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d55d956fa96f5ec02be2e13af0e20391a5aa83d6a074e3ad368959d0fab299ea" +[[package]] +name = "qoi" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f6d64c71eb498fe9eae14ce4ec935c555749aef511cca85b5568910d6e48001" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + [[package]] name = "quick-error" version = "2.0.1" @@ -3003,6 +5397,62 @@ dependencies = [ "memchr", ] +[[package]] +name = "quinn" +version = "0.11.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4051e23e9185c255a7e33ef59cdbca87a22d359052eecd22fc6b901fb37d9d11" +dependencies = [ + "bytes", + "cfg_aliases", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash 2.1.3", + "rustls", + "socket2", + "thiserror 2.0.21", + "tokio", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-proto" +version = "0.11.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e750cca55fe4f0439a15d0bb529da9651e79993e8e72c61a899a36d462befbe" +dependencies = [ + "bytes", + "getrandom 0.4.3", + "lru-slab", + "rand 0.10.3", + "rand_pcg", + "ring", + "rustc-hash 2.1.3", + "rustls", + "rustls-pki-types", + "slab", + "thiserror 2.0.21", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af66907df18639dcf4db56ca65490cabc4b27a97dbadd96f2926cca73298f016" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.61.2", +] + [[package]] name = "quote" version = "1.0.47" @@ -3024,6 +5474,27 @@ version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" +[[package]] +name = "rand" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.5", +] + [[package]] name = "rand" version = "0.10.3" @@ -3032,7 +5503,45 @@ checksum = "65c9fb96cbc91e3478eaae79a69fcd3f1ae4ad052e471fe6732fff548984b4af" dependencies = [ "chacha20", "getrandom 0.4.3", - "rand_core", + "rand_core 0.10.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.17", +] + +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", ] [[package]] @@ -3041,12 +5550,95 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" +[[package]] +name = "rand_pcg" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caa0f4137e1c0a72f4c651489402276c8e8e1cf081f3b0ba156d2cbeef09e86a" +dependencies = [ + "rand_core 0.10.1", +] + +[[package]] +name = "rand_xorshift" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60aa6af80be32871323012e02e6e65f8a7cc7890931ae421d217ad8fe0df2ccf" +dependencies = [ + "rand_core 0.10.1", +] + [[package]] name = "range-alloc" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca45419789ae5a7899559e9512e58ca889e41f04f1f2445e9f4b290ceccd1d08" +[[package]] +name = "rangemap" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a611d15b50743feb4c76b7d03edcb0e64f399c26961e4efe6975bc398be6aa3d" + +[[package]] +name = "rav1e" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43b6dd56e85d9483277cde964fd1bdb0428de4fec5ebba7540995639a21cb32b" +dependencies = [ + "aligned-vec", + "arbitrary", + "arg_enum_proc_macro", + "arrayvec", + "av-scenechange", + "av1-grain", + "bitstream-io", + "built", + "cfg-if", + "interpolate_name", + "itertools 0.14.0", + "libc", + "libfuzzer-sys", + "log", + "maybe-rayon", + "new_debug_unreachable", + "noop_proc_macro", + "num-derive", + "num-traits", + "paste", + "profiling", + "rand 0.9.5", + "rand_chacha 0.9.0", + "simd_helpers", + "thiserror 2.0.21", + "v_frame", + "wasm-bindgen", +] + +[[package]] +name = "ravif" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e52310197d971b0f5be7fe6b57530dcd27beb35c1b013f29d66c1ad73fbbcc45" +dependencies = [ + "avif-serialize", + "imgref", + "loop9", + "quick-error 2.0.1", + "rav1e", + "rayon", + "rgb", +] + +[[package]] +name = "raw-cpuid" +version = "11.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "498cd0dc59d73224351ee52a95fee0f1a617a2eae0e7d9d720cc622c73a54186" +dependencies = [ + "bitflags 2.13.2", +] + [[package]] name = "raw-window-handle" version = "0.6.2" @@ -3059,12 +5651,43 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40d213455a5f1dc59214213c7330e074ddf8114c9a42411eb890c767357ce135" dependencies = [ - "objc2 0.6.5", + "objc2 0.6.4", "objc2-core-foundation", "objc2-foundation 0.3.2", "objc2-quartz-core 0.3.2", ] +[[package]] +name = "rayon" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "read-fonts" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b634fabf032fab15307ffd272149b622260f55974d9fad689292a5d33df02e5" +dependencies = [ + "bytemuck", + "core_maths", + "font-types 0.11.3", +] + [[package]] name = "read-fonts" version = "0.41.0" @@ -3072,18 +5695,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "046a7d674daf459825b32f5062056d6882db0d2f5a479fbd76ccfc870ac18709" dependencies = [ "bytemuck", - "font-types", + "font-types 0.12.6", "once_cell", ] [[package]] -name = "redox_syscall" -version = "0.4.1" +name = "reborrow" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" -dependencies = [ - "bitflags 1.3.2", -] +checksum = "03251193000f4bd3b042892be858ee50e8b3719f2b08e5833ac4353724632430" [[package]] name = "redox_syscall" @@ -3095,12 +5715,14 @@ dependencies = [ ] [[package]] -name = "redox_syscall" -version = "0.9.5" +name = "redox_users" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "580c875845b41ecb1564ad1ae4703044cef774145e3d7a94dc2b3fa7c97868fd" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ - "bitflags 2.13.2", + "getrandom 0.2.17", + "libredox", + "thiserror 1.0.69", ] [[package]] @@ -3113,6 +5735,26 @@ dependencies = [ "thiserror 2.0.21", ] +[[package]] +name = "ref-cast" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e440fb4e4b4147295338efb76001ab9e4efc0e5839df2c47fc5ac2381d365c3" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92ecd8964f8453721699a1ed72037b0db49ce2f5a5138486ee89bed6f67cdf3a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + [[package]] name = "regex" version = "1.13.1" @@ -3154,35 +5796,32 @@ version = "0.45.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8928798c0a55e03c9ca6c4c6846f76377427d2c1e1f7e6de3c06ae57942df43" dependencies = [ + "gif 0.13.3", + "image-webp", "log", "pico-args", "rgb", - "svgtypes", + "svgtypes 0.15.3", "tiny-skia", - "usvg", + "usvg 0.45.1", + "zune-jpeg 0.4.21", ] [[package]] -name = "rfd" -version = "0.17.2" +name = "resvg" +version = "0.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20dafead71c16a34e1ff357ddefc8afc11e7d51d6d2b9fbd07eaa48e3e540220" +checksum = "b563218631706d614e23059436526d005b50ab5f2d506b55a17eb65c5eb83419" dependencies = [ - "block2 0.6.2", - "dispatch2", - "js-sys", - "libc", + "gif 0.14.2", + "image-webp", "log", - "objc2 0.6.5", - "objc2-app-kit 0.3.2", - "objc2-core-foundation", - "objc2-foundation 0.3.2", - "percent-encoding", - "raw-window-handle", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "windows-sys 0.61.2", + "pico-args", + "rgb", + "svgtypes 0.16.1", + "tiny-skia", + "usvg 0.46.0", + "zune-jpeg 0.5.15", ] [[package]] @@ -3208,6 +5847,15 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "ropey" +version = "2.0.0-beta.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4045a00dc327d084a2bbf126976e14125b54f23bd30511d45b842eba76c52d74" +dependencies = [ + "str_indices", +] + [[package]] name = "roxmltree" version = "0.20.0" @@ -3224,113 +5872,88 @@ dependencies = [ ] [[package]] -name = "rune" -version = "0.0.1" -source = "git+https://github.com/anomalyco/rune?rev=a7f276c3630f85a06a0230295da4d2bd172d8d3b#a7f276c3630f85a06a0230295da4d2bd172d8d3b" +name = "rust-embed" +version = "8.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9e7760e252aaba7b09f4be00e36476cf585bdb68a53552ac954cdf504ab4bc9" dependencies = [ - "accesskit", - "accesskit_macos", - "accesskit_unix", - "accesskit_windows", - "arboard", - "blake3", - "block2 0.5.1", - "block2 0.6.2", - "bytemuck", - "console_error_panic_hook", - "fontique", - "futures-util", - "half", - "image", - "js-sys", - "libc", - "libloading", - "objc2 0.5.3", - "objc2 0.6.5", - "objc2-app-kit 0.2.2", - "objc2-av-foundation", - "objc2-core-foundation", - "objc2-core-graphics", - "objc2-core-media", - "objc2-core-video", - "objc2-foundation 0.2.2", - "objc2-foundation 0.3.2", - "objc2-io-surface", - "objc2-metal 0.3.2", - "objc2-quartz-core 0.3.2", - "opuscule", - "parking_lot", - "parley", - "png 0.18.1", - "pollster", - "portable-atomic", - "raw-window-handle", - "raw-window-metal", - "resvg", - "rfd", - "rune-motion", - "rune-staging", - "rune-taffy", - "rustc-demangle", - "rustc-hash 2.1.3", - "serde", - "serde_json", - "swash", - "symphonia", - "taffy", - "tokio", - "unicode-segmentation", - "wasm-bindgen", - "wasm-bindgen-futures", - "wayland-backend", - "wayland-client", - "wayland-protocols", - "wayland-protocols-wlr", - "web-sys", - "web-time", - "wgpu", - "wgpu-core", - "wgpu-hal", - "wgpu-naga-bridge", - "windows", - "windows-sys 0.59.0", - "winit", - "x11rb", - "xkbcommon", - "zbus 6.2.1", - "zeroize", + "rust-embed-impl", + "rust-embed-utils", + "walkdir", ] [[package]] -name = "rune-kit" -version = "0.0.1" -source = "git+https://github.com/anomalyco/rune?rev=a7f276c3630f85a06a0230295da4d2bd172d8d3b#a7f276c3630f85a06a0230295da4d2bd172d8d3b" +name = "rust-embed-impl" +version = "8.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bcfc4d6f53af43755f7a723e4b6b8794fcce052a178dd8c6c1dadc5f5343097" dependencies = [ - "pulldown-cmark", - "rune", - "rune-motion", - "unicode-segmentation", + "mime_guess", + "proc-macro2", + "quote", + "rust-embed-utils", + "shellexpand", + "syn 2.0.119", + "walkdir", ] [[package]] -name = "rune-motion" -version = "0.1.0" -source = "git+https://github.com/anomalyco/rune?rev=a7f276c3630f85a06a0230295da4d2bd172d8d3b#a7f276c3630f85a06a0230295da4d2bd172d8d3b" +name = "rust-embed-utils" +version = "8.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ffa149f6aa81b58a5b3011d01a857c4ed12c7a732d2c51947a4c7c692185f0" +dependencies = [ + "globset", + "sha2 0.11.0", + "walkdir", +] [[package]] -name = "rune-staging" -version = "0.0.1" -source = "git+https://github.com/anomalyco/rune?rev=a7f276c3630f85a06a0230295da4d2bd172d8d3b#a7f276c3630f85a06a0230295da4d2bd172d8d3b" +name = "rust-i18n" +version = "4.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8502e73e6461c738659455c5d2cf95bc132760a6f203c717e66ee72b78906d7f" dependencies = [ - "wgpu", + "globwalk", + "regex", + "rust-i18n-macro", + "rust-i18n-support", + "smallvec", ] [[package]] -name = "rune-taffy" -version = "0.0.1" -source = "git+https://github.com/anomalyco/rune?rev=a7f276c3630f85a06a0230295da4d2bd172d8d3b#a7f276c3630f85a06a0230295da4d2bd172d8d3b" +name = "rust-i18n-macro" +version = "4.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d54a28dd9d46108d56b9f0c85b220908844233e561c03087890325104f90f2c6" dependencies = [ - "taffy", + "glob", + "proc-macro2", + "quote", + "rust-i18n-support", + "serde", + "serde_json", + "syn 2.0.119", +] + +[[package]] +name = "rust-i18n-support" +version = "4.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e806c2a9701cbd6043992cd935c30cb1fdb128fa15e7b506f3b46f97045737c0" +dependencies = [ + "arc-swap", + "base62", + "foldhash 0.2.0", + "globwalk", + "itertools 0.11.0", + "normpath", + "serde", + "serde-saphyr", + "serde_json", + "siphasher", + "toml 0.8.23", + "triomphe", ] [[package]] @@ -3360,19 +5983,6 @@ dependencies = [ "semver", ] -[[package]] -name = "rustix" -version = "0.38.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" -dependencies = [ - "bitflags 2.13.2", - "errno", - "libc", - "linux-raw-sys 0.4.15", - "windows-sys 0.59.0", -] - [[package]] name = "rustix" version = "1.1.5" @@ -3382,7 +5992,7 @@ dependencies = [ "bitflags 2.13.2", "errno", "libc", - "linux-raw-sys 0.12.1", + "linux-raw-sys", "windows-sys 0.61.2", ] @@ -3394,7 +6004,7 @@ checksum = "1de16c7c59892b870a6336f185dc10943517f1327447096bbb7bb32cd85e2393" dependencies = [ "errno", "libc", - "rustix 1.1.5", + "rustix", ] [[package]] @@ -3412,12 +6022,34 @@ dependencies = [ "zeroize", ] +[[package]] +name = "rustls-native-certs" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dab5152771c58876a2146916e53e35057e1a4dfa2b9df0f0305b07f611fdea4d" +dependencies = [ + "openssl-probe", + "rustls-pki-types", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pemfile" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "rustls-pki-types" version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96" dependencies = [ + "web-time", "zeroize", ] @@ -3438,6 +6070,42 @@ version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" +[[package]] +name = "rusty-fork" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc6bf79ff24e648f6da1f8d1f011e9cac26491b619e6b9280f2b47f1774e6ee2" +dependencies = [ + "fnv", + "quick-error 1.2.3", + "tempfile", + "wait-timeout", +] + +[[package]] +name = "rustybuzz" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3c7c96f8a08ee34eff8857b11b49b07d71d1c3f4e88f8a88d4c9e9f90b1702" +dependencies = [ + "bitflags 2.13.2", + "bytemuck", + "core_maths", + "log", + "smallvec", + "ttf-parser", + "unicode-bidi-mirroring", + "unicode-ccc", + "unicode-properties", + "unicode-script", +] + +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + [[package]] name = "same-file" version = "1.0.6" @@ -3447,6 +6115,41 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "schannel" +version = "0.1.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91c1b7e4904c873ef0710c1f407dde2e6287de2bebc1bbbf7d430bb7cbffd939" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "schemars" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "687274d293b6cdc6e73e0fee520bf2049650090d7164f87672d212a3c530cf4a" +dependencies = [ + "dyn-clone", + "indexmap", + "ref-cast", + "schemars_derive", + "serde", + "serde_json", +] + +[[package]] +name = "schemars_derive" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d98c67716b46af2f0b8cf752abc930f6f9aecfbf671ecfb531db8a31dbe4e2ba" +dependencies = [ + "proc-macro2", + "quote", + "serde_derive_internals", + "syn 3.0.6", +] + [[package]] name = "scoped-tls" version = "1.0.1" @@ -3460,30 +6163,108 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] -name = "sctk-adwaita" -version = "0.10.1" +name = "screencapturekit" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6277f0217056f77f1d8f49f2950ac6c278c0d607c45f5ee99328d792ede24ec" +checksum = "1a5eeeb57ac94960cfe5ff4c402be6585ae4c8d29a2cf41b276048c2e849d64e" dependencies = [ - "log", - "smithay-client-toolkit", - "tiny-skia", + "screencapturekit-sys", +] + +[[package]] +name = "screencapturekit-sys" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22411b57f7d49e7fe08025198813ee6fd65e1ee5eff4ebc7880c12c82bde4c60" +dependencies = [ + "block", + "dispatch", + "objc", + "objc-foundation", + "objc_id", + "once_cell", +] + +[[package]] +name = "seahash" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" + +[[package]] +name = "security-framework" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" +dependencies = [ + "bitflags 2.13.2", + "core-foundation 0.10.0", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "self_cell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ab42ca02749e120097e328d91d415325bdf43b1c72c4c8badf37375fe40a813" + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" +dependencies = [ + "serde", + "serde_core", +] + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", ] [[package]] -name = "semver" -version = "1.0.28" +name = "serde-saphyr" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" +checksum = "b8050abb251097357e24aff63ba2c52a6309ecb7d23a5474023df960a02694d8" +dependencies = [ + "annotate-snippets", + "base64 0.23.1", + "encoding_rs_io", + "granit-parser", + "nohash-hasher", + "num-traits", + "serde_core", + "smallvec", + "zmij", +] [[package]] -name = "serde" -version = "1.0.229" +name = "serde_bytes" +version = "0.11.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" dependencies = [ + "serde", "serde_core", - "serde_derive", ] [[package]] @@ -3506,6 +6287,26 @@ dependencies = [ "syn 3.0.6", ] +[[package]] +name = "serde_derive_internals" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f852137cce035d6a4df67ccce505ff6b3e9fd3a10e3e52b24dc71e650bb1a9bd" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "serde_fmt" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e497af288b3b95d067a23a4f749f2861121ffcb2f6d8379310dcda040c345ed" +dependencies = [ + "serde_core", +] + [[package]] name = "serde_json" version = "1.0.151" @@ -3531,6 +6332,15 @@ dependencies = [ "syn 3.0.6", ] +[[package]] +name = "serde_spanned" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +dependencies = [ + "serde", +] + [[package]] name = "serde_spanned" version = "1.1.1" @@ -3540,6 +6350,18 @@ dependencies = [ "serde_core", ] +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + [[package]] name = "sha1" version = "0.11.0" @@ -3547,8 +6369,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aacc4cc499359472b4abe1bf11d0b12e688af9a805fa5e3016f9a386dc2d0214" dependencies = [ "cfg-if", - "cpufeatures", - "digest", + "cpufeatures 0.3.1", + "digest 0.11.3", +] + +[[package]] +name = "sha1_smol" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbfa15b3dddfee50a0fff136974b3e1bde555604ba463834a7eb7deb6417705d" + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures 0.2.17", + "digest 0.10.7", ] [[package]] @@ -3558,10 +6397,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "446ba717509524cb3f22f17ecc096f10f4822d76ab5c0b9822c5f9c284e825f4" dependencies = [ "cfg-if", - "cpufeatures", - "digest", + "cpufeatures 0.3.1", + "digest 0.11.3", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shellexpand" +version = "3.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32824fab5e16e6c4d86dc1ba84489390419a39f97699852b66480bb87d297ed8" +dependencies = [ + "dirs", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "shlex" version = "2.0.1" @@ -3595,13 +6458,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea" [[package]] -name = "simd_cesu8" -version = "1.2.0" +name = "simd_helpers" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11031e251abf8611c80f460e19dbdeb54a66db918e49c65a7065b46ac7aec520" +checksum = "95890f873bec569a0362c235787f3aca6e1e887302ba4840839bcc6459c42da6" dependencies = [ - "rustc_version", - "simdutf8", + "quote", ] [[package]] @@ -3625,6 +6487,16 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33f4fe9184a62d842c9ef383018f3306d8ba224fd9d836f56d7288308847c256" +[[package]] +name = "skrifa" +version = "0.40.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fbdfe3d2475fbd7ddd1f3e5cf8288a30eb3e5f95832829570cd88115a7434ac" +dependencies = [ + "bytemuck", + "read-fonts 0.37.0", +] + [[package]] name = "skrifa" version = "0.44.0" @@ -3632,7 +6504,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "819ab7d62b1d3e72d9d9dea5650bac30424f9111364bb94928dbf5ecad1baa68" dependencies = [ "bytemuck", - "read-fonts", + "read-fonts 0.41.0", ] [[package]] @@ -3657,37 +6529,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9395f0f0eee849a9b707b2f06bb92a6a422090e2123bb2ef8e87a0e61892a8e" [[package]] -name = "smithay-client-toolkit" -version = "0.19.2" +name = "smol" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016" +checksum = "a33bd3e260892199c3ccfc487c88b2da2265080acb316cd920da72fdfd7c599f" dependencies = [ - "bitflags 2.13.2", - "calloop", - "calloop-wayland-source", - "cursor-icon", - "libc", - "log", - "memmap2", - "rustix 0.38.44", - "thiserror 1.0.69", - "wayland-backend", - "wayland-client", - "wayland-csd-frame", - "wayland-cursor", - "wayland-protocols", - "wayland-protocols-wlr", - "wayland-scanner", - "xkeysym", + "async-channel", + "async-executor", + "async-fs", + "async-io", + "async-lock", + "async-net", + "async-process", + "blocking", + "futures-lite", ] [[package]] name = "smol_str" -version = "0.2.2" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd538fb6910ac1099850255cf94a94df6551fbdd602454387d0adb2d1ca6dead" +checksum = "4aaa7368fcf4852a4c2dd92df0cace6a71f2091ca0a23391ce7f3a31833f1523" dependencies = [ - "serde", + "serde_core", ] [[package]] @@ -3700,6 +6564,24 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "spin" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3763264f6b73151db08c50ff20d7d8a0b8796e021cdea7ceedad07b80155fa0e" +dependencies = [ + "lock_api", +] + +[[package]] +name = "spin" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "023a211cb3138dbc438680b32560ad89f699977624c9f8dbb95a47d5b4c07dd3" +dependencies = [ + "lock_api", +] + [[package]] name = "spirv" version = "0.4.0+sdk-1.4.341.0" @@ -3721,6 +6603,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "str_indices" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d08889ec5408683408db66ad89e0e1f93dff55c73a4ccc71c427d5b277ee47e6" + [[package]] name = "streaming-iterator" version = "0.1.9" @@ -3736,6 +6624,52 @@ dependencies = [ "float-cmp", ] +[[package]] +name = "string_cache" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf776ba3fa74f83bf4b63c3dcbbf82173db2632ed8452cb2d891d33f459de70f" +dependencies = [ + "new_debug_unreachable", + "parking_lot", + "phf_shared 0.11.3", + "precomputed-hash", + "serde", +] + +[[package]] +name = "string_cache_codegen" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c711928715f1fe0fe509c53b43e993a9a557babc2d0a3567d0a3006f1ac931a0" +dependencies = [ + "phf_generator 0.11.3", + "phf_shared 0.11.3", + "proc-macro2", + "quote", +] + +[[package]] +name = "strum" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9628de9b8791db39ceda2b119bbe13134770b56c138ec1d3af810d045c04f9bd" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab85eea0270ee17587ed4156089e10b9e6880ee688791d45a905f5b1ca36f664" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "subtle" version = "2.6.1" @@ -3743,155 +6677,231 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] -name = "svgtypes" -version = "0.15.3" +name = "sval" +version = "2.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68c7541fff44b35860c1a7a47a7cadf3e4a304c457b58f9870d9706ece028afc" +checksum = "b81b254da21fe1fcc4e3a74fe39b46e25e3a863078f8b71c954d47f84889dbc6" + +[[package]] +name = "sval_buffer" +version = "2.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50be352d2822ffafb59e3e2ddac9d5ee60f2eeadbb7b5a2a951b9f3651e87a6f" dependencies = [ - "kurbo", - "siphasher", + "sval", + "sval_ref", + "zerocopy", ] [[package]] -name = "swash" -version = "0.2.10" +name = "sval_dynamic" +version = "2.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c2499c2d826531388872b2268718aed907a39bd785ab0dcfe57fab26283f92e" +checksum = "b048ca293b998d9a45659159f94a64063791e74cdc670164943dbb434405573d" dependencies = [ - "skrifa", - "yazi", - "zeno", + "sval", ] [[package]] -name = "symphonia" -version = "0.5.5" +name = "sval_fmt" +version = "2.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5773a4c030a19d9bfaa090f49746ff35c75dfddfa700df7a5939d5e076a57039" +checksum = "e6b5888e40f80568733217f27b7317b845f463400ced36c424b1a804730e53b2" dependencies = [ - "lazy_static", - "symphonia-codec-vorbis", - "symphonia-core", - "symphonia-format-mkv", - "symphonia-format-ogg", - "symphonia-metadata", + "itoa", + "ryu", + "sval", ] [[package]] -name = "symphonia-codec-vorbis" -version = "0.5.5" +name = "sval_json" +version = "2.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f025837c309cd69ffef572750b4a2257b59552c5399a5e49707cc5b1b85d1c73" +checksum = "e17664d6bb6b74947afaab9d7c991caa9bf5638d4dee16fcbef637f440796049" dependencies = [ - "log", - "symphonia-core", - "symphonia-utils-xiph", + "itoa", + "ryu", + "sval", ] [[package]] -name = "symphonia-core" -version = "0.5.5" +name = "sval_nested" +version = "2.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea00cc4f79b7f6bb7ff87eddc065a1066f3a43fe1875979056672c9ef948c2af" +checksum = "07c059969ca5ca163ea7fef6c9661758973d17691aba92abdcf5c428f4ec122c" dependencies = [ - "arrayvec", - "bitflags 1.3.2", - "bytemuck", - "lazy_static", - "log", + "sval", + "sval_buffer", + "sval_ref", ] [[package]] -name = "symphonia-format-mkv" -version = "0.5.5" +name = "sval_ref" +version = "2.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "122d786d2c43a49beb6f397551b4a050d8229eaa54c7ddf9ee4b98899b8742d0" +checksum = "42d6b29ff568c85c87561807f51d2adfff4b6016c6363133f7cd1652a12548f3" dependencies = [ - "lazy_static", - "log", - "symphonia-core", - "symphonia-metadata", - "symphonia-utils-xiph", + "sval", ] [[package]] -name = "symphonia-format-ogg" -version = "0.5.5" +name = "sval_serde" +version = "2.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b4955c67c1ed3aa8ae8428d04ca8397fbef6a19b2b051e73b5da8b1435639cb" +checksum = "8f33ec9edc42b12764d5c90ca0a1d84189c6bde81ed27507f1e661c6e4e05853" dependencies = [ - "log", - "symphonia-core", - "symphonia-metadata", - "symphonia-utils-xiph", + "serde_core", + "sval", + "sval_nested", ] [[package]] -name = "symphonia-metadata" -version = "0.5.5" +name = "svg_fmt" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0193cc4331cfd2f3d2011ef287590868599a2f33c3e69bc22c1a3d3acf9e02fb" + +[[package]] +name = "svgtypes" +version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36306ff42b9ffe6e5afc99d49e121e0bd62fe79b9db7b9681d48e29fa19e6b16" +checksum = "68c7541fff44b35860c1a7a47a7cadf3e4a304c457b58f9870d9706ece028afc" dependencies = [ - "encoding_rs", - "lazy_static", - "log", - "symphonia-core", + "kurbo 0.11.3", + "siphasher", +] + +[[package]] +name = "svgtypes" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "695b5790b3131dafa99b3bbfd25a216edb3d216dad9ca208d4657bfb8f2abc3d" +dependencies = [ + "kurbo 0.13.1", + "siphasher", +] + +[[package]] +name = "swash" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c2499c2d826531388872b2268718aed907a39bd785ab0dcfe57fab26283f92e" +dependencies = [ + "skrifa 0.44.0", + "yazi", + "zeno", +] + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8593e8e72159ed2257d083c7a454a85cbf854f37a0966d8d483aff8c8a3ebcee" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", ] [[package]] -name = "symphonia-utils-xiph" -version = "0.5.5" +name = "sys-locale" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee27c85ab799a338446b68eec77abf42e1a6f1bb490656e121c6e27bfbab9f16" +checksum = "8eab9a99a024a169fe8a903cf9d4a3b3601109bcc13bd9e3c6fff259138626c4" dependencies = [ - "symphonia-core", - "symphonia-metadata", + "libc", ] [[package]] -name = "syn" -version = "2.0.119" +name = "sysinfo" +version = "0.31.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +checksum = "355dbe4f8799b304b05e1b0f05fc59b2a18d36645cf169607da45bde2f69a1be" dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", + "core-foundation-sys", + "libc", + "memchr", + "ntapi", + "rayon", + "windows 0.57.0", ] [[package]] -name = "syn" -version = "3.0.6" +name = "system-configuration" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8593e8e72159ed2257d083c7a454a85cbf854f37a0966d8d483aff8c8a3ebcee" +checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", + "bitflags 2.13.2", + "core-foundation 0.9.4", + "system-configuration-sys", ] [[package]] -name = "synstructure" -version = "0.14.0" +name = "system-configuration-sys" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.6", + "core-foundation-sys", + "libc", ] [[package]] name = "taffy" -version = "0.15.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f7bd2d97198df05186f93a3a3c306845f40e8b3c22bf9279cdd7e5cf5fea7d" +checksum = "c034e05f6ee85a12daa63863c2245797715075c70649947aa0da54f3f2ab1d0f" dependencies = [ + "arrayvec", "serde", "slotmap", "smallvec", ] +[[package]] +name = "tao-core-video-sys" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271450eb289cb4d8d0720c6ce70c72c8c858c93dd61fc625881616752e6b98f6" +dependencies = [ + "cfg-if", + "core-foundation-sys", + "libc", + "objc", +] + [[package]] name = "tauri-winrt-notification" version = "0.8.1" @@ -3899,7 +6909,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f37a6c354fd28fc9e322ed9bd47e3959576dad28c9d58ea1cf888cce1c7ccb36" dependencies = [ "thiserror 2.0.21", - "windows", + "windows 0.62.2", "windows-version", ] @@ -3912,10 +6922,21 @@ dependencies = [ "fastrand", "getrandom 0.4.3", "once_cell", - "rustix 1.1.5", + "rustix", "windows-sys 0.61.2", ] +[[package]] +name = "tendril" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d24a120c5fc464a3458240ee02c299ebcb9d67b5249c8848b09d639dca8d7bb0" +dependencies = [ + "futf", + "mac", + "utf-8", +] + [[package]] name = "termcolor" version = "1.4.1" @@ -3965,6 +6986,15 @@ dependencies = [ "syn 3.0.6", ] +[[package]] +name = "thread_local" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad99c4c6d32803332c548b1af0540b357b3f5fc0be8f6c6bfe8b2e6ae784070" +dependencies = [ + "cfg-if", +] + [[package]] name = "tiff" version = "0.11.3" @@ -3974,9 +7004,9 @@ dependencies = [ "fax", "flate2", "half", - "quick-error", + "quick-error 2.0.1", "weezl", - "zune-jpeg", + "zune-jpeg 0.5.15", ] [[package]] @@ -4009,6 +7039,15 @@ dependencies = [ "time-core", ] +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + [[package]] name = "tiny-skia" version = "0.11.4" @@ -4042,35 +7081,75 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1e27c91459209c2986af3dcf603a5a74a4368754ce37414f59acc971167f643" dependencies = [ "displaydoc", - "serde_core", "zerovec", ] +[[package]] +name = "tinyvec" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee" + [[package]] name = "tokio" -version = "1.54.1" +version = "1.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3" +checksum = "e95f91fcc7a621e8b030f6aa23c71fe9838ae2fb4d8118b75602a328f5144044" dependencies = [ "bytes", "libc", "mio", "pin-project-lite", - "signal-hook-registry", "socket2", - "tokio-macros", "windows-sys 0.61.2", ] [[package]] -name = "tokio-macros" -version = "2.7.2" +name = "tokio-rustls" +version = "0.26.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e" +checksum = "c9cc2678c2cdd569ef8215e2afd7954ada2ae20b4fdd2c5fe6139a3b02d105db" dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.6", + "rustls", + "tokio", +] + +[[package]] +name = "tokio-socks" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7e2948f60dbe26b35f2c7fb74ac2854c1fddded0fe9d7548fcc674a246f7615" +dependencies = [ + "either", + "futures-util", + "thiserror 1.0.69", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "494815d09bf52b5548659851081238f0ca39ff638363907596da739561c62c52" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "libc", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" +dependencies = [ + "serde", + "serde_spanned 0.6.9", + "toml_datetime 0.6.11", + "toml_edit 0.22.27", ] [[package]] @@ -4081,11 +7160,20 @@ checksum = "920602543f0911ab71da12c50d59701da54c196d1a2bf5cb4b75667f137a406a" dependencies = [ "indexmap", "serde_core", - "serde_spanned", - "toml_datetime", + "serde_spanned 1.1.1", + "toml_datetime 1.1.1+spec-1.1.0", "toml_parser", "toml_writer", - "winnow", + "winnow 1.0.4", +] + +[[package]] +name = "toml_datetime" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" +dependencies = [ + "serde", ] [[package]] @@ -4097,6 +7185,20 @@ dependencies = [ "serde_core", ] +[[package]] +name = "toml_edit" +version = "0.22.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" +dependencies = [ + "indexmap", + "serde", + "serde_spanned 0.6.9", + "toml_datetime 0.6.11", + "toml_write", + "winnow 0.7.15", +] + [[package]] name = "toml_edit" version = "0.25.15+spec-1.1.0" @@ -4104,9 +7206,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1340ea94a5856333492c9064b02c778b191dd2c853778d9609debdcdfea3a614" dependencies = [ "indexmap", - "toml_datetime", + "toml_datetime 1.1.1+spec-1.1.0", "toml_parser", - "winnow", + "winnow 1.0.4", ] [[package]] @@ -4115,21 +7217,55 @@ version = "1.1.3+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d38ac1cf9b95face32296c0a3ede1fdc270627c9d9c02a7274dd6d960dc4d56" dependencies = [ - "winnow", + "winnow 1.0.4", ] +[[package]] +name = "toml_write" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" + [[package]] name = "toml_writer" version = "1.1.2+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d56353a2a665ad0f41a421187180aab746c8c325620617ad883a99a1cbe66d2" +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + [[package]] name = "tracing" version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" dependencies = [ + "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -4153,6 +7289,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" dependencies = [ "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319" +dependencies = [ + "nu-ansi-term", + "sharded-slab", + "smallvec", + "thread_local", + "tracing-core", + "tracing-log", ] [[package]] @@ -4199,18 +7361,6 @@ dependencies = [ "tree-sitter-language", ] -[[package]] -name = "tree-sitter-highlight" -version = "0.26.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "662316ecd27166f79e18865429638c05194aee76a7bc374136d844f05d778f74" -dependencies = [ - "regex", - "streaming-iterator", - "thiserror 2.0.21", - "tree-sitter", -] - [[package]] name = "tree-sitter-html" version = "0.23.2" @@ -4298,14 +7448,29 @@ dependencies = [ ] [[package]] -name = "tree_magic_mini" -version = "3.2.2" +name = "triomphe" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8765b90061cba6c22b5831f675da109ae5561588290f9fa2317adab2714d5a6" +checksum = "b40688ea6389c8171614b25491f71d4a27946e0c7ce2da1c6de27e25abf1a0ae" dependencies = [ - "memchr", - "nom", - "petgraph", + "arc-swap", + "serde", + "stable_deref_trait", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "ttf-parser" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31" +dependencies = [ + "core_maths", ] [[package]] @@ -4314,6 +7479,12 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ce898823d8cd0f028662d2f349694b1af0a5cc9be83f1d213a00d3147445e1e" +[[package]] +name = "typeid" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c" + [[package]] name = "typenum" version = "1.20.1" @@ -4331,12 +7502,42 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + [[package]] name = "unicase" version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "357cc3acc6a036009fd6c973ed009037c732d60d0b4f6c673e9041497482a28f" +[[package]] +name = "unicode-bidi" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" + +[[package]] +name = "unicode-bidi-mirroring" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dfa6e8c60bb66d49db113e0125ee8711b7647b5579dc7f5f19c42357ed039fe" + +[[package]] +name = "unicode-ccc" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce61d488bcdc9bc8b5d1772c404828b17fc481c0a582b5581e95fb233aef503e" + +[[package]] +name = "unicode-id" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65dd75ab2d9d379dbe86d4059e91d8b5a6e7054865eaba1ddbfc7a817ff96392" + [[package]] name = "unicode-ident" version = "1.0.26" @@ -4349,18 +7550,42 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" +[[package]] +name = "unicode-properties" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7df058c713841ad818f1dc5d3fd88063241cc61f49f5fbea4b951e8cf5a8d71d" + +[[package]] +name = "unicode-script" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "383ad40bb927465ec0ce7720e033cb4ca06912855fc35db31b5755d0de75b1ee" + [[package]] name = "unicode-segmentation" version = "1.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" +[[package]] +name = "unicode-vo" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1d386ff53b415b7fe27b50bb44679e2cc4660272694b7b6f3326d8480823a94" + [[package]] name = "unicode-width" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + [[package]] name = "untrusted" version = "0.9.0" @@ -4417,19 +7642,57 @@ dependencies = [ "base64 0.22.1", "data-url", "flate2", - "imagesize", - "kurbo", + "fontdb", + "imagesize 0.13.0", + "kurbo 0.11.3", "log", "pico-args", "roxmltree 0.20.0", + "rustybuzz", + "simplecss", + "siphasher", + "strict-num", + "svgtypes 0.15.3", + "tiny-skia-path", + "unicode-bidi", + "unicode-script", + "unicode-vo", + "xmlwriter", +] + +[[package]] +name = "usvg" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e419dff010bb12512b0ae9e3d2f318dfbdf0167fde7eb05465134d4e8756076f" +dependencies = [ + "base64 0.22.1", + "data-url", + "flate2", + "fontdb", + "imagesize 0.14.0", + "kurbo 0.13.1", + "log", + "pico-args", + "roxmltree 0.21.1", + "rustybuzz", "simplecss", "siphasher", "strict-num", - "svgtypes", + "svgtypes 0.16.1", "tiny-skia-path", + "unicode-bidi", + "unicode-script", + "unicode-vo", "xmlwriter", ] +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + [[package]] name = "utf8-zero" version = "0.8.1" @@ -4450,11 +7713,65 @@ checksum = "97277d36b9c3ace13e58fa6e753f8b0bbbf302a18dd193240d70f9e29681059a" dependencies = [ "getrandom 0.4.3", "js-sys", - "rand", + "rand 0.10.3", "serde_core", + "sha1_smol", + "wasm-bindgen", +] + +[[package]] +name = "v_frame" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "666b7727c8875d6ab5db9533418d7c764233ac9c0cff1d469aec8fa127597be2" +dependencies = [ + "aligned-vec", + "num-traits", "wasm-bindgen", ] +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + +[[package]] +name = "value-bag" +version = "1.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2799ffb329a792ecfd902b71306c8a815a6ef1c0470fa9953a6aa4d4cecbe511" +dependencies = [ + "value-bag-serde1", + "value-bag-sval2", +] + +[[package]] +name = "value-bag-serde1" +version = "1.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0941feceafbe7a8f59ea1096d45b97002884a41306315ad797b3684b63a81d8c" +dependencies = [ + "erased-serde", + "serde_core", + "serde_fmt", +] + +[[package]] +name = "value-bag-sval2" +version = "1.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "839752af8179287d27eb2b94164641b1ede9e60ab7424163388dc21ebd0508cd" +dependencies = [ + "sval", + "sval_buffer", + "sval_dynamic", + "sval_fmt", + "sval_json", + "sval_ref", + "sval_serde", +] + [[package]] name = "vcpkg" version = "0.2.15" @@ -4474,20 +7791,20 @@ dependencies = [ "libc", "log", "normpath", - "rand", + "rand 0.10.3", "regex", "semver", "serde", "serde_json", "sha1", - "sha2", + "sha2 0.11.0", "thiserror 2.0.21", "ureq", "url", "uuid", "wait-timeout", "waitpid-any", - "windows", + "windows 0.62.2", "xml", "zip", ] @@ -4498,6 +7815,26 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +[[package]] +name = "vswhom" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be979b7f07507105799e854203b470ff7c78a1639e330a58f183b5fea574608b" +dependencies = [ + "libc", + "vswhom-sys", +] + +[[package]] +name = "vswhom-sys" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb067e4cbd1ff067d1df46c9194b5de0e98efd2810bbc95c5d5e5f25a3231150" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "vte" version = "0.15.0" @@ -4527,10 +7864,16 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "18aa3ce681e189f125c4c1e1388c03285e2fd434ef52c7203084012ac29c5e4a" dependencies = [ - "rustix 1.1.5", + "rustix", "windows-sys 0.59.0", ] +[[package]] +name = "waker-fn" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "317211a0dc0ceedd78fb2ca9a44aed3d7b9b26f81870d485c07122b4350673b7" + [[package]] name = "walkdir" version = "2.5.0" @@ -4541,6 +7884,15 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + [[package]] name = "wasi" version = "0.11.1+wasi-snapshot-preview1" @@ -4612,6 +7964,31 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "wasm-streams" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15053d8d85c7eccdbefef60f06769760a563c7f0a9d6902a13d35c7800b0ad65" +dependencies = [ + "futures-util", + "js-sys", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "wasm_thread" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7516db7f32decdadb1c3b8deb1b7d78b9df7606c5cc2f6241737c2ab3a0258e" +dependencies = [ + "futures", + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "wayland-backend" version = "0.3.17" @@ -4620,7 +7997,8 @@ checksum = "38a91b4eaddff87b1cd1074985e3713da4af2c49742d1b356b2c01670a67a078" dependencies = [ "cc", "downcast-rs", - "rustix 1.1.5", + "log", + "rustix", "scoped-tls", "smallvec", "wayland-sys", @@ -4633,29 +8011,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3c36a0f861ad76d0901f2800b46321410d9f73f2ea88aac0650d86c32688073" dependencies = [ "bitflags 2.13.2", - "rustix 1.1.5", + "rustix", "wayland-backend", "wayland-scanner", ] -[[package]] -name = "wayland-csd-frame" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e" -dependencies = [ - "bitflags 2.13.2", - "cursor-icon", - "wayland-backend", -] - [[package]] name = "wayland-cursor" version = "0.31.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a52d18780be9b1314328a3de5f930b73d2200112e3849ca6cb11822793fb34d" dependencies = [ - "rustix 1.1.5", + "rustix", "wayland-client", "xcursor", ] @@ -4758,9 +8125,9 @@ checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88" [[package]] name = "wgpu" -version = "30.0.1" +version = "29.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "527ccdf43dd5b2e8676eed9984ce00e2bbb0a1b85b70c1969dcb6cd2eb55ab9e" +checksum = "76e8840e1ba2881d4cbb18d2147627a56af426ff064c0401eb0c8410c6325d07" dependencies = [ "arrayvec", "bitflags 2.13.2", @@ -4768,7 +8135,7 @@ dependencies = [ "cfg-if", "cfg_aliases", "document-features", - "hashbrown 0.17.1", + "hashbrown 0.16.1", "js-sys", "log", "naga", @@ -4788,22 +8155,21 @@ dependencies = [ [[package]] name = "wgpu-core" -version = "30.0.1" +version = "29.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c018fce9b6270aa203c2fdd56f3cce996713534bd757e4ea58c8560b121f14" +checksum = "2f519832254e56965a9940c4af57dcb75f702b6f6fa4a0b172f685395843a4d7" dependencies = [ "arrayvec", - "bit-set", - "bit-vec", + "bit-set 0.9.1", + "bit-vec 0.9.1", "bitflags 2.13.2", "bytemuck", "cfg_aliases", "document-features", - "hashbrown 0.17.1", + "hashbrown 0.16.1", "indexmap", "log", "naga", - "naga-types", "once_cell", "parking_lot", "portable-atomic", @@ -4813,6 +8179,8 @@ dependencies = [ "smallvec", "thiserror 2.0.21", "wgpu-core-deps-apple", + "wgpu-core-deps-emscripten", + "wgpu-core-deps-wasm", "wgpu-core-deps-windows-linux-android", "wgpu-hal", "wgpu-naga-bridge", @@ -4821,47 +8189,69 @@ dependencies = [ [[package]] name = "wgpu-core-deps-apple" -version = "30.0.1" +version = "29.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5e39e26c4c0e07589e67d18546cf79ff45383659fc72fca4dd293358a0347f3" +dependencies = [ + "wgpu-hal", +] + +[[package]] +name = "wgpu-core-deps-emscripten" +version = "29.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01e09be551dc939498bdd5f6b2c66e55ab275dad25825267a08605a80fc9f0af" +dependencies = [ + "wgpu-hal", +] + +[[package]] +name = "wgpu-core-deps-wasm" +version = "29.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "061f3d319a40d39d00b1ecc2c33b89fe21d4e6fe01859df3500a3a8ecccd6b68" +checksum = "af1fb1798be2a912497d4c224f72d39bb0cb34af50e8bcc29865bc339c943059" dependencies = [ "wgpu-hal", ] [[package]] name = "wgpu-core-deps-windows-linux-android" -version = "30.0.1" +version = "29.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7586165fd5f6d881cb9ce4bb71f40d6caab2c0f1837e3fc1d9788a197fb6004f" +checksum = "4e592c1bbef6ad047647ae6e666ebd8cee7a32bb4544d9700ec96cbf73230257" dependencies = [ "wgpu-hal", ] [[package]] name = "wgpu-hal" -version = "30.0.1" +version = "29.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6b7fb58561a792bc237628ba0792e332de418fefe145f13b5ed8201e6d52f58" +checksum = "97ace1c17727311c22a46e4e3faf56ea6de81af99dcc839bdfb54857b94d448d" dependencies = [ "android_system_properties", "arrayvec", "ash", - "bit-set", + "bit-set 0.9.1", "bitflags 2.13.2", "block2 0.6.2", "bytemuck", "cfg-if", "cfg_aliases", + "glow", + "glutin_wgl_sys", "gpu-allocator", - "hashbrown 0.17.1", + "gpu-descriptor", + "hashbrown 0.16.1", + "js-sys", + "khronos-egl", "libc", "libloading", "log", "naga", - "naga-types", - "objc2 0.6.5", + "ndk-sys", + "objc2 0.6.4", "objc2-core-foundation", - "objc2-core-graphics", "objc2-foundation 0.3.2", "objc2-metal 0.3.2", "objc2-quartz-core 0.3.2", @@ -4876,19 +8266,22 @@ dependencies = [ "raw-window-metal", "renderdoc-sys", "smallvec", - "static_assertions", "thiserror 2.0.21", + "wasm-bindgen", + "wayland-sys", + "web-sys", "wgpu-naga-bridge", "wgpu-types", - "windows", - "windows-core", + "windows 0.62.2", + "windows-core 0.62.2", + "windows-result 0.4.1", ] [[package]] name = "wgpu-naga-bridge" -version = "30.0.1" +version = "29.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2f62e73117bb7a62bfd9c5a5841438a823f6566c6442a808ee269d2d055c081" +checksum = "95226013f547544b223281cd16a4fb549aa9dcb562adbda0faae4c73ffbbc161" dependencies = [ "naga", "wgpu-types", @@ -4896,17 +8289,15 @@ dependencies = [ [[package]] name = "wgpu-types" -version = "30.0.1" +version = "29.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99dad6f1fbdbbdb4c278a6508b059d44688f5cebddf78d005a46a31340269286" +checksum = "84bf84cd9ca8ca45e2b223a3868f1adf9bfc0c66aeac212e76ee7e40fdadf8f5" dependencies = [ "bitflags 2.13.2", "bytemuck", "js-sys", "log", - "naga-types", "raw-window-handle", - "static_assertions", "web-sys", ] @@ -4919,6 +8310,22 @@ dependencies = [ "libc", ] +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + [[package]] name = "winapi-util" version = "0.1.11" @@ -4928,16 +8335,77 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12342cb4d8e3b046f3d80effd474a7a02447231330ef77d71daa6fbc40681143" +dependencies = [ + "windows-core 0.57.0", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6" +dependencies = [ + "windows-core 0.58.0", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows" +version = "0.61.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893" +dependencies = [ + "windows-collections 0.2.0", + "windows-core 0.61.2", + "windows-future 0.2.1", + "windows-link 0.1.3", + "windows-numerics 0.2.0", +] + [[package]] name = "windows" version = "0.62.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" dependencies = [ - "windows-collections", - "windows-core", - "windows-future", - "windows-numerics", + "windows-collections 0.3.2", + "windows-core 0.62.2", + "windows-future 0.3.2", + "windows-numerics 0.3.1", +] + +[[package]] +name = "windows-capture" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a4df73e95feddb9ec1a7e9c2ca6323b8c97d5eeeff78d28f1eccdf19c882b24" +dependencies = [ + "parking_lot", + "rayon", + "thiserror 2.0.21", + "windows 0.61.3", + "windows-future 0.2.1", +] + +[[package]] +name = "windows-collections" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" +dependencies = [ + "windows-core 0.61.2", ] [[package]] @@ -4946,7 +8414,45 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" dependencies = [ - "windows-core", + "windows-core 0.62.2", +] + +[[package]] +name = "windows-core" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d" +dependencies = [ + "windows-implement 0.57.0", + "windows-interface 0.57.0", + "windows-result 0.1.2", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-core" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99" +dependencies = [ + "windows-implement 0.58.0", + "windows-interface 0.58.0", + "windows-result 0.2.0", + "windows-strings 0.1.0", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-core" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" +dependencies = [ + "windows-implement 0.60.2", + "windows-interface 0.59.3", + "windows-link 0.1.3", + "windows-result 0.3.4", + "windows-strings 0.4.2", ] [[package]] @@ -4955,11 +8461,22 @@ version = "0.62.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" dependencies = [ - "windows-implement", - "windows-interface", - "windows-link", - "windows-result", - "windows-strings", + "windows-implement 0.60.2", + "windows-interface 0.59.3", + "windows-link 0.2.1", + "windows-result 0.4.1", + "windows-strings 0.5.1", +] + +[[package]] +name = "windows-future" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" +dependencies = [ + "windows-core 0.61.2", + "windows-link 0.1.3", + "windows-threading 0.1.0", ] [[package]] @@ -4968,9 +8485,31 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" dependencies = [ - "windows-core", - "windows-link", - "windows-threading", + "windows-core 0.62.2", + "windows-link 0.2.1", + "windows-threading 0.2.1", +] + +[[package]] +name = "windows-implement" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-implement" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", ] [[package]] @@ -4984,6 +8523,28 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "windows-interface" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-interface" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "windows-interface" version = "0.59.3" @@ -4995,20 +8556,85 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "windows-link" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" + [[package]] name = "windows-link" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" +[[package]] +name = "windows-numerics" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" +dependencies = [ + "windows-core 0.61.2", + "windows-link 0.1.3", +] + [[package]] name = "windows-numerics" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" dependencies = [ - "windows-core", - "windows-link", + "windows-core 0.62.2", + "windows-link 0.2.1", +] + +[[package]] +name = "windows-registry" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4286ad90ddb45071efd1a66dfa43eb02dd0dfbae1545ad6cc3c51cf34d7e8ba3" +dependencies = [ + "windows-result 0.3.4", + "windows-strings 0.3.1", + "windows-targets 0.53.5", +] + +[[package]] +name = "windows-registry" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720" +dependencies = [ + "windows-link 0.2.1", + "windows-result 0.4.1", + "windows-strings 0.5.1", +] + +[[package]] +name = "windows-result" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-result" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +dependencies = [ + "windows-link 0.1.3", ] [[package]] @@ -5017,7 +8643,35 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" dependencies = [ - "windows-link", + "windows-link 0.2.1", +] + +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result 0.2.0", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-strings" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87fa48cc5d406560701792be122a10132491cff9d0aeb23583cc2dcafc847319" +dependencies = [ + "windows-link 0.1.3", +] + +[[package]] +name = "windows-strings" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" +dependencies = [ + "windows-link 0.1.3", ] [[package]] @@ -5026,7 +8680,16 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" dependencies = [ - "windows-link", + "windows-link 0.2.1", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", ] [[package]] @@ -5035,7 +8698,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets", + "windows-targets 0.52.6", ] [[package]] @@ -5044,7 +8707,16 @@ version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ - "windows-targets", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.5", ] [[package]] @@ -5053,7 +8725,22 @@ version = "0.61.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" dependencies = [ - "windows-link", + "windows-link 0.2.1", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] @@ -5062,14 +8749,40 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm 0.52.6", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.53.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +dependencies = [ + "windows-link 0.2.1", + "windows_aarch64_gnullvm 0.53.1", + "windows_aarch64_msvc 0.53.1", + "windows_i686_gnu 0.53.1", + "windows_i686_gnullvm 0.53.1", + "windows_i686_msvc 0.53.1", + "windows_x86_64_gnu 0.53.1", + "windows_x86_64_gnullvm 0.53.1", + "windows_x86_64_msvc 0.53.1", +] + +[[package]] +name = "windows-threading" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" +dependencies = [ + "windows-link 0.1.3", ] [[package]] @@ -5078,7 +8791,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37" dependencies = [ - "windows-link", + "windows-link 0.2.1", ] [[package]] @@ -5087,51 +8800,135 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4060a1da109b9d0326b7262c8e12c84df67cc0dbc9e33cf49e01ccc2eb63631" dependencies = [ - "windows-link", + "windows-link 0.2.1", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + [[package]] name = "windows_i686_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" +[[package]] +name = "windows_i686_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" + [[package]] name = "windows_i686_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_i686_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + [[package]] name = "windows_x86_64_msvc" version = "0.52.6" @@ -5139,55 +8936,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] -name = "winit" -version = "0.30.13" +name = "windows_x86_64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" + +[[package]] +name = "winnow" +version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6755fa58a9f8350bd1e472d4c3fcc25f824ec358933bba33306d0b63df5978d" +checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" dependencies = [ - "ahash", - "android-activity", - "atomic-waker", - "bitflags 2.13.2", - "block2 0.5.1", - "bytemuck", - "calloop", - "cfg_aliases", - "concurrent-queue", - "core-foundation", - "core-graphics", - "cursor-icon", - "dpi", - "js-sys", - "libc", - "memmap2", - "ndk", - "objc2 0.5.3", - "objc2-app-kit 0.2.2", - "objc2-foundation 0.2.2", - "objc2-ui-kit", - "orbclient", - "percent-encoding", - "pin-project", - "raw-window-handle", - "redox_syscall 0.4.1", - "rustix 0.38.44", - "sctk-adwaita", - "smithay-client-toolkit", - "smol_str", - "tracing", - "unicode-segmentation", - "wasm-bindgen", - "wasm-bindgen-futures", - "wayland-backend", - "wayland-client", - "wayland-protocols", - "wayland-protocols-plasma", - "web-sys", - "web-time", - "windows-sys 0.52.0", - "x11-dl", - "x11rb", - "xkbcommon-dl", + "memchr", ] [[package]] @@ -5199,39 +8959,40 @@ dependencies = [ "memchr", ] +[[package]] +name = "winreg" +version = "0.55.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb5a765337c50e9ec252c2069be9bf91c7df47afb103b642ba3a53bf8101be97" +dependencies = [ + "cfg-if", + "windows-sys 0.59.0", +] + [[package]] name = "winresource" version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0986a8b1d586b7d3e4fe3d9ea39fb451ae22869dcea4aa109d287a374d866087" dependencies = [ - "toml", + "toml 1.1.6+spec-1.1.0", "version_check", ] [[package]] -name = "wit-bindgen" -version = "0.57.1" +name = "wio" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" +checksum = "5d129932f4644ac2396cb456385cbf9e63b5b30c6e8dc4820bdca4eb082037a5" +dependencies = [ + "winapi", +] [[package]] -name = "wl-clipboard-rs" -version = "0.9.5" +name = "wit-bindgen" +version = "0.57.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "959c7ac3b8afde864f7a7448ac16f29b2b83350b7eccbf77fb781c3999aa6848" -dependencies = [ - "libc", - "log", - "os_pipe", - "rustix 1.1.5", - "thiserror 2.0.21", - "tree_magic_mini", - "wayland-backend", - "wayland-client", - "wayland-protocols", - "wayland-protocols-wlr", -] +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" [[package]] name = "writeable" @@ -5240,13 +9001,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" [[package]] -name = "x11-dl" +name = "x11" version = "2.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f" +checksum = "502da5464ccd04011667b11c435cb992822c2c0dbde1770c988480d312a0db2e" dependencies = [ "libc", - "once_cell", "pkg-config", ] @@ -5259,10 +9019,9 @@ dependencies = [ "as-raw-xcb-connection", "gethostname", "libc", - "libloading", - "once_cell", - "rustix 1.1.5", + "rustix", "x11rb-protocol", + "xcursor", ] [[package]] @@ -5271,6 +9030,18 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd" +[[package]] +name = "xcb" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6c2ad15e0e922856ee89afe862b8992334bbe7953adad56cd1199358cb30566" +dependencies = [ + "bitflags 2.13.2", + "libc", + "quick-xml", + "x11", +] + [[package]] name = "xcursor" version = "0.3.11" @@ -5278,26 +9049,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "163b33ed8786455e2fa5d72f554057ce3f3182425434f756cd39c99839d88e23" [[package]] -name = "xkbcommon" -version = "0.9.0" +name = "xim-ctext" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a974f48060a14e95705c01f24ad9c3345022f4d97441b8a36beb7ed5c4a02d" +checksum = "2ac61a7062c40f3c37b6e82eeeef835d5cc7824b632a72784a89b3963c33284c" dependencies = [ - "libc", - "memmap2", - "xkeysym", + "encoding_rs", ] [[package]] -name = "xkbcommon-dl" -version = "0.4.2" +name = "xim-parser" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d039de8032a9a8856a6be89cea3e5d12fdd82306ab7c94d74e6deab2460651c5" +checksum = "5dcee45f89572d5a65180af3a84e7ddb24f5ea690a6d3aa9de231281544dd7b7" dependencies = [ "bitflags 2.13.2", - "dlib", - "log", - "once_cell", +] + +[[package]] +name = "xkbcommon" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d66ca9352cbd4eecbbc40871d8a11b4ac8107cfc528a6e14d7c19c69d0e1ac9" +dependencies = [ + "as-raw-xcb-connection", + "libc", + "memmap2", "xkeysym", ] @@ -5313,12 +9090,35 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2f45bb2c13fec6a6cb4c0f76a7e94839e110a14ec803ec2940777a94c347bc52" +[[package]] +name = "xml-rs" +version = "0.8.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e450f9b2ed1dff33c94c12589a87338689467b9c4f5d8a5710bd09a847d2c8a7" + +[[package]] +name = "xml5ever" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bbb26405d8e919bc1547a5aa9abc95cbfa438f04844f5fdd9dc7596b748bf69" +dependencies = [ + "log", + "mac", + "markup5ever", +] + [[package]] name = "xmlwriter" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9" +[[package]] +name = "y4m" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5a4b21e1a62b67a2970e6831bc091d7b87e119e7f9791aef9702e3bef04448" + [[package]] name = "yazi" version = "0.2.1" @@ -5381,14 +9181,14 @@ dependencies = [ "hex", "libc", "ordered-stream", - "rustix 1.1.5", + "rustix", "serde", "serde_repr", "tracing", "uds_windows", "uuid", "windows-sys 0.61.2", - "winnow", + "winnow 1.0.4", "zbus_macros 5.19.0", "zbus_names", "zvariant", @@ -5396,9 +9196,9 @@ dependencies = [ [[package]] name = "zbus" -version = "6.2.1" +version = "6.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ddb2961d9587ef9f24ad14cde1c3bc4c5edc9f1525932a8cffdd5bd98886eb9" +checksum = "6b4aae740b23927ceabed962431abab2cdefb9f7f885e5bbab062da09bf580e4" dependencies = [ "async-trait", "bitflags 2.13.2", @@ -5407,16 +9207,15 @@ dependencies = [ "hex", "libc", "ordered-stream", - "rustix 1.1.5", + "rustix", "serde", "serde_repr", "socket2", - "tokio", "uds_windows", "uuid", "windows-sys 0.61.2", - "winnow", - "zbus_macros 6.2.1", + "winnow 1.0.4", + "zbus_macros 6.5.0", "zbus_utils", "zcheapstr", "zruntime", @@ -5463,9 +9262,9 @@ dependencies = [ [[package]] name = "zbus_macros" -version = "6.2.1" +version = "6.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "083b38add47c340fc12ec560124fb1d9c23acb584f7021099f85ec6587a03c54" +checksum = "2f5aa7f2c4ea81b7ccfb26bafefdb4d1a44dd9d4f82c8426173a3727311743e4" dependencies = [ "proc-macro2", "quote", @@ -5480,7 +9279,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d8bf88b4a3ff53e883001e0e0115b297a9d53c31b9c1edd2bfdd853e3428624e" dependencies = [ "serde", - "winnow", + "winnow 1.0.4", "zvariant", ] @@ -5494,7 +9293,7 @@ dependencies = [ "quote", "serde", "syn 3.0.6", - "winnow", + "winnow 1.0.4", ] [[package]] @@ -5504,7 +9303,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d1586c021a01ca0a9216dcd874e546382e156a5cbab5fab6cb5f10087e22682a" dependencies = [ "serde", - "winnow", + "winnow 1.0.4", "zbus_names", "zvariant", ] @@ -5518,6 +9317,67 @@ dependencies = [ "serde", ] +[[package]] +name = "zed-font-kit" +version = "0.14.1-zed" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3898e450f36f852edda72e3f985c34426042c4951790b23b107f93394f9bff5" +dependencies = [ + "bitflags 2.13.2", + "byteorder", + "core-foundation 0.10.0", + "core-graphics 0.24.0", + "core-text", + "dirs", + "dwrote", + "float-ord", + "freetype-sys", + "lazy_static", + "libc", + "log", + "pathfinder_geometry", + "pathfinder_simd", + "walkdir", + "winapi", + "yeslogic-fontconfig-sys", +] + +[[package]] +name = "zed-scap" +version = "0.0.8-zed" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6b338d705ae33a43ca00287c11129303a7a0aa57b101b72a1c08c863f698ac8" +dependencies = [ + "anyhow", + "cocoa 0.25.0", + "core-graphics-helmer-fork", + "log", + "objc", + "rand 0.8.8", + "screencapturekit", + "screencapturekit-sys", + "sysinfo", + "tao-core-video-sys", + "windows 0.61.3", + "windows-capture", + "x11", + "xcb", +] + +[[package]] +name = "zed-xim" +version = "0.4.0-zed" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0b46ed118eba34d9ba53d94ddc0b665e0e06a2cf874cfa2dd5dec278148642" +dependencies = [ + "ahash", + "hashbrown 0.14.5", + "log", + "x11rb", + "xim-ctext", + "xim-parser", +] + [[package]] name = "zeno" version = "0.3.3" @@ -5570,6 +9430,20 @@ name = "zeroize" version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c50655cbb0fe3fc43170059e702f1ce5e19b84cec58dc87b037a09935c2f328" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] [[package]] name = "zerotrie" @@ -5580,7 +9454,6 @@ dependencies = [ "displaydoc", "yoke", "zerofrom", - "zerovec", ] [[package]] @@ -5589,7 +9462,6 @@ version = "0.11.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb0464e17806c1d976d5cba29399c7f08e516e279e2ba493f63123b5fca67dd8" dependencies = [ - "serde", "yoke", "zerofrom", "zerovec-derive", @@ -5650,30 +9522,54 @@ dependencies = [ [[package]] name = "zruntime" -version = "0.2.2" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23ef5ed7d628cdf0af82f93dfe03330a8e37383bf7422a1d3d6eb72326680be5" +checksum = "ac67096b97c00742108c4674db6bb6178adb78c4b66a506b0e4a7a9593aa5d9e" dependencies = [ "futures-core", "futures-io", - "rustix 1.1.5", + "rustix", "socket2", "windows-sys 0.61.2", ] +[[package]] +name = "zune-core" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f423a2c17029964870cfaabb1f13dfab7d092a62a29a89264f4d36990ca414a" + [[package]] name = "zune-core" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d56377fd46368984a170bc5aac5567e52ca5da874caa60bea39fcbca78fb658b" +[[package]] +name = "zune-inflate" +version = "0.2.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02" +dependencies = [ + "simd-adler32", +] + +[[package]] +name = "zune-jpeg" +version = "0.4.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29ce2c8a9384ad323cf564b67da86e21d3cfdff87908bc1223ed5c99bc792713" +dependencies = [ + "zune-core 0.4.12", +] + [[package]] name = "zune-jpeg" version = "0.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27bc9d5b815bc103f142aa054f561d9187d191692ec7c2d1e2b4737f8dbd7296" dependencies = [ - "zune-core", + "zune-core 0.5.3", ] [[package]] @@ -5685,7 +9581,8 @@ dependencies = [ "endi", "enumflags2", "serde", - "winnow", + "serde_bytes", + "winnow 1.0.4", "zcheapstr", "zvariant_derive", "zvariant_utils", @@ -5714,5 +9611,5 @@ dependencies = [ "quote", "serde", "syn 3.0.6", - "winnow", + "winnow 1.0.4", ] diff --git a/Cargo.toml b/Cargo.toml index a3bf559..0e8ae9e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,9 +1,9 @@ [package] -name = "claudiu" -version = "0.9.23" +name = "m4code" +version = "0.10.0" edition = "2024" -description = "A native workspace for Claude Code sessions: real PTYs, projects, and session history" -repository = "https://github.com/m4rocks/claudiu" +description = "A native desktop workspace for coding agents: Claude Code, Codex, OpenCode and Antigravity sessions, projects and history" +repository = "https://github.com/m4rocks/m4code" publish = false [dependencies] @@ -14,47 +14,45 @@ dunce = "1.0.5" futures = "0.3.34" # A system notification when a session finishes while the window is in the background (`platform::notify`). notify-rust = "4.19.0" -# Editor mode's file tree follows its folder on disk. -notify = "8.2.0" git2 = { version = "0.21.0", default-features = false } -# The types editor mode's language servers (`lsp`) speak. -lsp-types = "0.97.0" -# The UI: views, layout, text, springs and the native window. Pre-release, so pinned to a commit of its `dev` branch. -rune = { git = "https://github.com/anomalyco/rune", rev = "a7f276c3630f85a06a0230295da4d2bd172d8d3b", features = ["native-file-dialog"] } -rune-kit = { git = "https://github.com/anomalyco/rune", rev = "a7f276c3630f85a06a0230295da4d2bd172d8d3b", features = ["markdown"] } +gpui = { package = "gpui-pre", version = "=0.3.8" } +gpui-kit = { version = "0.7.1", default-features = false, features = [ + "component", + "assets", + # Editor mode's syntax highlighting; each grammar adds to the binary, so only these. + "tree-sitter-bash", + "tree-sitter-css", + "tree-sitter-html", + "tree-sitter-javascript", + "tree-sitter-markdown", + "tree-sitter-markdown-inline", + "tree-sitter-rust", + "tree-sitter-toml", + "tree-sitter-tsx", + "tree-sitter-typescript", + "tree-sitter-yaml", +] } +raw-window-handle = "0.6" serde = { version = "1.0.229", features = ["derive"] } serde_json = { version = "1.0.151", features = ["preserve_order"] } -# File links (OSC 8) a program prints in the terminal. +# The same versions gpui-kit's editor uses for its LSP hooks; editor mode's language servers (`lsp`) speak through them. +lsp-types = "0.97.0" url = "2.5.8" +# Editor mode's file tree follows its folder on disk; already in the build through gpui-kit. +notify = "8.2.0" image = { version = "0.25", default-features = false, features = ["png", "bmp", "jpeg", "gif", "webp"] } ureq = "3.4.2" time = { version = "0.3.55", features = ["parsing"] } -# Editor mode's syntax colours: the grammars of the languages `files::language` names, and their highlight queries. -tree-sitter = "0.26" -tree-sitter-highlight = "0.26" -tree-sitter-bash = "0.23.3" -tree-sitter-css = "0.23.2" +# Gleam is not among gpui-kit's grammars; registered in `app::editor_mode::register_languages`. tree-sitter-gleam = "1.0.0" -tree-sitter-html = "0.23.2" -tree-sitter-javascript = "0.23.1" -tree-sitter-json = "0.24.8" -tree-sitter-md = "0.5.4" -tree-sitter-rust = "0.24.2" -tree-sitter-toml-ng = "0.7.0" -tree-sitter-typescript = "0.23.2" -tree-sitter-yaml = "0.7.2" -# Where the editor may wrap a long line (Unicode line breaking) and never split a character the user sees, as main's -# GPUI editor wrapped; main's build had both. -unicode-linebreak = "0.1.5" -unicode-segmentation = "1.13.3" -# How many cells a character takes in the editor (wide CJK and emoji take two). -unicode-width = "0.2.2" uuid = { version = "1.27.0", features = ["v4"] } # 1.2.161 requires zip ^8.6. This release is the first published one that allows zip 9. velopack = "1.3.39-g8d2844f" which = "8.0.6" [dev-dependencies] +gpui = { package = "gpui-pre", version = "=0.3.8", features = ["test-support"] } +gpui-kit = { version = "0.7.1", default-features = false, features = ["component", "test-support"] } tempfile = "3.27.0" [build-dependencies] @@ -74,7 +72,7 @@ libc = "0.2" [target.'cfg(target_os = "macos")'.dependencies] objc2 = "0.6" -objc2-app-kit = { version = "0.3", features = ["NSApplication", "NSMenu", "NSMenuItem"] } +objc2-app-kit = { version = "0.3", features = ["NSApplication"] } [profile.dev] debug = "line-tables-only" @@ -82,5 +80,20 @@ incremental = true [profile.dev.package."*"] debug = false -# Rune lays out and draws on the UI thread; unoptimised dependencies make a busy session visibly laggy. +# gpui lays out and paints every element on every frame; unoptimised it makes a busy session visibly laggy. opt-level = 2 + +# gpui-base 0.7.1 drew an editor's `set_scroll_offset` unclamped for one frame, so a wheel glide past either end +# overshot and jumped back. Patched in `vendor/gpui-base` (`clamp_deferred_scroll_top` in src/input/base/element.rs); +# drop this once gpui-kit releases the fix and has an action to open the completion menu by hand. The patch adds +# `TriggerCompletion` (Ctrl+Space) and has a menu opened that way follow its word as it grows +# (`handle_completion_trigger` in src/input/editor/lsp/completions.rs). It also makes `has_multiple_cursors`, `select_range` +# and `replace_range` public, which the line actions (src/app/line_actions.rs) edit through, and makes a drag that began +# with a double click select whole words (`snap_to_word_edge` in src/input/base/selection.rs). `SelectableText::runs` lets +# a card's text keep its styling while selectable. +[patch.crates-io] +gpui-base = { path = "vendor/gpui-base" } + +[workspace] +# Not a member, so `profile.dev.package."*"` still builds it optimised like the other dependencies. +exclude = ["vendor"] diff --git a/README.md b/README.md index ea8c466..67e5551 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,16 @@ -# Claudiu +# m4code -Claudiu is a native desktop app, written in Rust with [Rune](https://github.com/anomalyco/rune), that runs several [Claude Code](https://code.claude.com) sessions in one window on Windows, macOS and Linux. It is a personal project with rough edges: macOS and Linux are lightly tested, and the macOS build isn't notarized. Issues and pull requests are welcome. +m4code is a native desktop app, written in Rust with [GPUI](https://gpui.rs), that runs coding agent sessions (Claude Code, Codex, OpenCode and Google Antigravity) in one window on Windows, macOS and Linux. It is a personal project with rough edges: macOS and Linux are lightly tested, and the macOS build isn't notarized. Issues and pull requests are welcome. -> **Claudiu is an independent project. It is not affiliated with, endorsed by or sponsored by Anthropic.** Claude and Claude Code are trademarks of Anthropic. +> **m4code is an independent project. It is not affiliated with, endorsed by or sponsored by Anthropic.** Claude and Claude Code are trademarks of Anthropic. ## What it does -Each session is your own `claude` process in a real terminal, and sign-in stays with Claude Code. Around it, Claudiu adds a sidebar of running and recent sessions (Ctrl+Z, or Cmd+Z on macOS, reopens the last one you closed), notifications when a background session finishes or asks something, an editor mode (Ctrl+Shift+E), usage meters, a GitHub pane, cards Claude draws inline, sessions that move between git worktrees, extra accounts that share one configuration, and Codex, OpenCode and Google Antigravity subagents (Settings → Custom subagents). Codex subagents need Node and a `codex login`, OpenCode subagents need `opencode` on PATH, Antigravity subagents need the Antigravity CLI (`agy`) installed and signed in, and with Allow edits on, each acts without Claude Code's permission rules. Read-only Antigravity runs from its own folder in Claudiu's data, whose hook refuses every tool but reading and searching, so your own Antigravity rules, skills and MCP servers don't load there. Google's [Antigravity terms](https://antigravity.google/terms) and [FAQ](https://antigravity.google/docs/faq) forbid using another company's agent, such as Claude Code, with a personal Google sign-in. That covers the Free, AI Plus, Pro and Ultra plans. Google can suspend or terminate the Antigravity and Gemini CLI accounts of anyone who does, so turn Antigravity subagents on at your own risk. With Codex subagents on, the sidebar also shows Codex's 5-hour and 7-day limits, which Claudiu reads from the session logs in `~/.codex`; with Antigravity subagents on, it shows Antigravity's limits for each group of models, from `agy`'s own `/usage`, asked every five minutes at no token cost. Their last saved readings show at launch and refresh in the background. Settings lists the rest. +Each session is a conversation with Claude Code, Codex, OpenCode or Google Antigravity in m4code's own chat view. m4code talks to each agent through the [Agent Client Protocol](https://agentclientprotocol.com) (ACP), and sign-in stays with the agent. Settings → General picks the default model for new sessions across all enabled harnesses. Claude Code sessions run through Anthropic's [Claude Agent SDK](https://code.claude.com/docs/en/agent-sdk/overview) with your own `claude`, and need Node and npm. The first one installs the SDK into m4code's data folder. Anthropic's [terms](https://code.claude.com/docs/en/legal-and-compliance) don't allow third-party apps built on the Agent SDK to use a Claude Free, Pro, Max or Ultra sign-in without Anthropic's approval, and Anthropic may enforce that without notice. m4code uses whatever sign-in your `claude` has, so with a subscription sign-in you use Claude Code sessions in m4code at your own risk. An API key, or a cloud provider such as Bedrock or Vertex, is allowed. Codex sessions need Node, because m4code runs Codex through its ACP adapter from npm. The chat view takes Claude Code's keyboard shortcuts, such as Esc to interrupt, Esc twice to edit your last message, Shift+Tab to change mode and Up for earlier messages. Settings → Keyboard lists every keyboard shortcut; they can't be changed yet. Pick up a session here, in a project's menu, lists the default agent's sessions in that folder, including ones started in a terminal, and opens the one you choose. Quit it in the terminal first. The welcome screen is the message box for a new session. Home and chat share a Send button on the right. Empty or whitespace-only drafts cannot be sent, including with Enter. Its chips pick the model from any enabled harness, the project, the effort level and the branch or worktree. The branch list explains deletion restrictions and shows the paths of external worktrees too. A missing worktree folder stays listed and cannot be selected. A chat's message box has the same chips, the branch chip included. The branch chip's dropdown starts work in a new worktree in one click. Type a name in its search box, or leave it blank for a random name, then choose New worktree to branch from main, or from current to branch from the checkout you are in. A typed name that isn't a branch also gets a Create branch row. Inside a chat, click the model pill (or press Alt+P / Option+P) to search and pick any model across enabled harnesses or drag the effort bar, and click the permission pill to open the permission mode dropdown; Escape or clicking outside closes either dropdown. The permission dropdown lists Auto mode whenever Claude Code offers it for your account. Picking a model served by another harness hands off the conversation in place when you send your next message, after the current turn ends. Returning to a harness resumes its saved provider session and sends the intervening conversation. A failed handoff restores the original session and the unsent draft. When you ask an agent to switch models, it does so with m4code's set_model tool, and list_models gives it the model names. A switch to a model on another harness hands the conversation to that harness when the turn ends. m4code's tools that open, read or link sessions, switch models or move a session to another worktree never ask you to confirm: the agent calls them only when you asked for what they do. An agent can open a new session in a project with a model and effort of its choosing; the new session takes your default permission mode. Settings → Harnesses enables or disables Claude Code, Codex, OpenCode and Antigravity. Each harness's popup lists its models. The model picker shows the ticked models. Every model starts ticked, and the last one can't be unticked. Claude Code's popup also holds its account switcher and the Claude in Chrome switch for new sessions. m4code starts each Claude Code session without the tools meant for the claude.ai app, such as scheduled tasks, push notifications and the claude.ai connectors. It removes them for that session only, so Claude Code in a terminal keeps them. The slash command menu leaves out commands m4code's own controls cover, such as /model and Codex's /approvals. Every harness popup has the same subagent and edit controls and uses the same status format. Antigravity shows its terms warning directly under the subagent toggle. With the toggle on, each ticked model can run as a subagent. Codex and OpenCode subagents default to enabled with edits allowed when those settings have not been saved. Existing off and read-only choices stay as they are. Antigravity stays opt-in for Claude Code's native integration. The sidebar footer shows usage limits only for connected harnesses that have a limits adapter. Settings → Skills browses `skills.sh`, installs single `SKILL.md` packages or whole GitHub repositories, and symlinks enabled skills globally or per project into each active harness. Installed skills are grouped by the GitHub repository they came from. Update fetches the latest version of one skill, Update repo does it for every skill from that repository, and Update all does it for every installed skill. Toggles stay as they were. With a project picked as the scope, the page also lists the skills that project's repository ships in its own folders, such as `.claude/skills`. m4code only reads those folders. Before each message in a git repository, m4code saves the working tree. Review changes, under the message box, then shows what changed since your last message, hunk by hunk. Each hunk can be kept or reverted. A comment on a line goes back to the agent as `@path#L12: comment`, and Cmd/Ctrl+Enter in a comment sends all of them. In editor mode, a button beside the selected lines, or beside the line under the mouse, opens the same comment box. Enter adds `@path#L12-30: comment` to the message box on a line of its own, and Cmd/Ctrl+Enter sends it. The sidebar starts with the project selector and Settings on its right. Around the chat, m4code adds a sidebar of running and recent sessions (Ctrl+Z, or Cmd+Z on macOS, reopens the last one you closed), notifications when a background session finishes or asks something, an editor mode (Ctrl+Shift+E) that also works on Home for the selected project, preserving each project's tabs and unsaved edits, usage meters, a GitHub pane, cards Claude draws inline, sessions that move between git worktrees, extra accounts that share one configuration, a `skills.sh` browser and toggle panel (Settings → Skills) that installs `SKILL.md` packages and symlinks enabled skills globally or per project into each active agent's skills folder, and cross-agent subagents configured in Settings → Harnesses. Codex subagents need Node and a `codex login`, OpenCode subagents need `opencode` on PATH, Antigravity subagents need the Antigravity CLI (`agy`) installed and signed in, and with Allow edits on, each acts without Claude Code's permission rules. Read-only Antigravity runs from its own folder in m4code's data, whose hook refuses every tool but reading and searching, so your own Antigravity rules, skills and MCP servers don't load there. Google's [Antigravity terms](https://antigravity.google/terms) and [FAQ](https://antigravity.google/docs/faq) forbid using another company's agent, such as Claude Code, with a personal Google sign-in. That covers the Free, AI Plus, Pro and Ultra plans. Google can suspend or terminate the Antigravity and Gemini CLI accounts of anyone who does, so turn Antigravity subagents on at your own risk. With Codex subagents on, the sidebar also shows Codex's 5-hour and 7-day limits, which m4code reads from the session logs in `~/.codex`; with Antigravity subagents on, it shows Antigravity's limits for each group of models, from `agy`'s own `/usage`, asked every five minutes at no token cost. Their last saved readings show at launch and refresh in the background. Settings lists the rest. + +Claude Code, Codex and OpenCode sessions share m4code's `spawn_subagent`, `list_subagents`, `send_subagent_message`, `wait_subagent` and `stop_subagent` MCP tools. Children run in the parent's working folder without taking focus. When a child's turn ends, m4code sends its report to the parent, which shows it folded among the thinking and tool steps. Click the step to read the report, or Open to show the child. `wait_subagent` is only for a parent that must have the report before it can go on. A subagent's chat has a bar above it with a link back to its parent, the child's provider and its state. The right sidebar lists a session's subagents with their provider logos and states, and folds the finished ones into one row. The list includes the harness's own subagents, such as Claude Code's Agent tool and its `m4code:` types; clicking one unfolds its step in the chat and scrolls there. Follow-ups use the same child session, including after stopping it. Stopping a parent stops its children. A read-only parent cannot grant edits to a child, and user questions still need an answer. Claude Code's native subagent integration remains available. Enabled Codex and OpenCode providers register a default-model subagent even before their model catalogs load. The shared MCP instructions name every subagent tool so each supported provider can discover them. The shared tools exclude Antigravity for now. In the Home editor, line comments go into the new-session composer; Cmd/Ctrl+Enter sends them and starts the session. + +m4code schedules compaction at the next idle boundary once reported context reaches 80%. It uses the adapter's advertised native compact command and keeps the provider session. Claude Code's mod and OpenCode's session configuration turn off native automatic compaction. Codex retains a native fallback that m4code cannot disable; the status panel says so. An adapter without verified compaction support shows that limitation. m4code does not replace an unsupported session with a generated summary. Returning to a provider keeps its session continuity and avoids resending the context it already has. While a custom subagent works, its own view in Claude Code's tasks list streams its messages, reasoning, plan and tool steps and command output. The main conversation stays as it is until the subagent hands back its report. The first Codex run takes longer while npm downloads the adapter. Claude can choose a Codex subagent's effort when it starts one (`max` runs as Codex's `xhigh`); otherwise Codex uses the effort in `~/.codex/config.toml`. @@ -14,8 +18,8 @@ A message Claude sends a running Codex subagent reaches it in the task it is wor ## What it touches -Claudiu never calls the Anthropic API or deletes a transcript, and it changes Claude Code's settings only when you flip a switch. Its network use is GitHub (the update check and the GitHub pane), plus npm and OpenAI once you turn on Codex subagents, the providers you set up in OpenCode once you turn on OpenCode subagents, and Google once you turn on Antigravity subagents. Terminal contents are never logged. +m4code never calls the Anthropic API or deletes a transcript, and it changes Claude Code's settings only when you flip a switch. In a git repository, each session keeps its 20 newest working-tree snapshots as commits under `refs/m4code/`. They never touch your index, branches or stash, but `git log --all` shows them. Its network use is GitHub (the update check, the GitHub pane and installing skills), `skills.sh` when you browse or search Skills, npm for the Claude Agent SDK and the Codex adapter, OpenAI once you use Codex sessions or turn on Codex subagents, the providers you set up in OpenCode once you turn on OpenCode subagents, and Google once you turn on Antigravity subagents. Terminal contents are never logged. ## Development -You need stable Rust, plus Visual Studio Build Tools on Windows or the headers Rune builds against on Linux, and [just](https://just.systems): `just run`, `just test`, `just ci`. `src/` is the app, `mod/` is the Claude Code plugin each session loads, and `web/` is the site. `CLAUDE.md` has the conventions. A debug build keeps its data in its own folder, so it runs beside the installed app; a second app on the same folder says Claudiu is already running and quits. To release, bump `version` in `Cargo.toml` and push a `vX.Y.Z` tag. +You need stable Rust, plus Visual Studio Build Tools on Windows or the headers GPUI builds against on Linux, and [just](https://just.systems): `just run`, `just test`, `just ci`. `src/` is the app, `vendor/gpui-base/` is a patched copy of the editor crate (`Cargo.toml` says what the patch changes and when to drop it), `mod/` is the Claude Code plugin each session loads, `bridge/` is the Node script that runs Claude Code sessions through the Claude Agent SDK (its lockfile pins the SDK), and `web/` is the site. `AGENTS.md` has the conventions. A debug build keeps its data in its own folder, so it runs beside the installed app; a second app on the same folder says m4code is already running and quits. To release, bump `version` in `Cargo.toml` and push a `vX.Y.Z` tag. diff --git a/assets/LICENSE-LUCIDE b/assets/LICENSE-LUCIDE deleted file mode 100644 index 718bb3f..0000000 --- a/assets/LICENSE-LUCIDE +++ /dev/null @@ -1,43 +0,0 @@ -ISC License - -Copyright (c) 2026 Lucide Icons and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ---- - -The following Lucide icons are derived from the Feather project: - -airplay, alert-circle, alert-octagon, alert-triangle, aperture, arrow-down-circle, arrow-down-left, arrow-down-right, arrow-down, arrow-left-circle, arrow-left, arrow-right-circle, arrow-right, arrow-up-circle, arrow-up-left, arrow-up-right, arrow-up, at-sign, calendar, cast, check, chevron-down, chevron-left, chevron-right, chevron-up, chevrons-down, chevrons-left, chevrons-right, chevrons-up, circle, clipboard, clock, code, columns, command, compass, corner-down-left, corner-down-right, corner-left-down, corner-left-up, corner-right-down, corner-right-up, corner-up-left, corner-up-right, crosshair, database, divide-circle, divide-square, dollar-sign, download, external-link, feather, frown, hash, headphones, help-circle, info, italic, key, layout, life-buoy, link-2, link, loader, lock, log-in, log-out, maximize, meh, minimize, minimize-2, minus-circle, minus-square, minus, monitor, moon, more-horizontal, more-vertical, move, music, navigation-2, navigation, octagon, pause-circle, percent, plus-circle, plus-square, plus, power, radio, rss, search, server, share, shopping-bag, sidebar, smartphone, smile, square, table-2, tablet, target, terminal, trash-2, trash, triangle, tv, type, upload, x-circle, x-octagon, x-square, x, zoom-in, zoom-out - -The MIT License (MIT) (for the icons listed above) - -Copyright (c) 2013-present Cole Bemis - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/assets/claudiu.ico b/assets/claudiu.ico deleted file mode 100644 index 62c3dbb..0000000 Binary files a/assets/claudiu.ico and /dev/null differ diff --git a/assets/claudiu.png b/assets/claudiu.png deleted file mode 100644 index 3b2cf5d..0000000 Binary files a/assets/claudiu.png and /dev/null differ diff --git a/assets/m4code.ico b/assets/m4code.ico new file mode 100644 index 0000000..0cef0f6 Binary files /dev/null and b/assets/m4code.ico differ diff --git a/assets/m4code.png b/assets/m4code.png new file mode 100644 index 0000000..8f80231 Binary files /dev/null and b/assets/m4code.png differ diff --git a/bridge/claude.mjs b/bridge/claude.mjs new file mode 100644 index 0000000..e708c18 --- /dev/null +++ b/bridge/claude.mjs @@ -0,0 +1,441 @@ +// Claude Code for m4code, through Anthropic's Claude Agent SDK. m4code speaks ACP (newline-delimited JSON-RPC on +// stdin and stdout) to every agent; this script answers it for Claude Code by driving the SDK, which runs the user's +// own `claude` (CLAUDE_CODE_EXECUTABLE) with their settings, plugins and sign-in. +// +// Only the part of ACP m4code uses is here: initialize, session/new, session/load, session/list, session/prompt, +// session/cancel, session/set_mode and session/set_config_option, and session/request_permission back to m4code. +// stdout carries the protocol only, so anything logged goes to stderr. + +import { randomUUID } from "node:crypto"; +import { createInterface } from "node:readline"; + +import { getSessionMessages, listSessions, query } from "@anthropic-ai/claude-agent-sdk"; + +console.log = console.error; +console.info = console.error; + +const send = (message) => process.stdout.write(`${JSON.stringify({ jsonrpc: "2.0", ...message })}\n`); +const update = (sessionId, body) => send({ method: "session/update", params: { sessionId, update: body } }); + +// Requests to m4code (permission questions) and their answers. +let nextRequest = 1; +const answers = new Map(); +function ask(method, params) { + const id = `claude-${nextRequest++}`; + send({ id, method, params }); + return new Promise((resolve) => answers.set(id, resolve)); +} + +/** What the user types, as the SDK reads it: an async stream that ends when the session closes. */ +class Inbox { + items = []; + wake = null; + closed = false; + push(item) { + this.items.push(item); + this.wake?.(); + } + close() { + this.closed = true; + this.wake?.(); + } + async *[Symbol.asyncIterator]() { + for (;;) { + while (this.items.length) yield this.items.shift(); + if (this.closed) return; + await new Promise((resolve) => (this.wake = resolve)); + this.wake = null; + } + } +} + +const sessions = new Map(); + +const MODES = [ + { id: "default", name: "Ask Before Editing" }, + { id: "acceptEdits", name: "Accept Edits" }, + { id: "plan", name: "Plan Mode" }, + { id: "dontAsk", name: "Don't Ask" }, + { id: "bypassPermissions", name: "Full Access" }, +]; +const EFFORTS = ["low", "medium", "high", "xhigh", "max"]; + +const AUTO = { id: "auto", name: "Auto" }; + +/** Auto mode is listed only when Claude Code offers it: a model of this account supports it (the "default" entry + * included), or the session already started in it. Without that, choosing it would fail. */ +function modes(session) { + const offersAuto = session.mode === AUTO.id || session.offersAuto; + const available = offersAuto ? [MODES[0], MODES[1], AUTO, ...MODES.slice(2)] : MODES; + return { currentModeId: session.mode, availableModes: available }; +} + +function configOptions(session) { + const realModels = session.models.filter((m) => m.value !== "default"); + const sourceModels = realModels.length ? realModels : session.models; + const models = sourceModels.map((m) => ({ value: m.value, name: m.displayName || m.value })); + return [ + { id: "model", name: "Model", category: "model", type: "select", currentValue: session.model, options: models }, + { + id: "effort", + name: "Effort", + category: "thought_level", + type: "select", + currentValue: session.effort, + options: EFFORTS.map((e) => ({ value: e, name: e })), + }, + ]; +} + +/** ACP's MCP servers (`env` as a list of names and values) as the SDK takes them. */ +function mcpServers(list = []) { + const servers = {}; + for (const s of list) { + if (s.command) { + servers[s.name] = { type: "stdio", command: s.command, args: s.args ?? [], env: Object.fromEntries((s.env ?? []).map((e) => [e.name, e.value])) }; + } else if (s.url) { + servers[s.name] = { type: s.type === "sse" ? "sse" : "http", url: s.url, headers: Object.fromEntries((s.headers ?? []).map((h) => [h.name, h.value])) }; + } + } + return servers; +} + +function kindOf(name) { + if (name === "Read") return "read"; + if (["Edit", "MultiEdit", "Write", "NotebookEdit"].includes(name)) return "edit"; + if (["Bash", "PowerShell"].includes(name)) return "execute"; + if (["Grep", "Glob", "LSP"].includes(name)) return "search"; + if (["WebFetch", "WebSearch"].includes(name)) return "fetch"; + if (["Agent", "Task"].includes(name)) return "think"; + return "other"; +} + +function titleOf(name, input = {}) { + const path = input.file_path ?? input.notebook_path ?? input.path; + switch (name) { + case "Bash": + case "PowerShell": + return input.description || input.command || name; + case "Read": + case "Edit": + case "MultiEdit": + case "Write": + case "NotebookEdit": + return path ? `${name} ${path}` : name; + case "Grep": + case "Glob": + return input.pattern ? `${name} ${input.pattern}` : name; + case "WebFetch": + return input.url ? `Fetch ${input.url}` : name; + case "WebSearch": + return input.query ? `Search ${input.query}` : name; + case "Agent": + case "Task": + return input.description || name; + } + // mcp__server__tool reads as "server: tool". + const mcp = /^mcp__(.+?)__(.+)$/.exec(name); + return mcp ? `${mcp[1]}: ${mcp[2]}` : name; +} + +/** An edit shows as a diff of what it changes. */ +function diffOf(name, input = {}) { + if (name === "Edit" && input.file_path) return [{ type: "diff", path: input.file_path, oldText: input.old_string ?? "", newText: input.new_string ?? "" }]; + if (name === "Write" && input.file_path) return [{ type: "diff", path: input.file_path, oldText: null, newText: input.content ?? "" }]; + return []; +} + +function toolCall(block, status) { + const path = block.input?.file_path ?? block.input?.notebook_path; + return { + sessionUpdate: "tool_call", + toolCallId: block.id, + title: titleOf(block.name, block.input), + kind: kindOf(block.name), + status, + rawInput: block.input, + content: diffOf(block.name, block.input), + locations: path ? [{ path }] : [], + }; +} + +function resultText(content) { + if (typeof content === "string") return content; + return (content ?? []).filter((c) => c.type === "text").map((c) => c.text).join("\n"); +} + +/** The todo list Claude keeps (TodoWrite) is the session's plan. */ +function plan(input) { + return { sessionUpdate: "plan", entries: (input?.todos ?? []).map((t) => ({ content: t.content, status: t.status, priority: "medium" })) }; +} + +/** One message of the conversation as updates: what the user said, the reply, its thinking and its tools. */ +function* updatesOf(session, role, content) { + const blocks = typeof content === "string" ? [{ type: "text", text: content }] : (content ?? []); + for (const b of blocks) { + if (b.type === "text" && b.text) yield { sessionUpdate: role === "user" ? "user_message_chunk" : "agent_message_chunk", content: { type: "text", text: b.text } }; + else if (b.type === "thinking" && b.thinking) yield { sessionUpdate: "agent_thought_chunk", content: { type: "text", text: b.thinking } }; + else if (b.type === "tool_use") { + session.tools.set(b.id, b); + yield b.name === "TodoWrite" ? plan(b.input) : toolCall(b, "in_progress"); + } else if (b.type === "tool_result") { + const call = session.tools.get(b.tool_use_id); + if (call?.name === "TodoWrite") continue; + const failed = b.is_error === true; + // An edit keeps its diff; its result text only says it succeeded. + const keepsDiff = !failed && call && diffOf(call.name, call.input).length; + yield { + sessionUpdate: "tool_call_update", + toolCallId: b.tool_use_id, + status: failed ? "failed" : "completed", + ...(keepsDiff ? {} : { content: [{ type: "content", content: { type: "text", text: resultText(b.content) } }] }), + }; + } + } +} + +async function permission(session, name, input, options) { + if (name === "AskUserQuestion") return askQuestions(session, input, options); + const id = options.toolUseID ?? randomUUID(); + const choices = [{ optionId: "allow", name: "Yes", kind: "allow_once" }]; + if (options.suggestions?.length) choices.push({ optionId: "always", name: "Yes, and don't ask again", kind: "allow_always" }); + choices.push({ optionId: "reject", name: "No", kind: "reject_once" }); + const title = options.title ?? titleOf(name, input); + const answer = await ask("session/request_permission", { + sessionId: session.id, + toolCall: { toolCallId: id, title, kind: kindOf(name), status: "pending", rawInput: input }, + options: choices, + }); + const chosen = answer?.outcome?.outcome === "selected" ? answer.outcome.optionId : null; + if (chosen === "allow" || chosen === "always") { + return { behavior: "allow", updatedInput: input, ...(chosen === "always" ? { updatedPermissions: options.suggestions } : {}) }; + } + return { behavior: "deny", message: "The user declined this.", interrupt: chosen === null }; +} + +/** Claude's questions to the user, one at a time, each with its options. A multiple-choice question takes one answer. */ +async function askQuestions(session, input, options) { + const answers = {}; + for (const q of input?.questions ?? []) { + const answer = await ask("session/request_permission", { + sessionId: session.id, + toolCall: { toolCallId: `${options.toolUseID}-${q.question}`, title: q.question, kind: "other", status: "pending" }, + options: [ + ...q.options.map((o, i) => ({ optionId: String(i), name: o.label, ...(o.description ? { description: o.description } : {}), kind: "allow_once" })), + { optionId: "skip", name: "Skip", kind: "reject_once" }, + ], + }); + const chosen = answer?.outcome?.outcome === "selected" ? answer.outcome.optionId : null; + if (chosen === null) return { behavior: "deny", message: "The user dismissed the question.", interrupt: true }; + if (chosen !== "skip") answers[q.question] = q.options[Number(chosen)].label; + } + return { behavior: "allow", updatedInput: { ...input, answers } }; +} + +function stopReason(session, result) { + if (session.cancelled) return "cancelled"; + if (result.subtype === "error_max_turns") return "max_turn_requests"; + if (result.stop_reason === "max_tokens") return "max_tokens"; + if (result.stop_reason === "refusal") return "refusal"; + return "end_turn"; +} + +function finishTurn(session, result) { + const turn = session.turn; + session.turn = null; + if (turn) { + const failed = result.is_error && !session.cancelled; + if (failed) turn.reject(new Error(result.result || (result.errors ?? []).join("\n") || "Claude Code stopped with an error.")); + else turn.resolve({ stopReason: stopReason(session, result) }); + } + // The context size is only shown, so the turn ends without waiting for it. + session.query + .getContextUsage() + .then((usage) => update(session.id, { sessionUpdate: "usage_update", used: usage.totalTokens, size: usage.maxTokens })) + .catch(() => {}); +} + +/** The session's messages from the SDK, as updates to m4code, until the session ends. */ +async function pump(session) { + try { + for await (const m of session.query) { + // A subagent's own steps stay inside its tool call. + if (m.parent_tool_use_id) continue; + if (m.type === "stream_event") { + const ev = m.event; + if (ev.type === "message_start") session.streamed.add(ev.message.id); + if (ev.type === "content_block_delta" && ev.delta.type === "text_delta") update(session.id, { sessionUpdate: "agent_message_chunk", content: { type: "text", text: ev.delta.text } }); + if (ev.type === "content_block_delta" && ev.delta.type === "thinking_delta") update(session.id, { sessionUpdate: "agent_thought_chunk", content: { type: "text", text: ev.delta.thinking } }); + } else if (m.type === "assistant") { + // Text already came in pieces when the message streamed; its tools come whole here. + const streamed = session.streamed.has(m.message.id); + const blocks = (m.message.content ?? []).filter((b) => b.type === "tool_use" || !streamed); + for (const u of updatesOf(session, "assistant", blocks)) update(session.id, u); + } else if (m.type === "user") { + const blocks = Array.isArray(m.message.content) ? m.message.content.filter((b) => b.type === "tool_result") : []; + for (const u of updatesOf(session, "user", blocks)) update(session.id, u); + } else if (m.type === "system" && m.subtype === "init") { + if (m.permissionMode && m.permissionMode !== session.mode) { + session.mode = m.permissionMode; + update(session.id, { sessionUpdate: "current_mode_update", currentModeId: session.mode }); + } + } else if (m.type === "result") { + finishTurn(session, m); + } + } + } catch (error) { + session.turn?.reject(error); + session.turn = null; + } + sessions.delete(session.id); +} + +async function open(params, resume) { + const id = resume ?? randomUUID(); + const extra = params._meta?.claudeCode?.options ?? {}; + const session = { id, cwd: params.cwd, inbox: new Inbox(), tools: new Map(), streamed: new Set(), turn: null, cancelled: false, mode: "default", model: "", effort: "medium", models: [] }; + session.query = query({ + prompt: session.inbox, + options: { + ...extra, + cwd: params.cwd, + pathToClaudeCodeExecutable: process.env.CLAUDE_CODE_EXECUTABLE || undefined, + mcpServers: mcpServers(params.mcpServers), + includePartialMessages: true, + // Lets the user pick Bypass permissions later; it starts in the user's own default mode. + allowDangerouslySkipPermissions: true, + canUseTool: (name, input, options) => permission(session, name, input, options), + stderr: (text) => process.stderr.write(text), + ...(resume ? { resume: id } : { sessionId: id }), + }, + }); + sessions.set(id, session); + let init; + try { + init = await session.query.initializationResult(); + } catch (error) { + sessions.delete(id); + session.query.close(); + throw error; + } + const rawModels = init.models ?? []; + session.offersAuto = rawModels.some((m) => m.supportsAutoMode); + const realModels = rawModels.filter((m) => m.value !== "default"); + session.models = realModels.length ? realModels : rawModels; + if (!session.models.some((m) => m.value === session.model) && session.models.length) session.model = session.models[0].value; + update(id, { sessionUpdate: "available_commands_update", availableCommands: (init.commands ?? []).map((c) => ({ name: c.name, description: c.description, input: c.argumentHint ? { hint: c.argumentHint } : null })) }); + pump(session); + return session; +} + +/** The summary Claude Code writes when it compacts a conversation comes back as a user message, and the SDK's + * messages carry no mark for it, so its fixed opening is the only way to tell. */ +const COMPACT_SUMMARY = "This session is being continued from a previous conversation"; + +function isCompactSummary(m) { + return m.type === "user" && typeof m.message?.content === "string" && m.message.content.startsWith(COMPACT_SUMMARY); +} + +async function replay(session) { + const messages = await getSessionMessages(session.id, { dir: session.cwd }); + for (const m of messages) { + if ((m.type !== "user" && m.type !== "assistant") || isCompactSummary(m)) continue; + // A tool's result arrives as a user message; it is not something the user said. + for (const u of updatesOf(session, m.type, m.message?.content)) update(session.id, u); + } +} + +const handlers = { + initialize: async () => ({ + protocolVersion: 1, + agentCapabilities: { loadSession: true, promptCapabilities: { image: false, embeddedContext: false }, mcpCapabilities: { http: true, sse: true }, sessionCapabilities: { list: {} } }, + authMethods: [], + }), + "session/new": async (p) => { + const s = await open(p, null); + return { sessionId: s.id, modes: modes(s), configOptions: configOptions(s) }; + }, + "session/load": async (p) => { + const s = await open(p, p.sessionId); + await replay(s); + return { modes: modes(s), configOptions: configOptions(s) }; + }, + "session/list": async (p) => { + const found = await listSessions({ dir: p.cwd }); + return { sessions: found.map((s) => ({ sessionId: s.sessionId, cwd: p.cwd, title: s.customTitle || s.summary, updatedAt: new Date(s.lastModified).toISOString() })) }; + }, + "session/prompt": async (p) => { + const s = sessions.get(p.sessionId); + if (!s) throw new Error("That session has ended."); + if (s.turn) throw new Error("A turn is already running."); + s.cancelled = false; + const text = (p.prompt ?? []).filter((c) => c.type === "text").map((c) => c.text).join("\n"); + const done = new Promise((resolve, reject) => (s.turn = { resolve, reject })); + s.inbox.push({ type: "user", message: { role: "user", content: [{ type: "text", text }] }, parent_tool_use_id: null, session_id: s.id, origin: { kind: "human" } }); + return done; + }, + "session/set_mode": async (p) => { + const s = sessions.get(p.sessionId); + await s.query.setPermissionMode(p.modeId); + s.mode = p.modeId; + update(s.id, { sessionUpdate: "current_mode_update", currentModeId: s.mode }); + return {}; + }, + "session/set_config_option": async (p) => { + const s = sessions.get(p.sessionId); + if (p.configId === "model") { + await s.query.setModel(p.value === "default" ? undefined : p.value); + s.model = p.value; + } else if (p.configId === "effort") { + await s.query.applyFlagSettings({ effortLevel: p.value === "default" ? null : p.value }); + s.effort = p.value; + } else { + throw new Error(`No setting called ${p.configId}.`); + } + return { configOptions: configOptions(s) }; + }, +}; + +function cancel(p) { + const s = sessions.get(p.sessionId); + if (!s?.turn) return; + s.cancelled = true; + s.query.interrupt().catch(() => {}); +} + +async function handle(m) { + if (m.method === undefined) { + answers.get(m.id)?.(m.result); + answers.delete(m.id); + return; + } + if (m.method === "session/cancel") return cancel(m.params ?? {}); + if (m.id === undefined) return; + const handler = handlers[m.method]; + if (!handler) return send({ id: m.id, error: { code: -32601, message: `${m.method} is not supported` } }); + try { + send({ id: m.id, result: await handler(m.params ?? {}) }); + } catch (error) { + send({ id: m.id, error: { code: -32603, message: error?.message ?? String(error) } }); + } +} + +const lines = createInterface({ input: process.stdin }); +lines.on("line", (line) => { + if (!line.trim()) return; + let message; + try { + message = JSON.parse(line); + } catch { + return; + } + handle(message); +}); +// m4code closing stdin ends every session and then this process. +lines.on("close", () => { + for (const s of sessions.values()) { + s.inbox.close(); + s.query.close(); + } + process.exit(0); +}); diff --git a/bridge/package-lock.json b/bridge/package-lock.json new file mode 100644 index 0000000..2f0b17c --- /dev/null +++ b/bridge/package-lock.json @@ -0,0 +1,153 @@ +{ + "name": "m4code-claude-bridge", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "m4code-claude-bridge", + "dependencies": { + "@anthropic-ai/claude-agent-sdk": "0.3.330" + } + }, + "node_modules/@anthropic-ai/claude-agent-sdk": { + "version": "0.3.330", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk/-/claude-agent-sdk-0.3.330.tgz", + "integrity": "sha512-7om9Xus6tfkeCUCfzg6ilJuN6Z7okkEvJ0mx+ukXa/Id5U/6BGtPkOYni+3ebedwa3b9SVF7A05+ln+/9EoU/w==", + "license": "SEE LICENSE IN README.md", + "engines": { + "node": ">=18.14.0" + }, + "optionalDependencies": { + "@anthropic-ai/claude-agent-sdk-darwin-arm64": "0.3.330", + "@anthropic-ai/claude-agent-sdk-darwin-x64": "0.3.330", + "@anthropic-ai/claude-agent-sdk-linux-arm64": "0.3.330", + "@anthropic-ai/claude-agent-sdk-linux-arm64-musl": "0.3.330", + "@anthropic-ai/claude-agent-sdk-linux-x64": "0.3.330", + "@anthropic-ai/claude-agent-sdk-linux-x64-musl": "0.3.330", + "@anthropic-ai/claude-agent-sdk-win32-arm64": "0.3.330", + "@anthropic-ai/claude-agent-sdk-win32-x64": "0.3.330" + }, + "peerDependencies": { + "@anthropic-ai/sdk": ">=0.93.0", + "@modelcontextprotocol/sdk": "^1.29.0", + "zod": "^4.0.0" + } + }, + "node_modules/@anthropic-ai/claude-agent-sdk-darwin-arm64": { + "version": "0.3.330", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-darwin-arm64/-/claude-agent-sdk-darwin-arm64-0.3.330.tgz", + "integrity": "sha512-J9nqvcfD2V90O5uoR8At66R51VYtSMKnxSmPc0S4A4F5oX1VbokcpJLXU1yVCOuTtzr/OIHjRr9nn2vKi/S6rQ==", + "cpu": [ + "arm64" + ], + "license": "SEE LICENSE IN LICENSE.md", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@anthropic-ai/claude-agent-sdk-darwin-x64": { + "version": "0.3.330", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-darwin-x64/-/claude-agent-sdk-darwin-x64-0.3.330.tgz", + "integrity": "sha512-woe+f9qeZYWML5fACibNyth0xMDf22riNRNDryIYuhdteh7IoWrK6zC31cC2MrZRoqDZcPVtfOLND79+iZbrLA==", + "cpu": [ + "x64" + ], + "license": "SEE LICENSE IN LICENSE.md", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@anthropic-ai/claude-agent-sdk-linux-arm64": { + "version": "0.3.330", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-linux-arm64/-/claude-agent-sdk-linux-arm64-0.3.330.tgz", + "integrity": "sha512-2Q+kfzaoTvJv1rsyu+iR4UHDZ3nxiOfdXISk+2ydQShU9DqXNlgQAt3BdJMh0Yx4MrxB66TMphVvVQeRslwwhA==", + "cpu": [ + "arm64" + ], + "libc": [ + "glibc" + ], + "license": "SEE LICENSE IN LICENSE.md", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@anthropic-ai/claude-agent-sdk-linux-arm64-musl": { + "version": "0.3.330", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-linux-arm64-musl/-/claude-agent-sdk-linux-arm64-musl-0.3.330.tgz", + "integrity": "sha512-fXmuAEegw31v+kiBd51yn7RVhjs7Rz2lnhfx/+XJXqt5lyqR2v7Ul/U/9r1CQZKuIw8M3ms9jQqGpmKbgKndqQ==", + "cpu": [ + "arm64" + ], + "libc": [ + "musl" + ], + "license": "SEE LICENSE IN LICENSE.md", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@anthropic-ai/claude-agent-sdk-linux-x64": { + "version": "0.3.330", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-linux-x64/-/claude-agent-sdk-linux-x64-0.3.330.tgz", + "integrity": "sha512-9w4uMdA3vNZXocwOUhivOGotXoRDxN/C/xPMkZMY9WPpKLAlj8upMZskNgPjQKlVRXhxPfNagcBijGPUH4WepA==", + "cpu": [ + "x64" + ], + "libc": [ + "glibc" + ], + "license": "SEE LICENSE IN LICENSE.md", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@anthropic-ai/claude-agent-sdk-linux-x64-musl": { + "version": "0.3.330", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-linux-x64-musl/-/claude-agent-sdk-linux-x64-musl-0.3.330.tgz", + "integrity": "sha512-kooZMdp6tFwNFkDXbGoNTZMgFcPQfJVfG+gZ2qAdkk11S6MFts9ybHRLQmzUK3VrqlahH7T9fmI2mNfzYgOXkw==", + "cpu": [ + "x64" + ], + "libc": [ + "musl" + ], + "license": "SEE LICENSE IN LICENSE.md", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@anthropic-ai/claude-agent-sdk-win32-arm64": { + "version": "0.3.330", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-win32-arm64/-/claude-agent-sdk-win32-arm64-0.3.330.tgz", + "integrity": "sha512-6jscch7vk/XBSn7mm1i6zwTeiz05q98nKrQ3HdTavQEDGvXycMcB/QxIdMrs3vrdNEjWuoxwrL1qlT1lOyAWLg==", + "cpu": [ + "arm64" + ], + "license": "SEE LICENSE IN LICENSE.md", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@anthropic-ai/claude-agent-sdk-win32-x64": { + "version": "0.3.330", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-win32-x64/-/claude-agent-sdk-win32-x64-0.3.330.tgz", + "integrity": "sha512-ooThWbUXlXKTDgj2VgWBXQ/6vSOTaAbBDWPvvCGNHi20haoSkw4uPX9gczkX+HJuVTslvvLiYIfe8zleVPzi7A==", + "cpu": [ + "x64" + ], + "license": "SEE LICENSE IN LICENSE.md", + "optional": true, + "os": [ + "win32" + ] + } + } +} diff --git a/bridge/package.json b/bridge/package.json new file mode 100644 index 0000000..3694076 --- /dev/null +++ b/bridge/package.json @@ -0,0 +1,8 @@ +{ + "name": "m4code-claude-bridge", + "private": true, + "type": "module", + "dependencies": { + "@anthropic-ai/claude-agent-sdk": "0.3.330" + } +} diff --git a/build.rs b/build.rs index 8009c83..27eab99 100644 --- a/build.rs +++ b/build.rs @@ -1,12 +1,12 @@ //! Embeds the app icon and version info into the Windows executable. fn main() { - println!("cargo:rerun-if-changed=assets/claudiu.ico"); + println!("cargo:rerun-if-changed=assets/m4code.ico"); if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("windows") { let mut res = winresource::WindowsResource::new(); - res.set_icon("assets/claudiu.ico"); - res.set("ProductName", "Claudiu"); - res.set("FileDescription", "Claudiu - Claude Code workspace"); + res.set_icon("assets/m4code.ico"); + res.set("ProductName", "m4code"); + res.set("FileDescription", "m4code - Claude Code workspace"); if let Err(e) = res.compile() { // Never fail the build over cosmetics (e.g. no resource compiler on this machine). println!("cargo:warning=could not embed icon: {e}"); diff --git a/justfile b/justfile index dd93a51..822c9df 100644 --- a/justfile +++ b/justfile @@ -1,11 +1,11 @@ -# Claudiu task runner. `just` lists the recipes. +# m4code task runner. `just` lists the recipes. set windows-shell := ["powershell.exe", "-NoLogo", "-Command"] default: @just --list -# ---- App (Rust + Rune) ---------------------------------------------------------------------------- +# ---- App (Rust + GPUI) ---------------------------------------------------------------------------- # Build the app. build: diff --git a/mod/.claude-plugin/plugin.json b/mod/.claude-plugin/plugin.json index 1133712..54339cd 100644 --- a/mod/.claude-plugin/plugin.json +++ b/mod/.claude-plugin/plugin.json @@ -1,5 +1,5 @@ { - "name": "Claudiu", + "name": "m4code", "version": "0.1.0", - "description": "Claudiu helper: applies set_model mid-turn, applies tab names, reports usage and status" + "description": "m4code helper: applies tab names, reports usage and status" } diff --git a/mod/hooks/ask.test.ts b/mod/hooks/ask.test.ts index 6a3983c..9a141b8 100644 --- a/mod/hooks/ask.test.ts +++ b/mod/hooks/ask.test.ts @@ -6,7 +6,7 @@ const usage = { input_tokens: 0, output_tokens: 0, cache_read_input_tokens: 0, c function setup($: any, on: any, request: () => string) { const clock = mock.clock(on) - mock.env(on, { CLAUDIU_ASK_FILE: 'ask/s.json' }) + mock.env(on, { M4CODE_ASK_FILE: 'ask/s.json' }) const writes: any[] = [] const asked: any[] = [] on('fs.read', () => ({ value: request() })) diff --git a/mod/hooks/ctl.test.ts b/mod/hooks/ctl.test.ts index 2f96c82..9816d16 100644 --- a/mod/hooks/ctl.test.ts +++ b/mod/hooks/ctl.test.ts @@ -1,7 +1,17 @@ import { expect, mock, test } from 'claude-code/testing' -test('applies the settings Claudiu asks for, once each, and not the ones sent before it started', async ($, on) => { - mock.env(on, { CLAUDIU_CTL_FILE: 'ctl/me.json', CLAUDIU_USAGE_DIR: 'usage' }) +test('m4code managed sessions turn off native automatic compaction', async ($, on) => { + mock.env(on, { M4CODE_MANAGED_COMPACTION: '1' }) + mock.clock(on) + const changes: any[] = [] + on('config.set', (_$, e) => { changes.push([e.key, e.value]); return { value: e.value } }) + on('session.start', (_$, e) => ({ cwd: e.cwd })) + await $.session.start({ cwd: '/repo', surface: 'terminal', isInteractive: true }) + expect(changes).toEqual([['autoCompact', false]]) +}) + +test('applies the settings m4code asks for, once each, and not the ones sent before it started', async ($, on) => { + mock.env(on, { M4CODE_CTL_FILE: 'ctl/me.json', M4CODE_USAGE_DIR: 'usage' }) const clock = mock.clock(on) let file = JSON.stringify({ cmds: [{ seq: 5, key: 'advisor', value: 'sonnet' }] }) // from an earlier run const sets: unknown[] = [] @@ -37,7 +47,7 @@ test('applies the settings Claudiu asks for, once each, and not the ones sent be { seq: 6, key: 'auto_compact', value: false }, { seq: 7, key: 'advisor', value: 'opus' }, { seq: 8, key: 'advisor', value: 'rm -rf /' }, // not a model name - { seq: 9, key: 'theme', value: 'light' }, // not a setting Claudiu sets + { seq: 9, key: 'theme', value: 'light' }, // not a setting m4code sets { seq: 10, key: 'precompute_compact', value: false }, ], }) @@ -54,8 +64,8 @@ test('applies the settings Claudiu asks for, once each, and not the ones sent be expect(sets.length + ran.length).toBe(3) // handled once }) -test('sends a message Claudiu asks for as the person’s own words, once', async ($, on) => { - mock.env(on, { CLAUDIU_CTL_FILE: 'ctl/me.json', CLAUDIU_USAGE_DIR: 'usage' }) +test('sends a message m4code asks for as the person’s own words, once', async ($, on) => { + mock.env(on, { M4CODE_CTL_FILE: 'ctl/me.json', M4CODE_USAGE_DIR: 'usage' }) const clock = mock.clock(on) let file = JSON.stringify({ cmds: [{ seq: 1, key: 'prompt', value: 'from an earlier run' }] }) const sent: unknown[] = [] diff --git a/mod/hooks/hooks.json b/mod/hooks/hooks.json index 408083a..eaaab30 100644 --- a/mod/hooks/hooks.json +++ b/mod/hooks/hooks.json @@ -1,4 +1,4 @@ { - "description": "Claudiu session helpers", + "description": "m4code session helpers", "modules": ["./register.js"] } diff --git a/mod/hooks/register.js b/mod/hooks/register.js index 59b4cf3..601a6c2 100644 --- a/mod/hooks/register.js +++ b/mod/hooks/register.js @@ -1,67 +1,55 @@ -// Loaded per process through `--plugin-dir`. Claudiu writes nothing to the user's Claude Code config. +// Loaded per process through `--plugin-dir`. m4code writes nothing to the user's Claude Code config. // // What this mod does: -// - Model and effort: answers Claudiu's `set_model` tool in-process, so the override applies from the next request, -// even mid-turn. It then runs /model and /effort once Claude Code is idle, so the session (and what /model shows) -// switches too. Claude Code saves those as the user's default. -// - Session name: applies the name Claudiu writes to `CLAUDIU_NAME_FILE` with /rename, which Claude Code queues +// - Session name: applies the name m4code writes to `M4CODE_NAME_FILE` with /rename, which Claude Code queues // until the session is idle. // - Sidebar settings: applies auto-compact, background compaction and advisor changes sent through -// `CLAUDIU_CTL_FILE`, the same as the user choosing them in /config or typing /advisor (which Claude Code saves). -// - Messages: sends a message Claudiu asks for through the same file (the editor's Ask Claude) as the user's own words, -// when the session is idle, without typing into the terminal. (Claudiu itself pastes the editor's `@file#L` +// `M4CODE_CTL_FILE`, the same as the user choosing them in /config or typing /advisor (which Claude Code saves). +// - Messages: sends a message m4code asks for through the same file (the editor's Ask Claude) as the user's own words, +// when the session is idle, without typing into the terminal. (m4code itself pastes the editor's `@file#L` // reference into Claude's input box; that is not done here.) // - Usage and status: reports context, the 5-hour and 7-day limits, auto-compact, background compaction and advisor to -// `CLAUDIU_USAGE_DIR/.json`, after each request, command and setting change. No tokens are spent. +// `M4CODE_USAGE_DIR/.json`, after each request, command and setting change. No tokens are spent. // - Cards: answers `show_visual` in-process and, while the model is still writing the call, streams its Markdown to -// `CLAUDIU_VISUAL_PREFIX.json`. Under each call it reserves rows, each with a link naming the call, and Claudiu -// paints the live card over them. Claudiu's measured height comes back in `CLAUDIU_VISUAL_PREFIX.rows`. -// - One-shot completions: runs requests from `CLAUDIU_ASK_FILE` (commit messages, session titles) with -// `$.model.complete`, on this session's own client, so Claudiu needs no `claude -p`. -// - Custom subagents: registers the provider agent types `CLAUDIU_SUBAGENTS` lists. Claude never runs for -// those agents: each turn is answered here with what the agent writes through `CLAUDIU_EXE --acp`, and its last +// `M4CODE_VISUAL_PREFIX.json`. Under each call it reserves rows, each with a link naming the call, and m4code +// paints the live card over them. m4code's measured height comes back in `M4CODE_VISUAL_PREFIX.rows`. +// - One-shot completions: runs requests from `M4CODE_ASK_FILE` (commit messages, session titles) with +// `$.model.complete`, on this session's own client, so m4code needs no `claude -p`. +// - Custom subagents: registers the provider agent types `M4CODE_SUBAGENTS` lists. Claude never runs for +// those agents: each turn is answered here with what the agent writes through `M4CODE_EXE --acp`, and its last // message is handed back with SubagentHandback. // ---- Constants ---------------------------------------------------------------------------------------------------- -// The aliases `set_model` accepts. A full `claude-…` id is accepted too. -const MODELS = { - haiku: 'claude-haiku-5-5', - sonnet: 'claude-sonnet-5-5', - opus: 'claude-opus-5-5', - fable: 'claude-fable-5-1', -} -const CARD_ROWS = 6 // reserved for a card until Claudiu has measured it -const PROMPT_MAX = 20000 // characters of a message Claudiu asks the session to send (the editor's Ask Claude) +const CARD_ROWS = 6 // reserved for a card until m4code has measured it +const PROMPT_MAX = 20000 // characters of a message m4code asks the session to send (the editor's Ask Claude) const INBOX_TEXT_MAX = 20000 // UTF-16 units, matching the ACP helper -const EFFORTS = ['low', 'medium', 'high', 'xhigh', 'max'] const ASK_MODELS = ['haiku', 'sonnet', 'opus'] -const VISUAL_TOOL = 'mcp__claudiu__show_visual' +const VISUAL_TOOL = 'mcp__m4code__show_visual' const HANDBACK_TOOL = 'SubagentHandback' const STEPS_LISTED = 30 // steps a custom subagent's report lists; the rest are only counted const STEP_CHARS = 120 // characters of each listed step, enough for a command or a path // The /config row for background compaction ("Precompute compaction"). Claude Code lists it only while a server-side -// flag enables the feature; without the row the setting does nothing, so Claudiu offers the switch only with it. +// flag enables the feature; without the row the setting does nothing, so m4code offers the switch only with it. const PRECOMPUTE_ROW = 'precomputeCompactionEnabled' // ---- Per-process state -------------------------------------------------------------------------------------------- -let want = {} // { model?, effort? } from Claudiu, applied to each turn step until Claude Code has run /model and /effort let named = null // `${claude session id}\n${name}` last applied with /rename -let namePoll // watches CLAUDIU_NAME_FILE -let ctlPoll // watches CLAUDIU_CTL_FILE +let namePoll // watches M4CODE_NAME_FILE +let ctlPoll // watches M4CODE_CTL_FILE let ctlSeen = null // highest command number handled; null until the file was first read (older ones are not replayed) let pendingAdvisor = null // an advisor change Claude Code refused (see setAdvisor), tried again until it goes through -let askPoll // watches CLAUDIU_ASK_FILE +let askPoll // watches M4CODE_ASK_FILE let askSeen = null // id of the last request looked at let asking = false // a completion is running; a poll that finds another request waits for it const cardRows = new Map() // show_visual call id -> rows reserved for its card -const AGENT_PREFIX = 'Claudiu:' // what Claude Code puts before an agent type this plugin registers -const customTypes = new Map() // agent type name -> { agent, model, edits, name } of each custom agent type Claudiu defined +const AGENT_PREFIX = 'm4code:' // what Claude Code puts before an agent type this plugin registers +const customTypes = new Map() // agent type name -> { agent, model, edits, name } of each custom agent type m4code defined const customRuns = new Map() // agent id -> { type, prompt, effort, turnId, report, steps } of each custom subagent started const agentCalls = new Map() // Agent call id -> { type, description, effort } of each running call that asked for an effort const published = new Set() // call ids whose card file this process wrote from the transcript -let rowsPoll // watches the heights Claudiu measures +let rowsPoll // watches the heights m4code measures let visualChain = Promise.resolve() // visual writes in order, without holding up the stream let lastVisual = null // id of the show_visual call being written, or last written @@ -121,12 +109,12 @@ function advisorAlias(value) { return v } -// Writes this session's usage and status report for Claudiu's sidebar. `fresh` re-reads the compaction threshold now. -// `override` carries a value Claudiu just asked for, so the sidebar updates before the host has refreshed its cache. +// Writes this session's usage and status report for m4code's sidebar. `fresh` re-reads the compaction threshold now. +// `override` carries a value m4code just asked for, so the sidebar updates before the host has refreshed its cache. // Every read is best effort: a failed one is left out, and reporting never fails a hook. async function report($, fresh = false, override = {}) { try { - const dir = await $.env.get('CLAUDIU_USAGE_DIR') + const dir = await $.env.get('M4CODE_USAGE_DIR') if (!dir) return const id = await $.session.id() if (!id) return @@ -162,7 +150,7 @@ async function report($, fresh = false, override = {}) { context_tokens: ctx?.tokens ?? null, context_window: ctx?.window ?? null, model: (await $.session.model().catch(() => null)) ?? null, - account: (await $.env.get('CLAUDIU_ACCOUNT')) ?? null, + account: (await $.env.get('M4CODE_ACCOUNT')) ?? null, auto_compact: autoCompact, precompute_compact: precomputeCompact, compact_at: await threshold($, fresh), @@ -183,11 +171,11 @@ async function report($, fresh = false, override = {}) { // ---- Sidebar commands --------------------------------------------------------------------------------------------- -// Applies what Claudiu's sidebar asked for since the last look. The file holds the latest few `{ seq, key, value }` +// Applies what m4code's sidebar asked for since the last look. The file holds the latest few `{ seq, key, value }` // commands; only known keys and plainly shaped values are acted on. async function applyCtl($) { try { - const file = await $.env.get('CLAUDIU_CTL_FILE') + const file = await $.env.get('M4CODE_CTL_FILE') if (!file) return const cmds = JSON.parse(await $.fs.read(file).catch(() => '{}')).cmds ?? [] if (ctlSeen === null) { @@ -286,7 +274,7 @@ async function answerAsk($) { let reply let id try { - const file = await $.env.get('CLAUDIU_ASK_FILE') + const file = await $.env.get('M4CODE_ASK_FILE') if (!file) return const text = await $.fs.read(file).catch(() => '') if (!text) return @@ -327,9 +315,9 @@ async function answerAsk($) { // ---- Session name ------------------------------------------------------------------------------------------------- -// Applies the name Claudiu writes to CLAUDIU_NAME_FILE with /rename: once per name and Claude session. +// Applies the name m4code writes to M4CODE_NAME_FILE with /rename: once per name and Claude session. async function watchSessionName($) { - const file = await $.env.get('CLAUDIU_NAME_FILE') + const file = await $.env.get('M4CODE_NAME_FILE') if (!file) return const read = async () => (await $.fs.read(file).catch(() => '')).trim() const key = async name => (await $.session.id()) + '\n' + name @@ -350,13 +338,13 @@ async function watchSessionName($) { // ---- Custom subagents --------------------------------------------------------------------------------------------- -// Registers the custom agent types Claudiu listed for this session (`claude/subagents.rs`); Claude Code names each -// `Claudiu:`. Interactive Claude Code ignores `claude --agents`, so this is where they are defined. A missing or +// Registers the custom agent types m4code listed for this session (`claude/subagents.rs`); Claude Code names each +// `m4code:`. Interactive Claude Code ignores `claude --agents`, so this is where they are defined. A missing or // broken list registers none. async function registerSubagents($) { customTypes.clear() - const listed = await $.env.get('CLAUDIU_SUBAGENTS') - if (!listed || !(await $.env.get('CLAUDIU_EXE'))) return + const listed = await $.env.get('M4CODE_SUBAGENTS') + if (!listed || !(await $.env.get('M4CODE_EXE'))) return let agents try { agents = JSON.parse(listed) @@ -496,10 +484,10 @@ async function* customStep($, e, next, run) { let previousKind let inbox let helperEnded = false - const exe = await $.env.get('CLAUDIU_EXE') + const exe = await $.env.get('M4CODE_EXE') const cwd = await $.session.cwd() // Read after the awaits above, by which time a spawn still finishing has noted the effort. - const request = { agent, model, effort: run.effort, edits, cwd, prompt, live_messages: true } + const request = { agent, model: model || null, effort: run.effort, edits, cwd, prompt, live_messages: true } try { for await (const event of helperEvents($, exe, request, next.signal)) { if (event.kind === 'inbox') { @@ -608,8 +596,8 @@ async function onMeasure($, e, next) { async function onCommandRun($, e, next) { const r = await next(e) // the command has run: a setting it changed is read after it - // A name the user gave with /rename is the session's now. Claudiu reads it from the transcript and writes it back to - // CLAUDIU_NAME_FILE; it is already applied, so that must not run /rename again. + // A name the user gave with /rename is the session's now. m4code reads it from the transcript and writes it back to + // M4CODE_NAME_FILE; it is already applied, so that must not run /rename again. const name = e.command === 'rename' ? e.args.trim() : '' if (name) named = (await $.session.id()) + '\n' + name await report($, true) @@ -637,73 +625,28 @@ async function noteCompaction($) { await report($, true) } -async function onSetModel($, e) { - const alias = String(e.model ?? '').trim().toLowerCase() - const model = MODELS[alias] ?? (/^claude-[a-z0-9.-]+$/.test(alias) ? alias : undefined) - const effort = String(e.effort ?? '').trim().toLowerCase() - if (e.model != null && !model) { - return { result: 'Unknown model: ' + e.model + '. Use haiku, sonnet, opus, fable or a full claude-… id.', isError: true } - } - if (e.effort != null && effort !== 'auto' && !EFFORTS.includes(effort)) { - return { result: 'Unknown effort: ' + e.effort + '. Use ' + EFFORTS.join(', ') + ' or auto.', isError: true } - } - if (!model && e.effort == null) return { result: 'Give a model, an effort, or both.', isError: true } - - if (model) want = { ...want, model } - if (e.effort != null) want = { ...want, effort: effort === 'auto' ? undefined : effort } - - // turn.step covers the rest of this turn. The session's own model and effort (what /model shows) follow once - // Claude Code is idle. A command can't run from inside a hook the turn waits on, hence the timer. - $.clock.after(0, () => { - if (model) { - $.command.run({ command: 'model', args: model }).then( - () => { if (want.model === model) want = { ...want, model: undefined } }, - () => {}, - ) - } - if (e.effort != null) { - $.command.run({ command: 'effort', args: effort }).then( - () => { if (want.effort === (effort === 'auto' ? undefined : effort)) want = { ...want, effort: undefined } }, - () => {}, - ) - } - }) - - const what = [model, e.effort != null && 'effort ' + effort].filter(Boolean).join(', ') - // Ending the turn lets the queued /model and /effort run, so the session (and /model) switch for good. - return { - result: 'Switched to ' + what + ' from your next request. Your system prompt still names the previous model; ignore that. ' + - 'Now stop: end your turn with one short line telling the user the switch is done and asking them to confirm ' + - '(or say what to do next) so the session itself switches. Do not continue the task in this turn.', - } -} - // The model's show_visual call streams to its card while it is written. The call's arguments arrive as pieces of JSON; // the Markdown read out of them so far goes to the file a few times a second at most. The tool.call hook writes the // finished card. async function onShowVisual($, e) { - const prefix = await $.env.get('CLAUDIU_VISUAL_PREFIX') + const prefix = await $.env.get('M4CODE_VISUAL_PREFIX') if (!prefix) { - return { result: "Visuals aren't available in this session (Claudiu's mod has no file for them).", isError: true } + return { result: "Visuals aren't available in this session (m4code's mod has no file for them).", isError: true } } if (typeof e.content !== 'string' || !e.content.trim()) return { result: 'content must be non-empty Markdown.', isError: true } writeVisual($, prefix, e.tool_use_id ?? lastVisual ?? 'v' + Date.now(), e.content) return { result: "Shown inline in the terminal. Say the key facts in a short reply; don't repeat the content." } } -// Applies the saved model and effort to this turn's steps, and streams a show_visual call to its card while the model -// writes it. A custom subagent's steps are answered by customStep; other subagents' steps are left alone. +// Streams a show_visual call to its card while the model writes it. A custom subagent's steps are answered by customStep; other subagents' steps are left alone. async function* onTurnStep($, e, next) { const run = e.agentId ? await customRun($, e.agentId) : undefined if (run) return yield* customStep($, e, next, run) - const step = !e.agentId && (want.model || want.effort) - ? { ...e, model: want.model ?? e.model, effort: want.effort ?? e.effort } - : e - const prefix = e.agentId ? null : await $.env.get('CLAUDIU_VISUAL_PREFIX') - if (!prefix) return yield* next(step) + const prefix = e.agentId ? null : await $.env.get('M4CODE_VISUAL_PREFIX') + if (!prefix) return yield* next(e) const open = new Map() // block index -> the show_visual call being written there - for await (const c of next(step)) { + for await (const c of next(e)) { if (c.kind === 'tool' && c.name === VISUAL_TOOL) { open.set(c.index, { id: c.id, json: '', at: 0 }) lastVisual = c.id @@ -720,7 +663,7 @@ async function* onTurnStep($, e, next) { } // Draws a show_visual call as its title and the rows its card covers. Each row's link names the call and the row, which -// is how Claudiu finds them on screen, and the rows scroll and clip with the transcript. Drawing a call from an earlier +// is how m4code finds them on screen, and the rows scroll and clip with the transcript. Drawing a call from an earlier // process writes its card again from the transcript: that is what brings cards back after a restart. async function onVisualRow($, e, next) { if (e.props.tool !== VISUAL_TOOL || e.props.isErrored) return next(e) @@ -729,11 +672,11 @@ async function onVisualRow($, e, next) { if (!cardRows.has(id)) cardRows.set(id, CARD_ROWS) if (!e.props.isRunning && !published.has(id) && e.props.input?.content) { published.add(id) - const prefix = await $.env.get('CLAUDIU_VISUAL_PREFIX') + const prefix = await $.env.get('M4CODE_VISUAL_PREFIX') if (prefix) writeVisual($, prefix, id, e.props.input.content) } const links = Array.from({ length: cardRows.get(id) }, (_, i) => - h(Link, { key: String(i), href: `claudiu://visual/${id}/${i}` }, ' '.repeat(16))) + h(Link, { key: String(i), href: `m4code://visual/${id}/${i}` }, ' '.repeat(16))) return h(Box, { flexDirection: 'column' }, h(Text, { dimColor: true }, String(e.props.input?.title ?? 'Visual')), ...links) } @@ -743,9 +686,9 @@ function onVisualGroup($, e, next) { return next({ ...e, props: { ...e.props, isExpanded: true } }) } -// Reserves the rows Claudiu measured for each card drawn in this process. +// Reserves the rows m4code measured for each card drawn in this process. async function readCardRows($) { - const prefix = await $.env.get('CLAUDIU_VISUAL_PREFIX') + const prefix = await $.env.get('M4CODE_VISUAL_PREFIX') if (!prefix) return let changed = false for (const [id, rows] of [...cardRows]) { @@ -760,6 +703,9 @@ async function readCardRows($) { async function onSessionStart($, e, next) { const r = await next(e) + if (await $.env.get('M4CODE_MANAGED_COMPACTION') === '1') { + await $.config.set({ key: 'autoCompact', value: false }).catch(() => {}) + } await report($) await applyCtl($) @@ -779,7 +725,6 @@ export function register(on) { on('command.run', onCommandRun) on('config.set', onConfigSet) on('session.compact', onSessionCompact) - on('tool.call', { tool: 'mcp__claudiu__set_model' }, onSetModel) on('tool.call', { tool: VISUAL_TOOL }, onShowVisual) on('ui.render', { component: 'ToolUse' }, onVisualRow) on('ui.render', { component: 'ToolGroup' }, onVisualGroup) diff --git a/mod/hooks/rename.test.ts b/mod/hooks/rename.test.ts index 6905256..108e637 100644 --- a/mod/hooks/rename.test.ts +++ b/mod/hooks/rename.test.ts @@ -2,7 +2,7 @@ import { expect, mock, test } from 'claude-code/testing' test('applies a changed name with /rename, never the launch name, and again after /clear', async ($, on) => { const clock = mock.clock(on) - mock.env(on, { CLAUDIU_NAME_FILE: 'names/s.txt' }) + mock.env(on, { M4CODE_NAME_FILE: 'names/s.txt' }) let name = 'Launch name' let sid = 'claude-1' const renames: string[] = [] @@ -29,9 +29,9 @@ test('applies a changed name with /rename, never the launch name, and again afte expect(renames).toEqual(['rename New name', 'rename New name']) }) -test('a name the user gave with /rename is not applied again when Claudiu writes it back', async ($, on) => { +test('a name the user gave with /rename is not applied again when m4code writes it back', async ($, on) => { const clock = mock.clock(on) - mock.env(on, { CLAUDIU_NAME_FILE: 'names/s.txt' }) + mock.env(on, { M4CODE_NAME_FILE: 'names/s.txt' }) let name = 'Launch name' const renames: string[] = [] on('fs.read', () => ({ value: name })) @@ -44,7 +44,7 @@ test('a name the user gave with /rename is not applied again when Claudiu writes await $.session.start({ cwd: '/repo', surface: 'terminal', isInteractive: true }) await $.command.run({ command: 'rename', args: ' Typed name ', origin: { kind: 'composer' }, presentation: { isFullscreen: false, columns: 80 } }) - name = 'Typed name' // Claudiu adopted it from the transcript and wrote it back + name = 'Typed name' // m4code adopted it from the transcript and wrote it back await clock.advance(3000) expect(renames).toEqual(['rename Typed name ']) }) diff --git a/mod/hooks/subagents.test.ts b/mod/hooks/subagents.test.ts index e310d72..75d7f52 100644 --- a/mod/hooks/subagents.test.ts +++ b/mod/hooks/subagents.test.ts @@ -7,10 +7,10 @@ function type(name: string, model: string) { const SUBAGENTS = JSON.stringify({ codex: { name: 'Codex', edits: false, types: [type('codex-gpt-5-5', 'gpt-5.5')] } }) -// What the engine answers beneath the mod for a session with Codex on. `helper` is what `claudiu --acp` writes; +// What the engine answers beneath the mod for a session with Codex on. `helper` is what `m4code --acp` writes; // `requests` collects what the mod sent it. function engine(on: any, helper: string[] | (() => AsyncGenerator<{ stream: string, text: string }, unknown>), requests: unknown[], subagents = SUBAGENTS) { - mock.env(on, { CLAUDIU_SUBAGENTS: subagents, CLAUDIU_EXE: '/apps/claudiu' }) + mock.env(on, { M4CODE_SUBAGENTS: subagents, M4CODE_EXE: '/apps/m4code' }) mock.clock(on) on('fs.read', () => ({ value: '' })) on('session.id', () => ({ value: 's1' })) @@ -42,6 +42,17 @@ function engine(on: any, helper: string[] | (() => AsyncGenerator<{ stream: stri return registered } +test('a default model alias works before the provider catalog arrives', async ($, on) => { + const requests: any[] = [] + const subagents = JSON.stringify({ codex: { name: 'Codex', edits: false, types: [type('codex-default', '')] } }) + engine(on, ['{"kind":"report","text":"done"}'], requests, subagents) + await $.session.start({ cwd: '/work', surface: 'terminal', isInteractive: true }) + await $.agent.spawn({ subagentType: 'm4code:codex-default', prompt: 'Find the bug' }) + await step($, 't1', 0, 'a1') + expect(requests[0].input.agent).toBe('codex') + expect(requests[0].input.model).toBe(null) +}) + // The subagent's own view streams its activity; the main conversation gets none of it, since one line per step // buried the person's own conversation. test('activity streams in the subagent and leaves the main conversation alone', async ($, on) => { @@ -56,7 +67,7 @@ test('activity streams in the subagent and leaves the main conversation alone', return { value: { code: 0, signal: null } } }, []) await $.session.start({ cwd: '/work', surface: 'terminal', isInteractive: true }) - await $.agent.spawn({ subagentType: 'Claudiu:codex-gpt-5-5', prompt: 'Find the bug' }) + await $.agent.spawn({ subagentType: 'm4code:codex-gpt-5-5', prompt: 'Find the bug' }) const chunks = await step($, 't1', 0, 'a1') expect(log).toEqual([]) @@ -117,7 +128,7 @@ test('SendMessage reaches only the running Codex helper and its reaction streams }) on('session.receive', (_$: any, e: any) => ({ text: e.text })) await $.session.start({ cwd: '/work', surface: 'terminal', isInteractive: true }) - await $.agent.spawn({ subagentType: 'Claudiu:codex-gpt-5-5', prompt: 'Find the bug' }) + await $.agent.spawn({ subagentType: 'm4code:codex-gpt-5-5', prompt: 'Find the bug' }) const running = step($, 't1', 0, 'a1').then(chunks => { finished = true; return chunks }) await ready.promise expect(await $.session.receive(messageTo('someone-else', 'Other task'))).toEqual({ text: 'Other task' }) @@ -158,12 +169,12 @@ test('a delivery racing helper exit is queued by Claude and its inbox is cleaned }) on('session.receive', (_$: any, e: any) => ({ text: e.text })) await $.session.start({ cwd: '/work', surface: 'terminal', isInteractive: true }) - await $.agent.spawn({ subagentType: 'Claudiu:codex-gpt-5-5', prompt: 'Find the bug' }) + await $.agent.spawn({ subagentType: 'm4code:codex-gpt-5-5', prompt: 'Find the bug' }) const running = step($, 't1', 0, 'a1') await ready.promise expect(await $.session.receive(messageTo('a1', 'Check one more file.'))).toEqual({ text: 'Check one more file.' }) await running - expect(cleanup).toEqual([['/apps/claudiu', '--acp', '--cleanup', INBOX_ID]]) + expect(cleanup).toEqual([['/apps/m4code', '--acp', '--cleanup', INBOX_ID]]) }) test('a Codex subagent runs the task in Codex and hands back its last message', async ($, on) => { @@ -175,12 +186,12 @@ test('a Codex subagent runs the task in Codex and hands back its last message', ], requests) await $.session.start({ cwd: '/work', surface: 'terminal', isInteractive: true }) - // Registered as Claudiu lists it; Claude Code names it Claudiu:codex-gpt-5-5. + // Registered as m4code lists it; Claude Code names it m4code:codex-gpt-5-5. expect(registered).toEqual([{ name: 'codex-gpt-5-5', description: 'Runs the task on gpt-5.5.', prompt: 'Say the mod lost track.', model: 'haiku', tools: [] }]) - await $.agent.spawn({ subagentType: 'Claudiu:codex-gpt-5-5', prompt: 'Find the bug' }) + await $.agent.spawn({ subagentType: 'm4code:codex-gpt-5-5', prompt: 'Find the bug' }) const chunks = await step($, 't1', 0, 'a1') - expect(requests).toEqual([{ argv: ['/apps/claudiu', '--acp'], input: { agent: 'codex', model: 'gpt-5.5', effort: null, edits: false, cwd: '/work/sub', prompt: 'Find the bug', live_messages: true } }]) + expect(requests).toEqual([{ argv: ['/apps/m4code', '--acp'], input: { agent: 'codex', model: 'gpt-5.5', effort: null, edits: false, cwd: '/work/sub', prompt: 'Find the bug', live_messages: true } }]) // What Codex writes and does is the agent's own text, which its transcript keeps; Claude gets only the report. const text = chunks.filter(c => c.kind === 'text').map(c => c.text).join('') expect(text).toBe('Codex on gpt-5.5, read-only\n\nLooking.\n▸ Read src/a.rs\n') @@ -217,9 +228,9 @@ test('the effort Claude asks for in its Agent call reaches Codex', async ($, on) async function agentCall(effort: string) { callId = '' spawned = gate() - const call = $.tool.call({ tool: 'Agent', subagent_type: 'Claudiu:codex-gpt-5-5', prompt: 'Find the bug', description: 'Find it', effort }) + const call = $.tool.call({ tool: 'Agent', subagent_type: 'm4code:codex-gpt-5-5', prompt: 'Find the bug', description: 'Find it', effort }) while (!callId) await new Promise(r => setTimeout(r, 1)) - await $.agent.spawn({ subagentType: 'Claudiu:codex-gpt-5-5', prompt: 'Find the bug', tool_use_id: callId } as any) + await $.agent.spawn({ subagentType: 'm4code:codex-gpt-5-5', prompt: 'Find the bug', tool_use_id: callId } as any) spawned.resolve() await call } @@ -235,14 +246,14 @@ test('the effort Claude asks for in its Agent call reaches Codex', async ($, on) test('a first turn that starts before its spawn is noted still gets the effort its Agent call asked for', async ($, on) => { const requests: any[] = [] engine(on, [JSON.stringify({ kind: 'report', text: 'Done.' })], requests) - on('agent.list', () => ({ value: [{ id: 'a1', type: 'Claudiu:codex-gpt-5-5', description: 'Find it' }] })) + on('agent.list', () => ({ value: [{ id: 'a1', type: 'm4code:codex-gpt-5-5', description: 'Find it' }] })) const finished = gate() on('tool.call', { tool: 'Agent' }, async () => { await finished.promise return { result: 'done' } }) await $.session.start({ cwd: '/work', surface: 'terminal', isInteractive: true }) - const call = $.tool.call({ tool: 'Agent', subagent_type: 'Claudiu:codex-gpt-5-5', prompt: 'Find the bug', description: 'Find it', effort: 'high' }) + const call = $.tool.call({ tool: 'Agent', subagent_type: 'm4code:codex-gpt-5-5', prompt: 'Find the bug', description: 'Find it', effort: 'high' }) // The agent's turn runs while the call does, before this module has seen its spawn. await new Promise(r => setTimeout(r, 1)) await step($, 't1', 0, 'a1') @@ -257,7 +268,7 @@ test('a report with many steps lists the first ones, each cut short', async ($, steps[1] = JSON.stringify({ kind: 'step', text: 'bash cat < c.kind === 'input').map(c => c.json).join('')).message.split('\n') expect(lines.slice(0, 6)).toEqual(['Done.', '', '---', 'Steps Codex ran (32), outside Claude Code, which counts them as 0 tool uses:', '- ' + 'x'.repeat(119) + '…', '- bash cat < ({ value: transcript })) await $.session.start({ cwd: '/work', surface: 'terminal', isInteractive: true }) - await $.agent.spawn({ subagentType: 'Claudiu:codex-gpt-5-5', prompt: 'Find the bug' }) + await $.agent.spawn({ subagentType: 'm4code:codex-gpt-5-5', prompt: 'Find the bug' }) await step($, 't1', 0, 'a1') transcript = [...FIRST_TURN, { role: 'user', text: 'Quote the line.', toolUses: [] }] - await $.agent.spawn({ subagentType: 'Claudiu:codex-gpt-5-5', prompt: 'Quote the line.' }) + await $.agent.spawn({ subagentType: 'm4code:codex-gpt-5-5', prompt: 'Quote the line.' }) await step($, 't2', 0, 'a1') expect(requests.map(r => r.input.prompt)).toEqual(['Find the bug', FOLLOW_UP]) }) @@ -293,7 +304,7 @@ test('a message to a finished subagent reaches Codex with the task and the repor test('a message to a subagent this module did not see start reaches Codex with the task and the report too', async ($, on) => { const requests: any[] = [] engine(on, [JSON.stringify({ kind: 'report', text: 'Line 1.' })], requests) - on('agent.list', () => ({ value: [{ id: 'a1', type: 'Claudiu:codex-gpt-5-5' }] })) + on('agent.list', () => ({ value: [{ id: 'a1', type: 'm4code:codex-gpt-5-5' }] })) on('session.messages', () => ({ value: [...FIRST_TURN, { role: 'user', text: 'Quote the line.', toolUses: [] }] })) await $.session.start({ cwd: '/work', surface: 'terminal', isInteractive: true }) await step($, 't2', 0, 'a1') @@ -308,7 +319,7 @@ test('an OpenCode subagent runs the task in OpenCode and names it', async ($, on }) engine(on, [JSON.stringify({ kind: 'failed', reason: 'opencode was not found on PATH. OpenCode subagents need OpenCode installed.' })], requests, subagents) await $.session.start({ cwd: '/work', surface: 'terminal', isInteractive: true }) - await $.agent.spawn({ subagentType: 'Claudiu:opencode-openai-gpt-6-1-sol', prompt: 'Find the bug' }) + await $.agent.spawn({ subagentType: 'm4code:opencode-openai-gpt-6-1-sol', prompt: 'Find the bug' }) const chunks = await step($, 't1', 0, 'a1') expect(requests.map(r => r.input)).toEqual([{ agent: 'opencode', model: 'openai/gpt-6.1-sol', effort: null, edits: true, cwd: '/work/sub', prompt: 'Find the bug', live_messages: true }]) @@ -317,14 +328,14 @@ test('an OpenCode subagent runs the task in OpenCode and names it', async ($, on expect(input.message).toBe('OpenCode failed: opencode was not found on PATH. OpenCode subagents need OpenCode installed.\n\n---\nOpenCode ran no steps.') }) -test('Antigravity uses the display name supplied by Claudiu', async ($, on) => { +test('Antigravity uses the display name supplied by m4code', async ($, on) => { const requests: any[] = [] const registered = engine(on, [JSON.stringify({ kind: 'report', text: 'Done.' })], requests, JSON.stringify({ antigravity: { name: 'Antigravity', edits: false, types: [type('antigravity-gemini-4-neon', 'gemini-4-neon')] }, })) await $.session.start({ cwd: '/work', surface: 'terminal', isInteractive: true }) expect(registered.map(r => r.name)).toEqual(['antigravity-gemini-4-neon']) - await $.agent.spawn({ subagentType: 'Claudiu:antigravity-gemini-4-neon', prompt: 'Find the bug' }) + await $.agent.spawn({ subagentType: 'm4code:antigravity-gemini-4-neon', prompt: 'Find the bug' }) const chunks = await step($, 't1', 0, 'a1') expect(requests[0].input.agent).toBe('antigravity') expect(chunks.filter(c => c.kind === 'text').map(c => c.text).join('')).toBe('Antigravity on gemini-4-neon, read-only\n\n') @@ -336,7 +347,7 @@ test('a provider without a display name falls back to its key', async ($, on) => fourth: { edits: false, types: [type('fourth-model', 'model')] }, })) await $.session.start({ cwd: '/work', surface: 'terminal', isInteractive: true }) - await $.agent.spawn({ subagentType: 'Claudiu:fourth-model', prompt: 'Find the bug' }) + await $.agent.spawn({ subagentType: 'm4code:fourth-model', prompt: 'Find the bug' }) const chunks = await step($, 't1', 0, 'a1') expect(chunks.filter(c => c.kind === 'text').map(c => c.text).join('')).toBe('fourth on model, read-only\n\n') expect(JSON.parse(chunks.find(c => c.kind === 'input').json).message).toContain('fourth ran no steps.') @@ -345,7 +356,7 @@ test('a provider without a display name falls back to its key', async ($, on) => test('a failure is handed back as the report', async ($, on) => { engine(on, [JSON.stringify({ kind: 'failed', reason: "Codex isn't signed in. Run `codex login`, then try again." })], []) await $.session.start({ cwd: '/work', surface: 'terminal', isInteractive: true }) - await $.agent.spawn({ subagentType: 'Claudiu:codex-gpt-5-5', prompt: 'Find the bug' }) + await $.agent.spawn({ subagentType: 'm4code:codex-gpt-5-5', prompt: 'Find the bug' }) const chunks = await step($, 't1', 0, 'a1') const input = JSON.parse(chunks.filter(c => c.kind === 'input').map(c => c.json).join('')) expect(input.message).toBe("Codex failed: Codex isn't signed in. Run `codex login`, then try again.\n\n---\nCodex ran no steps.") @@ -354,7 +365,7 @@ test('a failure is handed back as the report', async ($, on) => { test('a helper that ends without an answer is a failure too', async ($, on) => { engine(on, ['not json', '{"kind":"thought"}', '{"kind":"report","text":null}'], []) await $.session.start({ cwd: '/work', surface: 'terminal', isInteractive: true }) - await $.agent.spawn({ subagentType: 'Claudiu:codex-gpt-5-5', prompt: 'Find the bug' }) + await $.agent.spawn({ subagentType: 'm4code:codex-gpt-5-5', prompt: 'Find the bug' }) const chunks = await step($, 't1', 0, 'a1') const input = JSON.parse(chunks.filter(c => c.kind === 'input').map(c => c.json).join('')) expect(input.message).toBe('Codex failed: the helper stopped without an answer.\n\n---\nCodex ran no steps.') @@ -370,12 +381,12 @@ test('other subagents still run on Claude', async ($, on) => { expect(requests).toEqual([]) }) -test('without a list from Claudiu, nothing is registered and an agent named like a Codex type still runs on Claude', async ($, on) => { +test('without a list from m4code, nothing is registered and an agent named like a Codex type still runs on Claude', async ($, on) => { const requests: unknown[] = [] const registered = engine(on, [], requests, '') // an empty list reads as none, like a missing one await $.session.start({ cwd: '/work', surface: 'terminal', isInteractive: true }) expect(registered).toEqual([]) - await $.agent.spawn({ subagentType: 'Claudiu:codex-gpt-5-5', prompt: 'Find the bug' }) + await $.agent.spawn({ subagentType: 'm4code:codex-gpt-5-5', prompt: 'Find the bug' }) const chunks = await step($, 't1', 0, 'a1') expect(chunks.map(c => c.kind)).toEqual(['text']) expect(requests).toEqual([]) diff --git a/mod/hooks/usage.test.ts b/mod/hooks/usage.test.ts index 639dbf5..f9f4f26 100644 --- a/mod/hooks/usage.test.ts +++ b/mod/hooks/usage.test.ts @@ -1,7 +1,7 @@ import { expect, mock, test } from 'claude-code/testing' test('reports context, limits, auto-compact and advisor; rewrites only on change', async ($, on) => { - mock.env(on, { CLAUDIU_USAGE_DIR: 'usage', CLAUDIU_ACCOUNT: 'work' }) + mock.env(on, { M4CODE_USAGE_DIR: 'usage', M4CODE_ACCOUNT: 'work' }) let advisor: string | undefined = 'opus' const writes: { path: string; snap: any }[] = [] on('fs.write', (_$, e) => { @@ -10,7 +10,7 @@ test('reports context, limits, auto-compact and advisor; rewrites only on change }) on('session.id', () => ({ value: 'abc/123' })) on('session.model', () => ({ value: 'claude-haiku-5-5' })) - on('config.list', () => ({ value: [{ key: 'autoCompact', label: 'Auto-compact', kind: 'boolean', value: true, provider: { plugin: 'Claudiu', tier: 'user' }, isLocked: false }] })) + on('config.list', () => ({ value: [{ key: 'autoCompact', label: 'Auto-compact', kind: 'boolean', value: true, provider: { plugin: 'm4code', tier: 'user' }, isLocked: false }] })) on('settings.read', () => ({ value: { advisorModel: advisor } })) let compactAt: number | undefined = 167_000 on('session.usage', () => ({ @@ -64,7 +64,7 @@ test('reports context, limits, auto-compact and advisor; rewrites only on change test('reports the auto-compact threshold of the model the session switched to', async ($, on) => { // Each model has its own compaction window, so a cached threshold must not outlive a model change. - mock.env(on, { CLAUDIU_USAGE_DIR: 'usage' }) + mock.env(on, { M4CODE_USAGE_DIR: 'usage' }) let model = 'claude-sonnet-5-5' const windows: Record = { 'claude-sonnet-5-5': 367_000, 'claude-haiku-5-5': 67_000 } const writes: any[] = [] diff --git a/mod/hooks/visual.test.ts b/mod/hooks/visual.test.ts index 404d77d..72d953b 100644 --- a/mod/hooks/visual.test.ts +++ b/mod/hooks/visual.test.ts @@ -1,10 +1,10 @@ import { expect, mock, test } from 'claude-code/testing' -const TOOL = 'mcp__claudiu__show_visual' +const TOOL = 'mcp__m4code__show_visual' const STEP = { turnId: 't', index: 0, answer: '', toolUses: [], stopReason: 'tool_use' as const, usage: null } test('streams the Markdown of a show_visual call while it is written, then writes the finished card', async ($, on) => { - mock.env(on, { CLAUDIU_VISUAL_PREFIX: 'visual/s--' }) + mock.env(on, { M4CODE_VISUAL_PREFIX: 'visual/s--' }) const writes: { path: string; card: any }[] = [] on('fs.write', (_$, e) => { writes.push({ path: e.path, card: JSON.parse(e.text) }) @@ -32,15 +32,15 @@ test('streams the Markdown of a show_visual call while it is written, then write expect(writes.at(-1)!.card).toEqual({ call: 'toolu_1', content: '# Hi\n\nsome **bold** é' }) }) -test('refuses an empty card and says so when Claudiu gave no file', async ($, on) => { - mock.env(on, { CLAUDIU_VISUAL_PREFIX: 'visual/s--' }) +test('refuses an empty card and says so when m4code gave no file', async ($, on) => { + mock.env(on, { M4CODE_VISUAL_PREFIX: 'visual/s--' }) on('fs.write', () => ({ value: undefined })) const empty = await $.tool.call({ tool: TOOL, tool_use_id: 'x', content: ' ' }) expect(empty.isError).toBe(true) }) test('other tools and subagents are not streamed', async ($, on) => { - mock.env(on, { CLAUDIU_VISUAL_PREFIX: 'visual/s--' }) + mock.env(on, { M4CODE_VISUAL_PREFIX: 'visual/s--' }) let writes = 0 on('fs.write', () => { writes += 1 @@ -57,10 +57,10 @@ test('other tools and subagents are not streamed', async ($, on) => { }) const ROW = { tool: TOOL, tool_use_id: 'toolu_9', input: { title: 'Plan', content: '# Old card' }, isRunning: false, isErrored: false, isInterrupted: false } -const MOUNT = { plugin: 'Claudiu', surface: 'terminal' as const, component: 'ToolUse' as const, requestId: 'toolu_9', props: ROW } +const MOUNT = { plugin: 'm4code', surface: 'terminal' as const, component: 'ToolUse' as const, requestId: 'toolu_9', props: ROW } test('a drawn call reserves linked rows and writes its card back from the transcript', async ($, on) => { - mock.env(on, { CLAUDIU_VISUAL_PREFIX: 'visual/s--' }) + mock.env(on, { M4CODE_VISUAL_PREFIX: 'visual/s--' }) const writes: { path: string; text: string }[] = [] on('fs.write', (_$, e) => { writes.push({ path: e.path, text: e.text }) @@ -68,7 +68,7 @@ test('a drawn call reserves linked rows and writes its card back from the transc }) const ui = await $.ui.mount(MOUNT) const link = await ui.find({ type: 'Link' }) - expect(link?.props?.href).toBe('claudiu://visual/toolu_9/0') + expect(link?.props?.href).toBe('m4code://visual/toolu_9/0') expect((await ui.find({ type: 'Text', text: /Plan/ }))?.text).toBe('Plan') await ui.unmount() await new Promise(done => setTimeout(done, 10)) diff --git a/scripts/make-icns.sh b/scripts/make-icns.sh index 0984b11..1df2de0 100755 --- a/scripts/make-icns.sh +++ b/scripts/make-icns.sh @@ -1,10 +1,10 @@ #!/bin/sh -# macOS only: build assets/claudiu.icns from assets/claudiu.png (sips + iconutil ship with macOS). +# macOS only: build assets/m4code.icns from assets/m4code.png (sips + iconutil ship with macOS). set -e -set="$(mktemp -d)/claudiu.iconset" +set="$(mktemp -d)/m4code.iconset" mkdir -p "$set" for s in 16 32 128 256 512; do - sips -z $s $s assets/claudiu.png --out "$set/icon_${s}x${s}.png" >/dev/null - sips -z $((s * 2)) $((s * 2)) assets/claudiu.png --out "$set/icon_${s}x${s}@2x.png" >/dev/null + sips -z $s $s assets/m4code.png --out "$set/icon_${s}x${s}.png" >/dev/null + sips -z $((s * 2)) $((s * 2)) assets/m4code.png --out "$set/icon_${s}x${s}@2x.png" >/dev/null done -iconutil -c icns "$set" -o "${1:-dist/claudiu.icns}" +iconutil -c icns "$set" -o "${1:-dist/m4code.icns}" diff --git a/scripts/make-icon.ps1 b/scripts/make-icon.ps1 index ad02820..0471c7a 100644 --- a/scripts/make-icon.ps1 +++ b/scripts/make-icon.ps1 @@ -1,51 +1,47 @@ -# Generates assets/claudiu.png and assets/claudiu.ico (the Clawd-style mark on the app's black). -# Windows PowerShell + System.Drawing only. Re-run after changing the pattern or colors. +# Generates assets/m4code.png (512x512) and assets/m4code.ico from the `` mark. +# Windows PowerShell + System.Drawing only. Mirrors web/public/m4code.svg. Add-Type -AssemblyName System.Drawing $root = Split-Path $PSScriptRoot $assets = Join-Path $root "assets" New-Item -ItemType Directory -Force $assets | Out-Null -$pattern = @( - "..#######..", - "..#o###o#..", - "###o###o###", - "###########", - "..#######..", - "..#.#.#.#..", - "..#.#.#.#.." -) -$orange = [System.Drawing.Color]::FromArgb(255, 0xd9, 0x77, 0x57) -$eye = [System.Drawing.Color]::FromArgb(255, 0x1a, 0x0f, 0x0b) -$bg = [System.Drawing.Color]::FromArgb(255, 0x0c, 0x0c, 0x0d) +$fg = [System.Drawing.Color]::FromArgb(255, 0xff, 0xff, 0xff) +$bg = [System.Drawing.Color]::FromArgb(255, 0x12, 0x12, 0x12) function New-Icon([int]$size) { $bmp = New-Object System.Drawing.Bitmap $size, $size $g = [System.Drawing.Graphics]::FromImage($bmp) $g.SmoothingMode = 'AntiAlias' $g.Clear([System.Drawing.Color]::Transparent) + $scale = $size / 512.0 # rounded black tile - $r = [int]($size * 0.22) + $r = [float](112.0 * $scale) $path = New-Object System.Drawing.Drawing2D.GraphicsPath $path.AddArc(0, 0, 2 * $r, 2 * $r, 180, 90) - $path.AddArc($size - 2 * $r - 1, 0, 2 * $r, 2 * $r, 270, 90) - $path.AddArc($size - 2 * $r - 1, $size - 2 * $r - 1, 2 * $r, 2 * $r, 0, 90) - $path.AddArc(0, $size - 2 * $r - 1, 2 * $r, 2 * $r, 90, 90) + $path.AddArc($size - 2 * $r, 0, 2 * $r, 2 * $r, 270, 90) + $path.AddArc($size - 2 * $r, $size - 2 * $r, 2 * $r, 2 * $r, 0, 90) + $path.AddArc(0, $size - 2 * $r, 2 * $r, 2 * $r, 90, 90) $path.CloseFigure() $g.FillPath((New-Object System.Drawing.SolidBrush $bg), $path) - # pixel mark, pixel-aligned (no smoothing so edges stay crisp) - $g.SmoothingMode = 'None' - $g.PixelOffsetMode = 'Half' - $unit = [Math]::Max(1, [Math]::Floor($size * 0.70 / 11)) - $w = $unit * 11; $h = $unit * 7 - $ox = [int](($size - $w) / 2); $oy = [int](($size - $h) / 2) - [int]($unit * 0.2) - for ($y = 0; $y -lt 7; $y++) { - for ($x = 0; $x -lt 11; $x++) { - $c = $pattern[$y][$x] - if ($c -eq '.') { continue } - $brush = New-Object System.Drawing.SolidBrush ($(if ($c -eq 'o') { $eye } else { $orange })) - $g.FillRectangle($brush, $ox + $x * $unit, $oy + $y * $unit, $unit, $unit) - } - } + # `` strokes in 512x512 coordinates + $g.ScaleTransform($scale, $scale) + $pen = New-Object System.Drawing.Pen $fg, 24.0 + $pen.StartCap = 'Round'; $pen.EndCap = 'Round'; $pen.LineJoin = 'Round' + $g.DrawLines($pen, [System.Drawing.PointF[]]@([System.Drawing.PointF]::new(94, 206), [System.Drawing.PointF]::new(48, 256), [System.Drawing.PointF]::new(94, 306))) + $g.DrawLine($pen, 122, 306, 122, 214) + $m1 = New-Object System.Drawing.Drawing2D.GraphicsPath + $m1.AddBezier(122, 246, 122, 222, 135, 214, 148, 214) + $m1.AddBezier(148, 214, 164, 214, 174, 226, 174, 246) + $m1.AddLine(174, 246, 174, 306) + $g.DrawPath($pen, $m1) + $m2 = New-Object System.Drawing.Drawing2D.GraphicsPath + $m2.AddBezier(174, 246, 174, 222, 187, 214, 200, 214) + $m2.AddBezier(200, 214, 216, 214, 226, 226, 226, 246) + $m2.AddLine(226, 246, 226, 306) + $g.DrawPath($pen, $m2) + $g.DrawLines($pen, [System.Drawing.PointF[]]@([System.Drawing.PointF]::new(308, 306), [System.Drawing.PointF]::new(308, 198), [System.Drawing.PointF]::new(254, 274), [System.Drawing.PointF]::new(324, 274))) + $g.DrawLine($pen, 380, 198, 352, 314) + $g.DrawLines($pen, [System.Drawing.PointF[]]@([System.Drawing.PointF]::new(418, 206), [System.Drawing.PointF]::new(464, 256), [System.Drawing.PointF]::new(418, 306))) $g.Dispose() return $bmp } @@ -57,9 +53,11 @@ foreach ($s in $sizes) { $ms = New-Object System.IO.MemoryStream $bmp.Save($ms, [System.Drawing.Imaging.ImageFormat]::Png) $pngs += , $ms.ToArray() - if ($s -eq 256) { $bmp.Save((Join-Path $assets "claudiu.png"), [System.Drawing.Imaging.ImageFormat]::Png) } $bmp.Dispose() } +$big = New-Icon 512 +$big.Save((Join-Path $assets "m4code.png"), [System.Drawing.Imaging.ImageFormat]::Png) +$big.Dispose() # ICO container with PNG-compressed images $out = New-Object System.IO.MemoryStream @@ -76,5 +74,5 @@ for ($i = 0; $i -lt $sizes.Count; $i++) { $offset += $pngs[$i].Length } foreach ($p in $pngs) { $bw.Write($p) } -[System.IO.File]::WriteAllBytes((Join-Path $assets "claudiu.ico"), $out.ToArray()) -Write-Output "Wrote assets/claudiu.ico and assets/claudiu.png" +[System.IO.File]::WriteAllBytes((Join-Path $assets "m4code.ico"), $out.ToArray()) +Write-Output "Wrote assets/m4code.ico and assets/m4code.png" diff --git a/scripts/package.ps1 b/scripts/package.ps1 index 0ffbd9a..998ad3f 100644 --- a/scripts/package.ps1 +++ b/scripts/package.ps1 @@ -11,7 +11,7 @@ Set-Location $root if (-not $Version) { $Version = (Select-String -Path Cargo.toml -Pattern '^version\s*=\s*"([^"]+)"' | Select-Object -First 1).Matches[0].Groups[1].Value } -Write-Host "Packing Claudiu $Version" +Write-Host "Packing m4code $Version" cargo build --release if ($LASTEXITCODE -ne 0) { throw "cargo build failed" } @@ -19,17 +19,17 @@ if ($LASTEXITCODE -ne 0) { throw "cargo build failed" } $publish = Join-Path $root "dist\publish" Remove-Item $publish -Recurse -Force -ErrorAction SilentlyContinue New-Item -ItemType Directory -Force $publish | Out-Null -Copy-Item target\release\claudiu.exe $publish +Copy-Item target\release\m4code.exe $publish vpk pack ` - --packId Claudiu ` + --packId m4code ` --packVersion $Version ` --packDir $publish ` - --mainExe claudiu.exe ` - --packTitle "Claudiu" ` - --packAuthors "Claudiu" ` - --icon assets\claudiu.ico ` + --mainExe m4code.exe ` + --packTitle "m4code" ` + --packAuthors "m4code" ` + --icon assets\m4code.ico ` --outputDir dist\releases if ($LASTEXITCODE -ne 0) { throw "vpk pack failed" } -Write-Host "Done. Installer: dist\releases\Claudiu-win-Setup.exe" +Write-Host "Done. Installer: dist\releases\m4code-win-Setup.exe" diff --git a/src/app/act.rs b/src/app/act.rs new file mode 100644 index 0000000..97d3b01 --- /dev/null +++ b/src/app/act.rs @@ -0,0 +1,603 @@ +//! `Act`: every operation a button, menu, shortcut or click can trigger, and `Workspace::act`, which runs one. +//! The work itself is in the topic files next to this one; `act` only routes to it. + +use super::*; + +/// Every user-triggerable operation, so buttons, menus and shortcuts share one code path. +#[derive(Clone, Debug)] +pub enum Act { + NewClaude { + cwd: PathBuf, + }, + /// Make a worktree named `name` (random when blank) straight from the Branch & Worktree dialog: chosen for the + /// Welcome screen's next session (`for_home`), or the shown session moves into it. + QuickWorktree { main_checkout: PathBuf, name: String, base: Base, for_home: bool }, + CreateHomeWorktree { + main_checkout: PathBuf, + folder: PathBuf, + base: Base, + }, + /// Move the shown session into this working tree of its project (`base` is for a worktree that does not exist yet). + SwitchWorktree { + folder: PathBuf, + base: Base, + }, + /// `SwitchWorktree`, after the user agreed to leave uncommitted files behind. + ConfirmSwitch { + id: Id, + folder: PathBuf, + base: Base, + }, + /// Ask before removing a worktree. A running session in it refuses. + RemoveWorktree { + main_checkout: PathBuf, + folder: PathBuf, + }, + ConfirmRemoveWorktree { + main_checkout: PathBuf, + folder: PathBuf, + discard: bool, + }, + /// Ask before deleting a folder in m4code's worktrees folder that git no longer lists. + AskDeleteUnlisted(PathBuf), + ConfirmDeleteUnlisted(PathBuf), + /// Show or hide the shell under a Claude session's terminal (started on first use, in the session's folder). + ToggleShell(Id), + /// Return to the Welcome / New session launcher screen. + HomeSelectProject(Id), + HomeSelectWorktree(PathBuf), + HomeSelectModel(crate::harness::CatalogModel), + HomeSetEffort(Effort), + HomeLaunch, + /// List the default agent's sessions in a folder, to pick one up here. + ListSessions { cwd: PathBuf }, + /// Open a session an agent listed. + PickUp { harness: Harness, cwd: PathBuf, session_id: String, title: Option }, + /// Turn editor mode on or off for the shown session (see `editor_mode.rs`). + ToggleEditor, + /// Click on a session row: live -> show it, history -> resume it. + Select(Id), + Resume(Id), + CloseLive(Id), + /// End the session although its editor has unsaved files (the user confirmed). + ConfirmCloseLive(Id), + /// Close an editor tab and drop its unsaved edits (the user confirmed). + DiscardTab(Id, PathBuf), + Rename(Id), + /// Hide (true) or restore (false) a session in the sidebar. Archived sessions still turn up in search. + Archive(Id, bool), + CopyText(String), + Reveal(PathBuf), + OpenEditor(Editor, PathBuf), + ImportProject, + OpenSettings, + /// The setup window again, from Settings or the missing-`claude` toast (see `setup.rs`). + OpenSetup, + /// A choice in the Settings dialog's default-model, effort, or permission-mode picker; kept in the dialog until Save. + PickDefaultModel(crate::harness::CatalogModel), + PickEffort(Effort), + PickPermission(String), + /// The project's GitHub issues and pull requests. + OpenGithub { + cwd: PathBuf, + }, + /// Have the running session's own mod (Haiku) write a new title from what was said in it. + RegenTitle(Id), + /// Change a setting of a running session through its mod (see `usage::send_ctl`). + SetAutoCompact(Id, bool), + SetPrecomputeCompact(Id, bool), + /// Filter the sidebar list to a project (`None`: all). + FilterProject(Option), + /// Stage everything in this folder's repository, commit it with a message the running session's mod (Haiku) writes, push. + CommitPush(Id, PathBuf), + Pull(PathBuf), + SwitchBranch(PathBuf, String), + /// Read what deleting the local branch would lose, then ask. + DeleteBranch(PathBuf, String), + ConfirmDeleteBranch(PathBuf, String), + /// Ask for a name, then `CreateBranch`. + NewBranch(PathBuf), + CreateBranch(PathBuf, String), + /// New Claude session (Sonnet 5.5, medium effort) that resolves a failed pull / push in this repository. + FixGitWithClaude(PathBuf), + AddProject(PathBuf), + RemoveProject(Id), + /// Undo a removal: the project, back where it was in the list. + RestoreProject(usize, Project), + /// Start renaming a project on the Projects page of Settings. + RenameProject(Id), + SaveProjectName, + CancelProjectRename, + /// Move a project one place up (true) or down the list. + MoveProject(Id, bool), + ToggleRecent, + /// The Check now button in Settings. + CheckForUpdates, + ConfirmQuit, + ConfirmInstallUpdate, + Dismiss, + InstallUpdate, + /// New sessions start with this account; running ones keep theirs. + SwitchAccount(Id), + /// The shown session runs under another account: restart it under the active one (asks first, see `handoff.rs`). + Handoff, + ConfirmHandoff(Id), + /// Shows the sharing warning, then `ConfirmAddAccount`. + AddAccount, + ConfirmAddAccount, + /// Run `claude auth login` for an alt account in a terminal tab. + SignIn(Id), + RemoveAccount(Id), + ConfirmRemoveAccount(Id), + /// Editor mode's file tree: ask for a file name (new or renamed), ask before deleting, delete. + AskFileName(Id, NameFor), + AskDelete(Id, PathBuf), + ConfirmDelete(Id, PathBuf), + /// An entry of the editor's right-click menu. + Editor(EditorCommand), + /// Settings → Skills (`skills.sh` browser, installer and global/per-project toggles). + SetSkillsTab(SkillsTab), + SetSkillScope(SkillScope), + SearchSkills, + InstallSkill(crate::skills::registry::CatalogEntry), + InstallSkillRepo(String), + ToggleSkill(String), + UninstallSkill(String), + /// Download the latest version of these installed skills (one, one repository's, or all). + UpdateSkills(Vec), +} + +impl Workspace { + pub fn act(&mut self, act: Act, window: &mut Window, cx: &mut Context) { + self.menu = None; + // Dragging the effort slider inside the Home model picker keeps that dialog open. + // A pick made in a dropdown hands the keyboard back to the message box under it; an act that opens + // something else moves focus on from there. + if !matches!(act, Act::HomeSetEffort(_)) && self.picker.take().is_some() && self.modal.is_none() { + self.focus_active(window, cx); + } + match act { + Act::NewClaude { cwd } => self.new_claude(cwd, window, cx), + Act::QuickWorktree { main_checkout, name, base, for_home } => match worktrees::new_worktree_act(&main_checkout, &name, base, for_home) { + Ok(act) => { + self.picker = None; + self.act(act, window, cx); + } + Err(why) => self.toast(why, true, cx), + }, + Act::CreateHomeWorktree { main_checkout, folder, base } => self.create_home_worktree(main_checkout, folder, base, window, cx), + Act::SwitchWorktree { folder, base } => self.switch_shown(folder, base, false, window, cx), + Act::ConfirmSwitch { id, folder, base } => { + self.modal = None; + self.switch_session(id, folder, base, true, window, cx) + } + Act::RemoveWorktree { main_checkout, folder } => self.ask_remove_worktree(main_checkout, folder, cx), + Act::AskDeleteUnlisted(folder) => self.ask_delete_unlisted(folder, cx), + Act::ConfirmDeleteUnlisted(folder) => { + self.worktrees_page.asking = None; + self.run_git(GitOp::Worktree, move || Ok(crate::git::worktree::delete_unlisted(&folder)?), cx); + } + Act::ConfirmRemoveWorktree { main_checkout, folder, discard } => { + self.worktrees_page.asking = None; + self.run_git( + GitOp::Worktree, + move || Ok(crate::git::worktree::remove(&main_checkout, &folder, discard, Duration::from_secs(10))?), + cx, + ); + } + Act::ToggleShell(id) => self.toggle_shell(&id, window, cx), + Act::HomeSelectProject(id) => { + self.home.project = Some(id); + self.home.worktree = None; + } + Act::HomeSelectWorktree(path) => { + self.home.worktree = Some(path); + } + Act::HomeSelectModel(model) => { + self.home.model = Some(model); + } + Act::HomeSetEffort(effort) => { + self.home.effort = effort; + } + Act::HomeLaunch if !crate::panels::composer::can_send(self.home.prompt.read(cx).value().as_ref()) => {} + Act::HomeLaunch if self.home.creating.is_some() => { + // The worktree is on its way; the session starts in it as soon as git is done. + self.home.launch_when_created = true; + } + Act::HomeLaunch => { + let cwd = self.home_target_cwd(); + let chosen = self.home_selected_model(); + let effort = self.home.effort; + let text = self.home.prompt.read(cx).value().trim().to_string(); + let prompt = (!text.is_empty()).then_some(text); + if prompt.is_some() { + self.home.prompt.update(cx, |p, cx| p.set_value("", window, cx)); + } + let model = (!chosen.id.is_empty()).then_some(chosen.id); + self.new_session_from_home(chosen.harness, model, cwd, prompt, Some(effort), window, cx); + } + Act::ListSessions { cwd } => self.list_sessions(cwd, window.mouse_position(), cx), + Act::PickUp { harness, cwd, session_id, title } => self.pick_up(harness, cwd, session_id, title, window, cx), + Act::ToggleEditor => self.toggle_editor(window, cx), + Act::Editor(command) => self.run_editor_command(command, window, cx), + Act::Select(id) => self.show_session(&id, window, cx), + Act::Resume(id) => self.resume(&id, window, cx), + Act::CloseLive(id) => self.request_close_live(&id, window, cx), + Act::ConfirmCloseLive(id) => { + self.modal = None; + self.close_live(&id, window, cx) + } + Act::DiscardTab(id, path) => { + self.modal = None; + if let Some(ix) = self.panes.get(&id).and_then(|p| p.tabs.iter().position(|t| t.path == path)) { + self.close_tab(&id, ix, cx); + } + } + Act::Rename(id) => { + let text = self + .store + .session(&id) + .map(|s| s.display_title().to_string()) + .unwrap_or_default(); + let input = self.modal_input(&text, "", window, cx); + self.modal = Some(Modal::Rename { id, input }); + } + Act::Archive(id, archive) => { + if let Some(rec) = self.store.session_mut(&id) { + rec.hidden = archive; + } + if archive && self.selected.as_deref() == Some(id.as_str()) { + self.selected = None; + } + if archive { + self.toast("Archived. Search still finds it; the Claude transcript was not touched.", false, cx); + } + } + Act::CopyText(text) => { + cx.write_to_clipboard(ClipboardItem::new_string(text)); + self.toast("Copied", false, cx); + } + Act::Reveal(path) => cx.reveal_path(&path), + Act::OpenEditor(editor, path) => { + // The last editor used becomes the "Open in" default. + if self.store.data.settings.editor != Some(editor) { + self.store.data.settings.editor = Some(editor); + self.store.mark_dirty(); + } + if let Err(e) = editor.open(&path) { + self.toast(e, true, cx); + } + } + Act::ImportProject => self.import_project(window, cx), + Act::OpenGithub { cwd } => { + // GitHub opens in the right sidebar, which editor mode hides. + self.editor_mode = false; + self.open_github(cwd, window, cx) + } + Act::RegenTitle(id) => self.regen_title(&id, cx), + Act::CommitPush(_id, cwd) => { + self.run_git( + GitOp::CommitPush, + move || { + crate::git::commit::commit_and_push(&|_system, prompt| Ok(summarize_commit_diff(prompt)), &cwd) + .map_err(|e| crate::git::commit::classify(&cwd, e)) + }, + cx, + ) + } + Act::Pull(cwd) => self.run_git( + GitOp::Pull, + move || crate::git::commit::pull(&cwd).map_err(|e| crate::git::commit::classify(&cwd, e)), + cx, + ), + Act::SwitchBranch(cwd, name) => { + self.run_git(GitOp::Branch, move || Ok(crate::git::commit::switch_branch(&cwd, &name)?), cx) + } + Act::DeleteBranch(cwd, name) => self.ask_delete_branch(cwd, name, cx), + Act::ConfirmDeleteBranch(cwd, name) => { + self.run_git(GitOp::Branch, move || Ok(crate::git::commit::delete_branch(&cwd, &name)?), cx) + } + Act::FixGitWithClaude(cwd) => { + let prompt = "m4code's Pull or Commit & Push just failed in this repository because of a merge conflict, a diverged branch or a rejected push. Run git status, fix it (resolve conflicts keeping the intent of both sides, finish the merge or rebase, then push if the push was rejected). Ask me whenever a conflict is ambiguous or you are unsure which side to keep."; + match self.running_claude_in(&cwd, cx) { + Some(id) => self.send_to_claude(&id, prompt, window, cx), + None => { + // No session to ask: a short-lived one on medium effort (mid-sized Claude model when on Claude). + let mut options = vec![("thought_level", "medium".to_string())]; + if self.store.data.settings.harness == Harness::Claude { + options.push(("model", "claude-sonnet-5-5".to_string())); + } + let before = self.selected.clone(); + self.new_claude_with(cwd, Some(prompt.to_string()), options, Starter::FixGit, window, cx); + if self.selected != before + && let Some(id) = self.selected.clone() { + self.ephemeral.insert(id); + } + } + } + } + Act::OpenSetup => self.open_setup(window, cx), + Act::OpenSettings => { + let s = &self.store.data.settings; + let (shell_t, claude_t) = ( + s.shell.clone().unwrap_or_default(), + s.claude_path.as_ref().map(|p| p.to_string_lossy().into_owned()).unwrap_or_default(), + ); + let updates = s.update_url.as_deref() != Some(""); + let chrome = s.chrome_default; + let default_model = s.default_model(); + let claude_hint = self.claude_exe.as_ref().map_or("not found".to_string(), |p| p.to_string_lossy().into_owned()); + let defaults = s.new_session.clone(); + let claude = self.modal_input(&claude_t, &claude_hint, window, cx); + let shell = self.modal_input(&shell_t, &platform::default_shell(None).0, window, cx); + let skills_field = self.modal_input(&self.store.data.settings.limits.text(), "none, e.g. dataviz, claude-api", window, cx); + let skill_search = self.modal_input_then("", "Search skills.sh or enter owner/repo", |ws, _, cx| ws.search_skills(cx), window, cx); + let list_focus = cx.focus_handle(); + window.focus(&list_focus, cx); + let custom = &self.store.data.settings.custom_subagents; + let form = |c: &claude::subagents::AgentChoice| AgentForm { on: c.on, models: c.models.clone(), edits: c.edits }; + let subagents = Box::new(HarnessesForm { + enabled: self.store.data.settings.enabled_harnesses_list(), + agents: claude::subagents::AgentMap::from_fn(|agent| form(custom.get(agent))), + claude_models: self.store.data.settings.claude_picked.clone(), + claude_subagents: self.store.data.settings.claude_subagents, + picking: None, + }); + let modes = self.store.data.settings.modes_for(default_model.harness); + let initial_perm = defaults + .mode_id + .clone() + .or_else(|| defaults.permission_mode.map(|m| m.acp_id().to_string())) + .filter(|id| modes.iter().any(|(mid, _)| mid == id)) + .or_else(|| modes.first().map(|(id, _)| id.clone())) + .unwrap_or_else(|| "default".into()); + self.modal = Some(Modal::Settings { shell, claude, default_model, effort: defaults.effort.unwrap_or_default(), permission: initial_perm, updates, chrome, scale: crate::panels::scale::percent(), m4code_off: self.store.data.settings.m4code_tools_off.clone(), skills_field, skill_search, costly: claude::costly::scan(), list_focus, renaming: None, subagents }); + // After the modal exists: a page that loads something reads the dialog's fields. + self.set_settings_page(self.settings_page, cx); + } + Act::SetSkillsTab(tab) => { + self.skills_page.tab = tab; + if tab == SkillsTab::Browse { + self.load_skills_catalog(cx); + } + } + Act::SetSkillScope(scope) => { + self.skills_page.scope = scope; + self.load_repo_skills(cx); + } + Act::SearchSkills => self.search_skills(cx), + Act::InstallSkill(entry) => self.install_skill(entry, cx), + Act::InstallSkillRepo(source) => self.install_skill_repo(source, cx), + Act::ToggleSkill(name) => self.toggle_skill(name, cx), + Act::UninstallSkill(name) => self.uninstall_skill(name, cx), + Act::UpdateSkills(names) => self.update_skills(names, cx), + Act::PickDefaultModel(choice) => { + let modes = self.store.data.settings.modes_for(choice.harness); + if let Some(Modal::Settings { default_model, permission, list_focus, .. }) = self.modal.as_mut() { + if !modes.iter().any(|(id, _)| id == permission) + && let Some((first, _)) = modes.first() + { + *permission = first.clone(); + } + *default_model = choice; + window.focus(list_focus, cx); + } + } + Act::PickEffort(choice) => { + if let Some(Modal::Settings { effort, .. }) = self.modal.as_mut() { + *effort = choice; + } + } + Act::PickPermission(choice) => { + if let Some(Modal::Settings { permission, .. }) = self.modal.as_mut() { + *permission = choice; + } + } + Act::NewBranch(cwd) => { + let input = self.modal_input("", "", window, cx); + self.modal = Some(Modal::NewBranch { cwd, input }); + } + Act::CreateBranch(cwd, name) => { + self.run_git(GitOp::Branch, move || Ok(crate::git::commit::create_branch(&cwd, &name)?), cx) + } + Act::AddProject(path) => { + let id = self.store.add_project(&path); + let _ = id; + self.toast("Project added", false, cx); + } + Act::RemoveProject(id) => { + let Some((at, project)) = self.store.remove_project(&id) else { return }; + if self.store.data.layout.project_filter.as_ref() == Some(&id) { + self.store.data.layout.project_filter = None; + } + if let Some(Modal::Settings { renaming, .. }) = self.modal.as_mut() + && renaming.as_ref().is_some_and(|(r, _)| *r == id) + { + *renaming = None; + } + self.show_toast("Project removed. Its sessions are kept.".into(), false, Some(("Undo".into(), Act::RestoreProject(at, project))), cx); + } + Act::RestoreProject(at, project) => self.store.restore_project(at, project), + Act::RenameProject(id) => { + let Some(name) = self.store.project(&id).map(|p| p.name.clone()) else { return }; + let input = self.modal_input_then(&name, "Name", |ws, window, cx| ws.act(Act::SaveProjectName, window, cx), window, cx); + if let Some(Modal::Settings { renaming, .. }) = self.modal.as_mut() { + *renaming = Some((id, input)); + } + } + Act::SaveProjectName => { + if let Some(Modal::Settings { renaming, .. }) = self.modal.as_mut() + && let Some((id, name)) = renaming.take() + { + let name = name.read(cx).value().to_string(); + self.store.rename_project(&id, &name); + } + } + Act::CancelProjectRename => { + if let Some(Modal::Settings { renaming, .. }) = self.modal.as_mut() { + *renaming = None; + } + } + Act::MoveProject(id, up) => self.store.move_project(&id, up), + Act::SetAutoCompact(id, on) => { + // Provider usage reports describe the native switch, not m4code's policy. + if let Some(meta) = self.store.session_mut(&id).and_then(|s| s.claude.as_mut()) { + meta.auto_compact = Some(on); + } + self.store.mark_dirty(); + cx.notify(); + if let Some(view) = self.live_view(&id).and_then(|v| v.thread()).cloned() { + view.update(cx, |v, cx| v.set_auto_compact(on, cx)); + } + } + Act::SetPrecomputeCompact(id, on) => { + if let Some(meta) = self.store.session_mut(&id).and_then(|s| s.claude.as_mut()) { + meta.precompute_compact = Some(on); + } + self.store.mark_dirty(); + cx.notify(); + usage::send_ctl(&usage::ctl_file(&id), "precompute_compact", on.into()); + self.toast(format!("Turning background compaction {}…", if on { "on" } else { "off" }), false, cx); + } + Act::FilterProject(id) => { + self.store.data.layout.project_filter = id; + self.store.mark_dirty(); + } + Act::ToggleRecent => { + let l = &mut self.store.data.layout; + l.recent_open = !l.recent_open; + self.store.mark_dirty(); + } + Act::ConfirmQuit => { + self.modal = None; + self.finalize(cx); + cx.quit(); + } + Act::Dismiss => { + if matches!(self.modal, Some(Modal::Settings { .. })) { + self.close_settings(window, cx); + return; + } + self.modal = None; + self.focus_active(window, cx); + } + Act::InstallUpdate => { + let ready = matches!(self.update.status, crate::updater::Status::Ready { .. }); + let running = self.running_count(cx); + if ready && running > 0 { + self.modal = Some(Modal::Confirm { + title: "Restart to update?".into(), + body: format!( + "{running} session{} running. Restarting ends {}. Claude sessions can be resumed afterwards.", + if running == 1 { " is" } else { "s are" }, + if running == 1 { "it" } else { "them" } + ), + confirm: "Restart and update".into(), + danger: true, + act: Act::ConfirmInstallUpdate, + }); + window.focus(&self.modal_focus, cx); + } else { + crate::updater::install(self, cx); + } + } + Act::CheckForUpdates => crate::updater::check_now(self, cx), + Act::ConfirmInstallUpdate => { + self.modal = None; + crate::updater::install(self, cx); + } + Act::SwitchAccount(id) => { + self.store.data.active_account = Some(id); + self.store.mark_dirty(); + self.refresh_accounts(cx); + self.model_lookups.get_mut(Harness::Claude).fetched = false; + if !cfg!(test) { + self.load_enabled_models(cx); + } + self.toast("Switched. New and resumed sessions use this account; running sessions keep theirs.", false, cx); + } + Act::Handoff => self.ask_handoff(window, cx), + Act::ConfirmHandoff(id) => { + self.modal = None; + self.start_handoff(&id, window, cx); + } + Act::AddAccount => { + self.modal = Some(Modal::Confirm { + title: "Add an account?".into(), + body: "Only sign in to accounts you own. Sharing or pooling logins, or using several accounts to get around \ + usage limits, can break Anthropic's terms.\n\n\ + The new account uses your main Claude Code setup. Settings, CLAUDE.md, keybindings, MCP servers and project trust \\ + are kept the same in every account, both ways: a change made here (like /model) also changes ~/.claude and \\ + your other accounts, and the other way round. Agents, skills, plugins and session history are shared with \\ + ~/.claude. Only the login is separate. m4code creates this account's folder." + .into(), + confirm: "Add and sign in".into(), + danger: false, + act: Act::ConfirmAddAccount, + }); + window.focus(&self.modal_focus, cx); + } + Act::ConfirmAddAccount => { + self.modal = None; + match claude::claude_home().ok_or_else(|| std::io::Error::other("Claude Code's folder was not found")).and_then(|h| accounts::create(&h)) { + Ok(dir) => { + let id = new_id(); + self.store.data.accounts.push(Account { id: id.clone(), dir: Some(dir), ..Default::default() }); + self.store.data.active_account = Some(id.clone()); + self.store.mark_dirty(); + self.sign_in(&id, window, cx); + } + Err(e) => self.toast(format!("Could not create the account folder: {e}"), true, cx), + } + } + Act::SignIn(id) => self.sign_in(&id, window, cx), + Act::RemoveAccount(id) => { + let name = self.store.account(&id).and_then(|a| a.email.clone()).unwrap_or_else(|| "this account".into()); + self.modal = Some(Modal::Confirm { + title: format!("Remove {name}?"), + body: "Deletes this account's login from m4code. Shared settings and session history stay in your main \ + ~/.claude. End its running sessions first." + .into(), + confirm: "Remove".into(), + danger: true, + act: Act::ConfirmRemoveAccount(id), + }); + window.focus(&self.modal_focus, cx); + } + Act::AskFileName(id, purpose) => self.ask_file_name(id, purpose, window, cx), + Act::AskDelete(id, path) => self.ask_delete(id, path, window, cx), + Act::ConfirmDelete(id, path) => self.delete_path(id, path, cx), + Act::ConfirmRemoveAccount(id) => { + self.modal = None; + if let Some(dir) = self.store.account(&id).and_then(|a| a.dir.clone()) { + match accounts::remove(&dir) { + Ok(()) => { + self.store.data.accounts.retain(|a| a.id != id); + if self.store.data.active_account.as_deref() == Some(id.as_str()) { + self.store.data.active_account = None; + } + self.store.mark_dirty(); + } + Err(e) => self.toast(format!("Could not remove the account: {e}"), true, cx), + } + } + } + } + self.store.save_if_dirty(); + cx.notify(); + } +} + +/// Deterministic, harness-agnostic commit subject derived from `git diff --cached --stat --patch`. +fn summarize_commit_diff(prompt: &str) -> String { + let files: Vec<&str> = prompt + .lines() + .filter_map(|line| line.strip_prefix("diff --git a/").and_then(|rest| rest.split(" b/").nth(1))) + .collect(); + match files.as_slice() { + [] => "Update files".into(), + [only] => format!("Update {only}"), + [a, b] => format!("Update {a} and {b}"), + many => format!("Update {} files", many.len()), + } +} diff --git a/src/app/agent_handoff.rs b/src/app/agent_handoff.rs new file mode 100644 index 0000000..0ce622a --- /dev/null +++ b/src/app/agent_handoff.rs @@ -0,0 +1,152 @@ +//! Dynamic in-chat handoff between harnesses: switching the provider in the chat composer and sending a message +//! seamlessly transitions the same session to the new harness, preserving prior conversation history visually and +//! sending the transcript + the user's new message as the first turn. + +use super::*; +use crate::harness::thread::Entry; + +/// Entries read from the end before the cut, so a long session is not turned into text whole. +const LAST_ENTRIES: usize = 400; + +pub struct Pending { + source: Live, + pub(super) meta: ClaudeMeta, + draft: Option, +} + +impl Workspace { + /// Switch session `id` in place to `to` (with an optional specific model & effort), carrying over the conversation + /// transcript and sending `message`: the user's, or with `by_agent` what the agent said to hand over. + #[allow(clippy::too_many_arguments)] + pub(super) fn dynamic_handoff(&mut self, id: &str, to: Harness, model: Option, message: String, by_agent: bool, effort: Option, window: &mut Window, cx: &mut Context) { + let Some(thread) = self.live_view(id).and_then(|v| v.thread()).cloned() else { return }; + if self.pending_handoffs.contains_key(id) { + if !by_agent { + thread.update(cx, |v, cx| v.paste_text(&message, window, cx)); + } + self.toast("A harness handoff is already starting.", false, cx); + return; + } + let Some(mut rec) = self.store.session(id).cloned() else { return }; + if to == Harness::Antigravity && rec.claude.as_ref().is_some_and(|m| m.parent_session.is_some()) { + self.toast("Shared Antigravity subagents are not enabled yet.", true, cx); + return; + } + let cwd = rec.cwd.clone(); + let draft = (!by_agent).then(|| message.clone()); + let mut meta = rec.claude.clone().unwrap_or_default(); + let target = meta.provider_sessions.get(to.key()).cloned(); + let (from_name, transcript, mut prior_entries, count) = { + let t = thread.read(cx); + (t.harness.name(), t.thread.transcript_after(target.as_ref().map_or(0, |s| s.after_entry), LAST_ENTRIES), t.thread.entries.clone(), t.thread.entries.len()) + }; + if !meta.session_id.is_empty() { + meta.provider_sessions.insert(meta.harness.key().into(), crate::store::ProviderSession { + session_id: meta.session_id.clone(), model: meta.chosen_model.clone(), effort: meta.chosen_effort.clone(), + account: meta.account.clone(), after_entry: count, + }); + } + let target_label = model.as_deref().filter(|m| !m.is_empty()).unwrap_or_else(|| to.name()); + prior_entries.push(Entry::Notice { + text: format!("Switched to {target_label}"), + error: false, + }); + // An agent's own message goes in as the last thing it said, so the chat shows no message the user didn't type. + let prompt = if by_agent { + let said = if transcript.trim().is_empty() { format!("Agent: {message}") } else { format!("{transcript}\n\nAgent: {message}") }; + crate::harness::thread::handoff_prompt(from_name, &said, "") + } else if transcript.trim().is_empty() { + message.clone() + } else { + crate::harness::thread::handoff_prompt(from_name, &transcript, &message) + }; + meta.harness = to; + meta.session_id = target.as_ref().map_or_else(String::new, |s| s.session_id.clone()); + meta.chosen_model = model.clone().or_else(|| target.as_ref().and_then(|s| s.model.clone())); + meta.chosen_effort = effort.clone().or_else(|| target.as_ref().and_then(|s| s.effort.clone())); + meta.account = target.and_then(|s| s.account); + meta.transcript = None; + meta.external = ExternalState::Unknown; + meta.context_tokens = None; + meta.context_fraction = None; + meta.context_window = None; + meta.cache_ttl = None; + meta.model = None; + meta.managed_compaction = true; + meta.auto_compact = Some(meta.auto_compact.unwrap_or(true)); + rec.claude = Some(meta.clone()); + let Some(mut start) = self.thread_start(&rec.id, &cwd, &meta, rec.chosen_title().map(String::from), Some(prompt), Starter::User, cx) else { + if let Some(draft) = draft { + thread.update(cx, |v, cx| v.paste_text(&draft, window, cx)); + } + return; + }; + start.prior_entries = prior_entries; + if let Some(model_id) = model.filter(|m| !m.is_empty()) { + start.options.retain(|(cat, _)| *cat != "model"); + start.options.push(("model", model_id)); + } + if let Some(level) = effort { + start.options.retain(|(cat, _)| *cat != "thought_level"); + start.options.push(("thought_level", level)); + } + let Some(index) = self.live.iter().position(|live| live.id == id) else { return }; + let source = self.live.remove(index); + self.pending_handoffs.insert(id.into(), Pending { source, meta, draft }); + let shell = self.shells.remove(id); + self.start_thread(rec, start, false, window, cx); + if let Some(shell) = shell { + self.shells.insert(id.into(), shell); + } + } + + pub(super) fn commit_handoff(&mut self, id: &str, session_id: &str, cx: &mut Context) { + let Some(mut pending) = self.pending_handoffs.remove(id) else { return }; + pending.meta.session_id = session_id.to_string(); + if let Some(live) = self.live.iter().find(|live| live.id == id) { + pending.meta.account = Some(live.account.clone()); + if let Some(view) = live.view.thread() { + let view = view.read(cx); + if let Some(model) = view.thread.option("model") { pending.meta.chosen_model = Some(model.current.clone()); } + if let Some(effort) = view.thread.option("thought_level") { pending.meta.chosen_effort = Some(effort.current.clone()); } + } + } + if let Some(record) = self.store.session_mut(id) { + record.claude = Some(pending.meta); + } + if let Some(source) = pending.source.view.thread() { + source.update(cx, |view, _| view.relinquish_record()); + } + self.store.mark_dirty(); + cx.notify(); + } + + pub(super) fn rollback_handoff(&mut self, id: &str, window: &mut Window, cx: &mut Context) -> bool { + let Some(pending) = self.pending_handoffs.remove(id) else { return false }; + let error = self.live_view(id).and_then(|view| view.start_error(cx)).unwrap_or_else(|| "The replacement session stopped.".into()); + if let Some(target) = self.live_view(id).and_then(|view| view.thread()) { + target.update(cx, |view, _| view.relinquish_record()); + } + self.live.retain(|live| live.id != id); + if let (Some(source), Some(draft)) = (pending.source.view.thread(), pending.draft) { + source.update(cx, |view, cx| view.paste_text(&draft, window, cx)); + } + self.live.push(pending.source); + self.toast(format!("Handoff failed; the original session is still open. {error}"), true, cx); + if self.active_id().is_some_and(|active| active == id) { + self.focus_active(window, cx); + } + true + } + + pub(super) fn cancel_pending_handoff(&mut self, id: &str, cx: &mut Context) { + if let Some(pending) = self.pending_handoffs.remove(id) { + if let Some(target) = self.live_view(id).and_then(|view| view.thread()) { + target.update(cx, |view, _| view.relinquish_record()); + } + if let Some(source) = pending.source.view.thread() { + source.read(cx).stop(); + } + } + } +} diff --git a/src/app/already_running.rs b/src/app/already_running.rs index 519def2..d8f1308 100644 --- a/src/app/already_running.rs +++ b/src/app/already_running.rs @@ -1,35 +1,45 @@ -//! The window a second Claudiu shows when another one already uses its data folder, before it quits. +//! The window a second m4code shows when another one already uses its data folder, before it quits. -use rune::{Cx, El, col, row}; +use gpui::{App, AppContext, Bounds, ClickEvent, Context, IntoElement, ParentElement, Render, StatefulInteractiveElement, Styled, TitlebarOptions, Window, WindowBounds, WindowOptions, div, px, size}; -use crate::panels::theme; -use crate::panels::widgets::{button, label}; -use crate::platform; +use crate::panels::theme::{self, hsla}; +use crate::panels::widgets::button; -const SIZE: (f32, f32) = (420.0, 170.0); +struct AlreadyRunning; -pub struct AlreadyRunning; - -fn render(_: &AlreadyRunning, _cx: &mut Cx) -> El { - col() - .w_full() - .h_full() - .fill(theme::rgb(theme::APP_BG)) - .padding(24.0) - .gap(10.0) - .child(label("Claudiu is already running", 15.0, theme::TEXT)) - .child(label("Another Claudiu window uses the same data folder. Switch to it instead.", 13.0, theme::TEXT_DIM).wrap()) - .child(rune::el().grow(1.0)) - .child(row().w_full().child(rune::el().grow(1.0)).child(button("OK", true).key("already-running-ok").on_press_tx(|_: &mut AlreadyRunning, tx: &mut rune::Tx| tx.quit()))) +impl Render for AlreadyRunning { + fn render(&mut self, _: &mut Window, cx: &mut Context) -> impl IntoElement { + div() + .size_full() + .flex() + .flex_col() + .gap(px(10.0)) + .p(px(24.0)) + .bg(hsla(theme::APP_BG)) + .child(div().text_size(px(15.0)).text_color(hsla(theme::TEXT)).child("m4code is already running")) + .child(div().text_size(px(13.0)).text_color(hsla(theme::TEXT_DIM)).child("Another m4code window uses the same data folder. Switch to it instead.")) + .child(div().flex_1()) + .child(div().flex().justify_end().child(button("already-running-ok", "OK", true).on_click(cx.listener(|_, _: &ClickEvent, _, cx| cx.quit())))) + } } /// Shows the notice until it is closed, then returns. pub fn show() { - let spec = rune::AppSpec { - min_size: Some(SIZE), - families: (platform::ui_font(), platform::monospace_font()), - ..rune::AppSpec::new("Claudiu", SIZE, || AlreadyRunning, render) - }; - let app = rune::App::new(spec).on_close(|_: &mut AlreadyRunning, tx: &mut rune::Tx| tx.quit()); - rune::run_windows(move |_| vec![rune::WindowSpec::from_app("already-running", app).options(rune::WindowOptions { resizable: false, min_size: Some(SIZE), ..Default::default() })]); + gpui_kit::application().run(|cx: &mut App| { + gpui_kit::init(cx); + let bounds = size(px(420.0), px(170.0)); + let options = WindowOptions { + window_bounds: Some(WindowBounds::Windowed(Bounds::centered(None, bounds, cx))), + window_min_size: Some(bounds), + is_resizable: false, + app_id: Some(crate::platform::APP_ID.into()), + titlebar: Some(TitlebarOptions { title: Some("m4code".into()), ..Default::default() }), + ..Default::default() + }; + if cx.open_window(options, |_, cx| cx.new(|_| AlreadyRunning)).is_err() { + cx.quit(); + } + cx.on_window_closed(|cx, _| cx.quit()).detach(); + cx.activate(true); + }); } diff --git a/src/app/alt_accounts.rs b/src/app/alt_accounts.rs index 4709a32..29126c9 100644 --- a/src/app/alt_accounts.rs +++ b/src/app/alt_accounts.rs @@ -14,12 +14,15 @@ impl Workspace { } /// Read each account's email and plan through `claude auth status`, off the UI thread. - pub fn refresh_accounts(&mut self) { + pub fn refresh_accounts(&mut self, cx: &mut Context) { let Some(exe) = self.claude_exe.clone() else { return }; let jobs: Vec<(Id, Option)> = self.store.data.accounts.iter().map(|a| (a.id.clone(), a.dir.clone())).collect(); - self.rt.spawn( - move || { jobs.into_iter().map(|(id, dir)| (id, accounts::status(&exe, dir.as_deref()))).collect::>() }, - move |ws: &mut Workspace, out| { + cx.spawn(async move |this, cx| { + let out = cx + .background_executor() + .spawn(async move { jobs.into_iter().map(|(id, dir)| (id, accounts::status(&exe, dir.as_deref()))).collect::>() }) + .await; + let _ = this.update(cx, |ws, cx| { let mut signed_in = vec![]; for (id, status) in out { // No answer (CLI failed to run) keeps what we knew; an answer of "logged out" clears it. @@ -39,17 +42,19 @@ impl Workspace { if let Some((id, _)) = signed_in.into_iter().find(|(_, e)| Some(e) == main.as_ref()) { // The login page approves whichever claude.ai account the browser is already signed in to. let text = "This alt signed in to your main account. Sign out of claude.ai in your browser (or use a private window), then sign in again."; - ws.show_toast(text.into(), true, Some(("Sign in again".into(), Act::SignIn(id)))); + ws.show_toast(text.into(), true, Some(("Sign in again".into(), Act::SignIn(id))), cx); } ws.store.save_if_dirty(); - }, - ); + cx.notify(); + }); + }) + .detach(); } /// `claude auth login` for an alt account in a terminal tab; account details refresh when it ends. - pub(super) fn sign_in(&mut self, account: &str) { + pub(super) fn sign_in(&mut self, account: &str, window: &mut Window, cx: &mut Context) { let Some(exe) = self.claude_exe.clone() else { - self.toast("Could not find the `claude` CLI.", true); + self.toast("Could not find the `claude` CLI.", true, cx); return; }; let Some(env) = self.store.account(account).map(Self::account_env).filter(|e| !e.is_empty()) else { return }; @@ -71,6 +76,6 @@ impl Workspace { claude: None, }; self.logins.insert(record.id.clone()); - self.start_session(record, spec, true); + self.start(record, spec, true, window, cx); } } diff --git a/src/app/ask_claude.rs b/src/app/ask_claude.rs index 492e316..2708228 100644 --- a/src/app/ask_claude.rs +++ b/src/app/ask_claude.rs @@ -1,6 +1,7 @@ //! The editor's right-click requests to Claude: explain, fix or test the selected lines, or fix the problem a language -//! server reports on the caret's line. Each one sends the reference and the request to Claude as the next message -//! (`send_to_claude`), through the session's mod rather than its terminal. +//! server reports on the clicked line. Each one sends the reference and the request to Claude as the next message (`send_to_claude`). + +use std::path::Path; use super::*; @@ -9,58 +10,80 @@ pub enum Ask { Explain, Fix, Tests, - /// The language server's problem on the caret's line. + /// The language server's problem on the cursor's line. Problem, } impl Workspace { - pub fn ask_claude(&mut self, ask: Ask) { - let Some(id) = self.active_id().cloned() else { return }; + pub fn ask_claude(&mut self, ask: Ask, window: &mut Window, cx: &mut Context) { + let Some(id) = self.editor_owner() else { return }; let text = match ask { - Ask::Problem => self.problem_at_caret(&id).map(|(reference, message)| request(ask, &reference, Some(&message))), - _ => self.selection_reference(&id).or_else(|| self.caret_reference(&id)).map(|reference| request(ask, &reference, None)), + Ask::Problem => self.problem_at_cursor(&id, cx).map(|(reference, message)| request(ask, &reference, Some(&message))), + _ => self.selection_reference(&id, cx).or_else(|| self.cursor_reference(&id, cx)).map(|reference| request(ask, &reference, None)), }; let Some(text) = text else { if ask == Ask::Problem { - self.toast("The language server reports no problem on this line.", false); + self.toast("The language server reports no problem on this line.", false, cx); } return; }; - self.send_to_claude(&id, &text); + self.send_to_claude(&id, &text, window, cx); } - /// `@path#L..` for the shown tab's selection; `None` when nothing is selected. - pub(super) fn selection_reference(&self, id: &Id) -> Option { - let (path, e) = self.shown_reference_target(id)?; - if e.sel.is_empty() { - return None; - } - let (a, b) = e.sel.range(); - Some(reference(&path, a.line, b.line, b.col)) + /// The shown session when it is a running Claude session: where a request from anywhere in the app goes, rather than + /// into a session of its own. + pub(super) fn running_claude(&self, cx: &App) -> Option { + self.active_id().filter(|id| self.is_running(id, cx) && self.store.session(id).is_some_and(|r| r.kind == SessionKind::Claude)).cloned() } - /// `@path#L` for the caret's line of the shown tab. - fn caret_reference(&self, id: &Id) -> Option { - let (path, e) = self.shown_reference_target(id)?; - Some(format!("@{path}#L{}", e.caret().line + 1)) + /// `running_claude`, when it works in `folder` (or inside it, or around it). A request about another repository, + /// or another worktree of this one, must not land in a session that would act on the wrong files. + pub(super) fn running_claude_in(&self, folder: &Path, cx: &App) -> Option { + self.running_claude(cx).filter(|id| self.store.session(id).is_some_and(|r| works_in(&r.cwd, folder))) } - /// The reference and message of the most severe problem on the caret's line of the shown tab. - fn problem_at_caret(&self, id: &Id) -> Option<(String, String)> { - let (path, e) = self.shown_reference_target(id)?; - let line = e.caret().line; - // Errors before warnings; `false` sorts first. - let problem = e.problems.iter().filter(|p| (p.from.line..=p.to.line).contains(&line)).min_by_key(|p| !p.error)?; - let (first, last) = (problem.from.line, problem.to.line); - let reference = if first == last { format!("@{path}#L{}", first + 1) } else { format!("@{path}#L{}-{}", first + 1, last + 1) }; - Some((reference, problem.message.clone())) + /// Send `text` to the session `id` as the user's next message, then move the keyboard to it. A session mid-turn + /// queues it for after the turn; a half-written message in its composer is left alone. + pub(super) fn send_to_claude(&mut self, id: &Id, text: &str, window: &mut Window, cx: &mut Context) { + if matches!(self.main, Main::Home) && self.editor_owner().as_ref() == Some(id) { + self.add_home_comment(text, window, cx); + self.act(Act::HomeLaunch, window, cx); + return; + } + let Some(view) = self.live_view(id).filter(|v| v.is_running(cx)).and_then(|v| v.thread()).cloned() else { + self.toast("This session isn't running. Resume it, then try again.", false, cx); + return; + }; + view.update(cx, |v, cx| v.send(text.to_string(), window, cx)); + self.focus_active(window, cx); } - /// The shown tab's path as Claude Code resolves `@` (relative to the listed folder, the session's own) and its editor. - fn shown_reference_target(&self, id: &Id) -> Option<(String, &crate::editor::Editor)> { + /// `@path#L` for the cursor's line of the shown tab. + fn cursor_reference(&self, id: &Id, cx: &App) -> Option { let pane = self.panes.get(id)?; let tab = pane.shown().filter(|t| t.note.is_none())?; - Some((editor_mode::relative(&tab.path, &pane.root), &tab.editor)) + let line = tab.buffer.read(cx).cursor_position().line as usize; + Some(format!("@{}#L{}", super::picker::relative(&tab.path, &pane.root), line + 1)) + } + + /// The reference and message of the most severe problem on the cursor's line of the shown tab. + fn problem_at_cursor(&self, id: &Id, cx: &App) -> Option<(String, String)> { + use gpui_kit::base::input::DiagnosticSeverity as S; + let pane = self.panes.get(id)?; + let tab = pane.shown().filter(|t| t.note.is_none())?; + let b = tab.buffer.read(cx); + let line = b.cursor_position().line; + let rank = |s: &S| match s { + S::Error => 0, + S::Warning => 1, + S::Info => 2, + S::Hint => 3, + }; + let problem = b.diagnostics()?.iter().filter(|d| (d.diagnostic.range.start.line..=d.diagnostic.range.end.line).contains(&line)).min_by_key(|d| rank(&d.severity))?; + let (first, last) = (problem.diagnostic.range.start.line as usize, problem.diagnostic.range.end.line as usize); + let path = super::picker::relative(&tab.path, &pane.root); + let reference = if first == last { format!("@{path}#L{}", first + 1) } else { format!("@{path}#L{}-{}", first + 1, last + 1) }; + Some((reference, problem.message.to_string())) } } @@ -74,19 +97,9 @@ fn request(ask: Ask, reference: &str, problem: Option<&str>) -> String { } } -/// `@path#L-` (1-based, or `#L` for one line) for a selection from line `start` to line `end_line`, -/// column `end_col` (0-based). A selection that ends at the very start of a line doesn't take that line. -fn reference(path: &str, start: usize, end_line: usize, end_col: usize) -> String { - let last = if end_line > start && end_col == 0 { end_line - 1 } else { end_line }; - match last == start { - true => format!("@{path}#L{}", start + 1), - false => format!("@{path}#L{}-{}", start + 1, last + 1), - } -} - #[cfg(test)] mod tests { - use super::{Ask, reference, request}; + use super::{Ask, request}; #[test] fn requests_name_the_lines_and_the_problem_on_one_line() { @@ -98,12 +111,24 @@ mod tests { "the request stays on one line" ); } +} + +/// Whether a session started in `session` is working on `folder`. +fn works_in(session: &Path, folder: &Path) -> bool { + crate::platform::is_same_or_under(session, folder) || crate::platform::is_same_or_under(folder, session) +} + +#[cfg(test)] +mod folder_tests { + use super::works_in; + use std::path::Path; #[test] - fn references_name_the_selected_lines() { - assert_eq!(reference("src/main.rs", 11, 29, 4), "@src/main.rs#L12-30"); - assert_eq!(reference("a.rs", 4, 4, 9), "@a.rs#L5", "within one line"); - assert_eq!(reference("a.rs", 4, 7, 0), "@a.rs#L5-7", "whole lines, ending at the start of the next"); - assert_eq!(reference("a.rs", 4, 5, 0), "@a.rs#L5"); + fn a_session_works_in_its_folder_and_those_around_and_inside_it_only() { + assert!(works_in(Path::new("/p/app"), Path::new("/p/app"))); + assert!(works_in(Path::new("/p/app/crates/x"), Path::new("/p/app")), "started in a sub-folder of the repository"); + assert!(works_in(Path::new("/p"), Path::new("/p/app")), "started above the repository"); + assert!(!works_in(Path::new("/p/other"), Path::new("/p/app"))); + assert!(!works_in(Path::new("/p/app-wt"), Path::new("/p/app")), "another worktree is not this one"); } } diff --git a/src/app/attached_sync.rs b/src/app/attached_sync.rs index e9999a4..e34b5c2 100644 --- a/src/app/attached_sync.rs +++ b/src/app/attached_sync.rs @@ -29,6 +29,9 @@ fn retry_wait(failures: u32) -> Duration { /// One answer: the session, which item (its repository, whether it is a pull request, its number), and what GitHub said. type Answer = (Id, Option, bool, u32, String, State); +/// A session, its folder, and the items attached to it (repository, `true` for a pull request, number) to ask GitHub about. +type Ask = (Id, PathBuf, Vec<(Option, bool, u32)>); + impl Sync { fn due(&self, some_unanswered: bool) -> bool { let wait = if some_unanswered { retry_wait(self.failures) } else { REFRESH_EVERY }; @@ -36,11 +39,8 @@ impl Sync { } } -/// A session, its folder, and the items attached to it (repository, `true` for a pull request, number) to ask GitHub about. -type Ask = (Id, PathBuf, Vec<(Option, bool, u32)>); - impl Workspace { - pub(super) fn sync_attached(&mut self) { + pub(super) fn sync_attached(&mut self, cx: &mut Context) { let asks: Vec = self .store .data @@ -59,9 +59,9 @@ impl Workspace { } self.attached_sync.running = true; self.attached_sync.last_try = Some(Instant::now()); - self.rt.spawn_quietly( - move || { ask_github(asks) }, - move |ws: &mut Workspace, answers| { + cx.spawn(async move |this, cx| { + let answers = cx.background_executor().spawn(async move { ask_github(asks) }).await; + let _ = this.update(cx, |ws, cx| { ws.attached_sync.running = false; let changed = answers.into_iter().fold(false, |c, (id, repo, pull, number, title, state)| { ws.edit_attached(&id, |list| links::set_status(list, repo.as_deref(), pull, number, &title, state)) | c @@ -69,10 +69,11 @@ impl Workspace { ws.attached_sync.failures = if ws.unanswered_items() { ws.attached_sync.failures + 1 } else { 0 }; if changed { ws.store.mark_dirty(); - ws.rt.dirty = true; + cx.notify(); } - }, - ); + }); + }) + .detach(); } /// Whether some attached item of a session with a folder has no answer from GitHub yet. diff --git a/src/app/background.rs b/src/app/background.rs index 0857eed..a60e118 100644 --- a/src/app/background.rs +++ b/src/app/background.rs @@ -25,92 +25,122 @@ fn notice(before: Option, now: Option, window_active: bool) } impl Workspace { - /// Startup reconciliation: scan Claude Code's records off the UI thread, then merge. - pub fn start_scan(&mut self) { - let Some(home) = claude::claude_home() else { - return; - }; - self.scanning = true; - self.rt.spawn( - move || claude::scan_all(&home), - |ws: &mut Workspace, result| { - ws.scanning = false; - ws.store.reconcile(&result.sessions, result.ok); - if result.ok { - // Records from earlier runs that never produced a transcript: nothing to resume. - let live: Vec = ws.live.iter().map(|l| l.id.clone()).collect(); - ws.store.data.sessions.retain(|s| { - live.contains(&s.id) - || !s.claude.as_ref().is_some_and(|c| { - c.external == ExternalState::Unknown && c.transcript.is_none() - }) - }); - } + /// Runs `work` off the UI thread, then `done` with its result back on it; saves what `done` changed and redraws. + pub(crate) fn in_background( + &mut self, + work: impl FnOnce() -> T + Send + 'static, + done: impl FnOnce(&mut Self, T, &mut Context) + 'static, + cx: &mut Context, + ) { + cx.spawn(async move |this, cx| { + let result = cx.background_executor().spawn(async move { work() }).await; + let _ = this.update(cx, |ws, cx| { + done(ws, result, cx); ws.store.save_if_dirty(); - }, - ); + cx.notify(); + }); + }) + .detach(); } - /// Every five seconds: `tick`. - pub(super) fn start_ticker(&mut self) { - self.rt.after_quietly(Duration::from_secs(5), |ws: &mut Workspace| { - ws.tick(); - ws.start_ticker(); - }); + pub(super) fn start_ticker(&mut self, cx: &mut Context) { + cx.spawn(async move |this, cx| { + loop { + cx.background_executor().timer(Duration::from_secs(5)).await; + if this.update(cx, |ws, cx| ws.tick(cx)).is_err() { + break; + } + } + }) + .detach(); } - /// Whether a working session's sidebar icon turns: only while someone can see it, since every turning frame is - /// drawn. Rune stops drawing a hidden or occluded window by itself. - pub fn spin_visible(&self) -> bool { - // Editor mode hides the sidebar whatever its setting. - spin_visible(self.activity.values().any(|a| *a == Activity::Working), self.window_active, self.store.data.layout.sidebar_visible && !self.editing()) + /// While a session works, its sidebar icon spins: the session list is redrawn many times a second (with the + /// window's top level, which reuses the other cached parts). It stops when idle or out of view. + pub(crate) fn start_spin(&mut self, window: &Window, cx: &mut Context) { + if self.spinning || !self.spin_visible(window) { + return; + } + self.spinning = true; + cx.spawn_in(window, async move |this, cx| { + loop { + cx.background_executor().timer(crate::panels::status_icon::SPIN_STEP).await; + let working = this.update_in(cx, |ws, window, cx| { + let working = ws.spin_visible(window); + match &ws.session_list { + Some(list) if working => list.update(cx, |_, cx| cx.notify()), + _ => ws.spinning = working, + } + working + }); + if !matches!(working, Ok(true)) { + break; + } + } + }) + .detach(); + } + + fn spin_visible(&self, window: &Window) -> bool { + spin_visible( + self.activity.values().any(|a| *a == Activity::Working), + window.is_window_active(), + self.store.data.layout.sidebar_visible, + self.editing(), + ) } /// Once a second: derive each Claude session's `Activity` from its terminal output. When one stops working /// while the user isn't looking at it, mark it for attention, and if the whole window is in the /// background as well, send a system notification. - pub(super) fn start_activity_poll(&mut self) { - self.rt.after_quietly(Duration::from_secs(1), |ws: &mut Workspace| { - let mut seen = std::mem::take(&mut ws.status_files); - ws.rt.spawn_quietly( - move || { - let statuses = claude::claude_home().map(|h| claude::session_statuses(&h, &mut seen)).unwrap_or_default(); - (statuses, crate::claude::bridge::take_requests(), seen) - }, - |ws: &mut Workspace, (statuses, requests, seen)| { - ws.status_files = seen; - // Other sessions' requests and worktree switches change what is shown when there are - // any; `update_activity` says for itself. - if !requests.is_empty() || !ws.pending_switches.is_empty() || !ws.pending_starts.is_empty() { - ws.rt.dirty = true; - } - ws.serve_requests(requests); - ws.run_pending_switches(&statuses); - ws.check_open_files(); - ws.update_activity(&statuses); - ws.start_activity_poll(); - }, - ); - }); + pub(super) fn start_activity_poll(&mut self, window: &Window, cx: &mut Context) { + cx.spawn_in(window, async move |this, cx| { + let mut seen = claude::StatusFiles::default(); + loop { + cx.background_executor().timer(Duration::from_secs(1)).await; + let (statuses, requests, back) = cx + .background_executor() + .spawn(async move { + let statuses = claude::claude_home().map(|h| claude::session_statuses(&h, &mut seen)).unwrap_or_default(); + (statuses, crate::claude::bridge::take_requests(), seen) + }) + .await; + seen = back; + let update = this.update_in(cx, |ws, window, cx| { + ws.serve_requests(requests, window, cx); + ws.run_pending_switches(&statuses, window, cx); + ws.check_open_files(window, cx); + ws.update_activity(window, cx, &statuses) + }); + if update.is_err() { + break; + } + } + }) + .detach(); } /// `statuses` is Claude Code's own busy/idle/waiting per session id; sessions it doesn't list (older Claude /// Code, no registry file) fall back to the terminal-output heuristic. - fn update_activity(&mut self, statuses: &HashMap) { - let window_active = self.window_active; + fn update_activity(&mut self, window: &mut Window, cx: &mut Context, statuses: &HashMap) { + let window_active = window.is_window_active(); let shown = self.active_id().cloned(); let mut next: HashMap = HashMap::new(); let mut notices = vec![]; for l in &self.live { let is_claude = self.store.session(&l.id).is_some_and(|r| r.kind == SessionKind::Claude); - let view = &l.view; - if !is_claude || !view.is_running() { + if !is_claude || !l.view.is_running(cx) { continue; } let viewing = window_active && shown.as_deref() == Some(l.id.as_str()); - let status = self.store.session(&l.id).and_then(|r| statuses.get(r.claude_id()?)); - let working = status.map_or_else(|| view.is_working(), |s| s == "busy"); - let waiting = status.is_some_and(|s| s == "waiting"); + // A thread knows from ACP itself: a turn is out, or a permission question is open. + let (working, waiting) = match &l.view { + SessionView::Thread(v) => (v.read(cx).is_working(), v.read(cx).is_waiting()), + SessionView::Terminal(v) => { + let status = self.store.session(&l.id).and_then(|r| statuses.get(r.claude_id()?)); + (status.map_or_else(|| v.read(cx).is_working(), |s| s == "busy"), status.is_some_and(|s| s == "waiting")) + } + }; let before = self.activity.get(&l.id).copied(); let now = next_activity(working, waiting, before, viewing); if let Some(body) = notice(before, now, window_active) { @@ -122,7 +152,10 @@ impl Workspace { } if next != self.activity { self.activity = next; - self.rt.dirty = true; + cx.notify(); + } + if self.activity.values().any(|a| *a == Activity::Working) { + self.start_spin(window, cx); } for (title, body) in notices { platform::notify(title, body); @@ -148,40 +181,42 @@ impl Workspace { } } - pub(super) fn tick(&mut self) { + pub(super) fn tick(&mut self, cx: &mut Context) { let purged = self.purge_dead_shells(); self.store.save_if_dirty(); - self.refresh_live(); - self.remember_open(); - self.ingest_usage(); - self.sync_attached(); - self.sync_configs(); - self.refresh_if_stale(); - self.refresh_marks(); - self.raise_claude_priority(); - self.refresh_pending(); + self.remember_open(cx); + self.ingest_usage(cx); + self.sync_attached(cx); + self.sync_configs(cx); + self.refresh_if_stale(cx); + self.refresh_marks(cx); + self.raise_claude_priority(cx); + self.refresh_pending(cx); // The steps above redraw when they change something. The sidebar's "5m ago" and the reset countdowns count - // in minutes, so they need a redraw only when the minute turns; the prompt cache's bar shrinks as it runs out. + // in minutes, so they need a redraw only when the minute turns. let minute = crate::store::now() / 60; - let cache_running = self.selected_cache().is_some_and(|(_, left, _)| left > 0); - if purged || cache_running || minute != self.tick_minute { + if purged || minute != self.tick_minute { self.tick_minute = minute; - self.rt.dirty = true; + cx.notify(); } } /// Windows: run the Claude sessions above the builds and tests they start. - fn raise_claude_priority(&self) { + fn raise_claude_priority(&self, cx: &mut Context) { #[cfg(windows)] { + // Only a session still drawn in a terminal has a process id here. Agents now run as ACP processes, + // whose ids the chat view doesn't expose yet, so they keep the normal priority until it does. let claude_pids: Vec = self .live .iter() .filter(|l| self.store.session(&l.id).is_some_and(|r| r.kind == SessionKind::Claude)) - .filter_map(|l| l.view.terminal.process_id()) + .filter_map(|l| l.view.terminal()?.read(cx).terminal.process_id()) .collect(); - self.rt.background(move || crate::priority::raise_claude_priority(&claude_pids)); + cx.background_executor().spawn(async move { crate::priority::raise_claude_priority(&claude_pids) }).detach(); } + #[cfg(not(windows))] + let _ = cx; } /// Terminal sessions live only in CURRENT SESSION: once a shell's process is gone and its pane has been @@ -206,70 +241,13 @@ impl Workspace { purged } - /// Re-read transcripts of running Claude sessions so the context meter follows reality. - fn refresh_live(&mut self) { - let Some(home) = claude::claude_home() else { - return; - }; - let jobs: Vec<(Id, String, Option, Option)> = self - .live - .iter() - .filter(|l| l.view.is_running()) - .filter_map(|l| { - let rec = self.store.session(&l.id)?; - let meta = rec.claude.as_ref()?; - Some(( - l.id.clone(), - meta.session_id.clone(), - meta.transcript.clone(), - self.transcript_mtimes.get(&l.id).copied(), - )) - }) - .collect(); - if jobs.is_empty() { - return; - } - self.rt.spawn_quietly( - move || { - let mut out = Vec::new(); - for (id, claude_id, known, last_mtime) in jobs { - let Some(path) = known - .filter(|p| p.is_file()) - .or_else(|| claude::find_transcript(&home, &claude_id)) - else { - continue; - }; - let mtime = std::fs::metadata(&path).and_then(|m| m.modified()).ok(); - if mtime.is_some() && mtime == last_mtime { - continue; - } - if let Some(scan) = claude::read_session(&path) { - out.push((id, mtime, scan)); - } - } - out - }, - |ws: &mut Workspace, out| { - // Only transcripts that changed since the last look come back. - ws.rt.dirty |= !out.is_empty(); - for (id, mtime, scan) in out { - if let Some(m) = mtime { - ws.transcript_mtimes.insert(id.clone(), m); - } - ws.store - .reconcile(std::slice::from_ref(&scan.session), false); - } - }, - ); - } - - pub fn check_updates(&mut self) { - crate::updater::check(self); + pub fn check_updates(&mut self, cx: &mut Context) { + crate::updater::check(self, cx); } } -fn spin_visible(working: bool, active: bool, sidebar: bool) -> bool { - working && active && sidebar +fn spin_visible(working: bool, active: bool, sidebar: bool, editing: bool) -> bool { + working && active && sidebar && !editing } #[cfg(test)] @@ -292,7 +270,10 @@ mod tests { for working in [false, true] { for active in [false, true] { for sidebar in [false, true] { - assert_eq!(spin_visible(working, active, sidebar), working && active && sidebar); + for editing in [false, true] { + assert_eq!(spin_visible(working, active, sidebar, editing), + working && active && sidebar && !editing); + } } } } diff --git a/src/app/commands.rs b/src/app/commands.rs deleted file mode 100644 index de96984..0000000 --- a/src/app/commands.rs +++ /dev/null @@ -1,298 +0,0 @@ -//! The app's keyboard shortcuts and menu bar commands. Each is a `Command`; `Workspace::command` runs it, whether it came -//! from a key or the menu bar. - -use super::*; -use crate::terminal::keys::Keystroke; - -#[derive(Clone, Copy, Debug, PartialEq, Eq)] -pub enum Command { - NewClaude, - ToggleShell, - CloseSession, - NextSession, - PrevSession, - ToggleSidebar, - ToggleRight, - FocusSearch, - ImportProject, - SwapFocus, - OpenGithub, - OpenSettings, - ToggleEditor, - /// Show the running session with this number, counted down the sidebar's RUNNING list. - ShowSession(usize), -} - -/// The shortcuts, written as `Keystroke::parse` reads them. `secondary` is Cmd on macOS and Ctrl elsewhere. -const CHORDS: &[(&str, Command)] = &[ - ("secondary-shift-n", Command::NewClaude), - ("ctrl-`", Command::ToggleShell), - ("secondary-j", Command::ToggleShell), - ("secondary-shift-w", Command::CloseSession), - ("secondary-shift-b", Command::ToggleSidebar), - ("secondary-shift-r", Command::ToggleRight), - ("secondary-shift-f", Command::FocusSearch), - ("secondary-shift-o", Command::ImportProject), - ("secondary-shift-g", Command::OpenGithub), - ("secondary-,", Command::OpenSettings), - ("secondary-shift-]", Command::SwapFocus), - ("secondary-shift-e", Command::ToggleEditor), - ("ctrl-tab", Command::NextSession), - ("ctrl-shift-tab", Command::PrevSession), -]; - -/// What a key does while the keyboard is in the editor pane (its editor or its file tree). Elsewhere these keys belong -/// to Claude Code (Ctrl+P, Ctrl+G) or the terminal. -#[derive(Clone, Copy, Debug, PartialEq, Eq)] -pub enum PaneCommand { - QuickOpen, - SaveFile, - GoToLine, - CloseTab, - GoBack, - GoForward, -} - -const PANE_CHORDS: &[(&str, PaneCommand)] = &[ - ("secondary-p", PaneCommand::QuickOpen), - ("secondary-s", PaneCommand::SaveFile), - ("ctrl-g", PaneCommand::GoToLine), - ("secondary-w", PaneCommand::CloseTab), - // VS Code's keys: Alt+arrows move by word on macOS. - (if cfg!(target_os = "macos") { "ctrl--" } else { "alt-left" }, PaneCommand::GoBack), - (if cfg!(target_os = "macos") { "ctrl-shift--" } else { "alt-right" }, PaneCommand::GoForward), -]; - -impl PaneCommand { - pub fn for_key(ks: &Keystroke) -> Option { - let chord = chord_of(ks); - PANE_CHORDS.iter().find(|(spec, _)| resolve(spec) == chord).map(|(_, c)| *c) - } -} - -/// Whether `ks` is the chord `spec` names, as `CHORDS` writes them (`secondary-shift-f`). -pub fn is_chord(ks: &Keystroke, spec: &str) -> bool { - chord_of(ks) == resolve(spec) -} - -fn secondary() -> &'static str { - if cfg!(target_os = "macos") { "cmd" } else { "ctrl" } -} - -/// `secondary-shift-n` as this platform writes it: `cmd-shift-n` on macOS, `ctrl-shift-n` elsewhere. -fn resolve(spec: &str) -> String { - spec.replace("secondary", secondary()) -} - -/// The modifiers and key of a keystroke as a chord spec, to compare with `CHORDS`. -fn chord_of(ks: &Keystroke) -> String { - let m = &ks.modifiers; - let mut parts: Vec<&str> = vec![]; - if m.control { - parts.push("ctrl"); - } - if m.alt { - parts.push("alt"); - } - // The order `CHORDS` writes them in. - if m.platform { - parts.push("cmd"); - } - if m.shift { - parts.push("shift"); - } - let key = match ks.key.as_str() { - // Shift+] types `}`; the chord names the key. - "}" => "]", - "~" => "`", - "<" => ",", - // Shift+- types `_`. - "_" => "-", - k => k, - }; - parts.push(key); - parts.join("-") -} - -impl Command { - /// The command a key press runs, if any. - pub fn for_key(ks: &Keystroke) -> Option { - let chord = chord_of(ks); - if let Some((_, c)) = CHORDS.iter().find(|(spec, _)| resolve(spec) == chord) { - return Some(*c); - } - // Secondary+1 to Secondary+9. - let m = &ks.modifiers; - let secondary_alone = if cfg!(target_os = "macos") { m.platform && !m.control } else { m.control && !m.platform }; - if secondary_alone && !m.shift && !m.alt { - let n = ks.key.parse::().ok().filter(|n| (1..=9).contains(n))?; - return Some(Command::ShowSession(n)); - } - None - } - - /// The shortcut shown beside the command in the menu bar, as Rune's `Shortcut` reads it. - fn accelerator(self) -> Option<&'static str> { - Some(match self { - Command::NewClaude => "mod+shift+n", - Command::ToggleShell => "mod+j", - Command::CloseSession => "mod+shift+w", - Command::ToggleSidebar => "mod+shift+b", - Command::ToggleRight => "mod+shift+r", - Command::FocusSearch => "mod+shift+f", - Command::ImportProject => "mod+shift+o", - Command::OpenGithub => "mod+shift+g", - Command::OpenSettings => "mod+,", - Command::SwapFocus => "mod+shift+]", - Command::ToggleEditor => "mod+shift+e", - _ => return None, - }) - } -} - -/// The menu bar: Claudiu (Settings), File, View. Edit, Window and Quit come from Rune's standard menus. -const QUIT: &str = "Quit Claudiu"; - -impl Workspace { - /// Move ⌘Q to the app's Quit once the menu bar is up, looking again for up to 10 s: a run with no menu bar - /// (headless, tests) must not keep waking the app. - pub(super) fn take_quit_key(&mut self, tries_left: u32) { - if !platform::take_quit_key(QUIT) && tries_left > 0 { - self.rt.after_quietly(Duration::from_millis(250), move |ws: &mut Workspace| ws.take_quit_key(tries_left - 1)); - } - } -} - -pub fn menu_bar() -> Vec> { - fn item(title: &str, menu: &str, c: Command, run: fn(&mut Workspace, &mut Tx)) -> rune::MenuItem { - let mut item = rune::MenuItem::new(title, run).menu(menu).keys_first(); - if let Some(shortcut) = c.accelerator().and_then(|a| a.parse::().ok()) { - item = item.key_equivalent(shortcut); - } - item - } - vec![ - { - let mut settings = rune::MenuItem::new("Settings…", |ws: &mut Workspace, tx: &mut Tx| ws.run(Command::OpenSettings, tx)).keys_first(); - if let Ok(s) = "mod+,".parse() { - settings = settings.key_equivalent(s); - } - settings - }, - rune::MenuItem::separator(), - { - // AppKit's own Quit cannot ask first, so this one takes its ⌘Q (`Workspace::take_quit_key`). - rune::MenuItem::new(QUIT, |ws: &mut Workspace, tx: &mut Tx| ws.quit_or_ask(tx)) - }, - item("New Claude Session", "File", Command::NewClaude, |ws, tx| ws.run(Command::NewClaude, tx)), - item("Add Project…", "File", Command::ImportProject, |ws, tx| ws.run(Command::ImportProject, tx)), - rune::MenuItem::separator().menu("File"), - item("Close Session", "File", Command::CloseSession, |ws, tx| ws.run(Command::CloseSession, tx)), - item("Toggle Sidebar", "View", Command::ToggleSidebar, |ws, tx| ws.run(Command::ToggleSidebar, tx)), - item("Toggle Right Sidebar", "View", Command::ToggleRight, |ws, tx| ws.run(Command::ToggleRight, tx)), - item("Toggle Shell", "View", Command::ToggleShell, |ws, tx| ws.run(Command::ToggleShell, tx)), - item("Swap Terminal and Shell", "View", Command::SwapFocus, |ws, tx| ws.run(Command::SwapFocus, tx)), - item("Editor Mode", "View", Command::ToggleEditor, |ws, tx| ws.run(Command::ToggleEditor, tx)), - rune::MenuItem::separator().menu("View"), - item("Search Sessions", "View", Command::FocusSearch, |ws, tx| ws.run(Command::FocusSearch, tx)), - item("GitHub", "View", Command::OpenGithub, |ws, tx| ws.run(Command::OpenGithub, tx)), - rune::MenuItem::separator().menu("View"), - item("Next Session", "View", Command::NextSession, |ws, tx| ws.run(Command::NextSession, tx)), - item("Previous Session", "View", Command::PrevSession, |ws, tx| ws.run(Command::PrevSession, tx)), - ] -} - -impl Workspace { - /// Run a command, then hand its effects to the frame. - pub fn run(&mut self, c: Command, tx: &mut Tx) { - self.command(c); - self.after_input(tx); - } - - pub fn command(&mut self, c: Command) { - match c { - Command::NewClaude => { - let cwd = self.new_session_cwd(); - self.act(Act::NewClaude { cwd }) - } - Command::ToggleShell => self.toggle_shell_here(), - Command::CloseSession => { - if let Some(id) = self.active.clone() { - self.act(Act::CloseLive(id)) - } - } - Command::NextSession => self.cycle(1), - Command::PrevSession => self.cycle(-1), - Command::ShowSession(n) => self.show_numbered(n), - Command::ToggleSidebar => self.toggle_left(), - Command::ToggleRight => self.toggle_right(), - Command::FocusSearch => { - // In editor mode the search that fits is the session's files. - if self.editing() { - self.open_picker(super::picker::PickerKind::Text); - return; - } - self.store.data.layout.sidebar_visible = true; - self.store.mark_dirty(); - self.search.focused = true; - } - Command::ImportProject => self.act(Act::ImportProject), - Command::OpenGithub => { - if self.active_id().is_some() { - let cwd = self.active_cwd(); - self.act(Act::OpenGithub { cwd }) - } - } - Command::OpenSettings => self.act(Act::OpenSettings), - Command::SwapFocus => self.swap_focus(), - Command::ToggleEditor => { - if self.active_id().is_some() { - self.act(Act::ToggleEditor) - } - } - } - } - - pub fn pane_command(&mut self, c: PaneCommand) { - match c { - PaneCommand::QuickOpen => self.open_picker(super::picker::PickerKind::Files), - PaneCommand::SaveFile => self.save_shown(), - PaneCommand::GoToLine => self.ask_go_to_line(), - PaneCommand::CloseTab => self.close_shown_tab(), - PaneCommand::GoBack => self.go_back(), - PaneCommand::GoForward => self.go_forward(), - } - } -} - -#[cfg(test)] -mod tests { - use super::*; - - fn key(spec: &str) -> Option { - Command::for_key(&Keystroke::parse(&resolve(spec)).unwrap()) - } - - #[test] - fn every_chord_runs_its_command() { - for (spec, c) in CHORDS { - assert_eq!(key(spec), Some(*c), "{spec}"); - } - } - - #[test] - fn the_pane_keys_run_their_commands() { - for (spec, c) in PANE_CHORDS { - assert_eq!(PaneCommand::for_key(&Keystroke::parse(&resolve(spec)).unwrap()), Some(*c), "{spec}"); - } - assert_eq!(PaneCommand::for_key(&Keystroke::parse("alt-p").unwrap()), None); - } - - #[test] - fn secondary_and_a_digit_shows_that_session_but_shift_does_not() { - assert_eq!(key("secondary-3"), Some(Command::ShowSession(3))); - assert_eq!(key("secondary-0"), None); - assert_eq!(key("secondary-shift-3"), None); - assert_eq!(key("n"), None, "a letter alone is typing"); - } -} diff --git a/src/app/config_sync.rs b/src/app/config_sync.rs index 4884a5b..ca20f34 100644 --- a/src/app/config_sync.rs +++ b/src/app/config_sync.rs @@ -19,9 +19,9 @@ pub struct Runner { impl Workspace { /// Where each account keeps its files. An account with a running session has its `.claude.json` left alone, /// because Claude Code rewrites that file from memory. - fn account_files(&self) -> Vec { + fn account_files(&self, cx: &App) -> Vec { let busy = |account: &Account| { - self.live.iter().any(|l| l.view.is_running() && self.store.session_account(&l.id).is_some_and(|a| a.id == account.id)) + self.live.iter().any(|l| l.view.is_running(cx) && self.store.session_account(&l.id).is_some_and(|a| a.id == account.id)) }; self.store .data @@ -34,35 +34,35 @@ impl Workspace { .collect() } - pub(super) fn sync_configs(&mut self) { - let accounts = self.account_files(); + pub(super) fn sync_configs(&mut self, cx: &mut Context) { + let accounts = self.account_files(cx); if accounts.len() < 2 || self.config_sync.running || self.config_sync.last_try.is_some_and(|t| t.elapsed() < EVERY) { return; } self.config_sync.running = true; self.config_sync.last_try = Some(Instant::now()); - // Nothing is shown unless it fails, and then the toast redraws. - self.rt.spawn_quietly( - move || { sync::sync(&accounts, &sync::state_path()) }, - move |ws: &mut Workspace, result| { + cx.spawn(async move |this, cx| { + let result = cx.background_executor().spawn(async move { sync::sync(&accounts, &sync::state_path()) }).await; + let _ = this.update(cx, |ws, cx| { ws.config_sync.running = false; - ws.tell_sync_failure(result); - }, - ); + ws.tell_sync_failure(result, cx); + }); + }) + .detach(); } /// Before a session starts, so it begins with what the other accounts changed a moment ago. - pub(super) fn sync_configs_now(&mut self) { - let accounts = self.account_files(); + pub(super) fn sync_configs_now(&mut self, cx: &mut Context) { + let accounts = self.account_files(cx); if accounts.len() >= 2 { let result = sync::sync(&accounts, &sync::state_path()); - self.tell_sync_failure(result); + self.tell_sync_failure(result, cx); } } - fn tell_sync_failure(&mut self, result: std::io::Result<()>) { + fn tell_sync_failure(&mut self, result: std::io::Result<()>, cx: &mut Context) { if result.is_err() && !std::mem::replace(&mut self.config_sync.told, true) { - self.toast("Couldn't keep the Claude Code settings the same in every account. Will keep trying.", true); + self.toast("Couldn't keep the Claude Code settings the same in every account. Will keep trying.", true, cx); } } } diff --git a/src/app/cross.rs b/src/app/cross.rs index 9044a4a..ea74020 100644 --- a/src/app/cross.rs +++ b/src/app/cross.rs @@ -1,53 +1,29 @@ //! Sessions reaching other sessions: a Claude Code session can list, search and read the others and open a new one. -//! The MCP helper files the request (`claude/bridge.rs`) and Claudiu answers it on its next tick. Listing, searching and -//! reading answer at once; opening a session with a first message of its own asks the user first, since that is a -//! prompt the user never wrote. +//! The MCP helper files the request (`claude/bridge.rs`) and m4code answers it on its next tick, without asking the +//! user: the tools' instructions tell the model to call them only when the user asked for what they do. use super::*; use crate::claude::bridge::{self, Request}; +use crate::harness::CatalogModel; use serde_json::Value; /// Longest first message a session may hand over: it travels on a Windows command line, which is limited to about /// 32,000 characters. const MAX_PROMPT: usize = 2000; -/// A `start_code_session` request that waits for the user's answer to its dialog. -pub struct PendingStart { - req: Request, - /// The dialog is up (it needs the one modal slot, which another dialog may hold). - shown: bool, -} - -/// A worktree switch the user approved, waiting for the turn in which the session asked for it to end: the switch restarts -/// the process that made the call. +/// A worktree switch a session asked for, waiting for the turn in which it asked to end: the switch restarts the +/// process that made the call. pub struct PendingSwitch { id: Id, folder: PathBuf, base: crate::git::worktree::Base, - /// Unix seconds when the user approved it. - approved: i64, + /// Unix seconds when the session asked for it. + asked: i64, } -/// How long an approved switch waits for the turn to end before it is given up. +/// How long a switch waits for the turn to end before it is given up. const SWITCH_PATIENCE_SECS: i64 = 300; -/// Longest part of the first message the dialog quotes. -const SHOWN_PROMPT: usize = 600; - -/// What the dialog says about the session a session wants to open. -fn start_question(asker: &str, folder: &std::path::Path, prompt: &str) -> String { - let quoted: String = prompt.chars().take(SHOWN_PROMPT).collect(); - let more = if prompt.chars().count() > SHOWN_PROMPT { "…" } else { "" }; - format!("“{asker}” wants to open a new Claude Code session in {} with this first message:\n\n{quoted}{more}", folder.to_string_lossy()) -} - -/// What the dialog says about the worktree a session wants to move into. -fn switch_question(asker: &str, folder: &std::path::Path, new: bool) -> String { - let name = folder.file_name().map_or_else(|| folder.to_string_lossy().into_owned(), |n| n.to_string_lossy().into_owned()); - let what = if new { format!("a new worktree, {name}") } else { format!("the worktree {name}") }; - format!("“{asker}” wants to switch to {what}. Its process restarts once its turn ends, and the conversation continues there.") -} - /// `2026-10-22 09:10 UTC` for a Unix time (days since 1970 turned into a calendar date, no time crate needed). fn utc(ts: i64) -> String { let (days, secs) = (ts.div_euclid(86_400), ts.rem_euclid(86_400)); @@ -102,72 +78,27 @@ impl Workspace { /// Answer the requests that arrived since the last tick (not those whose asker has given up). One that can't /// work is refused with the reason. - pub(super) fn serve_requests(&mut self, requests: Vec) { + pub(super) fn serve_requests(&mut self, requests: Vec, window: &mut Window, cx: &mut Context) { for mut req in requests.into_iter().filter(|r| r.deadline > crate::store::now()) { - let prepared = self.prepare(&mut req); - if prepared.is_ok() && wants_confirmation(&req) { - self.pending_starts.push(PendingStart { req, shown: false }); + let prepared = self.prepare(&mut req, cx); + if prepared.is_ok() && req.tool == "wait_subagent" && self.defer_subagent_wait(&req, cx) { continue; } - let result = prepared.and_then(|()| self.run_request(&req)); + let result = prepared.and_then(|()| self.run_request(&req, window, cx)); let ok = result.is_ok(); answer(&req, ok, result.unwrap_or_else(|e| e)); } - self.settle_pending_starts(); - } - - /// Once a second: drop the requests nobody waits for, show the next dialog when the modal slot is free, and tell the - /// session when its dialog was closed without a yes. - fn settle_pending_starts(&mut self) { - let now = crate::store::now(); - self.pending_starts.retain(|p| p.req.deadline > now); - let asking = match &self.modal { - Some(Modal::Confirm { act: Act::ConfirmStartSession(id), .. }) => Some(id.clone()), - _ => None, - }; - let mut declined = vec![]; - self.pending_starts.retain(|p| { - let gone = p.shown && asking.as_deref() != Some(p.req.id.as_str()); - if gone { - declined.push(p.req.clone()); - } - !gone - }); - for req in declined { - answer(&req, false, "The user declined."); - } - if self.modal.is_some() { - return; - } - let Some(p) = self.pending_starts.iter_mut().find(|p| !p.shown) else { return }; - p.shown = true; - let requester = p.req.from.split_once(':').map_or(p.req.from.as_str(), |(_, id)| id); - let asker = self.store.session(requester).map_or_else(|| "A session".to_string(), |s| s.display_title().to_string()); - let folder = PathBuf::from(p.req.args["folder"].as_str().unwrap_or_default()); - let (title, body, confirm) = if p.req.tool == "switch_worktree" { - ("Switch worktree?", switch_question(&asker, &folder, p.req.args["new"].as_bool().unwrap_or(false)), "Switch") - } else { - let prompt = p.req.args["prompt"].as_str().unwrap_or_default().trim().to_string(); - ("Start a Claude Code session?", start_question(&asker, &folder, &prompt), "Start session") - }; - self.modal = Some(Modal::Confirm { title: title.into(), body, confirm: confirm.into(), danger: false, act: Act::ConfirmStartSession(p.req.id.clone()) }); - } - - /// The user said yes to a waiting `start_code_session`. - pub(super) fn confirm_start(&mut self, req_id: &str) { - self.modal = None; - let Some(ix) = self.pending_starts.iter().position(|p| p.req.id == req_id) else { return }; - let req = self.pending_starts.remove(ix).req; - let result = self.run_request(&req); - let ok = result.is_ok(); - answer(&req, ok, result.unwrap_or_else(|e| e)); + self.settle_subagent_waits(cx); } /// Check what the request needs. A new session's folder, or the worktree to switch to, is resolved into `req.args["folder"]`. - fn prepare(&self, req: &mut Request) -> Result<(), String> { + fn prepare(&self, req: &mut Request, cx: &App) -> Result<(), String> { if req.tool == "switch_worktree" { return self.prepare_switch(req); } + if req.tool == "set_model" { + return self.prepare_model(req, cx); + } if req.tool != "start_code_session" { return Ok(()); } @@ -179,12 +110,50 @@ impl Workspace { if req.args["prompt"].as_str().is_some_and(|p| p.trim().chars().count() > MAX_PROMPT) { return Err(format!("The first message is too long ({MAX_PROMPT} characters at most). Shorten it, or write the details to a file and point to it.")); } + if let Some(wanted) = req.args["model"].as_str().map(str::trim).filter(|m| !m.is_empty()) { + let model = find_model(&self.store.data.settings.aggregated_models(), wanted)?; + req.args["harness"] = model.harness.key().into(); + req.args["model_id"] = model.id.into(); + } + if let Some(effort) = req.args["effort"].as_str().filter(|e| !e.is_empty()) + && !crate::claude::defaults::Effort::ALL.iter().any(|known| known.name() == effort) + { + return Err("Choose low, medium, high, xhigh or max effort.".into()); + } + Ok(()) + } + + /// The requester's chat view, for the model tools. + fn requester_thread(&self, req: &Request) -> Result, String> { + let id = req.from.split_once(':').map_or(req.from.as_str(), |(_, id)| id); + self.live_view(id).and_then(|v| v.thread()).cloned().ok_or_else(|| "This session isn't open in m4code's chat view.".to_string()) + } + + /// Resolve `set_model`'s model into `harness`, `model_id` and `name`, and mark a switch onto another harness + /// (`cross`), which hands the conversation over once the turn ends. + fn prepare_model(&self, req: &mut Request, cx: &App) -> Result<(), String> { + let thread = self.requester_thread(req)?.read(cx); + let wanted = req.args["model"].as_str().map(str::trim).filter(|m| !m.is_empty()); + if wanted.is_none() && req.args["effort"].as_str().is_none() { + return Err("Give a model (as list_models prints it), an effort, or both.".into()); + } + if let Some(wanted) = wanted { + let model = find_model(&thread.unified_models(), wanted)?; + let cross = model.harness != thread.harness; + if cross && req.args["message"].as_str().is_some_and(|m| m.trim().chars().count() > MAX_PROMPT) { + return Err(format!("The message is too long ({MAX_PROMPT} characters at most).")); + } + req.args["harness"] = model.harness.key().into(); + req.args["model_id"] = model.id.clone().into(); + req.args["name"] = format!("{} ({})", model.name, model.harness.name()).into(); + req.args["cross"] = cross.into(); + } Ok(()) } fn prepare_switch(&self, req: &mut Request) -> Result<(), String> { let id = req.from.split_once(':').map_or(req.from.as_str(), |(_, id)| id); - let rec = self.store.session(id).ok_or("Claudiu doesn't know this session.")?; + let rec = self.store.session(id).ok_or("m4code doesn't know this session.")?; let git = rec.project_id.as_ref().and_then(|p| self.store.project(p)).and_then(|p| p.git.as_ref()).ok_or("This session's project is not a git repository.")?; let wanted = req.args["worktree"].as_str().unwrap_or_default(); let listed = crate::git::worktree::folders(git).into_iter().skip(1).filter_map(|f| f.file_name().map(|n| n.to_string_lossy().into_owned())).collect::>(); @@ -194,9 +163,9 @@ impl Workspace { Ok(()) } - /// Start the approved switches whose session has ended its turn. Looks at Claude Code's own status, as a switch from + /// Start the switches whose session has ended its turn. Looks at Claude Code's own status, as a switch from /// the menu does, so the call that asked is finished and answered first. - pub(super) fn run_pending_switches(&mut self, statuses: &std::collections::HashMap) { + pub(super) fn run_pending_switches(&mut self, statuses: &std::collections::HashMap, window: &mut Window, cx: &mut Context) { let now = crate::store::now(); let pending = std::mem::take(&mut self.pending_switches); for p in pending { @@ -204,14 +173,14 @@ impl Workspace { // Without a registry entry (older Claude Code) the terminal's own activity decides, as in `switch::inspect`. let idle = match claude_id.and_then(|c| statuses.get(c)) { Some(status) => status == "idle", - None => self.live_view(&p.id).is_some_and(|v| !v.is_working()), + None => self.live_view(&p.id).is_some_and(|v| !v.is_working(cx)), }; - if now - p.approved > SWITCH_PATIENCE_SECS { - self.toast("The worktree switch was dropped: the session's turn did not end.", true); - } else if !self.is_running(&p.id) { + if now - p.asked > SWITCH_PATIENCE_SECS { + self.toast("The worktree switch was dropped: the session's turn did not end.", true, cx); + } else if !self.is_running(&p.id, cx) { // Closed in the meantime: nothing to move. } else if idle { - self.switch_session(p.id, p.folder, p.base, false); + self.switch_session(p.id, p.folder, p.base, false, window, cx); } else { self.pending_switches.push(p); } @@ -219,7 +188,10 @@ impl Workspace { } /// Do what was asked. - pub(super) fn run_request(&mut self, req: &Request) -> Result { + pub(super) fn run_request(&mut self, req: &Request, window: &mut Window, cx: &mut Context) -> Result { + if crate::claude::mcp::SUBAGENT_TOOLS.contains(&req.tool.as_str()) { + return self.run_subagent_request(req, window, cx); + } let id = req.args["id"].as_str().unwrap_or_default().to_string(); let count = |key: &str, default: u64, max: u64| req.args[key].as_u64().unwrap_or(default).clamp(1, max) as usize; let requester_id = req.from.split_once(':').map_or(req.from.as_str(), |(_, id)| id); @@ -234,7 +206,7 @@ impl Workspace { .take(50) .map(|s| { let project = self.store.project_for_cwd(&s.cwd).and_then(|p| self.store.project(&p)).map_or_else(|| s.cwd.to_string_lossy().into_owned(), |p| p.name.clone()); - let state = if self.is_running(&s.id) { "running" } else { "ended" }; + let state = if self.is_running(&s.id, cx) { "running" } else { "ended" }; let me = req.from == format!("code:{}", s.id); format!("- id {} · {} · {project} · {state} · {}{}", s.id, s.display_title(), stamps(s.created_at, s.last_active), if me { " · this session" } else { "" }) }) @@ -278,79 +250,149 @@ impl Workspace { } "read_code_session" => { let rec = self.store.session(&id).filter(|s| s.kind == SessionKind::Claude).ok_or("No session with that id.")?; - let view = self.live_view(&id).filter(|v| v.is_running()).ok_or_else(|| format!("The session “{}” has ended; only running sessions can be read.", rec.display_title()))?; - let text = view.tail_text(count("lines", 120, 400)); - Ok(format!("Session “{}” ({}), latest terminal output:\n\n{text}", rec.display_title(), stamps(rec.created_at, rec.last_active))) + let view = self.live_view(&id).filter(|v| v.is_running(cx)).ok_or_else(|| format!("The session “{}” has ended; only running sessions can be read.", rec.display_title()))?; + let text = view.tail_text(count("lines", 120, 400), cx); + Ok(format!("Session “{}” ({}), latest conversation:\n\n{text}", rec.display_title(), stamps(rec.created_at, rec.last_active))) } "start_code_session" => { let cwd = folder.ok_or("No folder.")?; + let harness = req.args["harness"].as_str().and_then(|key| crate::harness::Harness::ALL.into_iter().find(|h| h.key() == key)).unwrap_or(self.store.data.settings.harness); + // The model may pick the model and effort; the permission mode stays the user's default for new + // sessions (`Starter::OtherSession` never bypasses permissions). + let mut options = vec![]; + if let Some(model) = req.args["model_id"].as_str() { + options.push(("model", model.to_string())); + } + if let Some(effort) = req.args["effort"].as_str().filter(|e| !e.is_empty()) { + options.push(("thought_level", effort.to_string())); + } let before = self.selected.clone(); - // A prompt that looks like a flag must not become one. - let leading = prompt.map(|p| if p.starts_with('-') { format!(" {p}") } else { p }).into_iter().collect(); - self.new_claude_with(cwd.clone(), leading, Starter::OtherSession); + self.new_session_with(harness, cwd.clone(), prompt, options, Starter::OtherSession, window, cx); match self.selected.clone().filter(|s| Some(s) != before.as_ref()) { Some(id) => { // A session started from another one is linked with it from the start. self.link(requester_id, &id); - Ok(format!("Opened a Claude Code session (id {id}) in {}. It is running in the user's sidebar.", cwd.to_string_lossy())) + Ok(format!("Opened a {} session (id {id}) in {}. It is running in the user's sidebar.", harness.name(), cwd.to_string_lossy())) } - None => Err("The session could not be started (is the `claude` CLI installed?).".into()), + None => Err(format!("The {} session could not be started.", harness.name())), } } "switch_worktree" => { let folder = folder.ok_or("No folder.")?; let base = if req.args["base"].as_str() == Some("current") { crate::git::worktree::Base::Current } else { crate::git::worktree::Base::Main }; let name = folder.file_name().map_or_else(|| "the main checkout".into(), |n| n.to_string_lossy().into_owned()); - self.pending_switches.push(PendingSwitch { id: requester_id.to_string(), folder, base, approved: crate::store::now() }); - Ok(format!("Approved. Claudiu switches this session to {name} as soon as your turn ends, so end your turn now: reply in one line and make no more tool calls. The user's next message continues the same conversation there.")) + self.pending_switches.push(PendingSwitch { id: requester_id.to_string(), folder, base, asked: crate::store::now() }); + Ok(format!("m4code switches this session to {name} as soon as your turn ends, so end your turn now: reply in one line and make no more tool calls. The user's next message continues the same conversation there.")) + } + "list_models" => { + let thread = self.requester_thread(req)?.read(cx); + Ok(model_lines(&thread.unified_models(), thread.current_model().as_ref())) + } + "set_model" => { + let thread = self.requester_thread(req)?; + let model = req.args["harness"].as_str().and_then(|key| crate::harness::Harness::ALL.into_iter().find(|h| h.key() == key)).map(|harness| CatalogModel { + harness, + id: req.args["model_id"].as_str().unwrap_or_default().to_string(), + name: req.args["name"].as_str().unwrap_or_default().to_string(), + }); + let effort = effort_for(req.args["effort"].as_str(), model.is_some()); + match model { + Some(model) if req.args["cross"].as_bool() == Some(true) => { + let message = req.args["message"].as_str().map(str::trim).filter(|m| !m.is_empty()).map_or_else(|| "Carry on with the task from where the conversation left off.".into(), String::from); + let name = model.name.clone(); + thread.update(cx, |t, cx| t.hand_off_after_turn(model, effort, message, cx)); + Ok(format!("m4code hands this conversation to {name} as soon as your turn ends, so end your turn now: reply in one line and make no more tool calls.")) + } + model => { + let done = thread.update(cx, |t, cx| t.switch_model(model.as_ref(), effort.as_deref(), cx))?; + Ok(format!("Switched to {done} from your next request. Your system prompt may still name the previous model; ignore that.")) + } + } } other => Err(format!("unknown tool {other}")), } } } -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn unix_times_become_utc_dates() { - assert_eq!(utc(0), "1970-01-01 00:00 UTC"); - assert_eq!(utc(1_782_119_400), "2026-06-22 09:10 UTC"); - assert_eq!(utc(951_782_400 + 3600), "2000-02-29 01:00 UTC"); +/// The effort set_model asks for: the one the agent named, or medium with a new model, since agents are told to name an +/// effort only when the user did. +fn effort_for(named: Option<&str>, new_model: bool) -> Option { + match named.map(str::trim).filter(|e| !e.is_empty()) { + Some(effort) => Some(effort.to_string()), + None => new_model.then(|| "medium".to_string()), } } -/// A new session with a first message of its own is a prompt the user did not write, and a worktree switch restarts the -/// session: both wait for the user's yes. -fn wants_confirmation(req: &Request) -> bool { - req.tool == "switch_worktree" || (req.tool == "start_code_session" && req.args["prompt"].as_str().is_some_and(|p| !p.trim().is_empty())) +/// What `list_models` answers: one line per model a session can switch to, `harness:model-id · name`, the current one +/// marked. +fn model_lines(models: &[CatalogModel], current: Option<&CatalogModel>) -> String { + let lines: Vec = models + .iter() + .filter(|m| !m.id.is_empty()) + .map(|m| { + let here = current.is_some_and(|c| c.harness == m.harness && c.id == m.id); + format!("- {}:{} · {} ({}){}", m.harness.key(), m.id, m.name, m.harness.name(), if here { " · current" } else { "" }) + }) + .collect(); + if lines.is_empty() { "No models are listed yet.".into() } else { lines.join("\n") } +} + +/// The model `wanted` names, as `list_models` prints it (`codex:gpt-6`). A bare id is accepted when only one harness +/// offers it, so `opus` still works when it is unambiguous. +fn find_model(models: &[CatalogModel], wanted: &str) -> Result { + let wanted = wanted.trim(); + let named = |m: &&CatalogModel| match wanted.split_once(':') { + Some((key, id)) if crate::harness::Harness::ALL.iter().any(|h| h.key() == key) => m.harness.key() == key && m.id == id, + _ => m.id == wanted, + }; + let found: Vec<&CatalogModel> = models.iter().filter(|m| !m.id.is_empty()).filter(named).collect(); + match found.as_slice() { + [one] => Ok((*one).clone()), + [] => Err(format!("No model “{wanted}”. Use one of these exactly as written:\n{}", model_lines(models, None))), + many => Err(format!("“{wanted}” is offered by {}. Say which, as harness:model-id.", many.iter().map(|m| m.harness.name()).collect::>().join(" and "))), + } } #[cfg(test)] -mod start_tests { +mod tests { use super::*; - use serde_json::json; - fn request(tool: &str, args: Value) -> Request { - Request { id: "r".into(), from: "code:s".into(), tool: tool.into(), args, deadline: 0 } + fn models() -> Vec { + use crate::harness::Harness; + let m = |harness, id: &str, name: &str| CatalogModel { harness, id: id.into(), name: name.into() }; + vec![m(Harness::Claude, "opus", "Opus"), m(Harness::Codex, "gpt-6", "GPT-6"), m(Harness::OpenCode, "gpt-6", "GPT-6 (OpenCode)"), m(Harness::Antigravity, "", "Antigravity (default)")] + } + + #[test] + fn set_model_finds_a_model_by_harness_and_id_or_by_an_unambiguous_id() { + assert_eq!(find_model(&models(), "codex:gpt-6").unwrap().harness, crate::harness::Harness::Codex); + assert_eq!(find_model(&models(), " opus ").unwrap().id, "opus"); + let both = find_model(&models(), "gpt-6").unwrap_err(); + assert!(both.contains("Codex and OpenCode"), "{both}"); + let none = find_model(&models(), "claude:sonnet").unwrap_err(); + assert!(none.contains("- codex:gpt-6 · GPT-6 (Codex)"), "an unknown name lists the choices: {none}"); + assert!(find_model(&models(), "antigravity:").is_err(), "a harness's placeholder default is not a model to switch to"); + } + + #[test] + fn set_model_uses_medium_effort_unless_one_is_named() { + assert_eq!(effort_for(None, true).as_deref(), Some("medium")); + assert_eq!(effort_for(Some(" "), true).as_deref(), Some("medium")); + assert_eq!(effort_for(Some("high"), true).as_deref(), Some("high")); + assert_eq!(effort_for(Some("low"), false).as_deref(), Some("low")); + assert_eq!(effort_for(None, false), None, "an effort-only call always names one"); } #[test] - fn only_a_session_with_a_first_message_needs_the_users_yes() { - assert!(wants_confirmation(&request("start_code_session", json!({"folder": "/p", "prompt": "do it"})))); - assert!(!wants_confirmation(&request("start_code_session", json!({"folder": "/p"}))), "no prompt, nothing to approve"); - assert!(!wants_confirmation(&request("start_code_session", json!({"folder": "/p", "prompt": " "})))); - assert!(!wants_confirmation(&request("read_code_session", json!({"prompt": "x"})))); - assert!(wants_confirmation(&request("switch_worktree", json!({"worktree": "fix"}))), "a switch always asks"); + fn list_models_marks_the_current_model() { + let listed = model_lines(&models(), models().get(1)); + assert_eq!(listed, "- claude:opus · Opus (Claude Code)\n- codex:gpt-6 · GPT-6 (Codex) · current\n- opencode:gpt-6 · GPT-6 (OpenCode) (OpenCode)"); } #[test] - fn the_dialog_quotes_a_long_message_in_part() { - let long = "x".repeat(SHOWN_PROMPT + 50); - let text = start_question("Fix build", std::path::Path::new("/p"), &long); - assert!(text.starts_with("“Fix build” wants to open a new Claude Code session in /p")); - assert!(text.ends_with(&format!("{}…", "x".repeat(SHOWN_PROMPT)))); - assert!(!start_question("a", std::path::Path::new("/p"), "short").contains('…')); + fn unix_times_become_utc_dates() { + assert_eq!(utc(0), "1970-01-01 00:00 UTC"); + assert_eq!(utc(1_782_119_400), "2026-06-22 09:10 UTC"); + assert_eq!(utc(951_782_400 + 3600), "2000-02-29 01:00 UTC"); } } diff --git a/src/app/editing.rs b/src/app/editing.rs index 185f709..36a6f84 100644 --- a/src/app/editing.rs +++ b/src/app/editing.rs @@ -3,11 +3,12 @@ use std::path::Path; +use gpui_kit::component::input::Position; + use super::*; -use crate::editor::Mark; use crate::files::{self, Contents, SaveError, Stamp}; -/// Why a tab's file and its text disagree in a way the user has to settle. +/// Why a tab's file and its buffer disagree in a way the user has to settle. #[derive(Clone, Copy, Debug, PartialEq)] pub enum Conflict { /// Changed on disk while the tab had unsaved edits. @@ -17,67 +18,72 @@ pub enum Conflict { impl Workspace { /// Save the shown tab of the shown session. Refuses, and shows the conflict, when the file changed on disk meanwhile. - pub fn save_shown(&mut self) { - let Some(id) = self.active_id().cloned() else { return }; - let Some(tab) = self.panes.get_mut(&id).and_then(|p| p.shown_mut()).filter(|t| t.note.is_none()) else { return }; + pub fn save_shown(&mut self, cx: &mut Context) { + let Some(id) = self.editor_owner() else { return }; + let Some(pane) = self.panes.get_mut(&id) else { return }; + let Some(tab) = pane.active.and_then(|ix| pane.tabs.get_mut(ix)).filter(|t| t.note.is_none()) else { return }; tab.saving = true; let (path, format, expected) = (tab.path.clone(), tab.format.clone(), tab.stamp); - let text = tab.editor.buffer.text(); - let version = tab.editor.buffer.version(); - let write = path.clone(); - self.rt.spawn(move || files::save(&write, &text, format, expected), move |ws: &mut Workspace, saved| ws.on_saved(&id, &path, version, saved)); - } - - fn on_saved(&mut self, id: &Id, path: &Path, version: u64, saved: Result) { - let mut tab = self.panes.get_mut(id).and_then(|p| p.tabs.iter_mut().find(|t| t.path == path)); - if let Some(tab) = tab.as_deref_mut() { - tab.saving = false; - } - match (saved, tab) { - (Ok(stamp), Some(tab)) => { - tab.stamp = Some(stamp); - // Typing while the file was written leaves edits the file doesn't have yet. - if tab.editor.buffer.version() == version { - tab.editor.buffer.mark_saved(); + let text = tab.buffer.read(cx).value().to_string(); + cx.spawn(async move |this, cx| { + let (write, written) = (path.clone(), text.clone()); + let saved = cx.background_executor().spawn(async move { files::save(&write, &written, format, expected) }).await; + let _ = this.update(cx, |ws, cx| { + let mut tab = ws.panes.get_mut(&id).and_then(|p| p.tabs.iter_mut().find(|t| t.path == path)); + if let Some(tab) = tab.as_deref_mut() { + tab.saving = false; } - tab.dirty = tab.editor.buffer.is_dirty(); - tab.conflict = None; - self.tell_server_saved(id, path); - self.refresh_marks(); - } - (Ok(_), None) => {} - (Err(SaveError::Changed), tab) => { - if let Some(tab) = tab { - tab.conflict = Some(Conflict::Changed); + match (saved, tab) { + (Ok(stamp), Some(tab)) => { + tab.stamp = Some(stamp); + // Typing while the file was written leaves edits the file doesn't have yet. + tab.dirty = tab.buffer.read(cx).value() != text.as_str(); + tab.conflict = None; + ws.tell_server_saved(&id, &path); + ws.refresh_marks(cx); + } + (Ok(_), None) => {} + (Err(SaveError::Changed), tab) => { + if let Some(tab) = tab { + tab.conflict = Some(Conflict::Changed); + } + ws.toast("Not saved: the file changed on disk. Reload it or keep your version.", true, cx); + } + (Err(SaveError::Io(e)), _) => ws.toast(format!("Could not save {}: {e}", path.display()), true, cx), } - self.toast("Not saved: the file changed on disk. Reload it or keep your version.", true); - } - (Err(SaveError::Io(e)), _) => self.toast(format!("Could not save {}: {e}", path.display()), true), - } + cx.notify(); + }); + }) + .detach(); } /// Look at the shown session's open files on disk (once a second, off the UI thread): reload the clean ones that /// changed, and flag a conflict on the ones with unsaved edits. - pub(super) fn check_open_files(&mut self) { - let Some(id) = self.active_id().filter(|_| self.editing()).cloned() else { return }; + pub(super) fn check_open_files(&mut self, window: &mut Window, cx: &mut Context) { + let Some(id) = self.editor_owner().filter(|_| self.editing()) else { return }; let Some(pane) = self.panes.get(&id) else { return }; // A tab without a stamp follows nothing: it was never read, or the user chose to keep their version. let watched: Vec<(PathBuf, Stamp)> = pane.tabs.iter().filter(|t| !t.saving).filter_map(|t| Some((t.path.clone(), t.stamp?))).collect(); if watched.is_empty() { return; } - self.rt.spawn_quietly( - move || { - watched - .into_iter() - .filter_map(|(path, seen)| { - let now = files::stamp(&path); - (now != Some(seen)).then_some((path, seen, now)) - }) - .collect::>() - }, - move |ws: &mut Workspace, changed| { - ws.rt.dirty |= !changed.is_empty(); + cx.spawn_in(window, async move |this, cx| { + let changed: Vec<(PathBuf, Stamp, Option)> = cx + .background_executor() + .spawn(async move { + watched + .into_iter() + .filter_map(|(path, seen)| { + let now = files::stamp(&path); + (now != Some(seen)).then_some((path, seen, now)) + }) + .collect() + }) + .await; + if changed.is_empty() { + return; + } + let _ = this.update_in(cx, |ws, window, cx| { for (path, seen, now) in changed { let Some(tab) = ws.panes.get_mut(&id).and_then(|p| p.tabs.iter_mut().find(|t| t.path == path)) else { continue }; // Saved or reloaded since the look began (or being saved now): the new stamp is the tab's own. @@ -85,30 +91,35 @@ impl Workspace { continue; } match (now, tab.dirty) { - (Some(_), false) => ws.reload_tab(&id, path), + (Some(_), false) => ws.reload_tab(&id, path, window, cx), (Some(_), true) => tab.conflict = Some(Conflict::Changed), (None, _) => tab.conflict = Some(Conflict::Deleted), } } - }, - ); + cx.notify(); + }); + }) + .detach(); } - /// Read the tab's file again, dropping unsaved edits; the caret stays where it was. - pub fn reload_tab(&mut self, id: &Id, path: PathBuf) { + /// Read the tab's file again, dropping unsaved edits; the cursor stays on its line. + pub fn reload_tab(&mut self, id: &Id, path: PathBuf, window: &mut Window, cx: &mut Context) { let id = id.clone(); - let read = path.clone(); - self.rt.spawn( - move || (files::read(&read), files::stamp(&read)), - move |ws: &mut Workspace, (contents, now)| { + cx.spawn_in(window, async move |this, cx| { + let read = path.clone(); + let (contents, now) = cx.background_executor().spawn(async move { (files::read(&read), files::stamp(&read)) }).await; + let _ = this.update_in(cx, |ws, window, cx| { let Some(tab) = ws.panes.get_mut(&id).and_then(|p| p.tabs.iter_mut().find(|t| t.path == path)) else { return }; match contents { Ok(Contents::Text { text, format, stamp }) => { - tab.editor.set_text(&text); - tab.editor.edited = false; + tab.buffer.update(cx, |b, cx| { + let at = b.cursor_position(); + b.set_tab_size(super::editor_mode::tab_size(&format), cx); + b.set_value(text, window, cx); + b.set_cursor_position(Position::new(at.line, 0), window, cx); + }); (tab.format, tab.stamp, tab.dirty, tab.conflict) = (format, Some(stamp), false, None); - ws.sync_with_server(&id, &path, true); - ws.refresh_marks(); + ws.sync_with_server(&id, &path, true, cx); } // Grew too large, stopped being text, or vanished: keep what is shown and let the user decide. The // stamp moves on so the once-a-second check does not read the same file again until it changes. @@ -117,31 +128,43 @@ impl Workspace { tab.stamp = now.or(tab.stamp); } } - }, - ); + cx.notify(); + }); + }) + .detach(); } - /// Settle a conflict by keeping the editor's text: the next save writes it over whatever is on disk. - pub fn keep_mine(&mut self, id: &Id, path: &Path) { + /// Settle a conflict by keeping the buffer: the next save writes it over whatever is on disk. + pub fn keep_mine(&mut self, id: &Id, path: &Path, cx: &mut Context) { if let Some(tab) = self.panes.get_mut(id).and_then(|p| p.tabs.iter_mut().find(|t| t.path == path)) { tab.conflict = None; tab.stamp = None; tab.dirty = true; + cx.notify(); } } - /// Ctrl+W: close the shown tab, asking first when it has unsaved edits. - pub fn close_shown_tab(&mut self) { - let Some(id) = self.active_id().cloned() else { return }; + /// Ctrl+W: close the shown tab, asking first when it has unsaved edits. The closed editor had the keyboard, so it + /// goes to the tab now shown (or the pane), and the key works again. + pub fn close_shown_tab(&mut self, window: &mut Window, cx: &mut Context) { + let Some(id) = self.editor_owner() else { return }; let Some(ix) = self.panes.get(&id).and_then(|p| p.active) else { return }; - self.request_close_tab(&id, ix); + self.request_close_tab(&id, ix, window, cx); + if self.modal.is_some() { + return; + } + let Some(pane) = self.panes.get(&id) else { return }; + match pane.shown().map(|t| t.buffer.clone()) { + Some(buffer) => buffer.update(cx, |b, cx| b.focus(window, cx)), + None => window.focus(&pane.focus, cx), + } } /// Close tab `ix`, asking first when it has unsaved edits. - pub fn request_close_tab(&mut self, id: &Id, ix: usize) { + pub fn request_close_tab(&mut self, id: &Id, ix: usize, window: &mut Window, cx: &mut Context) { let Some(tab) = self.panes.get(id).and_then(|p| p.tabs.get(ix)) else { return }; if !tab.dirty { - self.close_tab(id, ix); + self.close_tab(id, ix, cx); return; } let name = tab.path.file_name().unwrap_or_default().to_string_lossy().to_string(); @@ -152,7 +175,8 @@ impl Workspace { danger: true, act: Act::DiscardTab(id.clone(), tab.path.clone()), }); - self.modal_serial += 1; + window.focus(&self.modal_focus, cx); + cx.notify(); } /// Files with unsaved edits, in one session's pane or (with `None`) in all of them. @@ -161,10 +185,10 @@ impl Workspace { } /// End a session, asking first when its editor has unsaved files. - pub(super) fn request_close_live(&mut self, id: &Id) { + pub(super) fn request_close_live(&mut self, id: &Id, window: &mut Window, cx: &mut Context) { let unsaved = self.unsaved(Some(id)); if unsaved == 0 { - self.close_live(id); + self.close_live(id, window, cx); return; } self.modal = Some(Modal::Confirm { @@ -174,53 +198,11 @@ impl Workspace { danger: true, act: Act::ConfirmCloseLive(id.clone()), }); - self.modal_serial += 1; - } - - /// Re-read, off the UI thread, which lines of the shown file differ from the last commit. - pub(super) fn refresh_marks(&mut self) { - let Some(id) = self.active_id().filter(|_| self.editor_mode).cloned() else { return }; - let Some(path) = self.panes.get(&id).and_then(|p| p.shown()).filter(|t| t.note.is_none()).map(|t| t.path.clone()) else { return }; - let read = path.clone(); - self.rt.spawn( - move || marks_of(&crate::git::lines::changed_lines(&read)), - move |ws: &mut Workspace, marks| { - let Some(tab) = ws.panes.get_mut(&id).and_then(|p| p.tabs.iter_mut().find(|t| t.path == path)) else { return }; - if tab.editor.marks != marks { - tab.editor.marks = marks; - tab.editor.dirty = true; - } - }, - ); + window.focus(&self.modal_focus, cx); + cx.notify(); } } -/// Git's changes as the editor's gutter shows them: a mark on each added or changed line, and one where lines went. -fn marks_of(changes: &[crate::git::lines::Change]) -> Vec<(usize, Mark)> { - use crate::git::lines::Kind; - let mut marks = vec![]; - for c in changes { - match c.kind { - Kind::Deleted => marks.push((c.lines.start, Mark::Removed)), - Kind::Added => marks.extend(c.lines.clone().map(|l| (l, Mark::Added))), - Kind::Modified => marks.extend(c.lines.clone().map(|l| (l, Mark::Modified))), - } - } - marks -} - pub(super) fn plural(n: usize) -> &'static str { if n == 1 { "" } else { "s" } } - -#[cfg(test)] -mod tests { - use super::*; - use crate::git::lines::{Change, Kind}; - - #[test] - fn each_changed_line_gets_a_mark_and_a_removal_marks_the_line_below_it() { - let changes = [Change { lines: 0..2, kind: Kind::Added }, Change { lines: 5..5, kind: Kind::Deleted }, Change { lines: 7..8, kind: Kind::Modified }]; - assert_eq!(marks_of(&changes), [(0, Mark::Added), (1, Mark::Added), (5, Mark::Removed), (7, Mark::Modified)]); - } -} diff --git a/src/app/editor_mode.rs b/src/app/editor_mode.rs index 90e8ced..c327bde 100644 --- a/src/app/editor_mode.rs +++ b/src/app/editor_mode.rs @@ -1,15 +1,16 @@ //! Editor mode: the shown session's terminal narrows to the left, and its folder's files and an editor fill the rest. //! Each session keeps its own pane while it runs; listing and reading files happen off the UI thread (see `files`). -//! Saving and following changes on disk are in `editing.rs`; the pane is drawn by `panels/editor_pane.rs`. + +use gpui_kit::component::input::{EditorState, InputEvent, Position, TabSize}; +use gpui_kit::component::tree::{TreeEvent, TreeItem, TreeState}; use std::path::Path; -use std::time::{Duration, Instant}; -use super::editing::Conflict; +use futures::StreamExt; + use super::*; -use crate::editor::Editor; -use crate::files::{self, Change, Contents, Node, Stamp}; -use crate::platform::path_key; +use super::editing::Conflict; +use crate::files::{self, Contents, Node, Stamp}; /// Most entries listed in the tree, so a session started in a huge plain folder (or the home folder) stays usable. const LIST_LIMIT: usize = 20_000; @@ -18,65 +19,49 @@ const RELIST_GAP: Duration = Duration::from_secs(2); /// A watched folder is listed again this often even when its watcher reports nothing. const WATCHED_RELIST: Duration = Duration::from_secs(30); -/// One row of the file tree as it is shown: the open folders' contents under them. -#[derive(Clone, Debug, PartialEq)] -pub struct TreeRow { - pub path: PathBuf, - pub name: String, - pub depth: usize, - pub folder: bool, - pub open: bool, - pub change: Option, -} - -/// Where the keyboard is in the pane when the editor doesn't have it: the file tree, so the pane's shortcuts work. -pub fn tree_key(id: &str) -> String { - format!("files:{id}") -} - -/// An entry of the editor's right-click menu (`Workspace::open_editor_menu`). -#[derive(Clone, Copy, Debug, PartialEq)] -pub enum EditorCommand { - GoToDefinition, - Cut, - Copy, - Paste, - SelectAll, - Ask(super::Ask), -} - /// A session's files and editor. Never persisted; it goes away with the session. pub struct EditorPane { + /// The pane as a whole (its file tree): the keyboard needs to be inside the pane for its shortcuts, such as Ctrl+P, + /// which otherwise belong to Claude Code. + pub focus: FocusHandle, + pub tree: Entity, /// Open files, in the order they were opened, and the one shown. pub tabs: Vec, + /// Smooth wheel scrolling of the tab bar. + pub tabs_scroll: crate::panels::glide::Smooth, + /// Smooth wheel scrolling of the file tree. + pub tree_scroll: crate::panels::glide::Smooth, pub active: Option, - /// The listing as last read, and the folder it lists. + /// The listing the tree was last given, to skip redrawing it when nothing changed, and the folder it lists. pub nodes: Vec, pub root: PathBuf, - /// The tree's rows with the open folders' contents, worked out when the listing or an open folder changes. - pub rows: Vec, - /// Bumped whenever `rows` changes, so the tree's list knows its keys moved. - pub rows_version: u64, /// The listing's files, and each one's path under `root` as quick open shows it; worked out once per listing /// rather than on every keystroke. pub files: std::sync::Arc>, pub relative: std::sync::Arc>, /// Git's changes by `path_key`, see `files::Listing`. - pub changed: HashMap, + pub changed: std::sync::Arc>, pub truncated: bool, - /// Places the editor left (file and caret line), latest last, for Back; and the ones Back left, for Forward. - pub back: Vec<(PathBuf, usize)>, - pub forward: Vec<(PathBuf, usize)>, + /// Places the editor left (file and cursor line), latest last, for Back; and the ones Back left, for Forward. + pub back: Vec<(PathBuf, u32)>, + pub forward: Vec<(PathBuf, u32)>, /// Files shown lately, latest first, which quick open lists first. pub recent: Vec, /// Folders the user opened, kept open across refreshes. - pub expanded: HashSet, - /// Quick open or find in files, while it is up. - pub picker: Option, + pub expanded: HashSet, + /// Tree ids of the listed folders with nothing in them, which the tree would otherwise take for files, since it + /// counts an item with no children as one. + pub empty_folders: std::sync::Arc>, /// A listing is on its way. A refresh asked for meanwhile sets `relist`, because the walk under way may have /// passed the change already. pub listing: bool, pub relist: bool, + /// Quick open or find in files, while it is up. + pub picker: Option, + /// The comment box on lines of the shown tab, while it is up (`line_comment`). + pub comment: Option, + /// Language servers by program name; dropping the pane (the session ended) stops them. + pub servers: HashMap<&'static str, super::language_servers::ServerState>, /// Tells the pane when its folder changes on disk (see `watch_folder`); while there is none, every tick lists /// the folder again. pub watcher: Option, @@ -93,295 +78,310 @@ pub struct EditorPane { pub listed_at: Option, /// A listing is set to follow once `RELIST_GAP` has passed. pub relist_due: bool, - /// The language servers this session started, by program (see `lsp::KINDS`). - pub servers: HashMap<&'static str, super::language_servers::ServerState>, + pub _sub: Subscription, } -impl EditorPane { - pub fn shown(&self) -> Option<&Tab> { - self.tabs.get(self.active?) - } - - pub fn shown_mut(&mut self) -> Option<&mut Tab> { - self.tabs.get_mut(self.active?) - } - - /// The tree's rows again, after the listing or an open folder changed. - fn rebuild_rows(&mut self) { - let mut rows = vec![]; - flatten(&self.nodes, 0, &self.expanded, &self.changed, &mut rows); - if rows != self.rows { - self.rows = rows; - self.rows_version += 1; - } - } -} - -fn flatten(nodes: &[Node], depth: usize, expanded: &HashSet, changed: &HashMap, out: &mut Vec) { - for n in nodes { - let open = n.children.is_some() && expanded.contains(&n.path); - out.push(TreeRow { path: n.path.clone(), name: n.name.clone(), depth, folder: n.children.is_some(), open, change: changed.get(&path_key(&n.path)).copied() }); - if let (true, Some(children)) = (open, &n.children) { - flatten(children, depth + 1, expanded, changed, out); - } - } -} - -/// An open file. Its editor keeps the caret, scroll and undo history while other tabs are shown. +/// An open file. Its buffer keeps the cursor, scroll and undo history while other tabs are shown. pub struct Tab { pub path: PathBuf, - pub editor: Editor, - /// Why the file's text isn't shown (too large, not text, unreadable); the editor stays empty then. + pub buffer: Entity, + /// Why the file's text isn't shown (too large, not text, unreadable); the buffer stays empty then. pub note: Option, - /// How the file differs from the editor's text (line ends, tab indents), which saving puts back (see `files::read`). + /// How the file differs from the buffer (line ends, tab indents), which saving puts back (see `files::read`). pub format: files::Format, /// The file on disk as last read or saved; `None` when the user chose to keep their version over a change. pub stamp: Option, /// Edited since it was last read or saved. pub dirty: bool, + /// The lines that differ from the last commit, as of the last read or save of the file (`git::lines`). + pub marks: std::sync::Arc>, + /// The smooth wheel scrolling of the text (see `panels::editor_pane::change_marks`, which also hosts it). + pub follow: std::rc::Rc>, + /// The line under the mouse, which gets the comment button when nothing is selected. + pub hovered_line: std::rc::Rc>>, /// A save is being written; the disk check leaves the tab alone until it lands, so the save isn't taken for a /// change from outside. pub saving: bool, pub conflict: Option, /// The highlighter's name for the file's language (see `files::language`), which also picks its language server. pub language: Option<&'static str>, - /// The text's version as its language server last heard it (see `language_servers::sync_with_server`). + /// The document version the language server last heard of, and the server, once it has the file. pub version: i32, - /// The language server that has this file open, once it is running. - pub server: Option>, - /// The search bar over it (`find.rs`). - pub find: super::find::FindBar, + pub server: Option>, + pub _sub: Option, } -impl Workspace { - /// Turn editor mode on or off for the shown session. - pub fn toggle_editor(&mut self) { - if !self.editor_mode && !self.active_id().is_some_and(|id| self.is_running(id)) { - self.toast("Open a Claude session to use the editor.", false); - return; - } - self.editor_mode = !self.editor_mode; - if self.editor_mode { - self.ensure_pane(); - self.refresh_files(); - self.focus_pane(); - } else { - self.focus_active(); - } - } - - /// Editor mode is on and has a session to show; the home page keeps its sidebars. - pub fn editing(&self) -> bool { - self.editor_mode && self.main == Main::Terminals && self.active_id().is_some() +impl EditorPane { + pub fn shown(&self) -> Option<&Tab> { + self.tabs.get(self.active?) } +} - /// The shown session's pane while editor mode is on. - pub fn shown_pane(&self) -> Option<(&Id, &EditorPane)> { - let id = self.active_id().filter(|_| self.editing())?; - Some((id, self.panes.get(id)?)) +/// Add the grammars gpui-kit doesn't ship to the highlighter (see `files::language` for the names). Once, at startup. +pub fn register_languages() { + use gpui_kit::component::highlighter::{LanguageConfig, LanguageRegistry}; + let gleam = LanguageConfig::new( + "gleam", + tree_sitter_gleam::LANGUAGE.into(), + vec![], + tree_sitter_gleam::HIGHLIGHT_QUERY, + "", + tree_sitter_gleam::LOCALS_QUERY, + ); + let registry = LanguageRegistry::singleton(); + registry.register("gleam", &gleam); + // gpui-kit's TSX takes tree-sitter-typescript's highlights, which only add TypeScript's extras to JavaScript's, so + // alone they leave most of a .tsx file uncoloured; and neither TSX nor JavaScript (which .jsx files use) colours + // JSX. TSX gets TypeScript's full query instead (its grammar is TypeScript's plus JSX), and both get JSX's. + let (Some(typescript), Some(tsx), Some(javascript)) = (registry.language("typescript"), registry.language("tsx"), registry.language("javascript")) else { + return; + }; + let with_jsx = |config: LanguageConfig, highlights: &str| LanguageConfig { highlights: format!("{highlights}\n{JSX_HIGHLIGHTS}").into(), ..config }; + registry.register("tsx", &with_jsx(LanguageConfig { injection_languages: typescript.injection_languages.clone(), injections: typescript.injections.clone(), ..tsx }, &typescript.highlights)); + if !javascript.highlights.contains(JSX_HIGHLIGHTS) { + registry.register("javascript", &with_jsx(javascript.clone(), &javascript.highlights)); } +} - /// The pane for the shown session, made on first use. - fn ensure_pane(&mut self) { - let Some(id) = self.active_id().filter(|_| self.editing()).cloned() else { return }; - if self.panes.contains_key(&id) { - return; - } - let pane = EditorPane { - tabs: vec![], - active: None, - nodes: vec![], - root: PathBuf::new(), - rows: vec![], - rows_version: 0, - files: Default::default(), - relative: Default::default(), - changed: HashMap::new(), - truncated: false, - back: vec![], - forward: vec![], - recent: vec![], - expanded: HashSet::new(), - picker: None, - listing: false, - relist: false, - watcher: None, - git_dir: None, - nested_git_dirs: vec![], - folders: HashSet::new(), - stale: false, - listed_at: None, - relist_due: false, - servers: HashMap::new(), - }; - self.panes.insert(id.clone(), pane); - self.watch_folder(&id); - } +/// tree-sitter-javascript's `highlights-jsx.scm`, which gpui-kit leaves out. +const JSX_HIGHLIGHTS: &str = r#" +(jsx_opening_element (identifier) @tag (#match? @tag "^[a-z][^.]*$")) +(jsx_closing_element (identifier) @tag (#match? @tag "^[a-z][^.]*$")) +(jsx_self_closing_element (identifier) @tag (#match? @tag "^[a-z][^.]*$")) - /// The keyboard goes to the shown file's editor, or to the tree when no file is open. - pub fn focus_pane(&mut self) { - let Some((id, pane)) = self.shown_pane() else { return }; - let key = pane.shown().filter(|t| t.note.is_none()).map_or_else(|| tree_key(id), |t| t.editor.key.clone()); - self.focus_terminal(&key); - } +(jsx_attribute (property_identifier) @attribute) +(jsx_opening_element (["<" ">"]) @punctuation.bracket) +(jsx_closing_element ([""]) @punctuation.bracket) +(jsx_self_closing_element (["<" "/>"]) @punctuation.bracket) +"#; - /// The editor with this key, in any session's pane. - pub fn editor_mut(&mut self, key: &str) -> Option<&mut Editor> { - self.panes.values_mut().flat_map(|p| p.tabs.iter_mut()).map(|t| &mut t.editor).find(|e| e.key == key) +impl Workspace { + pub fn editor_owner(&self) -> Option { + match self.main { + Main::Terminals => self.active_id().cloned(), + Main::Home => self.home_selected_project().map(|p| format!("project:{}", p.id)), + } } - /// The editor's right-click menu at window point `x`, `y`: the usual editing entries, then requests to Claude about - /// the selection (or the caret's line) and about the language server's problem there. - pub fn open_editor_menu(&mut self, x: f32, y: f32) { - use EditorCommand::*; - use super::Ask; - let entry = |label: &str, command| MenuItem::new(label, Act::EditorMenu(command)); - let mut items = vec![ - entry("Go to Definition", GoToDefinition), - entry("Cut", Cut), - entry("Copy", Copy), - entry("Paste", Paste), - entry("Select All", SelectAll), - entry("Ask Claude to explain this", Ask(Ask::Explain)), - entry("Ask Claude to fix this", Ask(Ask::Fix)), - entry("Ask Claude to write tests for this", Ask(Ask::Tests)), - entry("Ask Claude to fix the problem on this line", Ask(Ask::Problem)), - ]; - for ix in [1, 5] { - items[ix].separator_before = true; + pub(super) fn editor_cwd(&self, owner: &str) -> Option { + if let Some(id) = owner.strip_prefix("project:") { + return self.store.project(id).map(|p| p.path.clone()); } - self.open_menu(MenuAnchor::Point(x, y), 280.0, items); + self.store.session(owner).map(|s| s.cwd.clone()) } - /// Run a right-click menu entry on the shown file's editor, which the click gave the keyboard. - pub(super) fn run_editor_command(&mut self, command: EditorCommand) { - if let EditorCommand::Ask(ask) = command { - return self.ask_claude(ask); + pub fn toggle_editor(&mut self, window: &mut Window, cx: &mut Context) { + if !self.editor_mode && self.editor_owner().is_none() { + return; } - let Some(e) = self.active_id().cloned().and_then(|id| self.panes.get_mut(&id)).and_then(|p| p.shown_mut()).map(|t| &mut t.editor) else { return }; - match command { - EditorCommand::GoToDefinition => e.requests.push(crate::editor::assist::Request::Definition(e.sel.head)), - EditorCommand::Cut | EditorCommand::Copy => { - let text = e.take_for_clipboard(command == EditorCommand::Cut); - self.rt.with_tx(move |tx| tx.copy(&text)); - } - EditorCommand::Paste => { - let key = e.key.clone(); - self.rt.with_tx(move |tx| { - tx.read_clipboard(move |ws: &mut Workspace, content, _| { - if let Some(e) = ws.editor_mut(&key) { - e.paste_text(content.text()); - } - }) - }); - } - EditorCommand::SelectAll => e.select_all(), - EditorCommand::Ask(_) => {} + self.editor_mode = !self.editor_mode; + if self.editor_mode { + self.refresh_files(cx); } + self.focus_active(window, cx); + cx.notify(); } - /// Give the keyboard to this editor: text fields let go of it. - pub fn focus_editor(&mut self, key: &str) { - self.focus_terminal(key); - } - - /// Whether the keyboard is in the shown pane (its editor or its tree), where the pane's shortcuts apply. - pub fn keys_in_pane(&self) -> bool { - let Some((id, pane)) = self.shown_pane() else { return false }; - let Some(key) = self.keys_to.as_deref() else { return false }; - key == tree_key(id) || pane.tabs.iter().any(|t| t.editor.key == key) + /// A path the user Ctrl+clicked in the session's terminal: open it in editor mode, at its line (1-based) when one was + /// given. Text that only looks like a path, naming no file, does nothing. + pub fn open_from_terminal(&mut self, id: &Id, path: &str, line: Option, window: &mut Window, cx: &mut Context) { + let Some(cwd) = self.store.session(id).map(|s| s.cwd.clone()) else { return }; + let Some(file) = dunce::canonicalize(cwd.join(path)).ok().filter(|f| f.is_file()) else { return }; + if self.active_id() != Some(id) { + return; + } + if !self.editor_mode { + self.toggle_editor(window, cx); + } + if self.shown_pane(cx).is_none() { + return; + } + self.open_file(id, file, line.map(|l| l.saturating_sub(1)), window, cx); } - /// Open or close a folder in the tree. - pub fn toggle_folder(&mut self, path: &Path) { - let Some(id) = self.active_id().cloned() else { return }; - let Some(pane) = self.panes.get_mut(&id) else { return }; - if !pane.expanded.remove(path) { - pane.expanded.insert(path.to_path_buf()); - } - pane.rebuild_rows(); - self.focus_terminal(&tree_key(&id)); + /// Editor mode is on and has a session to show; the home page keeps its sidebars. + pub fn editing(&self) -> bool { + self.editor_mode && self.editor_owner().is_some() + } + + /// The pane of the shown session while editor mode is on, created on first use. + pub fn shown_pane(&mut self, cx: &mut Context) -> Option<(Id, &EditorPane)> { + let id = self.editor_owner().filter(|_| self.editing())?; + if !self.panes.contains_key(&id) { + let tree = cx.new(|cx| TreeState::new(cx)); + let owner = id.clone(); + let sub = cx.subscribe(&tree, move |ws: &mut Workspace, _, ev: &TreeEvent, _| { + if let Some(p) = ws.panes.get_mut(&owner) { + match ev { + TreeEvent::Expanded(path) => p.expanded.insert(path.to_string()), + TreeEvent::Collapsed(path) => p.expanded.remove(path.as_ref()), + }; + } + }); + let tree_scroll = crate::panels::glide::Smooth::around(tree.read(cx).scroll_handle().0.borrow().base_handle.clone()); + let pane = EditorPane { + focus: cx.focus_handle(), + tree, + tabs: vec![], + tabs_scroll: crate::panels::glide::Smooth::horizontal(), + tree_scroll, + active: None, + nodes: vec![], + root: PathBuf::new(), + files: Default::default(), + relative: Default::default(), + changed: Default::default(), + truncated: false, + back: vec![], + forward: vec![], + recent: vec![], + expanded: HashSet::new(), + empty_folders: Default::default(), + listing: false, + relist: false, + picker: None, + comment: None, + servers: HashMap::new(), + watcher: None, + git_dir: None, + nested_git_dirs: vec![], + folders: HashSet::new(), + stale: false, + listed_at: None, + relist_due: false, + _sub: sub, + }; + self.panes.insert(id.clone(), pane); + self.watch_folder(&id, cx); + self.refresh_files(cx); + } + let pane = self.panes.get(&id)?; + Some((id, pane)) } /// List the shown session's folder again (files Claude added, changed marks), off the UI thread. - pub(super) fn refresh_files(&mut self) { - let Some(id) = self.active_id().filter(|_| self.editor_mode).cloned() else { return }; + pub(super) fn refresh_files(&mut self, cx: &mut Context) { + let Some(id) = self.editor_owner().filter(|_| self.editor_mode) else { return }; // A worktree that Claude Code is still making has no folder to list yet. - let Some(root) = self.store.session(&id).map(|s| s.cwd.clone()).filter(|root| root.is_dir()) else { return }; + let Some(root) = self.editor_cwd(&id).filter(|root| root.is_dir()) else { return }; let Some(pane) = self.panes.get_mut(&id) else { return }; if pane.listing { pane.relist = true; return; } pane.listing = true; - self.rt.spawn(move || files::list(&root, LIST_LIMIT), move |ws: &mut Workspace, listing| ws.on_listing(&id, listing)); - } - - fn on_listing(&mut self, id: &Id, listing: files::Listing) { - let Some(pane) = self.panes.get_mut(id) else { return }; - pane.listing = false; - pane.listed_at = Some(std::time::Instant::now()); - let relist = std::mem::take(&mut pane.relist); - pane.changed = listing.changed; - pane.truncated = listing.truncated; - pane.nested_git_dirs = listing.nested_git_dirs; - let moved = !pane.root.as_os_str().is_empty() && pane.root != listing.root; - pane.root = listing.root; - if pane.nodes != listing.nodes { - pane.folders = folders_of(&listing.nodes); - let all = files::files_of(&listing.nodes); - pane.relative = std::sync::Arc::new(all.iter().map(|f| relative(f, &pane.root)).collect()); - pane.files = std::sync::Arc::new(all); - pane.nodes = listing.nodes; - } - pane.rebuild_rows(); - if moved { - // The session went to another folder: the old watcher watches the wrong one. - pane.watcher = None; - self.watch_folder(id); - } - if relist { - self.refresh_files(); - } + cx.spawn(async move |this, cx| { + let listing = cx.background_executor().spawn(async move { files::list(&root, LIST_LIMIT) }).await; + let _ = this.update(cx, |ws, cx| { + let Some(pane) = ws.panes.get_mut(&id) else { return }; + pane.listing = false; + pane.listed_at = Some(std::time::Instant::now()); + let relist = std::mem::take(&mut pane.relist); + pane.changed = std::sync::Arc::new(listing.changed); + pane.truncated = listing.truncated; + pane.nested_git_dirs = listing.nested_git_dirs; + let moved = !pane.root.as_os_str().is_empty() && pane.root != listing.root; + pane.root = listing.root; + if pane.nodes != listing.nodes { + let items = tree_items(&listing.nodes, &pane.expanded); + let selected = pane.shown().map(|t| t.path.to_string_lossy().to_string()); + pane.tree.update(cx, |t, cx| { + t.set_items(items, cx); + let ix = selected.and_then(|s| t.index_of(&s.into())); + t.set_selected_index(ix, cx); + }); + pane.empty_folders = std::sync::Arc::new(empty_folders(&listing.nodes)); + pane.folders = folders_of(&listing.nodes); + let all = files::files_of(&listing.nodes); + pane.relative = std::sync::Arc::new(all.iter().map(|f| super::picker::relative(f, &pane.root)).collect()); + pane.files = std::sync::Arc::new(all); + pane.nodes = listing.nodes; + } + if moved { + // The session went to another folder: the old watcher watches the wrong one. + if let Some(pane) = ws.panes.get_mut(&id) { + pane.watcher = None; + } + ws.watch_folder(&id, cx); + } + if relist { + ws.refresh_files(cx); + } + cx.notify(); + }); + }) + .detach(); } /// The tick's look at the shown pane's folder: listed again when its watcher saw a change, every time when it has /// no watcher, and now and then regardless, since a watcher can go quiet without a word (network folders). - pub(super) fn refresh_if_stale(&mut self) { - let Some(id) = self.active_id().filter(|_| self.editor_mode).cloned() else { return }; + pub(super) fn refresh_if_stale(&mut self, cx: &mut Context) { + let Some(id) = self.editor_owner().filter(|_| self.editor_mode) else { return }; let Some(pane) = self.panes.get_mut(&id) else { return }; let overdue = pane.listed_at.is_none_or(|t| t.elapsed() >= WATCHED_RELIST); if pane.watcher.is_some() && !pane.stale && !overdue { return; } pane.stale = false; - self.refresh_files(); + self.refresh_files(cx); } /// Watch the session's folder, so the tree and its change marks follow the disk as soon as it changes rather than /// on the next tick, and an unchanged folder is never walked again. - fn watch_folder(&mut self, id: &Id) { - let Some(root) = self.store.session(id).map(|s| s.cwd.clone()) else { return }; - let mailbox = self.rt.mailbox(); - let owner = id.clone(); - // Starting a watch can take a while on a big tree (Linux adds one per folder), so it happens off the UI thread. - self.rt.spawn( - move || start_watch(&root, owner, mailbox), - { - let id = id.clone(); - move |ws: &mut Workspace, started| { - let Some((watcher, git_dir)) = started else { return }; - if let Some(p) = ws.panes.get_mut(&id) { - // The first listing ran while the watch was starting, so what changed in between is caught by one more. - (p.watcher, p.git_dir, p.stale) = (Some(watcher), git_dir, true); + fn watch_folder(&mut self, id: &Id, cx: &mut Context) { + let Some(root) = self.editor_cwd(id) else { return }; + let (tx, mut rx) = futures::channel::mpsc::unbounded::>(); + let id = id.clone(); + cx.spawn(async move |this, cx| { + // Starting a watch can take a while on a big tree (Linux adds one per folder), so it happens off the UI thread. + let started = cx + .background_executor() + .spawn(async move { + use notify::Watcher; + let root = dunce::canonicalize(&root).unwrap_or(root); + let mut watcher = notify::recommended_watcher(move |ev: notify::Result| { + // An error says nothing of what changed, so it counts as any change (no paths). + let paths = match ev { + Ok(ev) if matches!(ev.kind, notify::EventKind::Access(_)) => return, + Ok(ev) => ev.paths, + Err(_) => vec![], + }; + let _ = tx.unbounded_send(paths); + }) + .ok()?; + watcher.watch(&root, notify::RecursiveMode::Recursive).ok()?; + // A session started below the repository's top doesn't contain `.git`, so it is watched on its own. + let git_dir = git2::Repository::discover(&root).ok().and_then(|r| dunce::canonicalize(r.path()).ok()); + if let Some(dir) = git_dir.as_ref().filter(|d| !d.starts_with(&root)) { + let _ = watcher.watch(dir, notify::RecursiveMode::NonRecursive); + let _ = watcher.watch(&dir.join("refs"), notify::RecursiveMode::Recursive); } + Some((watcher, git_dir)) + }) + .await; + let Some((watcher, git_dir)) = started else { return }; + // The first listing ran while the watch was starting, so what changed in between is caught by one more. + let kept = this.update(cx, |ws, _| ws.panes.get_mut(&id).map(|p| (p.watcher, p.git_dir, p.stale) = (Some(watcher), git_dir, true))); + if !matches!(kept, Ok(Some(()))) { + return; + } + // Ends when the pane, and with it the watcher, goes away. + while let Some(mut paths) = rx.next().await { + // A save or a build touches many files at once: let the burst settle and take it as one change. + cx.background_executor().timer(Duration::from_millis(150)).await; + while let Ok(more) = rx.try_recv() { + paths.extend(more); + } + if this.update(cx, |ws, cx| ws.on_folder_change(&id, &paths, cx)).is_err() { + break; } - }, - ); + } + }) + .detach(); } - fn on_folder_change(&mut self, id: &Id, paths: &[PathBuf]) { - let shown = self.active_id() == Some(id); + fn on_folder_change(&mut self, id: &Id, paths: &[PathBuf], cx: &mut Context) { + let shown = self.editor_owner().as_ref() == Some(id); let Some(pane) = self.panes.get_mut(id) else { return }; // No paths: the watcher lost track (its buffer overflowed) and anything may have changed. let git_dirs: Vec<&Path> = pane.git_dir.iter().chain(&pane.nested_git_dirs).map(PathBuf::as_path).collect(); @@ -395,238 +395,190 @@ impl Workspace { // Listed a moment ago: listed again once `RELIST_GAP` has passed, with whatever else changed by then. let wait = pane.listed_at.map_or(Duration::ZERO, |t| RELIST_GAP.saturating_sub(t.elapsed())); if wait.is_zero() { - self.refresh_if_stale(); + self.refresh_if_stale(cx); } else if !pane.relist_due { pane.relist_due = true; let id = id.clone(); - self.rt.after(wait, move |ws: &mut Workspace| { - if let Some(p) = ws.panes.get_mut(&id) { - p.relist_due = false; + cx.spawn(async move |this, cx| { + cx.background_executor().timer(wait).await; + let _ = this.update(cx, |ws, cx| { + if let Some(p) = ws.panes.get_mut(&id) { + p.relist_due = false; + } + ws.refresh_if_stale(cx); + }); + }) + .detach(); + } + self.refresh_marks(cx); + } + + /// Re-read, off the UI thread, which lines of the shown file differ from the last commit. + pub(super) fn refresh_marks(&mut self, cx: &mut Context) { + let Some(id) = self.editor_owner().filter(|_| self.editor_mode) else { return }; + let Some(path) = self.panes.get(&id).and_then(|p| p.shown()).filter(|t| t.note.is_none()).map(|t| t.path.clone()) else { return }; + cx.spawn(async move |this, cx| { + let read = path.clone(); + let marks = cx.background_executor().spawn(async move { crate::git::lines::changed_lines(&read) }).await; + let _ = this.update(cx, |ws, cx| { + let Some(tab) = ws.panes.get_mut(&id).and_then(|p| p.tabs.iter_mut().find(|t| t.path == path)) else { return }; + if *tab.marks != marks { + tab.marks = std::sync::Arc::new(marks); + cx.notify(); } - ws.refresh_if_stale(); }); - } - self.refresh_marks(); + }) + .detach(); } - /// Show `path` in the session's editor at `line` (from 0), as a jump that Back returns from. - pub fn open_file(&mut self, id: &Id, path: PathBuf, line: Option) { - self.remember_place(id, &path, line); + /// Show `path` in the session's editor at `line` (0-based), as a jump that Back returns from. + pub fn open_file(&mut self, id: &Id, path: PathBuf, line: Option, window: &mut Window, cx: &mut Context) { + self.remember_place(id, &path, line, cx); self.note_recent(id, &path); - self.show_file(id, path, line); + self.show_file(id, path, line, window, cx); } - /// Show `path` in the session's editor: its tab when it is open, otherwise a new tab once the file is read off the - /// UI thread. `line` (from 0) puts the caret there. - pub(super) fn show_file(&mut self, id: &Id, path: PathBuf, line: Option) { + /// Show `path` in the session's editor: its tab when it is open, otherwise a new tab once the file is read off the UI + /// thread. `line` (0-based) puts the cursor there. + pub(super) fn show_file(&mut self, id: &Id, path: PathBuf, line: Option, window: &mut Window, cx: &mut Context) { let Some(pane) = self.panes.get_mut(id) else { return }; if let Some(ix) = pane.tabs.iter().position(|t| t.path == path) { pane.active = Some(ix); - if let Some(line) = line { - pane.tabs[ix].editor.go_to_line(line); - } - self.focus_pane(); - self.refresh_marks(); + let buffer = pane.tabs[ix].buffer.clone(); + buffer.update(cx, |b, cx| match line { + Some(line) => b.set_cursor_position(Position::new(line as u32, 0), window, cx), + None => b.focus(window, cx), + }); + cx.notify(); return; } let id = id.clone(); let read = path.clone(); - self.rt.spawn(move || files::read(&read), move |ws: &mut Workspace, contents| ws.on_read(&id, path, line, contents)); - } - - fn on_read(&mut self, id: &Id, path: PathBuf, line: Option, contents: std::io::Result) { - self.editor_serial += 1; - let mut editor = Editor::new(format!("editor:{}", self.editor_serial), ""); - let (mut format, mut stamp) = (files::Format::default(), None); - let note = match contents { - Ok(Contents::Text { text, format: f, stamp: s }) => { - editor.set_text(&text); - if f.tabs.as_ref().is_some_and(|t| t.hard) { - editor.indent_unit = crate::editor::TAB_WIDTH; + cx.spawn_in(window, async move |this, cx| { + let contents = cx.background_executor().spawn(async move { files::read(&read) }).await; + let _ = this.update_in(cx, |ws, window, cx| { + let language = files::language(&path); + let buffer = cx.new(|cx| { + let state = EditorState::new(window, cx); + match language { + Some(language) => state.language(language), + None => state, + } + }); + let (mut format, mut stamp, mut sub) = (files::Format::default(), None, None); + let note = match contents { + Ok(Contents::Text { text, format: f, stamp: s }) => { + buffer.update(cx, |b, cx| { + b.set_tab_size(tab_size(&f), cx); + b.set_value(text, window, cx); + b.set_cursor_position(Position::new(line.unwrap_or(0) as u32, 0), window, cx); + }); + // `set_value` (opening, reloading) sends no Change, so only the user's edits mark the tab. + sub = Some(cx.subscribe(&buffer, |ws: &mut Workspace, buffer, ev: &InputEvent, cx| { + if !matches!(ev, InputEvent::Change) { + return; + } + let edited = ws.panes.iter_mut().find_map(|(owner, p)| { + let tab = p.tabs.iter_mut().find(|t| t.buffer == buffer)?; + tab.dirty = true; + Some((owner.clone(), tab.path.clone())) + }); + if let Some((owner, path)) = edited { + ws.sync_with_server(&owner, &path, false, cx); + cx.notify(); + } + })); + (format, stamp) = (f, Some(s)); + None + } + Ok(Contents::TooLarge) => Some(format!( + "This file is too large for the editor (over {} lines or {} MB).", + files::MAX_LINES, + files::MAX_BYTES / (1024 * 1024) + )), + Ok(Contents::NotText) => Some("This file isn't UTF-8 text.".into()), + Err(e) => Some(format!("Could not read this file: {e}")), + }; + let Some(pane) = ws.panes.get_mut(&id) else { return }; + // A second click while the file was being read: keep the tab that is already there. + let opened = pane.tabs.iter().position(|t| t.path == path); + let ix = opened.unwrap_or_else(|| { + let language = language.filter(|_| note.is_none()); + pane.tabs.push(Tab { path: path.clone(), buffer, note, format, stamp, dirty: false, marks: Default::default(), follow: Default::default(), hovered_line: Default::default(), saving: false, conflict: None, language, version: 0, server: None, _sub: sub }); + pane.tabs.len() - 1 + }); + pane.active = Some(ix); + let shown = pane.tabs[ix].buffer.clone(); + shown.update(cx, |b, cx| b.focus(window, cx)); + if opened.is_none() { + ws.attach_server(&id, &path, cx); + ws.refresh_marks(cx); } - (format, stamp) = (f, Some(s)); - None - } - Ok(Contents::TooLarge) => Some(format!("This file is too large for the editor (over {} lines or {} MB).", files::MAX_LINES, files::MAX_BYTES / (1024 * 1024))), - Ok(Contents::NotText) => Some("This file isn't UTF-8 text.".into()), - Err(e) => Some(format!("Could not read this file: {e}")), - }; - editor.edited = false; - if let Some(line) = line { - editor.go_to_line(line); - } - let Some(pane) = self.panes.get_mut(id) else { return }; - // A second click while the file was being read: keep the tab that is already there. - let opened = pane.tabs.iter().position(|t| t.path == path); - let ix = opened.unwrap_or_else(|| { - let language = files::language(&path).filter(|_| note.is_none()); - pane.tabs.push(Tab { path: path.clone(), editor, note, format, stamp, dirty: false, saving: false, conflict: None, language, version: 0, server: None, find: Default::default() }); - pane.tabs.len() - 1 - }); - pane.active = Some(ix); - if self.active_id() == Some(id) { - self.focus_pane(); - } - if opened.is_none() { - self.attach_server(id, &path); - self.refresh_marks(); - } + cx.notify(); + }); + }) + .detach(); } /// Close tab `ix`; the tab to its right is shown next, or the last one. - pub fn close_tab(&mut self, id: &Id, ix: usize) { + pub fn close_tab(&mut self, id: &Id, ix: usize, cx: &mut Context) { let Some(pane) = self.panes.get_mut(id).filter(|p| ix < p.tabs.len()) else { return }; Self::tell_server_closed(&pane.tabs.remove(ix)); pane.active = active_after_close(pane.active, ix, pane.tabs.len()); - if self.active_id() == Some(id) && self.editing() { - self.focus_pane(); - } + cx.notify(); } - pub fn show_tab(&mut self, id: &Id, ix: usize) { + pub fn show_tab(&mut self, id: &Id, ix: usize, window: &mut Window, cx: &mut Context) { if let Some(path) = self.panes.get(id).and_then(|p| p.tabs.get(ix)).map(|t| t.path.clone()) { - self.remember_place(id, &path, None); + self.remember_place(id, &path, None, cx); self.note_recent(id, &path); } if let Some(pane) = self.panes.get_mut(id).filter(|p| ix < p.tabs.len()) { pane.active = Some(ix); - self.focus_pane(); - self.refresh_marks(); - } - } - - /// After every handler: an edited tab is marked unsaved (or clean again, undone back to what is saved). - /// Its language server hears of the change once typing pauses. - pub(super) fn note_edits(&mut self) { - let mut edited = vec![]; - for (id, pane) in &mut self.panes { - for tab in &mut pane.tabs { - if std::mem::take(&mut tab.editor.edited) { - // A tab whose user kept their version over a change on disk stays unsaved until it is saved. - tab.dirty = tab.editor.buffer.is_dirty() || tab.stamp.is_none(); - edited.push((id.clone(), tab.path.clone())); - } - } - } - for (id, path) in edited { - self.sync_with_server(&id, &path, false); + pane.tabs[ix].buffer.update(cx, |b, cx| b.focus(window, cx)); + cx.notify(); } } +} - /// Each frame: the shown editor's easing scroll moves on and its caret blinks. Whether that changed what shows, - /// and when the editor next needs a frame. - pub(super) fn poll_editors(&mut self) -> (bool, Option) { - let mut changed = false; - let mut next = None; - let window_active = self.window_active; - let keys_to = self.keys_to.clone(); - if let Some(id) = self.active_id().filter(|_| self.editing()).cloned() - && let Some(tab) = self.panes.get_mut(&id).and_then(|p| p.shown_mut()) - { - let now = Instant::now(); - if tab.editor.tick() { - next = Some(now + Duration::from_millis(16)); - } - let blinking = window_active && keys_to.as_deref() == Some(tab.editor.key.as_str()); - if let Some(at) = tab.editor.blink(now, blinking) { - next = Some(next.map_or(at, |n: Instant| n.min(at))); - } - changed |= std::mem::take(&mut tab.editor.dirty); - self.colour_shown(); - } - (changed, next) - } - - /// Work out the shown file's colours and foldable blocks off the UI thread when its text changed since they were, one run at a time: - /// edits made meanwhile are coloured by the next run. - fn colour_shown(&mut self) { - let Some(id) = self.active_id().cloned() else { return }; - let Some(tab) = self.panes.get_mut(&id).and_then(|p| p.shown_mut()) else { return }; - let Some(language) = tab.language else { return }; - let e = &mut tab.editor; - let version = e.buffer.version(); - if e.colouring || e.coloured == Some(version) { - return; - } - e.colouring = true; - let (key, text) = (e.key.clone(), e.buffer.text()); - self.rt.spawn( - move || (crate::editor::highlight::highlight(language, &text), crate::editor::highlight::fold_spots(language, &text)), - move |ws: &mut Workspace, (spans, folds)| { - let Some(e) = ws.editor_mut(&key) else { return }; - e.colouring = false; - // Colours and folds for older text would be a few letters or lines off; the next frame asks again. - if e.buffer.version() == version { - e.spans = spans.unwrap_or_default(); - e.set_fold_spots(folds.unwrap_or_default()); - e.coloured = Some(version); - e.dirty = true; - } - }, - ); - } - - /// Ctrl+click on a path in a session's terminal: open it in editor mode, at its line (from 1) when one was given. - /// Text that only looks like a path, naming no file, does nothing. - pub fn open_in_editor_mode(&mut self, id: &Id, path: &str, line: Option) -> bool { - let Some(cwd) = self.store.session(id).map(|s| s.cwd.clone()) else { return false }; - let Some(file) = dunce::canonicalize(cwd.join(path)).ok().filter(|f| f.is_file()) else { return false }; - if self.active_id() != Some(id) { - return false; - } - if !self.editor_mode { - self.toggle_editor(); - } - if !self.editing() { - return false; - } - self.open_file(id, file, line.map(|l| l.saturating_sub(1))); - true - } +/// What an entry of the editor's right-click menu does. +#[derive(Clone, Copy, Debug)] +pub enum EditorCommand { + GoToDefinition, + Cut, + Copy, + Paste, + SelectAll, + Ask(Ask), } -/// Start watching `root`; each burst of changes (a save, a build touching many files) reaches the pane of `id` once -/// it settles. Ends when the watcher, kept by the pane, is dropped. -fn start_watch(root: &Path, id: Id, mailbox: rt::Mailbox) -> Option<(notify::RecommendedWatcher, Option)> { - use notify::Watcher; - let root = dunce::canonicalize(root).unwrap_or_else(|_| root.to_path_buf()); - let (tx, rx) = std::sync::mpsc::channel::>(); - let mut watcher = notify::recommended_watcher(move |ev: notify::Result| { - // An error says nothing of what changed, so it counts as any change (no paths). - let paths = match ev { - Ok(ev) if matches!(ev.kind, notify::EventKind::Access(_)) => return, - Ok(ev) => ev.paths, - Err(_) => vec![], +impl Workspace { + /// Run a menu entry on the shown file's editor, which has the keyboard again after the menu closes. + pub(super) fn run_editor_command(&mut self, command: EditorCommand, window: &mut Window, cx: &mut Context) { + use gpui_kit::component::input::{Copy, Cut, GoToDefinition, Paste, SelectAll}; + if let EditorCommand::Ask(ask) = command { + return self.ask_claude(ask, window, cx); + } + let Some(buffer) = self.editor_owner().and_then(|id| self.panes.get(&id)).and_then(|p| p.shown()).map(|t| t.buffer.clone()) else { return }; + buffer.update(cx, |b, cx| b.focus(window, cx)); + let action: Box = match command { + EditorCommand::GoToDefinition => Box::new(GoToDefinition), + EditorCommand::Cut => Box::new(Cut), + EditorCommand::Copy => Box::new(Copy), + EditorCommand::Paste => Box::new(Paste), + EditorCommand::SelectAll => Box::new(SelectAll), + EditorCommand::Ask(_) => return, }; - let _ = tx.send(paths); - }) - .ok()?; - watcher.watch(&root, notify::RecursiveMode::Recursive).ok()?; - // A session started below the repository's top doesn't contain `.git`, so it is watched on its own. - let git_dir = git2::Repository::discover(&root).ok().and_then(|r| dunce::canonicalize(r.path()).ok()); - if let Some(dir) = git_dir.as_ref().filter(|d| !d.starts_with(&root)) { - let _ = watcher.watch(dir, notify::RecursiveMode::NonRecursive); - let _ = watcher.watch(&dir.join("refs"), notify::RecursiveMode::Recursive); + window.dispatch_action(action, cx); } - std::thread::spawn(move || { - // Ends when the watcher, and with it the sender, goes away. - while let Ok(mut paths) = rx.recv() { - std::thread::sleep(Duration::from_millis(150)); - while let Ok(more) = rx.try_recv() { - paths.extend(more); - } - let id = id.clone(); - if !mailbox.send(move |ws: &mut Workspace| ws.on_folder_change(&id, &paths)) { - break; - } - } - }); - Some((watcher, git_dir)) } -/// `path` under `root`, with `/` between folders, as quick open and tooltips show it. -pub fn relative(path: &Path, root: &Path) -> String { - path.strip_prefix(root).unwrap_or(path).to_string_lossy().replace('\\', "/") +/// A file indented with tabs is shown with `files::TAB_WIDTH` spaces for each tab, so the Tab key indents by as many. +pub(super) fn tab_size(format: &files::Format) -> TabSize { + match &format.tabs { + Some(indents) if indents.hard => TabSize { tab_size: files::TAB_WIDTH, hard_tabs: false }, + _ => TabSize::default(), + } } fn folders_of(nodes: &[Node]) -> HashSet { @@ -657,6 +609,35 @@ fn change_matters(root: &Path, git_dirs: &[&Path], folders: &HashSet, t parent.is_some_and(|dir| dir == root || folders.contains(dir)) } +fn empty_folders(nodes: &[Node]) -> HashSet { + let mut empty = HashSet::new(); + for n in nodes { + match &n.children { + Some(children) if children.is_empty() => { + empty.insert(n.path.to_string_lossy().to_string()); + } + Some(children) => empty.extend(empty_folders(children)), + None => {} + } + } + empty +} + +fn tree_items(nodes: &[Node], expanded: &HashSet) -> Vec { + nodes + .iter() + .map(|n| { + let id = n.path.to_string_lossy().to_string(); + let open = expanded.contains(&id); + let item = TreeItem::new(id, n.name.clone()); + match &n.children { + Some(children) => item.children(tree_items(children, expanded)).expanded(open), + None => item, + } + }) + .collect() +} + /// The tab shown after tab `closed` goes, given the one shown before and how many are left: the same file when another /// tab closed, otherwise the tab that took the closed one's place, or the new last one. fn active_after_close(active: Option, closed: usize, left: usize) -> Option { @@ -697,6 +678,59 @@ mod tests { assert!(change_matters(Path::new(""), &[], &folders, false, Path::new("/w/target/x")), "nothing listed yet"); } + /// The highlighter falls back to plain text when a grammar or its query fails to load, so check that each language + /// `files::language` names really colours code. + #[test] + fn every_named_language_highlights() { + use gpui_kit::component::highlighter::{HighlightTheme, SyntaxHighlighter}; + use gpui_kit::component::input::Rope; + super::register_languages(); + let samples = [ + ("rust", "fn main() { let x = 1; }"), + ("typescript", "const x: number = 1;"), + ("tsx", "const a =
{x}
;"), + ("javascript", "function f() { return 1; }"), + ("json", "{\"a\": 1}"), + ("toml", "[package]\nname = \"x\""), + ("yaml", "a: 1"), + ("markdown", "# Title\n\nSome *text*."), + ("html", "

hi

"), + ("css", "a { color: red; }"), + ("bash", "echo \"$HOME\""), + ("gleam", "pub fn main() { let x = 1 }"), + ]; + let theme = HighlightTheme::default_dark(); + for (lang, code) in samples { + let mut h = SyntaxHighlighter::new(lang); + assert_eq!(h.language().as_ref(), lang, "{lang} fell back to plain text"); + let rope = Rope::from(code); + h.update(None, &rope, None); + assert!(!h.styles(&(0..code.len()), &*theme).is_empty(), "{lang} has no highlights"); + } + } + + /// Whether some highlight colours exactly `part` of `code`. + fn coloured(lang: &str, code: &str, part: &str) -> bool { + use gpui_kit::component::highlighter::{HighlightTheme, SyntaxHighlighter}; + use gpui_kit::component::input::Rope; + super::register_languages(); + let mut h = SyntaxHighlighter::new(lang); + h.update(None, &Rope::from(code), None); + let start = code.find(part).unwrap(); + let theme = HighlightTheme::default_dark(); + h.styles(&(0..code.len()), &*theme).iter().any(|(range, style)| *range == (start..start + part.len()) && style.color.is_some()) + } + + #[test] + fn tsx_and_jsx_colour_code_and_tags() { + let code = "function App() { const s = \"hi\"; return
{s}
; }"; + for lang in ["tsx", "javascript"] { + for part in ["function", "App", "\"hi\"", "div", "className"] { + assert!(coloured(lang, code, part), "{lang}: {part} has no colour"); + } + } + } + #[test] fn closing_a_tab_keeps_the_shown_file_or_moves_to_a_neighbour() { // Tabs a b c, b shown. diff --git a/src/app/file_ops.rs b/src/app/file_ops.rs index b304b73..b0b0da4 100644 --- a/src/app/file_ops.rs +++ b/src/app/file_ops.rs @@ -1,10 +1,6 @@ -//! Creating, renaming and deleting files from editor mode's file tree. The disk work is `files::create_file`, -//! `create_folder`, `rename` and `delete`, which keep to the session's folder. Open tabs follow a rename and close -//! with a delete. +//! Creating, renaming and deleting files from editor mode's file tree (the disk work is `files::create_file`, +//! `create_folder`, `rename` and `delete`, which keep to the session's folder). Open tabs follow a rename and close with a delete. -use std::path::Path; - -use super::navigation::moved_path; use super::*; use crate::files; @@ -20,144 +16,146 @@ pub enum NameFor { } impl Workspace { - /// The tree's right-click menu at window point `x`, `y`: for a file or folder, or for the session folder (`None`). - pub fn open_file_menu(&mut self, id: &Id, path: Option<&Path>, folder: bool, x: f32, y: f32) { - let Some(pane) = self.panes.get(id) else { return }; - let new_items = |dir: &Path| { - vec![ - MenuItem::new("New file…", Act::AskFileName(id.clone(), NameFor::FileIn(dir.to_path_buf()))), - MenuItem::new("New folder…", Act::AskFileName(id.clone(), NameFor::FolderIn(dir.to_path_buf()))), - ] - }; - let items = match path { - None => new_items(&pane.root), - Some(path) => { - let dir = if folder { path.to_path_buf() } else { path.parent().map_or_else(|| pane.root.clone(), Path::to_path_buf) }; - let mut items = new_items(&dir); - items.push(MenuItem::new("Rename…", Act::AskFileName(id.clone(), NameFor::Rename(path.to_path_buf())))); - let reveal = if cfg!(target_os = "macos") { "Reveal in Finder" } else { "Reveal in File Explorer" }; - items.push(MenuItem { separator_before: true, ..MenuItem::new("Copy relative path", Act::CopyText(editor_mode::relative(path, &pane.root))) }); - items.push(MenuItem::new(reveal, Act::Reveal(path.to_path_buf()))); - items.push(MenuItem { danger: true, separator_before: true, ..MenuItem::new("Delete", Act::AskDelete(id.clone(), path.to_path_buf())) }); - items - } + /// The tree's right-click menu: for a file or folder, or for the session folder (`None`). + pub fn file_menu(&self, id: &Id, path: Option<&std::path::Path>, folder: bool) -> Vec { + let Some(pane) = self.panes.get(id) else { return vec![] }; + let Some(path) = path else { + return Self::new_items(id, &pane.root); }; - self.open_menu(MenuAnchor::Point(x, y), 0.0, items); + let dir = if folder { path.to_path_buf() } else { path.parent().map_or_else(|| pane.root.clone(), |p| p.to_path_buf()) }; + let mut items = Self::new_items(id, &dir); + items.push(MenuItem::new("Rename…", Act::AskFileName(id.clone(), NameFor::Rename(path.to_path_buf())))); + let reveal = if cfg!(target_os = "macos") { "Reveal in Finder" } else { "Reveal in File Explorer" }; + items.push(MenuItem { separator_before: true, ..MenuItem::new("Copy relative path", Act::CopyText(super::picker::relative(path, &pane.root))) }); + items.push(MenuItem::new(reveal, Act::Reveal(path.to_path_buf()))); + items.push(MenuItem { danger: true, separator_before: true, ..MenuItem::new("Delete", Act::AskDelete(id.clone(), path.to_path_buf())) }); + items + } + + fn new_items(id: &Id, dir: &std::path::Path) -> Vec { + vec![ + MenuItem::new("New file…", Act::AskFileName(id.clone(), NameFor::FileIn(dir.to_path_buf()))), + MenuItem::new("New folder…", Act::AskFileName(id.clone(), NameFor::FolderIn(dir.to_path_buf()))), + ] } - pub(super) fn ask_file_name(&mut self, id: Id, purpose: NameFor) { - let value = match &purpose { - NameFor::FileIn(_) | NameFor::FolderIn(_) => String::new(), - NameFor::Rename(path) => path.file_name().map(|n| n.to_string_lossy().into_owned()).unwrap_or_default(), + pub(super) fn ask_file_name(&mut self, id: Id, purpose: NameFor, window: &mut Window, cx: &mut Context) { + let (value, placeholder) = match &purpose { + NameFor::FileIn(_) => (String::new(), "name.ext"), + NameFor::FolderIn(_) => (String::new(), "name"), + NameFor::Rename(path) => (path.file_name().map(|n| n.to_string_lossy().into_owned()).unwrap_or_default(), "name"), }; - self.modal = Some(Modal::FileName { id, purpose, input: modal::field(&value, true) }); + let input = self.modal_input(&value, placeholder, window, cx); + self.modal = Some(Modal::FileName { id, purpose, input }); } - pub(super) fn ask_delete(&mut self, id: Id, path: PathBuf) { + pub(super) fn ask_delete(&mut self, id: Id, path: PathBuf, window: &mut Window, cx: &mut Context) { let Some(pane) = self.panes.get(&id) else { return }; - let name = editor_mode::relative(&path, &pane.root); + let name = super::picker::relative(&path, &pane.root); + let folder = path.is_dir(); let unsaved = pane.tabs.iter().any(|t| t.dirty && crate::platform::is_same_or_under(&t.path, &path)); - let mut body = if path.is_dir() { "Deletes the folder and everything in it from disk." } else { "Deletes the file from disk." }.to_string(); + let mut body = if folder { "Deletes the folder and everything in it from disk." } else { "Deletes the file from disk." }.to_string(); body.push_str(" This can't be undone."); if unsaved { body.push_str(" Unsaved edits in its open tabs are lost."); } self.modal = Some(Modal::Confirm { title: format!("Delete {name}?"), body, confirm: "Delete".into(), danger: true, act: Act::ConfirmDelete(id, path) }); + window.focus(&self.modal_focus, cx); } /// Carry out a typed file name; `Err` says why it can't be used, and the dialog stays open. - pub(super) fn apply_file_name(&mut self, id: &Id, purpose: &NameFor, name: &str) -> Result<(), String> { + pub(super) fn apply_file_name(&mut self, id: &Id, purpose: &NameFor, name: &str, window: &mut Window, cx: &mut Context) -> Result<(), String> { let root = self.panes.get(id).map(|p| p.root.clone()).ok_or("The session's files are gone.")?; match purpose { NameFor::FileIn(dir) => { let path = files::create_file(&root, dir, name).map_err(|e| e.to_string())?; - self.open_folders(id, &[dir]); - self.refresh_files(); - self.open_file(id, path, None); + if let Some(pane) = self.panes.get_mut(id) { + pane.expanded.insert(dir.to_string_lossy().into_owned()); + } + self.refresh_files(cx); + self.open_file(id, path, None, window, cx); } NameFor::FolderIn(dir) => { let path = files::create_folder(&root, dir, name).map_err(|e| e.to_string())?; - self.open_folders(id, &[dir, &path]); - self.refresh_files(); + if let Some(pane) = self.panes.get_mut(id) { + pane.expanded.insert(dir.to_string_lossy().into_owned()); + pane.expanded.insert(path.to_string_lossy().into_owned()); + } + self.refresh_files(cx); } NameFor::Rename(from) => { let to = files::rename(&root, from, name).map_err(|e| e.to_string())?; - self.follow_rename(id, from, to); - self.refresh_files(); + self.follow_rename(id, from, to, window, cx); + self.refresh_files(cx); } } Ok(()) } - fn open_folders(&mut self, id: &Id, folders: &[&Path]) { - if let Some(pane) = self.panes.get_mut(id) { - pane.expanded.extend(folders.iter().map(|f| f.to_path_buf())); - } - } - - /// The open tab of a renamed file shows it under its new name, and its language server hears of it as a new file. - /// The shown tab, when its language changed and it has no unsaved edits, is opened afresh. For a renamed folder, + /// The open tab of a renamed file shows it under its new name. The shown tab, when its language changed and it has + /// no unsaved edits, is opened afresh, since a buffer keeps the highlighting it was made with. For a renamed folder, /// every tab inside it follows, and its open folders stay open. - fn follow_rename(&mut self, id: &Id, from: &Path, to: PathBuf) { + fn follow_rename(&mut self, id: &Id, from: &std::path::Path, to: PathBuf, window: &mut Window, cx: &mut Context) { self.retarget_history(id, from, &to); - let Some(pane) = self.panes.get_mut(id) else { return }; if to.is_dir() { - pane.expanded = pane.expanded.drain().map(|mut p| { - moved_path(&mut p, from, &to); - p - }).collect(); + self.follow_folder_rename(id, from, &to, cx); + return; } - let moved: Vec<(PathBuf, PathBuf)> = pane - .tabs - .iter() - .filter_map(|t| { - let mut path = t.path.clone(); - moved_path(&mut path, from, &to); - (path != t.path).then(|| (t.path.clone(), path)) - }) - .collect(); - // By path, since reopening a tab moves the others. - for (old, path) in moved { - let Some(pane) = self.panes.get(id) else { return }; - let Some(ix) = pane.tabs.iter().position(|t| t.path == old) else { continue }; - let tab = &pane.tabs[ix]; - let language = files::language(&path); - if pane.active == Some(ix) && language != tab.language && !tab.dirty && tab.note.is_none() { - self.close_tab(id, ix); - self.open_file(id, path, None); - continue; - } - let Some(tab) = self.panes.get_mut(id).map(|p| &mut p.tabs[ix]) else { return }; + let Some(pane) = self.panes.get(id) else { return }; + let Some(ix) = pane.tabs.iter().position(|t| t.path == from) else { return }; + let language = files::language(&to); + let tab = &pane.tabs[ix]; + if pane.active == Some(ix) && language != tab.language && !tab.dirty && tab.note.is_none() { + self.close_tab(id, ix, cx); + self.open_file(id, to, None, window, cx); + return; + } + let Some(tab) = self.panes.get_mut(id).map(|p| &mut p.tabs[ix]) else { return }; + Self::tell_server_closed(tab); + (tab.path, tab.server, tab.version) = (to.clone(), None, 0); + if tab.note.is_none() { + tab.language = language; + } + self.attach_server(id, &to, cx); + cx.notify(); + } + + fn follow_folder_rename(&mut self, id: &Id, from: &std::path::Path, to: &std::path::Path, cx: &mut Context) { + let Some(pane) = self.panes.get_mut(id) else { return }; + let moved = |path: &std::path::Path| path.strip_prefix(from).ok().map(|rest| to.join(rest)); + pane.expanded = pane.expanded.iter().map(|key| moved(std::path::Path::new(key)).map_or_else(|| key.clone(), |p| p.to_string_lossy().into_owned())).collect(); + let mut retargeted = vec![]; + for tab in pane.tabs.iter_mut() { + let Some(path) = moved(&tab.path) else { continue }; Self::tell_server_closed(tab); (tab.path, tab.server, tab.version) = (path.clone(), None, 0); - if tab.note.is_none() && language != tab.language { - tab.language = language; - // Colours for the old language would be wrong; plain until the new ones arrive. - tab.editor.spans.clear(); - tab.editor.coloured = None; - } - self.attach_server(id, &path); + retargeted.push(path); + } + for path in retargeted { + self.attach_server(id, &path, cx); } + cx.notify(); } /// Delete off the UI thread (a folder can hold many files); tabs inside it close once it is gone. - pub(super) fn delete_path(&mut self, id: Id, path: PathBuf) { + pub(super) fn delete_path(&mut self, id: Id, path: PathBuf, cx: &mut Context) { let Some(root) = self.panes.get(&id).map(|p| p.root.clone()) else { return }; let target = path.clone(); - self.rt.spawn( - move || files::delete(&root, &target), - move |ws: &mut Workspace, done: std::io::Result<()>| { + cx.spawn(async move |this, cx| { + let done = cx.background_executor().spawn(async move { files::delete(&root, &target) }).await; + let _ = this.update(cx, |ws, cx| { match done { Ok(()) => { ws.forget_history(&id, &path); while let Some(ix) = ws.panes.get(&id).and_then(|p| p.tabs.iter().position(|t| crate::platform::is_same_or_under(&t.path, &path))) { - ws.close_tab(&id, ix); + ws.close_tab(&id, ix, cx); } } - Err(e) => ws.toast(format!("Could not delete it: {e}"), true), + Err(e) => ws.toast(format!("Could not delete it: {e}"), true, cx), } - ws.refresh_files(); - }, - ); + ws.refresh_files(cx); + }); + }) + .detach(); } } diff --git a/src/app/find.rs b/src/app/find.rs deleted file mode 100644 index 8dfa335..0000000 --- a/src/app/find.rs +++ /dev/null @@ -1,207 +0,0 @@ -//! The search bar over the shown file, as main's GPUI editor had it (gpui-kit's search panel): Primary+F opens it with -//! the selection or the last query, Enter and Shift+Enter step through the matches, and the replace row replaces one -//! match or all of them. Replace opens with Cmd+Shift+F on macOS and Ctrl+H elsewhere. The matching is -//! `Editor::find_all`; the bar is drawn by `panels/editor_pane.rs`. - -use super::*; -use crate::editor::buffer::Pos; -use crate::terminal::keys::Keystroke; - -/// One tab's search: kept while the bar is closed, so opening it again resumes the last query. -pub struct FindBar { - pub open: bool, - pub query: TextEdit, - pub replacement: TextEdit, - pub replace_mode: bool, - /// ASCII letters match either case, the default. - pub ignore_case: bool, - pub matches: Vec<(Pos, Pos)>, - pub current: usize, - /// The query, case and text version the matches were found for. - searched: Option<(String, bool, u64)>, -} - -impl Default for FindBar { - fn default() -> Self { - Self { open: false, query: modal::field("", false), replacement: modal::field("", false), replace_mode: false, ignore_case: true, matches: vec![], current: 0, searched: None } - } -} - -impl FindBar { - /// "2/5", or "0/0" with no match. - pub fn label(&self) -> String { - match self.matches.len() { - 0 => "0/0".into(), - n => format!("{}/{n}", self.current + 1), - } - } -} - -impl Workspace { - /// The shown tab's search bar, while editor mode shows one. - pub fn shown_find(&mut self) -> Option<&mut FindBar> { - let id = self.active_id().filter(|_| self.editing()).cloned()?; - self.panes.get_mut(&id)?.shown_mut().filter(|t| t.note.is_none()).map(|t| &mut t.find) - } - - /// Open the bar over the shown file, with the replace row when `replace`. The selection, if any, becomes the query. - pub fn open_find(&mut self, replace: bool) { - let Some(tab) = self.active_id().filter(|_| self.editing()).cloned().and_then(|id| self.panes.get_mut(&id)).and_then(|p| p.shown_mut()) else { return }; - if tab.note.is_some() { - return; - } - let (a, b) = tab.editor.sel.range(); - let selected = tab.editor.buffer.slice(a, b); - let bar = &mut tab.find; - bar.open = true; - bar.replace_mode = replace; - let query = if selected.is_empty() { bar.query.text.as_str().to_string() } else { selected }; - // The query has the keyboard, as in gpui-kit's panel, ready to be typed over. - bar.query = modal::field(&query, true); - bar.query.set_selection(0, query.len()); - bar.replacement.focused = false; - self.update_find(); - } - - pub fn close_find(&mut self) { - if let Some(bar) = self.shown_find() { - bar.open = false; - bar.query.focused = false; - bar.replacement.focused = false; - } - self.update_find(); - self.focus_pane(); - } - - /// Each frame: find again when the query, its case or the text changed, and show the matches in the editor. A new - /// query starts at the first match from the top of the screen; an edit keeps the current match's place. - pub(super) fn update_find(&mut self) { - let Some(tab) = self.active_id().cloned().and_then(|id| self.panes.get_mut(&id)).and_then(|p| p.shown_mut()) else { return }; - let (bar, e) = (&mut tab.find, &mut tab.editor); - if !bar.open { - if !e.found.is_empty() { - e.show_found(vec![], None, false); - } - bar.searched = None; - return; - } - let query = bar.query.text.as_str().to_string(); - let now = (query.clone(), bar.ignore_case, e.buffer.version()); - if bar.searched.as_ref() == Some(&now) { - return; - } - let new_query = bar.searched.as_ref().is_none_or(|(q, case, _)| *q != query || *case != bar.ignore_case); - bar.searched = Some(now); - bar.matches = e.find_all(&query, bar.ignore_case); - bar.current = if new_query { - let top = e.first_visible_line(); - bar.matches.iter().position(|(_, b)| b.line >= top).unwrap_or(0) - } else { - bar.current.min(bar.matches.len().saturating_sub(1)) - }; - let current = (!bar.matches.is_empty()).then_some(bar.current); - e.show_found(bar.matches.clone(), current, new_query); - } - - /// The next match (or the one before), wrapping at the ends. - pub fn find_step(&mut self, forward: bool) { - self.update_find(); - let Some(tab) = self.active_id().cloned().and_then(|id| self.panes.get_mut(&id)).and_then(|p| p.shown_mut()) else { return }; - let bar = &mut tab.find; - let n = bar.matches.len(); - if n == 0 { - return; - } - bar.current = if forward { (bar.current + 1) % n } else { (bar.current + n - 1) % n }; - tab.editor.show_found(bar.matches.clone(), Some(bar.current), true); - } - - /// Replace the current match; the next one becomes current. - pub fn replace_one(&mut self) { - self.update_find(); - let Some(tab) = self.active_id().cloned().and_then(|id| self.panes.get_mut(&id)).and_then(|p| p.shown_mut()) else { return }; - let Some(&(a, b)) = tab.find.matches.get(tab.find.current) else { return }; - let with = tab.find.replacement.text.as_str().to_string(); - let sel = tab.editor.sel; - tab.editor.replace(a, b, &with, false); - // The caret stays where the user left it; the bar moves on. - tab.editor.sel = crate::editor::buffer::Selection { anchor: tab.editor.buffer.clamp(sel.anchor), head: tab.editor.buffer.clamp(sel.head) }; - if tab.find.current + 1 >= tab.find.matches.len() { - tab.find.current = 0; - } - self.update_find(); - } - - /// Replace every match, as one step that one undo takes back. - pub fn replace_all(&mut self) { - self.update_find(); - let Some(tab) = self.active_id().cloned().and_then(|id| self.panes.get_mut(&id)).and_then(|p| p.shown_mut()) else { return }; - if tab.find.matches.is_empty() { - return; - } - let with = tab.find.replacement.text.as_str().to_string(); - let e = &mut tab.editor; - let mut text = e.buffer.text(); - let starts: Vec = std::iter::once(0).chain(text.match_indices('\n').map(|(i, _)| i + 1)).collect(); - for &(a, b) in tab.find.matches.iter().rev() { - text.replace_range(starts[a.line] + a.col..starts[b.line] + b.col, &with); - } - let sel = e.sel; - e.replace(Pos::default(), e.buffer.last(), &text, false); - e.sel = crate::editor::buffer::Selection { anchor: e.buffer.clamp(sel.anchor), head: e.buffer.clamp(sel.head) }; - tab.find.current = 0; - self.update_find(); - } - - /// A key in one of the bar's fields: Enter and Shift+Enter step through the matches, Escape closes the bar, Tab moves - /// between the two fields, and the replace keys show or hide the replace row. - pub fn find_key(&mut self, ev: &rune::KeyEvent) -> bool { - let shift = ev.mods.shift; - let chord = Keystroke::from_rune(ev, None).and_then(|ks| find_chord(&ks)); - match &ev.key { - rune::Key::Enter => self.find_step(!shift), - rune::Key::Escape => self.close_find(), - rune::Key::Tab => { - let Some(bar) = self.shown_find().filter(|b| b.replace_mode) else { return true }; - let to_replacement = bar.query.focused; - (bar.query.focused, bar.replacement.focused) = (!to_replacement, to_replacement); - } - _ if chord == Some(true) => { - let Some(bar) = self.shown_find() else { return false }; - bar.replace_mode = !bar.replace_mode; - (bar.query.focused, bar.replacement.focused) = (!bar.replace_mode, bar.replace_mode); - } - _ => return false, - } - true - } -} - -/// The keys of main's editor search: Primary+F finds (`Some(false)`), and Cmd+Shift+F on macOS or Ctrl+H elsewhere -/// replaces (`Some(true)`). -pub fn find_chord(ks: &Keystroke) -> Option { - let replace = if cfg!(target_os = "macos") { "secondary-shift-f" } else { "secondary-h" }; - if commands::is_chord(ks, "secondary-f") { - Some(false) - } else if commands::is_chord(ks, replace) { - Some(true) - } else { - None - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn primary_f_finds_and_the_platforms_replace_key_replaces() { - let key = |spec: &str| find_chord(&Keystroke::parse(spec).unwrap()); - let primary = if cfg!(target_os = "macos") { "cmd" } else { "ctrl" }; - assert_eq!(key(&format!("{primary}-f")), Some(false)); - let replace = if cfg!(target_os = "macos") { "cmd-shift-f" } else { "ctrl-h" }; - assert_eq!(key(replace), Some(true)); - assert_eq!(key("f"), None); - assert_eq!(key(&format!("{primary}-alt-f")), None); - } -} diff --git a/src/app/github_pane.rs b/src/app/github_pane.rs index 5841107..1d0b9bf 100644 --- a/src/app/github_pane.rs +++ b/src/app/github_pane.rs @@ -7,91 +7,64 @@ impl Workspace { self.gh.iter().find(|p| p.id == id) } - pub fn gh_view_mut(&mut self, id: &str) -> Option<&mut GithubView> { - self.gh.iter_mut().find(|p| p.id == id).map(|p| &mut p.view) - } - - /// The text field `which` picks in pane `id`. A pane that is gone hands out a scratch field (the search's), which - /// can only happen between a pane closing and the next frame. - pub fn gh_field(&mut self, id: &str, which: fn(&mut GithubView) -> &mut rune::TextEdit) -> &mut rune::TextEdit { - match self.gh.iter().position(|p| p.id == id) { - Some(i) => which(&mut self.gh[i].view), - None => &mut self.search, - } - } - - /// Run what the GitHub panes asked for since the last handler, and hand their `Tx` work to the frame. - pub(super) fn drain_github(&mut self) { - let mut events = vec![]; - for p in &mut self.gh { - events.extend(p.view.events.drain(..).map(|e| (p.id.clone(), e))); - for f in p.view.fx.drain(..) { - self.rt.with_tx(f); - } - } - for (pane, ev) in events { - self.on_gh_event(&pane, &ev); - } - } - /// Show the project's GitHub view in the right sidebar and move the keyboard into it. - pub fn open_github(&mut self, cwd: PathBuf) { - let id = self.github_pane(cwd); - self.show_github(id); + pub fn open_github(&mut self, cwd: PathBuf, window: &mut Window, cx: &mut Context) { + let id = self.github_pane(cwd, window, cx); + self.show_github(id, window, cx); } - fn show_github(&mut self, id: Id) { + fn show_github(&mut self, id: Id, window: &mut Window, cx: &mut Context) { self.right_gh = Some(id.clone()); self.store.data.layout.right_hidden = false; self.store.mark_dirty(); - // The pane takes keys through its own fields; the terminal lets go of them. - self.keys_to = None; - self.blur = true; + if let Some(p) = self.gh_pane(&id) { + let handle = p.view.read(cx).focus.clone(); + window.focus(&handle, cx); + } + cx.notify(); } /// An attached issue or pull request was clicked: show it in the GitHub view of the shown session's project, or of /// the repository it names. - pub fn open_attached(&mut self, repo: Option<&str>, pull: bool, number: u32) { + pub fn open_attached(&mut self, repo: Option<&str>, pull: bool, number: u32, window: &mut Window, cx: &mut Context) { let cwd = self.active_cwd(); // Claude may name the project's own repository; its own pane shows that, with every action. let project_repo = { - let id = self.github_pane(cwd.clone()); - self.gh_pane(&id).and_then(|p| p.view.repo.as_ref()).map(|r| r.full()) + let id = self.github_pane(cwd.clone(), window, cx); + self.gh_pane(&id).and_then(|p| p.view.read(cx).repo.as_ref()).map(|r| r.full()) }; let repo = repo.filter(|full| !project_repo.is_some_and(|own| own.eq_ignore_ascii_case(full))); match repo { Some(full) => { - let id = self.named_github_pane(cwd, full); - self.show_github(id); + let id = self.named_github_pane(cwd, full, window, cx); + self.show_github(id, window, cx); } - None => self.open_github(cwd), + None => self.open_github(cwd, window, cx), } let kind = if pull { crate::github::model::Kind::Pull } else { crate::github::model::Kind::Issue }; - if let Some(id) = self.right_gh.clone() - && let Some(p) = self.gh.iter_mut().find(|p| p.id == id) - { - p.view.open_item(kind, number); + if let Some(view) = self.right_gh.as_ref().and_then(|id| self.gh_pane(id)).map(|p| p.view.clone()) { + view.update(cx, |v, cx| v.open_item(kind, number, window, cx)); } } /// While the right sidebar shows GitHub, it follows the shown session to that session's project (no focus change). - pub(super) fn sync_github(&mut self) { + pub(super) fn sync_github(&mut self, window: &mut Window, cx: &mut Context) { // Only the panel on screen follows; other projects' panes are made when the panel opens. if self.right_gh.is_none() { return; } let Some(id) = self.active.clone() else { return }; if let Some(cwd) = self.store.session(&id).map(|s| s.cwd.clone()) { - self.right_gh = Some(self.github_pane(cwd)); + self.right_gh = Some(self.github_pane(cwd, window, cx)); } } /// The project's GitHub view (one per project), created on first use. - pub(super) fn github_pane(&mut self, cwd: PathBuf) -> Id { + pub(super) fn github_pane(&mut self, cwd: PathBuf, window: &mut Window, cx: &mut Context) -> Id { let project = self.store.project_for_cwd(&cwd).and_then(|id| self.store.project(&id)).cloned(); let root = project.as_ref().map(|p| p.path.clone()).unwrap_or(cwd); let key = platform::path_key(&root); - match self.gh.iter().find(|p| p.view.named.is_none() && platform::path_key(&p.cwd) == key) { + match self.gh.iter().find(|p| p.view.read(cx).named.is_none() && platform::path_key(&p.cwd) == key) { Some(p) => p.id.clone(), None => { let name = project @@ -99,9 +72,8 @@ impl Workspace { .or_else(|| root.file_name().map(|n| n.to_string_lossy().into_owned())) .unwrap_or_else(|| "GitHub".into()); let id = new_id(); - let gh = crate::github::cli::locate().map(|exe| crate::github::cli::Gh::new(exe, root.clone())); - let view = GithubView::new(id.clone(), self.rt.mailbox(), root.clone(), name.clone(), None, gh); - self.gh.push(GhPane { id: id.clone(), cwd: root, project: name, view }); + let view = cx.new(|cx| GithubView::new(root.clone(), name.clone(), None, crate::github::cli::locate().map(|exe| crate::github::cli::Gh::new(exe, root.clone())), window, cx)); + self.push_github_pane(id.clone(), root, name, view, window, cx); id } } @@ -109,25 +81,37 @@ impl Workspace { /// The GitHub view of the repository `full` (`owner/name`), which has no project here, created on first use. /// `cwd` is only where its `gh` runs. - fn named_github_pane(&mut self, cwd: PathBuf, full: &str) -> Id { - if let Some(p) = self.gh.iter().find(|p| p.view.named.as_deref().is_some_and(|n| n.eq_ignore_ascii_case(full))) { + fn named_github_pane(&mut self, cwd: PathBuf, full: &str, window: &mut Window, cx: &mut Context) -> Id { + if let Some(p) = self.gh.iter().find(|p| p.view.read(cx).named.as_deref().is_some_and(|n| n.eq_ignore_ascii_case(full))) { return p.id.clone(); } let id = new_id(); let gh = crate::github::cli::locate().map(|exe| crate::github::cli::Gh::new(exe, cwd.clone())); - let view = GithubView::new(id.clone(), self.rt.mailbox(), cwd.clone(), full.to_string(), Some(full.to_string()), gh); - self.gh.push(GhPane { id: id.clone(), cwd, project: full.to_string(), view }); + let view = cx.new(|cx| GithubView::new(cwd.clone(), full.to_string(), Some(full.to_string()), gh, window, cx)); + self.push_github_pane(id.clone(), cwd, full.to_string(), view, window, cx); id } - /// Run what a GitHub pane asked for. - pub(crate) fn on_gh_event(&mut self, pane: &str, ev: &GhEvent) { + fn push_github_pane(&mut self, id: Id, cwd: PathBuf, project: String, view: Entity, window: &mut Window, cx: &mut Context) { + let sub_id = id.clone(); + let sub = cx.subscribe_in(&view, window, move |ws: &mut Workspace, _view, ev: &GhEvent, window, cx| ws.on_gh_event(&sub_id, ev, window, cx)); + // Returning to the window refreshes the pane, but only the one that is on screen. + let (shown, watched) = (id.clone(), view.clone()); + let active = cx.observe_window_activation(window, move |ws: &mut Workspace, window, cx| { + if window.is_window_active() && ws.right_gh.as_ref() == Some(&shown) && !ws.store.data.layout.right_hidden { + watched.update(cx, |v, cx| v.refresh_on_return(window, cx)); + } + }); + self.gh.push(GhPane { id, cwd, project, view, _sub: sub, _active: active }); + } + + fn on_gh_event(&mut self, pane: &str, ev: &GhEvent, window: &mut Window, cx: &mut Context) { let Some(cwd) = self.gh_pane(pane).map(|p| p.cwd.clone()) else { return }; match ev { - GhEvent::Toast { text, error } => self.toast(text.clone(), *error), - GhEvent::AskClaude(prompt) => match self.running_claude_in(&cwd) { - Some(id) => self.send_to_claude(&id, prompt), - None => self.new_claude_with(cwd, vec![prompt.clone()], Starter::User), + GhEvent::Toast { text, error } => self.toast(text.clone(), *error, cx), + GhEvent::AskClaude(prompt) => match self.running_claude_in(&cwd, cx) { + Some(id) => self.send_to_claude(&id, prompt, window, cx), + None => self.new_claude_with(cwd, Some(prompt.clone()), vec![], Starter::User, window, cx), }, GhEvent::Checkout(number) => { let Some(exe) = crate::github::cli::locate() else { return }; @@ -135,14 +119,15 @@ impl Workspace { self.run_git( GitOp::Branch, move || crate::github::cli::Gh::new(exe, cwd).checkout(number).map_err(|e| e.msg.into()), + cx, ); } - GhEvent::SignIn => self.sign_in_to_github(), + GhEvent::SignIn => self.sign_in_to_github(window, cx), } } /// `gh auth login` in a terminal tab. - pub(super) fn sign_in_to_github(&mut self) { + pub(super) fn sign_in_to_github(&mut self, window: &mut Window, cx: &mut Context) { let Some(exe) = crate::github::cli::locate() else { return }; let home = platform::home_dir().unwrap_or_else(|| PathBuf::from(".")); let spec = SpawnSpec { program: exe.to_string_lossy().into_owned(), args: vec!["auth".into(), "login".into()], cwd: Some(home.clone()), ..Default::default() }; @@ -160,6 +145,6 @@ impl Workspace { hidden: false, claude: None, }; - self.start_session(record, spec, true); + self.start(record, spec, true, window, cx); } } diff --git a/src/app/handoff.rs b/src/app/handoff.rs index c6e2162..253a3c3 100644 --- a/src/app/handoff.rs +++ b/src/app/handoff.rs @@ -1,18 +1,17 @@ //! Hand-off: a running Claude session moves to the active account. Claude Code can't change the account of a running -//! process, so its process is replaced by a new one that resumes the same conversation under the active account. The Claudiu session is the same record and keeps its shell +//! process, so its process is replaced by a new one that resumes the same conversation under the active account. The m4code session is the same record and keeps its shell //! and cards; the old process ends. The record remembers its new account, so it starts there from then on. The right sidebar offers the hand-off for a session that //! runs under another account than the active one. use super::*; -use crate::terminal::view::Handover; -use std::time::Instant; +use crate::thread::Handover; impl Workspace { /// The right sidebar offer: a running session that runs under another account than the active one. /// Returns the account it runs under, and the active account's name. - pub fn session_away(&self, id: &str) -> Option<(String, String)> { + pub fn session_away(&self, id: &str, cx: &App) -> Option<(String, String)> { let live = self.live.iter().find(|l| l.id == id)?; - if !self.is_running(id) { + if !self.is_running(id, cx) { return None; } let active = self.store.active_account()?; @@ -24,43 +23,44 @@ impl Workspace { } /// The right sidebar button. Asks first; the shown session is restarted under the active account. - pub fn ask_handoff(&mut self) { - let shown = self.active_id().cloned().filter(|id| self.is_running(id) && self.store.session(id).is_some_and(|r| r.claude.is_some())); + pub fn ask_handoff(&mut self, window: &mut Window, cx: &mut Context) { + let shown = self.active_id().cloned().filter(|id| self.is_running(id, cx) && self.store.session(id).is_some_and(|r| r.claude.is_some())); let Some(id) = shown else { return }; let to_name = self.store.active_account().map_or_else(|| "the active account".into(), |a| a.name()); self.modal = Some(Modal::Confirm { title: format!("Hand off to {to_name}?"), body: format!( - "Claude Code can't change accounts in a running session. Claudiu restarts this session \ + "Claude Code can't change accounts in a running session. m4code restarts this session \ under {to_name} with the same conversation. Its history is kept." ), confirm: "Hand off".into(), danger: false, act: Act::ConfirmHandoff(id), }); + window.focus(&self.modal_focus, cx); } /// Confirmed: the process is replaced at once, without compacting; the new one resumes the same conversation. - pub fn start_handoff(&mut self, id: &str) { - self.restart_handed_off(id, Instant::now()); + pub fn start_handoff(&mut self, id: &str, window: &mut Window, cx: &mut Context) { + self.restart_handed_off(id, window, cx); } /// The old process ends and a new one resumes the same conversation. The shell and cards belong to the session, /// so they stay. - fn restart_handed_off(&mut self, id: &str, since: Instant) { + fn restart_handed_off(&mut self, id: &str, window: &mut Window, cx: &mut Context) { let to = self.store.active_account().map(|a| a.id.clone()); if let Some(meta) = self.store.session_mut(id).and_then(|r| r.claude.as_mut()) { meta.account = to; } - self.restart_session(id); + self.restart_session(id, window, cx); let to_name = self.store.active_account().map_or_else(|| "the active account".into(), |a| a.name()); - self.set_handover(id, Some(Handover { message: format!("Handing over to {to_name}…"), since })); + self.set_handover(id, Some(Handover { message: format!("Handing over to {to_name}…") }), cx); } - /// The skeleton says "Handing over to …" while this is set; the new process clears it once its prompt is ready. - pub(super) fn set_handover(&mut self, id: &str, handover: Option) { - if let Some(view) = self.terminal_mut(id) { - view.handover = handover; + /// The waiting screen says "Handing over to …" while this is set; the thread clears it once the session is open. + pub(super) fn set_handover(&self, id: &str, handover: Option, cx: &mut App) { + if let Some(view) = self.live_view(id) { + view.set_handover(handover, cx); } } } diff --git a/src/app/headless.rs b/src/app/headless.rs index 286929f..397374e 100644 --- a/src/app/headless.rs +++ b/src/app/headless.rs @@ -1,2806 +1,64 @@ -//! Drives the real workspace through Rune's headless runtime (no window opens) with throwaway data and Claude Code -//! folders, to catch hangs and panics when sessions start, switch and end. Sessions run a stand-in for `claude` -//! that prints a line and waits, so no test talks to a model or reads the user's own Claude Code data. Each test has -//! a state file of its own; the folders around it are the test run's (`datadir::use_throwaway_folders`). +//! Drives the real workspace on gpui's test platform (no window opens) with a throwaway data folder, to catch +//! hangs and panics when sessions start and switch and a shell panel opens. Spawns the real `claude` and shell. +//! `cargo test -- --ignored headless`. use super::*; -use std::path::Path; -use std::sync::{Mutex, MutexGuard}; -use std::time::Instant; - -/// The tests share the run's data folder (the cross-session requests, the list of running sessions), so they take -/// turns. -static ONE_AT_A_TIME: Mutex<()> = Mutex::new(()); - -struct Harness { - rt: rune::Runtime, - /// Where the test's projects and the stand-in `claude` live (canonical, so paths compare equal). - work: PathBuf, - /// Claude Code's data folder, where a conversation is looked for. - home: PathBuf, - _dirs: [tempfile::TempDir; 2], - // Last: the runtime and its terminals go before the next test may start. - _turn: MutexGuard<'static, ()>, -} - -/// A stand-in for `claude` that shows a line and stays up whatever it is asked. -fn fake_claude(dir: &Path) -> PathBuf { - let fake = dir.join(if cfg!(windows) { "claude.cmd" } else { "claude" }); - let script = if cfg!(windows) { "@echo off\r\necho ready\r\nping -n 60 127.0.0.1 >nul\r\n" } else { "#!/bin/sh\necho ready\nsleep 60\n" }; - std::fs::write(&fake, script).unwrap(); - #[cfg(unix)] - std::fs::set_permissions(&fake, std::os::unix::fs::PermissionsExt::from_mode(0o755)).unwrap(); - fake -} - -/// A git repository with one commit at `dir`. -fn git_repo(dir: &Path) { - std::fs::create_dir_all(dir).unwrap(); - for args in [&["init", "-q", "-b", "main"][..], &["config", "user.email", "t@t"], &["config", "user.name", "t"], &["commit", "-q", "--allow-empty", "-m", "one"]] { - assert!(git(dir, args).status.success(), "git {args:?}"); - } -} - -fn git(dir: &Path, args: &[&str]) -> std::process::Output { - std::process::Command::new("git").args(args).current_dir(dir).output().unwrap() -} - -impl Harness { - /// The workspace in a 1600×900 window, with the projects `initial` makes in the work folder registered. - fn new(initial: impl FnOnce(&Path) -> Vec) -> Self { - Self::with_store(initial, |store, _| store) - } - - fn with_store(initial: impl FnOnce(&Path) -> Vec, prepare: impl FnOnce(Store, &Path) -> Store) -> Self { - let turn = ONE_AT_A_TIME.lock().unwrap_or_else(|e| e.into_inner()); - let (_, home) = datadir::use_throwaway_folders(); - let dirs = [tempfile::tempdir().unwrap(), tempfile::tempdir().unwrap()]; - let work = dunce::canonicalize(dirs[1].path()).unwrap(); - let path = dirs[0].path().join("state.json"); - let store = prepare(Store::load(path.clone()), &path); - let mut ws = Workspace::with_store(initial(&work), store); - ws.claude_exe = Some(fake_claude(&work)); - ws.limits_asked = crate::claude::subagents::AgentMap::from_fn(|_| Some(Instant::now())); - let asked = ws.limits_asked.clone(); - ws.start(); - assert_eq!(ws.limits_asked, asked, "saved readings draw before any provider read starts"); - let mut rt = rune::Runtime::new(ws, crate::panels::workspace_view::view, (1600.0, 900.0), rune::Env::new(true, 2.0)); - // What `main` hands the app: keys no element took. - rt.on_key = Some(|ws: &mut Workspace, ev: &rune::KeyEvent, tx: &mut Tx| ws.on_key(ev, tx)); - let mut h = Self { rt, work, home, _dirs: dirs, _turn: turn }; - h.pump(); - h - } - - fn ws(&self) -> &Workspace { - &self.rt.state - } - - /// Run `f` as a click or key would, then draw. Nothing a step starts may block the window. - fn step(&mut self, f: impl FnOnce(&mut Workspace)) { - let t = Instant::now(); - self.rt.update(|ws, tx| { - f(ws); - ws.after_input(tx); - }); - let acted = t.elapsed(); - self.pump(); - self.pump(); - assert!(acted < Duration::from_millis(400), "the window was blocked for {acted:?}"); - } - - /// One frame: background answers and terminal output are taken in, then the view is drawn. - fn pump(&mut self) { - self.rt.update(|ws, tx| { - ws.limits_asked = crate::claude::subagents::AgentMap::from_fn(|_| Some(Instant::now())); - ws.poll(tx); - }); - self.rt.frame(1.0 / 60.0); - } - - fn wait(&mut self, what: &str, done: impl Fn(&Workspace) -> bool) { - let t = Instant::now(); - let mut said = None; - while !done(self.ws()) { - said = self.ws().toast.as_ref().map(|t| t.text.clone()).or(said); - assert!(t.elapsed() < Duration::from_secs(30), "{what} never happened; the last toast said {said:?}"); - std::thread::sleep(Duration::from_millis(50)); - self.pump(); - } - } - - /// Let springs and fades finish. - fn settle(&mut self) { - for _ in 0..90 { - self.pump(); - } - } - - fn drawn(&self, key: &str) -> bool { - self.rt.find(key).is_some() - } - - fn keys(&self) -> Vec { - self.rt.elements().iter().filter_map(|e| e.key.clone()).collect() - } - - fn click(&mut self, key: &str) { - let (x, y) = self.rt.find(key).unwrap_or_else(|| panic!("{key} is not drawn")); - self.rt.pointer_move(x, y); - self.rt.pointer_down(x, y); - self.rt.pointer_up(x, y); - self.pump(); - } - - /// Press on the element drawn for `key`, move the pointer by `(dx, dy)` and let go, as a mouse would. - fn drag(&mut self, key: &str, dx: f32, dy: f32) { - let (x, y) = self.rt.find(key).unwrap_or_else(|| panic!("{key} is not drawn")); - self.rt.pointer_move(x, y); - self.rt.pointer_down(x, y); - self.rt.pointer_move(x + dx, y + dy); - self.rt.pointer_up(x + dx, y + dy); - self.pump(); - } - - fn press(&mut self, key: rune::Key, mods: impl FnOnce(&mut rune::Mods)) { - let mut m = rune::Mods::default(); - mods(&mut m); - self.rt.key(rune::KeyEvent { key, mods: m }); - self.pump(); - } - - /// A session record in the first project, running `spec` instead of `claude`. - fn start_one(&mut self, title: &str, cwd: &Path, spec: SpawnSpec) -> Id { - let id = new_id(); - let project_id = self.ws().store.data.projects.first().map(|p| p.id.clone()); - let record = SessionRecord { - id: id.clone(), - kind: SessionKind::Claude, - title: title.into(), - custom_title: None, - auto_title: None, - project_id, - cwd: cwd.to_path_buf(), - created_at: now(), - last_active: now(), - exit_code: None, - hidden: false, - // Present, so closing it keeps the history record instead of treating it as an empty new session. - claude: Some(ClaudeMeta { session_id: id.clone(), external: ExternalState::Present, ..Default::default() }), - }; - self.step(|ws| ws.start_session(record, spec, true)); - id - } - - /// The menu's rows: label and whether it has an x. - fn menu_rows(&self) -> Vec<(String, bool)> { - self.ws().menu.as_ref().map(|m| m.items.iter().map(|i| (i.label.trim().to_string(), i.remove.is_some())).collect()).unwrap_or_default() - } -} - -fn exit_spec(code: i32, cwd: &Path) -> SpawnSpec { - let args = if cfg!(windows) { vec!["/c".into(), format!("exit {code}")] } else { vec!["-c".into(), format!("exit {code}")] }; - SpawnSpec { program: if cfg!(windows) { "cmd.exe" } else { "/bin/sh" }.into(), args, cwd: Some(cwd.to_path_buf()), ..Default::default() } -} - -fn idle(ws: &Workspace) -> bool { - ws.live.iter().all(|l| !l.view.is_loading() && !l.view.is_working()) -} - -/// The window draws its three columns, and the sidebar, the settings dialog and the shortcuts answer. -#[test] -fn the_workspace_draws_and_its_controls_answer() { - let mut h = Harness::new(|_| vec![]); - h.settle(); - for key in ["topbar", "sidebar", "new-claude", "search-box", "settings"] { - assert!(h.drawn(key), "{key} is not drawn: {:?}", h.keys()); - } - - // The gear opens Settings; Escape closes it. - h.click("settings"); - assert!(matches!(h.ws().modal, Some(Modal::Settings { .. })), "Settings did not open"); - h.press(rune::Key::Escape, |_| {}); - assert!(h.ws().modal.is_none(), "Escape did not close Settings"); - - // The sidebar shortcut hides the sidebar and shows it again. - let visible = h.ws().store.data.layout.sidebar_visible; - let secondary = |m: &mut rune::Mods| { - m.cmd = true; - m.shift = true; - if cfg!(target_os = "macos") { m.logo = true } else { m.ctrl = true } - }; - h.press(rune::Key::Command('b'), secondary); - assert_eq!(h.ws().store.data.layout.sidebar_visible, !visible, "the shortcut toggles the sidebar"); - h.press(rune::Key::Command('b'), secondary); - assert_eq!(h.ws().store.data.layout.sidebar_visible, visible); - - // A new session from the button: shown, running, and its row is in the sidebar. - let cwd = h.work.clone(); - h.step(|ws| ws.new_claude(cwd)); - let id = h.ws().active.clone().expect("a session is shown"); - h.wait("the first screen", idle); - h.settle(); - assert!(h.keys().iter().any(|k| k.starts_with("row-") && k.ends_with(&id)), "the session's row: {:?}", h.keys()); - assert!(h.ws().is_running(&id)); -} - -#[test] -fn saved_subagent_limits_draw_at_launch_before_any_read() { - use crate::claude::{limits::Pool, subagents::Agent}; - let h = Harness::with_store(|_| vec![], |mut store, path| { - let limit = crate::store::RateLimit { utilization: Some(0.24), resets_at: Some(now() + 3600), seen_at: now() }; - for agent in Agent::ALL { - if agent.provider().limits.is_some() { - store.data.settings.custom_subagents.get_mut(agent).on = true; - store.data.subagent_limits.insert(agent.key().into(), vec![Pool { name: agent.name().into(), usage: crate::store::AccountUsage { five_hour: Some(limit.clone()), seven_day: Some(limit.clone()) } }]); - } - } - store.save(); - Store::load(path.to_path_buf()) - }); - for agent in Agent::ALL { - if agent.provider().limits.is_some() { - assert!(h.drawn(&format!("meter-{}-0-5h", agent.key())), "{}: {:?}", agent.name(), h.keys()); - } - } -} - -#[test] -fn failed_and_unchanged_subagent_limits_keep_the_saved_reading_without_a_redraw() { - use crate::claude::limits::Pool; - let mut h = Harness::new(|_| vec![]); - let limit = crate::store::RateLimit { utilization: Some(0.24), resets_at: Some(now() + 3600), seen_at: now() }; - let pools = vec![Pool { name: "Codex".into(), usage: crate::store::AccountUsage { five_hour: Some(limit), seven_day: None } }]; - h.step(|ws| { - ws.rt.dirty = false; - ws.apply_subagent_limits("codex", Ok(pools.clone())); - assert!(ws.rt.dirty, "a changed reading redraws"); - ws.rt.dirty = false; - ws.apply_subagent_limits("codex", Ok(pools.clone())); - assert!(!ws.rt.dirty, "the same reading needs no redraw"); - ws.apply_subagent_limits("codex", Err("no reading yet".into())); - assert!(!ws.rt.dirty, "a failed read needs no redraw"); - assert_eq!(ws.store.data.subagent_limits.get("codex"), Some(&pools)); - }); -} - -#[test] -fn codex_limits_show_only_with_codex_subagents_on() { - let mut h = Harness::new(|_| vec![]); - let limit = crate::store::RateLimit { utilization: Some(0.24), resets_at: Some(now() + 3600), seen_at: now() }; - h.step(|ws| { - ws.limits_asked = crate::claude::subagents::AgentMap::from_fn(|_| Some(Instant::now())); - ws.store.data.subagent_limits.insert("codex".into(), vec![crate::claude::limits::Pool { name: "Codex".into(), usage: crate::store::AccountUsage { five_hour: Some(limit.clone()), seven_day: Some(limit) } }]); - }); - assert!(h.drawn("meter-5h") && !h.drawn("meter-codex-0-5h"), "Codex subagents are off: {:?}", h.keys()); - h.step(|ws| ws.store.data.settings.custom_subagents.get_mut(crate::claude::subagents::Agent::Codex).on = true); - assert!(h.drawn("meter-codex-0-5h") && h.drawn("meter-codex-0-7d"), "Codex's row draws under Claude's: {:?}", h.keys()); -} - -#[test] -fn a_reading_saved_hours_ago_still_counts_down_to_its_reset() { - use crate::claude::limits::Pool; - use crate::claude::subagents::Agent; - let mut h = Harness::new(|_| vec![]); - let saved = crate::store::RateLimit { utilization: Some(0.24), resets_at: Some(now() + 3630), seen_at: now() - 3 * 3600 }; - h.step(|ws| { - ws.store.data.settings.custom_subagents.get_mut(Agent::Codex).on = true; - ws.limits_asked = crate::claude::subagents::AgentMap::from_fn(|_| Some(Instant::now())); - ws.store.data.subagent_limits.insert("codex".into(), vec![Pool { name: "Codex".into(), usage: crate::store::AccountUsage { five_hour: Some(saved), seven_day: None } }]); - }); - let texts: Vec = h.rt.elements().into_iter().filter_map(|e| e.text).collect(); - assert!(texts.iter().any(|t| t == "1h 0m") && !texts.iter().any(|t| t.ends_with(" ago")), "{texts:?}"); -} - -#[test] -fn limit_meters_line_up_in_one_compact_grid_for_every_provider() { - use crate::claude::limits::Pool; - use crate::claude::subagents::Agent; - let mut h = Harness::new(|_| vec![]); - let limit = crate::store::RateLimit { utilization: Some(0.24), resets_at: Some(now() + 3600), seen_at: now() }; - let both = crate::store::AccountUsage { five_hour: Some(limit.clone()), seven_day: Some(limit.clone()) }; - h.step(|ws| { - ws.store.data.accounts = vec![crate::store::Account { id: crate::store::MAIN_ACCOUNT.into(), usage: both.clone(), ..Default::default() }]; - ws.store.data.subagent_limits.insert("codex".into(), vec![Pool { name: "Codex".into(), usage: both.clone() }]); - ws.store.data.settings.custom_subagents.get_mut(Agent::Codex).on = true; - ws.store.data.settings.custom_subagents.get_mut(Agent::Antigravity).on = true; - ws.limits_asked = crate::claude::subagents::AgentMap::from_fn(|_| Some(Instant::now())); - ws.store.data.subagent_limits.insert("antigravity".into(), vec![Pool { name: "Gemini Models".into(), usage: both.clone() }, Pool { name: "Claude and GPT models".into(), usage: both.clone() }, Pool { name: "Gemini 4 Argon".into(), usage: crate::store::AccountUsage { five_hour: None, seven_day: Some(limit.clone()) } }]); - }); - h.settle(); - let elements = h.rt.elements(); - let rect = |key: &str| -> [f32; 4] { elements.iter().find(|e| e.key.as_deref() == Some(key) && !e.exiting).unwrap_or_else(|| panic!("{key} is not drawn: {:?}", h.keys())).rect }; - let five = ["meter-5h", "meter-codex-0-5h", "meter-antigravity-0-5h", "meter-antigravity-1-5h"]; - let seven = ["meter-7d", "meter-codex-0-7d", "meter-antigravity-0-7d", "meter-antigravity-1-7d", "meter-antigravity-2-7d"]; - assert!(!h.drawn("meter-antigravity-2-5h"), "Argon has no five-hour window"); - for column in [&five[..], &seven[..]] { - let first = rect(column[0]); - for key in column { - let r = rect(key); - assert!((r[0] - first[0]).abs() <= 1.0 && (r[2] - first[2]).abs() <= 1.0, "{key} is not aligned with {}: {r:?} vs {first:?}", column[0]); - assert!(r[3] <= 22.0, "{key} is too tall: {r:?}"); - assert!(elements.iter().any(|e| e.text.as_deref().is_some_and(|t| t.contains("24%")) && e.rect[0] >= r[0] - 1.0 && e.rect[1] >= r[1] - 1.0 && e.rect[0] + e.rect[2] <= r[0] + r[2] + 1.0 && e.rect[1] + e.rect[3] <= r[1] + r[3] + 1.0), "{key} has no percent text inside its bar: {r:?}"); - } - } - for key in ["meter-row-claude", "meter-row-codex-0", "meter-row-antigravity-0", "meter-row-antigravity-1", "meter-row-antigravity-2"] { - let r = rect(key); - assert!(r[3] <= 24.0, "{key} is too tall: {r:?}"); - } - let grid = rect("meter-limits"); - assert!(grid[3] < 170.0, "the grid is too tall: {grid:?}"); - let headers = elements.iter().filter(|e| e.text.as_deref().is_some_and(|t| t.contains("5 HOUR"))).count(); - assert_eq!(headers, 1, "5 HOUR should appear once"); - // Rows are told apart by their logos; only a named Gemini model adds a short name. - for source in ["claude", "codex-0", "antigravity-0", "antigravity-1", "antigravity-2"] { - let (logo, row) = (rect(&format!("meter-logo-{source}")), rect(&format!("meter-row-{source}"))); - assert!(logo[0] >= row[0] - 1.0 && logo[1] >= row[1] - 1.0 && logo[1] + logo[3] <= row[1] + row[3] + 1.0, "{source}'s logo starts its row: {logo:?} in {row:?}"); - } - let texts: Vec<&str> = elements.iter().filter_map(|e| e.text.as_deref()).collect(); - assert!(!texts.contains(&"CLAUDE") && !texts.contains(&"CODEX") && !texts.contains(&"GEMINI") && !texts.contains(&"CLAUDE/GPT") && texts.contains(&"Ar"), "{texts:?}"); -} - -#[test] -fn unknown_antigravity_pools_stay_in_the_label_column_and_tell_rows_apart() { - use crate::claude::limits::Pool; - use crate::claude::subagents::Agent; - let mut h = Harness::new(|_| vec![]); - let limit = crate::store::RateLimit { utilization: Some(0.24), resets_at: Some(now() + 3600), seen_at: now() }; - let both = crate::store::AccountUsage { five_hour: Some(limit.clone()), seven_day: Some(limit) }; - h.step(|ws| { - ws.store.data.settings.custom_subagents.get_mut(Agent::Antigravity).on = true; - ws.limits_asked = crate::claude::subagents::AgentMap::from_fn(|_| Some(Instant::now())); - ws.store.data.subagent_limits.insert("antigravity".into(), vec![Pool { name: "Mistral and Llama models".into(), usage: both.clone() }, Pool { name: "Some New models".into(), usage: both }]); - }); - h.settle(); - let elements = h.rt.elements(); - let rect = |key: &str| -> [f32; 4] { elements.iter().find(|e| e.key.as_deref() == Some(key) && !e.exiting).unwrap_or_else(|| panic!("{key} is not drawn: {:?}", h.keys())).rect }; - let claude_five = rect("meter-5h"); - for (source, mark) in [("antigravity-0", "Mi"), ("antigravity-1", "So")] { - let (logo, five) = (rect(&format!("meter-logo-{source}")), rect(&format!("meter-{source}-5h"))); - assert!((five[0] - claude_five[0]).abs() <= 1.0 && (five[2] - claude_five[2]).abs() <= 1.0, "{source}'s 5h bar is not aligned with Claude's: {five:?} vs {claude_five:?}"); - assert!(logo[0] + logo[2] <= five[0], "{source}'s label column extends over its 5h bar: {logo:?} vs {five:?}"); - let label = elements.iter().find(|e| e.text.as_deref() == Some(mark)).unwrap_or_else(|| panic!("{mark} is not drawn for {source}: {:?}", elements.iter().filter_map(|e| e.text.as_deref()).collect::>())); - assert!(label.rect[0] >= logo[0] && label.rect[0] + label.rect[2] <= five[0], "{source}'s label {mark} extends past the label column: {:?} vs {five:?}", label.rect); - } -} - -#[test] -fn antigravity_limits_show_one_row_per_pool_only_with_antigravity_subagents_on() { - use crate::claude::limits::Pool; - use crate::claude::subagents::Agent; - let mut h = Harness::new(|_| vec![]); - let limit = crate::store::RateLimit { utilization: Some(0.24), resets_at: Some(now() + 3600), seen_at: now() }; - let gemini = Pool { name: "Gemini Models".into(), usage: crate::store::AccountUsage { five_hour: Some(limit.clone()), seven_day: Some(limit.clone()) } }; - let argon = Pool { name: "Gemini 4 Argon".into(), usage: crate::store::AccountUsage { five_hour: None, seven_day: Some(limit) } }; - // Asked just now, so the test's own `agy`, if any, isn't run. - h.step(|ws| { - ws.limits_asked = crate::claude::subagents::AgentMap::from_fn(|_| Some(Instant::now())); - ws.store.data.subagent_limits.insert("antigravity".into(), vec![gemini, argon]); - }); - assert!(!h.drawn("meter-antigravity-0-5h"), "Antigravity subagents are off: {:?}", h.keys()); - h.step(|ws| ws.store.data.settings.custom_subagents.get_mut(Agent::Antigravity).on = true); - assert!(h.drawn("meter-antigravity-0-5h") && h.drawn("meter-antigravity-0-7d"), "Gemini's row draws under Claude's: {:?}", h.keys()); - assert!(h.drawn("meter-antigravity-1-7d") && !h.drawn("meter-antigravity-1-5h"), "a pool shows only the windows it has"); - assert!(h.drawn("meter-logo-antigravity-0") && h.drawn("meter-logo-antigravity-1"), "each pool's row starts with its logos"); -} - -/// The welcome screen has a shell of its own: it opens with no session, takes the keyboard, is resized like any -/// shell, hides while a session is shown, and is back when the last session closes. -#[test] -fn the_shell_opens_on_the_welcome_screen() { - let mut h = Harness::new(|_| vec![]); - assert!(h.ws().main == Main::Home && h.ws().active.is_none(), "starts on the welcome screen"); - h.step(|ws| ws.command(Command::ToggleShell)); - h.settle(); - assert!(h.ws().shells.get(HOME_SHELL).is_some_and(|p| p.open), "the shell opens with no session"); - assert!(h.ws().terminal_focused(&shell_key(HOME_SHELL)), "it takes the keyboard"); - assert!(h.drawn("shell-panel"), "the shell panel draws: {:?}", h.keys()); - h.step(|ws| { - ws.shell_drag = Some(SideDrag { size: SHELL_HEIGHT }); - ws.drag_shell(-100.0); - assert_eq!(ws.shells[HOME_SHELL].height, SHELL_HEIGHT + 100.0, "the divider resizes it"); - ws.shell_drag = None; - }); - - // A session shown hides it, and it keeps running; the session's own shell is separate. - let cwd = h.work.clone(); - h.step(|ws| ws.new_claude(cwd.clone())); - let id = h.ws().active.clone().expect("a session is shown"); - h.settle(); - assert!(!h.drawn("shell-panel"), "the welcome shell stays out of a session's view"); - assert!(h.ws().shells.contains_key(HOME_SHELL), "but is kept"); - h.step(|ws| ws.close_live(&id)); - h.settle(); - assert!(h.ws().main == Main::Home && h.drawn("shell-panel"), "closing the last session brings the welcome shell back"); - assert!(h.ws().terminal_focused(&shell_key(HOME_SHELL)), "and the keyboard with it"); - - h.step(|ws| ws.command(Command::ToggleShell)); - assert!(!h.ws().shells[HOME_SHELL].open, "toggled shut"); -} - -/// Sessions and the shell under them, the sidebars' widths, cards and the GitHub view, with a stand-in `claude`. -#[test] -fn sessions_and_the_shell_panel() { - let mut h = Harness::new(|_| vec![]); - let cwd = h.work.clone(); - h.step(|ws| ws.new_claude(cwd.clone())); - let first = h.ws().active.clone().expect("a session is shown"); - // A filter on a project that no longer exists filters nothing; the list still draws. - h.step(|ws| ws.act(Act::FilterProject(Some("gone".into())))); - assert!(h.ws().project_filter().is_none()); - h.step(|ws| ws.act(Act::FilterProject(None))); - - // The shell under a Claude session: starts on first use, survives switching away, goes with its session. - h.step(|ws| ws.toggle_shell(&first)); - assert!(h.ws().shells.get(&first).is_some_and(|p| p.open), "shell opened"); - h.step(|ws| ws.new_claude(cwd.clone())); - let second = h.ws().active.clone().unwrap(); - assert_ne!(first, second); - assert!(h.ws().shells.contains_key(&first) && !h.ws().shells.contains_key(&second), "the shell stays with its own session"); - h.step(|ws| ws.toggle_shell(&first)); - assert!(h.ws().active.as_deref() == Some(first.as_str()) && h.ws().shells[&first].open, "from another session, it shows the session and its shell"); - h.step(|ws| ws.toggle_shell(&first)); - assert!(!h.ws().shells[&first].open, "toggled shut"); - h.step(|ws| ws.toggle_shell(&first)); - h.settle(); - assert!(h.drawn("shell-panel"), "the shell panel draws: {:?}", h.keys()); - - // Dragging the divider resizes the panel within bounds. - h.step(|ws| { - ws.shell_drag = Some(SideDrag { size: SHELL_HEIGHT }); - ws.drag_shell(-100.0); - assert_eq!(ws.shells[&first].height, SHELL_HEIGHT + 100.0); - ws.drag_shell(-5000.0); - assert_eq!(ws.shells[&first].height, 700.0, "keeps room for the terminal"); - ws.drag_shell(5000.0); - assert_eq!(ws.shells[&first].height, SHELL_MIN); - ws.shell_drag = None; - }); - h.step(|ws| ws.close_live(&first)); - assert!(!h.ws().shells.contains_key(&first), "closing the session drops its shell"); - - // Both sidebars can be dragged; the menu and the GitHub view each remember their own width. - assert_eq!(h.ws().right_width(1600.0), RIGHT_MENU_W, "the menu starts at its default width"); - h.step(|ws| { - ws.right_drag = Some(SideDrag { size: RIGHT_MENU_W }); - ws.drag_right(-40.0); - assert_eq!(ws.right_width(1600.0), RIGHT_MENU_W + 40.0); - ws.drag_right(5000.0); - assert_eq!(ws.right_width(1600.0), RIGHT_MENU_MIN); - ws.drag_right(-5000.0); - assert_eq!(ws.right_width(1600.0), RIGHT_MENU_MAX); - ws.drag_right(-40.0); - ws.right_drag = None; - assert_eq!(ws.left_width(1600.0), SIDEBAR_W); - ws.left_drag = Some(SideDrag { size: SIDEBAR_W }); - ws.drag_left(50.0); - assert_eq!(ws.left_width(1600.0), SIDEBAR_W + 50.0); - ws.drag_left(-5000.0); - assert_eq!(ws.left_width(1600.0), SIDEBAR_MIN); - ws.drag_left(5000.0); - assert_eq!(ws.left_width(1600.0), SIDEBAR_MAX); - assert_eq!(ws.left_width(700.0), SIDEBAR_MIN, "keeps room for the session in a small window"); - ws.left_drag = None; - }); - - // A card reaches the terminal of its session, and a card for a session that is not running is dropped. - let shown = h.ws().active.clone().unwrap(); - let stem = datadir::safe_file_stem(&shown); - let card = |call: &str| crate::visual::Card { call: call.into(), content: "# Hi".into() }; - h.step(|ws| ws.apply_visuals(vec![(stem.clone(), card("c1")), ("no-such-session".into(), card("c2"))])); - let view = h.ws().live_view(&shown).unwrap(); - assert!(view.has_card("c1") && !view.has_card("c2")); - - // The GitHub view lives in the right sidebar: one per folder, with its own width. - h.step(|ws| ws.open_github(cwd.clone())); - assert!(h.ws().gh.len() == 1 && h.ws().right_gh.is_some(), "github shown in the right sidebar"); - assert_eq!(h.ws().right_width(1600.0), RIGHT_GH_W, "GitHub keeps its own width"); - h.settle(); - h.step(|ws| { - ws.right_drag = Some(SideDrag { size: RIGHT_GH_W }); - ws.drag_right(-100.0); - assert_eq!(ws.right_width(1600.0), RIGHT_GH_W + 100.0); - ws.drag_right(5000.0); - assert_eq!(ws.right_width(1600.0), RIGHT_GH_MIN); - ws.drag_right(-5000.0); - assert_eq!(ws.right_width(1600.0), 1040.0, "keeps room for the session"); - ws.right_drag = None; - }); - h.step(|ws| ws.toggle_right()); - assert!(h.ws().store.data.layout.right_hidden, "hidden"); - h.step(|ws| ws.toggle_right()); - assert!(!h.ws().store.data.layout.right_hidden, "shown again"); - h.step(|ws| ws.open_github(cwd.clone())); - assert!(h.ws().gh.len() == 1, "one github pane per folder"); - - // A running Claude session in the folder takes the request itself, so close the leftovers to see a new one start. - let leftovers: Vec = h.ws().live.iter().map(|l| l.id.clone()).collect(); - for id in leftovers { - h.step(|ws| ws.close_live(&id)); - } - let before = h.ws().live.len(); - let pane = h.ws().gh[0].id.clone(); - h.step(|ws| ws.on_gh_event(&pane, &GhEvent::AskClaude("explain issue 1".into()))); - assert!(h.ws().live.len() == before + 1 && h.ws().active.is_some(), "Ask Claude opens a session"); - assert!(h.ws().right_gh.is_some() && h.ws().gh.len() == 1, "the right sidebar keeps following the same project"); - // A new session in another folder: the open GitHub view moves to that folder. - let other = h.work.join("other"); - std::fs::create_dir_all(&other).unwrap(); - h.step(|ws| ws.new_claude(other.clone())); - let follows = h.ws().right_gh.as_ref().and_then(|id| h.ws().gh_pane(id)).is_some_and(|p| platform::path_key(&p.cwd) == platform::path_key(&other)); - assert!(h.ws().gh.len() == 2 && follows, "GitHub follows a new session"); - h.settle(); -} - -/// The grips in the gutters answer the mouse: each panel follows its grip. -#[test] -fn the_sidebars_and_the_shell_resize_by_their_grips() { - let mut h = Harness::new(|_| vec![]); - let cwd = h.work.clone(); - h.step(|ws| ws.new_claude(cwd.clone())); - let id = h.ws().active.clone().unwrap(); - h.step(|ws| ws.toggle_shell(&id)); - h.settle(); - - h.drag("left-resize", 40.0, 0.0); - assert_eq!(h.ws().left_width(1600.0), SIDEBAR_W + 40.0, "the left sidebar follows its grip"); - h.drag("right-resize", -40.0, 0.0); - assert_eq!(h.ws().right_width(1600.0), RIGHT_MENU_W + 40.0, "the right sidebar follows its grip"); - h.drag("shell-resize", 0.0, -60.0); - assert_eq!(h.ws().shells[&id].height, SHELL_HEIGHT + 60.0, "the shell follows its grip"); -} - -/// Cross-session tools are answered on the spot, and one that can't work says why. -#[test] -fn other_sessions_are_listed_started_and_read() { - use serde_json::{Value, json}; - let mut h = Harness::new(|_| vec![]); - let cwd = h.work.clone(); - h.step(|ws| ws.new_claude(cwd.clone())); - let id = h.ws().active.clone().expect("a session is shown"); - let ask = |from: String, tool: &'static str, args: Value| std::thread::spawn(move || crate::claude::bridge::ask(&from, tool, &args)); - let take = || loop { - if let Some(r) = crate::claude::bridge::take_requests().pop() { - break r; - } - std::thread::sleep(Duration::from_millis(50)); - }; - let from = format!("code:{id}"); - - let asked = ask(from.clone(), "list_code_sessions", json!({})); - let req = take(); - h.step(|ws| ws.serve_requests(vec![req])); - let text = asked.join().unwrap().unwrap(); - assert!(text.contains(&id) && text.contains("this session"), "{text}"); - - // A request whose asker gave up is dropped. - let stale = crate::claude::bridge::Request { id: "late".into(), from: from.clone(), tool: "start_code_session".into(), args: json!({"folder": cwd.to_string_lossy()}), deadline: now() - 1 }; - let before = h.ws().live.len(); - h.step(|ws| ws.serve_requests(vec![stale])); - assert_eq!(h.ws().live.len(), before, "an expired request was carried out"); - - let asked = ask(from.clone(), "start_code_session", json!({"folder": "no-such-project"})); - let req = take(); - h.step(|ws| ws.serve_requests(vec![req])); - assert!(asked.join().unwrap().unwrap_err().contains("No project or folder")); - - // A first message of its own needs the user's yes: a closed dialog is a refusal, and nothing was started. - let asked = ask(from.clone(), "start_code_session", json!({"folder": cwd.to_string_lossy(), "prompt": "do the thing"})); - let req = take(); - h.step(|ws| ws.serve_requests(vec![req])); - assert!(matches!(h.ws().modal, Some(Modal::Confirm { act: Act::ConfirmStartSession(_), .. })), "the user was not asked"); - h.settle(); - assert!(h.drawn("modal-card"), "the question is drawn: {:?}", h.keys()); - h.step(|ws| ws.act(Act::Dismiss)); - h.step(|ws| ws.serve_requests(vec![])); - assert_eq!(asked.join().unwrap().unwrap_err(), "The user declined."); - assert_eq!(h.ws().live.len(), before, "a declined request started a session"); - - let asked = ask(from.clone(), "start_code_session", json!({"folder": cwd.to_string_lossy()})); - let req = take(); - h.step(|ws| ws.serve_requests(vec![req])); - let text = asked.join().unwrap().unwrap(); - assert_eq!(h.ws().live.len(), before + 1); - let code_id = text.split("(id ").nth(1).and_then(|t| t.split(')').next()).unwrap().to_string(); - // The stand-in prints one line at the top of a screen taller than 40 rows. - h.wait("output to read", |ws| ws.live_view(&code_id).is_some_and(|v| !v.tail_text(500).is_empty())); - let asked = ask(from.clone(), "read_code_session", json!({"id": code_id})); - let req = take(); - h.step(|ws| ws.serve_requests(vec![req])); - assert!(asked.join().unwrap().unwrap().contains("latest terminal output")); - h.step(|ws| ws.close_live(&id)); - // Closing goes to the home screen; the ended session is picked from the sidebar. - h.step(|ws| ws.act(Act::Select(id.clone()))); -} - -/// With no `claude` found, starting a session says so and offers the setup window; asking for it twice opens one. -#[test] -fn a_missing_claude_offers_the_setup_window() { - let mut h = Harness::new(|_| vec![]); - let cwd = h.work.clone(); - h.step(|ws| { - ws.claude_exe = None; - ws.new_claude(cwd); - }); - let action = h.ws().toast.as_ref().and_then(|t| t.action.as_ref().map(|(label, act)| (label.clone(), matches!(act, Act::OpenSetup)))); - assert_eq!(action, Some(("Check setup".to_string(), true)), "the toast offers the setup window"); - h.settle(); - assert!(h.keys().iter().any(|k| k.starts_with("toast-")), "the toast is drawn: {:?}", h.keys()); - for _ in 0..2 { - h.step(|ws| ws.act(Act::OpenSetup)); - } - assert!(h.ws().setup_window.is_some() && h.ws().setup_serial == 1, "one setup window"); -} - -/// The setup window's Done reaches the workspace: the `claude` it found is used and saved, and the window is gone. -#[test] -fn the_setup_windows_answer_reaches_the_workspace() { - let mut h = Harness::new(|_| vec![]); - h.step(|ws| ws.claude_exe = None); - let fake = fake_claude(&h.work); - let hand_back = super::setup::to_workspace(h.ws().rt.mailbox(), super::setup::Mode::Reopened); - hand_back(super::setup::SetupEvent::Done { claude_path: Some(fake.clone()), recommended_trims: false }); - h.wait("the answer to arrive", |ws| ws.claude_exe.is_some()); - assert_eq!(h.ws().claude_exe.as_deref(), Some(fake.as_path())); - assert_eq!(h.ws().store.data.settings.claude_path.as_deref(), Some(fake.as_path()), "the path is saved"); - assert!(h.ws().setup_window.is_none()); -} - -/// A process that ends by itself closes the session the way the X does. A clean exit says nothing, a non-zero -/// exit is a toast, and the worktree stays: Claude Code already asked on `/exit`, and the X is the path that offers. -#[test] -fn a_process_that_ends_closes_the_session_and_leaves_its_worktree() { - let mut h = Harness::new(|work| { - git_repo(&work.join("proj")); - vec![work.join("proj")] - }); - let repo_dir = h.work.join("proj"); - let folder = crate::git::worktree::folder(&repo_dir, "fix"); - let added = git(&repo_dir, &["worktree", "add", "-q", "-b", "worktree-fix", &folder.to_string_lossy()]); - assert!(added.status.success(), "{}", String::from_utf8_lossy(&added.stderr)); - // Pump until the view is gone. A late removal dialog is spawned off the UI thread, so keep going after the close. - let until_closed = |h: &mut Harness, id: &str| { - h.wait("the session to close after its process ended", |ws| ws.live_view(id).is_none()); - let rest = Instant::now(); - while rest.elapsed() < Duration::from_secs(1) { - h.pump(); - std::thread::sleep(Duration::from_millis(50)); - assert!(h.ws().modal.is_none(), "a process that ended by itself offered to remove the worktree"); - } - }; - - // Session-only shortcuts are inert on Home, even with a project available as a fallback folder. - h.step(|ws| { - ws.main = Main::Home; - ws.active = None; - ws.toast = None; - }); - h.step(|ws| ws.command(Command::OpenGithub)); - assert!(h.ws().gh.is_empty() && h.ws().right_gh.is_none() && h.ws().toast.is_none(), "disabled shortcuts must not open a view or show a toast"); - - let clean = h.start_one("Fix login", &folder, exit_spec(0, &folder)); - until_closed(&mut h, &clean); - let (code, toast) = (h.ws().store.session(&clean).map(|s| s.exit_code), h.ws().toast.as_ref().map(|t| t.text.clone())); - assert_eq!(code, Some(Some(0)), "a clean exit is kept on the history record"); - assert_eq!(toast, None, "a clean exit says nothing"); - assert!(folder.exists(), "the worktree stays"); - - let bad = h.start_one("Broken", &folder, exit_spec(1, &folder)); - until_closed(&mut h, &bad); - let (code, toast) = (h.ws().store.session(&bad).map(|s| s.exit_code), h.ws().toast.as_ref().map(|t| t.text.clone())); - assert_eq!(code, Some(Some(1))); - assert_eq!(toast.as_deref(), Some("Broken ended (exit code 1)")); - - let spec = SpawnSpec { program: "definitely-not-a-real-program-claudiu".into(), args: vec![], cwd: Some(folder.clone()), ..Default::default() }; - let missing = h.start_one("Missing", &folder, spec); - until_closed(&mut h, &missing); - let toast = h.ws().toast.as_ref().map(|t| t.text.clone()); - assert!(toast.as_deref().is_some_and(|t| t.starts_with("Could not start Missing:")), "{toast:?}"); -} - -/// A new session that was open, with no conversation yet, comes back when Claudiu starts again and stays up: -/// `claude --resume` would find nothing and end at once. -#[test] -fn a_new_session_without_a_conversation_comes_back_after_a_restart() { - let mut h = Harness::new(|_| vec![]); - // Like `claude`, the stand-in ends when asked to resume a conversation it doesn't have. - let fake = h.work.join(if cfg!(windows) { "claude-resume.cmd" } else { "claude-resume" }); - let script = if cfg!(windows) { - "@echo off\r\necho %* | find \"--resume\" >nul && exit /b 1\r\necho ready\r\nping -n 60 127.0.0.1 >nul\r\n" - } else { - "#!/bin/sh\ncase \"$*\" in *--resume*) echo 'No conversation found'; exit 1 ;; esac\necho ready\nsleep 60\n" - }; - std::fs::write(&fake, script).unwrap(); - #[cfg(unix)] - std::fs::set_permissions(&fake, std::os::unix::fs::PermissionsExt::from_mode(0o755)).unwrap(); - let id = new_id(); - let record = SessionRecord { - id: id.clone(), - kind: SessionKind::Claude, - title: "New session".into(), - custom_title: None, - auto_title: None, - project_id: None, - cwd: h.work.clone(), - created_at: now(), - last_active: now(), - exit_code: None, - hidden: false, - claude: Some(ClaudeMeta { session_id: new_id(), ..Default::default() }), - }; - std::fs::write(datadir::data_dir().join("running.json"), serde_json::json!([id]).to_string()).unwrap(); - h.step(|ws| { - ws.claude_exe = Some(fake); - ws.store.data.sessions.push(record); - ws.restore_open(); - }); - h.wait("the session to start", |ws| ws.live_view(&id).is_some_and(|v| v.tail_text(200).contains("ready") || !v.is_running())); - let start = Instant::now(); - while start.elapsed() < Duration::from_secs(1) { - h.pump(); - std::thread::sleep(Duration::from_millis(50)); - } - assert!(h.ws().is_running(&id), "the session closed itself after the restart"); -} - -/// The worktree dialog and the switch of a session between worktrees. What Claude Code does in the new folder is not -/// checked: the stand-in only prints a line. -#[test] -fn switching_between_worktrees() { - let mut h = Harness::new(|work| { - git_repo(&work.join("proj")); - vec![work.join("proj")] - }); - let repo_dir = h.work.join("proj"); - let active = |ws: &Workspace| ws.store.session(ws.active.as_ref().unwrap()).unwrap().clone(); - - // A new session starts in the main checkout. - h.step(|ws| ws.act(Act::NewClaude { cwd: repo_dir.clone() })); - assert!(h.ws().modal.is_none() && h.ws().live.len() == 1); - let session = active(h.ws()); - assert_eq!(session.cwd, repo_dir); - // The conversation exists once Claude Code has had a prompt; the test stands one in, in Claude Code's own place. - let claude_id = session.claude_id().unwrap().to_string(); - let transcript = h.home.join("projects/p").join(format!("{claude_id}.jsonl")); - std::fs::create_dir_all(transcript.parent().unwrap()).unwrap(); - std::fs::write(&transcript, "{\"type\":\"user\"}\n").unwrap(); - h.wait("the first screen", idle); - - // A shell is open under the session at a height of the user's choosing. - let id = session.id.clone(); - h.step(|ws| { - ws.toggle_shell(&id); - ws.shells.get_mut(&id).unwrap().height = 333.0; - }); - h.settle(); - let grid = h.ws().live_view(&id).unwrap().terminal.size(); - assert_ne!(grid, (120, 32), "the window must not happen to match the default size"); - - // A bad name keeps the dialog open; a typed one moves the session into the worktree Claude Code will make. - h.step(|ws| ws.act(Act::NewWorktree(repo_dir.clone()))); - h.settle(); - assert!(h.drawn("modal-card"), "the dialog draws: {:?}", h.keys()); - h.step(|ws| { - modal_field(&mut ws.modal, 0).unwrap().replace_text("bad name"); - ws.submit_modal(); - }); - assert!(matches!(h.ws().modal, Some(Modal::NewWorktree { .. })), "a bad name is refused"); - h.step(|ws| { - modal_field(&mut ws.modal, 0).unwrap().replace_text("fix-login"); - ws.act(Act::PickBase(crate::git::worktree::Base::Current)); - ws.submit_modal(); - }); - let worktree = crate::git::worktree::folder(&repo_dir, "fix-login"); - let skeleton = |ws: &Workspace| ws.live_view(&id).and_then(|v| v.handover.as_ref().map(|h| h.message.clone())); - assert_eq!(skeleton(h.ws()).as_deref(), Some("Switching to fix-login…"), "the skeleton names the worktree"); - // Until the new process is up, the session stays shown and running behind its skeleton, never an empty pane, and - // the skeleton sits on the pane's grid from the first frame on. - let moved_to = |folder: &Path, ws: &Workspace| { - let loading = ws.live_view(&id).is_some_and(|v| v.is_loading()); - assert_eq!(ws.live_view(&id).map(|v| v.terminal.size()), Some(grid), "mid-switch the skeleton is on another grid"); - assert!(ws.active.as_ref() == Some(&id) && ws.is_running(&id), "mid-switch the session is not shown running"); - let moved = ws.store.session(&id).is_some_and(|r| r.cwd == folder); - assert!(loading || moved, "mid-switch the pane has no skeleton"); - moved && !loading - }; - h.wait("the switch", |ws| moved_to(&worktree, ws)); - let branch = git(&worktree, &["branch", "--show-current"]); - assert_eq!(String::from_utf8_lossy(&branch.stdout).trim(), "fix-login", "the branch is named as typed"); - assert_eq!(h.ws().live.len(), 1, "the same session, not a new one"); - assert_eq!(active(h.ws()).id, id); - assert_eq!(active(h.ws()).claude_id().map(str::to_string), Some(claude_id.clone()), "the same conversation"); - assert_eq!(std::fs::read_to_string(&transcript).unwrap().lines().count(), 1, "making a worktree writes nothing to the conversation"); - let shell = h.ws().shells.get(&id).map(|p| (p.open, p.height)); - assert_eq!(shell, Some((true, 333.0)), "the shell is open and as tall as before"); - - // The worktree is outside the repository, so git has nothing to list there and no .gitignore line is offered. - let status = git(&repo_dir, &["status", "--porcelain"]); - assert!(status.stdout.is_empty(), "the main checkout is unchanged: {}", String::from_utf8_lossy(&status.stdout)); - assert!(h.ws().toast.as_ref().is_none_or(|t| t.action.is_none()), "no toast offers anything"); - - // Back to the main checkout, as a session that `claude --worktree` put in the worktree: Claude Code's record of the - // worktree would win over the folder, so one line is appended. - std::fs::write(worktree.join("wip.txt"), "x").unwrap(); - std::fs::write(&transcript, "{\"type\":\"user\"}\n{\"type\":\"worktree-state\",\"worktreeSession\":{\"worktreeName\":\"fix-login\"},\"sessionId\":\"x\"}\n").unwrap(); - h.wait("the first screen again", idle); - h.step(|ws| ws.act(Act::SwitchWorktree { folder: repo_dir.clone(), base: Default::default() })); - // The work file stays in the worktree the session leaves, so it asks first. - h.wait("the question", |ws| matches!(&ws.modal, Some(Modal::Confirm { body, .. }) if body.contains("1 uncommitted file stays"))); - h.step(|ws| ws.act(Act::Dismiss)); - assert!(h.ws().modal.is_none() && skeleton(h.ws()).is_none() && active(h.ws()).cwd == worktree, "cancelling leaves the session where it was, with no skeleton"); - h.step(|ws| ws.act(Act::SwitchWorktree { folder: repo_dir.clone(), base: Default::default() })); - h.wait("the question again", |ws| matches!(&ws.modal, Some(Modal::Confirm { .. }))); - h.step(|ws| ws.submit_modal()); - assert_eq!(skeleton(h.ws()).as_deref(), Some("Switching to the main checkout…")); - h.wait("the switch back", |ws| moved_to(&repo_dir, ws)); - assert!(!crate::claude::worktree_recorded(&transcript).unwrap(), "the transcript no longer names the worktree"); - assert_eq!(std::fs::read_to_string(&transcript).unwrap().lines().count(), 3); - - // A restart (a switch, a hand-off) puts the new terminal on the pane's grid before its first frame. - h.step(|ws| { - ws.restart_session(&id); - assert_eq!(ws.live_view(&id).map(|v| v.terminal.size()), Some(grid), "the new terminal starts on another grid"); - }); - h.wait("the restart", |ws| ws.live_view(&id).is_some_and(|v| !v.is_loading())); - - // Mid-turn nothing changes: either the check ran before the screen was ready (told to wait) or after (switched); - // it never half-switches. - h.step(|ws| ws.act(Act::SwitchWorktree { folder: worktree.clone(), base: Default::default() })); - h.wait("a settled state", |ws| ws.is_running(&id) && ws.live_view(&id).is_some_and(|v| !v.is_loading())); - - // A project without commits has a disabled "New worktree…". - let bare = h.work.join("bare"); - git2::Repository::init(&bare).unwrap(); - let mut bare_project = String::new(); - h.step(|ws| bare_project = ws.store.add_project(&bare)); - h.step(|ws| ws.open_worktree_menu(bare_project.clone(), bare.clone(), MenuAnchor::Point(100.0, 30.0))); - let last = h.ws().menu.as_ref().and_then(|m| m.items.last().map(|i| (i.label.clone(), i.disabled, i.hint.clone()))); - assert!(matches!(&last, Some((label, true, Some(hint))) if label == "New worktree…" && hint.contains("no commits")), "{last:?}"); - h.settle(); - assert!(h.keys().iter().any(|k| k.starts_with("menu-")), "the menu draws: {:?}", h.keys()); -} - -/// A running session refuses the removal of its worktree. Ending it offers the removal, and confirming removes the -/// folder. Branches and the Settings page's worktrees are removed the same way. -#[test] -fn removing_a_worktree() { - let mut h = Harness::new(|work| { - git_repo(&work.join("proj")); - vec![work.join("proj")] - }); - let repo_dir = h.work.join("proj"); - let folder = crate::git::worktree::folder(&repo_dir, "fix"); - let added = git(&repo_dir, &["worktree", "add", "-q", "-b", "worktree-fix", &folder.to_string_lossy()]); - assert!(added.status.success(), "{}", String::from_utf8_lossy(&added.stderr)); - // The worktree is known to the project once git has been read again. - h.step(|ws| ws.store.refresh_git()); - // A new session never starts inside a worktree; Fix-with-Claude is the one starter that keeps the folder it is given. - h.step(|ws| ws.new_claude_with(folder.clone(), vec![], Starter::FixGit)); - let id = h.ws().active.clone().unwrap(); - // Any other way of starting a session, asked to start inside the worktree, starts in the main checkout. - h.step(|ws| ws.new_claude(folder.clone())); - let other = h.ws().active.clone().unwrap(); - assert_eq!(h.ws().store.session(&other).unwrap().cwd, repo_dir); - h.step(|ws| ws.close_live(&other)); - h.step(|ws| ws.act(Act::Select(id.clone()))); - - // The top-bar menu offers the removal for the session's own worktree, and not in the main checkout. - let project = h.ws().store.data.projects[0].id.clone(); - for cwd in [folder.clone(), repo_dir.clone()] { - h.step(|ws| ws.open_worktree_menu(project.clone(), cwd, MenuAnchor::Point(100.0, 30.0))); - let rows = h.menu_rows(); - assert_eq!(rows[0].0, "Worktrees"); - assert!(rows[1].0.contains("main checkout") && !rows[1].1, "the main checkout has no x: {rows:?}"); - assert!(rows[2].0.contains("fix") && rows[2].1, "the worktree has an x: {rows:?}"); - assert!(rows.last().is_some_and(|r| r.0 == "New worktree…" && !r.1), "{rows:?}"); - } - - // The x on the worktree a session is running in is refused, naming the session. - let x = h.ws().menu.as_ref().and_then(|m| m.items[2].remove.clone()).expect("an x on the worktree's row"); - h.step(|ws| ws.act(x)); - let toast = h.ws().toast.as_ref().map(|t| t.text.clone()); - assert!(toast.as_deref().is_some_and(|t| t.contains("is in fix. Switch it to main first.")), "{toast:?}"); - assert!(folder.exists() && h.ws().modal.is_none() && h.ws().live.len() == 1, "nothing changes"); - - // Ending the session by itself offers the removal. - h.step(|ws| ws.close_live(&id)); - h.wait("the offer", |ws| matches!(&ws.modal, Some(Modal::Confirm { act: Act::ConfirmRemoveWorktree { .. }, .. }))); - h.step(|ws| ws.submit_modal()); - // The toast comes after the branch is deleted too, which on Windows is later than the folder going. - h.wait("the removal's toast", |ws| ws.toast.as_ref().is_some_and(|t| t.text.contains("Removed worktree fix"))); - assert!(!folder.exists(), "the folder went"); - assert!(!git(&repo_dir, &["rev-parse", "--verify", "-q", "worktree-fix"]).status.success(), "the merged branch went with it"); - - // The branch menu has a title and an x on every local branch but the current one. - assert!(git(&repo_dir, &["branch", "spare"]).status.success()); - h.step(|ws| ws.open_branch_menu(repo_dir.clone(), MenuAnchor::Point(100.0, 30.0))); - h.wait("the branch menu", |ws| ws.menu.is_some()); - let rows: Vec<(String, Option)> = h.ws().menu.as_ref().map(|m| m.items.iter().map(|i| (i.label.trim().to_string(), i.remove.clone())).collect()).unwrap_or_default(); - assert_eq!(rows[0].0, "Branches"); - let spare = rows.iter().find(|r| r.0 == "spare").and_then(|r| r.1.clone()).expect("a local branch has an x"); - assert!(rows.iter().find(|r| r.0.starts_with('✓')).is_some_and(|r| r.1.is_none()), "the current branch has none"); - h.step(|ws| ws.act(spare)); - h.wait("the question", |ws| matches!(&ws.modal, Some(Modal::Confirm { confirm, .. }) if confirm == "Delete")); - h.step(|ws| ws.submit_modal()); - h.wait("the branch to go", |_| !git(&repo_dir, &["rev-parse", "--verify", "-q", "spare"]).status.success()); - - // Settings lists the worktrees in Claudiu's data folder. Removing one asks inside the page, so the dialog stays open. - let listed = crate::git::worktree::folder(&repo_dir, "listed"); - assert!(git(&repo_dir, &["worktree", "add", "-q", "-b", "listed", &listed.to_string_lossy()]).status.success()); - h.step(|ws| { - ws.act(Act::OpenSettings); - ws.set_settings_page(SettingsPage::Worktrees); - }); - let shown = |ws: &Workspace| ws.worktrees_page.stored.as_ref().is_some_and(|s| s.iter().any(|w| w.folder == listed)); - h.wait("the page to list it", shown); - h.settle(); - let main_checkout = repo_dir.clone(); - h.step(|ws| ws.act(Act::RemoveWorktree { main_checkout, folder: listed.clone() })); - h.wait("the question in the page", |ws| ws.worktrees_page.asking.as_ref().is_some_and(|a| a.folder == listed)); - assert!(matches!(h.ws().modal, Some(Modal::Settings { .. })), "the dialog stays open"); - let confirm = h.ws().worktrees_page.asking.as_ref().unwrap().act.clone(); - h.step(|ws| ws.act(confirm)); - h.wait("the folder to go", |_| !listed.exists()); - h.wait("the page to drop it", |ws| !shown(ws)); -} - -/// What the user types and pastes reaches the shown session's program, and a click on the terminal takes the -/// keyboard back from a text field. -#[test] -fn typing_and_pasting_reach_the_session() { - let mut h = Harness::new(|_| vec![]); - // A plain terminal session (no start-up skeleton) running `cat`, which echoes what it is sent. - let cwd = h.work.clone(); - let id = new_id(); - let record = SessionRecord { - id: id.clone(), - kind: SessionKind::Shell, - title: "cat".into(), - custom_title: None, - auto_title: None, - project_id: None, - cwd: cwd.clone(), - created_at: now(), - last_active: now(), - exit_code: None, - hidden: false, - claude: None, - }; - let program = if cfg!(windows) { "more.com" } else { "/bin/cat" }; - h.step(|ws| ws.start_session(record, SpawnSpec { program: program.into(), cwd: Some(cwd), ..Default::default() }, true)); - h.settle(); - let ws = h.ws(); - assert!( - ws.terminal_focused(&id), - "a new session has the keyboard (keys_to {:?}, search focused {}, modal open {})", - ws.keys_to, - ws.search.focused, - ws.modal.is_some() - ); - let shows = |h: &mut Harness, text: &str, what: &str| { - h.wait(what, |ws| ws.live_view(&id).is_some_and(|v| v.tail_text(500).contains(text))); - }; - - for c in "hello".chars() { - h.press(rune::Key::Text(c.to_string()), |_| {}); - } - h.press(rune::Key::Enter, |_| {}); - shows(&mut h, "hello", "the typed line to reach the program"); - - h.rt.paste("pasted-text"); - h.pump(); - h.press(rune::Key::Enter, |_| {}); - shows(&mut h, "pasted-text", "the pasted text to reach the program"); - - // Settings takes the keyboard; once it is closed, a click on the terminal gives it back. - h.click("settings"); - assert!(!h.ws().terminal_focused(&id)); - h.press(rune::Key::Escape, |_| {}); - h.click(&id); - assert!(h.ws().terminal_focused(&id), "the click gave the terminal the keyboard"); - for c in "again".chars() { - h.press(rune::Key::Text(c.to_string()), |_| {}); - } - h.press(rune::Key::Enter, |_| {}); - shows(&mut h, "again", "typing after the click to reach the program"); -} - -/// A working session's icon turns only while someone can see it: the window is in front and the sidebar shown. -/// Otherwise the window stops asking for frames. -#[test] -fn busy_icons_stop_asking_for_frames_when_nobody_can_see_them() { - let mut h = Harness::new(|_| vec![]); - let cwd = h.work.clone(); - h.step(|ws| ws.new_claude(cwd)); - let id = h.ws().active.clone().unwrap(); - h.wait("the first screen", idle); - let animating = |h: &mut Harness, active: bool, sidebar: bool| { - h.step(|ws| { - ws.activity.insert(id.clone(), Activity::Working); - ws.window_active = active; - ws.store.data.layout.sidebar_visible = sidebar; - }); - // Five seconds of frames: anything else that moved (a meter filling as usage arrives) has settled by then. - (0..300).all(|_| h.rt.frame(1.0 / 60.0)) - }; - assert!(animating(&mut h, true, true), "the icon turns in a window in front"); - assert!(!animating(&mut h, false, true), "a window in the background asks for no frames"); - assert!(!animating(&mut h, true, false), "nor does a hidden sidebar"); -} - -/// Quit (⌘Q, or closing the window) asks first while a Claude session is mid-turn, and quits at once otherwise. -#[test] -#[cfg(unix)] // The stand-in that keeps printing is a `sh` loop. -fn quitting_asks_first_only_while_a_session_is_working() { - let mut h = Harness::new(|_| vec![]); - let quit_now = |h: &mut Harness| { - h.step(|ws| ws.modal = None); - h.rt.update(|ws, tx| ws.quit_or_ask(tx)); - h.pump(); - h.ws().quitting - }; - // A session that streams output for as long as it runs, as Claude Code does mid-turn. - let cwd = h.work.clone(); - let script = "while :; do echo working; sleep 0.1; done"; - let spec = SpawnSpec { program: "/bin/sh".into(), args: vec!["-c".into(), script.into()], cwd: Some(cwd.clone()), ..Default::default() }; - let id = h.start_one("Busy", &cwd, spec); - h.wait("the session to be working", |ws| ws.live_view(&id).is_some_and(|v| v.is_working())); - assert!(!quit_now(&mut h), "a working session holds the quit"); - assert!(matches!(h.ws().modal, Some(Modal::Confirm { act: Act::ConfirmQuit, .. })), "and the user is asked"); - h.settle(); - assert!(h.drawn("modal-card"), "the question is drawn"); - h.step(|ws| ws.act(Act::Dismiss)); - assert!(!h.ws().quitting && h.ws().is_running(&id), "Cancel keeps everything running"); - - h.step(|ws| ws.close_live(&id)); - assert!(quit_now(&mut h), "with nothing working it quits at once"); - assert!(h.ws().modal.is_none()); -} - -/// Ctrl+Z (Cmd+Z on macOS) resumes the sessions closed since Claudiu started, the last closed first. The editor keeps -/// the key for undo, and off macOS a shell keeps it to suspend its job. -#[test] -fn the_undo_key_reopens_closed_sessions_the_last_closed_first() { - let mut h = Harness::new(|_| vec![]); - let cwd = h.work.join("project"); - std::fs::create_dir_all(&cwd).unwrap(); - std::fs::write(cwd.join("code.rs"), "fn a() {}\n").unwrap(); - let exe = h.ws().claude_exe.clone().unwrap(); - let first = h.start_one("First", &cwd, claude::resume_spec(&exe, &cwd, "first")); - let second = h.start_one("Second", &cwd, claude::resume_spec(&exe, &cwd, "second")); - let third = h.start_one("Third", &cwd, claude::resume_spec(&exe, &cwd, "third")); - h.wait("the sessions starting", |ws| [&first, &second, &third].iter().all(|id| ws.is_running(id))); - h.step(|ws| ws.close_live(&first)); - h.step(|ws| ws.close_live(&second)); - let undo = |h: &mut Harness| h.press(rune::Key::Command('z'), secondary); - - // The shell under the shown session has the keyboard. - h.step(|ws| ws.show_session(&third)); - h.step(|ws| ws.toggle_shell_here()); - assert_eq!(h.ws().keys_to, Some(shell_key(&third))); - undo(&mut h); - assert_eq!(h.ws().is_running(&second), cfg!(target_os = "macos"), "off macOS the shell keeps Ctrl+Z"); - if h.ws().is_running(&second) { - h.step(|ws| ws.close_live(&second)); - } - - // The editor has the keyboard. - h.step(|ws| ws.show_session(&third)); - h.step(|ws| ws.toggle_editor()); - h.wait("listing", |ws| !ws.panes[&third].root.as_os_str().is_empty()); - let root = h.editor_pane(&third).root.clone(); - h.step(|ws| ws.open_file(&third, root.join("code.rs"), None)); - h.wait("opening", |ws| ws.panes[&third].shown().is_some()); - h.step(|ws| ws.focus_pane()); - assert!(h.ws().keys_in_pane()); - undo(&mut h); - assert!(!h.ws().is_running(&second), "the editor keeps the key for undo"); - h.step(|ws| ws.toggle_editor()); - - // Claude has the keyboard. - h.step(|ws| ws.show_session(&third)); - assert_eq!(h.ws().keys_to.as_deref(), Some(third.as_str())); - undo(&mut h); - h.wait("the second to come back", |ws| ws.is_running(&second)); - assert!(!h.ws().is_running(&first), "one press brings back one session"); - undo(&mut h); - h.wait("the first to come back", |ws| ws.is_running(&first)); - undo(&mut h); - assert_eq!(h.ws().running_count(), 3, "with nothing left to reopen the key does nothing"); -} - -/// Hundreds of recent sessions: the RECENT list at the bottom opens to part of the window, scrolls under the wheel and -/// keeps drawing rows where it brings them; its header closes it. -#[test] -fn the_recent_list_stays_short_and_draws_rows_where_scrolling_brings_them() { - let mut h = Harness::new(|_| vec![]); - h.step(|ws| { - for i in 0..300 { - ws.store.data.sessions.push(SessionRecord { - id: format!("s{i:03}"), - kind: SessionKind::Claude, - title: format!("Session {i}"), - custom_title: None, - auto_title: None, - cwd: PathBuf::from("/nowhere"), - project_id: None, - created_at: 0, - // Newer than anything else, so these come first, s000 at the top. - last_active: 4_000_000_000 - i, - exit_code: None, - hidden: false, - claude: None, - }); - } - }); - h.settle(); - assert!(h.rt.find("recent-scroll").is_none(), "the RECENT list starts closed"); - assert_eq!(h.rt.presented_pose("recent-caret").unwrap().rotation(), 0.0); - h.click("recent-header"); - h.settle(); - let turn = h.rt.presented_pose("recent-caret").unwrap().rotation(); - assert!((turn - std::f32::consts::FRAC_PI_2).abs() < 1e-3, "the caret turns a quarter, not {turn} radians"); - let (list, _) = h.rt.presented("recent-scroll").expect("the header opens the list"); - assert!(list[3] <= 900.0 * 0.4 + 1.0, "the open list is {}pt tall, more than its share of the window", list[3]); - let (footer, _) = h.rt.presented("account-switcher").unwrap(); - assert!((0.0..20.0).contains(&(footer[1] - (list[1] + list[3]))), "the list sits at the bottom, above the account: {list:?}, account at {footer:?}"); - let row_y = |h: &Harness, n: usize| h.keys().into_iter().find(|k| k.starts_with("row-") && k.ends_with(&format!("s{n:03}"))).and_then(|k| h.rt.find(&k)).map(|p| p.1); - let top = row_y(&h, 0).expect("the first row draws"); - let (x, y) = h.rt.find("recent-scroll").expect("the list draws"); - h.rt.pointer_move(x, y); - h.rt.wheel(x, y, -1200.0); - h.settle(); - let moved = row_y(&h, 0); - assert!(moved.is_none_or(|m| m < top - 600.0), "the list did not scroll: the first row went from {top} to {moved:?}"); - let shown = (1..300).filter(|n| row_y(&h, *n).is_some_and(|y| (0.0..900.0).contains(&y))).count(); - assert!(shown > 10, "only {shown} rows are drawn where the list scrolled to"); - h.click("recent-header"); - h.settle(); - assert!(h.rt.find("recent-scroll").is_none() && !h.ws().store.data.layout.recent_open, "the header closes the list"); - h.click("recent-header"); - h.settle(); - assert!(h.rt.find("recent-scroll").is_some(), "the header opens the list again"); - h.step(|ws| ws.act(Act::Select("s000".into()))); - h.settle(); - assert!(h.rt.find("recent-scroll").is_none(), "opening a session from the list closes it"); -} - -/// Cmd on macOS, Ctrl elsewhere: the modifier of the app's shortcuts. -fn secondary(m: &mut rune::Mods) { - m.cmd = true; - if cfg!(target_os = "macos") { m.logo = true } else { m.ctrl = true } -} - -impl Harness { - fn editor_pane(&self, id: &str) -> &EditorPane { - self.ws().panes.get(id).expect("the session has an editor pane") - } - - fn shown_tab(&self, id: &str) -> Option<&editor_mode::Tab> { - self.ws().panes.get(id).and_then(|p| p.shown()) - } - - fn shown_text(&self, id: &str) -> String { - self.shown_tab(id).map(|t| t.editor.buffer.text()).unwrap_or_default() - } - - fn type_text(&mut self, text: &str) { - for c in text.chars() { - self.press(rune::Key::Text(c.to_string()), |_| {}); - } - } -} - -/// Editor mode: the shown session keeps its terminal; its folder's files are listed beside it and open in tabs; edits -/// save; a change on disk reloads a clean tab and never overwrites unsaved edits; and nothing unsaved is dropped -/// without asking. -#[test] -fn editor_mode_lists_opens_edits_and_saves_files() { - let mut h = Harness::new(|_| vec![]); - let cwd = h.work.join("project"); - std::fs::create_dir_all(cwd.join("src")).unwrap(); - std::fs::write(cwd.join("notes.md"), "# Notes\n").unwrap(); - std::fs::write(cwd.join("src/code.rs"), "fn a() {}\nfn b() {}\n").unwrap(); - h.step(|ws| ws.new_claude(cwd.clone())); - let id = h.ws().active.clone().expect("a session is shown"); - h.wait("the first screen", idle); - let sidebars = (h.ws().store.data.layout.sidebar_visible, h.ws().store.data.layout.right_hidden); - - h.press(rune::Key::Command('e'), |m| { - secondary(m); - m.shift = true; - }); - assert!(h.ws().editing(), "Shift+E turns editor mode on"); - h.wait("listing the folder", |ws| ws.panes.get(&id).is_some_and(|p| p.rows.iter().any(|r| r.name == "notes.md"))); - h.settle(); - assert!(h.drawn("editor-pane") && h.drawn("file-tree"), "the pane is drawn: {:?}", h.keys()); - assert!(h.ws().is_running(&id) && h.drawn(&format!("pane-{id}")), "the terminal keeps running beside it"); - let names: Vec = h.editor_pane(&id).rows.iter().map(|r| r.name.clone()).collect(); - assert_eq!(names, ["src", "notes.md"], "folders first, closed until opened"); - - // Folders open in place; a file opens in a tab with the keyboard. - let root = h.editor_pane(&id).root.clone(); - h.click(&format!("tree-{}", platform::path_key(&root.join("src")))); - let names: Vec = h.editor_pane(&id).rows.iter().map(|r| r.name.clone()).collect(); - assert_eq!(names, ["src", "code.rs", "notes.md"]); - h.settle(); - h.click(&format!("tree-{}", platform::path_key(&root.join("notes.md")))); - h.wait("opening a file", |ws| ws.panes[&id].shown().is_some()); - h.settle(); - assert_eq!(h.shown_text(&id), "# Notes\n"); - let key = h.shown_tab(&id).unwrap().editor.key.clone(); - assert_eq!(h.ws().keys_to.as_deref(), Some(key.as_str()), "the opened file has the keyboard"); - assert!(h.drawn(&format!("{key}/l0")), "its first line is drawn"); - - // Typing edits it and marks the tab; the pane's Save writes it. - h.press(rune::Key::End, |_| {}); - h.type_text(" and more"); - assert_eq!(h.shown_text(&id), "# Notes and more\n"); - assert!(h.shown_tab(&id).unwrap().dirty, "an edit marks the tab"); - h.press(rune::Key::Command('s'), secondary); - h.wait("saving", |ws| ws.panes[&id].shown().is_some_and(|t| !t.dirty)); - assert_eq!(std::fs::read_to_string(cwd.join("notes.md")).unwrap(), "# Notes and more\n"); - // Undo back to what was loaded is a change from what is saved now. - h.press(rune::Key::Command('z'), secondary); - assert_eq!(h.shown_text(&id), "# Notes\n"); - assert!(h.shown_tab(&id).unwrap().dirty); - // Redo is Cmd+Shift+Z on macOS and Ctrl+Y elsewhere (editor/keys.rs). - if cfg!(target_os = "macos") { - h.press(rune::Key::Command('z'), |m| { - secondary(m); - m.shift = true; - }); - } else { - h.press(rune::Key::Command('y'), secondary); - } - assert!(!h.shown_tab(&id).unwrap().dirty, "redo back to the saved text is clean again"); - - // A change on disk reloads a clean tab; with unsaved edits it becomes a conflict that overwrites neither side. - let code = root.join("src/code.rs"); - h.step(|ws| ws.open_file(&id, code.clone(), Some(1))); - h.wait("opening the second file", |ws| ws.panes[&id].shown().is_some_and(|t| t.path == code)); - assert_eq!(h.shown_tab(&id).unwrap().editor.caret().line, 1, "it opens at the line asked for"); - std::fs::write(&code, "fn by_claude() {}\n// longer than before\n").unwrap(); - h.wait("reloading a clean tab", |ws| ws.panes[&id].shown().is_some_and(|t| t.editor.buffer.text().starts_with("fn by_claude"))); - h.type_text("x"); - std::fs::write(&code, "fn by_claude_again() {}\n").unwrap(); - h.wait("the conflict", |ws| ws.panes[&id].shown().is_some_and(|t| t.conflict == Some(Conflict::Changed))); - h.settle(); - assert!(h.drawn("conflict") && h.drawn("conflict-keep"), "the conflict is shown with its choices"); - assert!(h.shown_text(&id).contains('x'), "unsaved edits stay"); - h.press(rune::Key::Command('s'), secondary); - h.wait("the refused save", |ws| ws.toast.as_ref().is_some_and(|t| t.text.starts_with("Not saved"))); - assert_eq!(std::fs::read_to_string(&code).unwrap(), "fn by_claude_again() {}\n", "Claude's change is not overwritten"); - h.click("conflict-keep"); - h.press(rune::Key::Command('s'), secondary); - h.wait("saving over the change", |ws| ws.panes[&id].shown().is_some_and(|t| !t.dirty && t.stamp.is_some())); - let mine = h.shown_text(&id); - assert_eq!(std::fs::read_to_string(&code).unwrap(), mine, "keeping mine and saving writes mine"); - - // Each file has one tab; unsaved edits are never dropped without asking. - let tabs = |h: &Harness| h.editor_pane(&id).tabs.iter().map(|t| t.path.file_name().unwrap().to_string_lossy().to_string()).collect::>(); - assert_eq!(tabs(&h), ["notes.md", "code.rs"]); - h.step(|ws| ws.open_file(&id, root.join("notes.md"), None)); - assert_eq!((tabs(&h).len(), h.editor_pane(&id).active), (2, Some(0)), "opening an open file shows its tab"); - h.type_text("!"); - h.press(rune::Key::Command('w'), secondary); - assert!(matches!(h.ws().modal, Some(Modal::Confirm { act: Act::DiscardTab(..), .. })) && tabs(&h).len() == 2, "closing a dirty tab asks"); - h.step(|ws| ws.act(Act::Dismiss)); - assert_eq!(h.ws().keys_to.as_deref(), Some(h.shown_tab(&id).unwrap().editor.key.as_str()), "cancelling gives the editor the keyboard back"); - h.step(|ws| ws.act(Act::CloseLive(id.clone()))); - assert!(matches!(h.ws().modal, Some(Modal::Confirm { act: Act::ConfirmCloseLive(_), .. })) && h.ws().is_running(&id), "ending the session asks"); - h.step(|ws| ws.act(Act::Dismiss)); - h.press(rune::Key::Command('w'), secondary); - h.step(|ws| ws.submit_modal()); - assert_eq!(tabs(&h), ["code.rs"], "discarding closes the tab"); - assert_eq!(std::fs::read_to_string(cwd.join("notes.md")).unwrap(), "# Notes and more\n", "nothing was saved by asking"); - - // Back returns to the place the editor left. - h.step(|ws| ws.open_file(&id, root.join("notes.md"), None)); - h.wait("reopening", |ws| ws.panes[&id].tabs.len() == 2); - let back = if cfg!(target_os = "macos") { (rune::Key::Text("-".into()), true) } else { (rune::Key::Left, false) }; - h.press(back.0, |m| if back.1 { m.ctrl = true } else { m.alt = true }); - assert!(h.shown_tab(&id).is_some_and(|t| t.path == code), "Back shows the file before"); - - // Leaving editor mode brings the sidebars back as they were; asking for a sidebar in it leaves it. - h.step(|ws| ws.toggle_editor()); - assert_eq!((h.ws().editing(), (h.ws().store.data.layout.sidebar_visible, h.ws().store.data.layout.right_hidden)), (false, sidebars)); - h.step(|ws| { - ws.store.data.layout.sidebar_visible = false; - ws.toggle_editor(); - ws.toggle_left(); - }); - assert!(!h.ws().editing() && h.ws().store.data.layout.sidebar_visible, "the sidebar shows"); - - // Ctrl+click on a path in the terminal opens it in editor mode, at its line. - h.step(|ws| { - ws.open_in_editor_mode(&id, "src/code.rs", Some(1)); - }); - h.wait("the clicked file", |ws| ws.editing() && ws.panes[&id].shown().is_some_and(|t| t.path == code)); - - // The pane goes with its session. - h.step(|ws| ws.close_live(&id)); - assert!(!h.ws().panes.contains_key(&id), "closing the session drops its pane"); -} - -/// Quick open finds a file by its letters and opens it; find in files finds a line and opens the file there. -#[test] -fn quick_open_and_find_in_files_open_what_they_find() { - let mut h = Harness::new(|_| vec![]); - let cwd = h.work.join("project"); - std::fs::create_dir_all(cwd.join("src")).unwrap(); - std::fs::write(cwd.join("notes.md"), "# Notes\n").unwrap(); - std::fs::write(cwd.join("src/code.rs"), "fn a() {}\nfn needle() {}\n").unwrap(); - h.step(|ws| ws.new_claude(cwd.clone())); - let id = h.ws().active.clone().unwrap(); - h.step(|ws| ws.toggle_editor()); - h.wait("listing the folder", |ws| ws.panes[&id].files.len() == 2); - let picker = |h: &Harness| h.editor_pane(&id).picker.as_ref().map(|p| (p.kind, p.hits.iter().map(|hit| (hit.text.clone(), hit.line)).collect::>())); - - h.press(rune::Key::Command('p'), secondary); - h.settle(); - assert!(h.drawn("picker") && h.drawn("picker-field"), "quick open is drawn: {:?}", h.keys()); - h.type_text("notmd"); - h.pump(); - assert_eq!(picker(&h), Some((picker::PickerKind::Files, vec![("notes.md".to_string(), 0)]))); - h.press(rune::Key::Enter, |_| {}); - h.wait("opening the picked file", |ws| ws.panes[&id].shown().is_some_and(|t| t.path.ends_with("notes.md"))); - assert!(picker(&h).is_none(), "choosing closes the picker"); - - // From the tree: over the editor, the editor's own search keys come first, as in main. - h.step(|ws| ws.focus_terminal(&editor_mode::tree_key(&id))); - h.press(rune::Key::Command('f'), |m| { - secondary(m); - m.shift = true; - }); - assert_eq!(picker(&h).map(|p| p.0), Some(picker::PickerKind::Text), "the search shortcut finds in files in editor mode"); - h.type_text("NEEDLE"); - h.wait("find in files", |ws| ws.panes[&id].picker.as_ref().is_some_and(|p| !p.hits.is_empty())); - assert_eq!(picker(&h).unwrap().1, [("fn needle() {}".to_string(), 1)]); - h.settle(); - assert!(h.drawn("picked-0")); - h.press(rune::Key::Enter, |_| {}); - h.wait("opening the found file", |ws| ws.panes[&id].shown().is_some_and(|t| t.path.ends_with("code.rs"))); - assert_eq!(h.shown_tab(&id).unwrap().editor.caret().line, 1, "the caret is on the found line"); - h.wait("colouring the Rust file", |ws| ws.panes[&id].shown().is_some_and(|t| t.editor.spans.len() == 3 && !t.editor.spans[1].is_empty())); - // Typing a new line moves the colours below it down with their lines until they are worked out again. - h.press(rune::Key::Home, |_| {}); - h.press(rune::Key::Enter, |_| {}); - let e = &h.shown_tab(&id).unwrap().editor; - assert!(e.spans.len() == 4 && !e.spans[2].is_empty(), "the colours follow their line: {:?}", e.spans); - - // Escape closes it and gives the editor back the keyboard. - h.press(rune::Key::Command('p'), secondary); - h.press(rune::Key::Escape, |_| {}); - assert!(picker(&h).is_none()); - assert_eq!(h.ws().keys_to.as_deref(), Some(h.shown_tab(&id).unwrap().editor.key.as_str())); -} - -/// A file at the editor's line limit opens and types without stalling, draws only the lines on screen, and a wheel -/// notch eases the text down and stops at the end. -#[test] -fn a_long_file_opens_draws_only_what_shows_and_scrolls() { - let mut h = Harness::new(|_| vec![]); - let cwd = h.work.clone(); - let big = cwd.join("big.rs"); - std::fs::write(&big, "let x = 1; // a line of ordinary code\n".repeat(crate::files::MAX_LINES)).unwrap(); - h.step(|ws| ws.new_claude(cwd.clone())); - let id = h.ws().active.clone().unwrap(); - h.step(|ws| ws.toggle_editor()); - let t = Instant::now(); - h.step(|ws| ws.open_file(&id, big.clone(), None)); - h.wait("opening the long file", |ws| ws.panes[&id].shown().is_some()); - h.settle(); - eprintln!("a {}-line file opened and drew in {:?}", crate::files::MAX_LINES, t.elapsed()); - let key = h.shown_tab(&id).unwrap().editor.key.clone(); - let drawn_lines = || h.keys().iter().filter(|k| k.starts_with(&format!("{key}/l"))).count(); - let lines = drawn_lines(); - assert!((10..120).contains(&lines), "{lines} lines are built for one screen"); - - let t = Instant::now(); - for _ in 0..20 { - h.press(rune::Key::Text("y".into()), |_| {}); - } - let per_key = t.elapsed() / 20; - assert!(per_key < Duration::from_millis(100), "a keystroke in a long file took {per_key:?}"); - let t = Instant::now(); - for _ in 0..20 { - h.press(rune::Key::Down, |m| m.alt = true); - } - let per_move = t.elapsed() / 20; - assert!(per_move < Duration::from_millis(100), "moving a line in a long file took {per_move:?}"); - assert_eq!(h.shown_tab(&id).unwrap().editor.caret().line, 20, "the line moved down twenty times"); - - let (x, y) = h.rt.find(&key).expect("the editor is drawn"); - h.rt.pointer_move(x, y); - let scroll = |h: &Harness| h.shown_tab(&id).unwrap().editor.scroll[1]; - // Mouse wheel notches (not a trackpad's precise steps), down. - h.rt.wheel_event(rune::WheelEvent::new(0.0, -120.0).at(x, y)); - let mut seen = vec![]; - for _ in 0..40 { - std::thread::sleep(Duration::from_millis(8)); - h.pump(); - seen.push(scroll(&h)); - } - assert!(seen.windows(2).all(|w| w[1] >= w[0]), "the scroll only moves down: {seen:?}"); - assert!(seen[0] < *seen.last().unwrap() && *seen.last().unwrap() > 100.0, "the text eased down: {seen:?}"); - h.press(rune::Key::End, |m| if cfg!(target_os = "macos") { m.logo = true } else { m.ctrl = true }); - h.settle(); - assert_eq!(h.shown_tab(&id).unwrap().editor.caret().line, crate::files::MAX_LINES, "the caret went to the end"); - assert!(h.drawn(&format!("{key}/l{}", crate::files::MAX_LINES - 1)), "the end is on screen"); -} - -/// A stand-in language server on the other end of two pipes, for the file `main.rs` in `root`: it reports a problem -/// when the file opens, describes `alpha`, says `alpha` is defined on the first line, offers `alpha` as a completion, -/// and keeps the notifications it hears (method and text) in `heard`. -fn fake_language_server(root: &Path, heard: std::sync::Arc>>) -> (crate::lsp::Server, futures::channel::mpsc::UnboundedReceiver) { - use crate::lsp::rpc; - use serde_json::{Value, json}; - let (server_in, client_out) = std::io::pipe().unwrap(); - let (client_in, mut server_out) = std::io::pipe().unwrap(); - let uri = crate::lsp::uri(&root.join("main.rs")).unwrap().as_str().to_string(); - let range = |line: u32, from: u32, to: u32| json!({"start": {"line": line, "character": from}, "end": {"line": line, "character": to}}); - std::thread::spawn(move || { - let mut input = std::io::BufReader::new(server_in); - while let Ok(Some(m)) = rpc::read_message(&mut input) { - let method = m["method"].as_str().unwrap_or_default().to_string(); - let result = match method.as_str() { - "initialize" => json!({"capabilities": {}}), - "textDocument/hover" => json!({"contents": {"kind": "markdown", "value": "```rust\nfn alpha()\n```"}}), - "textDocument/definition" => json!({"uri": uri, "range": range(0, 3, 8)}), - "textDocument/completion" => json!([{"label": "alpha", "textEdit": {"range": range(1, 21, 23), "newText": "alpha"}}, {"label": "other"}]), - "shutdown" | "exit" => { - heard.lock().unwrap().push((method.clone(), String::new())); - if method == "exit" { - return; - } - Value::Null - } - _ => { - let text = m["params"]["contentChanges"][0]["text"].as_str().or(m["params"]["textDocument"]["text"].as_str()).unwrap_or_default(); - heard.lock().unwrap().push((method.clone(), text.to_string())); - if method == "textDocument/didOpen" { - let d = json!({"uri": uri, "diagnostics": [{"range": range(1, 21, 23), "message": "cannot find `al`", "severity": 1}]}); - rpc::write_message(&mut server_out, &json!({"jsonrpc": "2.0", "method": "textDocument/publishDiagnostics", "params": d})).unwrap(); - } - continue; - } - }; - rpc::write_message(&mut server_out, &json!({"jsonrpc": "2.0", "id": m["id"], "result": result})).unwrap(); - } - }); - let (events, incoming) = futures::channel::mpsc::unbounded(); - let server = crate::lsp::Server::connect(client_in, client_out, None::, root, false, events).unwrap(); - (server, incoming) -} - -/// A file's language server underlines its problems, describes what the pointer rests on, completes the word at the -/// caret, finds definitions, and hears every edit, save and close. -#[test] -fn a_language_server_checks_describes_completes_and_finds() { - use crate::editor::buffer::{Pos, Selection}; - let mut h = Harness::new(|_| vec![]); - let cwd = h.work.clone(); - let main = cwd.join("main.rs"); - std::fs::write(&main, "fn alpha() {}\nfn main() { alpha(); al }\n").unwrap(); - h.step(|ws| ws.new_claude(cwd.clone())); - let id = h.ws().active.clone().unwrap(); - h.step(|ws| ws.toggle_editor()); - let heard = std::sync::Arc::new(Mutex::new(vec![])); - let (server, incoming) = fake_language_server(&cwd, heard.clone()); - h.step(|ws| { - language_servers::forward_events(ws.rt.mailbox(), id.clone(), "rust-analyzer", incoming); - ws.on_server_started(&id, crate::lsp::kind_for("rust").unwrap(), Ok(server)); - }); - h.step(|ws| ws.open_file(&id, main.clone(), None)); - h.wait("the server's problem", |ws| ws.panes[&id].shown().is_some_and(|t| !t.editor.problems.is_empty())); - let problem = &h.shown_tab(&id).unwrap().editor.problems[0]; - assert_eq!((problem.from, problem.to, problem.error), (Pos::new(1, 21), Pos::new(1, 23), true), "the problem underlines `al`"); - let opened: Vec = heard.lock().unwrap().iter().filter(|(m, _)| m == "textDocument/didOpen").map(|(_, t)| t.clone()).collect(); - assert_eq!(opened, ["fn alpha() {}\nfn main() { alpha(); al }\n"], "the server got the file's text once"); - h.settle(); - assert_eq!(h.ws().server_status(&id).as_deref(), Some("rust-analyzer")); - assert!(h.drawn("server-status")); - - // Resting the pointer on `alpha` shows what the server says about it. - let key = h.shown_tab(&id).unwrap().editor.key.clone(); - let (editor, _) = h.rt.presented(&key).expect("the editor is drawn"); - let (line, _) = h.rt.presented(&format!("{key}/l1")).expect("the second line is drawn"); - let y = line[1] + line[3] / 2.0; - let e = &h.shown_tab(&id).unwrap().editor; - let x = (0..2000).map(|x| x as f32).find(|&x| e.pos_at(x, y - editor[1]) == Pos::new(1, 13)).expect("a point over `alpha`"); - h.rt.pointer_move(editor[0] + x, y); - h.pump(); - h.wait("the hover card", |ws| ws.panes[&id].shown().and_then(|t| t.editor.hover.as_ref()).is_some_and(|c| c.docs.is_some())); - let card = h.shown_tab(&id).unwrap().editor.hover.clone().unwrap(); - assert_eq!((card.at, card.docs.as_deref()), (Pos::new(1, 12), Some("```rust\nfn alpha()\n```"))); - - // F12 on the call goes to where `alpha` is defined. - h.step(|ws| ws.panes.get_mut(&id).unwrap().shown_mut().unwrap().editor.select(Selection::caret(Pos::new(1, 14)))); - h.press(rune::Key::Function(12), |_| {}); - h.wait("going to the definition", |ws| ws.panes[&id].shown().is_some_and(|t| t.editor.caret() == Pos::new(0, 3))); - - // Ctrl+Space after `al` lists what the server offers; Enter writes the choice over the word. - h.step(|ws| ws.panes.get_mut(&id).unwrap().shown_mut().unwrap().editor.select(Selection::caret(Pos::new(1, 23)))); - h.press(rune::Key::Text(" ".into()), |m| m.ctrl = true); - h.wait("the completion list", |ws| ws.panes[&id].shown().is_some_and(|t| t.editor.completion.is_some())); - h.settle(); - h.press(rune::Key::Enter, |_| {}); - let edited = "fn alpha() {}\nfn main() { alpha(); alpha }\n"; - assert_eq!(h.shown_text(&id), edited, "the completion replaced `al`"); - - // The server hears the edit once typing pauses, then the save and the close. - let heard_of = |method: &'static str, text: &'static str| { - let heard = heard.clone(); - move |_: &Workspace| heard.lock().unwrap().iter().any(|(m, t)| m == method && t == text) - }; - h.wait("the server hearing the edit", heard_of("textDocument/didChange", edited)); - h.press(rune::Key::Command('s'), secondary); - h.wait("the server hearing the save", heard_of("textDocument/didSave", "")); - h.step(|ws| ws.close_tab(&id, 0)); - h.wait("the server hearing the close", heard_of("textDocument/didClose", "")); - - // Ending the session ends its server. - h.step(|ws| ws.close_live(&id)); - h.wait("the server told to exit", heard_of("exit", "")); -} - -/// Right-clicking the editor opens its menu; asking Claude about the selected lines sends `@path#L..` and the request -/// to the session's mod (never typed into its terminal) and hands the keyboard to Claude. -#[test] -fn the_editor_menu_asks_claude_about_the_selected_lines() { - use crate::editor::buffer::{Pos, Selection}; - let mut h = Harness::new(|_| vec![]); - let cwd = h.work.join("project"); - std::fs::create_dir_all(cwd.join("src")).unwrap(); - std::fs::write(cwd.join("src/code.rs"), "fn a() {}\nfn b() {}\nfn c() {}\n").unwrap(); - h.step(|ws| ws.new_claude(cwd.clone())); - let id = h.ws().active.clone().unwrap(); - h.wait("the session starting", |ws| ws.is_running(&ws.active.clone().unwrap())); - h.step(|ws| ws.toggle_editor()); - h.wait("listing", |ws| !ws.panes[&id].root.as_os_str().is_empty()); - let root = h.editor_pane(&id).root.clone(); - h.step(|ws| ws.open_file(&id, root.join("src/code.rs"), None)); - h.wait("opening", |ws| ws.panes[&id].shown().is_some()); - h.settle(); - h.step(|ws| ws.panes.get_mut(&id).unwrap().shown_mut().unwrap().editor.select(Selection { anchor: Pos::new(1, 0), head: Pos::new(3, 0) })); - - // A right click inside the selection keeps it. - let key = h.shown_tab(&id).unwrap().editor.key.clone(); - let (x, y) = h.rt.find(&format!("{key}/l1")).expect("line 2 is drawn"); - h.rt.secondary_down(x, y); - h.rt.secondary_up(x, y); - h.settle(); - let rows: Vec = h.menu_rows().into_iter().map(|(label, _)| label).collect(); - assert_eq!(rows[0], "Go to Definition"); - let ask = rows.iter().position(|r| r == "Ask Claude to explain this").expect("the menu asks Claude"); - assert_eq!(h.shown_tab(&id).unwrap().editor.sel, Selection { anchor: Pos::new(1, 0), head: Pos::new(3, 0) }, "the selection stays"); - - let serial = h.ws().menu.as_ref().unwrap().serial; - h.click(&format!("menu-{serial}-{ask}")); - let sent = std::fs::read_to_string(crate::claude::usage::ctl_file(&id)).expect("a request went to the session's mod"); - assert!(sent.contains("@src/code.rs#L2-3: Explain this code."), "{sent}"); - assert_eq!(h.ws().keys_to.as_deref(), Some(id.as_str()), "Claude has the keyboard"); - - // Outside the selection, the click moves the caret there first. - h.step(|ws| ws.focus_pane()); - let (x, y) = h.rt.find(&format!("{key}/l0")).expect("line 1 is drawn"); - h.rt.secondary_down(x, y); - h.rt.secondary_up(x, y); - h.pump(); - let e = &h.shown_tab(&id).unwrap().editor; - assert!(e.sel.is_empty() && e.caret().line == 0, "the caret went to the clicked line"); -} - -/// Moving the keyboard from the editor to Claude while lines are selected puts `@path#L..: ` into Claude's input box, -/// and moving it away again without typing erases it. A stand-in for `claude` draws an input box, asks for bracketed -/// paste, and records what reaches it. -#[cfg(unix)] -#[test] -fn selected_lines_are_named_in_claudes_input_until_the_keyboard_leaves() { - use crate::editor::buffer::{Pos, Selection}; - let mut h = Harness::new(|_| vec![]); - let cwd = h.work.join("project"); - std::fs::create_dir_all(&cwd).unwrap(); - std::fs::write(cwd.join("code.rs"), "fn a() {}\nfn b() {}\nfn c() {}\n").unwrap(); - let heard = h.work.join("heard"); - let prompt = h.work.join("prompt-claude"); - let rule = "─".repeat(30); - // Bracketed paste on, a rule, the `❯` line, a rule, then the cursor back after `❯ `; raw, so bytes arrive as sent. - let script = format!("#!/bin/sh\nstty raw -echo\nprintf '\\033[?2004h\\033[2J\\033[H{rule}\\r\\n❯ \\r\\n{rule}\\r\\n\\033[2;3H'\nexec cat > '{}'\n", heard.display()); - std::fs::write(&prompt, script).unwrap(); - std::fs::set_permissions(&prompt, std::os::unix::fs::PermissionsExt::from_mode(0o755)).unwrap(); - h.step(|ws| ws.claude_exe = Some(prompt.clone())); - h.step(|ws| ws.new_claude(cwd.clone())); - let id = h.ws().active.clone().unwrap(); - h.wait("the input box", |ws| ws.live_view(&id).is_some_and(|v| !v.is_loading() && v.input_holds(""))); - h.step(|ws| ws.toggle_editor()); - h.wait("listing", |ws| !ws.panes[&id].root.as_os_str().is_empty()); - let root = h.editor_pane(&id).root.clone(); - h.step(|ws| ws.open_file(&id, root.join("code.rs"), None)); - h.wait("opening", |ws| ws.panes[&id].shown().is_some()); - h.step(|ws| ws.panes.get_mut(&id).unwrap().shown_mut().unwrap().editor.select(Selection { anchor: Pos::new(1, 0), head: Pos::new(3, 0) })); - - let read = || std::fs::read(&heard).unwrap_or_default(); - h.step(|ws| ws.focus_terminal(&id)); - h.wait("the reference reaching Claude", |_| String::from_utf8_lossy(&read()).contains("@code.rs#L2-3: ")); - assert_eq!(read(), b"\x1b[200~@code.rs#L2-3: \x1b[201~", "pasted, so nothing it holds is taken as a key"); - - h.step(|ws| ws.focus_pane()); - let reference = "@code.rs#L2-3: ".chars().count(); - h.wait("the reference erased", |_| read().iter().filter(|&&b| b == 0x7f).count() == reference); - - // Typed after, it stays: the user's comment is behind it. - h.step(|ws| ws.focus_terminal(&id)); - h.press(rune::Key::Text("x".into()), |_| {}); - h.step(|ws| ws.focus_pane()); - h.settle(); - assert_eq!(read().iter().filter(|&&b| b == 0x7f).count(), reference, "nothing more is erased"); -} - -/// The tree's right-click menu creates, renames and deletes files: a new file opens, a rename carries its open tab -/// along, a delete asks first and closes the tab, and a name that would leave the folder or overwrite a file is refused. -#[test] -fn the_tree_creates_renames_and_deletes_files() { - let mut h = Harness::new(|_| vec![]); - let cwd = h.work.join("project"); - std::fs::create_dir_all(cwd.join("src")).unwrap(); - std::fs::write(cwd.join("src/a.rs"), "fn a() {}\n").unwrap(); - std::fs::write(cwd.join("src/taken.rs"), "").unwrap(); - h.step(|ws| ws.new_claude(cwd.clone())); - let id = h.ws().active.clone().unwrap(); - h.step(|ws| ws.toggle_editor()); - h.wait("listing", |ws| ws.panes[&id].rows.iter().any(|r| r.name == "src")); - h.settle(); - let root = h.editor_pane(&id).root.clone(); - let src = root.join("src"); - let pick = |h: &mut Harness, label: &str| { - let rows: Vec = h.menu_rows().into_iter().map(|(l, _)| l).collect(); - let ix = rows.iter().position(|r| r == label).unwrap_or_else(|| panic!("no {label:?} in {rows:?}")); - let serial = h.ws().menu.as_ref().unwrap().serial; - h.click(&format!("menu-{serial}-{ix}")); - }; - let name_it = |h: &mut Harness, name: &str| { - h.step(|ws| { - if let Some(f) = modal_field(&mut ws.modal, 0) { - *f = modal::field(name, true); - } - }); - h.step(|ws| ws.submit_modal()); - }; - - // New file in a folder, from the folder's row: it is made, the folder opens, and the file opens in a tab. - let (x, y) = h.rt.find(&format!("tree-{}", platform::path_key(&src))).unwrap(); - h.rt.secondary_down(x, y); - h.rt.secondary_up(x, y); - h.settle(); - pick(&mut h, "New file…"); - name_it(&mut h, "b.rs"); - assert!(src.join("b.rs").is_file()); - h.wait("the new file's tab", |ws| ws.panes[&id].shown().is_some_and(|t| t.path == src.join("b.rs"))); - assert!(h.editor_pane(&id).expanded.contains(&src), "its folder is open"); - - // Refused names keep the dialog open and touch nothing. - h.step(|ws| ws.act(Act::AskFileName(id.clone(), NameFor::Rename(src.join("b.rs"))))); - name_it(&mut h, "taken.rs"); - assert!(h.ws().modal.is_some(), "a name in use is refused"); - name_it(&mut h, "../out.rs"); - assert!(h.ws().modal.is_some() && !cwd.join("out.rs").exists(), "a name can't leave the folder"); - - // A rename carries the open tab with it. - name_it(&mut h, "c.rs"); - assert!(h.ws().modal.is_none()); - assert!(src.join("c.rs").is_file() && !src.join("b.rs").exists()); - assert!(h.editor_pane(&id).tabs.iter().any(|t| t.path == src.join("c.rs")), "the tab follows the file"); - assert!(h.editor_pane(&id).tabs.iter().all(|t| t.path != src.join("b.rs"))); - assert!(h.editor_pane(&id).recent.contains(&src.join("c.rs")) && !h.editor_pane(&id).recent.contains(&src.join("b.rs")), "recent files follow the rename"); - - // Delete asks first, then removes the file and closes its tab. - h.wait("the tree listing c.rs", |ws| ws.panes[&id].rows.iter().any(|r| r.name == "c.rs")); - h.settle(); - let (x, y) = h.rt.find(&format!("tree-{}", platform::path_key(&src.join("c.rs")))).unwrap(); - h.rt.secondary_down(x, y); - h.rt.secondary_up(x, y); - h.settle(); - pick(&mut h, "Delete"); - assert!(src.join("c.rs").exists(), "nothing goes before the answer"); - h.step(|ws| ws.submit_modal()); - h.wait("deleting", |ws| !src.join("c.rs").exists() && ws.panes[&id].tabs.iter().all(|t| t.path != src.join("c.rs"))); - let pane = h.editor_pane(&id); - assert!(pane.recent.iter().chain(pane.back.iter().map(|(p, _)| p)).all(|p| !p.starts_with(src.join("c.rs"))), "no place is left in the deleted file"); -} - -/// A file git knows gets a bar beside each changed line, drawn only for the lines on screen: scrolled to a later -/// change, its bar shows and the first one's goes. -#[test] -fn git_change_marks_are_drawn_beside_their_lines_and_follow_scrolling() { - let mut h = Harness::new(|_| vec![]); - let cwd = h.work.join("repo"); - git_repo(&cwd); - let file = cwd.join("a.txt"); - let base: String = (1..=150).map(|n| format!("line {n}\n")).collect(); - std::fs::write(&file, &base).unwrap(); - assert!(git(&cwd, &["add", "."]).status.success() && git(&cwd, &["commit", "-qm", "base"]).status.success()); - std::fs::write(&file, base.replace("line 2\n", "TWO\n").replace("line 120\n", "CHANGED\n")).unwrap(); - h.step(|ws| ws.new_claude(cwd.clone())); - let id = h.ws().active.clone().unwrap(); - h.step(|ws| ws.toggle_editor()); - h.wait("listing", |ws| !ws.panes[&id].root.as_os_str().is_empty()); - let file = h.editor_pane(&id).root.join("a.txt"); - h.step(|ws| ws.open_file(&id, file.clone(), None)); - h.wait("the marks", |ws| ws.panes[&id].shown().is_some_and(|t| !t.editor.marks.is_empty())); - h.settle(); - let key = h.shown_tab(&id).unwrap().editor.key.clone(); - assert_eq!(h.shown_tab(&id).unwrap().editor.marks, [(1, crate::editor::Mark::Modified), (119, crate::editor::Mark::Modified)]); - let bar = |h: &Harness, line: usize| h.drawn(&format!("{key}/mark{line}")); - assert!(bar(&h, 1) && !bar(&h, 119), "only the change on screen has a bar"); - let (bar_rect, _) = h.rt.presented(&format!("{key}/mark1")).unwrap(); - let (line_rect, _) = h.rt.presented(&format!("{key}/l1")).unwrap(); - assert!((bar_rect[1] - line_rect[1]).abs() < 1.0 && bar_rect[3] > 8.0, "the bar runs beside its line: {bar_rect:?} {line_rect:?}"); - - h.step(|ws| ws.open_file(&id, file.clone(), Some(119))); - h.settle(); - assert!(bar(&h, 119) && !bar(&h, 1), "scrolled down, the later change has the bar"); -} - -/// The wheel eases the text but never past its ends: up at the top it stays put, and down past the end it stops with -/// the last line still on screen. A double click selects the word under the pointer. -#[test] -fn the_wheel_stops_at_both_ends_and_a_double_click_selects_a_word() { - let mut h = Harness::new(|_| vec![]); - let cwd = h.work.clone(); - let file = cwd.join("lines.txt"); - std::fs::write(&file, (0..300).map(|i| format!("line {i}\n")).collect::()).unwrap(); - h.step(|ws| ws.new_claude(cwd.clone())); - let id = h.ws().active.clone().unwrap(); - h.step(|ws| ws.toggle_editor()); - h.step(|ws| ws.open_file(&id, file.clone(), None)); - h.wait("opening", |ws| ws.panes[&id].shown().is_some()); - h.settle(); - let key = h.shown_tab(&id).unwrap().editor.key.clone(); - let scroll = |h: &Harness| h.shown_tab(&id).unwrap().editor.scroll[1]; - let (x, y) = h.rt.find(&key).unwrap(); - let wheel = |h: &mut Harness, dy: f32| { - h.rt.pointer_move(x, y); - h.rt.wheel_event(rune::WheelEvent::new(0.0, dy).at(x, y)); - (0..40) - .map(|_| { - std::thread::sleep(Duration::from_millis(8)); - h.pump(); - scroll(h) - }) - .collect::>() - }; - let seen = wheel(&mut h, 360.0); - assert!(seen.iter().all(|&s| s == 0.0), "up at the top, nothing moves: {seen:?}"); - - let (line, _) = h.rt.presented(&format!("{key}/l0")).unwrap(); - // The file ends with a line break, so its last line is the empty line 300, which may scroll up to the top. - let end = 300.0 * line[3]; - let mut seen = vec![]; - for _ in 0..8 { - seen.extend(wheel(&mut h, -3000.0)); - } - assert!(seen.iter().all(|&s| s <= end + 0.5), "never past the end ({end}): {seen:?}"); - assert!((seen.last().unwrap() - end).abs() < 0.5, "it reaches the end: {:?}", seen.last()); - h.settle(); - assert!(h.drawn(&format!("{key}/l300")), "the last line stays on screen"); - - // Back at the top, a double click on "line" of the first line selects that word. - h.press(rune::Key::Home, |m| if cfg!(target_os = "macos") { m.logo = true } else { m.ctrl = true }); - h.settle(); - let (row, _) = h.rt.presented(&format!("{key}/l0")).unwrap(); - let (editor, _) = h.rt.presented(&key).unwrap(); - let e = &h.shown_tab(&id).unwrap().editor; - let y = row[1] + row[3] / 2.0; - let x = (0..2000).map(|x| x as f32).find(|&x| e.pos_at(x, y - editor[1]) == crate::editor::buffer::Pos::new(0, 2)).unwrap() + editor[0]; - for _ in 0..2 { - h.rt.pointer_move(x, y); - h.rt.pointer_down(x, y); - h.rt.pointer_up(x, y); - } - h.pump(); - let e = &h.shown_tab(&id).unwrap().editor; - assert_eq!(e.buffer.slice(e.sel.range().0, e.sel.range().1), "line", "the word under the pointer"); -} - -/// As in main's editor, a line wider than the editor wraps onto more rows, and Down moves to its next row. A block's -/// chevron shows while the pointer is over the gutter; clicking it hides the block's inner lines and clicking again -/// shows them. -#[test] -fn a_long_line_wraps_and_a_block_folds_from_its_chevron() { - let mut h = Harness::new(|_| vec![]); - let cwd = h.work.clone(); - let file = cwd.join("wrap.rs"); - let long = format!("// {}", "word ".repeat(120)); - std::fs::write(&file, format!("{long}\nfn main() {{\n let a = 1;\n let b = 2;\n}}\nfn after() {{}}\n")).unwrap(); - h.step(|ws| ws.new_claude(cwd.clone())); - let id = h.ws().active.clone().unwrap(); - h.step(|ws| ws.toggle_editor()); - h.step(|ws| ws.open_file(&id, file.clone(), None)); - h.wait("the parser finding `main`'s block", |ws| ws.panes[&id].shown().is_some_and(|t| t.editor.fold_spot(1) == Some((1, 4)))); - h.settle(); - let key = h.shown_tab(&id).unwrap().editor.key.clone(); - let (editor, _) = h.rt.presented(&key).unwrap(); - let (first, _) = h.rt.presented(&format!("{key}/l0")).unwrap(); - let (second, _) = h.rt.presented(&format!("{key}/l1")).unwrap(); - let line_h = second[3]; - assert!(first[3] >= line_h * 3.0, "the long line takes several rows: {} for rows of {line_h}", first[3]); - assert!(first[0] + first[2] <= editor[0] + editor[2] + 0.5, "and fits the editor's width"); - assert!((second[1] - (first[1] + first[3])).abs() < 0.5, "the next line starts below its last row"); - - h.step(|ws| ws.focus_pane()); - h.press(rune::Key::Down, |_| {}); - let caret = h.shown_tab(&id).unwrap().editor.caret(); - assert_eq!(caret.line, 0, "Down goes to the long line's second row"); - assert!(caret.col > 0); - - // Over the gutter the chevron shows; a click folds the block, leaving its first and last lines. - let (gx, gy) = (editor[0] + 4.0, second[1] + line_h / 2.0); - h.rt.pointer_move(gx, gy); - h.pump(); - let fold = format!("{key}/fold1"); - let (x, y) = h.rt.find(&fold).expect("the chevron of `main`'s block"); - h.rt.pointer_move(x, y); - h.rt.pointer_down(x, y); - h.rt.pointer_up(x, y); - h.settle(); - assert!(h.shown_tab(&id).unwrap().editor.is_folded(1)); - assert!(!h.drawn(&format!("{key}/l2")) && !h.drawn(&format!("{key}/l3")), "the block's inner lines are hidden"); - let (closing, _) = h.rt.presented(&format!("{key}/l4")).unwrap(); - assert!((closing[1] - (second[1] + line_h)).abs() < 0.5, "its last line comes right after its first"); - assert_eq!(h.shown_tab(&id).unwrap().editor.caret().line, 0, "the click selected nothing"); - - h.rt.pointer_down(x, y); - h.rt.pointer_up(x, y); - h.settle(); - assert!(!h.shown_tab(&id).unwrap().editor.is_folded(1)); - assert!(h.drawn(&format!("{key}/l2")), "a second click shows them again"); -} - -/// Several cursors, as in main's editor: Alt+click adds one where it lands and the add-cursor key one below; typing -/// goes in at each, one undo takes it all back, and Escape leaves only the first cursor. -#[test] -fn alt_click_and_the_add_cursor_key_type_at_several_cursors() { - use crate::editor::buffer::Pos; - let mut h = Harness::new(|_| vec![]); - let cwd = h.work.clone(); - let file = cwd.join("many.txt"); - std::fs::write(&file, "one\ntwo\nthree\nfour\n").unwrap(); - h.step(|ws| ws.new_claude(cwd.clone())); - let id = h.ws().active.clone().unwrap(); - h.step(|ws| ws.toggle_editor()); - h.step(|ws| ws.open_file(&id, file.clone(), None)); - h.wait("opening", |ws| ws.panes[&id].shown().is_some()); - h.settle(); - let key = h.shown_tab(&id).unwrap().editor.key.clone(); - let (editor, _) = h.rt.presented(&key).unwrap(); - let (row, _) = h.rt.presented(&format!("{key}/l2")).unwrap(); - let e = &h.shown_tab(&id).unwrap().editor; - let y = row[1] + row[3] / 2.0; - let x = (0..2000).map(|x| x as f32).find(|&x| e.pos_at(x, y - editor[1]) == Pos::new(2, 0)).unwrap() + editor[0]; - h.step(|ws| ws.focus_pane()); - h.rt.pointer_move(x, y); - h.rt.physical_input(rune::PhysicalInput::Modifiers(rune::Mods { alt: true, ..Default::default() })); - h.rt.pointer_down(x, y); - h.rt.pointer_up(x, y); - h.pump(); - h.rt.physical_input(rune::PhysicalInput::Modifiers(rune::Mods::default())); - h.pump(); - let heads = |h: &Harness| h.shown_tab(&id).unwrap().editor.cursors().iter().map(|s| s.head).collect::>(); - assert_eq!(heads(&h), [Pos::new(0, 0), Pos::new(2, 0)], "the Alt+click added a cursor and kept the first"); - - let add_below = |m: &mut rune::Mods| { - m.alt = true; - if cfg!(target_os = "macos") { m.logo = true } else { m.ctrl = true } - }; - if cfg!(any(target_os = "macos", target_os = "windows")) { - h.press(rune::Key::Down, add_below); - assert_eq!(heads(&h), [Pos::new(0, 0), Pos::new(2, 0), Pos::new(1, 0), Pos::new(3, 0)], "a cursor below each"); - } - h.type_text("> "); - let text = h.shown_tab(&id).unwrap().editor.buffer.text(); - let expected = if cfg!(any(target_os = "macos", target_os = "windows")) { "> one\n> two\n> three\n> four\n" } else { "> one\ntwo\n> three\nfour\n" }; - assert_eq!(text, expected); - - h.press(rune::Key::Text("z".into()), |m| if cfg!(target_os = "macos") { m.logo = true } else { m.ctrl = true }); - assert_eq!(h.shown_tab(&id).unwrap().editor.buffer.text(), "one\ntwo\nthree\nfour\n", "one undo takes back every cursor's typing"); - // Another cursor's caret shows even while the first cursor is scrolled out of view. - h.step(|ws| { - let e = &mut ws.panes.get_mut(&id).unwrap().shown_mut().unwrap().editor; - e.scroll[1] = e.metrics_line_h() * 1.0; - // Whatever the blink's phase, so the check doesn't depend on timing. - e.blink(std::time::Instant::now(), false); - }); - h.pump(); - assert!(h.drawn(&format!("{key}/caret0")), "the second cursor's caret is drawn with the first off screen"); - - h.press(rune::Key::Escape, |_| {}); - assert_eq!(heads(&h), [Pos::new(0, 0)], "Escape leaves the first cursor"); - - // gpui-kit's `test_multi_cursor_platform_word_selection_dispatch`: the platform's select-word key at two cursors. - h.step(|ws| { - let e = &mut ws.panes.get_mut(&id).unwrap().shown_mut().unwrap().editor; - e.set_text("one two\none two"); - e.set_cursors(&[crate::editor::buffer::Selection::caret(Pos::new(0, 4)), crate::editor::buffer::Selection::caret(Pos::new(1, 4))]); - }); - h.press(rune::Key::Right, |m| { - m.shift = true; - if cfg!(any(target_os = "macos", target_os = "linux")) { m.alt = true } else { m.ctrl = true } - }); - h.type_text("x"); - assert_eq!(h.shown_tab(&id).unwrap().editor.buffer.text(), "one x\none x"); -} - -/// The caret blinks while the editor has the keyboard, as in main's editor: on while it moves, then off and on every -/// half second. Once the keyboard is elsewhere it stays on and nothing wakes the app for it. -#[test] -fn the_caret_blinks_only_while_the_editor_has_the_keyboard() { - let mut h = Harness::new(|_| vec![]); - let cwd = h.work.clone(); - let file = cwd.join("blink.txt"); - std::fs::write(&file, "one two\n").unwrap(); - h.step(|ws| ws.new_claude(cwd.clone())); - let id = h.ws().active.clone().unwrap(); - h.step(|ws| ws.toggle_editor()); - h.step(|ws| ws.open_file(&id, file.clone(), None)); - h.wait("opening", |ws| ws.panes[&id].shown().is_some()); - h.step(|ws| ws.focus_pane()); - h.press(rune::Key::Right, |_| {}); - let shown = |h: &Harness| h.shown_tab(&id).unwrap().editor.caret_shown(); - assert!(shown(&h), "on right after a move"); - h.wait("the caret blinking off", |ws| ws.panes[&id].shown().is_some_and(|t| !t.editor.caret_shown())); - h.wait("and on again", |ws| ws.panes[&id].shown().is_some_and(|t| t.editor.caret_shown())); - h.wait("and off", |ws| ws.panes[&id].shown().is_some_and(|t| !t.editor.caret_shown())); - h.press(rune::Key::Right, |_| {}); - assert!(shown(&h), "a move shows it at once"); - // A key the editor takes without changing anything, Copy, shows it too (gpui-kit's - // `test_consumed_keystrokes_keep_cursor_visible`). - h.wait("off again", |ws| ws.panes[&id].shown().is_some_and(|t| !t.editor.caret_shown())); - h.press(rune::Key::Text("c".into()), |m| if cfg!(target_os = "macos") { m.logo = true } else { m.ctrl = true }); - assert!(shown(&h), "Copy shows the caret"); - - let e = &mut h.rt.state.panes.get_mut(&id).unwrap().shown_mut().unwrap().editor; - let later = std::time::Instant::now() + Duration::from_secs(5); - assert_eq!(e.blink(later, false), None, "without the keyboard nothing is scheduled"); - assert!(e.caret_shown()); -} - -/// Primary+F opens the search bar over the file: matches are counted and highlighted without moving the caret, Enter -/// and Shift+Enter step through them, case can matter, the replace row replaces one or all as one undo step, and -/// Escape gives the keyboard back to the editor. -#[test] -fn the_search_bar_finds_steps_and_replaces_in_the_file() { - use crate::editor::buffer::Pos; - let mut h = Harness::new(|_| vec![]); - let cwd = h.work.clone(); - let file = cwd.join("words.txt"); - std::fs::write(&file, "alpha beta alpha\nALPHA gamma\n").unwrap(); - h.step(|ws| ws.new_claude(cwd.clone())); - let id = h.ws().active.clone().unwrap(); - h.step(|ws| ws.toggle_editor()); - h.step(|ws| ws.open_file(&id, file.clone(), None)); - h.wait("opening", |ws| ws.panes[&id].shown().is_some()); - h.settle(); - let key = h.shown_tab(&id).unwrap().editor.key.clone(); - let bar = |h: &Harness| { - let t = h.shown_tab(&id).unwrap(); - (t.find.open, t.find.label(), t.editor.found.len(), t.editor.found_current) - }; - - h.press(rune::Key::Command('f'), secondary); - h.settle(); - assert!(h.drawn("find-bar") && h.drawn("find-query"), "the bar is drawn: {:?}", h.keys()); - h.type_text("alpha"); - h.pump(); - assert_eq!(bar(&h), (true, "1/3".into(), 3, Some(0)), "case is ignored by default"); - assert_eq!(h.shown_tab(&id).unwrap().editor.caret(), Pos::new(0, 0), "the caret stays"); - assert_eq!(h.shown_text(&id), "alpha beta alpha\nALPHA gamma\n"); - h.press(rune::Key::Enter, |_| {}); - assert_eq!(bar(&h).1, "2/3"); - h.press(rune::Key::Enter, |m| m.shift = true); - h.press(rune::Key::Enter, |m| m.shift = true); - assert_eq!(bar(&h).1, "3/3", "back past the first wraps to the last"); - h.click("find-case"); - h.pump(); - assert_eq!(bar(&h).1.split('/').nth(1), Some("2"), "matching case leaves the lowercase two"); - - // The replace row: one, then all, and one undo takes all back. - h.click("find-case"); - h.click("find-replace-toggle"); - h.settle(); - assert!(h.shown_tab(&id).unwrap().find.replacement.focused, "the replacement has the keyboard"); - h.type_text("omega"); - h.pump(); - h.click("find-replace-one"); - h.pump(); - assert_eq!(h.shown_text(&id), "omega beta alpha\nALPHA gamma\n"); - assert_eq!(bar(&h).1, "1/2", "the next match becomes current"); - h.click("find-replace-all"); - h.pump(); - assert_eq!(h.shown_text(&id), "omega beta omega\nomega gamma\n"); - assert_eq!(bar(&h).1, "0/0"); - h.step(|ws| ws.close_find()); - h.press(rune::Key::Command('z'), secondary); - assert_eq!(h.shown_text(&id), "omega beta alpha\nALPHA gamma\n", "replace all is one step"); - assert_eq!(h.shown_tab(&id).unwrap().editor.found.len(), 0, "a closed bar highlights nothing"); - assert_eq!(h.ws().keys_to.as_deref(), Some(key.as_str()), "the editor has the keyboard again"); -} - -/// The real servers on PATH: gleam's reports a type error, and one that isn't installed says so. Starts programs from -/// the machine, so it runs on request: `cargo test -- --ignored real_language_servers`. -#[test] -#[ignore] -fn real_language_servers_start_and_report() { - let mut h = Harness::new(|_| vec![]); - let cwd = h.work.clone(); - std::fs::create_dir_all(cwd.join("src")).unwrap(); - std::fs::write(cwd.join("gleam.toml"), "name = \"probe\"\nversion = \"1.0.0\"\n").unwrap(); - std::fs::write(cwd.join("src/probe.gleam"), "pub fn main() -> Int {\n \"not a number\"\n}\n").unwrap(); - std::fs::write(cwd.join("probe.ts"), "export const n: number = \"x\";\n").unwrap(); - h.step(|ws| ws.new_claude(cwd.clone())); - let id = h.ws().active.clone().unwrap(); - h.step(|ws| ws.toggle_editor()); - let settled = |ws: &Workspace| ws.server_status(&ws.active.clone().unwrap()).is_some_and(|s| !s.contains("starting")); - for (file, program) in [("src/probe.gleam", "gleam"), ("probe.ts", "tsc")] { - h.step(|ws| ws.open_file(&id, cwd.join(file), None)); - h.wait(&format!("{program} starting"), settled); - let status = h.ws().server_status(&id).unwrap(); - eprintln!("{program}: {status}"); - if crate::platform::find_executable(program).is_none() { - assert_eq!(status, format!("{program} isn't installed, so this file has no diagnostics or hover.")); - continue; - } - assert_eq!(status, program); - h.wait(&format!("{program}'s type error"), |ws| ws.panes[&id].shown().is_some_and(|t| t.editor.problems.iter().any(|p| p.error))); - eprintln!("{program} says: {:?}", h.shown_tab(&id).unwrap().editor.problems[0].message); - } -} - -mod github { - use super::*; - use crate::github::cli::*; - use crate::github::model::*; - use crate::github::view::*; - use serde_json::json; - - impl Harness { - /// The GitHub pane opened on `cwd`, by id. - fn open_github_pane(&mut self, cwd: &Path) -> String { - let cwd = cwd.to_path_buf(); - self.step(|ws| ws.open_github(cwd)); - self.ws().right_gh.clone().expect("the GitHub pane is shown") - } - - fn pane(&self, id: &str) -> &GithubView { - &self.ws().gh_pane(id).expect("the pane").view - } - - fn with_pane(&mut self, id: &str, f: impl FnOnce(&mut GithubView)) { - let id = id.to_string(); - self.step(move |ws| f(ws.gh_view_mut(&id).expect("the pane"))); - } - } - - /// A stand-in for `gh` with no login: `o/r` is the folder's repository, and it has no issues or pull requests. The - /// repository is on an Enterprise host, so a github.com login another test left in `gh`'s token cache never sends - /// its requests past the stand-in. - fn fake_gh(dir: &Path) -> PathBuf { - let repo = r#"{"nameWithOwner":"o/r","url":"https://ghe.invalid/o/r"}"#; - let data = r#"{"data":{"repository":{"id":"R","issueOrPullRequest":null}}}"#; - let fake = dir.join(if cfg!(windows) { "gh.cmd" } else { "gh" }); - let script = if cfg!(windows) { - format!("@echo off\r\nif \"%1\"==\"auth\" exit /b 1\r\nif \"%1\"==\"repo\" goto repo\r\necho {data}\r\nexit /b 0\r\n:repo\r\necho {repo}\r\n") - } else { - format!("#!/bin/sh\ncase \"$1\" in\n auth) exit 1 ;;\n repo) echo '{repo}' ;;\n *) echo '{data}' ;;\nesac\n") - }; - std::fs::write(&fake, script).unwrap(); - #[cfg(unix)] - std::fs::set_permissions(&fake, std::os::unix::fs::PermissionsExt::from_mode(0o755)).unwrap(); - fake - } - - /// A click on an attached pull request opens it in a pane that is still looking its repository up; the item loads - /// once the repository is known. - #[test] - fn an_item_opened_before_the_repository_is_known_still_loads() { - let mut h = Harness::new(|_| vec![]); - let work = h.work.clone(); - let gh = Gh::new(fake_gh(&work), work.clone()); - let pane = new_id(); - let id = pane.clone(); - h.step(move |ws| { - let view = GithubView::new(id.clone(), ws.rt.mailbox(), work.clone(), "p".into(), None, Some(gh)); - ws.gh.push(crate::app::GhPane { id: id.clone(), cwd: work, project: "p".into(), view }); - ws.right_gh = Some(id.clone()); - ws.gh_view_mut(&id).unwrap().open_item(Kind::Pull, 7); - }); - h.wait("the pull request's answer", |ws| ws.gh_pane(&pane).and_then(|p| p.view.detail.as_ref()).is_some_and(|d| !d.loading)); - assert_eq!(h.pane(&pane).detail.as_ref().unwrap().error.as_deref(), Some("This item could not be found.")); - } - - #[test] - fn opening_a_pull_request_selects_the_pull_requests_tab() { - let mut h = Harness::new(|_| vec![]); - let work = h.work.clone(); - let pane = h.open_github_pane(&work); - for (kind, number) in [(Kind::Pull, 7), (Kind::Issue, 3)] { - h.with_pane(&pane, |v| v.open_item(kind, number)); - assert_eq!(h.pane(&pane).kind, kind); - } - } - - /// An attached item of another repository opens in that repository's own pane, not the project's. - #[test] - fn an_item_of_another_repository_opens_in_its_own_pane() { - let mut h = Harness::new(|_| vec![]); - let shown = h.ws().active_cwd(); - let project = h.open_github_pane(&shown); - h.step(|ws| ws.open_attached(Some("octocat/hello-world"), true, 9)); - let other = h.ws().right_gh.clone().unwrap(); - assert_ne!(other, project); - let v = h.pane(&other); - assert_eq!(v.named.as_deref(), Some("octocat/hello-world")); - assert_eq!(v.detail.as_ref().map(|d| (d.kind, d.number)), Some((Kind::Pull, 9))); - h.step(|ws| ws.open_attached(Some("Octocat/Hello-World"), false, 2)); - assert_eq!(h.ws().right_gh.as_ref(), Some(&other), "the same repository reuses its pane"); - h.step(|ws| ws.open_attached(None, false, 3)); - assert_eq!(h.ws().right_gh.as_ref(), Some(&project), "an item of the project opens in the project's pane"); - h.with_pane(&project, |v| v.repo = RepoRef::on_github("o/r")); - h.step(|ws| ws.open_attached(Some("O/R"), false, 4)); - assert_eq!(h.ws().right_gh.as_ref(), Some(&project), "the project's own repository, named, opens in the project's pane"); - } - - /// Draws the pane in every state, at two widths, with real GitHub data, to catch panics in `github/ui`. Only - /// reads from GitHub. Needs a signed-in `gh`: `cargo test -- --ignored pane_draws_every_state`. - #[test] - #[ignore] - fn pane_draws_every_state() { - let gh = Gh::new(locate().expect("gh is installed"), std::env::current_dir().unwrap()); - let (owner, name) = ("zed-industries", "zed"); - let info = parse_repo(&gh.graphql(REPO_QUERY, json!({"owner": owner, "name": name})).unwrap()).unwrap(); - let mut lists = vec![]; - for kind in [Kind::Issue, Kind::Pull] { - let (q, qa, qb) = (scoped("zed-industries/zed", kind, "is:open"), scoped("zed-industries/zed", kind, "is:open"), scoped("zed-industries/zed", kind, "is:closed")); - lists.push(parse_page(&gh.graphql(LIST_QUERY, json!({"q": q, "qa": qa, "qb": qb, "after": null})).unwrap())); - } - let detail = |n: u32| parse_detail(&gh.graphql(detail_query_text(), json!({"owner": owner, "name": name, "number": n, "after": null})).unwrap()).unwrap(); - let (issue, pull) = (detail(lists[0].items[0].number), detail(lists[1].items[0].number)); - let repo = RepoRef { owner: owner.into(), name: name.into(), url: String::new(), host: None }; - let files = parse_files(&pull_files(&gh, &repo, pull.item.number, 1).unwrap()); - - let mut h = Harness::new(|_| vec![]); - h.rt.set_viewport((2000.0, 1100.0), 2.0); - let work = h.work.clone(); - let pane = h.open_github_pane(&work); - h.wait("the first look at the folder", |ws| ws.gh_pane(&pane).is_some_and(|p| p.view.phase != Phase::Loading)); - for phase in [Phase::Loading, Phase::NoCli, Phase::SignedOut, Phase::NotGithub, Phase::Failed("boom".into())] { - h.with_pane(&pane, |v| v.phase = phase); - h.settle(); - } - for width in [1100.0, 620.0] { - h.step(|ws| ws.store.data.layout.right_gh_w = Some(width)); - h.with_pane(&pane, |v| { - v.phase = Phase::Ready; - v.info = Some(info.clone()); - v.repo = Some(repo.clone()); - for (i, p) in lists.iter().enumerate() { - let l = &mut v.lists[i]; - (l.items, l.total, l.open, l.closed, l.loaded) = (p.items.clone(), p.total, p.open, p.closed, true); - } - }); - h.settle(); - for (kind, d) in [(Kind::Issue, &issue), (Kind::Pull, &pull)] { - for tab in [DetailTab::Conversation, DetailTab::Commits, DetailTab::Files] { - h.with_pane(&pane, |v| { - v.kind = kind; - let mut s = DetailState::new(kind, d.item.number); - (s.data, s.loading, s.tab) = (Some(d.clone()), false, tab); - s.files = Some(files.clone()); - s.expanded = files.iter().map(|f| f.path.clone()).collect(); - v.detail = Some(s); - }); - h.settle(); - } - } - h.with_pane(&pane, |v| v.mode = Mode::New(Kind::Issue)); - h.settle(); - h.with_pane(&pane, |v| v.mode = Mode::New(Kind::Pull)); - h.settle(); - h.with_pane(&pane, |v| { - v.mode = Mode::Browse; - v.detail = None; - }); - } - } - - /// Every feature of the pane against a real, throwaway private repository on the signed-in account, driven through - /// the pane's own actions (`GithubView::act`). `cargo test -- --ignored every_feature_against_a_scratch_repo - /// --nocapture`. It CREATES a private repo (named `claudiu-gh-pane-test-