A high-performance inference engine for AI models
mirai-gui (#881)
Elizaveta Kharchenkoc9c27bc7e9c9
diff --git a/.github/workflows/release-mirai-gui.yml b/.github/workflows/release-mirai-gui.ymlnew file mode 100644index 000000000..3af03c788--- /dev/null+++ b/.github/workflows/release-mirai-gui.yml@@ -0,0 +1,233 @@+name: "Release mirai-gui"++# The app ships with every engine release under the engine's version, stamped+# by `cargo tools sync`; the engine's GitHub Release is also the update feed.+on:+ release:+ types: [published]++permissions:+ contents: write++concurrency:+ group: release-mirai-gui+ cancel-in-progress: false++defaults:+ run:+ shell: bash++jobs:+ decide:+ name: decide+ if: ${{ !github.event.release.prerelease }}+ runs-on: ubuntu-latest+ outputs:+ publish: ${{ steps.decide.outputs.publish }}++ steps:+ - uses: actions/checkout@v6++ - id: decide+ env:+ TAG: ${{ github.event.release.tag_name }}+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ run: |+ set -euo pipefail+ if [[ ! "${TAG}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then+ echo "::notice::${TAG} is not an engine release tag; nothing to publish"+ echo "publish=false" >> "$GITHUB_OUTPUT"+ exit 0+ fi+ STAMPED="$(node -p "require('./apps/mirai-gui/package.json').version")"+ if [ "${STAMPED}" != "${TAG}" ]; then+ echo "apps/mirai-gui/package.json is at ${STAMPED}, tag is ${TAG}: cargo tools sync did not run before tagging" >&2+ exit 1+ fi+ # latest.json is attached after every other asset.+ ASSETS="$(gh release view "${TAG}" --json assets --jq '.assets[].name')"+ if grep -qxF latest.json <<< "${ASSETS}"; then+ echo "::notice::${TAG} already carries the app; nothing to do"+ echo "publish=false" >> "$GITHUB_OUTPUT"+ exit 0+ fi+ echo "publish=true" >> "$GITHUB_OUTPUT"++ release:+ name: release-mirai-gui+ needs: decide+ if: ${{ needs.decide.outputs.publish == 'true' }}+ runs-on: macos-26++ defaults:+ run:+ working-directory: apps/mirai-gui++ env:+ TAG: ${{ github.event.release.tag_name }}+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ APPLE_ID: ${{ secrets.APPLE_ID }}+ APPLE_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}+ APPLE_TEAM_ID: ${{ secrets.APPLE_DEVELOPMENT_TEAM_ID }}+ APPLE_DEVELOPER_ID_P12: ${{ secrets.APPLE_DEVELOPER_ID_P12 }}+ APPLE_DEVELOPER_ID_PASSWORD: ${{ secrets.APPLE_DEVELOPER_ID_PASSWORD }}+ TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}+ # Unset makes the signer prompt for a password.+ TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ""++ steps:+ - uses: actions/checkout@v6+ - uses: ./.github/actions/setup+ with:+ metal: true+ bindings: true++ # Fail here, not after the twenty-minute build.+ - name: Verify secrets and variables are configured+ run: |+ for v in TAURI_SIGNING_PRIVATE_KEY APPLE_ID APPLE_PASSWORD APPLE_TEAM_ID \+ APPLE_DEVELOPER_ID_P12 APPLE_DEVELOPER_ID_PASSWORD; do+ test -n "${!v}" || { echo "${v} is not configured" >&2; exit 1; }+ done++ - name: Install dependencies+ run: pnpm install --frozen-lockfile++ # Already signed and notarized by the engine's release job; Tauri leaves+ # files under Resources unsigned.+ - name: Take the mirai CLI from the engine release+ run: |+ set -euo pipefail+ gh release download "${TAG}" --dir "${RUNNER_TEMP}" --pattern mirai-aarch64-apple-darwin.tar.gz+ tar -xzf "${RUNNER_TEMP}/mirai-aarch64-apple-darwin.tar.gz" -C "${RUNNER_TEMP}"+ install -d desktop/resources/cli+ install -m 755 "${RUNNER_TEMP}/mirai-aarch64-apple-darwin" desktop/resources/cli/mirai+ codesign --verify --strict --verbose=2 \+ -R="anchor apple generic and certificate leaf[subject.OU] = \"${APPLE_TEAM_ID}\"" \+ desktop/resources/cli/mirai++ - name: Import signing certificate and read its identity+ run: |+ set -euo pipefail+ # Tauri's own import prints the identity in the log.+ KEYCHAIN="${RUNNER_TEMP}/mirai-signing.keychain-db"+ KEYCHAIN_PW="$(openssl rand -base64 24)"+ printf '%s' "${APPLE_DEVELOPER_ID_P12}" | base64 -d > "${RUNNER_TEMP}/app_cert.p12"+ security create-keychain -p "${KEYCHAIN_PW}" "${KEYCHAIN}"+ # The keychain must stay unlocked through the whole build.+ security set-keychain-settings "${KEYCHAIN}"+ security unlock-keychain -p "${KEYCHAIN_PW}" "${KEYCHAIN}"+ security import "${RUNNER_TEMP}/app_cert.p12" -k "${KEYCHAIN}" \+ -P "${APPLE_DEVELOPER_ID_PASSWORD}" \+ -T /usr/bin/codesign -T /usr/bin/security+ security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "${KEYCHAIN_PW}" "${KEYCHAIN}" >/dev/null+ security list-keychains -d user -s "${KEYCHAIN}" $(security list-keychains -d user | tr -d '"')+ IDENTITY="$(security find-identity -v -p codesigning "${KEYCHAIN}" | grep -m1 'Developer ID Application' | awk -F'"' '{print $2}')"+ if [ -z "${IDENTITY}" ]; then+ echo "No Developer ID Application identity found in the imported certificate" >&2+ exit 1+ fi+ rm -f "${RUNNER_TEMP}/app_cert.p12"+ echo "APPLE_SIGNING_IDENTITY=${IDENTITY}" >> $GITHUB_ENV+ echo "::add-mask::${IDENTITY}"++ - name: Build and sign Tauri app+ run: |+ set -euo pipefail+ # Only the .app: Tauri cannot style the DMG on CI (tauri-apps/tauri#1731).+ pnpm build --bundles app --config desktop/tauri.release.conf.json++ - name: Build DMG (headless, dmgbuild)+ run: |+ set -euo pipefail+ # The runner's python3 refuses pip install outside a venv.+ VENV_DIR="${RUNNER_TEMP}/dmgbuild-venv"+ python3 -m venv "${VENV_DIR}"+ "${VENV_DIR}/bin/pip" install --quiet dmgbuild+ BUNDLE_DIR="${PWD}/desktop/target/aarch64-apple-darwin/release/bundle"+ PRODUCT="$(node -p "require('./desktop/tauri.conf.json').productName")"+ APP_PATH="${BUNDLE_DIR}/macos/${PRODUCT}.app"+ for p in "${APP_PATH}" "${APP_PATH}.tar.gz" "${APP_PATH}.tar.gz.sig"; do+ test -e "${p}" || { echo "Missing bundle artifact: ${p}" >&2; ls -la "${BUNDLE_DIR}/macos" >&2; exit 1; }+ done+ # public.api matches ^mirai-<version>-aarch64-apple-darwin.dmg$ exactly.+ DMG_NAME="mirai-${TAG}-aarch64-apple-darwin.dmg"+ DMG_TARGET="${BUNDLE_DIR}/dmg/${DMG_NAME}"+ mkdir -p "${BUNDLE_DIR}/dmg"+ DMG_APP_PATH="${APP_PATH}" \+ DMG_BACKGROUND="${PWD}/desktop/dmg-background.tiff" \+ "${VENV_DIR}/bin/python" -m dmgbuild -s desktop/dmg-settings.py "${PRODUCT}" "${DMG_TARGET}"+ {+ echo "APP_PATH=${APP_PATH}"+ echo "TARGZ_PATH=${APP_PATH}.tar.gz"+ echo "SIG_PATH=${APP_PATH}.tar.gz.sig"+ echo "DMG_TARGET=${DMG_TARGET}"+ } >> "$GITHUB_ENV"++ - name: Verify the built app+ run: |+ set -euo pipefail+ # Tauri only warns when the signing key does not match the pubkey.+ brew install --quiet minisign+ node -p "require('./desktop/tauri.conf.json').plugins.updater.pubkey" | base64 -d > "${RUNNER_TEMP}/updater.pub"+ base64 -d < "${SIG_PATH}" > "${RUNNER_TEMP}/updater.minisig"+ minisign -Vm "${TARGZ_PATH}" -p "${RUNNER_TEMP}/updater.pub" -x "${RUNNER_TEMP}/updater.minisig"+ BUILT="$(defaults read "${APP_PATH}/Contents/Info" CFBundleShortVersionString)"+ if [ "${BUILT}" != "${TAG}" ]; then+ echo "Built app is ${BUILT}, the manifest would say ${TAG}: every client would update forever" >&2+ exit 1+ fi+ # Installed /usr/local/bin wrappers point at this path.+ if [ ! -x "${APP_PATH}/Contents/Resources/cli/mirai" ]; then+ echo "CLI missing from bundle at ${APP_PATH}/Contents/Resources/cli/mirai" >&2+ exit 1+ fi++ - name: Notarize the DMG+ run: |+ set -euo pipefail+ # Tauri notarized the .app; the DMG was built outside Tauri.+ xcrun notarytool submit "${DMG_TARGET}" \+ --apple-id "${APPLE_ID}" \+ --team-id "${APPLE_TEAM_ID}" \+ --password "${APPLE_PASSWORD}" \+ --wait+ xcrun stapler staple -v "${DMG_TARGET}"++ - name: Build the updater manifest+ run: |+ set -euo pipefail+ TARGZ_NAME="mirai-${TAG}.app.tar.gz"+ cp "${TARGZ_PATH}" "${TARGZ_NAME}"+ cp "${SIG_PATH}" "${TARGZ_NAME}.sig"+ jq -n \+ --arg version "${TAG}" \+ --arg pub_date "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \+ --arg signature "$(cat "${TARGZ_NAME}.sig")" \+ --arg url "https://github.com/${GITHUB_REPOSITORY}/releases/download/${TAG}/${TARGZ_NAME}" \+ '{version: $version, pub_date: $pub_date, platforms: {"darwin-aarch64": {signature: $signature, url: $url}}}' \+ > latest.json+ echo "TARGZ_NAME=${TARGZ_NAME}" >> "$GITHUB_ENV"++ # Clients read latest.json as soon as it is attached.+ - name: Attach the release assets+ run: |+ set -euo pipefail+ ASSETS="$(gh release view "${TAG}" --json assets --jq '.assets[].name')"+ if grep -qxF latest.json <<< "${ASSETS}"; then+ echo "${TAG} is already published; re-run all jobs, not failed ones, to rebuild" >&2+ exit 1+ fi+ gh release upload "${TAG}" --clobber "${DMG_TARGET}" "${TARGZ_NAME}" "${TARGZ_NAME}.sig"+ gh release upload "${TAG}" --clobber latest.json++ - uses: google-github-actions/auth@v2+ with:+ credentials_json: ${{ secrets.ASSETS_GOOGLE_CREDENTIALS }}++ - uses: google-github-actions/setup-gcloud@v2++ - name: Upload the DMG to the website bucket+ run: |+ set -euo pipefail+ gsutil cp -n "${DMG_TARGET}" "gs://${{ vars.ASSETS_BUCKET_NAME }}/app/$(basename "${DMG_TARGET}")"diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.ymlindex 636254475..a634f1e8c 100644--- a/.github/workflows/tests.yml+++ b/.github/workflows/tests.yml@@ -150,10 +150,119 @@ jobs:cargo tools test swiftcargo tools test typescript+ linters-mirai-gui:+ name: linters-mirai-gui+ runs-on: [self-hosted, macos, arm64]++ defaults:+ run:+ working-directory: apps/mirai-gui++ steps:+ - uses: actions/checkout@v6+ - uses: ./.github/actions/setup+ with:+ linters: true+ metal: true+ bindings: true++ - id: install+ name: Install dependencies+ run: pnpm install --frozen-lockfile++ - name: Typecheck+ if: ${{ always() && steps.install.outcome == 'success' }}+ run: pnpm typecheck++ - name: Lint+ if: ${{ always() && steps.install.outcome == 'success' }}+ run: pnpm lint++ - name: Check formatting+ if: ${{ always() && steps.install.outcome == 'success' }}+ run: pnpm format:check++ - name: Check Rust formatting+ if: ${{ always() && steps.install.outcome == 'success' }}+ working-directory: apps/mirai-gui/desktop+ run: cargo +nightly fmt --check++ - name: Lint with clippy+ if: ${{ always() && steps.install.outcome == 'success' }}+ working-directory: apps/mirai-gui/desktop+ run: cargo +nightly clippy --workspace --all-targets -- -D warnings++ - name: Check that Cargo.lock is consistent with Cargo.toml+ if: ${{ always() && steps.install.outcome == 'success' }}+ working-directory: apps/mirai-gui/desktop+ run: |+ cargo metadata --locked --format-version=1 > /dev/null+ git diff --exit-code -- Cargo.lock++ - name: Check with cargo-deny+ if: ${{ always() && steps.install.outcome == 'success' }}+ working-directory: apps/mirai-gui/desktop+ run: cargo deny check -D warnings++ tests-mirai-gui:+ name: tests-mirai-gui+ runs-on: [self-hosted, macos, arm64]++ defaults:+ run:+ working-directory: apps/mirai-gui++ env:+ CARGO_ENCODED_RUSTFLAGS: "-Dwarnings"++ steps:+ - uses: actions/checkout@v6+ - uses: ./.github/actions/setup+ with:+ metal: true+ bindings: true++ - name: Install dependencies+ run: pnpm install --frozen-lockfile++ - name: Run client tests+ run: pnpm test++ - name: Run Rust tests+ run: pnpm test:rust++ build-mirai-gui:+ name: build-mirai-gui+ runs-on: [self-hosted, macos, arm64]++ defaults:+ run:+ working-directory: apps/mirai-gui++ steps:+ - uses: actions/checkout@v6+ - uses: ./.github/actions/setup+ with:+ metal: true+ bindings: true++ - name: Install dependencies+ run: pnpm install --frozen-lockfile++ - name: Build app bundle+ run: pnpm build++ - name: Upload app bundle+ uses: actions/upload-artifact@v4+ with:+ name: mirai-gui-macos-arm64+ path: apps/mirai-gui/desktop/target/aarch64-apple-darwin/release/bundle/dmg/*.dmg+ if-no-files-found: error+completed:name: completedruns-on: ubuntu-latest- needs: [linters, tests, validate-bindings]+ needs: [linters, tests, validate-bindings, linters-mirai-gui, tests-mirai-gui, build-mirai-gui]if: ${{ always() }}steps:@@ -161,3 +270,6 @@ jobs:[ "${{ needs.linters.result }}" = success ][ "${{ needs.tests.result }}" = success ][ "${{ needs.validate-bindings.result }}" = success ]+ [ "${{ needs.linters-mirai-gui.result }}" = success ]+ [ "${{ needs.tests-mirai-gui.result }}" = success ]+ [ "${{ needs.build-mirai-gui.result }}" = success ]diff --git a/apps/mirai-gui/.gitignore b/apps/mirai-gui/.gitignorenew file mode 100644index 000000000..c75b4f358--- /dev/null+++ b/apps/mirai-gui/.gitignore@@ -0,0 +1,26 @@+# Dependencies+node_modules/++# Build outputs+client/dist-web/+client/dist-tauri/+desktop/target/+desktop/gen/+desktop/resources/cli/++# Python (dmgbuild settings)+__pycache__/+*.pyc++# Editors+.vscode/+.idea/+*.swp++# OS files+.DS_Store++# Logs+*.log++.tanstack/diff --git a/apps/mirai-gui/.prettierignore b/apps/mirai-gui/.prettierignorenew file mode 100644index 000000000..6e875511a--- /dev/null+++ b/apps/mirai-gui/.prettierignore@@ -0,0 +1,5 @@+client/src/route-tree.gen.ts+client/dist-*/+desktop/target/+desktop/gen/+pnpm-lock.yamldiff --git a/apps/mirai-gui/README.md b/apps/mirai-gui/README.mdnew file mode 100644index 000000000..89bb2cc59--- /dev/null+++ b/apps/mirai-gui/README.md@@ -0,0 +1,40 @@+# Mirai++Desktop chat app for local LLMs on the [uzu](https://github.com/trymirai/uzu) engine.+Tauri v2, React, Rust.++## Requirements++- macOS 26.4 or newer, Apple silicon+- Xcode 26 with the Metal toolchain (`xcodebuild -downloadComponent MetalToolchain`)+- rustup; the first `cargo` run installs the nightly toolchain pinned by+ `rust-toolchain.toml` at the repository root+- Node 20.19 or newer and pnpm (`corepack enable` picks the version from `package.json`)++## Run++```bash+pnpm install+pnpm dev # desktop app; the first build also compiles the engine and its Metal shaders, later builds are incremental+pnpm build # .app and .dmg in desktop/target/aarch64-apple-darwin/release/bundle/, ad-hoc signed+pnpm web:dev # frontend in a browser without the engine: no models, no chats+```++`pnpm check` runs typecheck, ESLint, client tests, clippy and Rust tests;+`pnpm format` runs Prettier.++## Layout++```text+client/src/ React app, shared by desktop and web+ components/ app shell, icons and generic UI primitives (components/ui)+ features/ chat, chat-history, local-models, settings, welcome, runtime; each owns its page+ routes/ thin TanStack route glue+ platform/ platform contract + tauri/web adapters, the only way to the backend+ stores/ zustand stores+ styles/ theme.css: the palette, light values in @theme, dark ones in .dark+desktop/src/ Rust backend: engine, chat, downloads, storage+```++Inter and Geist Mono are bundled under the SIL Open Font License; license texts+are in `client/public/fonts/`.diff --git a/apps/mirai-gui/client/index.html b/apps/mirai-gui/client/index.htmlnew file mode 100644index 000000000..f7f0200d0--- /dev/null+++ b/apps/mirai-gui/client/index.html@@ -0,0 +1,24 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="UTF-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />+ <title>Mirai</title>+ <link rel="icon" type="image/png" href="/icons/icon_mirai_app.png" />+ <script>+ {+ let isDark = true;+ try {+ isDark = JSON.parse(localStorage.getItem("mirai-store") ?? "{}")?.state?.isDarkMode !== false;+ } catch {+ isDark = true;+ }+ document.documentElement.classList.toggle("dark", isDark);+ }+ </script>+ </head>+ <body>+ <div id="root"></div>+ <script type="module" src="/src/index.tsx"></script>+ </body>+</html>diff --git a/apps/mirai-gui/client/public/fonts/GeistMono-OFL.txt b/apps/mirai-gui/client/public/fonts/GeistMono-OFL.txtnew file mode 100644index 000000000..04e95fc55--- /dev/null+++ b/apps/mirai-gui/client/public/fonts/GeistMono-OFL.txt@@ -0,0 +1,93 @@+Copyright 2024 The Geist Project Authors (https://github.com/vercel/geist-font)++This Font Software is licensed under the SIL Open Font License, Version 1.1.+This license is copied below, and is also available with a FAQ at:+https://openfontlicense.org+++-----------------------------------------------------------+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007+-----------------------------------------------------------++PREAMBLE+The goals of the Open Font License (OFL) are to stimulate worldwide+development of collaborative font projects, to support the font creation+efforts of academic and linguistic communities, and to provide a free and+open framework in which fonts may be shared and improved in partnership+with others.++The OFL allows the licensed fonts to be used, studied, modified and+redistributed freely as long as they are not sold by themselves. The+fonts, including any derivative works, can be bundled, embedded,+redistributed and/or sold with any software provided that any reserved+names are not used by derivative works. The fonts and derivatives,+however, cannot be released under any other type of license. The+requirement for fonts to remain under this license does not apply+to any document created using the fonts or their derivatives.++DEFINITIONS+"Font Software" refers to the set of files released by the Copyright+Holder(s) under this license and clearly marked as such. This may+include source files, build scripts and documentation.++"Reserved Font Name" refers to any names specified as such after the+copyright statement(s).++"Original Version" refers to the collection of Font Software components as+distributed by the Copyright Holder(s).++"Modified Version" refers to any derivative made by adding to, deleting,+or substituting -- in part or in whole -- any of the components of the+Original Version, by changing formats or by porting the Font Software to a+new environment.++"Author" refers to any designer, engineer, programmer, technical+writer or other person who contributed to the Font Software.++PERMISSION & CONDITIONS+Permission is hereby granted, free of charge, to any person obtaining+a copy of the Font Software, to use, study, copy, merge, embed, modify,+redistribute, and sell modified and unmodified copies of the Font+Software, subject to the following conditions:++1) Neither the Font Software nor any of its individual components,+in Original or Modified Versions, may be sold by itself.++2) Original or Modified Versions of the Font Software may be bundled,+redistributed and/or sold with any software, provided that each copy+contains the above copyright notice and this license. These can be+included either as stand-alone text files, human-readable headers or+in the appropriate machine-readable metadata fields within text or+binary files as long as those fields can be easily viewed by the user.++3) No Modified Version of the Font Software may use the Reserved Font+Name(s) unless explicit written permission is granted by the corresponding+Copyright Holder. This restriction only applies to the primary font name as+presented to the users.++4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font+Software shall not be used to promote, endorse or advertise any+Modified Version, except to acknowledge the contribution(s) of the+Copyright Holder(s) and the Author(s) or with their explicit written+permission.++5) The Font Software, modified or unmodified, in part or in whole,+must be distributed entirely under this license, and must not be+distributed under any other license. The requirement for fonts to+remain under this license does not apply to any document created+using the Font Software.++TERMINATION+This license becomes null and void if any of the above conditions are+not met.++DISCLAIMER+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM+OTHER DEALINGS IN THE FONT SOFTWARE.\ No newline at end of filediff --git a/apps/mirai-gui/client/public/fonts/GeistMono-VariableFont_wght.ttf b/apps/mirai-gui/client/public/fonts/GeistMono-VariableFont_wght.ttfnew file mode 100644index 000000000..f86f19518Binary files /dev/null and b/apps/mirai-gui/client/public/fonts/GeistMono-VariableFont_wght.ttf differdiff --git a/apps/mirai-gui/client/public/fonts/Inter-OFL.txt b/apps/mirai-gui/client/public/fonts/Inter-OFL.txtnew file mode 100644index 000000000..9b2ca37b3--- /dev/null+++ b/apps/mirai-gui/client/public/fonts/Inter-OFL.txt@@ -0,0 +1,92 @@+Copyright (c) 2016 The Inter Project Authors (https://github.com/rsms/inter)++This Font Software is licensed under the SIL Open Font License, Version 1.1.+This license is copied below, and is also available with a FAQ at:+http://scripts.sil.org/OFL++-----------------------------------------------------------+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007+-----------------------------------------------------------++PREAMBLE+The goals of the Open Font License (OFL) are to stimulate worldwide+development of collaborative font projects, to support the font creation+efforts of academic and linguistic communities, and to provide a free and+open framework in which fonts may be shared and improved in partnership+with others.++The OFL allows the licensed fonts to be used, studied, modified and+redistributed freely as long as they are not sold by themselves. The+fonts, including any derivative works, can be bundled, embedded,+redistributed and/or sold with any software provided that any reserved+names are not used by derivative works. The fonts and derivatives,+however, cannot be released under any other type of license. The+requirement for fonts to remain under this license does not apply+to any document created using the fonts or their derivatives.++DEFINITIONS+"Font Software" refers to the set of files released by the Copyright+Holder(s) under this license and clearly marked as such. This may+include source files, build scripts and documentation.++"Reserved Font Name" refers to any names specified as such after the+copyright statement(s).++"Original Version" refers to the collection of Font Software components as+distributed by the Copyright Holder(s).++"Modified Version" refers to any derivative made by adding to, deleting,+or substituting -- in part or in whole -- any of the components of the+Original Version, by changing formats or by porting the Font Software to a+new environment.++"Author" refers to any designer, engineer, programmer, technical+writer or other person who contributed to the Font Software.++PERMISSION AND CONDITIONS+Permission is hereby granted, free of charge, to any person obtaining+a copy of the Font Software, to use, study, copy, merge, embed, modify,+redistribute, and sell modified and unmodified copies of the Font+Software, subject to the following conditions:++1) Neither the Font Software nor any of its individual components,+in Original or Modified Versions, may be sold by itself.++2) Original or Modified Versions of the Font Software may be bundled,+redistributed and/or sold with any software, provided that each copy+contains the above copyright notice and this license. These can be+included either as stand-alone text files, human-readable headers or+in the appropriate machine-readable metadata fields within text or+binary files as long as those fields can be easily viewed by the user.++3) No Modified Version of the Font Software may use the Reserved Font+Name(s) unless explicit written permission is granted by the corresponding+Copyright Holder. This restriction only applies to the primary font name as+presented to the users.++4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font+Software shall not be used to promote, endorse or advertise any+Modified Version, except to acknowledge the contribution(s) of the+Copyright Holder(s) and the Author(s) or with their explicit written+permission.++5) The Font Software, modified or unmodified, in part or in whole,+must be distributed entirely under this license, and must not be+distributed under any other license. The requirement for fonts to+remain under this license does not apply to any document created+using the Font Software.++TERMINATION+This license becomes null and void if any of the above conditions are+not met.++DISCLAIMER+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM+OTHER DEALINGS IN THE FONT SOFTWARE.diff --git a/apps/mirai-gui/client/public/fonts/InterVariable-Italic.woff2 b/apps/mirai-gui/client/public/fonts/InterVariable-Italic.woff2new file mode 100644index 000000000..b3530f3f5Binary files /dev/null and b/apps/mirai-gui/client/public/fonts/InterVariable-Italic.woff2 differdiff --git a/apps/mirai-gui/client/public/fonts/InterVariable.woff2 b/apps/mirai-gui/client/public/fonts/InterVariable.woff2new file mode 100644index 000000000..5a8d3e72aBinary files /dev/null and b/apps/mirai-gui/client/public/fonts/InterVariable.woff2 differdiff --git a/apps/mirai-gui/client/public/icons/icon_mirai_app.png b/apps/mirai-gui/client/public/icons/icon_mirai_app.pngnew file mode 100644index 000000000..77e5edffcBinary files /dev/null and b/apps/mirai-gui/client/public/icons/icon_mirai_app.png differdiff --git a/apps/mirai-gui/client/public/rive/loader-dark-mode.riv b/apps/mirai-gui/client/public/rive/loader-dark-mode.rivnew file mode 100644index 000000000..33e57c6e3Binary files /dev/null and b/apps/mirai-gui/client/public/rive/loader-dark-mode.riv differdiff --git a/apps/mirai-gui/client/public/rive/loader-light-mode.riv b/apps/mirai-gui/client/public/rive/loader-light-mode.rivnew file mode 100644index 000000000..a530ad3dfBinary files /dev/null and b/apps/mirai-gui/client/public/rive/loader-light-mode.riv differdiff --git a/apps/mirai-gui/client/src/components/error-page.tsx b/apps/mirai-gui/client/src/components/error-page.tsxnew file mode 100644index 000000000..1784f7cd2--- /dev/null+++ b/apps/mirai-gui/client/src/components/error-page.tsx@@ -0,0 +1,37 @@+import { Button } from "./ui/button";+import { useAppStore } from "@/stores/use-app-store";+import { useRouter } from "@tanstack/react-router";+import { ArrowLeft } from "lucide-react";+import { Logo } from "./icons/logo";+import { LogoLightMode } from "./icons/logo-light-mode";+import { ErrorIcon } from "./icons/error-icon";++export function ErrorPage() {+ const isDarkMode = useAppStore((s) => s.isDarkMode);+ const router = useRouter();++ const handleAction = () => {+ if (window.history.length > 1) router.history.back();+ else router.navigate({ to: "/" });+ };++ return (+ <div className="min-h-screen min-w-[360px] w-full flex flex-col bg-background text-label-title">+ <div className="flex px-8 py-8 justify-center">+ {isDarkMode ? <Logo width={66} height={57} /> : <LogoLightMode width={48} height={24} />}+ </div>+ <div className="flex-1 flex items-center justify-center px-4">+ <div className="flex flex-col items-center gap-10">+ <ErrorIcon color="#FF2020" />+ <div className="flex flex-col items-center justify-center gap-3 text-center">+ <h1 className="text-2xl font-bold">Page Not Found</h1>+ <p className="text-base text-label-muted">An unexpected error occurred</p>+ </div>+ <Button kind="primary" icon={<ArrowLeft size={16} />} onClick={handleAction}>+ Go back+ </Button>+ </div>+ </div>+ </div>+ );+}diff --git a/apps/mirai-gui/client/src/components/footer-bar/footer-runtime-model.ts b/apps/mirai-gui/client/src/components/footer-bar/footer-runtime-model.tsnew file mode 100644index 000000000..617700031--- /dev/null+++ b/apps/mirai-gui/client/src/components/footer-bar/footer-runtime-model.ts@@ -0,0 +1,72 @@+import type { RuntimeSessionState } from "@/stores/use-runtime-session-store";+import type { RuntimeSessionRef } from "@/types/session";++type FooterModelInput = {+ repoId: string;+ name: string;+ vendor?: string;+};++type FooterModelLabel = {+ name: string;+ vendor: string;+};++type RuntimeSessions = Pick<RuntimeSessionState, "residentSession" | "loadingSession" | "ejectingSession">;++export type FooterRuntimeStatus = "hidden" | "loading" | "ejecting" | "ready";++export const getFooterModelLabel = (+ session: RuntimeSessionRef | null,+ chatModels: FooterModelInput[],+): FooterModelLabel => {+ if (!session) {+ return { name: "", vendor: "" };+ }++ const match = chatModels.find((model) => model.repoId === session.repoId);+ return {+ name: match?.name || session.repoId,+ vendor: match?.vendor || "",+ };+};++// Ejecting and loading outrank a resident session: both describe a transition+// away from it.+export const pickFooterActiveSession = (+ sessions: RuntimeSessions,+): {+ session: RuntimeSessionRef | null;+ status: FooterRuntimeStatus;+} => {+ if (sessions.ejectingSession) {+ return { session: sessions.ejectingSession, status: "ejecting" };+ }+ if (sessions.loadingSession) {+ return { session: sessions.loadingSession, status: "loading" };+ }+ if (sessions.residentSession) {+ return { session: sessions.residentSession, status: "ready" };+ }+ return { session: null, status: "hidden" };+};++export const canFooterEjectActiveSession = (+ sessions: RuntimeSessions,+ session: RuntimeSessionRef | null,+ status: FooterRuntimeStatus,+ ejectAwaiting: boolean,+ runtimeBusy: boolean,+): boolean => {+ if (!session || status !== "ready") {+ return false;+ }++ return (+ !!sessions.residentSession &&+ !sessions.loadingSession &&+ !sessions.ejectingSession &&+ !runtimeBusy &&+ !ejectAwaiting+ );+};diff --git a/apps/mirai-gui/client/src/components/footer-bar/index.tsx b/apps/mirai-gui/client/src/components/footer-bar/index.tsxnew file mode 100644index 000000000..b9f4fb7f3--- /dev/null+++ b/apps/mirai-gui/client/src/components/footer-bar/index.tsx@@ -0,0 +1,55 @@+import { useFooterRuntimeModel } from "./use-footer-runtime-model";+import { useAppStore } from "@/stores/use-app-store";+import { ModelVendorIcon } from "@/components/model-vendor-icon";+import React from "react";+import { twMerge } from "tailwind-merge";+import { EjectIcon } from "../icons/eject-icon";+import { Loader } from "../loader";++export const FooterBar = React.memo(({ className }: { className?: string }) => {+ const version = useAppStore((s) => s.appVersion);+ const footerModel = useFooterRuntimeModel();++ return (+ <div+ className={twMerge(+ "bg-bg-sidebar max-h-6 min-h-6 border-t border-cell-border flex items-center justify-between px-5 py-[5px] select-none",+ className,+ )}+ >+ <div className="flex items-center gap-2 overflow-hidden">+ {footerModel.visible && (+ <>+ {footerModel.status === "loading" || footerModel.status === "ejecting" ? (+ <Loader+ showText+ textClassName="text-[11px]"+ iconWidth={8}+ iconHeight={8}+ text={footerModel.status === "ejecting" ? "Ejecting…" : "Initializing model…"}+ />+ ) : (+ <>+ <button+ onClick={footerModel.onEject}+ disabled={!footerModel.canEject}+ className="flex items-center gap-[5px] hover:text-label-title disabled:opacity-50 disabled:cursor-not-allowed"+ >+ <EjectIcon className="text-label-title" />+ <span className="text-[11px] font-[350] leading-[120%]">Eject model</span>+ </button>+ <span className="flex items-center gap-1.5 truncate max-w-[220px]">+ {footerModel.vendor && <ModelVendorIcon vendor={footerModel.vendor} size={12} className="h-3 w-3" />}+ <span className="text-[11px] font-[450] leading-[1.3] truncate text-text-secondary">+ {footerModel.label}+ </span>+ </span>+ </>+ )}+ </>+ )}+ </div>+ {version && <div className="ml-auto text-[11px] font-[450] leading-[1.3] text-text-muted">{version}</div>}+ </div>+ );+});diff --git a/apps/mirai-gui/client/src/components/footer-bar/use-footer-runtime-model.ts b/apps/mirai-gui/client/src/components/footer-bar/use-footer-runtime-model.tsnew file mode 100644index 000000000..bbb42bac5--- /dev/null+++ b/apps/mirai-gui/client/src/components/footer-bar/use-footer-runtime-model.ts@@ -0,0 +1,93 @@+import { useToast } from "@/components/ui/toast/use-toast";+import { ejectRuntimeSessionAndWait } from "@/features/runtime/eject-runtime-session";+import { useModelsStore } from "@/stores/use-models-store";+import { useRuntimeSessionStore } from "@/stores/use-runtime-session-store";+import { useRuntimeBusy } from "@/features/runtime/runtime-busy";+import { runtimeSessionEjectReasons } from "@/types/session";+import {+ canFooterEjectActiveSession,+ getFooterModelLabel,+ pickFooterActiveSession,+ type FooterRuntimeStatus,+} from "./footer-runtime-model";+import { useCallback, useMemo, useState } from "react";++type FooterRuntimeModel =+ | {+ visible: false;+ status: "hidden";+ label: "";+ vendor: "";+ canEject: false;+ onEject: () => Promise<void>;+ }+ | {+ visible: true;+ status: Exclude<FooterRuntimeStatus, "hidden">;+ label: string;+ vendor: string;+ canEject: boolean;+ onEject: () => Promise<void>;+ };++export const useFooterRuntimeModel = (): FooterRuntimeModel => {+ const toast = useToast();+ const chatModels = useModelsStore((state) => state.models);+ const residentSession = useRuntimeSessionStore((state) => state.residentSession);+ const loadingSession = useRuntimeSessionStore((state) => state.loadingSession);+ const ejectingSession = useRuntimeSessionStore((state) => state.ejectingSession);+ const runtimeBusy = useRuntimeBusy();+ const [ejectAwaiting, setEjectAwaiting] = useState(false);++ const sessions = useMemo(+ () => ({ residentSession, loadingSession, ejectingSession }),+ [residentSession, loadingSession, ejectingSession],+ );++ const { session: activeSession, status } = useMemo(() => pickFooterActiveSession(sessions), [sessions]);+ const { name: label, vendor } = useMemo(+ () => getFooterModelLabel(activeSession, chatModels),+ [activeSession, chatModels],+ );++ const onEject = useCallback(async () => {+ if (!residentSession) {+ return;+ }++ setEjectAwaiting(true);+ try {+ const ok = await ejectRuntimeSessionAndWait({+ target: residentSession,+ reason: runtimeSessionEjectReasons.user,+ });+ if (ok) {+ toast.success("Model ejected successfully");+ }+ } catch (error) {+ toast.error(error instanceof Error ? error.message : "Failed to eject model");+ } finally {+ setEjectAwaiting(false);+ }+ }, [residentSession, toast]);++ if (!activeSession || status === "hidden") {+ return {+ visible: false,+ status: "hidden",+ label: "",+ vendor: "",+ canEject: false,+ onEject,+ };+ }++ return {+ visible: true,+ status,+ label,+ vendor,+ canEject: canFooterEjectActiveSession(sessions, activeSession, status, ejectAwaiting, runtimeBusy),+ onEject,+ };+};diff --git a/apps/mirai-gui/client/src/components/icons/chats-icon.tsx b/apps/mirai-gui/client/src/components/icons/chats-icon.tsxnew file mode 100644index 000000000..690449728--- /dev/null+++ b/apps/mirai-gui/client/src/components/icons/chats-icon.tsx@@ -0,0 +1,17 @@+import React from "react";++type ChatsIconProps = React.SVGProps<SVGSVGElement>;++export function ChatsIcon(props: ChatsIconProps) {+ return (+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none" {...props}>+ <path+ d="M13.8681 13.5282C13.8681 13.5282 13.9195 13.4916 14.0015 13.4289C15.2301 12.4789 16.0015 11.1022 16.0015 9.56955C16.0015 6.71222 13.3148 4.39355 10.0015 4.39355C6.68813 4.39355 4.00146 6.71222 4.00146 9.56955C4.00146 12.4282 6.68813 14.6669 10.0015 14.6669C10.2841 14.6669 10.7481 14.6482 11.3935 14.6109C12.2348 15.1576 13.4628 15.6062 14.5375 15.6062C14.8701 15.6062 15.0268 15.3329 14.8135 15.0542C14.4895 14.6569 14.0428 14.0202 13.8695 13.5276L13.8681 13.5282Z"+ stroke="currentColor"+ strokeWidth="1.5"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ </svg>+ );+}diff --git a/apps/mirai-gui/client/src/components/icons/check-circle-filled-icon.tsx b/apps/mirai-gui/client/src/components/icons/check-circle-filled-icon.tsxnew file mode 100644index 000000000..740760ee5--- /dev/null+++ b/apps/mirai-gui/client/src/components/icons/check-circle-filled-icon.tsx@@ -0,0 +1,19 @@+import type { SVGProps } from "react";++export type IconCheckCircleFilledProps = SVGProps<SVGSVGElement> & {+ size?: number;+ color?: string;+};++export function IconCheckCircleFilled({ size = 16, color = "currentColor", ...props }: IconCheckCircleFilledProps) {+ return (+ <svg xmlns="http://www.w3.org/2000/svg" width={size} height={size} viewBox="0 0 16 16" fill="none" {...props}>+ <path+ fillRule="evenodd"+ clipRule="evenodd"+ d="M7.99967 1.33337C11.6815 1.33337 14.6663 4.31814 14.6663 8.00004C14.6663 11.6819 11.6815 14.6667 7.99967 14.6667C4.31777 14.6667 1.33301 11.6819 1.33301 8.00004C1.33301 4.31814 4.31777 1.33337 7.99967 1.33337ZM10.3721 5.44731C10.0667 5.24177 9.65261 5.32241 9.44694 5.62765L6.98147 9.28911L5.80436 8.11204C5.54401 7.85164 5.122 7.85164 4.86165 8.11204C4.6013 8.37237 4.6013 8.79437 4.86165 9.05471L6.61165 10.8047C6.75254 10.9456 6.94921 11.016 7.14747 10.9968C7.34554 10.9775 7.52454 10.8708 7.63574 10.7058L10.5524 6.37243C10.7579 6.06707 10.6773 5.65295 10.3721 5.44731Z"+ fill={color}+ />+ </svg>+ );+}diff --git a/apps/mirai-gui/client/src/components/icons/check-stroke-icon.tsx b/apps/mirai-gui/client/src/components/icons/check-stroke-icon.tsxnew file mode 100644index 000000000..1b3f82941--- /dev/null+++ b/apps/mirai-gui/client/src/components/icons/check-stroke-icon.tsx@@ -0,0 +1,11 @@+import type { SVGProps } from "react";++export type IconCheckStrokeProps = SVGProps<SVGSVGElement> & { size?: number; color?: string };++export function IconCheckStroke({ size = 16, color = "currentColor", ...props }: IconCheckStrokeProps) {+ return (+ <svg width={size} height={size} viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>+ <path d="M3 9L6 12L13 4" stroke={color} strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />+ </svg>+ );+}diff --git a/apps/mirai-gui/client/src/components/icons/checkmark-icon.tsx b/apps/mirai-gui/client/src/components/icons/checkmark-icon.tsxnew file mode 100644index 000000000..b4ca2be7a--- /dev/null+++ b/apps/mirai-gui/client/src/components/icons/checkmark-icon.tsx@@ -0,0 +1,20 @@+import type { SVGProps } from "react";++export type IconCheckmarkProps = SVGProps<SVGSVGElement> & {+ size?: number;+ color?: string;+};++export function IconCheckmark({ size = 16, color = "currentColor", strokeWidth, ...props }: IconCheckmarkProps) {+ return (+ <svg xmlns="http://www.w3.org/2000/svg" width={size} height={size} viewBox="0 0 20 20" fill="none" {...props}>+ <path+ d="M5 10l3.5 3.5L15 7"+ stroke={color}+ strokeWidth={strokeWidth ?? 1.5}+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ </svg>+ );+}diff --git a/apps/mirai-gui/client/src/components/icons/code-icon.tsx b/apps/mirai-gui/client/src/components/icons/code-icon.tsxnew file mode 100644index 000000000..ec3da5a04--- /dev/null+++ b/apps/mirai-gui/client/src/components/icons/code-icon.tsx@@ -0,0 +1,26 @@+import React from "react";++type CodeIconProps = {+ className?: string;+};++export const CodeIcon: React.FC<CodeIconProps> = ({ className }) => {+ return (+ <svg+ width="16"+ height="16"+ viewBox="0 0 16 16"+ fill="none"+ xmlns="http://www.w3.org/2000/svg"+ className={className}+ >+ <path+ d="M4.11111 4.88845L1 7.99957L4.11111 11.1107M11.8889 4.88845L15 7.99957L11.8889 11.1107M9.55556 1.77734L6.44444 14.2218"+ stroke="currentColor"+ strokeWidth="1.75"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ </svg>+ );+};diff --git a/apps/mirai-gui/client/src/components/icons/discord-icon.tsx b/apps/mirai-gui/client/src/components/icons/discord-icon.tsxnew file mode 100644index 000000000..d2624004f--- /dev/null+++ b/apps/mirai-gui/client/src/components/icons/discord-icon.tsx@@ -0,0 +1,12 @@+import React from "react";++const DiscordIcon: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (+ <svg xmlns="http://www.w3.org/2000/svg" width="19" height="15" viewBox="0 0 19 15" fill="none" {...props}>+ <path+ d="M15.3202 1.6725C14.1495 1.12475 12.8977 0.72667 11.589 0.5C11.4283 0.790583 11.2405 1.18142 11.1111 1.49234C9.71987 1.28312 8.34148 1.28312 6.97588 1.49234C6.84644 1.18142 6.6544 0.790583 6.49224 0.5C5.18213 0.72667 3.92891 1.12621 2.7582 1.6754C0.39686 5.24369 -0.243259 8.72334 0.0768009 12.1536C1.64296 13.3232 3.16076 14.0336 4.65295 14.4986C5.02138 13.9915 5.34997 13.4525 5.63304 12.8844C5.09392 12.6795 4.57756 12.4267 4.08966 12.1333C4.21909 12.0374 4.34571 11.9371 4.46803 11.834C7.44387 13.2258 10.6772 13.2258 13.6175 11.834C13.7412 11.9371 13.8678 12.0374 13.9959 12.1333C13.5065 12.4282 12.9887 12.681 12.4496 12.8859C12.7327 13.4525 13.0599 13.993 13.4297 14.5C14.9233 14.0351 16.4425 13.3246 18.0087 12.1536C18.3843 8.17706 17.3672 4.72936 15.3202 1.6725ZM6.03846 10.044C5.14514 10.044 4.41254 9.21005 4.41254 8.19449C4.41254 7.17892 5.12949 6.34352 6.03846 6.34352C6.94744 6.34352 7.68001 7.17746 7.66437 8.19449C7.66578 9.21005 6.94744 10.044 6.03846 10.044ZM12.0471 10.044C11.1537 10.044 10.4212 9.21005 10.4212 8.19449C10.4212 7.17892 11.1381 6.34352 12.0471 6.34352C12.956 6.34352 13.6886 7.17746 13.673 8.19449C13.673 9.21005 12.956 10.044 12.0471 10.044Z"+ fill="currentColor"+ />+ </svg>+);++export default DiscordIcon;diff --git a/apps/mirai-gui/client/src/components/icons/eject-icon.tsx b/apps/mirai-gui/client/src/components/icons/eject-icon.tsxnew file mode 100644index 000000000..741ebf039--- /dev/null+++ b/apps/mirai-gui/client/src/components/icons/eject-icon.tsx@@ -0,0 +1,11 @@+import React from "react";++export const EjectIcon: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (+ <svg width="7" height="8" viewBox="0 0 7 8" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>+ <path d="M0 4H7L3.5 0L0 4Z" fill="currentColor" />+ <path+ d="M0 6.5C0 6.36739 0.0526785 6.24021 0.146447 6.14645C0.240215 6.05268 0.367392 6 0.5 6H6.5C6.63261 6 6.75979 6.05268 6.85355 6.14645C6.94732 6.24021 7 6.36739 7 6.5V7.5C7 7.63261 6.94732 7.75979 6.85355 7.85355C6.75979 7.94732 6.63261 8 6.5 8H0.5C0.367392 8 0.240215 7.94732 0.146447 7.85355C0.0526785 7.75979 0 7.63261 0 7.5V6.5Z"+ fill="currentColor"+ />+ </svg>+);diff --git a/apps/mirai-gui/client/src/components/icons/error-icon.tsx b/apps/mirai-gui/client/src/components/icons/error-icon.tsxnew file mode 100644index 000000000..718e523bd--- /dev/null+++ b/apps/mirai-gui/client/src/components/icons/error-icon.tsx@@ -0,0 +1,75 @@+type Props = {+ color: string;+ width?: number;+ height?: number;+};++export function ErrorIcon({ color, width = 97, height = 96 }: Props) {+ return (+ <svg xmlns="http://www.w3.org/2000/svg" width={width} height={height} viewBox="0 0 97 96" fill="none">+ <path+ d="M48.5107 57.2459L67.3772 89.8375L59.8192 94.1005L41.0016 61.5171L40.5134 60.6709L36.8524 62.7537L21.0775 71.7354L13.5195 58.7429L32.9555 47.6216L13.5195 14.2087L21.0775 9.9375L40.5134 43.4479L48.7629 38.6885L56.2395 34.3687L59.8192 32.3022L60.3643 33.2459L67.3772 45.2947L47.9412 56.2696L48.5107 57.2459Z"+ fill={color}+ fillOpacity="0.08"+ stroke={color}+ strokeWidth="0.813559"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ <path+ d="M41.0022 61.5181L37.3493 63.6008L21.0781 71.7364L36.853 62.7547L40.5141 60.6719L41.0022 61.5181Z"+ fill={color}+ fillOpacity="0.08"+ stroke={color}+ strokeWidth="0.813559"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ <path+ d="M83.6495 37.1595L67.3783 45.295L60.3654 33.2462L59.8203 32.3026L76.0915 24.167L83.6495 37.1595Z"+ fill={color}+ fillOpacity="0.08"+ stroke={color}+ strokeWidth="0.813559"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ <path+ d="M83.6485 81.7026L75.8709 85.5914L67.3773 89.8382L48.5109 57.2466L47.9414 56.2704L64.2126 48.1348L83.6485 81.7026Z"+ fill={color}+ fillOpacity="0.08"+ stroke={color}+ strokeWidth="0.813559"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ <path+ d="M83.6495 81.7021L76.0915 85.9652L59.8203 94.1008L67.3783 89.8377L75.8718 85.591L83.6495 81.7021Z"+ fill={color}+ fillOpacity="0.08"+ stroke={color}+ strokeWidth="0.813559"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ <path+ d="M83.6485 37.1602L64.2126 48.1351L47.9414 56.2707L67.3773 45.2957L83.6485 37.1602Z"+ fill={color}+ fillOpacity="0.08"+ stroke={color}+ strokeWidth="0.813559"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ <path+ d="M56.2402 34.3695L48.7635 38.6894L40.5141 43.4488L21.0781 9.93834L37.3493 1.80273L56.2402 34.3695Z"+ fill={color}+ fillOpacity="0.08"+ stroke={color}+ strokeWidth="0.813559"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ </svg>+ );+}diff --git a/apps/mirai-gui/client/src/components/icons/github-icon.tsx b/apps/mirai-gui/client/src/components/icons/github-icon.tsxnew file mode 100644index 000000000..e021f3fe3--- /dev/null+++ b/apps/mirai-gui/client/src/components/icons/github-icon.tsx@@ -0,0 +1,14 @@+import React from "react";++const GithubIcon: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (+ <svg xmlns="http://www.w3.org/2000/svg" width="17" height="17" viewBox="0 0 17 17" fill="none" {...props}>+ <path+ fillRule="evenodd"+ clipRule="evenodd"+ d="M8.33987 0.5C3.91242 0.5 0.333252 4.16665 0.333252 8.7028C0.333252 12.3288 2.62655 15.3981 5.80795 16.4844C6.20571 16.5661 6.35141 16.3079 6.35141 16.0908C6.35141 15.9006 6.3383 15.2488 6.3383 14.5696C4.11105 15.0586 3.64725 13.5918 3.64725 13.5918C3.28931 12.6411 2.75897 12.3968 2.75897 12.3968C2.02999 11.8943 2.81207 11.8943 2.81207 11.8943C3.6207 11.9486 4.045 12.7363 4.045 12.7363C4.76071 13.9856 5.91399 13.6326 6.37796 13.4153C6.44417 12.8856 6.65641 12.5189 6.88175 12.3153C5.10536 12.1251 3.23638 11.419 3.23638 8.26813C3.23638 7.3718 3.55432 6.63847 4.05812 6.06814C3.97863 5.86448 3.70018 5.02231 4.13776 3.89515C4.13776 3.89515 4.81381 3.67782 6.33813 4.73715C6.99075 4.55759 7.66379 4.46625 8.33987 4.46548C9.01591 4.46548 9.70506 4.56065 10.3414 4.73715C11.8659 3.67782 12.542 3.89515 12.542 3.89515C12.9796 5.02231 12.7009 5.86448 12.6215 6.06814C13.1385 6.63847 13.4434 7.3718 13.4434 8.26813C13.4434 11.419 11.5744 12.1115 9.78471 12.3153C10.0764 12.5733 10.3282 13.0621 10.3282 13.8363C10.3282 14.9363 10.3151 15.8191 10.3151 16.0906C10.3151 16.3079 10.4609 16.5661 10.8585 16.4846C14.0399 15.3979 16.3332 12.3288 16.3332 8.7028C16.3463 4.16665 12.7541 0.5 8.33987 0.5Z"+ fill="currentColor"+ />+ </svg>+);++export default GithubIcon;diff --git a/apps/mirai-gui/client/src/components/icons/lightning-icon.tsx b/apps/mirai-gui/client/src/components/icons/lightning-icon.tsxnew file mode 100644index 000000000..8bd146eab--- /dev/null+++ b/apps/mirai-gui/client/src/components/icons/lightning-icon.tsx@@ -0,0 +1,16 @@+import React from "react";++type LightningIconProps = {+ className?: string;+};++export const LightningIcon: React.FC<LightningIconProps> = ({ className }) => (+ <svg xmlns="http://www.w3.org/2000/svg" width="14" height="15" viewBox="0 0 14 15" fill="none" className={className}>+ <path+ fillRule="evenodd"+ clipRule="evenodd"+ d="M7.81546 1.13128C8.053 1.2344 8.19413 1.48177 8.16201 1.73873L7.66063 5.74971H12.2498C12.4762 5.74971 12.6821 5.88064 12.7781 6.08562C12.8741 6.29059 12.8429 6.5326 12.698 6.70648L6.86464 13.7065C6.69886 13.9054 6.42177 13.9712 6.18423 13.8681C5.94669 13.765 5.80556 13.5176 5.83768 13.2607L6.33905 9.24971H1.74984C1.5235 9.24971 1.31759 9.11877 1.22158 8.9138C1.12558 8.70882 1.15681 8.46681 1.30172 8.29293L7.13505 1.29293C7.30083 1.094 7.57791 1.02817 7.81546 1.13128ZM2.99529 8.08304H6.99984C7.16716 8.08304 7.32643 8.15489 7.43716 8.28032C7.54789 8.40576 7.59943 8.5727 7.57867 8.73873L7.24213 11.4311L11.0044 6.91637H6.99984C6.83253 6.91637 6.67326 6.84453 6.56253 6.71909C6.4518 6.59366 6.40026 6.42671 6.42102 6.26069L6.75756 3.56831L2.99529 8.08304Z"+ fill="currentColor"+ />+ </svg>+);diff --git a/apps/mirai-gui/client/src/components/icons/logo-light-mode.tsx b/apps/mirai-gui/client/src/components/icons/logo-light-mode.tsxnew file mode 100644index 000000000..408dc5ccc--- /dev/null+++ b/apps/mirai-gui/client/src/components/icons/logo-light-mode.tsx@@ -0,0 +1,16 @@+import { type SVGProps } from "react";++export const LogoLightMode = (props: SVGProps<SVGSVGElement>) => {+ return (+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 24" fill="none" {...props}>+ <path+ d="M8.14441 1.07744V20.9293C8.14441 21.3423 8.20672 21.6655 8.33133 21.899C8.47375 22.1145 8.69627 22.2671 8.9989 22.3569L10.2539 22.5993C10.61 22.743 10.788 22.9764 10.788 23.2997C10.788 23.7666 10.5299 24 10.0136 24H0.98801C0.738782 24 0.542961 23.9372 0.400545 23.8115C0.258129 23.6857 0.186921 23.5152 0.186921 23.2997C0.186921 23.1201 0.231426 22.9675 0.320436 22.8418C0.427248 22.7161 0.578565 22.6083 0.774386 22.5185L2.08283 22.2761C2.38547 22.1863 2.59909 22.0426 2.7237 21.8451C2.84832 21.6476 2.91062 21.3513 2.91062 20.9562V4.60606C2.91062 4.28283 2.85722 4.04938 2.75041 3.90572C2.6614 3.76207 2.50118 3.6633 2.26975 3.60943L0.587466 3.58249C0.391644 3.51066 0.240327 3.42087 0.133515 3.31313C0.044505 3.20539 0 3.07071 0 2.90909C0 2.72952 0.062307 2.57688 0.186921 2.45118C0.311535 2.30752 0.516258 2.1908 0.801089 2.10101L5.92806 0.484848C6.3019 0.341189 6.58674 0.251403 6.78256 0.215489C6.97838 0.179574 7.1653 0.161616 7.34332 0.161616C7.61035 0.161616 7.80617 0.251402 7.93078 0.430975C8.0732 0.592592 8.14441 0.808081 8.14441 1.07744ZM7.61035 6.51852L6.88937 5.6835L7.87738 4.71381C9.60417 2.9899 11.1885 1.77778 12.6305 1.07744C14.0903 0.359148 15.4877 0 16.8229 0C18.6743 0 20.1786 0.601572 21.3357 1.80471C22.4928 2.9899 23.0714 4.74972 23.0714 7.08418V20.9024C23.0714 21.3513 23.1337 21.6925 23.2583 21.9259C23.4007 22.1414 23.6321 22.2941 23.9526 22.3838L25.0474 22.5993C25.3856 22.7609 25.5547 22.9944 25.5547 23.2997C25.5547 23.7666 25.2877 24 24.7537 24H15.915C15.4165 24 15.1673 23.7666 15.1673 23.2997C15.1673 22.9764 15.3453 22.743 15.7014 22.5993L16.9297 22.3569C17.3035 22.2492 17.5439 22.0786 17.6507 21.8451C17.7753 21.5937 17.8376 21.2346 17.8376 20.7677V8.05387C17.8376 6.45567 17.4548 5.24355 16.6894 4.41751C15.9417 3.59147 14.9626 3.17845 13.752 3.17845C12.9153 3.17845 12.0608 3.37598 11.1885 3.77104C10.3163 4.14815 9.41725 4.78564 8.49155 5.6835L7.61035 6.51852ZM22.4038 6.3569L21.6828 5.54882L22.6441 4.55219C24.1751 2.93603 25.5726 1.77778 26.8365 1.07744C28.1004 0.359148 29.3733 0 30.655 0C32.4174 0 33.7971 0.574636 34.794 1.72391C35.8087 2.85522 36.4585 4.53423 36.7433 6.76094L38.6125 20.8754C38.6659 21.3244 38.7549 21.6566 38.8795 21.8721C39.0219 22.0875 39.2445 22.2402 39.5471 22.33L40.7287 22.6088C40.9068 22.6986 40.9268 22.743 41.0158 22.8687C41.1226 22.9764 41.176 23.1201 41.176 23.2997C41.176 23.5152 41.1048 23.6857 40.9624 23.8115C40.8378 23.9372 40.6419 24 40.3749 24H31.3493C30.8508 24 30.6016 23.7666 30.6016 23.2997C30.6016 22.9944 30.7796 22.7609 31.1357 22.5993L32.364 22.3569C32.7379 22.2671 32.996 22.0965 33.1384 21.8451C33.2986 21.5937 33.352 21.2435 33.2986 20.7946L31.5896 8.08081C31.376 6.44669 30.9577 5.22559 30.3346 4.41751C29.7115 3.59147 28.8214 3.17845 27.6643 3.17845C26.97 3.17845 26.2668 3.367 25.5547 3.74411C24.8605 4.10326 24.095 4.68687 23.2583 5.49495L22.4038 6.3569Z"+ fill="black"+ />+ <path+ d="M41.4964 4.21549C41.0695 3.78548 41.0695 3.0883 41.4964 2.6583L43.8154 0.322505C44.2423 -0.107502 44.9344 -0.107502 45.3613 0.322506L47.6802 2.6583C48.1071 3.0883 48.1071 3.78548 47.6802 4.21549L45.3613 6.55128C44.9344 6.98129 44.2423 6.98129 43.8154 6.55128L41.4964 4.21549Z"+ fill="black"+ />+ </svg>+ );+};diff --git a/apps/mirai-gui/client/src/components/icons/logo.tsx b/apps/mirai-gui/client/src/components/icons/logo.tsxnew file mode 100644index 000000000..9c9ef789c--- /dev/null+++ b/apps/mirai-gui/client/src/components/icons/logo.tsx@@ -0,0 +1,246 @@+import { type SVGProps } from "react";++export const Logo = (props: SVGProps<SVGSVGElement>) => {+ return (+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 66 57" fill="none" {...props}>+ <g opacity="0.7" filter="url(#filter0_dddd_324_18399)">+ <path+ d="M10.1444 17.0774V36.9292C10.1444 37.3422 10.2067 37.6654 10.3313 37.8989C10.4737 38.1144 10.6962 38.267 10.9989 38.3568L12.2539 38.5992C12.6099 38.7429 12.7879 38.9763 12.7879 39.2995C12.7879 39.7664 12.5298 39.9999 12.0136 39.9999H2.988C2.73878 39.9999 2.54296 39.937 2.40054 39.8113C2.25813 39.6856 2.18692 39.515 2.18692 39.2995C2.18692 39.12 2.23142 38.9673 2.32043 38.8416C2.42725 38.7159 2.57856 38.6082 2.77438 38.5184L4.08282 38.276C4.38545 38.1862 4.59908 38.0425 4.72369 37.845C4.8483 37.6475 4.91061 37.3512 4.91061 36.9561V20.606C4.91061 20.2828 4.8572 20.0494 4.75039 19.9057C4.66138 19.762 4.50116 19.6633 4.26974 19.6094L2.58746 19.5825C2.39164 19.5106 2.24033 19.4209 2.13351 19.3131C2.0445 19.2054 2 19.0707 2 18.9091C2 18.7295 2.06231 18.5769 2.18692 18.4512C2.31153 18.3075 2.51625 18.1908 2.80108 18.101L7.92803 16.4848C8.30187 16.3412 8.5867 16.2514 8.78252 16.2155C8.97834 16.1796 9.16526 16.1616 9.34328 16.1616C9.61031 16.1616 9.80613 16.2514 9.93074 16.431C10.0732 16.5926 10.1444 16.8081 10.1444 17.0774ZM9.61031 22.5185L8.88933 21.6835L9.87733 20.7138C11.6041 18.9899 13.1885 17.7778 14.6304 17.0774C16.0902 16.3591 17.4876 16 18.8228 16C20.6742 16 22.1784 16.6016 23.3356 17.8047C24.4927 18.9899 25.0712 20.7497 25.0712 23.0841V36.9022C25.0712 37.3512 25.1336 37.6924 25.2582 37.9258C25.4006 38.1413 25.632 38.2939 25.9524 38.3837L27.0473 38.5992C27.3855 38.7608 27.5546 38.9943 27.5546 39.2995C27.5546 39.7664 27.2876 39.9999 26.7535 39.9999H17.9149C17.4164 39.9999 17.1672 39.7664 17.1672 39.2995C17.1672 38.9763 17.3452 38.7429 17.7013 38.5992L18.9296 38.3568C19.3034 38.249 19.5438 38.0784 19.6506 37.845C19.7752 37.5936 19.8375 37.2344 19.8375 36.7676V24.0538C19.8375 22.4556 19.4547 21.2435 18.6893 20.4175C17.9416 19.5914 16.9625 19.1784 15.752 19.1784C14.9153 19.1784 14.0608 19.376 13.1885 19.771C12.3162 20.1481 11.4172 20.7856 10.4915 21.6835L9.61031 22.5185ZM24.4037 22.3569L23.6827 21.5488L24.644 20.5522C26.175 18.936 27.5724 17.7778 28.8363 17.0774C30.1003 16.3591 31.3731 16 32.6548 16C34.4172 16 35.7969 16.5746 36.7938 17.7239C37.8085 18.8552 38.4583 20.5342 38.7431 22.7609L40.6123 36.8753C40.6657 37.3242 40.7547 37.6564 40.8793 37.8719C41.0217 38.0874 41.2443 38.2401 41.5469 38.3298L42.7285 38.6087C42.9065 38.6985 42.9265 38.7429 43.0155 38.8686C43.1223 38.9763 43.1758 39.12 43.1758 39.2995C43.1758 39.515 43.1045 39.6856 42.9621 39.8113C42.8375 39.937 42.6417 39.9999 42.3747 39.9999H33.3491C32.8507 39.9999 32.6014 39.7664 32.6014 39.2995C32.6014 38.9943 32.7795 38.7608 33.1355 38.5992L34.3638 38.3568C34.7377 38.267 34.9958 38.0964 35.1382 37.845C35.2984 37.5936 35.3518 37.2434 35.2984 36.7945L33.5894 24.0808C33.3758 22.4467 32.9575 21.2256 32.3344 20.4175C31.7113 19.5914 30.8213 19.1784 29.6641 19.1784C28.9699 19.1784 28.2667 19.367 27.5546 19.7441C26.8603 20.1032 26.0949 20.6868 25.2582 21.4949L24.4037 22.3569Z"+ fill="url(#paint0_linear_324_18399)"+ />+ <path+ d="M32.6553 15.9336C34.4329 15.9337 35.8313 16.5142 36.8428 17.6797H36.8438C37.8706 18.8247 38.5238 20.5183 38.8096 22.752L40.6787 36.8662V36.8672C40.7318 37.3133 40.8197 37.6352 40.9375 37.8389C41.0691 38.0358 41.2751 38.1787 41.5625 38.2646L42.7441 38.5439L42.752 38.5459L42.7588 38.5488C42.8504 38.595 42.9067 38.6327 42.9521 38.6777C42.9959 38.7211 43.0283 38.7708 43.0703 38.8301H43.0693C43.1857 38.9516 43.2422 39.1101 43.2422 39.2998C43.2421 39.5298 43.1652 39.7176 43.0088 39.8574C42.8666 40.0009 42.6507 40.0664 42.375 40.0664H33.3486C33.0904 40.0663 32.8847 40.0056 32.7432 39.873C32.6008 39.7397 32.5352 39.5446 32.5352 39.2998C32.5352 39.1334 32.5836 38.9842 32.6816 38.8555C32.7792 38.7276 32.9236 38.622 33.1084 38.5381L33.1152 38.5352L33.123 38.5342L34.3506 38.291C34.7111 38.204 34.9497 38.0423 35.0801 37.8125L35.082 37.8096C35.2305 37.5766 35.2846 37.2442 35.2324 36.8037L33.5234 24.0898C33.3238 22.563 32.9458 21.4057 32.3945 20.6123L32.2812 20.458C31.6724 19.6508 30.8031 19.2451 29.6641 19.2451C28.9824 19.2451 28.2899 19.43 27.5859 19.8027L27.585 19.8037C26.8986 20.1588 26.1386 20.7376 25.3047 21.543L25.0703 21.7783C25.1145 22.1921 25.1377 22.6272 25.1377 23.084V36.9023C25.1377 37.3458 25.2 37.6734 25.3164 37.8926C25.4479 38.0893 25.6631 38.2331 25.9707 38.3193H25.9697L27.0605 38.5342L27.0684 38.5352L27.0762 38.5391C27.2523 38.6232 27.3887 38.7285 27.4814 38.8564C27.5747 38.9852 27.6211 39.134 27.6211 39.2998C27.621 39.5458 27.5505 39.742 27.3984 39.875C27.248 40.0065 27.029 40.0664 26.7539 40.0664H17.915C17.6566 40.0664 17.4502 40.0057 17.3086 39.873C17.1663 39.7397 17.1006 39.5445 17.1006 39.2998C17.1006 39.1251 17.1493 38.9713 17.248 38.8418C17.3462 38.7131 17.491 38.6121 17.6768 38.5371L17.6885 38.5322V38.5332L18.917 38.291C19.2783 38.1858 19.495 38.0245 19.5898 37.8174L19.5908 37.8154L19.6328 37.7207C19.7236 37.4885 19.7705 37.1721 19.7705 36.7676V24.0537C19.7705 22.4655 19.3905 21.2722 18.6406 20.4629L18.6396 20.4619C17.9058 19.6513 16.9453 19.2451 15.752 19.2451C14.926 19.2451 14.0807 19.4403 13.2158 19.832H13.2148C12.3521 20.205 11.4599 20.8373 10.5381 21.7314H10.5371L10.2109 22.04V36.9287C10.2109 37.3342 10.2715 37.6446 10.3877 37.8643C10.5188 38.0616 10.7248 38.2047 11.0117 38.291L12.2666 38.5342L12.2793 38.5361L12.2539 38.5986L12.2793 38.5371C12.4649 38.612 12.6089 38.7132 12.707 38.8418C12.8058 38.9713 12.8545 39.1251 12.8545 39.2998C12.8544 39.5452 12.786 39.7408 12.6387 39.874C12.4926 40.0061 12.2804 40.0664 12.0137 40.0664H2.98828C2.72799 40.0664 2.51443 40.0008 2.35645 39.8613C2.19774 39.7213 2.12018 39.5314 2.12012 39.2998C2.12012 39.1088 2.16738 38.9415 2.26562 38.8027L2.26953 38.7979C2.38425 38.663 2.54514 38.5506 2.74707 38.458L2.75391 38.4541L2.7627 38.4531L4.06641 38.21C4.3573 38.1231 4.55399 37.9885 4.66699 37.8096C4.7817 37.6277 4.84375 37.3463 4.84375 36.9561V20.6064C4.84375 20.2875 4.79096 20.0714 4.69727 19.9453L4.69336 19.9414V19.9404C4.61712 19.8177 4.47658 19.7263 4.25684 19.6748L2.58594 19.6494H2.5752L2.56445 19.6455C2.36272 19.5715 2.2017 19.4771 2.08594 19.3604L2.08203 19.3555C1.98172 19.234 1.93361 19.0836 1.93359 18.9092C1.93359 18.7137 2.00146 18.5451 2.13672 18.4072L2.19141 18.3506C2.32825 18.2209 2.52702 18.1173 2.78125 18.0371L7.9082 16.4209C8.28081 16.2779 8.5691 16.1873 8.77051 16.1504C8.96984 16.1138 9.16126 16.0947 9.34375 16.0947C9.62518 16.0948 9.84249 16.1907 9.98242 16.3896C10.1366 16.5659 10.2109 16.7972 10.2109 17.0771V20.2969C11.7944 18.7664 13.2561 17.6707 14.6006 17.0176C16.0675 16.2958 17.4759 15.9336 18.8232 15.9336C20.69 15.9337 22.2119 16.5407 23.3828 17.7578C24.0362 18.427 24.5059 19.2757 24.7939 20.3008C26.2504 18.7894 27.5864 17.6941 28.8037 17.0195L29.042 16.8877C30.2364 16.2519 31.4414 15.9336 32.6553 15.9336Z"+ stroke="url(#paint1_linear_324_18399)"+ strokeOpacity="0.2"+ strokeWidth="0.133333"+ />+ </g>+ <g style={{ mixBlendMode: "overlay" }} filter="url(#filter1_ii_324_18399)">+ <path+ d="M10.1444 17.0774V36.9292C10.1444 37.3422 10.2067 37.6654 10.3313 37.8989C10.4737 38.1144 10.6962 38.267 10.9989 38.3568L12.2539 38.5992C12.6099 38.7429 12.7879 38.9763 12.7879 39.2995C12.7879 39.7664 12.5298 39.9999 12.0136 39.9999H2.988C2.73878 39.9999 2.54296 39.937 2.40054 39.8113C2.25813 39.6856 2.18692 39.515 2.18692 39.2995C2.18692 39.12 2.23142 38.9673 2.32043 38.8416C2.42725 38.7159 2.57856 38.6082 2.77438 38.5184L4.08282 38.276C4.38545 38.1862 4.59908 38.0425 4.72369 37.845C4.8483 37.6475 4.91061 37.3512 4.91061 36.9561V20.606C4.91061 20.2828 4.8572 20.0494 4.75039 19.9057C4.66138 19.762 4.50116 19.6633 4.26974 19.6094L2.58746 19.5825C2.39164 19.5106 2.24033 19.4209 2.13351 19.3131C2.0445 19.2054 2 19.0707 2 18.9091C2 18.7295 2.06231 18.5769 2.18692 18.4512C2.31153 18.3075 2.51625 18.1908 2.80108 18.101L7.92803 16.4848C8.30187 16.3412 8.5867 16.2514 8.78252 16.2155C8.97834 16.1796 9.16526 16.1616 9.34328 16.1616C9.61031 16.1616 9.80613 16.2514 9.93074 16.431C10.0732 16.5926 10.1444 16.8081 10.1444 17.0774ZM9.61031 22.5185L8.88933 21.6835L9.87733 20.7138C11.6041 18.9899 13.1885 17.7778 14.6304 17.0774C16.0902 16.3591 17.4876 16 18.8228 16C20.6742 16 22.1784 16.6016 23.3356 17.8047C24.4927 18.9899 25.0712 20.7497 25.0712 23.0841V36.9022C25.0712 37.3512 25.1336 37.6924 25.2582 37.9258C25.4006 38.1413 25.632 38.2939 25.9524 38.3837L27.0473 38.5992C27.3855 38.7608 27.5546 38.9943 27.5546 39.2995C27.5546 39.7664 27.2876 39.9999 26.7535 39.9999H17.9149C17.4164 39.9999 17.1672 39.7664 17.1672 39.2995C17.1672 38.9763 17.3452 38.7429 17.7013 38.5992L18.9296 38.3568C19.3034 38.249 19.5438 38.0784 19.6506 37.845C19.7752 37.5936 19.8375 37.2344 19.8375 36.7676V24.0538C19.8375 22.4556 19.4547 21.2435 18.6893 20.4175C17.9416 19.5914 16.9625 19.1784 15.752 19.1784C14.9153 19.1784 14.0608 19.376 13.1885 19.771C12.3162 20.1481 11.4172 20.7856 10.4915 21.6835L9.61031 22.5185ZM24.4037 22.3569L23.6827 21.5488L24.644 20.5522C26.175 18.936 27.5724 17.7778 28.8363 17.0774C30.1003 16.3591 31.3731 16 32.6548 16C34.4172 16 35.7969 16.5746 36.7938 17.7239C37.8085 18.8552 38.4583 20.5342 38.7431 22.7609L40.6123 36.8753C40.6657 37.3242 40.7547 37.6564 40.8793 37.8719C41.0217 38.0874 41.2443 38.2401 41.5469 38.3298L42.7285 38.6087C42.9065 38.6985 42.9265 38.7429 43.0155 38.8686C43.1223 38.9763 43.1758 39.12 43.1758 39.2995C43.1758 39.515 43.1045 39.6856 42.9621 39.8113C42.8375 39.937 42.6417 39.9999 42.3747 39.9999H33.3491C32.8507 39.9999 32.6014 39.7664 32.6014 39.2995C32.6014 38.9943 32.7795 38.7608 33.1355 38.5992L34.3638 38.3568C34.7377 38.267 34.9958 38.0964 35.1382 37.845C35.2984 37.5936 35.3518 37.2434 35.2984 36.7945L33.5894 24.0808C33.3758 22.4467 32.9575 21.2256 32.3344 20.4175C31.7113 19.5914 30.8213 19.1784 29.6641 19.1784C28.9699 19.1784 28.2667 19.367 27.5546 19.7441C26.8603 20.1032 26.0949 20.6868 25.2582 21.4949L24.4037 22.3569Z"+ fill="#D9D9D9"+ fillOpacity="0.01"+ />+ </g>+ <g style={{ mixBlendMode: "difference" }} filter="url(#filter2_f_324_18399)">+ <path+ d="M43.4962 20.2155C43.0693 19.7855 43.0693 19.0883 43.4962 18.6583L45.8151 16.3225C46.242 15.8925 46.9341 15.8925 47.361 16.3225L49.6799 18.6583C50.1068 19.0883 50.1068 19.7855 49.6799 20.2155L47.361 22.5512C46.9341 22.9812 46.242 22.9812 45.8151 22.5512L43.4962 20.2155Z"+ fill="currentColor"+ />+ </g>+ <g style={{ mixBlendMode: "difference" }} filter="url(#filter3_f_324_18399)">+ <path+ d="M43.4962 20.2155C43.0693 19.7855 43.0693 19.0883 43.4962 18.6583L45.8151 16.3225C46.242 15.8925 46.9341 15.8925 47.361 16.3225L49.6799 18.6583C50.1068 19.0883 50.1068 19.7855 49.6799 20.2155L47.361 22.5512C46.9341 22.9812 46.242 22.9812 45.8151 22.5512L43.4962 20.2155Z"+ fill="currentColor"+ />+ </g>+ <g style={{ mixBlendMode: "difference" }} filter="url(#filter4_f_324_18399)">+ <path+ d="M43.4962 20.2155C43.0693 19.7855 43.0693 19.0883 43.4962 18.6583L45.8151 16.3225C46.242 15.8925 46.9341 15.8925 47.361 16.3225L49.6799 18.6583C50.1068 19.0883 50.1068 19.7855 49.6799 20.2155L47.361 22.5512C46.9341 22.9812 46.242 22.9812 45.8151 22.5512L43.4962 20.2155Z"+ fill="currentColor"+ />+ </g>+ <g style={{ mixBlendMode: "overlay" }} filter="url(#filter5_iii_324_18399)">+ <path+ d="M43.4962 20.2155C43.0693 19.7855 43.0693 19.0883 43.4962 18.6583L45.8151 16.3225C46.242 15.8925 46.9341 15.8925 47.361 16.3225L49.6799 18.6583C50.1068 19.0883 50.1068 19.7855 49.6799 20.2155L47.361 22.5512C46.9341 22.9812 46.242 22.9812 45.8151 22.5512L43.4962 20.2155Z"+ fill="currentColor"+ fillOpacity="0.01"+ />+ </g>+ <defs>+ <filter+ id="filter0_dddd_324_18399"+ x="0.533373"+ y="14.5334"+ width="59.5756"+ height="41.9998"+ filterUnits="userSpaceOnUse"+ colorInterpolationFilters="sRGB"+ >+ <feFlood floodOpacity="0" result="BackgroundImageFix" />+ <feColorMatrix+ in="SourceAlpha"+ type="matrix"+ values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"+ result="hardAlpha"+ />+ <feOffset dx="0.666663" dy="0.666663" />+ <feGaussianBlur stdDeviation="0.999994" />+ <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.24 0" />+ <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_324_18399" />+ <feColorMatrix+ in="SourceAlpha"+ type="matrix"+ values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"+ result="hardAlpha"+ />+ <feOffset dx="2.66665" dy="2.66665" />+ <feGaussianBlur stdDeviation="1.86666" />+ <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.12 0" />+ <feBlend mode="normal" in2="effect1_dropShadow_324_18399" result="effect2_dropShadow_324_18399" />+ <feColorMatrix+ in="SourceAlpha"+ type="matrix"+ values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"+ result="hardAlpha"+ />+ <feOffset dx="5.99997" dy="5.86663" />+ <feGaussianBlur stdDeviation="2.53332" />+ <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.08 0" />+ <feBlend mode="normal" in2="effect2_dropShadow_324_18399" result="effect3_dropShadow_324_18399" />+ <feColorMatrix+ in="SourceAlpha"+ type="matrix"+ values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"+ result="hardAlpha"+ />+ <feOffset dx="10.7999" dy="10.3999" />+ <feGaussianBlur stdDeviation="2.99998" />+ <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.12 0" />+ <feBlend mode="normal" in2="effect3_dropShadow_324_18399" result="effect4_dropShadow_324_18399" />+ <feBlend mode="normal" in="SourceGraphic" in2="effect4_dropShadow_324_18399" result="shape" />+ </filter>+ <filter+ id="filter1_ii_324_18399"+ x="2"+ y="15.8667"+ width="41.1758"+ height="24.2667"+ filterUnits="userSpaceOnUse"+ colorInterpolationFilters="sRGB"+ >+ <feFlood floodOpacity="0" result="BackgroundImageFix" />+ <feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape" />+ <feColorMatrix+ in="SourceAlpha"+ type="matrix"+ values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"+ result="hardAlpha"+ />+ <feOffset dy="-0.133333" />+ <feGaussianBlur stdDeviation="0.733329" />+ <feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1" />+ <feColorMatrix type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.64 0" />+ <feBlend mode="normal" in2="shape" result="effect1_innerShadow_324_18399" />+ <feColorMatrix+ in="SourceAlpha"+ type="matrix"+ values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"+ result="hardAlpha"+ />+ <feOffset dy="0.133333" />+ <feGaussianBlur stdDeviation="0.333331" />+ <feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1" />+ <feColorMatrix type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0" />+ <feBlend mode="normal" in2="effect1_innerShadow_324_18399" result="effect2_innerShadow_324_18399" />+ </filter>+ <filter+ id="filter2_f_324_18399"+ x="37.8427"+ y="10.6667"+ width="17.4906"+ height="17.5401"+ filterUnits="userSpaceOnUse"+ colorInterpolationFilters="sRGB"+ >+ <feFlood floodOpacity="0" result="BackgroundImageFix" />+ <feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape" />+ <feGaussianBlur stdDeviation="2.66665" result="effect1_foregroundBlur_324_18399" />+ </filter>+ <filter+ id="filter3_f_324_18399"+ x="27.1761"+ y="9.05991e-05"+ width="38.8238"+ height="38.8734"+ filterUnits="userSpaceOnUse"+ colorInterpolationFilters="sRGB"+ >+ <feFlood floodOpacity="0" result="BackgroundImageFix" />+ <feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape" />+ <feGaussianBlur stdDeviation="7.99995" result="effect1_foregroundBlur_324_18399" />+ </filter>+ <filter+ id="filter4_f_324_18399"+ x="27.1761"+ y="9.05991e-05"+ width="38.8238"+ height="38.8734"+ filterUnits="userSpaceOnUse"+ colorInterpolationFilters="sRGB"+ >+ <feFlood floodOpacity="0" result="BackgroundImageFix" />+ <feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape" />+ <feGaussianBlur stdDeviation="7.99995" result="effect1_foregroundBlur_324_18399" />+ </filter>+ <filter+ id="filter5_iii_324_18399"+ x="41.8427"+ y="15.6"+ width="8.5573"+ height="9.80685"+ filterUnits="userSpaceOnUse"+ colorInterpolationFilters="sRGB"+ >+ <feFlood floodOpacity="0" result="BackgroundImageFix" />+ <feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape" />+ <feColorMatrix+ in="SourceAlpha"+ type="matrix"+ values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"+ result="hardAlpha"+ />+ <feOffset dx="-1.33333" dy="2.53332" />+ <feGaussianBlur stdDeviation="1.59999" />+ <feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1" />+ <feColorMatrix type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0" />+ <feBlend mode="normal" in2="shape" result="effect1_innerShadow_324_18399" />+ <feColorMatrix+ in="SourceAlpha"+ type="matrix"+ values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"+ result="hardAlpha"+ />+ <feOffset />+ <feGaussianBlur stdDeviation="0.933328" />+ <feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1" />+ <feColorMatrix type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0" />+ <feBlend mode="normal" in2="effect1_innerShadow_324_18399" result="effect2_innerShadow_324_18399" />+ <feColorMatrix+ in="SourceAlpha"+ type="matrix"+ values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"+ result="hardAlpha"+ />+ <feOffset dx="0.399998" dy="-0.399998" />+ <feGaussianBlur stdDeviation="0.266665" />+ <feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1" />+ <feColorMatrix type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0" />+ <feBlend mode="normal" in2="effect2_innerShadow_324_18399" result="effect3_innerShadow_324_18399" />+ </filter>+ <linearGradient+ id="paint0_linear_324_18399"+ x1="29.7332"+ y1="23.7333"+ x2="43.1998"+ y2="20.4"+ gradientUnits="userSpaceOnUse"+ >+ <stop stopColor="currentColor" />+ <stop offset="1" stopColor="currentColor" />+ </linearGradient>+ <linearGradient+ id="paint1_linear_324_18399"+ x1="38.8665"+ y1="22.2"+ x2="2.00004"+ y2="39.9999"+ gradientUnits="userSpaceOnUse"+ >+ <stop stopColor="currentColor" stopOpacity="0" />+ <stop offset="1" stopColor="currentColor" />+ </linearGradient>+ </defs>+ </svg>+ );+};diff --git a/apps/mirai-gui/client/src/components/icons/model-menu-icon.tsx b/apps/mirai-gui/client/src/components/icons/model-menu-icon.tsxnew file mode 100644index 000000000..5609af286--- /dev/null+++ b/apps/mirai-gui/client/src/components/icons/model-menu-icon.tsx@@ -0,0 +1,13 @@+import React from "react";++export const ModelMenuIcon: React.FC = () => (+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="17" viewBox="0 0 16 17" fill="none">+ <path+ d="M10.9092 9.96376C12.3137 9.54601 13.2364 8.83503 13.2364 8.02747C13.2364 6.74165 10.8917 5.7002 8.00008 5.7002C5.10845 5.7002 2.76372 6.74165 2.76372 8.02747C2.76372 9.31329 5.10845 10.3547 8.00008 10.3547M8.00008 10.3547L6.25463 8.60929M8.00008 10.3547L6.25463 12.1002"+ stroke="#A8A8B3"+ strokeWidth="1.2"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ </svg>+);diff --git a/apps/mirai-gui/client/src/components/icons/models-icon.tsx b/apps/mirai-gui/client/src/components/icons/models-icon.tsxnew file mode 100644index 000000000..b4c708302--- /dev/null+++ b/apps/mirai-gui/client/src/components/icons/models-icon.tsx@@ -0,0 +1,17 @@+import React from "react";++type ModelsIconProps = React.SVGProps<SVGSVGElement>;++export function ModelsIcon(props: ModelsIconProps) {+ return (+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none" {...props}>+ <path+ d="M6.41667 7.33366L3.75 10.0003L6.41667 12.667M13.0833 7.33366L15.75 10.0003L13.0833 12.667M11.0833 4.66699L8.41667 15.3337"+ stroke="currentColor"+ strokeWidth="1.5"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ </svg>+ );+}diff --git a/apps/mirai-gui/client/src/components/icons/pause-filled-icon.tsx b/apps/mirai-gui/client/src/components/icons/pause-filled-icon.tsxnew file mode 100644index 000000000..4915a8fc1--- /dev/null+++ b/apps/mirai-gui/client/src/components/icons/pause-filled-icon.tsx@@ -0,0 +1,18 @@+import type { SVGProps } from "react";++export type IconPauseFilledProps = SVGProps<SVGSVGElement> & { size?: number; color?: string };++export function IconPauseFilled({ size = 16, color = "currentColor", ...props }: IconPauseFilledProps) {+ return (+ <svg width={size} height={size} viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>+ <path+ d="M4.25 3C4.11193 3 4 3.12437 4 3.27778V12.7222C4 12.8756 4.11193 13 4.25 13H6.75C6.88807 13 7 12.8756 7 12.7222V3.27778C7 3.12437 6.88807 3 6.75 3H4.25Z"+ fill={color}+ />+ <path+ d="M9.25 3C9.11195 3 9 3.12437 9 3.27778V12.7222C9 12.8756 9.11195 13 9.25 13H11.75C11.8881 13 12 12.8756 12 12.7222V3.27778C12 3.12437 11.8881 3 11.75 3H9.25Z"+ fill={color}+ />+ </svg>+ );+}diff --git a/apps/mirai-gui/client/src/components/icons/performance-icon.tsx b/apps/mirai-gui/client/src/components/icons/performance-icon.tsxnew file mode 100644index 000000000..162cf90ae--- /dev/null+++ b/apps/mirai-gui/client/src/components/icons/performance-icon.tsx@@ -0,0 +1,13 @@+import React from "react";++export const PerformanceIcon: React.FC = () => (+ <svg xmlns="http://www.w3.org/2000/svg" width="13" height="8" viewBox="0 0 13 8" fill="none">+ <path+ d="M1.97777 5.9998L5.44444 1.95536L8.33333 4.84425L11.2222 1.37758M7.75555 4.84425C7.75555 4.99749 7.81642 5.14445 7.92478 5.2528C8.03313 5.36115 8.18009 5.42203 8.33333 5.42203C8.48656 5.42203 8.63352 5.36115 8.74188 5.2528C8.85023 5.14445 8.91111 4.99749 8.91111 4.84425C8.91111 4.69101 8.85023 4.54405 8.74188 4.4357C8.63352 4.32734 8.48656 4.26647 8.33333 4.26647C8.18009 4.26647 8.03313 4.32734 7.92478 4.4357C7.81642 4.54405 7.75555 4.69101 7.75555 4.84425ZM4.86666 1.95536C4.86666 2.1086 4.92753 2.25556 5.03589 2.36391C5.14424 2.47227 5.2912 2.53314 5.44444 2.53314C5.59767 2.53314 5.74463 2.47227 5.85299 2.36391C5.96134 2.25556 6.02222 2.1086 6.02222 1.95536C6.02222 1.80212 5.96134 1.65516 5.85299 1.54681C5.74463 1.43846 5.59767 1.37758 5.44444 1.37758C5.2912 1.37758 5.14424 1.43846 5.03589 1.54681C4.92753 1.65516 4.86666 1.80212 4.86666 1.95536ZM1.39999 5.9998C1.39999 6.15304 1.46087 6.3 1.56922 6.40836C1.67758 6.51671 1.82454 6.57758 1.97777 6.57758C2.13101 6.57758 2.27797 6.51671 2.38632 6.40836C2.49468 6.3 2.55555 6.15304 2.55555 5.9998C2.55555 5.84657 2.49468 5.69961 2.38632 5.59125C2.27797 5.4829 2.13101 5.42203 1.97777 5.42203C1.82454 5.42203 1.67758 5.4829 1.56922 5.59125C1.46087 5.69961 1.39999 5.84657 1.39999 5.9998ZM10.6444 1.37758C10.6444 1.53082 10.7053 1.67778 10.8137 1.78613C10.922 1.89449 11.069 1.95536 11.2222 1.95536C11.3755 1.95536 11.5224 1.89449 11.6308 1.78613C11.7391 1.67778 11.8 1.53082 11.8 1.37758C11.8 1.22435 11.7391 1.07739 11.6308 0.969032C11.5224 0.860678 11.3755 0.799805 11.2222 0.799805C11.069 0.799805 10.922 0.860678 10.8137 0.969032C10.7053 1.07739 10.6444 1.22435 10.6444 1.37758Z"+ stroke="#A8A8B3"+ strokeWidth="1.2"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ </svg>+);diff --git a/apps/mirai-gui/client/src/components/icons/play-filled-icon.tsx b/apps/mirai-gui/client/src/components/icons/play-filled-icon.tsxnew file mode 100644index 000000000..4b6d23f40--- /dev/null+++ b/apps/mirai-gui/client/src/components/icons/play-filled-icon.tsx@@ -0,0 +1,14 @@+import type { SVGProps } from "react";++export type IconPlayFilledProps = SVGProps<SVGSVGElement> & { size?: number; color?: string };++export function IconPlayFilled({ size = 16, color = "currentColor", ...props }: IconPlayFilledProps) {+ return (+ <svg width={size} height={size} viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>+ <path+ d="M5.87355 2.05613C4.6186 1.28101 3 2.18373 3 3.65877V12.3413C3 13.8163 4.6186 14.7191 5.87355 13.9439L12.9022 9.60265C14.094 8.86657 14.094 7.13345 12.9022 6.39739L5.87355 2.05613Z"+ fill={color}+ />+ </svg>+ );+}diff --git a/apps/mirai-gui/client/src/components/icons/player-stop-filled-icon.tsx b/apps/mirai-gui/client/src/components/icons/player-stop-filled-icon.tsxnew file mode 100644index 000000000..80c9be6ea--- /dev/null+++ b/apps/mirai-gui/client/src/components/icons/player-stop-filled-icon.tsx@@ -0,0 +1,14 @@+import type { SVGProps } from "react";++export type IconPlayerStopFilledProps = SVGProps<SVGSVGElement> & {+ size?: number;+ color?: string;+};++export function IconPlayerStopFilled({ size = 16, color = "currentColor", ...props }: IconPlayerStopFilledProps) {+ return (+ <svg xmlns="http://www.w3.org/2000/svg" width={size} height={size} viewBox="0 0 24 24" fill={color} {...props}>+ <rect x="3" y="3" width="18" height="18" rx="3" />+ </svg>+ );+}diff --git a/apps/mirai-gui/client/src/components/icons/rename-icon.tsx b/apps/mirai-gui/client/src/components/icons/rename-icon.tsxnew file mode 100644index 000000000..6919cd908--- /dev/null+++ b/apps/mirai-gui/client/src/components/icons/rename-icon.tsx@@ -0,0 +1,26 @@+import React from "react";++type Props = {+ className?: string;+};++export const RenameIcon: React.FC<Props> = ({ className }) => (+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" className={className}>+ <path+ d="M7.33329 2.66602H5.86663C4.74652 2.66602 4.18647 2.66602 3.75865 2.884C3.38232 3.07575 3.07636 3.38171 2.88461 3.75804C2.66663 4.18586 2.66663 4.74591 2.66663 5.86602V10.1327C2.66663 11.2528 2.66663 11.8128 2.88461 12.2407C3.07636 12.617 3.38232 12.9229 3.75865 13.1147C4.18647 13.3327 4.74652 13.3327 5.86663 13.3327H10.1333C11.2534 13.3327 11.8134 13.3327 12.2413 13.1147C12.6176 12.9229 12.9236 12.617 13.1153 12.2407C13.3333 11.8128 13.3333 11.2528 13.3333 10.1327V8.66602"+ stroke="currentColor"+ strokeWidth="1.33333"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ <path+ d="M6 10.0002V8.27629C6 8.09949 6.07024 7.92989 6.19526 7.80489L11.5 2.50015C12.0523 1.94787 12.9477 1.94787 13.5 2.50015C14.0523 3.05243 14.0523 3.94786 13.5 4.50015L8.19527 9.80489C8.07027 9.92989 7.90067 10.0002 7.72387 10.0002H6Z"+ stroke="currentColor"+ strokeWidth="1.33333"+ strokeLinecap="square"+ strokeLinejoin="round"+ />+ </svg>+);++export default RenameIcon;diff --git a/apps/mirai-gui/client/src/components/icons/send-icon.tsx b/apps/mirai-gui/client/src/components/icons/send-icon.tsxnew file mode 100644index 000000000..ca2e429d2--- /dev/null+++ b/apps/mirai-gui/client/src/components/icons/send-icon.tsx@@ -0,0 +1,12 @@+import type { SVGProps } from "react";++export type IconSendProps = SVGProps<SVGSVGElement> & { size?: number; color?: string };++export function IconSend({ size = 16, color = "currentColor", ...props }: IconSendProps) {+ return (+ <svg width={size} height={size} viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>+ <path d="M8 3V12" stroke={color} strokeWidth="1.33333" strokeLinecap="round" strokeLinejoin="round" />+ <path d="M4 7L8 3L12 7" stroke={color} strokeWidth="1.33333" strokeLinecap="round" strokeLinejoin="round" />+ </svg>+ );+}diff --git a/apps/mirai-gui/client/src/components/icons/sidebar-toggle-icon.tsx b/apps/mirai-gui/client/src/components/icons/sidebar-toggle-icon.tsxnew file mode 100644index 000000000..767775369--- /dev/null+++ b/apps/mirai-gui/client/src/components/icons/sidebar-toggle-icon.tsx@@ -0,0 +1,15 @@+import React from "react";++const SidebarToggleIcon: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none" {...props}>+ <path+ d="M7.75 4V16M4 5.5C4 5.10218 4.15804 4.72064 4.43934 4.43934C4.72064 4.15804 5.10218 4 5.5 4H14.5C14.8978 4 15.2794 4.15804 15.5607 4.43934C15.842 4.72064 16 5.10218 16 5.5V14.5C16 14.8978 15.842 15.2794 15.5607 15.5607C15.2794 15.842 14.8978 16 14.5 16H5.5C5.10218 16 4.72064 15.842 4.43934 15.5607C4.15804 15.2794 4 14.8978 4 14.5V5.5Z"+ stroke="currentColor"+ strokeWidth="1.5"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ </svg>+);++export default SidebarToggleIcon;diff --git a/apps/mirai-gui/client/src/components/icons/thinking-bubble.tsx b/apps/mirai-gui/client/src/components/icons/thinking-bubble.tsxnew file mode 100644index 000000000..99a81c64e--- /dev/null+++ b/apps/mirai-gui/client/src/components/icons/thinking-bubble.tsx@@ -0,0 +1,17 @@+import React from "react";++export const ThinkingBubbleIcon: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (+ <svg viewBox="0 0 14 15" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>+ <path+ d="M6.40727 3.05139C6.22778 3.22339 5.97187 3.29849 5.72697 3.25586C5.57912 3.23013 5.42705 3.21672 5.27188 3.21672C3.81005 3.21672 2.625 4.40689 2.625 5.87505C2.625 6.69763 2.99702 7.43298 3.58131 7.92058C3.72927 8.04408 3.8265 8.21989 3.8523 8.41088C4.02762 9.70833 5.13503 10.7083 6.475 10.7083C7.11638 10.7083 7.70449 10.4792 8.16258 10.0981C8.34178 9.94895 8.58136 9.88589 8.81014 9.9304C8.98899 9.96517 9.17367 9.98343 9.36256 9.98343C10.9573 9.98343 12.2501 8.68504 12.2501 7.08338C12.2501 6.30427 11.9442 5.5969 11.4463 5.07585C11.3426 4.9673 11.274 4.82929 11.2501 4.68109C11.0269 3.30244 9.83587 2.25 8.40012 2.25C7.62737 2.25 6.92551 2.55487 6.40727 3.05139Z"+ stroke="currentColor"+ strokeWidth="1.1"+ strokeLinejoin="round"+ />+ <path+ d="M3.49935 12.1667C3.49935 12.811 2.97701 13.3333 2.33268 13.3333C1.68835 13.3333 1.16602 12.811 1.16602 12.1667C1.16602 11.5223 1.68835 11 2.33268 11C2.97701 11 3.49935 11.5223 3.49935 12.1667Z"+ stroke="currentColor"+ strokeWidth="1.1"+ />+ </svg>+);diff --git a/apps/mirai-gui/client/src/components/icons/trash-icon.tsx b/apps/mirai-gui/client/src/components/icons/trash-icon.tsxnew file mode 100644index 000000000..0f6851764--- /dev/null+++ b/apps/mirai-gui/client/src/components/icons/trash-icon.tsx@@ -0,0 +1,47 @@+import React from "react";++type Props = {+ className?: string;+};++export const TrashIcon: React.FC<Props> = ({ className }) => (+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" className={className}>+ <path+ d="M3.33337 4.33398L3.8716 12.1383C3.94392 13.1869 4.81569 14.0007 5.86686 14.0007H10.1332C11.1844 14.0007 12.0562 13.1869 12.1285 12.1383L12.6667 4.33398"+ stroke="currentColor"+ strokeWidth="1.33333"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ <path+ d="M6.66663 7.33398V10.6673"+ stroke="currentColor"+ strokeWidth="1.33333"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ <path+ d="M9.33337 7.33398V10.6673"+ stroke="currentColor"+ strokeWidth="1.33333"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ <path+ d="M2.33337 4H13.6667"+ stroke="currentColor"+ strokeWidth="1.33333"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ <path+ d="M5.38049 3.83016C5.61553 2.59765 6.69888 1.66602 7.99988 1.66602C9.30088 1.66602 10.3842 2.59765 10.6193 3.83016"+ stroke="currentColor"+ strokeWidth="1.33333"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ </svg>+);++export default TrashIcon;diff --git a/apps/mirai-gui/client/src/components/icons/x-icon.tsx b/apps/mirai-gui/client/src/components/icons/x-icon.tsxnew file mode 100644index 000000000..e17b71436--- /dev/null+++ b/apps/mirai-gui/client/src/components/icons/x-icon.tsx@@ -0,0 +1,14 @@+import React from "react";++const XIcon: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (+ <svg xmlns="http://www.w3.org/2000/svg" width="17" height="17" viewBox="0 0 17 17" fill="none" {...props}>+ <path+ fillRule="evenodd"+ clipRule="evenodd"+ d="M0.762431 0.636564C0.815065 0.711665 2.03403 2.4859 3.47124 4.5793C4.90846 6.67269 6.23774 8.60863 6.42523 8.88141C6.6127 9.15419 6.7661 9.38284 6.7661 9.38953C6.7661 9.39623 6.69628 9.48231 6.61096 9.58081C6.52564 9.67931 6.2853 9.95815 6.07692 10.2004C5.86851 10.4427 5.5172 10.8511 5.29621 11.1079C5.07524 11.3648 4.68648 11.8167 4.4323 12.1123C4.17813 12.4079 3.72106 12.9394 3.41658 13.2933C2.47489 14.388 2.33899 14.5461 1.62215 15.3811C1.23938 15.8269 0.872334 16.2531 0.806501 16.3283C0.740669 16.4035 0.686801 16.4729 0.686801 16.4825C0.686801 16.4938 0.927224 16.5 1.36418 16.5H2.04153L2.78622 15.6322C3.19581 15.1548 3.59984 14.685 3.68407 14.5881C3.86622 14.3786 5.25529 12.7623 5.37205 12.6241C5.41676 12.5711 5.48169 12.4958 5.51635 12.4567C5.55103 12.4175 5.82432 12.1 6.12366 11.7511C6.423 11.4022 6.67614 11.1082 6.68617 11.0977C6.69621 11.0873 6.85468 10.9029 7.03833 10.6881C7.22197 10.4732 7.3779 10.2974 7.38483 10.2974C7.39177 10.2974 8.33514 11.6632 9.48123 13.3326C10.6273 15.002 11.5855 16.3974 11.6105 16.4335L11.656 16.4992L13.9794 16.4996C15.8902 16.4999 16.3013 16.4959 16.294 16.4769C16.2863 16.4566 15.1731 14.8329 12.3172 10.6762C10.2613 7.68386 9.98791 7.28174 9.99575 7.26134C10.0034 7.2415 10.2834 6.91397 12.1244 4.77167C12.4402 4.40419 12.8756 3.89736 13.0918 3.64537C13.3081 3.39339 13.5264 3.13965 13.5771 3.0815C13.6277 3.02335 13.8938 2.7141 14.1684 2.39427C14.443 2.07445 14.9099 1.53101 15.2059 1.18664C15.5019 0.842273 15.755 0.546908 15.7682 0.530256C15.791 0.501762 15.7523 0.5 15.1044 0.5H14.4164L14.1104 0.856828C13.7031 1.33172 12.9669 2.18809 12.7578 2.43008C12.6655 2.537 12.5502 2.67138 12.5018 2.72869C12.4533 2.78599 12.3577 2.89674 12.2893 2.9748C12.2209 3.05286 11.8763 3.45374 11.5234 3.86564C11.1706 4.27753 10.877 4.6185 10.8711 4.62335C10.8652 4.62819 10.7896 4.71589 10.7031 4.81825C10.5518 4.99729 10.3978 5.17649 9.69168 5.99542C9.38173 6.35489 9.36583 6.37033 9.3397 6.33729C9.32467 6.31825 8.41632 4.99715 7.32116 3.40152L5.32997 0.50037L2.99836 0.500176L0.666748 0.5L0.762431 0.636564ZM2.58222 1.58796C2.59974 1.6147 3.03536 2.23921 3.55031 2.97577C4.52692 4.3727 8.36463 9.86539 10.8327 13.3987C11.6214 14.5278 12.2763 15.4615 12.2881 15.4737C12.3049 15.4911 12.5345 15.4949 13.3611 15.4913L14.4127 15.4868L11.6608 11.5485C10.1473 9.38238 7.95588 6.24626 6.79108 4.5793L4.67327 1.54846L3.61184 1.54391L2.55041 1.53937L2.58222 1.58796Z"+ fill="currentColor"+ />+ </svg>+);++export default XIcon;diff --git a/apps/mirai-gui/client/src/components/left-bar/index.tsx b/apps/mirai-gui/client/src/components/left-bar/index.tsxnew file mode 100644index 000000000..cf3c8d125--- /dev/null+++ b/apps/mirai-gui/client/src/components/left-bar/index.tsx@@ -0,0 +1,154 @@+import { useIsMobile } from "@/hooks/use-media-query";+import { platformInfo } from "@/platform/platform-info";+import { useChatStore } from "@/stores/use-chat-store";+import { useSidebarStore } from "@/stores/use-sidebar-store";+import { Transition } from "@headlessui/react";+import { useLocation, useNavigate } from "@tanstack/react-router";+import { Plus } from "lucide-react";+import { useCallback, useEffect } from "react";+import { twMerge } from "tailwind-merge";+import { v4 as uuidv4 } from "uuid";+import { ChatsIcon } from "../icons/chats-icon";+import { ModelsIcon } from "../icons/models-icon";+import SidebarToggleIcon from "../icons/sidebar-toggle-icon";+import MenuItem from "./menu-item";+import SavedChats from "@/features/chat-history/components/saved-chats";+import Settings from "./settings";++function LeftBar() {+ const location = useLocation();+ const navigate = useNavigate();+ const createNewChat = useChatStore((s) => s.createNewChat);+ const isMobile = useIsMobile();++ const isSidebarOpen = useSidebarStore((s) => s.isOpen);+ const toggleSidebar = useSidebarStore((s) => s.toggle);+ const setMobile = useSidebarStore((s) => s.setMobile);+ const closeOnMobile = useSidebarStore((s) => s.closeOnMobile);++ useEffect(() => {+ setMobile(isMobile);+ }, [isMobile, setMobile]);++ const setSidebarWidth = useCallback(+ (open: boolean) => {+ document.documentElement.style.setProperty("--sidebar-width", open && !isMobile ? "200px" : "0px");+ },+ [isMobile],+ );++ useEffect(() => {+ setSidebarWidth(useSidebarStore.getState().isOpen);+ }, [setSidebarWidth]);++ const mainItems = [+ {+ icon: Plus,+ title: "New Chat",+ onClick: () => {+ const newChatId = uuidv4();+ createNewChat(newChatId);+ navigate({+ to: "/chat/$chatId",+ params: { chatId: newChatId },+ search: { isNew: true },+ });+ closeOnMobile();+ },+ },+ {+ icon: ChatsIcon,+ title: "Chats",+ url: "/chats",+ isActive: location.pathname.startsWith("/chats"),+ },+ ...(platformInfo.features.localModelDownloads+ ? [+ {+ icon: ModelsIcon,+ title: "Local Models",+ url: "/local-models",+ isActive: location.pathname.startsWith("/local-models"),+ },+ ]+ : []),+ ];++ const toggleSidebarButton = (+ <button+ onClick={toggleSidebar}+ className={twMerge(+ "overlay-button p-1 rounded-lg hover:bg-bg-hover transition-all duration-300 ease-in-out absolute top-[10px]",+ isMobile && platformInfo.features.nativeTitleBar+ ? "left-20 translate-x-0"+ : isMobile+ ? "left-4 translate-x-0"+ : platformInfo.features.nativeTitleBar+ ? "translate-x-[92px]"+ : "left-3 translate-x-0",+ )}+ >+ <SidebarToggleIcon className="w-6 h-6 text-label-muted" />+ </button>+ );++ return (+ <div className="relative z-30">+ {toggleSidebarButton}++ {isMobile && isSidebarOpen && (+ <div className="fixed top-0 right-0 bottom-0 left-[280px] bg-black/50 z-40 md:hidden" onClick={closeOnMobile} />+ )}++ <Transition+ show={isSidebarOpen}+ enter="transition-all duration-300 ease-out"+ enterFrom="opacity-0 -translate-x-full"+ enterTo="opacity-100 translate-x-0"+ leave="transition-all duration-300 ease-in"+ leaveFrom="opacity-100 translate-x-0"+ leaveTo="opacity-0 -translate-x-full"+ beforeEnter={() => setSidebarWidth(true)}+ beforeLeave={() => setSidebarWidth(true)}+ afterLeave={() => setSidebarWidth(false)}+ >+ <div+ data-tauri-drag-region+ className={twMerge(+ "relative min-h-screen bg-bg-sidebar border-[1px] border-cell-border border-b-0 border-t-0 h-screen flex flex-col py-3 overflow-hidden",+ isMobile ? "fixed top-0 left-0 w-[280px] z-50" : "w-[200px]",+ )}+ >+ <div className="flex-1 flex flex-col overflow-hidden mt-10">+ <div className="flex-shrink-0">+ <nav className="flex flex-col gap-2">+ {mainItems.map((item, index) => (+ <MenuItem+ key={index}+ icon={item.icon}+ title={item.title}+ url={item.url}+ isActive={item.isActive}+ onClick={item.onClick}+ />+ ))}+ </nav>++ <div className="mt-3 mb-2 border-t border-cell-border" />+ </div>++ <div className="flex-1 overflow-y-auto min-h-0 scrollbar-hide">+ <SavedChats />+ </div>++ <div>+ <Settings />+ </div>+ </div>+ </div>+ </Transition>+ </div>+ );+}++export default LeftBar;diff --git a/apps/mirai-gui/client/src/components/left-bar/menu-item.tsx b/apps/mirai-gui/client/src/components/left-bar/menu-item.tsxnew file mode 100644index 000000000..7634f7aeb--- /dev/null+++ b/apps/mirai-gui/client/src/components/left-bar/menu-item.tsx@@ -0,0 +1,51 @@+import { Link } from "@tanstack/react-router";+import { useSidebarStore } from "@/stores/use-sidebar-store";+import { useIsMobile } from "@/hooks/use-media-query";++type MenuItemProps = {+ icon: React.ComponentType<React.SVGProps<SVGSVGElement>>;+ title: string;+ url?: string;+ onClick?: () => void;+ isActive?: boolean;+};++function MenuItem({ icon: Icon, title, url, onClick, isActive }: MenuItemProps) {+ const isMobile = useIsMobile();+ const closeOnMobile = useSidebarStore((s) => s.closeOnMobile);++ const handleClick = () => {+ if (onClick) {+ onClick();+ } else if (url && isMobile) {+ closeOnMobile();+ }+ };++ const content = (+ <div className="flex px-2">+ <div+ className={`flex items-center gap-2 px-2 py-[6px] w-full rounded-md hover:bg-bg-hover ${isActive ? "bg-bg-hover dark:bg-bg-hover" : ""}`}+ >+ <Icon className="w-5 h-5 flex-shrink-0 text-label-muted" />+ <p className="text-[13px] font-[350] leading-[150%] text-label-title truncate min-w-0">{title}</p>+ </div>+ </div>+ );++ if (onClick) {+ return (+ <button onClick={handleClick} className="w-full text-left">+ {content}+ </button>+ );+ }++ return (+ <Link to={url || "#"} onClick={handleClick}>+ {content}+ </Link>+ );+}++export default MenuItem;diff --git a/apps/mirai-gui/client/src/components/left-bar/settings.tsx b/apps/mirai-gui/client/src/components/left-bar/settings.tsxnew file mode 100644index 000000000..de2390150--- /dev/null+++ b/apps/mirai-gui/client/src/components/left-bar/settings.tsx@@ -0,0 +1,29 @@+import { Link } from "@tanstack/react-router";+import Socials from "./socials";++function Settings() {+ return (+ <div>+ <div className="border-t border-cell-border mb-2" />+ <div className="flex flex-col gap-2">+ <Link+ to="/settings"+ search={{ tab: "general" }}+ className="flex px-2"+ activeOptions={{ includeSearch: true, exact: true }}+ >+ <div className="flex items-center gap-2 px-2 py-[6px] w-full rounded-md hover:bg-bg-hover">+ <span className="text-[13px] font-[350] leading-[150%] text-label-title">Settings</span>+ </div>+ </Link>+ <div className="flex px-2">+ <div className="px-2 py-[6px]">+ <Socials />+ </div>+ </div>+ </div>+ </div>+ );+}++export default Settings;diff --git a/apps/mirai-gui/client/src/components/left-bar/socials.tsx b/apps/mirai-gui/client/src/components/left-bar/socials.tsxnew file mode 100644index 000000000..6a8dae7fb--- /dev/null+++ b/apps/mirai-gui/client/src/components/left-bar/socials.tsx@@ -0,0 +1,36 @@+import DiscordIcon from "../icons/discord-icon";+import GithubIcon from "../icons/github-icon";+import XIcon from "../icons/x-icon";++function Socials() {+ return (+ <div className="flex items-center justify-start space-x-4">+ <a+ href="https://github.com/trymirai"+ target="_blank"+ rel="noopener noreferrer"+ className="text-label-muted hover:text-label-title"+ >+ <GithubIcon className="w-5 h-5" />+ </a>+ <a+ href="https://x.com/trymirai"+ target="_blank"+ rel="noopener noreferrer"+ className="text-label-muted hover:text-label-title"+ >+ <XIcon className="w-4 h-4" />+ </a>+ <a+ href="https://discord.gg/trymirai"+ target="_blank"+ rel="noopener noreferrer"+ className="text-label-muted hover:text-label-title"+ >+ <DiscordIcon className="w-5 h-5" />+ </a>+ </div>+ );+}++export default Socials;diff --git a/apps/mirai-gui/client/src/components/loader.tsx b/apps/mirai-gui/client/src/components/loader.tsxnew file mode 100644index 000000000..8b3d62a5d--- /dev/null+++ b/apps/mirai-gui/client/src/components/loader.tsx@@ -0,0 +1,56 @@+import { useAppStore } from "@/stores/use-app-store";+import { useRive } from "@rive-app/react-canvas";+import React, { type HTMLAttributes } from "react";+import { twMerge } from "tailwind-merge";+import { TextShimmer } from "./ui/text-shimmer";++type LoaderProps = {+ showText?: boolean;+ textClassName?: string;+ text?: string;+ iconWidth?: number;+ iconHeight?: number;+} & HTMLAttributes<HTMLDivElement>;++export const LoaderIcon = ({ width = 10, height = 10 }: { width?: number; height?: number }) => {+ const isDarkMode = useAppStore((s) => s.isDarkMode);++ const baseUrl = import.meta.env.BASE_URL || "/";+ const src = isDarkMode ? `${baseUrl}rive/loader-dark-mode.riv` : `${baseUrl}rive/loader-light-mode.riv`;++ const { RiveComponent } = useRive({+ src: src,+ autoplay: true,+ });++ return (+ <div style={{ width, height }}>+ <RiveComponent key={isDarkMode ? "dark" : "light"} style={{ width: "100%", height: "100%", display: "block" }} />+ </div>+ );+};++export const Loader: React.FC<LoaderProps> = ({+ showText = true,+ textClassName,+ className,+ text = "Loading…",+ iconWidth = 10,+ iconHeight = 10,+}) => {+ return (+ <div className={twMerge("flex items-center justify-center gap-2", className)}>+ <LoaderIcon width={iconWidth} height={iconHeight} />+ {showText && text && (+ <div className="flex items-baseline gap-[2px]">+ <TextShimmer+ duration={1.2}+ className={twMerge("text-[13px] font-[350] [--base-color:var(--color-label-muted)]", textClassName)}+ >+ {text}+ </TextShimmer>+ </div>+ )}+ </div>+ );+};diff --git a/apps/mirai-gui/client/src/components/model-vendor-icon.tsx b/apps/mirai-gui/client/src/components/model-vendor-icon.tsxnew file mode 100644index 000000000..271590332--- /dev/null+++ b/apps/mirai-gui/client/src/components/model-vendor-icon.tsx@@ -0,0 +1,16 @@+import { useAppStore } from "@/stores/use-app-store";+import { useModelsStore } from "@/stores/use-models-store";+import { VendorIcon } from "./ui/vendor-icon";++type ModelVendorIconProps = {+ vendor?: string | null;+ className?: string;+ size?: number;+};++export const ModelVendorIcon = ({ vendor, className = "h-4 w-4", size = 16 }: ModelVendorIconProps) => {+ const isDarkMode = useAppStore((s) => s.isDarkMode);+ const icons = useModelsStore((s) => (vendor ? s.vendorIconsByName[vendor] : undefined));+ if (!vendor || !icons) return null;+ return <VendorIcon src={isDarkMode ? icons.dark : icons.light} vendor={vendor} className={className} size={size} />;+};diff --git a/apps/mirai-gui/client/src/components/page-header.tsx b/apps/mirai-gui/client/src/components/page-header.tsxnew file mode 100644index 000000000..f010c525f--- /dev/null+++ b/apps/mirai-gui/client/src/components/page-header.tsx@@ -0,0 +1,23 @@+import { platformInfo } from "@/platform/platform-info";+import { useSidebarStore } from "@/stores/use-sidebar-store";+import type { ReactElement } from "react";++const HEADER_LEFT_RESERVE_PX = platformInfo.features.nativeTitleBar ? 120 : 56;++export const PageHeader = ({ title }: { title: ReactElement }) => {+ const isSidebarOpen = useSidebarStore((s) => s.isOpen);++ return (+ <div+ style={+ !isSidebarOpen+ ? {+ paddingLeft: `clamp(0px, calc(${HEADER_LEFT_RESERVE_PX}px - var(--sidebar-width, 0px)), ${HEADER_LEFT_RESERVE_PX}px)`,+ }+ : undefined+ }+ >+ {title}+ </div>+ );+};diff --git a/apps/mirai-gui/client/src/components/ui/button/constants.ts b/apps/mirai-gui/client/src/components/ui/button/constants.tsnew file mode 100644index 000000000..38db3bde6--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/button/constants.ts@@ -0,0 +1,37 @@+import type { ButtonSize, ButtonKind } from "./types";++export const SIZE_STYLES: Record<ButtonSize, string> = {+ xxs: "h-6 px-2 text-xs font-medium rounded gap-1",+ xs: "h-7 px-2.5 text-xs font-medium rounded-md gap-1.5",+ sm: "h-8 px-3 text-sm font-medium rounded-md gap-1.5",+ lg: "h-10 px-4 text-sm font-medium rounded-md gap-2",+};++export const ICON_ONLY_SIZE_STYLES: Record<ButtonSize, string> = {+ xxs: "size-6 rounded p-0",+ xs: "size-7 rounded-md p-0",+ sm: "size-8 rounded-md p-0",+ lg: "size-10 rounded-md p-0",+};++export const KIND_STYLES: Record<ButtonKind, string> = {+ primary: "bg-primary text-primary-contrast hover:bg-primary-hover active:bg-primary-active active:scale-[0.97]",+ secondary:+ "bg-secondary text-secondary-contrast shadow-sm hover:bg-secondary-hover hover:shadow-md active:scale-[0.97]",+ danger: "bg-danger text-danger-contrast hover:bg-danger-hover active:bg-danger-active active:scale-[0.97]",+ ghost:+ "bg-transparent text-text-secondary hover:bg-secondary-hover hover:text-text-primary active:bg-secondary-active active:scale-[0.97]",+};++export const DISABLED_STYLES = "opacity-50 cursor-not-allowed pointer-events-none";+export const LOADING_STYLES = "cursor-wait pointer-events-none";+export const BASE_STYLES =+ "inline-flex shrink-0 items-center justify-center whitespace-nowrap select-none outline-hidden antialiased transition-all duration-150 ease-out will-change-transform touch-manipulation focus-visible:shadow-focus [&_svg]:pointer-events-none [&_svg]:shrink-0";+export const FULL_WIDTH_STYLES = "w-full";++export const SPINNER_SIZE_MAP: Record<ButtonSize, number> = {+ xxs: 10,+ xs: 12,+ sm: 14,+ lg: 16,+};diff --git a/apps/mirai-gui/client/src/components/ui/button/index.tsx b/apps/mirai-gui/client/src/components/ui/button/index.tsxnew file mode 100644index 000000000..3a826dbe5--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/button/index.tsx@@ -0,0 +1,115 @@+import { forwardRef } from "react";+import { twMerge } from "tailwind-merge";+import { Spinner } from "../spinner";+import {+ BASE_STYLES,+ DISABLED_STYLES,+ FULL_WIDTH_STYLES,+ ICON_ONLY_SIZE_STYLES,+ KIND_STYLES,+ LOADING_STYLES,+ SIZE_STYLES,+ SPINNER_SIZE_MAP,+} from "./constants";+import type { ButtonAsButton, ButtonAsLink, ButtonProps } from "./types";+import { getButtonCommonProps } from "./utils";++type SharedButtonPropKeys =+ | "children"+ | "size"+ | "kind"+ | "icon"+ | "iconPosition"+ | "loading"+ | "disabled"+ | "ariaLabel"+ | "fullWidth"+ | "className"+ | "iconOnly";++type ButtonPassthroughProps = Omit<ButtonAsButton, SharedButtonPropKeys>;+type LinkPassthroughProps = Omit<ButtonAsLink, SharedButtonPropKeys>;++export const Button = forwardRef<HTMLButtonElement | HTMLAnchorElement, ButtonProps>(function Button(props, ref) {+ const {+ children,+ size = "sm",+ kind = "primary",+ icon,+ iconPosition = "left",+ loading = false,+ disabled = false,+ ariaLabel,+ fullWidth = false,+ className = "",+ iconOnly = false,+ ...rest+ } = props;+ const isIconOnly = Boolean(iconOnly || (!children && icon));+ const isLinkInteractive = !(disabled || loading);+ const sizeStyles = isIconOnly ? ICON_ONLY_SIZE_STYLES[size] : SIZE_STYLES[size];+ const kindStyles = KIND_STYLES[kind];+ const stateStyles = disabled ? DISABLED_STYLES : loading ? LOADING_STYLES : "";+ const widthStyles = fullWidth ? FULL_WIDTH_STYLES : "";++ const combinedClassName = twMerge(BASE_STYLES, sizeStyles, kindStyles, stateStyles, widthStyles, className);++ const spinnerSize = SPINNER_SIZE_MAP[size];+ const effectiveAriaLabel = ariaLabel || undefined;++ const iconSlot = icon ? (+ <span aria-hidden className="grid shrink-0 place-items-center">+ {icon}+ </span>+ ) : null;++ const content = (+ <>+ {loading && <Spinner size={spinnerSize} />}+ {isIconOnly && !loading && iconSlot}+ {!isIconOnly && (+ <>+ {!loading && iconPosition === "left" && iconSlot}+ {children && <span className="truncate">{children}</span>}+ {!loading && iconPosition === "right" && iconSlot}+ </>+ )}+ </>+ );++ const commonProps = getButtonCommonProps({+ className: combinedClassName,+ ariaLabel: effectiveAriaLabel,+ disabled,+ loading,+ size,+ kind,+ isIconOnly,+ });++ if (props.href !== undefined) {+ const { href, target, rel, onClick, ...restLinkProps } = rest as LinkPassthroughProps;+ const linkRel = target === "_blank" && !rel ? "noopener noreferrer" : rel;+ const linkProps = isLinkInteractive ? { href, target, rel: linkRel, onClick } : { tabIndex: -1 };+ return (+ <a ref={ref as React.Ref<HTMLAnchorElement>} {...linkProps} {...commonProps} {...restLinkProps}>+ {content}+ </a>+ );+ }++ const { type = "button", onClick, ...restButtonProps } = rest as ButtonPassthroughProps;++ return (+ <button+ ref={ref as React.Ref<HTMLButtonElement>}+ type={type}+ disabled={disabled || loading}+ onClick={disabled || loading ? undefined : onClick}+ {...commonProps}+ {...restButtonProps}+ >+ {content}+ </button>+ );+});diff --git a/apps/mirai-gui/client/src/components/ui/button/types.ts b/apps/mirai-gui/client/src/components/ui/button/types.tsnew file mode 100644index 000000000..172cef96c--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/button/types.ts@@ -0,0 +1,40 @@+import type { AnchorHTMLAttributes, ButtonHTMLAttributes, ReactNode } from "react";++export type ButtonSize = "xxs" | "xs" | "sm" | "lg";+export type ButtonKind = "primary" | "secondary" | "danger" | "ghost";+export type IconPosition = "left" | "right";+export type LinkTarget = "_blank" | "_self" | "_parent" | "_top";++type ButtonSharedProps = {+ children?: ReactNode;+ size?: ButtonSize;+ kind?: ButtonKind;+ icon?: ReactNode;+ iconPosition?: IconPosition;+ loading?: boolean;+ disabled?: boolean;+ ariaLabel?: string;+ fullWidth?: boolean;+ className?: string;+ iconOnly?: boolean;+};++export type ButtonAsButton = ButtonSharedProps &+ Omit<+ ButtonHTMLAttributes<HTMLButtonElement>,+ "className" | "children" | "aria-label" | "aria-describedby" | "disabled" | "title"+ > & {+ href?: undefined;+ };++export type ButtonAsLink = ButtonSharedProps &+ Omit<+ AnchorHTMLAttributes<HTMLAnchorElement>,+ "className" | "children" | "aria-label" | "aria-describedby" | "title"+ > & {+ href: string;+ target?: LinkTarget;+ rel?: string;+ };++export type ButtonProps = ButtonAsButton | ButtonAsLink;diff --git a/apps/mirai-gui/client/src/components/ui/button/utils.ts b/apps/mirai-gui/client/src/components/ui/button/utils.tsnew file mode 100644index 000000000..b24fcc826--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/button/utils.ts@@ -0,0 +1,32 @@+import type { ButtonKind, ButtonSize } from "./types";++type ButtonCommonPropsParams = {+ className: string;+ ariaLabel: string | undefined;+ disabled: boolean;+ loading: boolean;+ size: ButtonSize;+ kind: ButtonKind;+ isIconOnly: boolean;+};++export function getButtonCommonProps({+ className,+ ariaLabel,+ disabled,+ loading,+ size,+ kind,+ isIconOnly,+}: ButtonCommonPropsParams) {+ return {+ className,+ "aria-label": ariaLabel,+ "aria-disabled": disabled || loading,+ "aria-busy": loading,+ "data-size": size,+ "data-kind": kind,+ "data-loading": loading || undefined,+ "data-icon-only": isIconOnly || undefined,+ };+}diff --git a/apps/mirai-gui/client/src/components/ui/card-container.tsx b/apps/mirai-gui/client/src/components/ui/card-container.tsxnew file mode 100644index 000000000..68779e77a--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/card-container.tsx@@ -0,0 +1,14 @@+import type { ReactNode, HTMLAttributes } from "react";+import { twMerge } from "tailwind-merge";++type CardContainerProps = {+ children: ReactNode;+} & HTMLAttributes<HTMLDivElement>;++export function CardContainer({ children, className, ...props }: CardContainerProps) {+ return (+ <div className={twMerge("bg-bg-modal border border-cell-border rounded-lg overflow-hidden", className)} {...props}>+ {children}+ </div>+ );+}diff --git a/apps/mirai-gui/client/src/components/ui/checkbox/constants.ts b/apps/mirai-gui/client/src/components/ui/checkbox/constants.tsnew file mode 100644index 000000000..95f432bce--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/checkbox/constants.ts@@ -0,0 +1,14 @@+import type { SelectorSize } from "./types";++export const CHECKBOX_SIZE: Record<SelectorSize, { box: string; icon: number; radius: string }> = {+ sm: { box: "size-4", icon: 12, radius: "rounded" },+ md: { box: "size-[18px]", icon: 14, radius: "rounded" },+};++export const CHECKED_BG = "bg-primary";++export const CHECKED_BORDER = "border-primary";++export const UNCHECKED_BORDER = "border-border-strong";++export const FOCUS_RING = "focus-visible:shadow-focus";diff --git a/apps/mirai-gui/client/src/components/ui/checkbox/index.tsx b/apps/mirai-gui/client/src/components/ui/checkbox/index.tsxnew file mode 100644index 000000000..e54107f07--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/checkbox/index.tsx@@ -0,0 +1,47 @@+import { twMerge } from "tailwind-merge";+import { IconCheckmark } from "../../icons/checkmark-icon";+import { CHECKBOX_SIZE, CHECKED_BG, CHECKED_BORDER, FOCUS_RING, UNCHECKED_BORDER } from "./constants";+import type { CheckboxProps } from "./types";++export function Checkbox({+ checked,+ onChange,+ size = "md",+ disabled = false,+ className,+ "aria-label": ariaLabel,+}: CheckboxProps) {+ const sizeConfig = CHECKBOX_SIZE[size];++ const boxClasses = twMerge(+ "relative m-0 block shrink-0 appearance-none border-[1.5px] p-0 outline-hidden transition-all duration-150 ease-out align-middle cursor-pointer",+ sizeConfig.box,+ sizeConfig.radius,+ checked ? `${CHECKED_BG} ${CHECKED_BORDER}` : UNCHECKED_BORDER,+ FOCUS_RING,+ className,+ );++ return (+ <span className="relative inline-flex shrink-0 items-center justify-center">+ <input+ type="checkbox"+ className={boxClasses}+ checked={checked}+ onChange={(e) => onChange(e.target.checked)}+ disabled={disabled}+ aria-checked={checked}+ aria-label={ariaLabel}+ />+ <IconCheckmark+ strokeWidth={2.5}+ size={sizeConfig.icon}+ className={twMerge(+ "pointer-events-none absolute transition-opacity duration-100 stroke-current",+ "text-primary-contrast",+ checked ? "opacity-100" : "opacity-0",+ )}+ />+ </span>+ );+}diff --git a/apps/mirai-gui/client/src/components/ui/checkbox/types.ts b/apps/mirai-gui/client/src/components/ui/checkbox/types.tsnew file mode 100644index 000000000..a62204794--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/checkbox/types.ts@@ -0,0 +1,10 @@+export type SelectorSize = "sm" | "md";++export type CheckboxProps = {+ checked: boolean;+ onChange: (checked: boolean) => void;+ size?: SelectorSize;+ disabled?: boolean;+ className?: string;+ "aria-label"?: string;+};diff --git a/apps/mirai-gui/client/src/components/ui/copy-button.tsx b/apps/mirai-gui/client/src/components/ui/copy-button.tsxnew file mode 100644index 000000000..4e12bc332--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/copy-button.tsx@@ -0,0 +1,60 @@+import { IconButton } from "./icon-button";+import { useToast } from "./toast/use-toast";+import { Transition } from "@headlessui/react";+import { Check, Copy } from "lucide-react";+import { Fragment, useState } from "react";+import { twMerge } from "tailwind-merge";++type CopyButtonProps = {+ onCopy: () => Promise<void>;+ className?: string;+};++const COPIED_FEEDBACK_MS = 1000;++const BUTTON_CLASSES =+ "relative min-w-8 min-h-8 flex items-center justify-center p-[6px] rounded-[5px] text-label-muted hover:bg-card-hover hover:text-label-title active:scale-100";++export function CopyButton({ onCopy, className }: CopyButtonProps) {+ const [copied, setCopied] = useState(false);+ const toast = useToast();++ const handleCopy = async () => {+ try {+ await onCopy();+ setCopied(true);+ setTimeout(() => setCopied(false), COPIED_FEEDBACK_MS);+ } catch {+ toast.error("Copy failed. Please try again.");+ }+ };++ return (+ <IconButton aria-label="Copy" onClick={handleCopy} className={twMerge(BUTTON_CLASSES, className)}>+ <Transition+ as={Fragment}+ show={!copied}+ enter="transition-opacity duration-500"+ enterFrom="opacity-0"+ enterTo="opacity-100"+ leave="transition-opacity duration-500"+ leaveFrom="opacity-100"+ leaveTo="opacity-0"+ >+ <Copy className="w-[14px] h-[14px] absolute" />+ </Transition>+ <Transition+ as={Fragment}+ show={copied}+ enter="transition-opacity duration-500"+ enterFrom="opacity-0"+ enterTo="opacity-100"+ leave="transition-opacity duration-500"+ leaveFrom="opacity-100"+ leaveTo="opacity-0"+ >+ <Check className="w-[14px] h-[14px] absolute" />+ </Transition>+ </IconButton>+ );+}diff --git a/apps/mirai-gui/client/src/components/ui/group-button.tsx b/apps/mirai-gui/client/src/components/ui/group-button.tsxnew file mode 100644index 000000000..36acdf298--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/group-button.tsx@@ -0,0 +1,61 @@+import React from "react";+import { twMerge } from "tailwind-merge";++type GroupButtonProps = {+ className?: string;+ children: React.ReactNode;+};++type SegmentProps = {+ className?: string;+ onClick?: (e?: React.MouseEvent) => void;+ disabled?: boolean;+ children: React.ReactNode;+ ariaLabel?: string;+ leftDivider?: boolean;+};++const Base: React.FC<GroupButtonProps> = ({ className, children }) => {+ return (+ <div+ className={twMerge(+ "h-8 flex items-center rounded-lg overflow-hidden border border-cell-border bg-transparent",+ className,+ )}+ >+ {children}+ </div>+ );+};++const Segment: React.FC<SegmentProps> = ({+ className,+ onClick,+ disabled = false,+ children,+ ariaLabel,+ leftDivider = false,+}) => {+ return (+ <button+ type="button"+ aria-label={ariaLabel}+ onClick={(e) => {+ if (disabled) return;+ onClick?.(e);+ }}+ disabled={disabled}+ className={twMerge(+ "px-2 h-8 flex items-center gap-2 transition-colors select-none",+ "disabled:opacity-50 disabled:cursor-not-allowed",+ "hover:bg-card-hover",+ leftDivider && "border-l-[0.5px] border-button-border",+ className,+ )}+ >+ {children}+ </button>+ );+};++export const GroupButton = Object.assign(Base, { Segment });diff --git a/apps/mirai-gui/client/src/components/ui/icon-action.tsx b/apps/mirai-gui/client/src/components/ui/icon-action.tsxnew file mode 100644index 000000000..b08746f7a--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/icon-action.tsx@@ -0,0 +1,31 @@+import type { MouseEvent, ReactNode } from "react";+import { Button } from "./button";++type IconActionProps = {+ label: string;+ icon: ReactNode;+ onClick?: () => void;+ className?: string;+};++export function IconAction({ label, icon, onClick, className }: IconActionProps) {+ const handleClick = (event: MouseEvent<HTMLButtonElement>) => {+ event.stopPropagation();+ onClick?.();+ };++ return (+ <Button+ size="xs"+ kind="ghost"+ iconOnly+ ariaLabel={label}+ icon={icon}+ onClick={handleClick}+ className={+ className ??+ "size-7 rounded-md bg-transparent text-text-muted hover:bg-border-default hover:text-text-primary active:bg-border-default"+ }+ />+ );+}diff --git a/apps/mirai-gui/client/src/components/ui/icon-button.tsx b/apps/mirai-gui/client/src/components/ui/icon-button.tsxnew file mode 100644index 000000000..40f66701d--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/icon-button.tsx@@ -0,0 +1,23 @@+import type { ButtonHTMLAttributes, ReactNode } from "react";+import { twMerge } from "tailwind-merge";++export type IconButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children"> & {+ icon?: ReactNode;+ children?: ReactNode;+};++export function IconButton({ icon, children, className, ...rest }: IconButtonProps) {+ return (+ <button+ {...rest}+ className={twMerge(+ "inline-flex items-center gap-1 rounded-md p-0.5 bg-transparent text-gray-1000 outline-hidden focus-visible:shadow-focus",+ "hover:text-gray-1200 active:scale-[0.97] disabled:opacity-50 transition-colors duration-200",+ className,+ )}+ >+ {icon && <span className="grid place-items-center">{icon}</span>}+ {children}+ </button>+ );+}diff --git a/apps/mirai-gui/client/src/components/ui/input/constants.ts b/apps/mirai-gui/client/src/components/ui/input/constants.tsnew file mode 100644index 000000000..579f44111--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/input/constants.ts@@ -0,0 +1,39 @@+import type { InputSize, InputKind } from "./types";++export const WRAPPER_BASE =+ "inline-flex items-center bg-surface-secondary border-[0.5px] rounded-md transition-all duration-150 ease-out";++export const INPUT_SIZE_STYLES: Record<InputSize, { wrapper: string; input: string }> = {+ sm: { wrapper: "h-8 px-2.5 gap-1.5", input: "text-xs" },+ md: { wrapper: "h-9 px-3 gap-2", input: "text-sm" },+};++export const KIND_BORDER: Record<InputKind, string> = {+ default: "border-border-outlined",+ error: "border-red-500",+};++// Focus is shown with the border alone: an outward ring or ring-offset overflows+// the wrapper and collides with neighbours in tight rows (model params, toolbars).+export const KIND_FOCUS_RING: Record<InputKind, string> = {+ default: "focus-within:border-border-outlined-hover",+ error: "focus-within:border-red-500",+};++export const KIND_HOVER: Record<InputKind, string> = {+ default: "hover:border-border-outlined-hover",+ error: "hover:border-red-500",+};++export const INPUT_BASE =+ "flex-1 min-w-0 bg-transparent outline-hidden text-text-primary placeholder:text-text-muted font-normal";++export const DISABLED_WRAPPER = "opacity-40 cursor-not-allowed";+export const DISABLED_INPUT = "cursor-not-allowed";++export const ICON_COLOR: Record<InputKind, string> = {+ default: "text-text-muted",+ error: "text-red-500",+};++export const FULL_WIDTH = "w-full";diff --git a/apps/mirai-gui/client/src/components/ui/input/index.tsx b/apps/mirai-gui/client/src/components/ui/input/index.tsxnew file mode 100644index 000000000..b679900b4--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/input/index.tsx@@ -0,0 +1,64 @@+import { forwardRef } from "react";+import { twMerge } from "tailwind-merge";+import {+ DISABLED_INPUT,+ DISABLED_WRAPPER,+ FULL_WIDTH,+ ICON_COLOR,+ INPUT_BASE,+ KIND_BORDER,+ KIND_FOCUS_RING,+ KIND_HOVER,+ INPUT_SIZE_STYLES,+ WRAPPER_BASE,+} from "./constants";+import type { InputProps } from "./types";++export type { InputProps } from "./types";++/** Low-level input control for inline UIs. For forms, use TextField. */+export const Input = forwardRef<HTMLInputElement, InputProps>(function Input(props, ref) {+ const {+ size = "md",+ kind = "default",+ leftIcon,+ fullWidth = false,+ disabled = false,+ className,+ ...inputProps+ } = props;++ const sizeConfig = INPUT_SIZE_STYLES[size];++ const wrapperClasses = twMerge(+ WRAPPER_BASE,+ sizeConfig.wrapper,+ KIND_BORDER[kind],+ !disabled ? KIND_HOVER[kind] : "",+ !disabled ? KIND_FOCUS_RING[kind] : "",+ disabled ? DISABLED_WRAPPER : "",+ fullWidth ? FULL_WIDTH : "",+ className,+ );++ const inputClasses = twMerge(INPUT_BASE, sizeConfig.input, disabled ? DISABLED_INPUT : "");++ const iconColor = ICON_COLOR[kind];++ return (+ <div className={wrapperClasses}>+ {leftIcon && (+ <span className={twMerge("shrink-0 flex items-center justify-center", iconColor)} aria-hidden="true">+ {leftIcon}+ </span>+ )}+ <input+ ref={ref}+ {...inputProps}+ disabled={disabled}+ className={inputClasses}+ aria-invalid={kind === "error" || undefined}+ />+ </div>+ );+});diff --git a/apps/mirai-gui/client/src/components/ui/input/types.ts b/apps/mirai-gui/client/src/components/ui/input/types.tsnew file mode 100644index 000000000..dac7cd1d1--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/input/types.ts@@ -0,0 +1,14 @@+import type { InputHTMLAttributes, ReactNode } from "react";++export type InputSize = "sm" | "md";++export type InputKind = "default" | "error";++export type InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "className"> & {+ size?: InputSize;+ kind?: InputKind;+ leftIcon?: ReactNode;+ fullWidth?: boolean;++ className?: string;+};diff --git a/apps/mirai-gui/client/src/components/ui/modal/index.tsx b/apps/mirai-gui/client/src/components/ui/modal/index.tsxnew file mode 100644index 000000000..6e5f3edea--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/modal/index.tsx@@ -0,0 +1,104 @@+import { X } from "lucide-react";+import { Dialog, DialogPanel, DialogTitle, Transition, TransitionChild } from "@headlessui/react";+import { Fragment } from "react";+import { twMerge } from "tailwind-merge";+import { Button } from "../button";+import { Text } from "../typography";+import type { ModalProps } from "./types";++const SPRING_ENTER =+ "[transition:opacity_150ms_cubic-bezier(0.23,1,0.32,1),transform_150ms_cubic-bezier(0.23,1,0.32,1)]";+const SPRING_LEAVE =+ "[transition:opacity_100ms_cubic-bezier(0.23,1,0.32,1),transform_100ms_cubic-bezier(0.23,1,0.32,1)]";++export function Modal(props: ModalProps) {+ const {+ open,+ onClose,+ initialFocus,+ title,+ description,+ children,+ primaryLabel,+ primaryKind = "primary",+ onPrimary,+ primaryDisabled = false,+ secondaryLabel = "Cancel",+ onSecondary,+ } = props;++ const handlePrimary = onPrimary ?? onClose;+ const handleSecondary = onSecondary ?? onClose;+ const hasPrimary = Boolean(primaryLabel);++ return (+ <Transition appear show={open} as={Fragment}>+ <Dialog as="div" className="relative z-50" onClose={onClose} initialFocus={initialFocus}>+ <TransitionChild+ as={Fragment}+ enter="duration-150 ease-out"+ enterFrom="opacity-0"+ enterTo="opacity-100"+ leave="duration-100 ease-in"+ leaveFrom="opacity-100"+ leaveTo="opacity-0"+ >+ <div className="fixed inset-0 bg-overlay" />+ </TransitionChild>++ <div className="fixed inset-0 flex items-center justify-center p-4">+ <TransitionChild+ as={Fragment}+ enter={SPRING_ENTER}+ enterFrom="opacity-0 scale-[0.96]"+ enterTo="opacity-100 scale-100"+ leave={SPRING_LEAVE}+ leaveFrom="opacity-100 scale-100"+ leaveTo="opacity-0 scale-[0.96]"+ >+ <DialogPanel+ className={twMerge(+ "rounded-lg bg-surface-elevated border border-border-default p-4 text-text-primary",+ "w-[468px]",+ )}+ >+ <div className="flex items-start justify-between gap-3">+ <DialogTitle className="flex-1 min-w-0">+ <Text as="span" color="primary" opticalSize={14} className="text-[18px] font-[450] leading-[28px]">+ {title}+ </Text>+ </DialogTitle>+ <button+ type="button"+ aria-label="Close"+ onClick={onClose}+ className="shrink-0 flex items-center justify-center size-7 rounded-md text-text-muted hover:text-text-primary hover:bg-tertiary-hover transition-colors duration-150 ease-out outline-hidden focus-visible:shadow-focus cursor-pointer"+ >+ <X size={16} />+ </button>+ </div>+ {description && (+ <Text as="p" color="muted" opticalSize={20} className="mt-1.5 text-[15px] font-[450] leading-[1.6]">+ {description}+ </Text>+ )}++ {children && <div className="mt-5">{children}</div>}++ <div className="mt-6 flex justify-end gap-2 flex-wrap">+ <Button kind="secondary" size="sm" onClick={handleSecondary}>+ {secondaryLabel}+ </Button>+ {hasPrimary && (+ <Button kind={primaryKind} size="sm" onClick={handlePrimary} disabled={primaryDisabled}>+ {primaryLabel}+ </Button>+ )}+ </div>+ </DialogPanel>+ </TransitionChild>+ </div>+ </Dialog>+ </Transition>+ );+}diff --git a/apps/mirai-gui/client/src/components/ui/modal/types.ts b/apps/mirai-gui/client/src/components/ui/modal/types.tsnew file mode 100644index 000000000..902f410ba--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/modal/types.ts@@ -0,0 +1,20 @@+import type { ReactNode, RefObject } from "react";+import type { ButtonKind } from "../button/types";++export type ModalProps = {+ open: boolean;+ onClose: () => void;+ initialFocus?: RefObject<HTMLElement | null>;++ title: string;+ description?: string;+ children?: ReactNode;++ primaryLabel?: string;+ primaryKind?: ButtonKind;+ onPrimary?: () => void;+ primaryDisabled?: boolean;++ secondaryLabel?: string;+ onSecondary?: () => void;+};diff --git a/apps/mirai-gui/client/src/components/ui/popover/hover-popover/index.tsx b/apps/mirai-gui/client/src/components/ui/popover/hover-popover/index.tsxnew file mode 100644index 000000000..c46aab88c--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/popover/hover-popover/index.tsx@@ -0,0 +1,48 @@+import type { FocusEvent, KeyboardEvent, MouseEvent } from "react";+import { cloneElement, useContext, useEffect, useId, useRef } from "react";+import { HoverPopoverContext } from "./provider";+import type { HoverPopoverProps } from "./types";++export function HoverPopover({ items, trigger, side = "bottom", align = "end" }: HoverPopoverProps) {+ const context = useContext(HoverPopoverContext);+ if (!context) throw new Error("HoverPopover must be rendered inside a HoverPopoverProvider.");+ const { show, hide, contains } = context;++ const id = useId();+ const triggerNodeRef = useRef<HTMLButtonElement | null>(null);++ // The panel lives in the provider, so it would outlive a trigger that unmounts while open.+ useEffect(() => () => hide(id), [hide, id]);++ const open = (options?: { focusPanel?: boolean }) => {+ if (triggerNodeRef.current) show({ id, triggerNode: triggerNodeRef.current, items, side, align }, options);+ };++ const mergedTrigger = cloneElement(trigger, {+ ref: (node: HTMLButtonElement | null) => {+ triggerNodeRef.current = node;+ },+ "aria-haspopup": "menu",+ onMouseEnter: () => open(),+ onMouseLeave: (event: MouseEvent<HTMLElement>) => {+ if (!contains(event.relatedTarget as Node | null)) hide(id);+ },+ onFocus: (event: FocusEvent<HTMLElement>) => {+ if (event.currentTarget.matches(":focus-visible")) open();+ },+ onBlur: (event: FocusEvent<HTMLElement>) => {+ if (!contains(event.relatedTarget as Node | null)) hide(id);+ },+ onKeyDown: (event: KeyboardEvent<HTMLElement>) => {+ if (event.key === "Escape") hide(id);+ // The panel renders elsewhere in the tree, so Tab never reaches it; move+ // focus there explicitly.+ if (event.key === "Enter" || event.key === " " || event.key === "ArrowDown") {+ event.preventDefault();+ open({ focusPanel: true });+ }+ },+ });++ return <div className="relative inline-flex">{mergedTrigger}</div>;+}diff --git a/apps/mirai-gui/client/src/components/ui/popover/hover-popover/panel.tsx b/apps/mirai-gui/client/src/components/ui/popover/hover-popover/panel.tsxnew file mode 100644index 000000000..682dd447f--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/popover/hover-popover/panel.tsx@@ -0,0 +1,112 @@+import { Transition, TransitionChild } from "@headlessui/react";+import type {+ CSSProperties,+ FocusEvent as ReactFocusEvent,+ KeyboardEvent as ReactKeyboardEvent,+ MouseEvent as ReactMouseEvent,+ RefCallback,+ RefObject,+} from "react";+import { Fragment } from "react";+import { twMerge } from "tailwind-merge";+import { PopoverItemLabel } from "../shared/item-label";+import { PopoverSurface } from "../shared/surface";+import type { PopoverItem } from "../shared/types";+import { getOriginClassName } from "../shared/utils";+import type { HoverPopoverAlign, HoverPopoverSide } from "./types";++type HoverPopoverPanelProps = {+ floatingStyle: CSSProperties;+ setFloatingRef: RefCallback<HTMLDivElement>;+ open: boolean;+ afterLeave?: () => void;+ close: () => void;+ items: ReadonlyArray<PopoverItem>;+ side: HoverPopoverSide;+ align: HoverPopoverAlign;+ sideOffsetPx: number;+ onMouseEnter?: () => void;+ onMouseLeave?: (event: ReactMouseEvent<HTMLDivElement>) => void;+ onFocusCapture?: () => void;+ onBlurCapture?: (event: ReactFocusEvent<HTMLDivElement>) => void;+ onKeyDown?: (event: ReactKeyboardEvent<HTMLDivElement>) => void;+ restoreFocusRef?: RefObject<HTMLElement | null>;+};++const ENTER = "transition-[opacity,transform] duration-[120ms] ease-spring";+const LEAVE = "transition-[opacity,transform] duration-[80ms] ease-spring";++export function HoverPopoverPanel({+ floatingStyle,+ setFloatingRef,+ open,+ afterLeave,+ close,+ items,+ side,+ align,+ sideOffsetPx,+ onMouseEnter,+ onMouseLeave,+ onFocusCapture,+ onBlurCapture,+ onKeyDown,+ restoreFocusRef,+}: HoverPopoverPanelProps) {+ const wrapperStyle = {+ ...floatingStyle,+ ...(side === "top" ? { paddingBottom: sideOffsetPx } : { paddingTop: sideOffsetPx }),+ } satisfies CSSProperties;++ return (+ <div+ ref={setFloatingRef}+ style={wrapperStyle}+ {...(open ? { onMouseEnter } : {})}+ {...(open ? { onMouseLeave } : {})}+ {...(open ? { onFocusCapture } : {})}+ {...(open ? { onBlurCapture } : {})}+ {...(open ? { onKeyDown } : {})}+ role="menu"+ className={twMerge("z-50 outline-hidden", open ? "pointer-events-auto" : "pointer-events-none")}+ >+ <Transition appear show={open} as={Fragment} afterLeave={afterLeave}>+ <TransitionChild+ as="div"+ enter={ENTER}+ enterFrom="opacity-0 scale-90"+ enterTo="opacity-100 scale-100"+ leave={LEAVE}+ leaveFrom="opacity-100 scale-100"+ leaveTo="opacity-0 scale-90"+ className={getOriginClassName(side, align)}+ >+ <PopoverSurface open side={side} align={align} animated={false}>+ {items.map((item) => (+ <button+ key={item.id}+ type="button"+ role="menuitem"+ disabled={!open || item.disabled === true}+ className={twMerge(+ "flex items-center gap-2 w-full px-2.5 py-2 rounded-md bg-transparent border-none outline-hidden text-left hover:bg-surface-tertiary focus:bg-surface-tertiary",+ item.disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer",+ item.danger ? "text-red-500" : "text-text-primary",+ )}+ onClick={(event) => {+ if (item.disabled) return;+ restoreFocusRef?.current?.focus({ preventScroll: true });+ item.onClick?.(event);+ close();+ }}+ >+ {item.icon && <span className="shrink-0">{item.icon}</span>}+ <PopoverItemLabel label={item.label} />+ </button>+ ))}+ </PopoverSurface>+ </TransitionChild>+ </Transition>+ </div>+ );+}diff --git a/apps/mirai-gui/client/src/components/ui/popover/hover-popover/provider.tsx b/apps/mirai-gui/client/src/components/ui/popover/hover-popover/provider.tsxnew file mode 100644index 000000000..b0bbe85f4--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/popover/hover-popover/provider.tsx@@ -0,0 +1,121 @@+import { createContext, useCallback, useEffect, useMemo, useRef, useState } from "react";+import { usePopoverFloating } from "../shared/use-popover-floating";+import type { HoverPopoverContextValue, HoverPopoverPayload, HoverPopoverProviderProps } from "./types";+import { HoverPopoverPanel } from "./panel";++export const HoverPopoverContext = createContext<HoverPopoverContextValue | null>(null);++export function HoverPopoverProvider({ children }: HoverPopoverProviderProps) {+ const [active, setActive] = useState<HoverPopoverPayload | null>(null);+ const [visible, setVisible] = useState(false);+ const activeRef = useRef<HoverPopoverPayload | null>(null);+ const visibleRef = useRef(false);+ const panelNodeRef = useRef<HTMLDivElement | null>(null);+ const restoreFocusRef = useRef<HTMLElement | null>(null);+ const floating = usePopoverFloating({+ side: active?.side ?? "bottom",+ align: active?.align ?? "end",+ sideOffsetPx: 0,+ });++ useEffect(() => {+ activeRef.current = active;+ visibleRef.current = visible;+ floating.setTriggerRef(active?.triggerNode ?? null);+ restoreFocusRef.current = active?.triggerNode ?? null;+ }, [active, floating, visible]);++ const focusPanelPendingRef = useRef(false);++ const show = useCallback((payload: HoverPopoverPayload, options?: { focusPanel?: boolean }) => {+ activeRef.current = payload;+ focusPanelPendingRef.current = options?.focusPanel === true;+ setActive(payload);+ setVisible(true);+ }, []);++ useEffect(() => {+ if (!visible || !focusPanelPendingRef.current) return;+ focusPanelPendingRef.current = false;+ panelNodeRef.current?.querySelector<HTMLButtonElement>("button:not(:disabled)")?.focus({ preventScroll: true });+ }, [visible, active]);++ const focusItemFrom = (current: HTMLElement, step: 1 | -1) => {+ const buttons = Array.from(+ panelNodeRef.current?.querySelectorAll<HTMLButtonElement>("button:not(:disabled)") ?? [],+ );+ if (buttons.length === 0) return;+ const index = buttons.findIndex((button) => button === current);+ buttons[(index + step + buttons.length) % buttons.length]?.focus();+ };++ const hide = useCallback((id: string) => {+ const current = activeRef.current;++ if (!current || current.id !== id) return;++ setVisible(false);+ }, []);++ const handleAfterLeave = useCallback(() => {+ if (!activeRef.current || visibleRef.current) return;++ activeRef.current = null;+ setActive(null);+ restoreFocusRef.current = null;+ floating.setTriggerRef(null);+ }, [floating]);++ // Moving between the trigger and its panel must not close the popover.+ const contains = useCallback((node: Node | null) => {+ const current = activeRef.current;+ if (!node || !current) return false;++ return Boolean(current.triggerNode.contains(node) || panelNodeRef.current?.contains(node));+ }, []);++ const contextValue = useMemo<HoverPopoverContextValue>(() => ({ show, hide, contains }), [contains, hide, show]);++ return (+ <HoverPopoverContext.Provider value={contextValue}>+ {children}+ {active && (+ <HoverPopoverPanel+ floatingStyle={floating.floatingStyle}+ setFloatingRef={(node) => {+ panelNodeRef.current = node;+ floating.setFloatingRef(node);+ }}+ open={visible}+ afterLeave={handleAfterLeave}+ close={() => hide(active.id)}+ items={active.items}+ side={active.side}+ align={active.align}+ sideOffsetPx={4}+ onMouseEnter={() => setVisible(true)}+ onMouseLeave={(event) => {+ if (contains(event.relatedTarget as Node | null)) return;+ setVisible(false);+ }}+ onFocusCapture={() => setVisible(true)}+ onBlurCapture={(event) => {+ if (contains(event.relatedTarget as Node | null)) return;+ setVisible(false);+ }}+ onKeyDown={(event) => {+ if (event.key === "Escape") {+ event.preventDefault();+ restoreFocusRef.current?.focus({ preventScroll: true });+ setVisible(false);+ } else if (event.key === "ArrowDown" || event.key === "ArrowUp") {+ event.preventDefault();+ focusItemFrom(event.target as HTMLElement, event.key === "ArrowDown" ? 1 : -1);+ }+ }}+ restoreFocusRef={restoreFocusRef}+ />+ )}+ </HoverPopoverContext.Provider>+ );+}diff --git a/apps/mirai-gui/client/src/components/ui/popover/hover-popover/types.ts b/apps/mirai-gui/client/src/components/ui/popover/hover-popover/types.tsnew file mode 100644index 000000000..d474714c3--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/popover/hover-popover/types.ts@@ -0,0 +1,31 @@+import type { ReactElement, ReactNode } from "react";+import type { PopoverAlign, PopoverItem, PopoverSide } from "../shared/types";++export type HoverPopoverItem = PopoverItem;+export type HoverPopoverSide = PopoverSide;+export type HoverPopoverAlign = PopoverAlign;++export type HoverPopoverProviderProps = {+ children: ReactNode;+};++export type HoverPopoverProps = {+ items: ReadonlyArray<HoverPopoverItem>;+ trigger: ReactElement;+ side?: HoverPopoverSide;+ align?: HoverPopoverAlign;+};++export type HoverPopoverPayload = {+ id: string;+ triggerNode: HTMLButtonElement;+ items: ReadonlyArray<HoverPopoverItem>;+ side: HoverPopoverSide;+ align: HoverPopoverAlign;+};++export type HoverPopoverContextValue = {+ show: (payload: HoverPopoverPayload, options?: { focusPanel?: boolean }) => void;+ hide: (id: string) => void;+ contains: (node: Node | null) => boolean;+};diff --git a/apps/mirai-gui/client/src/components/ui/popover/popover-menu/index.tsx b/apps/mirai-gui/client/src/components/ui/popover/popover-menu/index.tsxnew file mode 100644index 000000000..b374dbe79--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/popover/popover-menu/index.tsx@@ -0,0 +1,144 @@+import { Menu, MenuButton } from "@headlessui/react";+import type {+ CSSProperties,+ KeyboardEvent as ReactKeyboardEvent,+ PointerEvent as ReactPointerEvent,+ ReactElement,+} from "react";+import { Fragment, cloneElement, useCallback, useEffect, useRef } from "react";+import { usePopoverFloating } from "../shared/use-popover-floating";+import type { PopoverMenuProps } from "./types";+import { PopoverMenuPanel } from "./panel";++const renderTrigger = (trigger: PopoverMenuProps["trigger"], open: boolean): ReactElement =>+ typeof trigger === "function" ? trigger(open) : trigger;++type PopoverMenuContentProps = {+ menuOpen: boolean;+ close: () => void;+ trigger: PopoverMenuProps["trigger"];+ items: PopoverMenuProps["items"];+ side: NonNullable<PopoverMenuProps["side"]>;+ align: NonNullable<PopoverMenuProps["align"]>;+ className: string | undefined;+ itemClassName: string | undefined;+ setTriggerRef: (node: HTMLButtonElement | null) => void;+ setFloatingRef: (node: HTMLDivElement | null) => void;+ floatingStyle: CSSProperties;+};++function PopoverMenuContent({+ menuOpen,+ close,+ trigger,+ items,+ side,+ align,+ className,+ itemClassName,+ setTriggerRef,+ setFloatingRef,+ floatingStyle,+}: PopoverMenuContentProps) {+ const openMethodRef = useRef<"keyboard" | "pointer" | null>(null);++ const setMergedItemsRef = useCallback(+ (node: HTMLDivElement | null) => {+ setFloatingRef(node);++ if (node === null || !menuOpen || openMethodRef.current !== "keyboard") {+ return;+ }++ const firstEnabledItem = node.querySelector<HTMLButtonElement>("button:not(:disabled)");++ firstEnabledItem?.focus({ preventScroll: true });+ },+ [menuOpen, setFloatingRef],+ );++ useEffect(() => {+ if (!menuOpen) {+ openMethodRef.current = null;+ }+ }, [menuOpen]);++ const triggerElement = renderTrigger(trigger, menuOpen);+ const triggerOnKeyDownCapture = triggerElement.props.onKeyDownCapture as+ ((event: ReactKeyboardEvent<HTMLElement>) => void) | undefined;+ const triggerOnPointerDownCapture = triggerElement.props.onPointerDownCapture as+ ((event: ReactPointerEvent<HTMLElement>) => void) | undefined;++ const mergedTrigger = cloneElement(triggerElement, {+ onKeyDownCapture: (event: ReactKeyboardEvent<HTMLElement>) => {+ triggerOnKeyDownCapture?.(event);+ if (event.defaultPrevented) return;+ if (event.key === "Enter" || event.key === " " || event.key === "ArrowDown" || event.key === "ArrowUp") {+ openMethodRef.current = "keyboard";+ }+ },+ onPointerDownCapture: (event: ReactPointerEvent<HTMLElement>) => {+ triggerOnPointerDownCapture?.(event);+ if (event.defaultPrevented) return;+ openMethodRef.current = "pointer";+ },+ });++ return (+ <>+ <MenuButton ref={setTriggerRef} as={Fragment}>+ {mergedTrigger}+ </MenuButton>+ {menuOpen ? (+ <PopoverMenuPanel+ floatingStyle={floatingStyle}+ setFloatingRef={setMergedItemsRef}+ menuOpen={menuOpen}+ close={close}+ items={items}+ side={side}+ align={align}+ className={className}+ itemClassName={itemClassName}+ />+ ) : null}+ </>+ );+}++export function PopoverMenu({+ items,+ trigger,+ side = "bottom",+ align = "end",+ sideOffsetPx,+ className,+ itemClassName,+}: PopoverMenuProps) {+ const resolvedSideOffsetPx = sideOffsetPx ?? 4;+ const floating = usePopoverFloating({+ side,+ align,+ sideOffsetPx: resolvedSideOffsetPx,+ });++ return (+ <Menu as="div" className="relative inline-flex">+ {({ open: menuOpen, close }) => (+ <PopoverMenuContent+ menuOpen={menuOpen}+ close={close}+ trigger={trigger}+ items={items}+ side={side}+ align={align}+ className={className}+ itemClassName={itemClassName}+ setTriggerRef={floating.setTriggerRef}+ setFloatingRef={floating.setFloatingRef}+ floatingStyle={floating.floatingStyle}+ />+ )}+ </Menu>+ );+}diff --git a/apps/mirai-gui/client/src/components/ui/popover/popover-menu/panel.tsx b/apps/mirai-gui/client/src/components/ui/popover/popover-menu/panel.tsxnew file mode 100644index 000000000..8d9878d19--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/popover/popover-menu/panel.tsx@@ -0,0 +1,67 @@+import { MenuItem, MenuItems } from "@headlessui/react";+import type { CSSProperties, RefCallback } from "react";+import { twMerge } from "tailwind-merge";+import { PopoverItemLabel } from "../shared/item-label";+import { PopoverSurface } from "../shared/surface";+import type { PopoverItem } from "../shared/types";+import type { PopoverMenuAlign, PopoverMenuSide } from "./types";++type PopoverMenuPanelProps = {+ floatingStyle: CSSProperties;+ setFloatingRef: RefCallback<HTMLDivElement>;+ menuOpen: boolean;+ close: () => void;+ items: ReadonlyArray<PopoverItem>;+ side: PopoverMenuSide;+ align: PopoverMenuAlign;+ className?: string;+ itemClassName?: string;+};++export function PopoverMenuPanel({+ floatingStyle,+ setFloatingRef,+ menuOpen,+ close,+ items,+ side,+ align,+ className,+ itemClassName,+}: PopoverMenuPanelProps) {+ return (+ <MenuItems+ ref={setFloatingRef}+ style={floatingStyle}+ className={twMerge("z-50 outline-hidden", menuOpen ? "pointer-events-auto" : undefined)}+ >+ <PopoverSurface open={menuOpen} side={side} align={align} className={className}>+ {items.map((item) => (+ <MenuItem+ key={item.id}+ as="button"+ type="button"+ disabled={item.disabled ?? false}+ className={({ focus, disabled }) =>+ twMerge(+ "flex items-center gap-2 w-full px-2.5 py-2 rounded-md bg-transparent border-none outline-hidden text-left",+ focus ? "bg-surface-tertiary" : undefined,+ disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer",+ item.danger ? "text-red-500" : "text-text-primary",+ itemClassName,+ )+ }+ onClick={(event) => {+ if (item.disabled) return;+ close();+ item.onClick?.(event);+ }}+ >+ {item.icon && <span className="shrink-0">{item.icon}</span>}+ <PopoverItemLabel label={item.label} />+ </MenuItem>+ ))}+ </PopoverSurface>+ </MenuItems>+ );+}diff --git a/apps/mirai-gui/client/src/components/ui/popover/popover-menu/types.ts b/apps/mirai-gui/client/src/components/ui/popover/popover-menu/types.tsnew file mode 100644index 000000000..3625675a2--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/popover/popover-menu/types.ts@@ -0,0 +1,15 @@+import type { PopoverAlign, PopoverItem, PopoverSide, PopoverTrigger } from "../shared/types";++export type PopoverMenuItem = PopoverItem;+export type PopoverMenuSide = PopoverSide;+export type PopoverMenuAlign = PopoverAlign;++export type PopoverMenuProps = {+ items: ReadonlyArray<PopoverMenuItem>;+ trigger: PopoverTrigger;+ side?: PopoverMenuSide;+ align?: PopoverMenuAlign;+ sideOffsetPx?: number;+ className?: string;+ itemClassName?: string;+};diff --git a/apps/mirai-gui/client/src/components/ui/popover/shared/constants.ts b/apps/mirai-gui/client/src/components/ui/popover/shared/constants.tsnew file mode 100644index 000000000..531fef3f3--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/popover/shared/constants.ts@@ -0,0 +1,4 @@+export const TEXT_13 = "text-[13px] font-[450] leading-[1.3]";+export const TEXT_13_STYLE = { fontVariationSettings: "'opsz' 14" } as const;++export const TRANSITION_BASE = "transition-[opacity,transform] ease-spring";diff --git a/apps/mirai-gui/client/src/components/ui/popover/shared/item-label.tsx b/apps/mirai-gui/client/src/components/ui/popover/shared/item-label.tsxnew file mode 100644index 000000000..6dbb20906--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/popover/shared/item-label.tsx@@ -0,0 +1,19 @@+import type { ReactNode } from "react";+import { TEXT_13, TEXT_13_STYLE } from "./constants";+import { isPlainTextLabel } from "./utils";++type PopoverItemLabelProps = {+ label: ReactNode;+};++export function PopoverItemLabel({ label }: PopoverItemLabelProps) {+ if (!isPlainTextLabel(label)) {+ return <>{label}</>;+ }++ return (+ <span className={TEXT_13} style={TEXT_13_STYLE}>+ {label}+ </span>+ );+}diff --git a/apps/mirai-gui/client/src/components/ui/popover/shared/surface.tsx b/apps/mirai-gui/client/src/components/ui/popover/shared/surface.tsxnew file mode 100644index 000000000..b6d60c921--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/popover/shared/surface.tsx@@ -0,0 +1,28 @@+import type { ReactNode } from "react";+import { twMerge } from "tailwind-merge";+import { getAnimationClassName, getOriginClassName } from "./utils";+import type { PopoverAlign, PopoverSide } from "./types";++type PopoverSurfaceProps = {+ open: boolean;+ side: PopoverSide;+ align: PopoverAlign;+ className?: string;+ children?: ReactNode;+ animated?: boolean;+};++export function PopoverSurface({ open, side, align, className, children, animated = true }: PopoverSurfaceProps) {+ return (+ <div+ className={twMerge(+ "rounded-lg bg-surface-elevated shadow-sm p-1.5 min-w-[140px]",+ animated ? getOriginClassName(side, align) : undefined,+ animated ? getAnimationClassName(open) : undefined,+ className,+ )}+ >+ {children}+ </div>+ );+}diff --git a/apps/mirai-gui/client/src/components/ui/popover/shared/types.ts b/apps/mirai-gui/client/src/components/ui/popover/shared/types.tsnew file mode 100644index 000000000..875cf802d--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/popover/shared/types.ts@@ -0,0 +1,15 @@+import type { MouseEvent, ReactElement, ReactNode } from "react";++export type PopoverItem = {+ id: string;+ label: ReactNode;+ icon?: ReactNode;+ danger?: boolean;+ disabled?: boolean;+ onClick?: (event: MouseEvent<HTMLElement>) => void;+};++export type PopoverSide = "top" | "bottom";+export type PopoverAlign = "start" | "end";++export type PopoverTrigger = ReactElement | ((open: boolean) => ReactElement);diff --git a/apps/mirai-gui/client/src/components/ui/popover/shared/use-popover-floating.ts b/apps/mirai-gui/client/src/components/ui/popover/shared/use-popover-floating.tsnew file mode 100644index 000000000..e85209995--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/popover/shared/use-popover-floating.ts@@ -0,0 +1,39 @@+import { autoUpdate, offset, shift, useFloating, type Placement } from "@floating-ui/react-dom";+import type { CSSProperties, RefCallback } from "react";+import type { PopoverAlign, PopoverSide } from "./types";++export type PopoverFloatingConfig = {+ side: PopoverSide;+ align: PopoverAlign;+ sideOffsetPx: number;+};++export type PopoverFloatingResult = {+ floatingStyle: CSSProperties;+ setTriggerRef: RefCallback<HTMLButtonElement>;+ setFloatingRef: RefCallback<HTMLDivElement>;+};++const getPlacement = (side: PopoverSide, align: PopoverAlign): Placement => {+ const resolvedSide = side === "top" ? "top" : "bottom";+ const resolvedAlign = align === "start" ? "start" : "end";++ return `${resolvedSide}-${resolvedAlign}`;+};++export function usePopoverFloating({ side, align, sideOffsetPx }: PopoverFloatingConfig): PopoverFloatingResult {+ const placement = getPlacement(side, align);++ const { refs, floatingStyles } = useFloating({+ strategy: "fixed",+ placement,+ whileElementsMounted: autoUpdate,+ middleware: [offset(sideOffsetPx), shift({ padding: 8 })],+ });++ return {+ floatingStyle: floatingStyles,+ setTriggerRef: refs.setReference,+ setFloatingRef: refs.setFloating,+ };+}diff --git a/apps/mirai-gui/client/src/components/ui/popover/shared/utils.ts b/apps/mirai-gui/client/src/components/ui/popover/shared/utils.tsnew file mode 100644index 000000000..fc6f6e18c--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/popover/shared/utils.ts@@ -0,0 +1,21 @@+import { twMerge } from "tailwind-merge";+import { TRANSITION_BASE } from "./constants";+import type { PopoverAlign, PopoverSide } from "./types";++export const isPlainTextLabel = (value: unknown): value is string | number =>+ typeof value === "string" || typeof value === "number";++export const getOriginClassName = (side: PopoverSide, align: PopoverAlign) => {+ if (side === "top") {+ return align === "start" ? "origin-bottom-left" : "origin-bottom-right";+ }++ return align === "start" ? "origin-top-left" : "origin-top-right";+};++export const getAnimationClassName = (open: boolean) =>+ twMerge(+ TRANSITION_BASE,+ open ? "duration-[120ms]" : "duration-[80ms]",+ open ? "opacity-100 scale-100" : "opacity-0 scale-90",+ );diff --git a/apps/mirai-gui/client/src/components/ui/search-input.tsx b/apps/mirai-gui/client/src/components/ui/search-input.tsxnew file mode 100644index 000000000..735b0eddf--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/search-input.tsx@@ -0,0 +1,23 @@+import { Search } from "lucide-react";+import { Input } from "./input";++export type SearchInputProps = {+ value: string;+ onChange: (value: string) => void;+ placeholder?: string;+ className?: string;+};++export function SearchInput({ value, onChange, placeholder = "Search", className }: SearchInputProps) {+ return (+ <Input+ size="sm"+ fullWidth+ leftIcon={<Search size={14} />}+ value={value}+ onChange={(e) => onChange(e.target.value)}+ placeholder={placeholder}+ className={className}+ />+ );+}diff --git a/apps/mirai-gui/client/src/components/ui/segmented-control.tsx b/apps/mirai-gui/client/src/components/ui/segmented-control.tsxnew file mode 100644index 000000000..45578f5b2--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/segmented-control.tsx@@ -0,0 +1,56 @@+import type { ReactNode } from "react";+import { twMerge } from "tailwind-merge";++export type SegmentedControlOption = {+ value: string;+ label: ReactNode;+ disabled?: boolean;+ ariaLabel?: string;+};++export type SegmentedControlProps = {+ value: string;+ onChange: (value: string) => void;+ options: ReadonlyArray<SegmentedControlOption>;+ // Required: a radiogroup without an accessible name is announced as unlabelled.+ ariaLabel: string;+};++const CONTAINER_CLASSES =+ "inline-flex w-fit h-7 items-center rounded-lg overflow-hidden border border-border-default bg-transparent";++export function SegmentedControl({ value, onChange, options, ariaLabel }: SegmentedControlProps) {+ const handleSelect = (option: SegmentedControlOption) => {+ if (option.disabled || option.value === value) return;+ onChange(option.value);+ };++ return (+ <div role="radiogroup" aria-label={ariaLabel} className={CONTAINER_CLASSES}>+ {options.map((option, index) => {+ const isSelected = option.value === value;+ const segmentClasses = twMerge(+ "h-full px-2 inline-flex items-center gap-2 text-xs transition-colors select-none",+ index > 0 ? "border-l border-border-default" : undefined,+ isSelected ? "bg-surface-tertiary text-text-primary" : "text-text-muted hover:bg-surface-tertiary",+ option.disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer",+ );++ return (+ <button+ key={option.value}+ type="button"+ role="radio"+ aria-checked={isSelected}+ aria-label={option.ariaLabel}+ disabled={option.disabled}+ onClick={() => handleSelect(option)}+ className={segmentClasses}+ >+ {option.label}+ </button>+ );+ })}+ </div>+ );+}diff --git a/apps/mirai-gui/client/src/components/ui/select/constants.ts b/apps/mirai-gui/client/src/components/ui/select/constants.tsnew file mode 100644index 000000000..77dca1632--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/select/constants.ts@@ -0,0 +1,3 @@+export const SELECT_ROW_BASE_CLASSNAME = "text-xs leading-[130%] cursor-pointer select-none rounded-md p-2";++export const SELECT_ROW_ACTIVE_CLASSNAME = "bg-surface-tertiary";diff --git a/apps/mirai-gui/client/src/components/ui/select/selection-item/index.tsx b/apps/mirai-gui/client/src/components/ui/select/selection-item/index.tsxnew file mode 100644index 000000000..473381065--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/select/selection-item/index.tsx@@ -0,0 +1,31 @@+import { forwardRef, type ElementType } from "react";+import { twMerge } from "tailwind-merge";+import { SELECT_ROW_ACTIVE_CLASSNAME, SELECT_ROW_BASE_CLASSNAME } from "../constants";+import type { SelectionItemProps } from "./types";++function SelectionItemInner(+ { as, active = false, selected = false, disabled = false, children, className, ...props }: SelectionItemProps,+ ref: React.ForwardedRef<HTMLElement>,+) {+ const Component = as as ElementType;+ const resolvedProps = props as Record<string, unknown>;++ return (+ <Component+ ref={ref}+ className={twMerge(+ SELECT_ROW_BASE_CLASSNAME,+ className,+ active || selected ? SELECT_ROW_ACTIVE_CLASSNAME : undefined,+ disabled ? "opacity-50 cursor-not-allowed" : undefined,+ )}+ {...resolvedProps}+ >+ {children}+ </Component>+ );+}++export const SelectionItem = forwardRef(SelectionItemInner) as (+ props: SelectionItemProps & { ref?: React.ForwardedRef<HTMLElement> },+) => React.ReactElement | null;diff --git a/apps/mirai-gui/client/src/components/ui/select/selection-item/types.ts b/apps/mirai-gui/client/src/components/ui/select/selection-item/types.tsnew file mode 100644index 000000000..bd5412ac5--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/select/selection-item/types.ts@@ -0,0 +1,30 @@+import type { ButtonHTMLAttributes, ElementType, MouseEventHandler, ReactNode } from "react";++export type SelectionItemLinkLikeProps = {+ to: string;+ className?: string;+ children: ReactNode;+ onClick?: MouseEventHandler<HTMLElement>;+};++export type SelectionItemLinkLikeComponent = ElementType<SelectionItemLinkLikeProps>;++type BaseSelectionItemProps = {+ active?: boolean;+ selected?: boolean;+ disabled?: boolean;+ children: ReactNode;+ className?: string;+};++export type SelectionItemButtonProps = BaseSelectionItemProps &+ Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children" | "className" | "disabled"> & {+ as: "button";+ };++export type SelectionItemLinkProps = BaseSelectionItemProps &+ SelectionItemLinkLikeProps & {+ as: SelectionItemLinkLikeComponent;+ };++export type SelectionItemProps = SelectionItemButtonProps | SelectionItemLinkProps;diff --git a/apps/mirai-gui/client/src/components/ui/select/selection-panel.tsx b/apps/mirai-gui/client/src/components/ui/select/selection-panel.tsxnew file mode 100644index 000000000..8e8c2d1e6--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/select/selection-panel.tsx@@ -0,0 +1,13 @@+import type { ComponentPropsWithoutRef } from "react";+import { twMerge } from "tailwind-merge";++type SelectionPanelProps = ComponentPropsWithoutRef<"div">;++export function SelectionPanel({ className, ...props }: SelectionPanelProps) {+ return (+ <div+ className={twMerge("rounded-lg bg-surface-elevated shadow-sm outline-hidden origin-bottom-right", className)}+ {...props}+ />+ );+}diff --git a/apps/mirai-gui/client/src/components/ui/select/selection-section.tsx b/apps/mirai-gui/client/src/components/ui/select/selection-section.tsxnew file mode 100644index 000000000..6b9a43297--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/select/selection-section.tsx@@ -0,0 +1,19 @@+import type { ComponentPropsWithoutRef } from "react";+import { twMerge } from "tailwind-merge";++type SelectionSectionProps = ComponentPropsWithoutRef<"div"> & {+ divided?: boolean;+};++export function SelectionSection({ divided = false, className, ...props }: SelectionSectionProps) {+ return (+ <div+ className={twMerge(+ "px-1.5 flex flex-col gap-0.5",+ divided ? "border-t border-border-default mt-1" : undefined,+ className,+ )}+ {...props}+ />+ );+}diff --git a/apps/mirai-gui/client/src/components/ui/spinner.tsx b/apps/mirai-gui/client/src/components/ui/spinner.tsxnew file mode 100644index 000000000..ce65e3a24--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/spinner.tsx@@ -0,0 +1,29 @@+import type { CSSProperties } from "react";++type SpinnerProps = {+ size?: number;+ className?: string;+};++export function Spinner({ size = 16, className = "" }: SpinnerProps) {+ const style: CSSProperties = {+ width: size,+ height: size,+ animationDuration: "0.8s",+ };+ const resolvedClassName = className ? `animate-spin ${className}` : "animate-spin";++ return (+ <svg+ className={resolvedClassName}+ style={style}+ viewBox="0 0 24 24"+ fill="none"+ xmlns="http://www.w3.org/2000/svg"+ aria-hidden="true"+ >+ <circle cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="3" strokeLinecap="round" opacity="0.25" />+ <path d="M12 2C6.48 2 2 6.48 2 12" stroke="currentColor" strokeWidth="3" strokeLinecap="round" />+ </svg>+ );+}diff --git a/apps/mirai-gui/client/src/components/ui/text-area/index.tsx b/apps/mirai-gui/client/src/components/ui/text-area/index.tsxnew file mode 100644index 000000000..cc8fca1ff--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/text-area/index.tsx@@ -0,0 +1,33 @@+import { forwardRef } from "react";+import { twMerge } from "tailwind-merge";+import { useAutosize } from "./use-autosize";+import type { TextAreaProps } from "./types";++export const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(function TextArea(+ { value, onChange, rows = 3, maxHeightPx, className = "", ...rest }: TextAreaProps,+ ref,+) {+ const resolvedValue = value ?? "";+ const { setRef, onInput } = useAutosize({+ ref,+ value: resolvedValue,+ rows,+ enabled: maxHeightPx !== undefined,+ maxHeightPx,+ });++ return (+ <textarea+ ref={setRef}+ className={twMerge(+ "w-full resize-none outline-hidden thin-scrollbar text-text-primary placeholder:text-text-muted",+ className,+ )}+ value={resolvedValue}+ rows={rows}+ onChange={(e) => onChange(e.target.value)}+ onInput={onInput}+ {...rest}+ />+ );+});diff --git a/apps/mirai-gui/client/src/components/ui/text-area/types.ts b/apps/mirai-gui/client/src/components/ui/text-area/types.tsnew file mode 100644index 000000000..c9436a97b--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/text-area/types.ts@@ -0,0 +1,8 @@+import type { ComponentPropsWithoutRef } from "react";++export type TextAreaProps = Omit<ComponentPropsWithoutRef<"textarea">, "value" | "onChange" | "className"> & {+ value: string | null;+ onChange: (value: string) => void;+ maxHeightPx?: number;+ className?: string;+};diff --git a/apps/mirai-gui/client/src/components/ui/text-area/use-autosize.ts b/apps/mirai-gui/client/src/components/ui/text-area/use-autosize.tsnew file mode 100644index 000000000..3130a42b2--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/text-area/use-autosize.ts@@ -0,0 +1,48 @@+import type { Ref } from "react";+import { useCallback, useEffect, useMemo, useRef } from "react";+import { createAdjustTextAreaHeightHandler, setMergedRef } from "./utils";++type UseAutosizeParams = {+ ref: Ref<HTMLTextAreaElement> | undefined;+ value: string;+ rows: number;+ maxHeightPx?: number;+ enabled: boolean;+};++type UseAutosizeResult = {+ setRef: (node: HTMLTextAreaElement | null) => void;+ onInput: (() => void) | undefined;+};++export const useAutosize = ({ ref, value, rows, maxHeightPx, enabled }: UseAutosizeParams): UseAutosizeResult => {+ const localRef = useRef<HTMLTextAreaElement | null>(null);++ const setRef = useCallback(+ (node: HTMLTextAreaElement | null) => {+ localRef.current = node;+ setMergedRef(ref, node);+ },+ [ref],+ );++ const adjustHeight = useMemo(+ () =>+ createAdjustTextAreaHeightHandler({+ getTextarea: () => localRef.current,+ rows,+ maxHeightPx,+ }),+ [rows, maxHeightPx],+ );++ useEffect(() => {+ if (!enabled) return;+ adjustHeight();+ }, [value, enabled, adjustHeight]);++ return {+ setRef,+ onInput: enabled ? adjustHeight : undefined,+ };+};diff --git a/apps/mirai-gui/client/src/components/ui/text-area/utils.ts b/apps/mirai-gui/client/src/components/ui/text-area/utils.tsnew file mode 100644index 000000000..f0dd0858d--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/text-area/utils.ts@@ -0,0 +1,59 @@+import type { MutableRefObject, Ref } from "react";++type TextAreaResizeParams = {+ textarea: HTMLTextAreaElement;+ maxHeightPx?: number;+ rows: number;+};++type TextAreaAdjustOptions = {+ getTextarea: () => HTMLTextAreaElement | null;+ rows: number;+ maxHeightPx?: number;+};++const isMutableRef = (+ value: Ref<HTMLTextAreaElement> | undefined,+): value is MutableRefObject<HTMLTextAreaElement | null> =>+ value !== null && typeof value === "object" && "current" in value;++export const setMergedRef = (ref: Ref<HTMLTextAreaElement> | undefined, node: HTMLTextAreaElement | null) => {+ if (typeof ref === "function") {+ ref(node);+ return;+ }+ if (isMutableRef(ref)) {+ ref.current = node;+ }+};++const adjustTextAreaHeight = ({ textarea, maxHeightPx, rows }: TextAreaResizeParams) => {+ textarea.style.height = "auto";+ const styles = window.getComputedStyle(textarea);+ const lineHeight = parseInt(styles.lineHeight, 10);+ const paddingTop = parseInt(styles.paddingTop, 10);+ const paddingBottom = parseInt(styles.paddingBottom, 10);+ const minHeightFromStyle = parseInt(styles.minHeight, 10);+ const scrollHeight = textarea.scrollHeight;+ const minHeightComputed = lineHeight * rows + paddingTop + paddingBottom;+ const minHeight = Number.isNaN(minHeightFromStyle)+ ? minHeightComputed+ : Math.max(minHeightComputed, minHeightFromStyle);+ const nextHeight = Math.max(scrollHeight, minHeight);++ if (maxHeightPx !== undefined && nextHeight > maxHeightPx) {+ textarea.style.height = `${maxHeightPx}px`;+ textarea.style.overflowY = "auto";+ return;+ }+ textarea.style.height = `${nextHeight}px`;+ textarea.style.overflowY = "hidden";+};++export const createAdjustTextAreaHeightHandler = ({ getTextarea, rows, maxHeightPx }: TextAreaAdjustOptions) => {+ return () => {+ const textarea = getTextarea();+ if (!textarea) return;+ adjustTextAreaHeight({ textarea, rows, maxHeightPx });+ };+};diff --git a/apps/mirai-gui/client/src/components/ui/text-field.tsx b/apps/mirai-gui/client/src/components/ui/text-field.tsxnew file mode 100644index 000000000..be8bd86b2--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/text-field.tsx@@ -0,0 +1,30 @@+import { useId, type Ref } from "react";+import { Input, type InputProps } from "./input";++export type TextFieldProps = {+ error?: string;+ // aria-describedby is owned here: it wires the control to the error message.+ controlProps: Omit<InputProps, "aria-describedby"> & { ref?: Ref<HTMLInputElement> };+};++export function TextField({ error, controlProps }: TextFieldProps) {+ const reactId = useId();+ const controlId = controlProps.id ?? `field-${reactId}`;+ const errorId = error ? `${controlId}-error` : undefined;++ return (+ <div className="flex flex-col w-full">+ <Input+ {...controlProps}+ id={controlId}+ kind={error ? "error" : (controlProps.kind ?? "default")}+ aria-describedby={errorId}+ />+ {errorId && (+ <p id={errorId} className="mt-1.5 text-xs text-red-500">+ {error}+ </p>+ )}+ </div>+ );+}diff --git a/apps/mirai-gui/client/src/components/ui/text-shimmer.tsx b/apps/mirai-gui/client/src/components/ui/text-shimmer.tsxnew file mode 100644index 000000000..03a21c3ce--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/text-shimmer.tsx@@ -0,0 +1,43 @@+import React from "react";+import { motion } from "motion/react";+import { twMerge } from "tailwind-merge";++export type TextShimmerProps = {+ children: string;+ className?: string;+ duration?: number;+ spread?: number;+};++function TextShimmerComponent({ children, className, duration = 2, spread = 2 }: TextShimmerProps) {+ const dynamicSpread = children.length * spread;++ return (+ <motion.p+ className={twMerge(+ "relative inline-block bg-[length:250%_100%,auto] bg-clip-text",+ "text-transparent [--base-color:#a1a1aa] [--base-gradient-color:#000]",+ "[background-repeat:no-repeat,padding-box] [--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--base-gradient-color),#0000_calc(50%+var(--spread)))]",+ "dark:[--base-color:#71717a] dark:[--base-gradient-color:#ffffff] dark:[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--base-gradient-color),#0000_calc(50%+var(--spread)))]",+ className,+ )}+ initial={{ backgroundPosition: "100% center" }}+ animate={{ backgroundPosition: "0% center" }}+ transition={{+ repeat: Infinity,+ duration,+ ease: "linear",+ }}+ style={+ {+ "--spread": `${dynamicSpread}px`,+ backgroundImage: `var(--bg), linear-gradient(var(--base-color), var(--base-color))`,+ } as React.CSSProperties+ }+ >+ {children}+ </motion.p>+ );+}++export const TextShimmer = React.memo(TextShimmerComponent);diff --git a/apps/mirai-gui/client/src/components/ui/toast/custom-toast.tsx b/apps/mirai-gui/client/src/components/ui/toast/custom-toast.tsxnew file mode 100644index 000000000..5f0a76eee--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/toast/custom-toast.tsx@@ -0,0 +1,74 @@+import { Info, TriangleAlert, X } from "lucide-react";+import type { ReactNode } from "react";+import type { Toast } from "react-hot-toast";+import toast from "react-hot-toast";+import { twMerge } from "tailwind-merge";+import { IconButton } from "../icon-button";+import { IconCheckCircleFilled } from "../../icons/check-circle-filled-icon";+import type { ToastType } from "./types";++export type CustomToastProps = {+ t: Toast;+ message: ReactNode;+ type: ToastType;+ onClick?: () => void;+};++type ToastIconConfig = {+ Icon: (props: { className?: string; size?: number }) => ReactNode;+ className: string;+};++const TOAST_ICON_BY_TYPE: Record<ToastType, ToastIconConfig> = {+ success: { Icon: IconCheckCircleFilled, className: "text-success" },+ info: { Icon: Info, className: "text-blue-500" },+ warning: { Icon: TriangleAlert, className: "text-yellow-500" },+ error: { Icon: TriangleAlert, className: "text-error" },+};++function ToastIcon({ type }: { type: ToastType }) {+ const { Icon, className } = TOAST_ICON_BY_TYPE[type];+ return <Icon className={className} size={20} />;+}++export function CustomToast({ t, message, type, onClick }: CustomToastProps) {+ const isClickable = onClick !== undefined;++ return (+ <div+ className={twMerge(+ "flex items-center justify-between rounded-lg border border-gray-500 bg-surface-elevated py-2 pl-3 pr-2 shadow-custom transition-opacity",+ t.visible ? "opacity-100" : "opacity-0",+ isClickable && "cursor-pointer hover:bg-surface-tertiary",+ )}+ onClick={isClickable ? onClick : undefined}+ onKeyDown={+ isClickable+ ? (event) => {+ if (event.target !== event.currentTarget) return;+ if (event.key === "Enter" || event.key === " ") {+ event.preventDefault();+ onClick?.();+ }+ }+ : undefined+ }+ role={isClickable ? "button" : undefined}+ tabIndex={isClickable ? 0 : undefined}+ >+ <div className="flex min-w-0 items-center">+ <ToastIcon type={type} />+ <span className="ml-2 mr-5 min-w-0 truncate text-sm font-medium text-text-primary">{message}</span>+ </div>+ <IconButton+ onClick={(e) => {+ e.stopPropagation();+ toast.dismiss(t.id);+ }}+ className="text-text-muted hover:text-text-primary"+ icon={<X size={20} />}+ aria-label="Dismiss toast"+ />+ </div>+ );+}diff --git a/apps/mirai-gui/client/src/components/ui/toast/toast-provider.tsx b/apps/mirai-gui/client/src/components/ui/toast/toast-provider.tsxnew file mode 100644index 000000000..c40c8e8a1--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/toast/toast-provider.tsx@@ -0,0 +1,16 @@+import { Toaster } from "react-hot-toast";++export function ToastProvider() {+ return (+ <Toaster+ position="top-right"+ toastOptions={{ duration: 3000 }}+ containerStyle={{+ top: 20,+ right: 20,+ bottom: 20,+ left: 20,+ }}+ />+ );+}diff --git a/apps/mirai-gui/client/src/components/ui/toast/types.ts b/apps/mirai-gui/client/src/components/ui/toast/types.tsnew file mode 100644index 000000000..aeb66914f--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/toast/types.ts@@ -0,0 +1,6 @@+export type ToastType = "success" | "error" | "info" | "warning";++export type ToastOptions = {+ id?: string;+ onClick?: () => void;+};diff --git a/apps/mirai-gui/client/src/components/ui/toast/use-toast.tsx b/apps/mirai-gui/client/src/components/ui/toast/use-toast.tsxnew file mode 100644index 000000000..bf38b5153--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/toast/use-toast.tsx@@ -0,0 +1,25 @@+import toast from "react-hot-toast";+import { CustomToast } from "./custom-toast";+import type { ToastOptions, ToastType } from "./types";++function showToast(message: string, type: ToastType, options?: ToastOptions) {+ return toast.custom((t) => <CustomToast t={t} message={message} type={type} onClick={options?.onClick} />, {+ id: options?.id,+ duration: 4000,+ position: "top-right",+ });+}++const toastApi = {+ success: (message: string, options?: ToastOptions) => showToast(message, "success", options),+ error: (message: string, options?: ToastOptions) => showToast(message, "error", options),+ info: (message: string, options?: ToastOptions) => showToast(message, "info", options),+ warning: (message: string, options?: ToastOptions) => showToast(message, "warning", options),+ dismiss: toast.dismiss,+};++export type ToastApi = typeof toastApi;++export function useToast(): ToastApi {+ return toastApi;+}diff --git a/apps/mirai-gui/client/src/components/ui/toggle.tsx b/apps/mirai-gui/client/src/components/ui/toggle.tsxnew file mode 100644index 000000000..f7e0b000a--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/toggle.tsx@@ -0,0 +1,38 @@+import React from "react";+import { twMerge } from "tailwind-merge";++type ToggleProps = {+ /** Accessible name; the switch renders no text of its own. */+ label: string;+ checked: boolean;+ onChange: (checked: boolean) => void;+ disabled?: boolean;+ className?: string;+};++export const Toggle: React.FC<ToggleProps> = ({ label, checked, onChange, disabled = false, className }) => {+ return (+ <button+ type="button"+ role="switch"+ aria-label={label}+ aria-checked={checked}+ disabled={disabled}+ onClick={() => !disabled && onChange(!checked)}+ className={twMerge(+ "relative inline-flex min-h-6 min-w-11 items-center rounded-full transition-colors outline-hidden focus-visible:shadow-focus",+ checked ? "bg-label-title" : "bg-button-border",+ disabled && "opacity-50 cursor-not-allowed",+ !disabled && "cursor-pointer",+ className,+ )}+ >+ <span+ className={twMerge(+ "inline-block h-5 w-5 px-0.5 transform rounded-full bg-white dark:bg-black transition-transform",+ checked ? "translate-x-[22px]" : "translate-x-[2px]",+ )}+ />+ </button>+ );+};diff --git a/apps/mirai-gui/client/src/components/ui/tooltip/bubble.tsx b/apps/mirai-gui/client/src/components/ui/tooltip/bubble.tsxnew file mode 100644index 000000000..6b30ae163--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/tooltip/bubble.tsx@@ -0,0 +1,35 @@+import type { CSSProperties } from "react";+import { twMerge } from "tailwind-merge";+import type { TooltipProps } from "./types";++type TooltipBubbleProps = {+ tooltipId: string;+ content: TooltipProps["content"];+ floatingStyles: CSSProperties;+ setFloating: (node: HTMLDivElement | null) => void;+};++export function TooltipBubble({ tooltipId, content, floatingStyles, setFloating }: TooltipBubbleProps) {+ return (+ <div+ ref={setFloating}+ id={tooltipId}+ role="tooltip"+ className="pointer-events-none fixed z-50"+ style={{+ ...floatingStyles,+ opacity: 1,+ }}+ >+ <div+ className={twMerge(+ "rounded-md bg-surface-tertiary shadow-sm text-text-primary [font-variation-settings:'opsz'_18]",+ "px-2 py-1 text-[11px] font-[450] leading-[1.3]",+ "whitespace-nowrap",+ )}+ >+ {content}+ </div>+ </div>+ );+}diff --git a/apps/mirai-gui/client/src/components/ui/tooltip/context.ts b/apps/mirai-gui/client/src/components/ui/tooltip/context.tsnew file mode 100644index 000000000..e01c3f139--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/tooltip/context.ts@@ -0,0 +1,4 @@+import { createContext } from "react";+import type { TooltipContextValue } from "./types";++export const TooltipContext = createContext<TooltipContextValue | null>(null);diff --git a/apps/mirai-gui/client/src/components/ui/tooltip/index.tsx b/apps/mirai-gui/client/src/components/ui/tooltip/index.tsxnew file mode 100644index 000000000..54548ed6f--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/tooltip/index.tsx@@ -0,0 +1,64 @@+import { useCallback, useContext, useId, useLayoutEffect, useRef } from "react";+import { TooltipContext } from "./context";+import { useTooltipAria } from "./use-tooltip-aria";+import type { TooltipContextValue, TooltipProps } from "./types";++function TooltipShared({ content, side = "top", children, context }: TooltipProps & { context: TooltipContextValue }) {+ const instanceId = useId();+ const wrapperRef = useRef<HTMLSpanElement | null>(null);+ const visible = context.activeId === instanceId;++ useTooltipAria({ wrapperRef, tooltipId: context.tooltipId, visible });++ const show = useCallback(() => {+ if (!wrapperRef.current) return;++ context.show({+ id: instanceId,+ reference: wrapperRef.current,+ content,+ side,+ });+ }, [content, context, instanceId, side]);++ const hide = useCallback(() => {+ context.hide(instanceId);+ }, [context, instanceId]);++ const hideRef = useRef(hide);+ hideRef.current = hide;+ useLayoutEffect(() => {+ return () => {+ hideRef.current();+ };+ }, []);++ return (+ <span+ ref={wrapperRef}+ className="inline-flex"+ onMouseEnter={show}+ onMouseLeave={hide}+ onFocus={show}+ onBlur={hide}+ onPointerDown={(event) => {+ if (event.button === 0) hide();+ }}+ >+ {children}+ </span>+ );+}++export function Tooltip(props: TooltipProps) {+ const context = useContext(TooltipContext);+ if (!context) {+ // The bubble lives in the provider, so without one the trigger renders bare and+ // the tip silently disappears.+ if (import.meta.env.DEV) {+ console.warn("Tooltip rendered without a TooltipProvider; the tooltip will not appear.");+ }+ return <>{props.children}</>;+ }+ return <TooltipShared {...props} context={context} />;+}diff --git a/apps/mirai-gui/client/src/components/ui/tooltip/provider.tsx b/apps/mirai-gui/client/src/components/ui/tooltip/provider.tsxnew file mode 100644index 000000000..47eab6dcc--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/tooltip/provider.tsx@@ -0,0 +1,63 @@+import { flip, offset, shift, useFloating } from "@floating-ui/react-dom";+import type { ReferenceType } from "@floating-ui/react-dom";+import { useCallback, useEffect, useId, useMemo, useState } from "react";+import { TooltipContext } from "./context";+import type { TooltipContextValue, TooltipPayload, TooltipProviderProps } from "./types";+import { autoUpdateWithDetach } from "./utils";+import { TooltipBubble } from "./bubble";++export function TooltipProvider({ children }: TooltipProviderProps) {+ const [activeTooltip, setActiveTooltip] = useState<TooltipPayload | null>(null);+ const tooltipId = useId();++ const whileElementsMounted = useCallback(+ (reference: ReferenceType, floating: HTMLElement, update: () => void) =>+ autoUpdateWithDetach(reference, floating, update, () => {+ setActiveTooltip((current) => (current && current.reference === reference ? null : current));+ }),+ [],+ );++ const { refs, floatingStyles } = useFloating({+ placement: activeTooltip?.side ?? "top",+ strategy: "fixed",+ whileElementsMounted,+ middleware: [offset(8), flip(), shift({ padding: 8 })],+ });++ useEffect(() => {+ refs.setReference(activeTooltip?.reference ?? null);+ }, [activeTooltip, refs]);++ const show = useCallback((payload: TooltipPayload) => {+ setActiveTooltip(payload);+ }, []);++ const hide = useCallback((id: string) => {+ setActiveTooltip((current) => (current?.id === id ? null : current));+ }, []);++ const contextValue = useMemo<TooltipContextValue>(+ () => ({+ activeId: activeTooltip?.id ?? null,+ tooltipId,+ show,+ hide,+ }),+ [activeTooltip?.id, hide, show, tooltipId],+ );++ return (+ <TooltipContext.Provider value={contextValue}>+ {children}+ {activeTooltip && (+ <TooltipBubble+ tooltipId={tooltipId}+ content={activeTooltip.content}+ floatingStyles={floatingStyles}+ setFloating={refs.setFloating}+ />+ )}+ </TooltipContext.Provider>+ );+}diff --git a/apps/mirai-gui/client/src/components/ui/tooltip/types.ts b/apps/mirai-gui/client/src/components/ui/tooltip/types.tsnew file mode 100644index 000000000..3a6b2dd75--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/tooltip/types.ts@@ -0,0 +1,27 @@+import type { ReactNode } from "react";++export type TooltipSide = "top" | "bottom";++export type TooltipProviderProps = {+ children: ReactNode;+};++export type TooltipProps = {+ content: ReactNode;+ side?: TooltipSide;+ children: ReactNode;+};++export type TooltipPayload = {+ id: string;+ reference: HTMLSpanElement;+ content: TooltipProps["content"];+ side: NonNullable<TooltipProps["side"]>;+};++export type TooltipContextValue = {+ activeId: string | null;+ tooltipId: string;+ show: (payload: TooltipPayload) => void;+ hide: (id: string) => void;+};diff --git a/apps/mirai-gui/client/src/components/ui/tooltip/use-tooltip-aria.ts b/apps/mirai-gui/client/src/components/ui/tooltip/use-tooltip-aria.tsnew file mode 100644index 000000000..0e35ff5b6--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/tooltip/use-tooltip-aria.ts@@ -0,0 +1,45 @@+import { useEffect, useRef } from "react";+import type { RefObject } from "react";+import { syncAriaDescribedBy } from "./utils";++export function useTooltipAria({+ wrapperRef,+ tooltipId,+ visible,+}: {+ wrapperRef: RefObject<HTMLSpanElement | null>;+ tooltipId: string;+ visible: boolean;+}) {+ const describedElementRef = useRef<HTMLElement | null>(null);++ useEffect(() => {+ const wrapperNode = wrapperRef.current;++ if (!wrapperNode) return undefined;++ const activeElement = document.activeElement;+ const focusedDescendant =+ activeElement instanceof HTMLElement && activeElement !== wrapperNode && wrapperNode.contains(activeElement)+ ? activeElement+ : null;++ const previousElement = describedElementRef.current;++ if (previousElement && previousElement !== focusedDescendant) {+ syncAriaDescribedBy(previousElement, tooltipId, false);+ }++ if (!visible || !focusedDescendant) {+ describedElementRef.current = null;+ return undefined;+ }++ syncAriaDescribedBy(focusedDescendant, tooltipId, true);+ describedElementRef.current = focusedDescendant;++ return () => {+ syncAriaDescribedBy(describedElementRef.current, tooltipId, false);+ };+ }, [tooltipId, visible, wrapperRef]);+}diff --git a/apps/mirai-gui/client/src/components/ui/tooltip/utils.ts b/apps/mirai-gui/client/src/components/ui/tooltip/utils.tsnew file mode 100644index 000000000..15a4578f1--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/tooltip/utils.ts@@ -0,0 +1,48 @@+import { autoUpdate } from "@floating-ui/react-dom";+import type { ReferenceType } from "@floating-ui/react-dom";++export function autoUpdateWithDetach(+ reference: ReferenceType,+ floating: HTMLElement,+ update: () => void,+ onDetach: () => void,+) {+ return autoUpdate(+ reference,+ floating,+ () => {+ if (reference instanceof Element && !reference.isConnected) {+ onDetach();+ return;+ }+ update();+ },+ { animationFrame: true },+ );+}++function getDescribedByValue(currentValue: string | null, tooltipId: string, includeTooltipId: boolean) {+ const tokens = (currentValue ?? "")+ .split(" ")+ .map((token) => token.trim())+ .filter((token) => token !== "" && token !== tooltipId);++ if (includeTooltipId) {+ tokens.push(tooltipId);+ }++ return tokens.join(" ") || null;+}++export function syncAriaDescribedBy(element: HTMLElement | null, tooltipId: string, includeTooltipId: boolean) {+ if (!element) return;++ const nextValue = getDescribedByValue(element.getAttribute("aria-describedby"), tooltipId, includeTooltipId);++ if (nextValue) {+ element.setAttribute("aria-describedby", nextValue);+ return;+ }++ element.removeAttribute("aria-describedby");+}diff --git a/apps/mirai-gui/client/src/components/ui/typography/constants.ts b/apps/mirai-gui/client/src/components/ui/typography/constants.tsnew file mode 100644index 000000000..ff15e5ab4--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/typography/constants.ts@@ -0,0 +1,12 @@+import type { TextColor, TextSize } from "./types";++export const TEXT_SIZE: Record<TextSize, string> = {+ sm: "text-sm leading-[1.55]",+ md: "text-base leading-[1.6]",+};++export const TEXT_COLOR: Record<TextColor, string> = {+ primary: "text-text-primary",+ secondary: "text-text-secondary",+ muted: "text-text-muted",+};diff --git a/apps/mirai-gui/client/src/components/ui/typography/index.tsx b/apps/mirai-gui/client/src/components/ui/typography/index.tsxnew file mode 100644index 000000000..ea0a3e92a--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/typography/index.tsx@@ -0,0 +1,12 @@+import { createElement } from "react";+import { twMerge } from "tailwind-merge";+import { TEXT_COLOR, TEXT_SIZE } from "./constants";+import type { TextProps } from "./types";++export function Text({ size = "md", color = "primary", opticalSize, as = "p", className, style, ...rest }: TextProps) {+ return createElement(as, {+ className: twMerge(TEXT_SIZE[size], TEXT_COLOR[color], "font-normal", className),+ style: opticalSize ? { ...style, fontVariationSettings: `'opsz' ${opticalSize}` } : style,+ ...rest,+ });+}diff --git a/apps/mirai-gui/client/src/components/ui/typography/types.ts b/apps/mirai-gui/client/src/components/ui/typography/types.tsnew file mode 100644index 000000000..fb7c449ee--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/typography/types.ts@@ -0,0 +1,13 @@+import type { HTMLAttributes } from "react";++export type TextSize = "sm" | "md";++export type TextColor = "primary" | "secondary" | "muted";++export type TextProps = HTMLAttributes<HTMLParagraphElement> & {+ size?: TextSize;+ color?: TextColor;+ opticalSize?: number;+ as?: "p" | "span";+ className?: string;+};diff --git a/apps/mirai-gui/client/src/components/ui/vendor-icon/index.tsx b/apps/mirai-gui/client/src/components/ui/vendor-icon/index.tsxnew file mode 100644index 000000000..037fb2ec0--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/vendor-icon/index.tsx@@ -0,0 +1,19 @@+import { useState } from "react";+import { twMerge } from "tailwind-merge";+import type { VendorIconProps } from "./types";++export function VendorIcon({ src, vendor, className, size = 16 }: VendorIconProps) {+ const [failedSrc, setFailedSrc] = useState<string | null>(null);+ if (!src || failedSrc === src) return null;+ return (+ <img+ src={src}+ alt={vendor}+ width={size}+ height={size}+ draggable={false}+ onError={() => setFailedSrc(src)}+ className={twMerge("shrink-0 object-contain", className)}+ />+ );+}diff --git a/apps/mirai-gui/client/src/components/ui/vendor-icon/types.ts b/apps/mirai-gui/client/src/components/ui/vendor-icon/types.tsnew file mode 100644index 000000000..f9495d9bb--- /dev/null+++ b/apps/mirai-gui/client/src/components/ui/vendor-icon/types.ts@@ -0,0 +1,6 @@+export type VendorIconProps = {+ src?: string;+ vendor: string;+ className?: string;+ size?: number;+};diff --git a/apps/mirai-gui/client/src/components/update-toast/index.tsx b/apps/mirai-gui/client/src/components/update-toast/index.tsxnew file mode 100644index 000000000..2d62013c4--- /dev/null+++ b/apps/mirai-gui/client/src/components/update-toast/index.tsx@@ -0,0 +1,43 @@+import React from "react";+import { twMerge } from "tailwind-merge";+import { Button } from "@/components/ui/button";+import { X } from "lucide-react";++export type UpdateToastProps = {+ version: string;+ onApplyNow: () => void;+ onLater: () => void;+ errorMessage?: string;+ onClose?: () => void;+};++export const UpdateToast: React.FC<UpdateToastProps> = ({ version, onApplyNow, onLater, errorMessage, onClose }) => {+ return (+ <div+ className={twMerge(+ "w-[560px] max-w-[90vw] bg-bg-modal border border-button-border rounded-xl p-4 shadow-lg",+ "flex flex-col gap-3",+ )}+ >+ <div className="flex items-start justify-between gap-3">+ <div className="flex flex-col">+ <div className="text-label-title font-semibold">Update {version} is ready</div>+ <div className="text-label-muted text-sm mt-1">Restart to apply the update.</div>+ {errorMessage ? <div className="text-sm mt-2 text-error">{errorMessage}</div> : null}+ </div>+ <button onClick={onClose} className="text-label-muted hover:text-label-title p-1 rounded" aria-label="Close">+ <X size={18} />+ </button>+ </div>++ <div className="flex items-center gap-2 mt-1">+ <Button size="sm" kind="primary" onClick={onApplyNow}>+ Restart now+ </Button>+ <Button size="sm" kind="secondary" onClick={onLater}>+ Later+ </Button>+ </div>+ </div>+ );+};diff --git a/apps/mirai-gui/client/src/components/update-toast/notifications.tsx b/apps/mirai-gui/client/src/components/update-toast/notifications.tsxnew file mode 100644index 000000000..3cf72edda--- /dev/null+++ b/apps/mirai-gui/client/src/components/update-toast/notifications.tsx@@ -0,0 +1,41 @@+import { UpdateToast } from "@/components/update-toast";+import { toast } from "react-hot-toast";++const toastPosition = "bottom-right" as const;++type ReadyToastParams = {+ version: string;+ toastId: string;+ onApplyNow: () => void | Promise<void>;+ onLater: () => void | Promise<void>;+ errorMessage?: string;+};++export const dismissUpdateToast = (toastId: string): void => {+ toast.dismiss(toastId);+};++export const showReadyUpdateToast = ({+ version,+ toastId,+ onApplyNow,+ onLater,+ errorMessage,+}: ReadyToastParams): void => {+ toast.custom(+ () => (+ <UpdateToast+ version={version}+ onApplyNow={onApplyNow}+ onLater={onLater}+ errorMessage={errorMessage}+ onClose={() => dismissUpdateToast(toastId)}+ />+ ),+ {+ id: toastId,+ position: toastPosition,+ duration: Infinity,+ },+ );+};diff --git a/apps/mirai-gui/client/src/constants/attachments.ts b/apps/mirai-gui/client/src/constants/attachments.tsnew file mode 100644index 000000000..9978f61f8--- /dev/null+++ b/apps/mirai-gui/client/src/constants/attachments.ts@@ -0,0 +1,25 @@+export const SUPPORTED_FILE_TYPES: {+ text: string[];+} = {+ text: [+ ".txt",+ ".md",+ ".json",+ ".csv",+ ".tsv",+ ".py",+ ".js",+ ".ts",+ ".tsx",+ ".jsx",+ ".html",+ ".css",+ ".xml",+ ".yaml",+ ".yml",+ ],+};++export const MAX_SINGLE_FILE_SIZE = 256 * 1024;+export const MAX_TOTAL_ATTACHMENTS_SIZE = 512 * 1024;+export const MAX_FILES_PER_MESSAGE = 5;diff --git a/apps/mirai-gui/client/src/constants/chat.ts b/apps/mirai-gui/client/src/constants/chat.tsnew file mode 100644index 000000000..da6994f3c--- /dev/null+++ b/apps/mirai-gui/client/src/constants/chat.ts@@ -0,0 +1,4 @@+export const UNTITLED_CHAT_TITLE = "Untitled";+export const DEFAULT_CHAT_TITLE = "General Chat";+export const CHAT_TITLE_MIN_LENGTH = 3;+export const CHAT_TITLE_MAX_LENGTH = 50;diff --git a/apps/mirai-gui/client/src/features/chat-history/components/chat-card.tsx b/apps/mirai-gui/client/src/features/chat-history/components/chat-card.tsxnew file mode 100644index 000000000..20160fd7d--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat-history/components/chat-card.tsx@@ -0,0 +1,83 @@+import React from "react";+import { formatDistanceToNow } from "date-fns";+import { ChatsIcon } from "@/components/icons/chats-icon";+import { Checkbox } from "@/components/ui/checkbox";+import { CardContainer } from "@/components/ui/card-container";+import { twMerge } from "tailwind-merge";++type ChatCardProps = {+ id: string;+ title: string;+ updatedAt: number;+ onClick: () => void;+ selected?: boolean;+ selectMode?: boolean;+ checked?: boolean;+ onCheckedChange?: () => void;+};++const ChatCard: React.FC<ChatCardProps> = ({+ id,+ title,+ updatedAt,+ onClick,+ selected = false,+ selectMode = false,+ checked = false,+ onCheckedChange,+}) => {+ const timeAgo = formatDistanceToNow(updatedAt, { addSuffix: true });++ return (+ <CardContainer+ key={id}+ onClick={onClick}+ // In select mode the checkbox is the focusable control, so the card must not+ // also be a button: that would nest a control inside a control.+ {...(selectMode+ ? {}+ : {+ role: "button",+ tabIndex: 0,+ onKeyDown: (event: React.KeyboardEvent<HTMLDivElement>) => {+ if (event.key !== "Enter" && event.key !== " ") return;+ event.preventDefault();+ onClick();+ },+ })}+ className={twMerge(+ "bg-background cursor-pointer transition-colors border-[0.5px] border-cell-border",+ !selectMode && "outline-hidden focus-visible:shadow-focus",+ selectMode ? "hover:bg-card-hover" : "hover:bg-card-hover",+ selected ? "bg-bg-modal border-button-border" : "",+ )}+ >+ <div className="grid grid-cols-[auto_1fr_auto] items-center gap-3 p-3 w-full">+ <div className="flex-shrink-0 w-5 h-5 flex items-center justify-center">+ {selectMode ? (+ <span onClick={(e) => e.stopPropagation()}>+ <Checkbox+ checked={checked}+ onChange={() => onCheckedChange?.()}+ size="sm"+ aria-label={`Select ${title}`}+ />+ </span>+ ) : (+ <ChatsIcon className="w-5 h-5 text-label-title" />+ )}+ </div>+ <div className="min-w-0">+ <h3 className="text-[15px] leading-[150%] font-[350] text-label-title overflow-hidden text-ellipsis whitespace-nowrap">+ {title}+ </h3>+ </div>+ <div className="flex-shrink-0 ml-2">+ <span className="text-xs text-label-muted font-mono whitespace-nowrap">{timeAgo}</span>+ </div>+ </div>+ </CardContainer>+ );+};++export default ChatCard;diff --git a/apps/mirai-gui/client/src/features/chat-history/components/chat-delete-modal.tsx b/apps/mirai-gui/client/src/features/chat-history/components/chat-delete-modal.tsxnew file mode 100644index 000000000..612e859f0--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat-history/components/chat-delete-modal.tsx@@ -0,0 +1,39 @@+import { Modal } from "@/components/ui/modal";++type ChatDeleteModalProps = {+ isOpen: boolean;+ onClose: () => void;+ onConfirm: () => void;+ chatName?: string;+ count?: number;+ isDeleting?: boolean;+};++export const ChatDeleteModal: React.FC<ChatDeleteModalProps> = ({+ isOpen,+ onClose,+ onConfirm,+ chatName,+ count,+ isDeleting = false,+}) => {+ const isBulk = typeof count === "number" && count > 0 && !chatName;+ const description = chatName+ ? `Are you sure you want to delete chat "${chatName}"? This action cannot be undone.`+ : isBulk+ ? `Are you sure you want to delete ${count} ${count === 1 ? "chat" : "chats"}? This action cannot be undone.`+ : "";++ return (+ <Modal+ open={isOpen}+ onClose={onClose}+ title={chatName ? "Delete chat" : "Delete chats"}+ description={description}+ primaryLabel={chatName ? "Delete chat" : "Delete"}+ primaryKind="danger"+ onPrimary={onConfirm}+ primaryDisabled={isDeleting}+ />+ );+};diff --git a/apps/mirai-gui/client/src/features/chat-history/components/chat-history-page.tsx b/apps/mirai-gui/client/src/features/chat-history/components/chat-history-page.tsxnew file mode 100644index 000000000..ee8819086--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat-history/components/chat-history-page.tsx@@ -0,0 +1,227 @@+import RenameIcon from "@/components/icons/rename-icon";+import TrashIcon from "@/components/icons/trash-icon";+import ChatCard from "./chat-card";+import { ChatDeleteModal } from "./chat-delete-modal";+import { ChatRenameModal } from "./chat-rename-modal";+import GlobalInstructions from "./global-instructions";+import { GroupButton } from "@/components/ui/group-button";+import { useNavigate } from "@tanstack/react-router";+import { X } from "lucide-react";+import { useEffect, useMemo, useState } from "react";+import { Button } from "@/components/ui/button";+import { Checkbox } from "@/components/ui/checkbox";+import { SearchInput } from "@/components/ui/search-input";+import { useToast } from "@/components/ui/toast/use-toast";+import { useChatStore } from "@/stores/use-chat-store";+import { useGlobalInstructionsStore } from "@/stores/use-global-instructions-store";++export function ChatHistoryPage() {+ const navigate = useNavigate();+ const toast = useToast();+ const [searchQuery, setSearchQuery] = useState("");+ const savedChats = useChatStore((s) => s.savedChats);+ const loadSavedChats = useChatStore((s) => s.loadSavedChats);+ const deleteChat = useChatStore((s) => s.deleteChat);+ const instructions = useGlobalInstructionsStore((s) => s.instructions);+ const loadInstructions = useGlobalInstructionsStore((s) => s.loadInstructions);+ const saveInstructions = useGlobalInstructionsStore((s) => s.saveInstructions);++ const [isSelectionMode, setIsSelectionMode] = useState(false);+ const [selectedIds, setSelectedIds] = useState<string[]>([]);+ const [isConfirmOpen, setIsConfirmOpen] = useState(false);+ const [isDeleting, setIsDeleting] = useState(false);+ const [isRenameOpen, setIsRenameOpen] = useState(false);++ useEffect(() => {+ loadSavedChats();+ loadInstructions();+ }, [loadSavedChats, loadInstructions]);++ const filteredChats = useMemo(() => {+ const searchLower = searchQuery.toLowerCase();+ return savedChats.filter((chat) => (searchQuery === "" ? true : chat.title.toLowerCase().includes(searchLower)));+ }, [savedChats, searchQuery]);++ const allFilteredIds = filteredChats.map((c) => c.id);+ const isAllSelected = allFilteredIds.length > 0 && allFilteredIds.every((id) => selectedIds.includes(id));++ const toggleSelectAll = () => setSelectedIds(isAllSelected ? [] : allFilteredIds);++ const toggleSelectOne = (chatId: string) =>+ setSelectedIds((prev) => (prev.includes(chatId) ? prev.filter((id) => id !== chatId) : [...prev, chatId]));++ const exitSelectionMode = () => {+ setIsSelectionMode(false);+ setSelectedIds([]);+ };++ const handleChatClick = (chatId: string) => {+ return isSelectionMode+ ? toggleSelectOne(chatId)+ : navigate({+ to: "/chat/$chatId",+ params: { chatId },+ search: { isNew: false },+ });+ };++ const confirmBulkDelete = async () => {+ setIsDeleting(true);+ try {+ await Promise.all(selectedIds.map((id) => deleteChat(id)));+ } catch (e) {+ console.error("[chats] bulk delete failed", e);+ toast.error("Some chats could not be deleted");+ } finally {+ setIsDeleting(false);+ setIsConfirmOpen(false);+ exitSelectionMode();+ }+ };++ const singleSelectedChat = useMemo(+ () => (selectedIds.length === 1 ? savedChats.find((c) => c.id === selectedIds[0]) || null : null),+ [selectedIds, savedChats],+ );++ const selectedCount = selectedIds.length;+ const showActive = selectedCount > 0;+ const labelText = isAllSelected ? "All selected" : selectedCount === 0 ? "Select all" : `${selectedCount} selected`;++ return (+ <>+ <div className="sticky top-0 z-10">+ <div className="w-full bg-bg-modal">+ <div className="pt-7 pb-7 flex flex-col justify-center px-5 lg:px-0 lg:max-w-[800px] mx-auto gap-6 lg:gap-0">+ <h1 className="leading-[130%] text-xl font-medium text-label-title text-center lg:text-left">+ Chat history+ </h1>+ </div>++ <div className="px-5 lg:px-0 pt-4 pb-7 lg:max-w-[800px] mx-auto">+ <GlobalInstructions instructions={instructions} onSave={saveInstructions} />+ </div>+ <div className="h-[1px] bg-cell-border" />+ </div>++ <div className="w-full bg-background">+ <div className="px-5 lg:px-0 pt-5 pb-2.5 flex items-center justify-between lg:max-w-[800px] mx-auto">+ <h2 className="text-sm font-[350] text-label-title">Your chats</h2>+ <div className="flex items-center gap-2">+ <SearchInput+ value={searchQuery}+ onChange={setSearchQuery}+ placeholder="Search"+ className="w-full max-w-[210px] lg:min-w-[240px] lg:max-w-[240px]"+ />+ {isSelectionMode ? (+ <GroupButton>+ <GroupButton.Segment ariaLabel="Select all" onClick={() => toggleSelectAll()} className="gap-2">+ <Checkbox+ checked={isAllSelected}+ onChange={() => {}}+ size="sm"+ disabled+ className="pointer-events-none opacity-100"+ />+ <span className={showActive ? "text-[12px] text-label-title" : "text-[12px] text-label-muted"}>+ {labelText}+ </span>+ </GroupButton.Segment>++ {!isAllSelected && singleSelectedChat && (+ <GroupButton.Segment+ leftDivider+ ariaLabel="Rename"+ onClick={() => setIsRenameOpen(true)}+ className={showActive ? "text-label-title" : "text-label-muted"}+ >+ <RenameIcon className="w-4 h-4" />+ </GroupButton.Segment>+ )}++ <GroupButton.Segment+ leftDivider+ ariaLabel="Delete"+ onClick={() => setIsConfirmOpen(true)}+ disabled={selectedIds.length === 0}+ className={showActive ? "text-label-title" : "text-label-muted"}+ >+ <TrashIcon className="w-4 h-4" />+ </GroupButton.Segment>++ <GroupButton.Segment+ leftDivider+ ariaLabel="Exit selection"+ onClick={exitSelectionMode}+ className={showActive ? "text-label-title" : "text-label-muted"}+ >+ <X className="w-4 h-4" />+ </GroupButton.Segment>+ </GroupButton>+ ) : (+ <Button+ kind="secondary"+ size="sm"+ className="text-label-muted h-8 px-3 rounded-[8px] border border-cell-border text-sm leading-[150%]"+ onClick={() => setIsSelectionMode(true)}+ >+ Select+ </Button>+ )}+ </div>+ </div>+ </div>+ </div>++ <div className="w-full lg:max-w-[808px] pl-2 overflow-auto mx-auto bg-background">+ <div className="px-5 lg:px-0 overflow-visible w-full">+ {filteredChats.length === 0 ? (+ <div className="text-center py-8">+ <p className="text-label-muted">+ {searchQuery ? "No chats found matching your search." : "No chats yet. Start a new conversation!"}+ </p>+ </div>+ ) : (+ <div className="space-y-3 pb-6 w-full">+ {filteredChats.map((chat) => (+ <div key={chat.id} className="relative">+ <ChatCard+ id={chat.id}+ title={chat.title}+ updatedAt={chat.updatedAt}+ onClick={() => handleChatClick(chat.id)}+ selected={isSelectionMode && selectedIds.includes(chat.id)}+ selectMode={isSelectionMode}+ checked={selectedIds.includes(chat.id)}+ onCheckedChange={() => toggleSelectOne(chat.id)}+ />+ </div>+ ))}+ </div>+ )}+ </div>+ </div>++ <ChatDeleteModal+ isOpen={isConfirmOpen}+ onClose={() => setIsConfirmOpen(false)}+ onConfirm={confirmBulkDelete}+ count={selectedIds.length}+ isDeleting={isDeleting}+ />++ {singleSelectedChat && (+ <ChatRenameModal+ isOpen={isRenameOpen}+ onClose={() => setIsRenameOpen(false)}+ onConfirm={async (newName) => {+ await useChatStore.getState().updateChatTitle(singleSelectedChat.id, newName);+ setIsRenameOpen(false);+ }}+ currentName={singleSelectedChat.title}+ />+ )}+ </>+ );+}diff --git a/apps/mirai-gui/client/src/features/chat-history/components/chat-rename-modal.tsx b/apps/mirai-gui/client/src/features/chat-history/components/chat-rename-modal.tsxnew file mode 100644index 000000000..57c78b091--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat-history/components/chat-rename-modal.tsx@@ -0,0 +1,91 @@+import { Modal } from "@/components/ui/modal";+import { TextField } from "@/components/ui/text-field";+import { useEffect, useRef, useState } from "react";+import { CHAT_TITLE_MAX_LENGTH, CHAT_TITLE_MIN_LENGTH } from "@/constants/chat";++type ChatRenameModalProps = {+ isOpen: boolean;+ onClose: () => void;+ onConfirm: (name: string) => Promise<void>;+ currentName: string;+};++export const ChatRenameModal: React.FC<ChatRenameModalProps> = ({ isOpen, onClose, onConfirm, currentName }) => {+ const [name, setName] = useState(currentName);+ const [isSubmitting, setIsSubmitting] = useState(false);+ const [error, setError] = useState("");+ const inputRef = useRef<HTMLInputElement>(null);++ useEffect(() => {+ if (isOpen) {+ setName(currentName);+ setError("");+ }+ }, [isOpen, currentName]);++ const submit = async () => {+ const trimmed = name.trim();+ if (!trimmed) {+ setError("Name cannot be empty");+ return;+ }+ if (trimmed.length < CHAT_TITLE_MIN_LENGTH) {+ setError(`Name must be at least ${CHAT_TITLE_MIN_LENGTH} characters long`);+ return;+ }+ if (trimmed.length > CHAT_TITLE_MAX_LENGTH) {+ setError(`Name must be at most ${CHAT_TITLE_MAX_LENGTH} characters long`);+ return;+ }+ try {+ setIsSubmitting(true);+ await onConfirm(trimmed);+ onClose();+ } catch (e) {+ console.error(e);+ setError("Failed to rename chat");+ } finally {+ setIsSubmitting(false);+ }+ };++ const handleClose = () => {+ setName(currentName);+ setError("");+ onClose();+ };++ return (+ <Modal+ open={isOpen}+ onClose={handleClose}+ initialFocus={inputRef}+ title="Rename chat"+ primaryLabel={isSubmitting ? "Saving…" : "Save"}+ onPrimary={() => void submit()}+ primaryDisabled={isSubmitting}+ >+ <form+ onSubmit={(e) => {+ e.preventDefault();+ void submit();+ }}+ >+ <TextField+ error={error || undefined}+ controlProps={{+ ref: inputRef,+ value: name,+ onChange: (e) => setName(e.target.value),+ // The input mounts after open; select on the focus the dialog gives it.+ onFocus: (e) => e.currentTarget.select(),+ placeholder: "Enter chat name",+ maxLength: CHAT_TITLE_MAX_LENGTH,+ disabled: isSubmitting,+ fullWidth: true,+ }}+ />+ </form>+ </Modal>+ );+};diff --git a/apps/mirai-gui/client/src/features/chat-history/components/global-instructions.test.tsx b/apps/mirai-gui/client/src/features/chat-history/components/global-instructions.test.tsxnew file mode 100644index 000000000..ba3b50520--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat-history/components/global-instructions.test.tsx@@ -0,0 +1,49 @@+import { cleanup, fireEvent, render, screen } from "@testing-library/react";+import { afterEach, expect, it, vi } from "vitest";+import GlobalInstructions from "./global-instructions";++vi.mock("@/components/ui/toast/use-toast", () => ({ useToast: () => ({ error: vi.fn() }) }));++afterEach(cleanup);++const textarea = () => screen.getByPlaceholderText("Add instructions to all chats") as HTMLTextAreaElement;++it("takes the stored text while nothing is unsaved", () => {+ const view = render(<GlobalInstructions instructions="" onSave={vi.fn(async () => true)} />);++ view.rerender(<GlobalInstructions instructions="loaded from disk" onSave={vi.fn(async () => true)} />);++ expect(textarea().value).toBe("loaded from disk");+});++it("does not revive a save still in flight after the text was cleared", () => {+ const onSave = vi.fn(() => new Promise<boolean>(() => {}));+ const view = render(<GlobalInstructions instructions="" onSave={onSave} />);++ fireEvent.change(textarea(), { target: { value: "abc" } });+ fireEvent.blur(textarea());+ fireEvent.change(textarea(), { target: { value: "" } });+ fireEvent.blur(textarea());+ view.rerender(<GlobalInstructions instructions="abc" onSave={onSave} />);++ expect(textarea().value).toBe("");+});++it("still writes a clear typed while the previous save is in flight", async () => {+ let finishFirst!: (ok: boolean) => void;+ const onSave = vi+ .fn<(value: string) => Promise<boolean>>()+ .mockImplementationOnce(() => new Promise((resolve) => (finishFirst = resolve)))+ .mockResolvedValue(true);+ const view = render(<GlobalInstructions instructions="" onSave={onSave} />);++ fireEvent.change(textarea(), { target: { value: "abc" } });+ fireEvent.blur(textarea());+ fireEvent.change(textarea(), { target: { value: "" } });+ view.unmount();++ expect(onSave.mock.calls.map(([v]) => v)).toEqual(["abc", ""]);+ finishFirst(true);+ await Promise.resolve();+ expect(onSave).toHaveBeenCalledTimes(2);+});diff --git a/apps/mirai-gui/client/src/features/chat-history/components/global-instructions.tsx b/apps/mirai-gui/client/src/features/chat-history/components/global-instructions.tsxnew file mode 100644index 000000000..44f4588ff--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat-history/components/global-instructions.tsx@@ -0,0 +1,150 @@+import { Textarea as HeadlessTextarea } from "@headlessui/react";+import { Plus } from "lucide-react";+import React, { useCallback, useEffect, useRef, useState } from "react";+import { CardContainer } from "@/components/ui/card-container";+import { useToast } from "@/components/ui/toast/use-toast";++type GlobalInstructionsProps = {+ instructions: string;+ onSave: (instructions: string) => Promise<boolean>;+};++const GlobalInstructions: React.FC<GlobalInstructionsProps> = ({ instructions, onSave }) => {+ const toast = useToast();+ const [isExpanded, setIsExpanded] = useState(false);+ const [localInstructions, setLocalInstructions] = useState(instructions);+ const textareaRef = useRef<HTMLTextAreaElement | null>(null);+ const saveTimerRef = useRef<number | null>(null);+ // null after a failed save, so the next blur saves again.+ const lastRequestedRef = useRef<string | null>(instructions || "");+ const latestValueRef = useRef<string>(instructions || "");+ const touchedRef = useRef(false);++ // After the first keystroke the store only repeats what this editor saved.+ useEffect(() => {+ if (touchedRef.current) return;+ setLocalInstructions(instructions);+ lastRequestedRef.current = instructions || "";+ }, [instructions]);++ useEffect(() => {+ latestValueRef.current = localInstructions;+ }, [localInstructions]);++ const doSave = useCallback(+ (value: string) => {+ if (value === lastRequestedRef.current) return;+ lastRequestedRef.current = value;+ void onSave(value).then((saved) => {+ if (saved) return;+ if (lastRequestedRef.current === value) lastRequestedRef.current = null;+ toast.error("Failed to save instructions", { id: "instructions-save-failed" });+ });+ },+ [onSave, toast],+ );++ const scheduleSave = useCallback(+ (value: string) => {+ if (saveTimerRef.current) {+ window.clearTimeout(saveTimerRef.current);+ saveTimerRef.current = null;+ }+ saveTimerRef.current = window.setTimeout(() => {+ doSave(value);+ saveTimerRef.current = null;+ }, 500);+ },+ [doSave],+ );++ const flushSave = useCallback(() => {+ if (saveTimerRef.current) {+ window.clearTimeout(saveTimerRef.current);+ saveTimerRef.current = null;+ }+ const value = latestValueRef.current;+ doSave(value);+ }, [doSave]);++ useEffect(() => {+ const handleBeforeUnload = () => flushSave();+ window.addEventListener("beforeunload", handleBeforeUnload);+ return () => {+ window.removeEventListener("beforeunload", handleBeforeUnload);+ flushSave();+ };+ }, [flushSave]);++ useEffect(() => {+ if (!isExpanded) return;+ const id = requestAnimationFrame(() => {+ const el = textareaRef.current;+ if (!el) return;+ el.focus();+ const len = el.value.length;+ el.setSelectionRange(len, len);+ el.scrollTop = el.scrollHeight;+ });+ return () => cancelAnimationFrame(id);+ }, [isExpanded]);++ const handleToggleExpand = useCallback(() => {+ setIsExpanded((prev) => !prev);+ }, []);++ const handleChange = useCallback(+ (e: React.ChangeEvent<HTMLTextAreaElement>) => {+ const value = e.target.value;+ touchedRef.current = true;+ setLocalInstructions(value);+ scheduleSave(value);+ },+ [scheduleSave],+ );++ return (+ <div>+ <CardContainer>+ <button+ className="w-full group flex items-center gap-3 p-3 text-left lg:justify-between"+ onClick={handleToggleExpand}+ >+ <div className="flex items-center gap-3 flex-1 min-w-0 lg:flex-initial">+ <Plus+ className={`w-5 h-5 shrink-0 text-label-muted transition-transform duration-200 ${isExpanded ? "rotate-45" : ""}`}+ />+ <div className="flex-1 min-w-0 lg:flex-initial">+ <h3 className="text-sm font-[350] leading-[150%] text-label-title">Add instructions to all chats</h3>+ <span className="block text-[13px] font-[350] leading-[130%] text-label-muted lg:hidden">+ Tailor the way the model responds+ </span>+ </div>+ </div>++ <span className="hidden lg:block text-[13px] font-[350] leading-[130%] text-label-muted text-right">+ Tailor the way the model responds+ </span>+ </button>+ </CardContainer>++ <CardContainer+ className={`overflow-hidden transition-all duration-300 ease-in-out ${isExpanded ? "max-h-96 opacity-100 mt-3" : "max-h-0 opacity-0"}`}+ >+ <div className="p-3">+ <HeadlessTextarea+ ref={textareaRef}+ value={localInstructions}+ onChange={handleChange}+ onBlur={flushSave}+ placeholder="Add instructions to all chats"+ className="w-full p-1 bg-bg-modal rounded-md text-sm leading-[150%] text-label-title placeholder:text-label-muted focus:outline-hidden focus:border-primary resize-none thin-scrollbar"+ rows={7}+ />+ </div>+ </CardContainer>+ </div>+ );+};++export default GlobalInstructions;diff --git a/apps/mirai-gui/client/src/features/chat-history/components/saved-chats.tsx b/apps/mirai-gui/client/src/features/chat-history/components/saved-chats.tsxnew file mode 100644index 000000000..aa55fe920--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat-history/components/saved-chats.tsx@@ -0,0 +1,243 @@+import { Menu, MenuButton, MenuItem, MenuItems } from "@headlessui/react";+import { useNavigate, useParams } from "@tanstack/react-router";+import { Edit3, MoreHorizontal, Trash2 } from "lucide-react";+import { useEffect, useRef, useState } from "react";+import { useChatStore } from "@/stores/use-chat-store";+import { CHAT_TITLE_MAX_LENGTH, CHAT_TITLE_MIN_LENGTH } from "@/constants/chat";+import { useShiftHeld } from "@/hooks/use-shift-held";+import { ChatDeleteModal } from "@/features/chat-history/components/chat-delete-modal";+import type { ChatMetadata } from "@/platform/services/storage";++export default function SavedChats() {+ const navigate = useNavigate();+ const { chatId: currentChatId } = useParams({ strict: false }) as {+ chatId?: string;+ };+ const savedChats = useChatStore((s) => s.savedChats);+ const loadSavedChats = useChatStore((s) => s.loadSavedChats);+ const deleteChat = useChatStore((s) => s.deleteChat);+ const updateChatTitle = useChatStore((s) => s.updateChatTitle);++ const [showDeleteModal, setShowDeleteModal] = useState(false);+ const [selectedChat, setSelectedChat] = useState<ChatMetadata | null>(null);+ const [isDeleting, setIsDeleting] = useState(false);++ const [editingChatId, setEditingChatId] = useState<string | null>(null);+ const [draftTitle, setDraftTitle] = useState("");+ const renameInputRef = useRef<HTMLInputElement | null>(null);+ const shiftHeld = useShiftHeld();++ useEffect(() => {+ loadSavedChats();+ }, [loadSavedChats]);++ useEffect(() => {+ if (editingChatId) {+ requestAnimationFrame(() => {+ renameInputRef.current?.focus({ preventScroll: true });+ renameInputRef.current?.select();+ });+ }+ }, [editingChatId]);++ const handleChatClick = (chatId: string) => {+ navigate({ to: "/chat/$chatId", params: { chatId } });+ };++ const startRename = (chat: ChatMetadata) => {+ setEditingChatId(chat.id);+ setDraftTitle(chat.title);+ };++ const cancelRename = () => {+ setEditingChatId(null);+ setDraftTitle("");+ };++ const commitRename = async () => {+ if (!editingChatId) return;+ const chat = savedChats.find((c) => c.id === editingChatId);+ const newTitle = draftTitle.trim();+ cancelRename();+ if (+ !chat ||+ newTitle === chat.title ||+ newTitle.length < CHAT_TITLE_MIN_LENGTH ||+ newTitle.length > CHAT_TITLE_MAX_LENGTH+ ) {+ return;+ }+ try {+ await updateChatTitle(chat.id, newTitle);+ } catch (error) {+ console.error("Failed to rename chat:", error);+ }+ };++ const performDelete = async (chat: ChatMetadata) => {+ setIsDeleting(true);+ try {+ await deleteChat(chat.id);+ setShowDeleteModal(false);+ setSelectedChat(null);++ if (currentChatId === chat.id) {+ const newChatId = Date.now().toString();+ navigate({+ to: "/chat/$chatId",+ params: { chatId: newChatId },+ search: { isNew: true },+ });+ }+ } catch (error) {+ console.error("Failed to delete chat:", error);+ } finally {+ setIsDeleting(false);+ }+ };++ const handleDeleteChat = (chat: ChatMetadata, skipConfirmation: boolean) => {+ if (skipConfirmation) {+ void performDelete(chat);+ return;+ }+ setSelectedChat(chat);+ setShowDeleteModal(true);+ };++ return (+ <div className="flex flex-col gap-2">+ {savedChats.length === 0 ? (+ <div className="px-4 py-2 text-[13px] font-[350] leading-[150%] text-label-muted">No chats yet</div>+ ) : (+ savedChats.map((chat: ChatMetadata) => (+ <div+ key={chat.id}+ role="button"+ tabIndex={0}+ aria-label={chat.title}+ onClick={() => {+ if (editingChatId !== chat.id) handleChatClick(chat.id);+ }}+ onKeyDown={(e) => {+ if (e.target !== e.currentTarget) return;+ if (e.key === "Enter" || e.key === " ") {+ e.preventDefault();+ if (editingChatId !== chat.id) handleChatClick(chat.id);+ }+ }}+ className="flex px-2"+ >+ <Menu>+ {({ open }) => (+ <div+ onDoubleClick={(e) => {+ e.stopPropagation();+ startRename(chat);+ }}+ className={`flex items-center gap-3 py-[6px] px-2 w-full rounded-md group ${currentChatId === chat.id || editingChatId === chat.id || open ? "bg-bg-hover dark:bg-bg-hover" : "hover:bg-bg-hover hover:dark:bg-bg-hover"}`}+ >+ <div className="flex-1 min-w-0">+ {editingChatId === chat.id ? (+ <input+ ref={renameInputRef}+ value={draftTitle}+ maxLength={CHAT_TITLE_MAX_LENGTH}+ onChange={(e) => setDraftTitle(e.target.value)}+ onClick={(e) => e.stopPropagation()}+ onKeyDown={(e) => {+ e.stopPropagation();+ if (e.key === "Enter") void commitRename();+ if (e.key === "Escape") cancelRename();+ }}+ onBlur={() => void commitRename()}+ className="block w-full text-left text-[13px] font-[350] leading-[150%] text-label-title bg-transparent outline-hidden border-none p-0"+ />+ ) : (+ <p className="w-full text-left text-[13px] font-[350] leading-[150%] text-label-title truncate">+ {chat.title}+ </p>+ )}+ </div>+ {shiftHeld ? (+ <button+ type="button"+ aria-label={`Delete ${chat.title}`}+ onClick={(e) => {+ e.stopPropagation();+ void performDelete(chat);+ }}+ onDoubleClick={(e) => e.stopPropagation()}+ className="opacity-0 group-hover:opacity-100 hover:bg-bg-hover p-1 rounded transition-opacity"+ >+ <Trash2 className="w-3 h-3 text-error" />+ </button>+ ) : (+ <>+ <MenuButton+ aria-label={`Options for ${chat.title}`}+ onClick={(e) => e?.stopPropagation()}+ onDoubleClick={(e) => e.stopPropagation()}+ className={`${open ? "opacity-100 bg-bg-hover dark:bg-bg-hover" : "opacity-0 group-hover:opacity-100 data-[focus]:opacity-100"} hover:bg-bg-hover p-1 rounded transition-opacity outline-hidden data-[focus]:shadow-focus`}+ >+ <MoreHorizontal className="w-3 h-3 text-label-muted" />+ </MenuButton>+ <MenuItems+ anchor="bottom end"+ className="w-32 rounded-lg border border-cell-border bg-bg-modal [--anchor-gap:4px] outline-hidden focus:outline-hidden focus:ring-0 z-50 translate-x-2"+ >+ <MenuItem>+ <button+ onClick={(e) => {+ e.stopPropagation();+ startRename(chat);+ }}+ className="group/item flex w-full p-1 outline-hidden"+ >+ <div className="flex grow rounded-md py-1.5 px-2 gap-2 w-full items-center hover:bg-card-hover group-data-[focus]/item:bg-card-hover transition-colors">+ <Edit3 className="w-3 h-3 text-label-title" />+ <span className="text-xs text-label-title">Rename</span>+ </div>+ </button>+ </MenuItem>+ <MenuItem>+ <button+ onClick={(e) => {+ e.stopPropagation();+ handleDeleteChat(chat, e.shiftKey);+ }}+ className="group/item flex w-full p-1 outline-hidden"+ >+ <div className="flex grow rounded-md py-1.5 px-2 gap-2 w-full items-center hover:bg-card-hover group-data-[focus]/item:bg-card-hover transition-colors">+ <Trash2 className="w-3 h-3 text-error" />+ <span className="text-xs text-error">Delete</span>+ </div>+ </button>+ </MenuItem>+ </MenuItems>+ </>+ )}+ </div>+ )}+ </Menu>+ </div>+ ))+ )}++ {selectedChat && (+ <ChatDeleteModal+ isOpen={showDeleteModal}+ onClose={() => {+ setShowDeleteModal(false);+ setSelectedChat(null);+ }}+ onConfirm={async () => {+ if (selectedChat) await performDelete(selectedChat);+ }}+ chatName={selectedChat.title}+ isDeleting={isDeleting}+ />+ )}+ </div>+ );+}diff --git a/apps/mirai-gui/client/src/features/chat/components/chat-header.tsx b/apps/mirai-gui/client/src/features/chat/components/chat-header.tsxnew file mode 100644index 000000000..1db9f001e--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/components/chat-header.tsx@@ -0,0 +1,45 @@+import { twMerge } from "tailwind-merge";+import { LoaderIcon } from "@/components/loader";+import { platformInfo } from "@/platform/platform-info";++const HEADER_LEFT_RESERVE_PX = platformInfo.features.nativeTitleBar ? 120 : 56;++export const ChatHeader = ({+ title,+ isSidebarOpen,+ isTitleGenerating,+ className,+}: {+ title: string;+ isSidebarOpen: boolean;+ isTitleGenerating?: boolean;+ className?: string;+}) => {+ return (+ <div+ data-tauri-drag-region="deep"+ className={twMerge("flex items-center justify-between pb-4 text-center lg:text-left", className)}+ >+ <div+ className="flex items-center gap-1 w-auto lg:w-auto justify-center lg:justify-start min-w-0"+ style={+ !isSidebarOpen+ ? {+ paddingLeft: `clamp(0px, calc(${HEADER_LEFT_RESERVE_PX}px - var(--sidebar-width, 0px)), ${HEADER_LEFT_RESERVE_PX}px)`,+ }+ : undefined+ }+ >+ <h1+ className={twMerge(+ "text-[13px] font-[350] text-label-muted line-clamp-1",+ !isSidebarOpen && "lg:text-center",+ )}+ >+ {title}+ </h1>+ {isTitleGenerating ? <LoaderIcon width={8} height={8} /> : null}+ </div>+ </div>+ );+};diff --git a/apps/mirai-gui/client/src/features/chat/components/chat-page.tsx b/apps/mirai-gui/client/src/features/chat/components/chat-page.tsxnew file mode 100644index 000000000..c7edeaf5f--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/components/chat-page.tsx@@ -0,0 +1,195 @@+import { useCallback, useEffect, useState } from "react";+import { useParams, useSearch } from "@tanstack/react-router";++import { ChatHeader } from "./chat-header";+import { UNTITLED_CHAT_TITLE } from "@/constants/chat";+import { useToast } from "@/components/ui/toast/use-toast";+import { useRuntimeSessionStore } from "@/stores/use-runtime-session-store";+import { useChatSessionStore } from "@/stores/use-chat-session-store";+import { useChatStore } from "@/stores/use-chat-store";+import { useGlobalInstructionsStore } from "@/stores/use-global-instructions-store";+import { useSidebarStore } from "@/stores/use-sidebar-store";+import { isChatGenerating } from "@/features/runtime/runtime-busy";+import { useChatModelSelector } from "../hooks/use-chat-model-selector";+import { useLlmStream } from "../hooks/use-llm-stream";++import { ModelParamsDrawer } from "./composer/model-params-drawer";+import { isCustomParams, useModelParamsStore } from "@/stores/use-model-params-store";+import { ChatComposer } from "./composer/chat-composer";+import { ChatMessageList } from "./message/chat-message-list";+import { useActiveAssistantBuffer } from "../hooks/use-active-assistant-buffer";+import { useChatComposerState } from "../hooks/use-chat-composer-state";+import { useChatRunStatus } from "../hooks/use-chat-run-status";+import { useChatSwitchEffect } from "../hooks/use-chat-switch-effect";+import { useEjectDrivenModelReset } from "../hooks/use-eject-driven-model-reset";+import { useModelSwitch } from "../hooks/use-model-switch";+import { useRegenerateMessage } from "../hooks/use-regenerate-message";+import { useSendChatMessage } from "../hooks/use-send-chat-message";+import { useStopChatRun } from "../hooks/use-stop-chat-run";++type ChatSearchParams = {+ isNew?: boolean;+ model?: string;+ modelName?: string;+};++export function ChatPage() {+ const { chatId } = useParams({ from: "/chat/$chatId" });+ const search = useSearch({ strict: false }) as ChatSearchParams;++ const toast = useToast();++ const isSidebarOpen = useSidebarStore((s) => s.isOpen);+ const globalInstructions = useGlobalInstructionsStore((s) => s.instructions);+ const loadInstructions = useGlobalInstructionsStore((s) => s.loadInstructions);+ const residentSession = useRuntimeSessionStore((s) => s.residentSession);+ const isModelLoading = useChatSessionStore((s) => s.isModelLoading);+ const isTitleGenerating = useChatSessionStore((s) => s.isTitleGenerating);+ const titleGenChatId = useChatSessionStore((s) => s.titleGenChatId);+ const isTitleGeneratingForChat = isTitleGenerating && titleGenChatId === chatId;+ const savedChats = useChatStore((s) => s.savedChats);+ const isChatStreaming = useChatSessionStore((s) => isChatGenerating(s, chatId));+ const loadingMessageId = useChatSessionStore((s) =>+ s.loadingMessage?.chatId === chatId ? s.loadingMessage.messageId : null,+ );+ const canceledMessageId = useChatSessionStore((s) =>+ s.canceledMessage?.chatId === chatId ? s.canceledMessage.messageId : null,+ );++ const composer = useChatComposerState();+ const { isLoading, startStream, cancel } = useLlmStream(chatId);++ const {+ selectedChatModel,+ hasAvailableModels: hasInstalledModels,+ currentModelId,+ autoSelectSuppressed,+ } = useChatModelSelector({+ chatId,+ searchModel: search.model,+ searchModelName: search.modelName,+ });++ const [pendingSwitch, setPendingSwitch] = useState(false);++ const [scrollTargetId, setScrollTargetId] = useState<string | null>(null);+ const applyActiveBufferToMessage = useActiveAssistantBuffer(chatId);++ const resetLocalUi = useCallback(() => {+ setScrollTargetId(null);+ }, []);++ useChatSwitchEffect({+ chatId,+ isNewChat: !!search.isNew,+ replayActiveBuffer: applyActiveBufferToMessage,+ resetLocalUi,+ });++ useEffect(() => {+ void loadInstructions();+ }, [loadInstructions]);++ const runStatus = useChatRunStatus({ chatId, modelId: currentModelId });++ const currentChatTitle = savedChats.find((c) => c.id === chatId)?.title || UNTITLED_CHAT_TITLE;++ useEjectDrivenModelReset({+ chatId,+ selectedModelId: selectedChatModel.modelId,+ pendingSwitch,+ });++ const { stop: handleStopResponse } = useStopChatRun({ chatId, cancelStream: cancel });++ const handleSendMessage = useSendChatMessage({+ chatId,+ composer,+ globalInstructions,+ runStatusBlockReason: runStatus.blockReason,+ toast,+ setScrollTargetId,+ startStream,+ });++ const handleChatModelSelect = useModelSwitch({+ chatId,+ toast,+ setPendingSwitch,+ cancelStream: cancel,+ });++ const handleMessageModelSelect = useRegenerateMessage({+ chatId,+ globalInstructions,+ toast,+ startStream,+ });++ const effectiveSelectedModelId = autoSelectSuppressed ? "" : currentModelId || "";++ const [paramsDrawerOpen, setParamsDrawerOpen] = useState(false);+ const selectedModelParams = useModelParamsStore((s) =>+ effectiveSelectedModelId ? s.paramsByRepoId[effectiveSelectedModelId] : undefined,+ );+ const globalReasoningEnabled = useModelParamsStore((s) => s.globalReasoningEnabled);+ const modelParamsModified = isCustomParams(selectedModelParams, globalReasoningEnabled);++ return (+ <div className="flex flex-col h-[calc(100vh-24px)] bg-background pt-4 pb-5 px-5">+ <div className="w-full flex flex-col h-full">+ <ChatHeader+ title={currentChatTitle}+ isSidebarOpen={isSidebarOpen}+ isTitleGenerating={isTitleGeneratingForChat}+ />++ <div className="flex-1 overflow-hidden min-h-0 w-full lg:max-w-[800px] mx-auto">+ <ChatMessageList+ isNewChat={!!search.isNew}+ isChatStreaming={isChatStreaming}+ isLoadingStream={isLoading}+ isTitleGeneratingForChat={isTitleGeneratingForChat}+ isModelLoading={isModelLoading}+ hasResidentModel={Boolean(residentSession)}+ scrollTargetId={scrollTargetId}+ onScrolled={() => setScrollTargetId(null)}+ loadingMessageId={loadingMessageId}+ canceledMessageId={canceledMessageId}+ onMessageModelSelect={handleMessageModelSelect}+ />+ </div>++ <div className="flex-shrink-0 w-full lg:max-w-[800px] mx-auto">+ <ChatComposer+ chatId={chatId}+ isChatStreaming={isChatStreaming}+ isLoadingStream={isLoading}+ isTitleGeneratingForChat={isTitleGeneratingForChat}+ autoSelectSuppressed={autoSelectSuppressed}+ selectedModelId={effectiveSelectedModelId}+ hasInstalledModels={hasInstalledModels}+ draft={composer.draft}+ onDraftChange={composer.setDraft}+ attachedFiles={composer.attachedFiles}+ canRun={runStatus.canRun}+ onSendMessage={handleSendMessage}+ onStopResponse={handleStopResponse}+ onModelSelect={handleChatModelSelect}+ onFileSelect={composer.attachFile}+ onRemoveFile={composer.removeFile}+ onOpenModelParams={() => setParamsDrawerOpen(true)}+ modelParamsModified={modelParamsModified}+ />+ </div>+ </div>++ <ModelParamsDrawer+ open={paramsDrawerOpen}+ chatId={chatId}+ repoId={effectiveSelectedModelId || null}+ onClose={() => setParamsDrawerOpen(false)}+ />+ </div>+ );+}diff --git a/apps/mirai-gui/client/src/features/chat/components/composer/attached-files-display.tsx b/apps/mirai-gui/client/src/features/chat/components/composer/attached-files-display.tsxnew file mode 100644index 000000000..cc2cfb2f4--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/components/composer/attached-files-display.tsx@@ -0,0 +1,70 @@+import { twMerge } from "tailwind-merge";+import type { AttachedFile } from "@/types/files";+import { FileIcon } from "./file-icon";++type FileType = "document" | "code" | "table" | "other";++const DOCUMENT_EXTENSIONS = ["txt", "md"];+const CODE_EXTENSIONS = ["json", "py", "js", "ts", "tsx", "jsx", "html", "css", "xml", "yaml", "yml"];+const TABLE_EXTENSIONS = ["csv", "tsv"];++const LABEL_COLOR: Record<FileType, string> = {+ document: "text-blue",+ code: "text-progress",+ table: "text-green-500",+ other: "text-label-muted",+};++const ICON_BACKGROUND: Record<FileType, string> = {+ document: "bg-blue/[0.12] text-blue border-blue/[0.12]",+ code: "bg-progress/[0.12] text-progress border-progress/[0.12]",+ table: "bg-green-500/[0.12] text-green-500 border-green-500/[0.12]",+ other: "bg-bg-hover border-button-border",+};++const getFileType = (extension: string): FileType => {+ if (DOCUMENT_EXTENSIONS.includes(extension)) return "document";+ if (CODE_EXTENSIONS.includes(extension)) return "code";+ if (TABLE_EXTENSIONS.includes(extension)) return "table";+ return "other";+};++const getFileNameWithoutExtension = (filename: string): string => {+ const lastDotIndex = filename.lastIndexOf(".");+ return lastDotIndex > 0 ? filename.substring(0, lastDotIndex) : filename;+};++function FileCard({ file }: { file: AttachedFile }) {+ const fileType = getFileType(file.extension);+ return (+ <div className="group relative flex items-center gap-2 px-2 py-[6px] rounded-[8px] border max-w-[200px] border-cell-border">+ <div+ className={twMerge(+ "w-10 h-10 border rounded-[5px] flex items-center justify-center flex-shrink-0",+ ICON_BACKGROUND[fileType],+ )}+ >+ <FileIcon extension={file.extension} className="w-4 h-4" />+ </div>++ <div className="flex flex-col min-w-0 flex-1 gap-[2px]">+ <span className="text-[13px] font-[350] leading-[150%] text-label-title truncate">+ {getFileNameWithoutExtension(file.name)}+ </span>+ <span className={twMerge("text-xs leading-[130%]", LABEL_COLOR[fileType])}>{file.extension}</span>+ </div>+ </div>+ );+}++export function AttachedFilesDisplay({ files }: { files: AttachedFile[] }) {+ if (files.length === 0) return null;++ return (+ <div className="flex flex-wrap gap-2">+ {files.map((file) => (+ <FileCard key={file.id} file={file} />+ ))}+ </div>+ );+}diff --git a/apps/mirai-gui/client/src/features/chat/components/composer/chat-composer.tsx b/apps/mirai-gui/client/src/features/chat/components/composer/chat-composer.tsxnew file mode 100644index 000000000..ae9b8d56f--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/components/composer/chat-composer.tsx@@ -0,0 +1,127 @@+import { useToast } from "@/components/ui/toast/use-toast";+import { useInstalledPickerModels } from "../../hooks/use-picker-models";+import { useChatSessionStore } from "@/stores/use-chat-session-store";+import { isOtherChatGenerating } from "@/features/runtime/runtime-busy";+import type { AttachedFile } from "@/types/files";+import { MAX_FILES_PER_MESSAGE, SUPPORTED_FILE_TYPES } from "@/constants/attachments";+import { isValidFileSize, isValidFileType, processFile } from "../../services/attachment-files";+import { ChatInput } from "./chat-input";++type ChatComposerProps = {+ chatId: string;+ isChatStreaming: boolean;+ isLoadingStream: boolean;+ isTitleGeneratingForChat: boolean;+ autoSelectSuppressed: boolean;+ selectedModelId: string;+ hasInstalledModels: boolean;+ draft: string;+ onDraftChange: (draft: string) => void;+ attachedFiles: AttachedFile[];+ canRun: boolean;+ onSendMessage: (message: string) => void;+ onStopResponse: () => void;+ onModelSelect: (modelId: string, modelName: string) => void;+ onFileSelect: (file: AttachedFile) => void;+ onRemoveFile: (fileId: string) => void;+ onOpenModelParams: () => void;+ modelParamsModified: boolean;+};++const ATTACH_ACCEPT = SUPPORTED_FILE_TYPES.text.join(",");++export const ChatComposer = ({+ chatId,+ isChatStreaming,+ isLoadingStream,+ isTitleGeneratingForChat,+ autoSelectSuppressed,+ selectedModelId,+ hasInstalledModels,+ draft,+ onDraftChange,+ attachedFiles,+ canRun,+ onSendMessage,+ onStopResponse,+ onModelSelect,+ onFileSelect,+ onRemoveFile,+ onOpenModelParams,+ modelParamsModified,+}: ChatComposerProps) => {+ const toast = useToast();++ const isEjecting = useChatSessionStore((s) => s.isEjecting);+ const otherChatGenerating = useChatSessionStore((s) => isOtherChatGenerating(s, chatId));+ const installedModels = useInstalledPickerModels();++ const blockedMessage =+ !selectedModelId || autoSelectSuppressed+ ? "Select a model to continue"+ : otherChatGenerating+ ? "A response is already generating in another chat."+ : undefined;++ const isLoading = isLoadingStream || isTitleGeneratingForChat;+ const isStreaming = isChatStreaming || isTitleGeneratingForChat;+ const busy = isStreaming || isLoading || isEjecting;++ const handleAttach = async (file: File) => {+ if (attachedFiles.length >= MAX_FILES_PER_MESSAGE) {+ toast.warning(`Maximum ${MAX_FILES_PER_MESSAGE} files allowed per message`);+ return;+ }+ if (!isValidFileType(file)) {+ toast.error("Unsupported file type");+ return;+ }+ if (!isValidFileSize(file, attachedFiles)) {+ toast.error("File too large or exceeds total attachment size limit");+ return;+ }+ try {+ onFileSelect(await processFile(file));+ } catch (error) {+ console.error("Error processing file:", error);+ toast.error("Error processing file");+ }+ };++ return (+ <ChatInput+ value={draft}+ onChange={onDraftChange}+ placeholder="Add message…"+ onSend={({ text }) => {+ if (text) onSendMessage(text);+ }}+ canSend={({ text }) => !!text.trim() && !isLoading && hasInstalledModels && canRun}+ onBlockedSend={({ text, files }) => {+ if (isLoading || !hasInstalledModels) return;+ if (!text.trim()) {+ if (files.length > 0) toast.error("Add a message to send attachments");+ return;+ }+ toast.error(blockedMessage || "Sending is blocked right now");+ }}+ streaming={isStreaming}+ onStop={onStopResponse}+ onAttach={handleAttach}+ attachAccept={ATTACH_ACCEPT}+ files={attachedFiles.map((f) => ({ id: f.id, name: f.name, extension: f.extension }))}+ onRemoveFile={onRemoveFile}+ models={installedModels}+ activeModelId={selectedModelId}+ onModelChange={(id) => {+ const model = installedModels.find((m) => m.id === id);+ if (model) onModelSelect(id, model.name);+ }}+ modelPickerDisabled={busy || otherChatGenerating}+ moreModelsLink={{ href: "/local-models" }}+ {...(selectedModelId ? { onModelSettingsClick: onOpenModelParams } : {})}+ settingsModified={modelParamsModified}+ settingsDisabled={busy}+ />+ );+};diff --git a/apps/mirai-gui/client/src/features/chat/components/composer/chat-input/attach-menu.tsx b/apps/mirai-gui/client/src/features/chat/components/composer/chat-input/attach-menu.tsxnew file mode 100644index 000000000..524954177--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/components/composer/chat-input/attach-menu.tsx@@ -0,0 +1,47 @@+import { File as FileIcon, Plus } from "lucide-react";+import { Button } from "@/components/ui/button";+import { PopoverMenu } from "@/components/ui/popover/popover-menu";+import { Text } from "@/components/ui/typography";++export type AttachMenuProps = {+ onSelectFile: () => void;+};++export function AttachMenu({ onSelectFile }: AttachMenuProps) {+ return (+ <PopoverMenu+ side="top"+ align="start"+ sideOffsetPx={4}+ className="min-w-[280px]"+ itemClassName="gap-3 px-2 py-2"+ trigger={+ <Button+ size="xs"+ kind="ghost"+ iconOnly+ ariaLabel="Attach file"+ icon={<Plus size={18} />}+ className="bg-surface-tertiary text-text-muted hover:bg-control-surface-hover hover:text-text-primary"+ />+ }+ items={[+ {+ id: "upload",+ icon: <FileIcon size={16} className="text-text-muted shrink-0" />,+ label: (+ <span>+ <Text as="span" color="primary" opticalSize={14} className="block text-[13px] font-[450] leading-[1.3]">+ Upload a file+ </Text>+ <Text as="span" color="muted" className="block text-[11px] leading-[1.4]">+ Supports TXT, MD, JSON, CSV, YAML+ </Text>+ </span>+ ),+ onClick: onSelectFile,+ },+ ]}+ />+ );+}diff --git a/apps/mirai-gui/client/src/features/chat/components/composer/chat-input/constants.ts b/apps/mirai-gui/client/src/features/chat/components/composer/chat-input/constants.tsnew file mode 100644index 000000000..430090117--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/components/composer/chat-input/constants.ts@@ -0,0 +1,2 @@+export const CHAT_INPUT_TEXTAREA_CLASSNAME = "text-[15px] font-normal leading-[1.5]";+export const CHAT_INPUT_TEXTAREA_STYLE = { fontVariationSettings: "'opsz' 14" } as const;diff --git a/apps/mirai-gui/client/src/features/chat/components/composer/chat-input/file-chip.tsx b/apps/mirai-gui/client/src/features/chat/components/composer/chat-input/file-chip.tsxnew file mode 100644index 000000000..d8342e307--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/components/composer/chat-input/file-chip.tsx@@ -0,0 +1,62 @@+import { File as FileIcon, X } from "lucide-react";+import { useState } from "react";+import { twMerge } from "tailwind-merge";+import { Button } from "@/components/ui/button";+import { Text } from "@/components/ui/typography";+import type { ChatInputFile } from "./types";++const EXT_COLORS: Record<string, string> = {+ txt: "text-text-muted",+ md: "text-text-muted",+ json: "text-amber-500",+ csv: "text-green-500",+ yaml: "text-blue-500",+ yml: "text-blue-500",+};++export type FileChipProps = {+ file: ChatInputFile;+ onRemove: () => void;+};++export function FileChip({ file, onRemove }: FileChipProps) {+ const [hovered, setHovered] = useState(false);+ const extColor = EXT_COLORS[file.extension.toLowerCase()] ?? "text-text-muted";++ return (+ <div+ className="relative group flex items-center gap-2 rounded-md bg-surface-tertiary px-2 py-2 min-w-[80px]"+ onMouseEnter={() => setHovered(true)}+ onMouseLeave={() => setHovered(false)}+ >+ {hovered && (+ <div className="absolute -top-1.5 -right-1.5">+ <Button+ size="xxs"+ kind="ghost"+ iconOnly+ ariaLabel="Remove file"+ icon={<X size={10} />}+ onClick={(e) => {+ e.stopPropagation();+ onRemove();+ }}+ className="size-5 rounded-full bg-surface-elevated shadow-sm text-text-muted hover:text-text-primary hover:bg-surface-elevated"+ />+ </div>+ )}+ <FileIcon size={14} className="text-text-muted shrink-0" />+ <Text+ as="span"+ color="primary"+ opticalSize={14}+ className="truncate max-w-[160px] text-[13px] font-[450] leading-[1.3]"+ >+ {file.name}+ </Text>+ <Text as="span" opticalSize={14} className={twMerge("text-[13px] font-[450] leading-[1.3]", extColor)}>+ {file.extension.toLowerCase()}+ </Text>+ </div>+ );+}diff --git a/apps/mirai-gui/client/src/features/chat/components/composer/chat-input/index.tsx b/apps/mirai-gui/client/src/features/chat/components/composer/chat-input/index.tsxnew file mode 100644index 000000000..dca9411ab--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/components/composer/chat-input/index.tsx@@ -0,0 +1,124 @@+import { Settings } from "lucide-react";+import { useCallback, useRef } from "react";+import { twMerge } from "tailwind-merge";+import { TextArea } from "@/components/ui/text-area";+import { AttachMenu } from "./attach-menu";+import { FileChip } from "./file-chip";+import { ModelPicker } from "./model-picker";+import { SendButton } from "./send-button";+import { CHAT_INPUT_TEXTAREA_CLASSNAME, CHAT_INPUT_TEXTAREA_STYLE } from "./constants";+import type { ChatInputProps } from "./types";+import { useChatInputController } from "./use-chat-input-controller";++export function ChatInput({+ value,+ onChange,+ onSend,+ canSend,+ onBlockedSend,+ onAttach,+ attachAccept = ".txt,.md,.json,.csv,.yaml,.yml",+ placeholder = "Send a message to the local model…",+ files,+ onRemoveFile,+ models,+ activeModelId,+ onModelChange,+ onModelSettingsClick,+ moreModelsLink,+ modelPickerDisabled = false,+ streaming = false,+ onStop,+ settingsModified = false,+ settingsDisabled = false,+}: ChatInputProps) {+ const fileInputRef = useRef<HTMLInputElement>(null);+ const hasFiles = files && files.length > 0;++ const controller = useChatInputController({+ value,+ files,+ onSend,+ canSend,+ onBlockedSend,+ });++ const handleFileSelect = useCallback(() => {+ fileInputRef.current?.click();+ }, []);++ return (+ <div className="rounded-xl bg-surface-elevated shadow-md p-4 w-full">+ <input+ ref={fileInputRef}+ type="file"+ accept={attachAccept}+ className="hidden"+ onChange={(e) => {+ const file = e.target.files?.[0];+ if (file) {+ void Promise.resolve(onAttach?.(file));+ }+ e.target.value = "";+ }}+ />++ {hasFiles && (+ <div className="flex flex-wrap gap-2 mb-3">+ {files.map((file) => (+ <FileChip key={file.id} file={file} onRemove={() => onRemoveFile?.(file.id)} />+ ))}+ </div>+ )}++ <TextArea+ ref={controller.textareaRef}+ value={value}+ onChange={onChange}+ onKeyDown={controller.handleKeyDown}+ placeholder={placeholder}+ rows={1}+ maxHeightPx={320}+ className={twMerge(CHAT_INPUT_TEXTAREA_CLASSNAME, "bg-transparent")}+ style={{ ...CHAT_INPUT_TEXTAREA_STYLE, minHeight: 23, maxHeight: 320 }}+ />++ <div className="flex items-center justify-between mt-4">+ <AttachMenu onSelectFile={handleFileSelect} />++ <div className="flex items-center gap-2 min-w-0">+ <ModelPicker+ models={models}+ {...(activeModelId ? { activeModelId } : {})}+ onModelChange={onModelChange}+ moreModelsLink={moreModelsLink}+ disabled={modelPickerDisabled}+ />+ {onModelSettingsClick ? (+ <span className="relative inline-flex shrink-0">+ <button+ type="button"+ onClick={onModelSettingsClick}+ disabled={settingsDisabled}+ aria-label="Model settings"+ className="flex size-7 shrink-0 items-center justify-center rounded-md bg-surface-tertiary text-text-muted outline-hidden transition-colors duration-150 ease-out hover:bg-control-surface-hover hover:text-text-primary focus-visible:shadow-focus disabled:pointer-events-none disabled:opacity-50"+ >+ <Settings size={16} />+ </button>+ {settingsModified && (+ <span className="pointer-events-none absolute right-0.5 top-0.5 size-1.5 rounded-full bg-danger ring-1 ring-surface-elevated" />+ )}+ </span>+ ) : null}+ <SendButton+ disabled={controller.sendDisabled}+ hasContent={controller.hasContent}+ onClick={controller.handleSubmit}+ streaming={streaming}+ onStop={onStop}+ />+ </div>+ </div>+ </div>+ );+}diff --git a/apps/mirai-gui/client/src/features/chat/components/composer/chat-input/model-picker.tsx b/apps/mirai-gui/client/src/features/chat/components/composer/chat-input/model-picker.tsxnew file mode 100644index 000000000..349831bd4--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/components/composer/chat-input/model-picker.tsx@@ -0,0 +1,171 @@+import { Link } from "@tanstack/react-router";+import { ChevronDown } from "lucide-react";+import { Menu, MenuButton, MenuItem, MenuItems, Transition } from "@headlessui/react";+import { forwardRef, Fragment } from "react";+import { SelectionItem } from "@/components/ui/select/selection-item";+import { SelectionPanel } from "@/components/ui/select/selection-panel";+import { SelectionSection } from "@/components/ui/select/selection-section";+import { Text } from "@/components/ui/typography";+import type { ChatInputModel, ChatInputMoreModelsLink } from "./types";++export type ModelPickerProps = {+ models?: ChatInputModel[];+ activeModelId?: string;+ onModelChange?: (id: string) => void;+ moreModelsLink?: ChatInputMoreModelsLink;+ disabled?: boolean;+ menuPlacement?: "up" | "down";+};++const TEXT_13_CLASSNAME = "text-[13px] font-[450] leading-[1.3]";++type SelectionRowProps = {+ active: boolean;+ selected?: boolean;+ children: React.ReactNode;+ onClick?: () => void;+} & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "onClick" | "children" | "className">;++// Headless UI tracks menu items through the injected ref/role/id props;+// dropping them breaks keyboard navigation.+const SelectionRow = forwardRef<HTMLElement, SelectionRowProps>(function SelectionRow(+ { active, selected, children, onClick, ...rest },+ ref,+) {+ return (+ <SelectionItem+ as="button"+ type="button"+ ref={ref}+ active={active}+ selected={selected}+ className="flex items-center gap-2 w-full border-none outline-hidden bg-transparent text-text-primary hover:bg-surface-tertiary"+ {...rest}+ onClick={onClick}+ >+ {children}+ </SelectionItem>+ );+});++export function ModelPicker({+ models,+ activeModelId,+ onModelChange,+ moreModelsLink,+ disabled = false,+ menuPlacement = "up",+}: ModelPickerProps) {+ const activeModel = models?.find((model) => model.id === activeModelId);++ if ((!models || models.length === 0) && !moreModelsLink) {+ return null;+ }++ return (+ <Menu as="div" className="relative min-w-0 max-w-full">+ {({ close }) => (+ <div className="relative">+ <MenuButton+ as="button"+ type="button"+ disabled={disabled}+ className="group/model flex items-center gap-2 h-7 px-2 max-w-full rounded-md bg-surface-tertiary hover:bg-control-surface-hover data-[headlessui-state~=open]:bg-control-surface-active data-[focus]:bg-control-surface-hover cursor-pointer border-none outline-hidden data-[focus]:shadow-focus disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-surface-tertiary"+ >+ {activeModel && (+ <span className="shrink-0 flex items-center justify-center w-3.5 h-3.5 [&>svg]:w-3.5 [&>svg]:h-3.5">+ {activeModel.logo}+ </span>+ )}+ <Text+ as="span"+ color="muted"+ opticalSize={14}+ className={`min-w-0 truncate ${TEXT_13_CLASSNAME} group-hover/model:text-text-primary group-data-[focus]/model:text-text-primary group-data-[headlessui-state~=open]/model:text-text-primary`}+ >+ {activeModel ? activeModel.name : "Select model"}+ </Text>+ <ChevronDown+ size={16}+ className="shrink-0 text-text-muted group-hover/model:text-text-primary group-data-[focus]/model:text-text-primary group-data-[headlessui-state~=open]/model:text-text-primary"+ />+ </MenuButton>++ <Transition+ as={Fragment}+ enter="transition-[opacity,transform] duration-[120ms] ease-spring"+ enterFrom="transform opacity-0 scale-90"+ enterTo="transform opacity-100 scale-100"+ leave="transition-[opacity,transform] duration-[80ms] ease-spring"+ leaveFrom="transform opacity-100 scale-100"+ leaveTo="transform opacity-0 scale-90"+ >+ <div+ className={+ menuPlacement === "up"+ ? "absolute right-0 bottom-full pb-1 z-50"+ : "absolute right-0 top-full pt-1 z-50"+ }+ >+ <MenuItems className="outline-hidden">+ <SelectionPanel className="pt-1.5 min-w-[240px]">+ <SelectionSection className="max-h-[280px] overflow-y-auto thin-scrollbar">+ {models?.map((model) => (+ <MenuItem key={model.id}>+ {({ focus }) => (+ <SelectionRow+ active={focus}+ selected={model.id === activeModelId}+ onClick={() => {+ onModelChange?.(model.id);+ close();+ }}+ >+ <span className="shrink-0 flex items-center justify-center w-4 h-4 [&>svg]:w-4 [&>svg]:h-4">+ {model.logo}+ </span>+ <Text+ as="span"+ color="primary"+ opticalSize={14}+ className={`whitespace-nowrap ${TEXT_13_CLASSNAME}`}+ >+ {model.name}+ </Text>+ </SelectionRow>+ )}+ </MenuItem>+ ))}+ </SelectionSection>++ {moreModelsLink && (+ <SelectionSection divided className="py-1.5">+ <MenuItem>+ {({ focus }) => (+ <SelectionItem+ as={Link}+ to={moreModelsLink.href}+ active={focus}+ onClick={() => {+ moreModelsLink.onClick?.();+ close();+ }}+ className="flex items-center w-full bg-transparent text-text-primary hover:bg-surface-tertiary"+ >+ <Text as="span" color="primary" opticalSize={14} className={TEXT_13_CLASSNAME}>+ Download more local models+ </Text>+ </SelectionItem>+ )}+ </MenuItem>+ </SelectionSection>+ )}+ </SelectionPanel>+ </MenuItems>+ </div>+ </Transition>+ </div>+ )}+ </Menu>+ );+}diff --git a/apps/mirai-gui/client/src/features/chat/components/composer/chat-input/send-button.tsx b/apps/mirai-gui/client/src/features/chat/components/composer/chat-input/send-button.tsxnew file mode 100644index 000000000..1721be45d--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/components/composer/chat-input/send-button.tsx@@ -0,0 +1,44 @@+import { twMerge } from "tailwind-merge";+import { Button } from "@/components/ui/button";+import { IconPlayerStopFilled } from "@/components/icons/player-stop-filled-icon";+import { IconSend } from "@/components/icons/send-icon";++export type SendButtonProps = {+ disabled: boolean;+ hasContent: boolean;+ onClick: () => void;+ streaming?: boolean;+ onStop?: () => void;+};++export function SendButton({ disabled, hasContent, onClick, streaming = false, onStop }: SendButtonProps) {+ if (streaming) {+ return (+ <Button+ size="xs"+ kind="primary"+ iconOnly+ ariaLabel="Stop generating"+ icon={<IconPlayerStopFilled size={14} />}+ onClick={onStop}+ className="active:scale-100"+ />+ );+ }++ return (+ <Button+ size="xs"+ kind={hasContent ? "primary" : "ghost"}+ iconOnly+ ariaLabel="Send message"+ icon={<IconSend />}+ disabled={disabled}+ onClick={onClick}+ className={twMerge(+ "active:scale-100",+ hasContent ? "" : "bg-surface-tertiary text-text-disabled cursor-not-allowed opacity-100",+ )}+ />+ );+}diff --git a/apps/mirai-gui/client/src/features/chat/components/composer/chat-input/types.ts b/apps/mirai-gui/client/src/features/chat/components/composer/chat-input/types.tsnew file mode 100644index 000000000..63df777d1--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/components/composer/chat-input/types.ts@@ -0,0 +1,46 @@+import type { ReactNode } from "react";++export type ChatInputModel = {+ id: string;+ name: string;+ logo: ReactNode;+};++export type ChatInputFile = {+ id: string;+ name: string;+ extension: string;+};++export type ChatInputSendPayload = {+ text: string;+ files: ChatInputFile[];+};++export type ChatInputMoreModelsLink = {+ href: string;+ onClick?: () => void;+};++export type ChatInputProps = {+ value: string;+ onChange: (value: string) => void;+ onSend?: (payload: ChatInputSendPayload) => void;+ canSend?: (payload: ChatInputSendPayload) => boolean;+ onBlockedSend?: (payload: ChatInputSendPayload) => void;+ onAttach?: (file: File) => void | Promise<void>;+ attachAccept?: string;+ placeholder?: string;+ files?: ChatInputFile[];+ onRemoveFile?: (id: string) => void;+ models?: ChatInputModel[];+ activeModelId?: string;+ onModelChange?: (id: string) => void;+ onModelSettingsClick?: () => void;+ moreModelsLink?: ChatInputMoreModelsLink;+ modelPickerDisabled?: boolean;+ streaming?: boolean;+ onStop?: () => void;+ settingsModified?: boolean;+ settingsDisabled?: boolean;+};diff --git a/apps/mirai-gui/client/src/features/chat/components/composer/chat-input/use-chat-input-controller.test.tsx b/apps/mirai-gui/client/src/features/chat/components/composer/chat-input/use-chat-input-controller.test.tsxnew file mode 100644index 000000000..dc052acbd--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/components/composer/chat-input/use-chat-input-controller.test.tsx@@ -0,0 +1,44 @@+import { act, renderHook } from "@testing-library/react";+import { expect, it, vi } from "vitest";+import type { KeyboardEvent as ReactKeyboardEvent } from "react";+import { useChatInputController } from "./use-chat-input-controller";++const enter = (+ overrides: Partial<ReactKeyboardEvent<HTMLTextAreaElement>> & { isComposing?: boolean; keyCode?: number } = {},+) =>+ ({+ key: "Enter",+ shiftKey: false,+ ctrlKey: false,+ metaKey: false,+ altKey: false,+ preventDefault: vi.fn(),+ nativeEvent: { isComposing: overrides.isComposing ?? false, keyCode: overrides.keyCode ?? 13 },+ ...overrides,+ }) as unknown as ReactKeyboardEvent<HTMLTextAreaElement>;++it("does not send on the Enter that confirms an IME composition", () => {+ const onSend = vi.fn();+ const hook = renderHook(() => useChatInputController({ value: "日本語", onSend }));++ const composing = enter({ isComposing: true });+ act(() => hook.result.current.handleKeyDown(composing));+ expect(onSend).not.toHaveBeenCalled();+ expect(composing.preventDefault).not.toHaveBeenCalled();++ const plain = enter();+ act(() => hook.result.current.handleKeyDown(plain));+ expect(onSend).toHaveBeenCalledTimes(1);+ expect(plain.preventDefault).toHaveBeenCalled();+});++it("does not send on the WebKit Enter that reports no composition but keyCode 229", () => {+ const onSend = vi.fn();+ const hook = renderHook(() => useChatInputController({ value: "日本語", onSend }));++ const webkitConfirm = enter({ keyCode: 229 });+ act(() => hook.result.current.handleKeyDown(webkitConfirm));++ expect(onSend).not.toHaveBeenCalled();+ expect(webkitConfirm.preventDefault).not.toHaveBeenCalled();+});diff --git a/apps/mirai-gui/client/src/features/chat/components/composer/chat-input/use-chat-input-controller.ts b/apps/mirai-gui/client/src/features/chat/components/composer/chat-input/use-chat-input-controller.tsnew file mode 100644index 000000000..1469e4ea9--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/components/composer/chat-input/use-chat-input-controller.ts@@ -0,0 +1,93 @@+import type { KeyboardEvent as ReactKeyboardEvent, MutableRefObject } from "react";+import { useCallback, useMemo, useRef } from "react";+import { isMacPlatform } from "@/utils/platform";+import type { ChatInputFile, ChatInputSendPayload } from "./types";++const EMPTY_FILES: ChatInputFile[] = [];++export type UseChatInputControllerArgs = {+ value: string;+ files?: ChatInputFile[];+ onSend?: (payload: ChatInputSendPayload) => void;+ canSend?: (payload: ChatInputSendPayload) => boolean;+ onBlockedSend?: (payload: ChatInputSendPayload) => void;+};++export type UseChatInputControllerResult = {+ textareaRef: MutableRefObject<HTMLTextAreaElement | null>;+ sendDisabled: boolean;+ hasContent: boolean;+ handleSubmit: () => void;+ handleKeyDown: (e: ReactKeyboardEvent<HTMLTextAreaElement>) => void;+};++export function useChatInputController({+ value,+ files,+ onSend,+ canSend,+ onBlockedSend,+}: UseChatInputControllerArgs): UseChatInputControllerResult {+ const textareaRef = useRef<HTMLTextAreaElement | null>(null);+ const isMac = isMacPlatform();++ const effectiveFiles = files ?? EMPTY_FILES;+ const trimmedText = value.trim();+ const hasContent = trimmedText.length > 0 || effectiveFiles.length > 0;++ const payload = useMemo<ChatInputSendPayload>(+ () => ({ text: trimmedText, files: effectiveFiles }),+ [effectiveFiles, trimmedText],+ );++ const sendDisabled = !hasContent || !onSend;++ const focusTextarea = useCallback(() => {+ textareaRef.current?.focus();+ }, []);++ const handleSubmit = useCallback(() => {+ if (sendDisabled) return;+ if (!onSend) return;+ if (canSend && !canSend(payload)) {+ onBlockedSend?.(payload);+ return;+ }++ onSend(payload);+ focusTextarea();+ }, [canSend, focusTextarea, onBlockedSend, onSend, payload, sendDisabled]);++ const handleKeyDown = useCallback(+ (e: ReactKeyboardEvent<HTMLTextAreaElement>) => {+ const metaOrCtrl = isMac ? e.metaKey : e.ctrlKey;++ if (e.key !== "Enter") return;+ // In WebKit the Enter that confirms an IME choice arrives with isComposing+ // already false and keyCode 229.+ if (e.nativeEvent.isComposing || e.nativeEvent.keyCode === 229) return;++ if (metaOrCtrl) {+ if (!hasContent || !onSend) return;+ e.preventDefault();+ handleSubmit();+ return;+ }++ if (e.shiftKey || e.ctrlKey || e.metaKey || e.altKey) return;+ if (!hasContent || !onSend) return;++ e.preventDefault();+ handleSubmit();+ },+ [handleSubmit, hasContent, isMac, onSend],+ );++ return {+ textareaRef,+ sendDisabled,+ hasContent,+ handleSubmit,+ handleKeyDown,+ };+}diff --git a/apps/mirai-gui/client/src/features/chat/components/composer/file-icon.tsx b/apps/mirai-gui/client/src/features/chat/components/composer/file-icon.tsxnew file mode 100644index 000000000..bc7b84030--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/components/composer/file-icon.tsx@@ -0,0 +1,32 @@+import type { ComponentType } from "react";+import { File, Table } from "lucide-react";++import { CodeIcon } from "@/components/icons/code-icon";++type FileIconProps = {+ extension: string;+ className?: string;+};++const ICON_BY_EXTENSION: Record<string, ComponentType<{ className?: string }>> = {+ txt: File,+ md: File,+ json: CodeIcon,+ csv: Table,+ tsv: Table,+ py: CodeIcon,+ js: CodeIcon,+ ts: CodeIcon,+ tsx: CodeIcon,+ jsx: CodeIcon,+ html: CodeIcon,+ css: CodeIcon,+ xml: CodeIcon,+ yaml: CodeIcon,+ yml: CodeIcon,+};++export const FileIcon = ({ extension, className }: FileIconProps) => {+ const IconComponent = ICON_BY_EXTENSION[extension] ?? File;+ return <IconComponent className={className} />;+};diff --git a/apps/mirai-gui/client/src/features/chat/components/composer/model-params-controls.tsx b/apps/mirai-gui/client/src/features/chat/components/composer/model-params-controls.tsxnew file mode 100644index 000000000..5bf81e10e--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/components/composer/model-params-controls.tsx@@ -0,0 +1,355 @@+import { getPlatform } from "@/platform/platform-singleton";+import type { SamplingDefaults } from "@/platform/services/chat";+import { STOCHASTIC_SEED, defaultReasoningEffort, useModelParamsStore } from "@/stores/use-model-params-store";+import { useModelsStore } from "@/stores/use-models-store";+import { useRuntimeSessionStore } from "@/stores/use-runtime-session-store";+import {+ TEMPERATURE_MIN,+ type ReasoningEffort,+ type ReasoningSupport,+ type SamplingPolicyPayload,+} from "@/types/sampling";+import { Checkbox } from "@/components/ui/checkbox";+import { Input } from "@/components/ui/input";+import { SegmentedControl } from "@/components/ui/segmented-control";+import { AnimatePresence, motion } from "motion/react";+import { useEffect, useState, useId } from "react";+import { Toggle } from "@/components/ui/toggle";++const TOP_K_MIN = 1;+const TOP_K_MAX = 4096;+const REPETITION_PENALTY_MIN = 1;+const REPETITION_PENALTY_MAX = 2;+const REPETITION_PENALTY_SEED = 1.1;+const SUFFIX_REPETITION_LENGTH_MIN = 32;+const SUFFIX_REPETITION_LENGTH_MAX = 4096;+const SUFFIX_REPETITION_LENGTH_STEP = 32;+const SUFFIX_REPETITION_LENGTH_SEED = 32;++type ModelParamsControlsProps = {+ repoId: string;+};++const MODE_OPTIONS = [+ { value: "Default", label: "Default" },+ { value: "Argmax", label: "Argmax" },+ { value: "Stochastic", label: "Stochastic" },+] as const;++const EFFORT_LABELS: Record<ReasoningEffort, string> = {+ disabled: "Off",+ default: "Default",+ low: "Low",+ medium: "Medium",+ high: "High",+ xhigh: "XHigh",+};++const sectionLabel = "text-[12px] font-[450] text-label-muted";++export const ModelParamsControls = ({ repoId }: ModelParamsControlsProps) => {+ const model = useModelsStore((s) => s.models.find((m) => m.repoId === repoId));+ const params = useModelParamsStore((s) => s.paramsByRepoId[repoId] ?? null);+ const globalReasoningEnabled = useModelParamsStore((s) => s.globalReasoningEnabled);+ const setParams = useModelParamsStore((s) => s.setParams);++ const sampling: SamplingPolicyPayload = params?.sampling ?? { type: "Default" };+ const reasoningEffort = params?.reasoningEffort ?? defaultReasoningEffort(globalReasoningEnabled);+ const reasoning: ReasoningSupport = model?.reasoning ?? { kind: "unsupported" };+ const stochastic = sampling.type === "Stochastic" ? sampling : null;++ const isResident = useRuntimeSessionStore((s) => s.residentSession?.repoId === repoId);+ const [modelDefaults, setModelDefaults] = useState<SamplingDefaults | null>(null);+ useEffect(() => setModelDefaults(null), [repoId]);+ useEffect(() => {+ if (!isResident) return;+ let alive = true;+ void getPlatform()+ .chat.getSamplingDefaults(repoId)+ .then((defaults) => {+ if (alive) setModelDefaults(defaults);+ });+ return () => {+ alive = false;+ };+ }, [repoId, isResident]);+ const seed = {+ temperature: Math.max(TEMPERATURE_MIN, modelDefaults?.temperature ?? STOCHASTIC_SEED.temperature),+ topK: modelDefaults?.topK ?? STOCHASTIC_SEED.topK,+ topP: modelDefaults?.topP ?? STOCHASTIC_SEED.topP,+ minP: modelDefaults?.minP ?? STOCHASTIC_SEED.minP,+ repetitionPenalty: modelDefaults?.repetitionPenalty ?? REPETITION_PENALTY_SEED,+ suffixRepetitionLength: modelDefaults?.suffixRepetitionLength ?? SUFFIX_REPETITION_LENGTH_SEED,+ };++ const update = (next: SamplingPolicyPayload) => {+ setParams(repoId, { ...params, sampling: next });+ };++ const onModeChange = (value: string) => {+ if (value === "Stochastic") {+ update({ type: "Stochastic", temperature: seed.temperature, topK: seed.topK, topP: seed.topP, minP: seed.minP });+ } else if (value === "Argmax") {+ update({ type: "Argmax" });+ } else {+ update({ type: "Default" });+ }+ };++ const onStochasticChange = (+ patch: Partial<{+ temperature: number;+ topK: number;+ topP: number;+ minP: number;+ repetitionPenalty: number;+ suffixRepetitionLength: number;+ }>,+ ) => {+ const base = stochastic ?? { type: "Stochastic" as const };+ update({+ type: "Stochastic",+ temperature: base.temperature ?? seed.temperature,+ topK: base.topK ?? seed.topK,+ ...(base.topP !== undefined ? { topP: base.topP } : {}),+ ...(base.minP !== undefined ? { minP: base.minP } : {}),+ ...(base.repetitionPenalty !== undefined ? { repetitionPenalty: base.repetitionPenalty } : {}),+ ...(base.suffixRepetitionLength !== undefined ? { suffixRepetitionLength: base.suffixRepetitionLength } : {}),+ ...patch,+ });+ };++ const onToggleOptional = (field: "topP" | "minP" | "repetitionPenalty", on: boolean) => {+ if (on) {+ const patch =+ field === "repetitionPenalty"+ ? { repetitionPenalty: seed.repetitionPenalty, suffixRepetitionLength: seed.suffixRepetitionLength }+ : { [field]: seed[field] };+ onStochasticChange(patch);+ } else {+ const next = { ...(stochastic ?? { type: "Stochastic" as const }) };+ delete next[field];+ if (field === "repetitionPenalty") delete next.suffixRepetitionLength;+ update({ ...next, type: "Stochastic" });+ }+ };++ const onReasoningChange = (effort: ReasoningEffort) => {+ const override = effort === defaultReasoningEffort(globalReasoningEnabled) ? undefined : effort;+ setParams(repoId, { sampling, ...(override ? { reasoningEffort: override } : {}) });+ };++ const levelOptions =+ reasoning.kind === "levels"+ ? reasoning.efforts.map((effort) => ({ value: effort, label: EFFORT_LABELS[effort] }))+ : [];+ const levelValue =+ reasoning.kind === "levels"+ ? reasoning.efforts.includes(reasoningEffort)+ ? reasoningEffort+ : (reasoning.efforts.find((effort) => effort === "default") ??+ reasoning.efforts.find((effort) => effort !== "disabled"))+ : undefined;++ return (+ <div className="flex flex-col gap-3">+ <div className="flex flex-col gap-1.5">+ <span className={sectionLabel}>Sampling</span>+ <SegmentedControl ariaLabel="Sampling" value={sampling.type} onChange={onModeChange} options={MODE_OPTIONS} />+ </div>++ <AnimatePresence initial={false}>+ {stochastic && (+ <motion.div+ key="stochastic"+ initial={{ height: 0, opacity: 0 }}+ animate={{ height: "auto", opacity: 1 }}+ exit={{ height: 0, opacity: 0 }}+ transition={{ duration: 0.2, ease: "easeInOut" }}+ className="overflow-hidden"+ >+ <div className="flex flex-col gap-3 pt-3">+ <NumberSliderRow+ label="Temperature"+ min={TEMPERATURE_MIN}+ max={1}+ step={0.01}+ decimals={2}+ value={stochastic.temperature ?? seed.temperature}+ onChange={(v) => onStochasticChange({ temperature: v })}+ />+ <NumberSliderRow+ label="Top K"+ min={TOP_K_MIN}+ max={TOP_K_MAX}+ step={1}+ decimals={0}+ noSlider+ value={stochastic.topK ?? seed.topK}+ onChange={(v) => onStochasticChange({ topK: v })}+ />+ <NumberSliderRow+ label="Top P"+ min={0}+ max={1}+ step={0.01}+ decimals={2}+ value={stochastic.topP ?? seed.topP}+ enabled={stochastic.topP !== undefined}+ onToggle={(on) => onToggleOptional("topP", on)}+ onChange={(v) => onStochasticChange({ topP: v })}+ />+ <NumberSliderRow+ label="Min P"+ min={0}+ max={1}+ step={0.01}+ decimals={2}+ value={stochastic.minP ?? seed.minP}+ enabled={stochastic.minP !== undefined}+ onToggle={(on) => onToggleOptional("minP", on)}+ onChange={(v) => onStochasticChange({ minP: v })}+ />+ <NumberSliderRow+ label="Repetition penalty"+ min={REPETITION_PENALTY_MIN}+ max={REPETITION_PENALTY_MAX}+ step={0.05}+ decimals={2}+ value={stochastic.repetitionPenalty ?? seed.repetitionPenalty}+ enabled={stochastic.repetitionPenalty !== undefined}+ onToggle={(on) => onToggleOptional("repetitionPenalty", on)}+ onChange={(v) => onStochasticChange({ repetitionPenalty: v })}+ />+ {stochastic.repetitionPenalty !== undefined && (+ <NumberSliderRow+ label="Suffix repetition length"+ min={SUFFIX_REPETITION_LENGTH_MIN}+ max={SUFFIX_REPETITION_LENGTH_MAX}+ step={SUFFIX_REPETITION_LENGTH_STEP}+ decimals={0}+ noSlider+ value={stochastic.suffixRepetitionLength ?? seed.suffixRepetitionLength}+ onChange={(v) => onStochasticChange({ suffixRepetitionLength: v })}+ />+ )}+ </div>+ </motion.div>+ )}+ </AnimatePresence>++ {reasoning.kind === "toggle" && (+ <div className="flex items-center justify-between gap-3 border-t border-cell-border pt-3">+ <span className="text-[13px] text-label-title">Reasoning</span>+ <Toggle+ label="Reasoning"+ checked={reasoningEffort !== "disabled"}+ onChange={(checked) => onReasoningChange(checked ? "default" : "disabled")}+ />+ </div>+ )}++ {reasoning.kind === "levels" && levelValue !== undefined && (+ <div className="flex flex-col gap-1.5 border-t border-cell-border pt-3">+ <span className={sectionLabel}>Reasoning</span>+ <SegmentedControl+ ariaLabel="Reasoning"+ value={levelValue}+ onChange={(value) => onReasoningChange(value as ReasoningEffort)}+ options={levelOptions}+ />+ </div>+ )}+ </div>+ );+};++type NumberSliderRowProps = {+ label: string;+ min: number;+ max: number;+ step: number;+ decimals: number;+ value: number;+ onChange: (value: number) => void;+ enabled?: boolean;+ onToggle?: (on: boolean) => void;+ noSlider?: boolean;+};++const fmt = (value: number, decimals: number) => (decimals > 0 ? String(value) : String(Math.round(value)));++const NumberSliderRow = ({+ label,+ min,+ max,+ step,+ decimals,+ value,+ onChange,+ enabled,+ onToggle,+ noSlider,+}: NumberSliderRowProps) => {+ const optional = onToggle !== undefined;+ const active = !optional || enabled === true;++ const labelId = useId();+ const [draft, setDraft] = useState(fmt(value, decimals));+ useEffect(() => {+ // Keep what the user typed while it still parses to the value ("1." for 1).+ setDraft((current) => (Number(current) === value ? current : fmt(value, decimals)));+ }, [value, decimals]);++ const onInput = (raw: string) => {+ setDraft(raw);+ if (raw.trim() === "") return;+ const n = decimals > 0 ? Number(raw) : Math.floor(Number(raw));+ if (Number.isFinite(n) && n >= min && n <= max) onChange(n);+ };++ const onBlur = () => {+ const parsed = decimals > 0 ? Number(draft) : Math.floor(Number(draft));+ const next = Number.isFinite(parsed) ? Math.min(max, Math.max(min, parsed)) : value;+ setDraft(fmt(next, decimals));+ if (next !== value) onChange(next);+ };++ return (+ <div className="flex flex-col gap-1.5">+ <div className="flex items-center justify-between gap-3">+ <div className="flex items-center gap-2">+ <span id={labelId} className="text-[13px] text-label-title">+ {label}+ </span>+ {optional && (+ <Checkbox checked={active} onChange={(on) => onToggle?.(on)} size="sm" aria-label={`Enable ${label}`} />+ )}+ </div>+ <Input+ size="sm"+ type="text"+ aria-labelledby={labelId}+ inputMode="decimal"+ disabled={!active}+ className="w-20"+ value={active ? draft : ""}+ onChange={(e) => onInput(e.target.value)}+ onBlur={onBlur}+ />+ </div>+ {active && !noSlider && (+ <input+ type="range"+ aria-labelledby={labelId}+ min={min}+ max={max}+ step={step}+ value={value}+ onChange={(e) => onChange(Number(e.target.value))}+ className="my-1 h-1.5 w-full cursor-pointer appearance-none rounded-full bg-slider-track [&::-webkit-slider-thumb]:size-3 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-text-primary"+ />+ )}+ </div>+ );+};diff --git a/apps/mirai-gui/client/src/features/chat/components/composer/model-params-drawer.tsx b/apps/mirai-gui/client/src/features/chat/components/composer/model-params-drawer.tsxnew file mode 100644index 000000000..abdabea95--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/components/composer/model-params-drawer.tsx@@ -0,0 +1,83 @@+import { useInstalledPickerModels } from "../../hooks/use-picker-models";+import { useChatStore } from "@/stores/use-chat-store";+import { Dialog, DialogPanel, DialogTitle, Transition, TransitionChild } from "@headlessui/react";+import { ModelPicker } from "./chat-input/model-picker";+import { X } from "lucide-react";+import { Fragment } from "react";+import { ModelParamsControls } from "./model-params-controls";++type ModelParamsDrawerProps = {+ open: boolean;+ chatId: string;+ repoId: string | null;+ onClose: () => void;+};++export const ModelParamsDrawer = ({ open, chatId, repoId, onClose }: ModelParamsDrawerProps) => {+ const setChatModel = useChatStore((s) => s.setChatModel);+ const pickerModels = useInstalledPickerModels();++ const onPickModel = (modelId: string) => {+ const model = pickerModels.find((m) => m.id === modelId);+ if (model) setChatModel(chatId, modelId, model.name);+ };++ return (+ <Transition appear show={open} as={Fragment}>+ <Dialog as="div" className="relative z-50" onClose={onClose}>+ <TransitionChild+ as={Fragment}+ enter="ease-out duration-200"+ enterFrom="opacity-0"+ enterTo="opacity-100"+ leave="ease-in duration-150"+ leaveFrom="opacity-100"+ leaveTo="opacity-0"+ >+ <div className="fixed inset-0 bg-black/25" />+ </TransitionChild>++ <div className="fixed inset-y-0 right-0 flex max-w-full">+ <TransitionChild+ as={Fragment}+ enter="transform transition ease-out duration-300"+ enterFrom="translate-x-full"+ enterTo="translate-x-0"+ leave="transform transition ease-in duration-200"+ leaveFrom="translate-x-0"+ leaveTo="translate-x-full"+ >+ <DialogPanel className="flex h-full w-[320px] flex-col border-l border-cell-border bg-bg-modal px-5 pb-6 pt-[18px] shadow-xl">+ <div className="flex items-center justify-between gap-3">+ <DialogTitle as="h3" className="text-[17px] font-medium leading-[130%] text-label-title">+ Edit parameters+ </DialogTitle>+ <button+ onClick={onClose}+ className="text-label-muted transition-colors hover:text-label-title"+ aria-label="Close"+ >+ <X className="h-5 w-5" />+ </button>+ </div>++ <div className="mt-4">+ <ModelPicker+ models={pickerModels}+ activeModelId={repoId ?? ""}+ onModelChange={onPickModel}+ moreModelsLink={{ href: "/local-models" }}+ menuPlacement="down"+ />+ </div>++ <div className="mt-4 flex-1 overflow-y-auto">+ {repoId ? <ModelParamsControls repoId={repoId} /> : null}+ </div>+ </DialogPanel>+ </TransitionChild>+ </div>+ </Dialog>+ </Transition>+ );+};diff --git a/apps/mirai-gui/client/src/features/chat/components/message/chat-message-list.tsx b/apps/mirai-gui/client/src/features/chat/components/message/chat-message-list.tsxnew file mode 100644index 000000000..656e1a1da--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/components/message/chat-message-list.tsx@@ -0,0 +1,42 @@+import { MessageList } from "./message-list";++type ChatMessageListProps = {+ isNewChat: boolean;+ isChatStreaming: boolean;+ isLoadingStream: boolean;+ isTitleGeneratingForChat: boolean;+ isModelLoading: boolean;+ hasResidentModel: boolean;+ scrollTargetId: string | null;+ onScrolled: () => void;+ loadingMessageId: string | null;+ canceledMessageId: string | null;+ onMessageModelSelect: (messageId: string, modelId: string, modelName: string) => void;+};++export const ChatMessageList = ({+ isNewChat,+ isChatStreaming,+ isLoadingStream,+ isTitleGeneratingForChat,+ isModelLoading,+ hasResidentModel,+ scrollTargetId,+ onScrolled,+ loadingMessageId,+ canceledMessageId,+ onMessageModelSelect,+}: ChatMessageListProps) => (+ <MessageList+ isNew={isNewChat}+ isLoading={(isLoadingStream && isChatStreaming) || isTitleGeneratingForChat}+ scrollToMessageId={scrollTargetId}+ onScrolled={onScrolled}+ isUiStreaming={isChatStreaming}+ onMessageModelSelect={onMessageModelSelect}+ loadingMessageId={loadingMessageId}+ canceledMessageId={canceledMessageId}+ isModelLoading={isModelLoading}+ hasResidentModel={hasResidentModel}+ />+);diff --git a/apps/mirai-gui/client/src/features/chat/components/message/markdown-renderer.test.tsx b/apps/mirai-gui/client/src/features/chat/components/message/markdown-renderer.test.tsxnew file mode 100644index 000000000..7719390de--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/components/message/markdown-renderer.test.tsx@@ -0,0 +1,151 @@+import { cleanup, render, waitFor } from "@testing-library/react";+import { afterEach, describe, expect, it } from "vitest";+import { MarkdownRenderer } from "./markdown-renderer";++afterEach(cleanup);++const links = (container: HTMLElement) =>+ Array.from(container.querySelectorAll("a")).map((a) => ({ href: a.getAttribute("href"), text: a.textContent }));++describe("MarkdownRenderer links", () => {+ it("renders markdown links, bare URLs and autolinks as anchors that open externally", () => {+ const { container } = render(+ <MarkdownRenderer+ content={"See [Mirai](https://trymirai.com) or https://example.com/p?x=1 or <https://angle.test>."}+ />,+ );+ expect(links(container)).toEqual([+ { href: "https://trymirai.com/", text: "Mirai" },+ { href: "https://example.com/p?x=1", text: "https://example.com/p?x=1" },+ { href: "https://angle.test/", text: "https://angle.test" },+ ]);+ for (const a of container.querySelectorAll("a")) {+ expect(a.getAttribute("target")).toBe("_blank");+ expect(a.getAttribute("rel")).toContain("noreferrer");+ }+ });++ it("leaves scheme-less domains as plain text, like GitHub does", () => {+ const { container } = render(<MarkdownRenderer content={"Try **Spotify.com** or Reddit.com today."} />);+ expect(links(container)).toEqual([]);+ expect(container.textContent).toContain("Spotify.com");+ });++ it("keeps links inside tables and lists", () => {+ const md = "| a | b |\n|---|---|\n| [t](https://t.test/x) | y |\n\n- [l](https://l.test/y)";+ const { container } = render(<MarkdownRenderer content={md} />);+ expect(links(container).map((l) => l.href)).toEqual(["https://t.test/x", "https://l.test/y"]);+ });+});++describe("MarkdownRenderer incomplete markdown", () => {+ const unterminated = "Sources: [1](https://a.test) and [2\n\nLet me know! ✨";++ it("renders an unterminated link as text, never as a placeholder href", () => {+ const { container } = render(<MarkdownRenderer content={unterminated} />);+ expect(links(container)).toEqual([{ href: "https://a.test/", text: "1" }]);+ expect(container.textContent).toContain("Let me know! ✨");+ expect(container.textContent).not.toContain("streamdown:incomplete-link");+ });++ it("renders the same whether or not the text is still streaming", () => {+ const done = render(<MarkdownRenderer content={unterminated} />).container.innerHTML;+ const live = render(<MarkdownRenderer content={unterminated} streaming />).container.innerHTML;+ expect(live).toBe(done);+ });+});++const streaming = (content: string) => render(<MarkdownRenderer content={content} streaming />);++describe("MarkdownRenderer unterminated formatting while streaming", () => {+ it("closes bold, italic and inline code", () => {+ expect(streaming("Some **bold text").container.querySelector("strong")?.textContent).toBe("bold text");+ expect(streaming("Some *italic text").container.querySelector("em")?.textContent).toBe("italic text");+ expect(streaming("Run `pnpm check").container.querySelector("code")?.textContent).toBe("pnpm check");+ });++ it("does not leak marker characters as text", () => {+ expect(streaming("Some **bold").container.textContent).not.toContain("**");+ expect(streaming("Run `pnpm check").container.textContent).not.toContain("`");+ expect(streaming("Some ~~gone").container.textContent).not.toContain("~~");+ });++ it("renders an open code fence as a code block", async () => {+ const { container } = streaming("```ts\nconst a = 1;\nconst b = ");+ await waitFor(() => expect(container.querySelector("pre, [data-streamdown='code-block']")).not.toBeNull());+ expect(container.textContent).toContain("const a = 1;");+ expect(container.textContent).not.toContain("```");+ });++ it("renders a partial table row without breaking the table", () => {+ const { container } = streaming("| a | b |\n|---|---|\n| 1 | 2 |\n| 3 |");+ expect(container.querySelectorAll("table").length).toBe(1);+ expect(container.querySelectorAll("tbody tr").length).toBe(2);+ });+});++describe("MarkdownRenderer streaming parity", () => {+ const full = [+ "# Title",+ "Text with **bold**, *em*, `code`, [link](https://x.test/) and ~~gone~~.",+ "- one\n- two [l](https://l.test/)",+ "| a | b |\n|---|---|\n| 1 | 2 |",+ "> quote",+ ].join("\n\n");++ it("renders a finished message the same way with and without the streaming flag", () => {+ const stat = render(<MarkdownRenderer content={full} />).container;+ const live = render(<MarkdownRenderer content={full} streaming />).container;+ const text = (el: HTMLElement) => (el.textContent ?? "").replace(/\s+/g, "");+ expect(text(live)).toBe(text(stat));+ for (const sel of ["h1", "strong", "em", "code", "a", "li", "table", "tr", "blockquote", "del"]) {+ expect(live.querySelectorAll(sel).length, sel).toBe(stat.querySelectorAll(sel).length);+ }+ });+});++describe("MarkdownRenderer sanitization", () => {+ it("drops script tags and inline event handlers from raw HTML", () => {+ const { container } = render(+ <MarkdownRenderer+ content={'Hi <script>window.pwned = 1</script><img src="x" onerror="window.pwned = 1"> there'}+ />,+ );+ expect(container.querySelector("script")).toBeNull();+ expect(container.querySelector("[onerror]")).toBeNull();+ expect(container.textContent).toContain("Hi");+ });++ it("neutralises javascript: links", () => {+ const { container } = render(<MarkdownRenderer content={"[click](javascript:alert(1))"} />);+ expect(container.querySelector('a[href^="javascript:"]')).toBeNull();+ expect(container.textContent).toContain("click");+ });++ it("drops iframes and forms", () => {+ const { container } = render(+ <MarkdownRenderer+ content={'<iframe src="https://x.test"></iframe><form action="https://x.test"><input name="a"></form>'}+ />,+ );+ expect(container.querySelector("iframe")).toBeNull();+ expect(container.querySelector("form")).toBeNull();+ });+});++describe("MarkdownRenderer math and CJK", () => {+ it("renders block and inline math with KaTeX, leaving single-dollar prices alone", () => {+ const { container } = render(+ <MarkdownRenderer content={"Energy: $$E = mc^2$$ costs $5 and $10.\n\n$$\n\\int_0^1 x\\,dx\n$$"} />,+ );+ expect(container.querySelectorAll(".katex").length).toBe(2);+ expect(container.textContent).toContain("$5 and $10");+ expect(container.textContent).not.toContain("$$");+ });++ it("applies emphasis next to CJK punctuation", () => {+ const { container } = render(<MarkdownRenderer content={"これは**「重要」**です。**中文测试**,好的。"} />);+ const strong = Array.from(container.querySelectorAll("strong")).map((s) => s.textContent);+ expect(strong).toEqual(["「重要」", "中文测试"]);+ });+});diff --git a/apps/mirai-gui/client/src/features/chat/components/message/markdown-renderer.tsx b/apps/mirai-gui/client/src/features/chat/components/message/markdown-renderer.tsxnew file mode 100644index 000000000..270758922--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/components/message/markdown-renderer.tsx@@ -0,0 +1,333 @@+import { CopyButton } from "@/components/ui/copy-button";+import { Checkbox } from "@/components/ui/checkbox";+import { useAppStore } from "@/stores/use-app-store";+import { writeItemsWithFocus } from "@/utils/clipboard";+import { cjk } from "@streamdown/cjk";+import { createCodePlugin } from "@streamdown/code";+import { math } from "@streamdown/math";+import type { Element } from "hast";+import "katex/dist/katex.min.css";+import React, { useMemo, useRef } from "react";+import type { BundledTheme } from "shiki";+import { Streamdown } from "streamdown";++type MarkdownRendererProps = {+ content: string;+ className?: string;+ useOneFontSize?: boolean;+ /** Animates arriving text; incomplete markdown is completed either way. */+ streaming?: boolean;+};++// Safety mode opens links via window.open, which WKWebView drops; anchors go+// through the platform's click interception instead. This also drops+// Streamdown's own leave-site confirmation.+const LINK_SAFETY = { enabled: false } as const;+// The default placeholder href gets sanitized into "[blocked]" mid-stream.+const REMEND = { linkMode: "text-only" } as const;++type MarkdownComponentProps<K extends keyof JSX.IntrinsicElements> = JSX.IntrinsicElements[K] & { node?: Element };++const cloneTableElement = (table: HTMLTableElement): HTMLTableElement => {+ const clone = table.cloneNode(true);+ if (clone instanceof HTMLTableElement) {+ return clone;+ }+ throw new Error("Table element not found");+};++const MarkdownTable = ({ children, ...props }: MarkdownComponentProps<"table">) => {+ const tableRef = useRef<HTMLTableElement>(null);++ const handleTableCopy = async () => {+ if (!tableRef.current) {+ throw new Error("Table element not found");+ }++ const tableClone = cloneTableElement(tableRef.current);++ const buttons = tableClone.querySelectorAll('button, .copy-button, [class*="copy"]');+ buttons.forEach((button) => button.remove());++ await writeItemsWithFocus([+ new ClipboardItem({+ "text/html": new Blob([tableClone.outerHTML], { type: "text/html" }),+ "text/plain": new Blob([tableClone.textContent || ""], {+ type: "text/plain",+ }),+ }),+ ]);+ };++ return (+ <div className="relative mt-3 mb-5">+ <div className="absolute right-1 top-[10px] z-10">+ <CopyButton className="!min-w-6 !min-h-6" onCopy={handleTableCopy} />+ </div>+ <div className="overflow-x-auto thin-scrollbar">+ <table ref={tableRef} className="min-w-full" {...props}>+ {children}+ </table>+ </div>+ </div>+ );+};++const CustomComponents = {+ h1: ({ children, ...props }: MarkdownComponentProps<"h1">) => (+ <h1 className="text-[24px] font-medium leading-[130%] mb-4 text-label-title" {...props}>+ {children}+ </h1>+ ),+ h2: ({ children, ...props }: MarkdownComponentProps<"h2">) => (+ <h2 className="text-[20px] font-medium leading-[130%] mb-3 text-label-title" {...props}>+ {children}+ </h2>+ ),+ h3: ({ children, ...props }: MarkdownComponentProps<"h3">) => (+ <h3 className="text-[18px] font-medium leading-[130%] mb-2 text-label-title" {...props}>+ {children}+ </h3>+ ),+ h4: ({ children, ...props }: MarkdownComponentProps<"h4">) => (+ <h4 className="text-[16px] font-medium leading-[130%] mb-2 text-label-title" {...props}>+ {children}+ </h4>+ ),+ h5: ({ children, ...props }: MarkdownComponentProps<"h5">) => (+ <h5 className="text-[14px] font-medium leading-[130%] mb-1 text-label-title" {...props}>+ {children}+ </h5>+ ),+ h6: ({ children, ...props }: MarkdownComponentProps<"h6">) => (+ <h6 className="text-xs font-medium leading-[130%] mb-1 text-label-title" {...props}>+ {children}+ </h6>+ ),+ p: ({ children, ...props }: MarkdownComponentProps<"p">) => (+ <p className="mb-3 mt-2 text-[15px] font-[350] leading-[150%]" {...props}>+ {children}+ </p>+ ),+ ul: ({ children, ...props }: MarkdownComponentProps<"ul">) => (+ <ul+ className="mb-3 ml-[9px] list-disc text-[15px] font-[350] leading-[150%] text-label-title space-y-3 mt-3 pl-[10px]"+ {...props}+ >+ {children}+ </ul>+ ),+ ol: ({ children, ...props }: MarkdownComponentProps<"ol">) => (+ <ol+ className="mb-3 list-decimal list-inside text-[15px] font-[350] leading-[150%] text-label-title space-y-3 mt-3 tabular-nums marker:[font-variant-numeric:tabular-nums]"+ {...props}+ >+ {children}+ </ol>+ ),+ li: ({ children, ...props }: MarkdownComponentProps<"li">) => (+ <li+ className="text-[15px] font-[350] leading-[150%] text-label-title mb-3 last:mb-0 tabular-nums [&>p:first-child]:inline [&>p:first-child]:m-0"+ {...props}+ >+ {children}+ </li>+ ),+ blockquote: ({ children, ...props }: MarkdownComponentProps<"blockquote">) => (+ <blockquote+ className="border-l-[4px] border-button-border pl-3 text-[15px] font-[350] leading-[150%] text-label-title my-3"+ {...props}+ >+ {children}+ </blockquote>+ ),+ table: MarkdownTable,+ thead: ({ children, ...props }: MarkdownComponentProps<"thead">) => (+ <thead className="border-b border-button-border" {...props}>+ {children}+ </thead>+ ),+ tbody: ({ children, ...props }: MarkdownComponentProps<"tbody">) => <tbody {...props}>{children}</tbody>,+ tr: ({ children, ...props }: MarkdownComponentProps<"tr">) => (+ <tr className="border-b border-cell-border [&:has(th)]:border-button-border" {...props}>+ {children}+ </tr>+ ),+ th: ({ children, ...props }: MarkdownComponentProps<"th">) => (+ <th+ className="px-2 py-3 first:pl-0 last:pr-0 text-left text-[15px] font-[350] leading-[150%] text-label-title"+ {...props}+ >+ {children}+ </th>+ ),+ td: ({ children, ...props }: MarkdownComponentProps<"td">) => (+ <td className="px-2 py-3 first:pl-0 last:pr-0 text-[15px] font-[350] leading-[150%] text-label-title" {...props}>+ {children}+ </td>+ ),+ hr: ({ ...props }: MarkdownComponentProps<"hr">) => (+ <hr className="my-5 border-gray-300 dark:border-gray-600" {...props} />+ ),+ img: ({ ...props }: MarkdownComponentProps<"img">) => <img className="max-w-full h-auto rounded my-3" {...props} />,+ input: ({ type, checked, ...props }: MarkdownComponentProps<"input">) => {+ if (type === "checkbox") {+ return (+ <div className="inline-flex items-center align-text-bottom">+ <Checkbox checked={!!checked} onChange={() => {}} disabled size="sm" className="mr-1" />+ </div>+ );+ }+ return <input type={type} {...props} />;+ },+ strong: ({ children, ...props }: MarkdownComponentProps<"strong">) => (+ <strong className="text-[15px] font-medium leading-[150%] tracking-[0.2px] text-label-title" {...props}>+ {children}+ </strong>+ ),+ em: ({ children, ...props }: MarkdownComponentProps<"em">) => (+ <em className="text-[15px] italic font-normal leading-[150%] text-label-title" {...props}>+ {children}+ </em>+ ),+};++const OneFontSizeComponents = {+ h1: ({ children, ...props }: MarkdownComponentProps<"h1">) => (+ <h1 className="text-xs font-medium mb-1" {...props}>+ {children}+ </h1>+ ),+ h2: ({ children, ...props }: MarkdownComponentProps<"h2">) => (+ <h2 className="text-xs font-medium mb-1" {...props}>+ {children}+ </h2>+ ),+ h3: ({ children, ...props }: MarkdownComponentProps<"h3">) => (+ <h3 className="text-xs font-medium mb-1" {...props}>+ {children}+ </h3>+ ),+ h4: ({ children, ...props }: MarkdownComponentProps<"h4">) => (+ <h4 className="text-xs font-medium mb-1" {...props}>+ {children}+ </h4>+ ),+ h5: ({ children, ...props }: MarkdownComponentProps<"h5">) => (+ <h5 className="text-xs font-medium mb-1" {...props}>+ {children}+ </h5>+ ),+ h6: ({ children, ...props }: MarkdownComponentProps<"h6">) => (+ <h6 className="text-xs font-medium mb-1" {...props}>+ {children}+ </h6>+ ),+ p: ({ children, ...props }: MarkdownComponentProps<"p">) => (+ <p className="mb-1 mt-1 text-xs font-[350]" {...props}>+ {children}+ </p>+ ),+ ul: ({ children, ...props }: MarkdownComponentProps<"ul">) => (+ <ul className="mb-2 ml-[9px] list-disc text-xs font-[350] space-y-2 mt-2 pl-[10px]" {...props}>+ {children}+ </ul>+ ),+ ol: ({ children, ...props }: MarkdownComponentProps<"ol">) => (+ <ol+ className="mb-2 list-decimal list-inside text-xs font-[350] space-y-2 mt-2 tabular-nums marker:[font-variant-numeric:tabular-nums]"+ {...props}+ >+ {children}+ </ol>+ ),+ li: ({ children, ...props }: MarkdownComponentProps<"li">) => (+ <li className="font-[350] mb-2 last:mb-0 tabular-nums [&>p:first-child]:inline [&>p:first-child]:m-0" {...props}>+ {children}+ </li>+ ),+ blockquote: ({ children, ...props }: MarkdownComponentProps<"blockquote">) => (+ <blockquote className="border-l-[4px] border-button-border pl-2 text-xs font-[350] my-3" {...props}>+ {children}+ </blockquote>+ ),+ table: MarkdownTable,+ thead: ({ children, ...props }: MarkdownComponentProps<"thead">) => (+ <thead className="border-b border-button-border" {...props}>+ {children}+ </thead>+ ),+ tbody: ({ children, ...props }: MarkdownComponentProps<"tbody">) => <tbody {...props}>{children}</tbody>,+ tr: ({ children, ...props }: MarkdownComponentProps<"tr">) => (+ <tr className="border-b border-cell-border [&:has(th)]:border-button-border" {...props}>+ {children}+ </tr>+ ),+ th: ({ children, ...props }: MarkdownComponentProps<"th">) => (+ <th className="px-2 py-2 first:pl-0 last:pr-0 text-left text-xs font-[350]" {...props}>+ {children}+ </th>+ ),+ td: ({ children, ...props }: MarkdownComponentProps<"td">) => (+ <td className="px-2 py-2 first:pl-0 last:pr-0 text-xs font-[350]" {...props}>+ {children}+ </td>+ ),+ hr: ({ ...props }: MarkdownComponentProps<"hr">) => (+ <hr className="my-2 border-gray-300 dark:border-gray-600" {...props} />+ ),+ img: ({ ...props }: MarkdownComponentProps<"img">) => <img className="max-w-full h-auto rounded my-3" {...props} />,+ input: ({ type, checked, ...props }: MarkdownComponentProps<"input">) => {+ if (type === "checkbox") {+ return (+ <div className="inline-flex items-center align-text-bottom">+ <Checkbox checked={!!checked} onChange={() => {}} disabled size="sm" className="mr-1" />+ </div>+ );+ }+ return <input type={type} {...props} />;+ },+ strong: ({ children, ...props }: MarkdownComponentProps<"strong">) => (+ <strong className="text-xs font-medium tracking-[0.2px]" {...props}>+ {children}+ </strong>+ ),+ em: ({ children, ...props }: MarkdownComponentProps<"em">) => (+ <em className="text-xs italic font-normal" {...props}>+ {children}+ </em>+ ),+};++export const MarkdownRenderer: React.FC<MarkdownRendererProps> = ({+ content,+ useOneFontSize = false,+ className = "max-w-none text-label-title markdown-body",+ streaming = false,+}) => {+ const isDarkMode = useAppStore((s) => s.isDarkMode);++ const codePlugin = useMemo(() => {+ const themes: [BundledTheme, BundledTheme] = isDarkMode+ ? ["github-dark", "github-dark"]+ : ["github-light", "github-light"];+ return createCodePlugin({ themes });+ }, [isDarkMode]);+ return (+ <div className={className}>+ <Streamdown+ mode="streaming"+ isAnimating={streaming}+ parseIncompleteMarkdown+ lineNumbers={false}+ codeBlockMaxHeight="none"+ linkSafety={LINK_SAFETY}+ remend={REMEND}+ components={useOneFontSize ? OneFontSizeComponents : CustomComponents}+ plugins={{ code: codePlugin, math, cjk }}+ >+ {content}+ </Streamdown>+ </div>+ );+};diff --git a/apps/mirai-gui/client/src/features/chat/components/message/message-list.tsx b/apps/mirai-gui/client/src/features/chat/components/message/message-list.tsxnew file mode 100644index 000000000..4dc192c8a--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/components/message/message-list.tsx@@ -0,0 +1,254 @@+import { Transition } from "@headlessui/react";+import { useParams } from "@tanstack/react-router";+import React, { useEffect, useLayoutEffect, useRef } from "react";+import { useChatStore } from "@/stores/use-chat-store";+import { Loader, LoaderIcon } from "@/components/loader";+import { Message } from "./message";++type MessageListProps = {+ isNew?: boolean;+ isLoading?: boolean;+ scrollToMessageId?: string | null;+ onScrolled?: () => void;+ isUiStreaming?: boolean;+ onMessageModelSelect?: (messageId: string, modelId: string, modelName: string) => void;+ loadingMessageId?: string | null;+ canceledMessageId?: string | null;+ isModelLoading?: boolean;+ hasResidentModel?: boolean;+};++const MessageListComponent: React.FC<MessageListProps> = ({+ isNew,+ isLoading,+ scrollToMessageId,+ onScrolled,+ isUiStreaming,+ onMessageModelSelect,+ loadingMessageId,+ canceledMessageId,+ isModelLoading,+ hasResidentModel,+}) => {+ const messages = useChatStore((s) => s.messages);+ const messagesEndRef = useRef<HTMLDivElement>(null);+ const scrollContainerRef = useRef<HTMLDivElement>(null);+ const itemRefs = useRef<Record<string, HTMLDivElement | null>>({});+ const lastScrolledIdRef = useRef<string | null>(null);+ const autoStickRef = useRef<boolean>(true);+ const { chatId } = useParams({ from: "/chat/$chatId" });++ const scrollToBottom = (behavior: ScrollBehavior = "auto") => {+ const container = scrollContainerRef.current;+ if (container) {+ if (behavior === "smooth") {+ container.scrollTo({ top: container.scrollHeight, behavior: "smooth" });+ } else {+ container.scrollTop = container.scrollHeight;+ }+ } else {+ if (behavior === "smooth") {+ messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });+ } else {+ messagesEndRef.current?.scrollIntoView();+ }+ }+ };++ const didInitialScrollRef = useRef<boolean>(false);+ useLayoutEffect(() => {+ didInitialScrollRef.current = false;+ autoStickRef.current = true;+ }, [chatId]);+ useLayoutEffect(() => {+ if (!didInitialScrollRef.current && messages.length > 0) {+ scrollToBottom("auto");+ didInitialScrollRef.current = true;+ }+ }, [messages.length, chatId]);++ useEffect(() => {+ const container = scrollContainerRef.current;+ if (!container) return;++ const threshold = 8;++ const handleScroll = () => {+ const atBottom = container.scrollTop + container.clientHeight >= container.scrollHeight - threshold;+ autoStickRef.current = atBottom;+ };++ const handleLoad = () => {+ if (autoStickRef.current) {+ container.scrollTop = container.scrollHeight;+ }+ };++ container.addEventListener("scroll", handleScroll, { passive: true });+ container.addEventListener("load", handleLoad, true);++ const observer = new MutationObserver(() => {+ if (autoStickRef.current) {+ container.scrollTop = container.scrollHeight;+ }+ });+ observer.observe(container, {+ childList: true,+ subtree: true,+ characterData: true,+ });++ const resizeObserver = new ResizeObserver(() => {+ if (autoStickRef.current) {+ container.scrollTop = container.scrollHeight;+ }+ });+ resizeObserver.observe(container);++ handleScroll();++ return () => {+ container.removeEventListener("scroll", handleScroll);+ container.removeEventListener("load", handleLoad, true);+ observer.disconnect();+ resizeObserver.disconnect();+ };+ }, [chatId]);++ useEffect(() => {+ const container = scrollContainerRef.current;+ if (!container) return;++ let rafId = 0;+ const tick = () => {+ if (autoStickRef.current && isLoading && !isUiStreaming) {+ container.scrollTop = container.scrollHeight;+ }+ rafId = requestAnimationFrame(tick);+ };++ if (isLoading && !isUiStreaming) {+ rafId = requestAnimationFrame(tick);+ }++ return () => {+ if (rafId) cancelAnimationFrame(rafId);+ };+ }, [isUiStreaming, isLoading, chatId]);++ useEffect(() => {+ if (!scrollToMessageId) return;+ if (lastScrolledIdRef.current === scrollToMessageId) return;++ const container = scrollContainerRef.current;+ if (!container) return;++ const tryScroll = () => {+ const el = itemRefs.current[scrollToMessageId];+ if (!el) {+ return;+ }+ container.scrollTo({ top: el.offsetTop, behavior: "smooth" });+ lastScrolledIdRef.current = scrollToMessageId;+ onScrolled?.();+ };++ requestAnimationFrame(tryScroll);+ }, [scrollToMessageId, onScrolled]);++ const lastAssistantIndex = messages.at(-1)?.sender === "assistant" ? messages.length - 1 : -1;++ const showWaiting = !hasResidentModel && Boolean(isLoading) && !loadingMessageId;+ const isBusy = Boolean(isModelLoading || isLoading);+ const loaderText = showWaiting ? "Waiting for the model to be ready…" : "Generating reply…";++ return (+ <div className="relative flex flex-1 flex-col overflow-hidden h-full">+ <div ref={scrollContainerRef} className="absolute inset-0 flex flex-col gap-4 overflow-y-auto scrollbar-hide">+ {messages.length > 0 ? (+ messages.map((message, idx) => {+ const isLastAssistant = idx === lastAssistantIndex;+ const isLoadingThisMessage = loadingMessageId === message.id;++ const hasVersions = Array.isArray(message.versions) && (message.versions?.length || 0) > 0;+ const activeVersion = hasVersions+ ? message.versions?.[message.currentVersionIndex ?? message.versions.length - 1]+ : undefined;+ const activeParsed = hasVersions ? activeVersion?.output?.text?.parsed : message.output?.text?.parsed;+ const activeText = hasVersions ? activeVersion?.text : message.text;++ const hasVisibleParsed = Boolean(+ (activeParsed?.chainOfThought && activeParsed.chainOfThought.length > 0) ||+ (activeParsed?.response && activeParsed.response.length > 0) ||+ (activeText && activeText.length > 0),+ );++ const showInlineLoader = isLoadingThisMessage && !hasVisibleParsed;++ const showAssistantLoader = !loadingMessageId && isLastAssistant && isBusy;++ return (+ <Transition+ key={message.id}+ appear+ show={true}+ enter="transition-opacity duration-200 ease-out"+ enterFrom="opacity-0"+ enterTo="opacity-100"+ >+ <div+ ref={(el) => {+ itemRefs.current[message.id] = el;+ }}+ className={isLastAssistant ? "flex flex-col min-h-8" : undefined}+ >+ {showAssistantLoader ? (+ <div className="flex items-center gap-2 text-left text-[15px] leading-[18px] text-label-muted">+ <Loader text={loaderText} />+ </div>+ ) : null}+ {showInlineLoader ? (+ <div className="flex items-center gap-2 text-left text-[15px] leading-[18px] text-label-muted">+ <Loader text={loaderText} />+ </div>+ ) : null}+ <Message+ key={`${message.id}_${message.currentVersionIndex ?? 0}_${message.versions?.length ?? 0}`}+ isLoading={isLoadingThisMessage}+ chatId={chatId}+ isLast={idx === lastAssistantIndex}+ isUiStreaming={Boolean(isUiStreaming && isLastAssistant)}+ isCanceled={canceledMessageId === message.id}+ onModelSelect={onMessageModelSelect}+ {...message}+ />+ </div>+ </Transition>+ );+ })+ ) : (+ <div className="flex gap-2 items-center justify-center h-full relative">+ {isNew ? (+ <>+ <span className="text-label-muted text-[13px] font-[350]">+ Start your new private and local conversation+ </span>+ <LoaderIcon />+ </>+ ) : (+ <Loader />+ )}+ </div>+ )}+ {lastAssistantIndex === -1 && isBusy && !loadingMessageId && (+ <div className="flex items-center gap-2 text-left text-[15px] leading-[18px] text-label-muted">+ <Loader text={loaderText} />+ </div>+ )}+ <div ref={messagesEndRef} />+ </div>+ </div>+ );+};++export const MessageList = React.memo(MessageListComponent);diff --git a/apps/mirai-gui/client/src/features/chat/components/message/message-version-controls.tsx b/apps/mirai-gui/client/src/features/chat/components/message/message-version-controls.tsxnew file mode 100644index 000000000..fdd9f504c--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/components/message/message-version-controls.tsx@@ -0,0 +1,73 @@+import React from "react";+import { ChevronLeft, ChevronRight } from "lucide-react";+import { twMerge } from "tailwind-merge";++type MessageVersionControlsProps = {+ currentVersion: number;+ totalVersions: number;+ onVersionChange: (versionIndex: number) => void;+ className?: string;+ disabledPrevious?: boolean;+ currentModelName?: string;+};++export const MessageVersionControls: React.FC<MessageVersionControlsProps> = ({+ currentVersion,+ totalVersions,+ onVersionChange,+ className,+ disabledPrevious,+ currentModelName,+}) => {+ const canGoPrevious = currentVersion > 0 && !disabledPrevious;+ const canGoNext = currentVersion < totalVersions - 1;++ const handlePrevious = () => {+ if (canGoPrevious) {+ onVersionChange(currentVersion - 1);+ }+ };++ const handleNext = () => {+ if (canGoNext) {+ onVersionChange(currentVersion + 1);+ }+ };++ if (totalVersions <= 1) {+ return null;+ }++ return (+ <div className={twMerge("flex items-center gap-1.5", className)}>+ <button+ onClick={handlePrevious}+ disabled={!canGoPrevious}+ className={twMerge(+ "p-1 rounded transition-colors",+ canGoPrevious ? "text-label-muted hover:text-label-title" : "text-label-muted/50 cursor-not-allowed",+ )}+ >+ <ChevronLeft className="w-4 h-4" />+ </button>++ <span className="text-sm text-label-muted">+ {currentVersion + 1}/{totalVersions}+ </span>+ {currentModelName && (+ <span className="text-[13px] leading-[130%] text-label-muted truncate max-w-[220px]">{currentModelName}</span>+ )}++ <button+ onClick={handleNext}+ disabled={!canGoNext}+ className={twMerge(+ "p-1 rounded transition-colors",+ canGoNext ? "text-label-muted hover:text-label-title" : "text-label-muted/50 cursor-not-allowed",+ )}+ >+ <ChevronRight className="w-4 h-4" />+ </button>+ </div>+ );+};diff --git a/apps/mirai-gui/client/src/features/chat/components/message/message.tsx b/apps/mirai-gui/client/src/features/chat/components/message/message.tsxnew file mode 100644index 000000000..c90f78da2--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/components/message/message.tsx@@ -0,0 +1,306 @@+import { useChatSessionStore } from "@/stores/use-chat-session-store";+import { isOtherChatGenerating } from "@/features/runtime/runtime-busy";+import { writeItemsWithFocus } from "@/utils/clipboard";+import { Transition } from "@headlessui/react";+import { ChevronDownIcon } from "lucide-react";+import React, { useEffect, useRef, useState } from "react";+import { twMerge } from "tailwind-merge";+import type { MessageVersion } from "@/types/message";+import { useChatStore } from "@/stores/use-chat-store";+import { attachmentStorage } from "../../services/attachment-storage";+import { ModelMenuIcon } from "@/components/icons/model-menu-icon";+import { ThinkingBubbleIcon } from "@/components/icons/thinking-bubble";+import { AttachedFilesDisplay } from "../composer/attached-files-display";+import { CopyButton } from "@/components/ui/copy-button";+import { MarkdownRenderer } from "./markdown-renderer";+import { MessageVersionControls } from "./message-version-controls";+import { ModelSelector } from "./model-selector";+import { PerformanceDropdown } from "./performance-dropdown";++export type MessageType = {+ text: string;+ id: string;+ sender: "assistant" | "user";+ modelId?: string;+ modelName?: string;+ versions?: MessageVersion[];+ currentVersionIndex?: number;+ attachmentIds?: string[];+ error?: string;+};++type MessageProps = MessageType & {+ isLoading?: boolean;+ chatId: string;+ isLast?: boolean;+ isUiStreaming?: boolean;+ isCanceled?: boolean;+ onModelSelect?: (messageId: string, modelId: string, modelName: string) => void;+};++const UserMessage: React.FC<Pick<MessageProps, "text" | "attachmentIds">> = ({ text, attachmentIds }) => (+ <>+ {attachmentIds && attachmentIds.length > 0 && (+ <div className="mb-3 ml-auto w-fit">+ <AttachedFilesDisplay files={attachmentStorage.getFiles(attachmentIds)} />+ </div>+ )}+ <div className="font-[350] text-label-title relative w-fit max-w-full rounded-[5px] text-[15px] leading-[140%] px-2.5 py-[6px] bg-bg-hover ml-auto [&>div>*:first-child]:mt-0 [&>div>*:last-child]:mb-0">+ <MarkdownRenderer content={text} />+ </div>+ </>+);++const AssistantMessage: React.FC<MessageProps> = ({+ text,+ id,+ versions,+ currentVersionIndex = 0,+ onModelSelect,+ chatId,+ isLoading,+ isLast,+ isUiStreaming,+ isCanceled = false,+}) => {+ const getEffectiveModelForMessage = useChatStore((s) => s.getEffectiveModelForMessage);+ const switchMessageVersion = useChatStore((s) => s.switchMessageVersion);+ const messageFromStore = useChatStore((s) => s.messages.find((m) => m.id === id));++ const { modelId: effectiveModelId, modelName: effectiveModelName } = getEffectiveModelForMessage(id, chatId);++ const storeVersionIndex = messageFromStore?.currentVersionIndex ?? 0;+ const currentMsgVersion = messageFromStore?.versions?.[storeVersionIndex];++ const hasActiveVersions = Array.isArray(messageFromStore?.versions) && (messageFromStore?.versions?.length || 0) > 0;+ const parsed = hasActiveVersions ? currentMsgVersion?.output?.text?.parsed : messageFromStore?.output?.text?.parsed;++ const visibleChainOfThought = parsed?.chainOfThought;+ const visibleMessageText = hasActiveVersions ? (currentMsgVersion?.text ?? text) : text;+ const visibleResponseText = parsed?.response ?? visibleMessageText ?? "";+ const hasError = hasActiveVersions ? !!currentMsgVersion?.error : !!messageFromStore?.error;+ const errorText = hasActiveVersions ? currentMsgVersion?.error : messageFromStore?.error;++ const streamInProgress = !!(isLast && (isLoading || isUiStreaming));++ const [isReasoningVisible, setIsReasoningVisible] = useState(false);+ const autoOpenedByStreamRef = useRef(false);+ const userToggledRef = useRef(false);++ const messageRef = useRef<HTMLDivElement>(null);+ const reasoningScrollRef = useRef<HTMLDivElement>(null);++ const reasoningPinnedRef = useRef(true);++ const reasoningAutoScrollingRef = useRef(false);++ const onReasoningScroll = (e: React.UIEvent<HTMLDivElement>) => {+ if (reasoningAutoScrollingRef.current) return;+ const el = e.currentTarget;+ reasoningPinnedRef.current = el.scrollHeight - el.scrollTop - el.clientHeight < 24;+ };++ useEffect(() => {+ setIsReasoningVisible(false);+ autoOpenedByStreamRef.current = false;+ userToggledRef.current = false;+ reasoningPinnedRef.current = true;+ }, [currentMsgVersion?.id]);++ const stickReasoningToBottom = () => {+ const el = reasoningScrollRef.current;+ if (!el || !reasoningPinnedRef.current) return;+ reasoningAutoScrollingRef.current = true;+ el.scrollTop = el.scrollHeight;++ requestAnimationFrame(() => {+ requestAnimationFrame(() => {+ reasoningAutoScrollingRef.current = false;+ });+ });+ };++ useEffect(() => {+ if (isReasoningVisible) stickReasoningToBottom();+ }, [visibleChainOfThought, isReasoningVisible]);++ useEffect(() => {+ const el = reasoningScrollRef.current;+ if (!isReasoningVisible || !el || typeof ResizeObserver === "undefined") return;+ const observer = new ResizeObserver(() => stickReasoningToBottom());+ if (el.firstElementChild) observer.observe(el.firstElementChild);+ return () => observer.disconnect();+ }, [isReasoningVisible]);++ useEffect(() => {+ const shouldAutoOpen =+ !!visibleChainOfThought &&+ !visibleResponseText &&+ !!isUiStreaming &&+ !isReasoningVisible &&+ !userToggledRef.current;+ if (shouldAutoOpen) {+ setIsReasoningVisible(true);+ autoOpenedByStreamRef.current = true;+ }+ }, [visibleChainOfThought, visibleResponseText, isUiStreaming, isReasoningVisible]);++ const handleMessageCopy = async () => {+ if (!messageRef.current) {+ throw new Error("Message element not found");+ }++ const messageClone = messageRef.current.cloneNode(true) as HTMLDivElement;++ const buttons = messageClone.querySelectorAll('button, .copy-button, [class*="copy"]');+ buttons.forEach((button) => button.remove());++ await writeItemsWithFocus([+ new ClipboardItem({+ "text/html": new Blob([messageClone.innerHTML], { type: "text/html" }),+ "text/plain": new Blob([messageClone.textContent || ""], {+ type: "text/plain",+ }),+ }),+ ]);+ };++ const handleModelSelect = (selectedModelId: string, selectedModelName: string) => {+ onModelSelect?.(id, selectedModelId, selectedModelName);+ };++ const handleVersionChange = (versionIndex: number) => {+ switchMessageVersion(id, versionIndex);+ };++ const anyStreamInProgress = !!(isLoading || isUiStreaming);+ const isStreamFinished = !(isLast && isUiStreaming);+ const modelMenuContent = (+ <>+ <ModelMenuIcon />+ <span className="text-[13px]">Model</span>+ </>+ );++ const totalVersions = versions ? versions.length : 1;+ const hasVersions = totalVersions > 1;+ const effectivePerf = hasVersions ? versions?.[currentVersionIndex || 0]?.perf : messageFromStore?.perf;++ const shouldShowPerf = !!(+ effectivePerf &&+ ((effectivePerf.ttftSec ?? 0) > 0 ||+ (effectivePerf.totalSec ?? 0) > 0 ||+ (effectivePerf.tps ?? 0) > 0 ||+ (effectivePerf.tokensOut ?? 0) > 0)+ );++ const isEjecting = useChatSessionStore((s) => s.isEjecting);+ const blockedByOtherChat = useChatSessionStore((s) => isOtherChatGenerating(s, chatId));++ const currentVersionModelName = hasVersions+ ? versions?.[currentVersionIndex || 0]?.modelName+ : messageFromStore?.modelName;++ return (+ <div className="pb-3 text-label-title relative w-full rounded-[5px] text-[15px] leading-[140%]">+ {visibleChainOfThought && (+ <button+ onClick={() => {+ userToggledRef.current = true;+ setIsReasoningVisible((v) => !v);+ }}+ className={twMerge(+ "group mb-1 px-4 pt-4 border border-cell-border w-full rounded-[8px] transition-colors duration-150",+ "hover:[background-color:rgba(0,0,0,0.01)] dark:hover:[background-color:rgba(255,255,255,0.01)]",+ )}+ >+ <div className="flex pb-4 items-center justify-between p-0 group hover:bg-transparent text-label-title">+ <span className="flex items-center gap-2">+ <ThinkingBubbleIcon className="w-[14px] h-[14px]" />++ <span className="text-[13px] font-[400] leading-[130%]">thinking...</span>+ </span>+ <ChevronDownIcon+ className={twMerge(+ "w-[12px] h-[12px] text-label-muted transition-transform transition-colors duration-150",+ isReasoningVisible && "rotate-180",+ )}+ />+ </div>+ <Transition+ show={isReasoningVisible}+ appear+ enter="transition-all duration-200 ease-out"+ enterFrom="opacity-0 -translate-y-1"+ enterTo="opacity-100 translate-y-0"+ leave="transition-all duration-150 ease-in"+ leaveFrom="opacity-100 translate-y-0"+ leaveTo="opacity-0 -translate-y-1"+ >+ <div className="relative contain-layout">+ <div+ ref={reasoningScrollRef}+ onScroll={onReasoningScroll}+ className="pb-4 text-left max-h-[180px] overflow-y-auto thin-scrollbar"+ >+ <MarkdownRenderer+ content={visibleChainOfThought || ""}+ useOneFontSize={true}+ className="text-[12px] leading-[150%] font-mono text-label-muted [&_p]:mb-1 [&_p]:mt-1"+ />+ </div>+ <div className="group-hover:pointer-events-none opacity-100 group-hover:opacity-0 transition-opacity duration-150 absolute bottom-0 left-0 right-0 h-[96px] z-10 [background:linear-gradient(180deg,rgba(255,255,255,0)_0%,#FFFFFF_100%)] dark:[background:linear-gradient(180deg,rgba(10,10,10,0)_0%,#0A0A0A_100%)]" />+ </div>+ </Transition>+ </button>+ )}+ <div ref={messageRef}>+ {hasError && (+ <div className="p-3 rounded-md border border-error/30 bg-error/10">+ <span className="text-[13px] leading-[150%] text-error">{errorText}</span>+ </div>+ )}+ <MarkdownRenderer content={visibleResponseText} streaming={streamInProgress} />+ </div>+ {(hasVersions ||+ (!streamInProgress && (isStreamFinished || isCanceled || text.length === 0 || !!visibleChainOfThought))) && (+ <div className="flex justify-between items-center mt-6 pr-6">+ <div className="flex items-center gap-1">+ {hasVersions && (+ <MessageVersionControls+ currentVersion={currentVersionIndex}+ totalVersions={totalVersions}+ onVersionChange={handleVersionChange}+ disabledPrevious={anyStreamInProgress}+ currentModelName={currentVersionModelName || effectiveModelName || ""}+ />+ )}+ {(visibleResponseText.length !== 0 || hasError) && (+ <CopyButton className="!min-w-6 !min-h-6" onCopy={handleMessageCopy} />+ )}+ </div>+ <div className="flex items-center gap-4">+ <ModelSelector+ selectedModel={effectiveModelId || ""}+ onModelSelect={handleModelSelect}+ menuContent={modelMenuContent}+ disabled={(anyStreamInProgress && hasVersions) || isEjecting || blockedByOtherChat}+ />+ {shouldShowPerf && (+ <PerformanceDropdown perf={effectivePerf} disabled={anyStreamInProgress && hasVersions} />+ )}+ </div>+ </div>+ )}+ </div>+ );+};++const MessageComponent: React.FC<MessageProps> = (props) =>+ props.sender === "user" ? (+ <UserMessage text={props.text} attachmentIds={props.attachmentIds} />+ ) : (+ <AssistantMessage {...props} />+ );++export const Message = React.memo(MessageComponent);diff --git a/apps/mirai-gui/client/src/features/chat/components/message/model-selector.tsx b/apps/mirai-gui/client/src/features/chat/components/message/model-selector.tsxnew file mode 100644index 000000000..cb2ab4e00--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/components/message/model-selector.tsx@@ -0,0 +1,118 @@+import { Listbox, ListboxButton, ListboxOption, ListboxOptions, Transition } from "@headlessui/react";+import { ChevronRight } from "lucide-react";+import { useNavigate } from "@tanstack/react-router";+import React from "react";+import { twMerge } from "tailwind-merge";+import { useModelsStore } from "@/stores/use-models-store";+import { modelDownloadPhases } from "@/types/model-manager";+import { ModelVendorIcon } from "@/components/model-vendor-icon";++type ModelSelectorProps = {+ selectedModel?: string;+ onModelSelect?: (modelId: string, modelName: string) => void;+ menuContent: React.ReactNode;+ disabled?: boolean;+};++export const ModelSelector: React.FC<ModelSelectorProps> = ({+ selectedModel,+ onModelSelect,+ menuContent,+ disabled = false,+}) => {+ const navigate = useNavigate();++ const models = useModelsStore((s) => s.models);+ const getModelState = useModelsStore((s) => s.getModelState);+ const loadingModels = useModelsStore((s) => s.loading);++ const installedModelsList = models.filter((m) => getModelState(m.repoId)?.phase === modelDownloadPhases.downloaded);++ const handleModelSelect = (modelId: string) => {+ const selectedModel = installedModelsList.find((model) => model.repoId === modelId);+ if (selectedModel) {+ onModelSelect?.(selectedModel.repoId, selectedModel.name);+ }+ };++ const handleMoreModelsClick = () => {+ navigate({ to: "/local-models" });+ };++ const variantClasses = disabled+ ? "text-label-muted rounded-md py-1"+ : "text-label-muted group-hover:text-label-title group-hover:bg-bg-hover rounded-md py-1";++ return (+ <div className="group w-fit">+ <Listbox value={selectedModel || ""} onChange={handleModelSelect} disabled={disabled}>+ <div>+ <ListboxButton+ className={twMerge(+ "flex items-center px-[6px] transition-colors focus:outline-hidden focus:ring-0",+ "gap-2",+ variantClasses,+ disabled ? "opacity-60 cursor-not-allowed" : undefined,+ )}+ >+ {menuContent}+ </ListboxButton>++ <Transition+ enter="transition duration-100 ease-out"+ enterFrom="transform scale-95 opacity-0"+ enterTo="transform scale-100 opacity-100"+ leave="transition duration-75 ease-out"+ leaveFrom="transform scale-100 opacity-100"+ leaveTo="transform scale-95 opacity-0"+ >+ <ListboxOptions+ anchor="bottom end"+ className="thin-scrollbar [--anchor-gap:8px] [--anchor-max-height:360px] bg-bg-modal border border-cell-border rounded-[6px] z-50 pointer-events-auto focus:outline-hidden focus:ring-0"+ >+ <div className="p-[6px] flex flex-col gap-2">+ {loadingModels ? (+ <div className="px-[14px] py-2 leading-[130%] text-sm text-label-muted">Loading models...</div>+ ) : installedModelsList.length > 0 ? (+ installedModelsList.map((model) => {+ const isSelected = model.repoId === selectedModel;+ return (+ <ListboxOption+ key={model.repoId}+ value={model.repoId}+ className={twMerge(+ "w-full flex items-center gap-2 px-[14px] py-2 rounded-md text-left transition-colors cursor-pointer hover:bg-bg-hover focus:outline-hidden focus:ring-0",+ isSelected ? "bg-bg-sub" : "",+ )}+ >+ <ModelVendorIcon vendor={model.vendor} />+ <span className="text-sm leading-[130%] text-label-title flex items-center gap-2">+ {model.name}+ </span>+ <span className="text-label-muted text-[10px]">Local</span>+ </ListboxOption>+ );+ })+ ) : (+ <div className="px-[14px] py-2 leading-[130%] text-sm text-label-muted">No models available</div>+ )}+ </div>++ <div className="h-[1px] bg-cell-border" />++ <div className="p-[10px]">+ <button+ onClick={handleMoreModelsClick}+ className="w-full flex items-center justify-between px-[14px] py-2 rounded-md hover:bg-bg-hover transition-colors text-label-title focus:outline-hidden focus:ring-0"+ >+ <span className="text-sm text-label-title">More local models</span>+ <ChevronRight className="h-4 w-4 text-label-muted" />+ </button>+ </div>+ </ListboxOptions>+ </Transition>+ </div>+ </Listbox>+ </div>+ );+};diff --git a/apps/mirai-gui/client/src/features/chat/components/message/performance-dropdown.tsx b/apps/mirai-gui/client/src/features/chat/components/message/performance-dropdown.tsxnew file mode 100644index 000000000..22979c806--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/components/message/performance-dropdown.tsx@@ -0,0 +1,61 @@+import { Popover, PopoverButton, PopoverPanel, Transition } from "@headlessui/react";+import { twMerge } from "tailwind-merge";+import { PerformanceIcon } from "@/components/icons/performance-icon";+import type { PerfStats } from "@/types/message";++type PerformanceDropdownProps = {+ perf?: PerfStats;+ disabled?: boolean;+};++const formatSeconds = (seconds?: number): string =>+ typeof seconds === "number" && Number.isFinite(seconds) ? `${seconds.toFixed(3)}s` : "—";++const formatTps = (tps?: number): string =>+ typeof tps === "number" && Number.isFinite(tps) ? `${Math.round(tps)}` : "—";++const BUTTON_BASE =+ "flex items-center px-[6px] transition-colors focus:outline-hidden focus:ring-0 gap-2 text-label-muted rounded-md py-1";+const BUTTON_ENABLED = "group-hover:text-label-title group-hover:bg-bg-hover";+const BUTTON_DISABLED = "opacity-60 cursor-not-allowed";++function PerfStat({ value, label }: { value: string; label: string }) {+ return (+ <div className="flex flex-col items-center">+ <div className="text-[15px] leading-[120%] text-label-title">{value}</div>+ <div className="text-[11px] leading-[120%] text-label-muted mt-1">{label}</div>+ </div>+ );+}++export function PerformanceDropdown({ perf, disabled = false }: PerformanceDropdownProps) {+ return (+ <Popover className="group w-fit">+ <PopoverButton disabled={disabled} className={twMerge(BUTTON_BASE, disabled ? BUTTON_DISABLED : BUTTON_ENABLED)}>+ <PerformanceIcon />+ <span className="text-[13px]">Performance</span>+ </PopoverButton>+ <Transition+ enter="transition duration-100 ease-out"+ enterFrom="transform scale-95 opacity-0"+ enterTo="transform scale-100 opacity-100"+ leave="transition duration-75 ease-out"+ leaveFrom="transform scale-100 opacity-100"+ leaveTo="transform scale-95 opacity-0"+ >+ <PopoverPanel+ anchor="bottom end"+ className="[--anchor-gap:8px] bg-bg-modal border border-cell-border rounded-[6px] z-50 pointer-events-auto focus:outline-hidden focus:ring-0"+ >+ <div className="p-[10px]">+ <div className="grid grid-cols-3 gap-3 text-center">+ <PerfStat value={formatSeconds(perf?.ttftSec)} label="Time to first token" />+ <PerfStat value={formatTps(perf?.tps)} label="Tokens per second" />+ <PerfStat value={formatSeconds(perf?.totalSec)} label="Total time" />+ </div>+ </div>+ </PopoverPanel>+ </Transition>+ </Popover>+ );+}diff --git a/apps/mirai-gui/client/src/features/chat/hooks/reopen-mid-stream.test.tsx b/apps/mirai-gui/client/src/features/chat/hooks/reopen-mid-stream.test.tsxnew file mode 100644index 000000000..4879207c5--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/hooks/reopen-mid-stream.test.tsx@@ -0,0 +1,103 @@+import { act, renderHook, waitFor } from "@testing-library/react";+import { afterEach, beforeEach, expect, it, vi } from "vitest";+import type { ChatData } from "@/platform/services/storage";+import { runLlmStream, type RunEvent, type RunTransport } from "@/platform/services/chat/run-stream";+import { useChatSessionStore } from "@/stores/use-chat-session-store";+import { useChatStore } from "@/stores/use-chat-store";+import { Roles } from "@/types/chat";+import { useActiveAssistantBuffer } from "./use-active-assistant-buffer";+import { useChatSwitchEffect } from "./use-chat-switch-effect";+import { useLlmStream, type StartStreamOptions } from "./use-llm-stream";++const mocks = vi.hoisted(() => ({ chats: new Map<string, ChatData>() }));+vi.mock("@/platform/platform-singleton", () => ({+ getPlatform: () => ({+ storage: {+ loadChat: async (id: string) => mocks.chats.get(id) ?? null,+ listChats: async () => [...mocks.chats.values()].map((c) => c.metadata),+ },+ }),+}));++const CHAT_A = "a";+const CHAT_B = "b";+const MESSAGE_ID = "assistant-1";+const sessionDefaults = useChatSessionStore.getState();+const chatDefaults = useChatStore.getState();++const chatData = (id: string, messages: ChatData["messages"]): ChatData => ({+ metadata: { id, title: "Untitled", messageCount: messages.length, createdAt: 1, updatedAt: 1 },+ messages,+});++const usePageWiring = (chatId: string) => {+ const stream = useLlmStream(chatId);+ const replay = useActiveAssistantBuffer(chatId);+ useChatSwitchEffect({ chatId, isNewChat: false, replayActiveBuffer: replay, resetLocalUi: () => {} });+ return stream;+};++beforeEach(() => {+ // A fixed 100 ms per frame keeps the reveal pacing off the wall clock.+ let frameNow = 0;+ vi.stubGlobal("requestAnimationFrame", (cb: FrameRequestCallback) =>+ window.setTimeout(() => cb((frameNow += 100)), 0),+ );+ vi.stubGlobal("cancelAnimationFrame", (id: number) => window.clearTimeout(id));+ useChatSessionStore.setState(sessionDefaults, true);+ useChatStore.setState(chatDefaults, true);+ mocks.chats.clear();+ mocks.chats.set(+ CHAT_A,+ chatData(CHAT_A, [+ { id: "user-1", text: "hi", sender: Roles.User, timestamp: 1 },+ { id: MESSAGE_ID, text: "", sender: Roles.Assistant, timestamp: 2 },+ ]),+ );+ mocks.chats.set(CHAT_B, chatData(CHAT_B, [{ id: "user-b", text: "other", sender: Roles.User, timestamp: 3 }]));+});++afterEach(() => {+ vi.unstubAllGlobals();+});++it("keeps streaming into the message after leaving and reopening the chat", async () => {+ let emit: (event: RunEvent) => void = () => {};+ const transport: RunTransport = {+ start: (_runId, _params, onEvent) => {+ emit = onEvent;+ return new Promise(() => {});+ },+ cancel: vi.fn(() => Promise.resolve()),+ };+ useChatStore.setState({ runChatStream: (params) => runLlmStream(transport, params) });++ const page = renderHook(({ chatId }) => usePageWiring(chatId), { initialProps: { chatId: CHAT_A } });+ await waitFor(() => expect(useChatStore.getState().messages.map((m) => m.id)).toEqual(["user-1", MESSAGE_ID]));++ const options: StartStreamOptions = {+ repoId: "vendor/model",+ chatId: CHAT_A,+ messageId: MESSAGE_ID,+ messages: [{ role: "user", content: "hi" }],+ updateText: (id, text) => useChatStore.getState().updateMessage(id, { text }),+ onError: vi.fn(),+ };+ act(() => {+ void useChatSessionStore.getState().withOperation("running", () => page.result.current.startStream(options));+ });+ await waitFor(() => expect(page.result.current.isStreaming).toBe(true));+ act(() => emit({ type: "chunk", delta: "Hello" }));+ await waitFor(() => expect(useChatStore.getState().messages.at(-1)?.text).toBe("Hello"));++ page.rerender({ chatId: CHAT_B });+ await waitFor(() => expect(useChatStore.getState().currentChatId).toBe(CHAT_B));+ act(() => emit({ type: "chunk", delta: " world" }));++ page.rerender({ chatId: CHAT_A });+ await waitFor(() => expect(useChatStore.getState().messages.map((m) => m.id)).toEqual(["user-1", MESSAGE_ID]));+ await waitFor(() => expect(useChatStore.getState().messages.at(-1)?.text).toBe("Hello world"));++ act(() => emit({ type: "chunk", delta: "!" }));+ await waitFor(() => expect(useChatStore.getState().messages.at(-1)?.text).toBe("Hello world!"));+});diff --git a/apps/mirai-gui/client/src/features/chat/hooks/use-active-assistant-buffer.ts b/apps/mirai-gui/client/src/features/chat/hooks/use-active-assistant-buffer.tsnew file mode 100644index 000000000..b35c16ca9--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/hooks/use-active-assistant-buffer.ts@@ -0,0 +1,32 @@+import { useCallback, useEffect } from "react";+import { useChatSessionStore } from "@/stores/use-chat-session-store";+import { useChatStore } from "@/stores/use-chat-store";+import { isChatGenerating } from "@/features/runtime/runtime-busy";+import { patchActiveVersion } from "../services/regenerate-versions";++// Replays the buffered streaming text into the in-memory message so a mid-stream+// chat switch or page remount keeps showing the partial output until finalize arrives.+export const useActiveAssistantBuffer = (chatId: string): (() => void) => {+ const generatingHere = useChatSessionStore((s) => isChatGenerating(s, chatId));+ const activeAssistantMessageId = useChatSessionStore((s) => s.activeAssistantMessageId);+ const activeAssistantMessageText = useChatSessionStore((s) => s.activeAssistantMessageText);++ const apply = useCallback(() => {+ if (!chatId || !generatingHere || !activeAssistantMessageId || typeof activeAssistantMessageText !== "string")+ return;+ const s = useChatStore.getState();+ const msg = s.messages.find((m) => m.id === activeAssistantMessageId);+ if (!msg) return;+ const hasVersions = Array.isArray(msg.versions) && msg.versions.length > 0;+ s.updateMessage(activeAssistantMessageId, {+ text: activeAssistantMessageText,+ ...(hasVersions ? { versions: patchActiveVersion(msg.versions, { text: activeAssistantMessageText }) } : {}),+ });+ }, [chatId, generatingHere, activeAssistantMessageId, activeAssistantMessageText]);++ useEffect(() => {+ apply();+ }, [apply]);++ return apply;+};diff --git a/apps/mirai-gui/client/src/features/chat/hooks/use-chat-composer-state.test.ts b/apps/mirai-gui/client/src/features/chat/hooks/use-chat-composer-state.test.tsnew file mode 100644index 000000000..a905f76fa--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/hooks/use-chat-composer-state.test.ts@@ -0,0 +1,22 @@+import { act, renderHook } from "@testing-library/react";+import { expect, it } from "vitest";+import { useChatComposerState } from "./use-chat-composer-state";++it("clears the draft that was sent", () => {+ const hook = renderHook(() => useChatComposerState());+ act(() => hook.result.current.setDraft("hello "));++ act(() => hook.result.current.clear("hello"));++ expect(hook.result.current.draft).toBe("");+});++it("keeps a draft typed while the send was in flight", () => {+ const hook = renderHook(() => useChatComposerState());+ act(() => hook.result.current.setDraft("first"));+ act(() => hook.result.current.setDraft("second"));++ act(() => hook.result.current.clear("first"));++ expect(hook.result.current.draft).toBe("second");+});diff --git a/apps/mirai-gui/client/src/features/chat/hooks/use-chat-composer-state.ts b/apps/mirai-gui/client/src/features/chat/hooks/use-chat-composer-state.tsnew file mode 100644index 000000000..906dff844--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/hooks/use-chat-composer-state.ts@@ -0,0 +1,32 @@+import { useCallback, useState } from "react";+import type { AttachedFile } from "@/types/files";++export type ChatComposerState = {+ draft: string;+ setDraft: (draft: string) => void;+ attachedFiles: AttachedFile[];+ attachFile: (file: AttachedFile) => void;+ removeFile: (fileId: string) => void;+ /** A draft typed while the send was in flight survives. */+ clear: (sentText: string) => void;+};++export const useChatComposerState = (): ChatComposerState => {+ const [draft, setDraft] = useState("");+ const [attachedFiles, setAttachedFiles] = useState<AttachedFile[]>([]);++ const attachFile = useCallback((file: AttachedFile) => {+ setAttachedFiles((prev) => [...prev, file]);+ }, []);++ const removeFile = useCallback((fileId: string) => {+ setAttachedFiles((prev) => prev.filter((f) => f.id !== fileId));+ }, []);++ const clear = useCallback((sentText: string) => {+ setAttachedFiles([]);+ setDraft((prev) => (prev.trim() === sentText ? "" : prev));+ }, []);++ return { draft, setDraft, attachedFiles, attachFile, removeFile, clear };+};diff --git a/apps/mirai-gui/client/src/features/chat/hooks/use-chat-model-selector.ts b/apps/mirai-gui/client/src/features/chat/hooks/use-chat-model-selector.tsnew file mode 100644index 000000000..de8d719e6--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/hooks/use-chat-model-selector.ts@@ -0,0 +1,106 @@+import { useEffect, useMemo } from "react";++import { useRuntimeSessionStore } from "@/stores/use-runtime-session-store";+import { useChatStore } from "@/stores/use-chat-store";+import { useModelsStore } from "@/stores/use-models-store";+import { modelDownloadPhases } from "@/types/model-manager";++type UseChatModelSelectorProps = {+ chatId: string;+ searchModel?: string;+ searchModelName?: string;+};++type UseChatModelSelectorResult = {+ selectedChatModel: {+ modelId: string;+ modelName: string;+ };+ hasAvailableModels: boolean;+ currentModelId: string | undefined;+ autoSelectSuppressed: boolean;+};++export function useChatModelSelector(props: UseChatModelSelectorProps): UseChatModelSelectorResult {+ const { chatId, searchModel, searchModelName } = props;++ const models = useModelsStore((s) => s.models);+ const modelPhasesById = useModelsStore((s) => s.modelPhasesById);+ const localsLoaded = useModelsStore((s) => s.hasLoadedModels);++ const setChatModel = useChatStore((s) => s.setChatModel);+ const selectedChatModel = useChatStore(+ (s) =>+ s.chatModels[chatId] || {+ modelId: "",+ modelName: "",+ },+ );+ const autoSelectSuppressed = useChatStore((s) => s.autoSelectSuppressed?.[chatId] === true);+ const lastUsedModel = useChatStore((s) => s.lastUsedModel);++ const residentSession = useRuntimeSessionStore((s) => s.residentSession);++ const allAvailableModels = useMemo(+ () => models.filter((model) => modelPhasesById[model.repoId] === modelDownloadPhases.downloaded),+ [models, modelPhasesById],+ );++ useEffect(() => {+ if (!localsLoaded) return;+ const selectedId = selectedChatModel.modelId;+ if (!selectedId) return;+ if (searchModel && selectedId === searchModel) return;++ const exists = allAvailableModels.some((model) => model.repoId === selectedId);+ if (exists) return;++ setChatModel(chatId, "", "");+ }, [selectedChatModel.modelId, searchModel, allAvailableModels, chatId, setChatModel, localsLoaded]);++ useEffect(() => {+ if (autoSelectSuppressed) return;++ if (searchModel && searchModelName && !selectedChatModel.modelId) {+ setChatModel(chatId, searchModel, searchModelName);+ return;+ }++ if (selectedChatModel.modelId) return;++ if (residentSession?.repoId) {+ const residentName =+ allAvailableModels.find((model) => model.repoId === residentSession.repoId)?.name || residentSession.repoId;+ setChatModel(chatId, residentSession.repoId, residentName);+ return;+ }++ if (lastUsedModel?.modelId) {+ const isAvailable = allAvailableModels.some((model) => model.repoId === lastUsedModel.modelId);+ if (!localsLoaded || isAvailable) {+ setChatModel(chatId, lastUsedModel.modelId, lastUsedModel.modelName);+ }+ }+ }, [+ autoSelectSuppressed,+ searchModel,+ searchModelName,+ selectedChatModel.modelId,+ chatId,+ residentSession?.repoId,+ allAvailableModels,+ setChatModel,+ lastUsedModel?.modelId,+ lastUsedModel?.modelName,+ localsLoaded,+ ]);++ const currentModelId = selectedChatModel.modelId || searchModel;++ return {+ selectedChatModel,+ hasAvailableModels: allAvailableModels.length > 0,+ currentModelId,+ autoSelectSuppressed,+ };+}diff --git a/apps/mirai-gui/client/src/features/chat/hooks/use-chat-run-status.ts b/apps/mirai-gui/client/src/features/chat/hooks/use-chat-run-status.tsnew file mode 100644index 000000000..ffac543b5--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/hooks/use-chat-run-status.ts@@ -0,0 +1,26 @@+import { useChatSessionStore } from "@/stores/use-chat-session-store";+import { useChatStore } from "@/stores/use-chat-store";+import { isOtherChatGenerating } from "@/features/runtime/runtime-busy";+import { ChatRunBlockReason } from "../types";++type UseChatRunStatusParams = {+ chatId: string;+ modelId: string | null | undefined;+};++type UseChatRunStatusResult = {+ blockReason: ChatRunBlockReason | null;+ canRun: boolean;+};++export const useChatRunStatus = ({ chatId, modelId }: UseChatRunStatusParams): UseChatRunStatusResult => {+ const autoSelectSuppressed = useChatStore((s) => !!s.autoSelectSuppressed?.[chatId]);+ const otherChatGenerating = useChatSessionStore((s) => isOtherChatGenerating(s, chatId));++ let blockReason: ChatRunBlockReason | null = null;+ if (!modelId) blockReason = ChatRunBlockReason.NoModel;+ else if (autoSelectSuppressed) blockReason = ChatRunBlockReason.AutoSelectSuppressed;+ else if (otherChatGenerating) blockReason = ChatRunBlockReason.OtherChatGenerating;++ return { blockReason, canRun: blockReason === null };+};diff --git a/apps/mirai-gui/client/src/features/chat/hooks/use-chat-switch-effect.ts b/apps/mirai-gui/client/src/features/chat/hooks/use-chat-switch-effect.tsnew file mode 100644index 000000000..dce0dfbc1--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/hooks/use-chat-switch-effect.ts@@ -0,0 +1,47 @@+import { useEffect, useRef } from "react";+import { useChatStore } from "@/stores/use-chat-store";++type UseChatSwitchEffectParams = {+ chatId: string;+ isNewChat: boolean;+ replayActiveBuffer: () => void;+ resetLocalUi: () => void;+};++// `replayActiveBuffer` / `resetLocalUi` are read through refs: including them+// in deps would re-trigger clearChat+loadChat on every stream chunk (they+// rebuild with streaming state).+export const useChatSwitchEffect = ({+ chatId,+ isNewChat,+ replayActiveBuffer,+ resetLocalUi,+}: UseChatSwitchEffectParams): void => {+ const setCurrentChatId = useChatStore((s) => s.setCurrentChatId);+ const loadChat = useChatStore((s) => s.loadChat);++ const replayRef = useRef(replayActiveBuffer);+ const resetRef = useRef(resetLocalUi);+ replayRef.current = replayActiveBuffer;+ resetRef.current = resetLocalUi;++ useEffect(() => {+ if (!chatId) return;+ resetRef.current();+ setCurrentChatId(chatId);+ useChatStore.getState().clearChat();+ if (isNewChat) {+ replayRef.current();+ return;+ }+ let stale = false;+ loadChat(chatId)+ .then(() => {+ if (!stale) replayRef.current();+ })+ .catch((e: unknown) => console.error("[chat] failed to load chat", { chatId }, e));+ return () => {+ stale = true;+ };+ }, [chatId, isNewChat, loadChat, setCurrentChatId]);+};diff --git a/apps/mirai-gui/client/src/features/chat/hooks/use-eject-driven-model-reset.ts b/apps/mirai-gui/client/src/features/chat/hooks/use-eject-driven-model-reset.tsnew file mode 100644index 000000000..705975f07--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/hooks/use-eject-driven-model-reset.ts@@ -0,0 +1,60 @@+import { useEffect } from "react";+import { useChatSessionStore } from "@/stores/use-chat-session-store";+import { useChatStore } from "@/stores/use-chat-store";+import { runtimeSessionEjectReasons } from "@/types/session";++type UseEjectDrivenModelResetParams = {+ chatId: string;+ selectedModelId: string | null;+ pendingSwitch: boolean;+};++// After a user-initiated eject the chat shows "Select model" instead of+// snapping to another resident model; waits for idle so it does not fire+// mid-eject or mid-load.+export const useEjectDrivenModelReset = ({+ chatId,+ selectedModelId,+ pendingSwitch,+}: UseEjectDrivenModelResetParams): void => {+ const lastEjected = useChatSessionStore((s) => s.lastEjected);+ const lastEjectedReason = useChatSessionStore((s) => s.lastEjectedReason);+ const setLastEjected = useChatSessionStore((s) => s.setLastEjected);+ const operationState = useChatSessionStore((s) => s.operationState);+ const isGenerating = useChatSessionStore((s) => s.isGenerating);+ const isModelLoading = useChatSessionStore((s) => s.isModelLoading);+ const isEjecting = useChatSessionStore((s) => s.isEjecting);+ const isTitleGenerating = useChatSessionStore((s) => s.isTitleGenerating);+ const suppressAutoSelect = useChatStore((s) => s.suppressAutoSelect);+ const setChatModel = useChatStore((s) => s.setChatModel);++ useEffect(() => {+ if (!lastEjected) return;+ if (pendingSwitch) return;+ const idle = operationState === "idle" && !isGenerating && !isModelLoading && !isEjecting && !isTitleGenerating;+ if (!idle) return;+ if (lastEjectedReason !== runtimeSessionEjectReasons.user) return;++ const matchesEjected = selectedModelId && selectedModelId === lastEjected.repoId;++ if (matchesEjected) {+ suppressAutoSelect(chatId, true);+ setChatModel(chatId, "", "");+ setLastEjected(null);+ }+ }, [+ lastEjected,+ lastEjectedReason,+ setLastEjected,+ selectedModelId,+ suppressAutoSelect,+ setChatModel,+ chatId,+ operationState,+ isGenerating,+ isModelLoading,+ isEjecting,+ isTitleGenerating,+ pendingSwitch,+ ]);+};diff --git a/apps/mirai-gui/client/src/features/chat/hooks/use-llm-stream.test.tsx b/apps/mirai-gui/client/src/features/chat/hooks/use-llm-stream.test.tsxnew file mode 100644index 000000000..be49d3e0d--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/hooks/use-llm-stream.test.tsx@@ -0,0 +1,243 @@+import { act, renderHook, waitFor } from "@testing-library/react";+import { beforeEach, describe, expect, it, vi } from "vitest";+import { runLlmStream, type RunEvent, type RunTransport } from "@/platform/services/chat/run-stream";+import { useChatSessionStore } from "@/stores/use-chat-session-store";+import { useChatStore } from "@/stores/use-chat-store";+import { Roles } from "@/types/chat";+import type { SessionOutputStats } from "@/types/llm-stream";+import { STALL_TIMEOUT_MS, useLlmStream, type StartStreamOptions } from "./use-llm-stream";++const mocks = vi.hoisted(() => ({ cancelRun: vi.fn(async () => {}), updateStoredMessage: vi.fn(async () => {}) }));+vi.mock("@/platform/platform-singleton", () => ({+ getPlatform: () => ({+ chat: { cancelRun: mocks.cancelRun },+ storage: { updateStoredMessage: mocks.updateStoredMessage },+ }),+}));++const CHAT_ID = "chat-1";+const MESSAGE_ID = "assistant-1";++const stats: SessionOutputStats = {+ prefillStats: { duration: 0.25, tokensCount: 5, tokensPerSecond: 20 },+ generateStats: { duration: 2, tokensCount: 40, tokensPerSecond: 20 },+ totalStats: { duration: 2.25, tokensCountInput: 5, tokensCountOutput: 40 },+};++const sessionDefaults = useChatSessionStore.getState();+const chatDefaults = useChatStore.getState();++const setup = () => {+ let emit: (event: RunEvent) => void = () => {+ throw new Error("run was not started");+ };+ let startedRunId = "";+ const transport: RunTransport = {+ start: (runId, _params, onEvent) => {+ startedRunId = runId;+ emit = onEvent;+ return new Promise(() => {});+ },+ cancel: vi.fn(() => Promise.resolve()),+ };+ const finalizeAssistantMessage = vi.fn(() => Promise.resolve());+ useChatStore.setState({+ currentChatId: CHAT_ID,+ messages: [{ id: MESSAGE_ID, text: "", sender: Roles.Assistant, timestamp: 1 }],+ runChatStream: (params) => runLlmStream(transport, params),+ finalizeAssistantMessage,+ });++ const callbacks = {+ updateText: vi.fn((id: string, text: string) => useChatStore.getState().updateMessage(id, { text })),+ onError: vi.fn(),+ onDone: vi.fn(),+ onFinishReason: vi.fn(),+ };+ const options: StartStreamOptions = {+ repoId: "vendor/model",+ chatId: CHAT_ID,+ messageId: MESSAGE_ID,+ messages: [{ role: "user", content: "hi" }],+ ...callbacks,+ };+ const hook = renderHook(() => useLlmStream(CHAT_ID));+ const start = (o: StartStreamOptions) =>+ useChatSessionStore.getState().withOperation("running", () => hook.result.current.startStream(o));+ return {+ hook,+ start,+ options,+ callbacks,+ transport,+ finalizeAssistantMessage,+ emit: (event: RunEvent) => emit(event),+ runId: () => startedRunId,+ };+};++const messageText = () => useChatStore.getState().messages.find((m) => m.id === MESSAGE_ID)?.text;++describe("useLlmStream", () => {+ beforeEach(() => {+ useChatSessionStore.setState(sessionDefaults, true);+ useChatStore.setState(chatDefaults, true);+ });++ it("reveals streamed text, records perf and finalizes the message", async () => {+ const { hook, start, options, callbacks, finalizeAssistantMessage, emit } = setup();++ let run!: Promise<unknown>;+ act(() => {+ run = start(options);+ });+ await waitFor(() => expect(hook.result.current.isStreaming).toBe(true));+ expect(hook.result.current.isLoading).toBe(true);+ expect(useChatSessionStore.getState().isGenerating).toBe(true);++ act(() => emit({ type: "chunk", delta: "", parsed: { chainOfThought: "let me think" } }));+ await waitFor(() => expect(hook.result.current.isLoading).toBe(false));+ act(() => {+ emit({ type: "chunk", delta: "Hello" });+ emit({ type: "chunk", delta: " world" });+ emit({ type: "done", text: "Hello world", stats, finishReason: "Stop", parsed: { response: "Hello world" } });+ });+ await act(() => run);++ expect(messageText()).toBe("Hello world");+ const message = useChatStore.getState().messages.find((m) => m.id === MESSAGE_ID);+ expect(message?.output?.text?.parsed).toEqual({ chainOfThought: "let me think", response: "Hello world" });+ expect(message?.perf).toEqual({ ttftSec: 0.25, totalSec: 2.25, tps: 20, tokensOut: 40 });+ expect(finalizeAssistantMessage).toHaveBeenCalledWith(CHAT_ID, MESSAGE_ID, "Hello world", {+ response: "Hello world",+ });+ expect(callbacks.onFinishReason).toHaveBeenCalledWith("Stop");+ expect(callbacks.onDone).toHaveBeenCalledTimes(1);+ expect(callbacks.onError).not.toHaveBeenCalled();+ expect(hook.result.current.isStreaming).toBe(false);+ expect(useChatSessionStore.getState()).toMatchObject({+ isGenerating: false,+ activeGeneratingChatId: null,+ activeAssistantMessageText: null,+ operationState: "idle",+ });+ });++ it("reports a backend error and does not finalize", async () => {+ const { hook, start, options, callbacks, finalizeAssistantMessage, emit } = setup();++ let run!: Promise<unknown>;+ act(() => {+ run = start(options);+ });+ await waitFor(() => expect(hook.result.current.isStreaming).toBe(true));+ act(() => emit({ type: "error", error: "model exploded" }));+ await act(() => run);++ expect(callbacks.onError).toHaveBeenCalledWith(MESSAGE_ID, "Error: model exploded");+ expect(callbacks.onDone).toHaveBeenCalledTimes(1);+ expect(finalizeAssistantMessage).not.toHaveBeenCalled();+ expect(hook.result.current.isStreaming).toBe(false);+ expect(useChatSessionStore.getState().isGenerating).toBe(false);+ });++ it("stops a run without finalizing or reporting an error", async () => {+ const { hook, start, options, callbacks, transport, finalizeAssistantMessage, emit } = setup();++ let run!: Promise<unknown>;+ act(() => {+ run = start(options);+ });+ await waitFor(() => expect(hook.result.current.isStreaming).toBe(true));+ act(() => emit({ type: "chunk", delta: "partial" }));+ await act(() => hook.result.current.cancel());+ await act(() => run);++ expect(transport.cancel).toHaveBeenCalledTimes(1);+ expect(finalizeAssistantMessage).not.toHaveBeenCalled();+ expect(callbacks.onError).not.toHaveBeenCalled();+ expect(callbacks.onFinishReason).not.toHaveBeenCalled();+ expect(hook.result.current.isStreaming).toBe(false);+ expect(useChatSessionStore.getState()).toMatchObject({ isGenerating: false, operationState: "idle" });+ });++ it("stops a run started by an instance that has since unmounted", async () => {+ const { hook, start, options, transport, finalizeAssistantMessage, emit, runId } = setup();+ mocks.cancelRun.mockClear();++ let run!: Promise<unknown>;+ act(() => {+ run = start(options);+ });+ await waitFor(() => expect(hook.result.current.isStreaming).toBe(true));+ act(() => emit({ type: "chunk", delta: "partial" }));+ hook.unmount();++ const remounted = renderHook(() => useLlmStream(CHAT_ID));+ await act(() => remounted.result.current.cancel());+ expect(mocks.cancelRun).toHaveBeenCalledWith(runId());+ expect(transport.cancel).not.toHaveBeenCalled();++ act(() => emit({ type: "done", text: "partial", stats, finishReason: "Cancelled" }));+ await act(() => run);++ expect(finalizeAssistantMessage).not.toHaveBeenCalled();+ expect(mocks.updateStoredMessage).toHaveBeenCalledWith(+ CHAT_ID,+ MESSAGE_ID,+ expect.objectContaining({ text: "partial" }),+ );+ expect(useChatSessionStore.getState()).toMatchObject({ isGenerating: false, operationState: "idle" });+ });++ it("stops a run whose model is still loading", async () => {+ const { hook, start, options, transport } = setup();++ let run!: Promise<unknown>;+ act(() => {+ run = start(options);+ });+ await waitFor(() => expect(hook.result.current.isStreaming).toBe(true));+ act(() => useChatSessionStore.getState().startModelLoading());++ await act(() => hook.result.current.cancel());+ await act(() => run);++ expect(transport.cancel).toHaveBeenCalledTimes(1);+ expect(hook.result.current.isStreaming).toBe(false);+ });++ it("reports a stalled stream once", async () => {+ vi.useFakeTimers();+ try {+ const { start, options, callbacks, emit } = setup();++ act(() => {+ void start(options);+ });+ await act(async () => {+ await vi.advanceTimersByTimeAsync(0);+ });+ act(() => emit({ type: "chunk", delta: "partial" }));+ await act(async () => {+ await vi.advanceTimersByTimeAsync(STALL_TIMEOUT_MS + 1);+ });++ expect(callbacks.onError).toHaveBeenCalledWith(MESSAGE_ID, "Error: Stream timeout");+ expect(callbacks.onDone).toHaveBeenCalledTimes(1);+ } finally {+ vi.useRealTimers();+ }+ });++ it("refuses an empty history", async () => {+ const { start, options, callbacks, finalizeAssistantMessage } = setup();++ await act(() => start({ ...options, messages: [] }));++ expect(callbacks.onError).toHaveBeenCalledWith(MESSAGE_ID, "Error: empty message history");+ expect(callbacks.onDone).toHaveBeenCalledTimes(1);+ expect(finalizeAssistantMessage).not.toHaveBeenCalled();+ expect(useChatSessionStore.getState().isGenerating).toBe(false);+ });+});diff --git a/apps/mirai-gui/client/src/features/chat/hooks/use-llm-stream.ts b/apps/mirai-gui/client/src/features/chat/hooks/use-llm-stream.tsnew file mode 100644index 000000000..c08abd61e--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/hooks/use-llm-stream.ts@@ -0,0 +1,264 @@+import { useChatSessionStore } from "@/stores/use-chat-session-store";+import { useChatStore } from "@/stores/use-chat-store";+import type { Message } from "@/types/message";+import { withParsedOutput } from "@/stores/chat/message-patches";+import { getRunMetrics } from "../services/run-metrics";+import type {+ LlmAsyncStream,+ LlmRunParams,+ ParsedPatch,+ SessionOutputFinishReason,+ SessionOutputStats,+} from "@/types/llm-stream";+import { useCallback, useRef, useState } from "react";+import { createRevealLoop } from "../services/reveal-loop";++export type StartStreamOptions = {+ repoId: string;+ messages: LlmRunParams["messages"];+ messageId: string;+ chatId: string;+ updateText: (messageId: string, updatedText: string) => void;+ onError: (messageId: string, errorText: string) => void;+ onDone?: () => void;+ onFinishReason?: (reason: SessionOutputFinishReason) => void;+};++export const STALL_TIMEOUT_MS = 15000;++const activeVersionIndex = (message: Message | undefined): number | undefined =>+ message?.versions?.length ? (message.currentVersionIndex ?? message.versions.length - 1) : undefined;++const applyParsed = (messageId: string, patch: ParsedPatch): void => {+ const store = useChatStore.getState();+ const target = store.messages.find((m) => m.id === messageId);+ const versionIndex = activeVersionIndex(target);+ if (versionIndex === undefined) {+ store.updateMessage(messageId, { output: withParsedOutput(target?.output, patch) });+ return;+ }+ const versions = (target?.versions || []).map((v, i) =>+ i === versionIndex ? { ...v, output: withParsedOutput(v.output, patch) } : v,+ );+ store.updateMessage(messageId, { versions });+};++const applyPerf = (messageId: string, stats: SessionOutputStats): void => {+ const store = useChatStore.getState();+ const versionIndex = activeVersionIndex(store.messages.find((m) => m.id === messageId));+ const metrics = getRunMetrics(stats);+ if (versionIndex === undefined) {+ store.updateMessagePerf(messageId, metrics, stats);+ } else {+ store.updateVersionPerf(messageId, versionIndex, metrics, stats);+ }+};++export const useLlmStream = (chatId: string) => {+ const [isStreaming, setIsStreaming] = useState(false);+ const [isLoading, setIsLoading] = useState(false);++ const currentLlmRef = useRef<LlmAsyncStream | null>(null);+ const currentReaderRef = useRef<ReadableStreamDefaultReader<string> | null>(null);+ const currentRevealCancelRef = useRef<(() => void) | null>(null);++ const activeRunIdRef = useRef<string | null>(null);+ const canceledRunIdRef = useRef<string | null>(null);+ const stallTimeoutRef = useRef<number | null>(null);++ const clearStallTimeout = useCallback(() => {+ if (stallTimeoutRef.current === null) return;+ window.clearTimeout(stallTimeoutRef.current);+ stallTimeoutRef.current = null;+ }, []);++ const finalize = useCallback(+ (onDone?: () => void) => {+ clearStallTimeout();+ setIsStreaming(false);+ setIsLoading(false);+ currentLlmRef.current = null;+ currentReaderRef.current = null;+ currentRevealCancelRef.current = null;+ useChatSessionStore.getState().setGenerating(false);+ useChatSessionStore.getState().clearActiveGenerating();+ onDone?.();+ },+ [clearStallTimeout],+ );++ const releaseCurrentRun = useCallback(async () => {+ currentRevealCancelRef.current?.();+ currentRevealCancelRef.current = null;+ const reader = currentReaderRef.current;+ const llm = currentLlmRef.current;+ if (reader) {+ await reader.cancel().catch(() => {});+ currentReaderRef.current = null;+ }+ if (llm) {+ await llm.cancel().catch(() => {});+ currentLlmRef.current = null;+ }+ }, []);++ const cancel = useCallback(async () => {+ const { canStop, withOperation } = useChatSessionStore.getState();+ if (!canStop()) return;+ await withOperation("stopping", async () => {+ canceledRunIdRef.current = activeRunIdRef.current;+ setIsStreaming(false);+ setIsLoading(false);+ if (currentLlmRef.current) {+ await releaseCurrentRun();+ return;+ }+ // A run outlives the page that started it: after a remount this instance+ // holds no handle, and the backend run is reachable only by its id.+ await useChatSessionStore.getState().cancelActiveRunForChat(chatId);+ });+ }, [chatId, releaseCurrentRun]);++ const startStream = useCallback(+ async (options: StartStreamOptions) => {+ const { messageId, chatId, repoId } = options;+ const session = useChatSessionStore.getState();++ if (session.operationState !== "running") throw new Error("startStream called without the run operation");++ await releaseCurrentRun();++ session.setGenerating(true);+ session.setActiveGenerating(chatId, messageId);++ if (options.messages.length === 0) {+ options.onError(messageId, "Error: empty message history");+ finalize(options.onDone);+ return;+ }++ const llm = useChatStore.getState().runChatStream({ repoId, messages: options.messages });+ const runId = llm.runId;+ const reader = llm.stream.getReader();+ currentLlmRef.current = llm;+ currentReaderRef.current = reader;+ activeRunIdRef.current = runId;+ session.setActiveRunId(runId);+ const isCurrentRun = () => activeRunIdRef.current === runId;++ // Reasoning arrives as parsed patches before any text does.+ let hasContent = false;+ const offParsed = llm.onParsed((patch) => {+ if (!hasContent && (patch.chainOfThought || patch.response)) {+ hasContent = true;+ setIsLoading(false);+ }+ applyParsed(messageId, patch);+ });++ setIsStreaming(true);+ setIsLoading(true);++ const storeText = useChatStore.getState().messages.find((m) => m.id === messageId)?.text || "";+ const bufferText = useChatSessionStore.getState().activeAssistantMessageText || "";+ const reveal = createRevealLoop({+ baseText: bufferText.length >= storeText.length ? bufferText : storeText,+ isActive: isCurrentRun,+ apply: (visibleText) => {+ options.updateText(messageId, visibleText);+ session.setActiveAssistantMessageText(visibleText);+ },+ });+ currentRevealCancelRef.current = reveal.cancel;++ const fail = (message: string) => {+ // The pump may still be awaiting a read that resolves after this;+ // retiring the run id keeps it from finalizing a second time.+ activeRunIdRef.current = null;+ options.onError(messageId, `Error: ${message}`);+ reveal.cancel();+ offParsed();+ finalize(options.onDone);+ };++ let hasText = false;+ const armStallTimeout = () => {+ if (!hasText) return;+ clearStallTimeout();+ stallTimeoutRef.current = window.setTimeout(() => {+ if (!isCurrentRun()) return;+ canceledRunIdRef.current = runId;+ void reader.cancel();+ void llm.cancel();+ fail("Stream timeout");+ }, STALL_TIMEOUT_MS);+ };++ const pump = async (): Promise<void> => {+ for (;;) {+ const { value, done } = await reader.read();+ if (!isCurrentRun()) {+ reveal.cancel();+ offParsed();+ return;+ }+ if (done) {+ clearStallTimeout();+ await reveal.drain();+ offParsed();+ if (!isCurrentRun()) return;+ session.setActiveAssistantMessageText(null);+ finalize(options.onDone);+ return;+ }+ if (value) {+ if (!hasText) setIsLoading(false);+ hasText = true;+ reveal.append(value);+ }+ armStallTimeout();+ }+ };++ try {+ await pump();+ } catch (e) {+ // A reader abort caused by Stop or by a newer run is not a failure.+ if (canceledRunIdRef.current === runId || !isCurrentRun()) {+ canceledRunIdRef.current = null;+ reveal.cancel();+ offParsed();+ } else {+ fail(e instanceof Error ? e.message : String(e));+ }+ }++ const result = await llm.result;+ if (result.error) return;+ // Stop pressed after leaving and reopening the chat: the stop handler saved+ // the text at that moment, and this stream kept printing after it.+ const wasCanceled = canceledRunIdRef.current === runId || result.finishReason === "Cancelled";+ if (wasCanceled) {+ canceledRunIdRef.current = null;+ const current = useChatStore.getState().messages.find((m) => m.id === messageId);+ if (isCurrentRun() && current) {+ void useChatStore.getState().persistMessagePatch(chatId, messageId, {+ text: current.text,+ versions: current.versions,+ error: current.error,+ output: current.output,+ });+ }+ return;+ }+ if (!isCurrentRun()) return;++ applyPerf(messageId, result.stats);+ await useChatStore.getState().finalizeAssistantMessage(chatId, messageId, result.text || "", result.parsed);+ if (result.finishReason) options.onFinishReason?.(result.finishReason);+ },+ [clearStallTimeout, finalize, releaseCurrentRun],+ );++ return { isStreaming, isLoading, cancel, startStream };+};diff --git a/apps/mirai-gui/client/src/features/chat/hooks/use-model-switch.ts b/apps/mirai-gui/client/src/features/chat/hooks/use-model-switch.tsnew file mode 100644index 000000000..a85e3323d--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/hooks/use-model-switch.ts@@ -0,0 +1,58 @@+import { useCallback } from "react";+import { useChatSessionStore } from "@/stores/use-chat-session-store";+import { useRuntimeSessionStore } from "@/stores/use-runtime-session-store";+import { useChatStore } from "@/stores/use-chat-store";+import { isOtherChatGenerating } from "@/features/runtime/runtime-busy";+import { ejectAndWait } from "@/features/runtime/eject-runtime-session";+import type { ToastApi } from "@/components/ui/toast/use-toast";++type UseModelSwitchParams = {+ chatId: string;+ toast: ToastApi;+ setPendingSwitch: (v: boolean) => void;+ cancelStream: () => Promise<void>;+};++export const useModelSwitch = ({ chatId, toast, setPendingSwitch, cancelStream }: UseModelSwitchParams) => {+ return useCallback(+ async (modelId: string, modelName: string) => {+ const session = useChatSessionStore.getState();+ if (isOtherChatGenerating(session, chatId)) {+ toast.error("A response is already generating in another chat");+ return;+ }++ const resident = useRuntimeSessionStore.getState().residentSession;+ const needsEject = !!resident && resident.repoId !== modelId;++ if (needsEject) {+ try {+ if (session.canStop()) {+ toast.info("Stopping current generation…");+ await cancelStream().catch(() => undefined);+ }++ toast.info("Ejecting previous model…");+ setPendingSwitch(true);+ const closeRes = await ejectAndWait(resident);++ if (!closeRes) {+ setPendingSwitch(false);+ toast.error("Failed to eject previous model");+ return;+ }+ } catch {+ setPendingSwitch(false);+ toast.error("Failed to switch model");+ return;+ }+ }++ const chat = useChatStore.getState();+ chat.suppressAutoSelect(chatId, false);+ chat.setChatModel(chatId, modelId, modelName);+ setPendingSwitch(false);+ },+ [chatId, toast, setPendingSwitch, cancelStream],+ );+};diff --git a/apps/mirai-gui/client/src/features/chat/hooks/use-picker-models.tsx b/apps/mirai-gui/client/src/features/chat/hooks/use-picker-models.tsxnew file mode 100644index 000000000..fdda7394a--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/hooks/use-picker-models.tsx@@ -0,0 +1,22 @@+import { useModelsStore } from "@/stores/use-models-store";+import { modelDownloadPhases } from "@/types/model-manager";+import { ModelVendorIcon } from "@/components/model-vendor-icon";+import type { ChatInputModel } from "../components/composer/chat-input/types";+import { useMemo } from "react";++export const useInstalledPickerModels = (): ChatInputModel[] => {+ const models = useModelsStore((s) => s.models);+ const modelPhasesById = useModelsStore((s) => s.modelPhasesById);++ return useMemo(+ () =>+ models+ .filter((m) => modelPhasesById[m.repoId] === modelDownloadPhases.downloaded)+ .map((m) => ({+ id: m.repoId,+ name: m.name,+ logo: <ModelVendorIcon vendor={m.vendor} />,+ })),+ [models, modelPhasesById],+ );+};diff --git a/apps/mirai-gui/client/src/features/chat/hooks/use-regenerate-message.ts b/apps/mirai-gui/client/src/features/chat/hooks/use-regenerate-message.tsnew file mode 100644index 000000000..5dfdd0309--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/hooks/use-regenerate-message.ts@@ -0,0 +1,120 @@+import { useCallback } from "react";+import { useChatSessionStore } from "@/stores/use-chat-session-store";+import { useChatStore } from "@/stores/use-chat-store";+import { Roles } from "../types";+import { attachmentStorage } from "../services/attachment-storage";+import { getChatRunBlockMessage, prepareChatModelForRun } from "../services/chat-run-preflight";+import { buildChatRunInput } from "../services/build-chat-run-input";+import { patchActiveVersion, projectAssistantVersion } from "../services/regenerate-versions";+import type { StartStreamOptions } from "./use-llm-stream";+import type { ToastApi } from "@/components/ui/toast/use-toast";++type UseRegenerateMessageParams = {+ chatId: string;+ globalInstructions: string | null | undefined;+ toast: ToastApi;+ startStream: (options: StartStreamOptions) => Promise<void | null>;+};++export const useRegenerateMessage = ({+ chatId,+ globalInstructions,+ toast,+ startStream,+}: UseRegenerateMessageParams) => {+ return useCallback(+ async (messageId: string, modelId: string, modelName: string) => {+ const target = { repoId: modelId } as const;+ const ready = await prepareChatModelForRun({ chatId, modelId }, target, {+ onEjectStart: () => toast.info("Ejecting previous model…"),+ });+ if (!ready.ok) {+ toast.error(getChatRunBlockMessage(ready.reason));+ return;+ }++ const state = useChatStore.getState();+ const messages = state.messages;+ const targetIndex = messages.findIndex((m) => m.id === messageId);+ if (targetIndex < 0) return;+ const targetMessage = messages[targetIndex];+ if (!targetMessage || targetMessage.sender !== Roles.Assistant) return;++ const userIndex = messages+ .slice(0, targetIndex)+ .reduceRight((found, m, i) => (found !== -1 ? found : m.sender === Roles.User ? i : -1), -1);+ if (userIndex < 0) return;++ const userMessage = messages[userIndex];+ if (!userMessage) return;+ const userAttachments = userMessage.attachmentIds ? attachmentStorage.getFiles(userMessage.attachmentIds) : [];+ const { messages: messagesForRun } = buildChatRunInput({+ history: messages.slice(0, userIndex),+ prompt: userMessage.text,+ attachments: userAttachments,+ globalInstructions,+ });++ const accepted = await useChatSessionStore.getState().withOperation("running", async () => {+ const newVersions = projectAssistantVersion(targetMessage, modelId, modelName, userMessage.attachmentIds);+ const regeneratePatch = {+ text: "",+ modelId,+ modelName,+ versions: newVersions,+ currentVersionIndex: newVersions.length - 1,+ };+ state.updateMessage(messageId, regeneratePatch);+ await state.persistMessagePatch(chatId, messageId, regeneratePatch);+ const { setLoadingMessage } = useChatSessionStore.getState();+ setLoadingMessage(chatId, messageId);++ const updateText = (id: string, updatedText: string) => {+ const current = useChatStore.getState().messages.find((m) => m.id === id);+ useChatStore.getState().updateMessage(id, {+ text: updatedText,+ versions: patchActiveVersion(current?.versions, {+ text: updatedText,+ attachmentIds: userMessage.attachmentIds,+ }),+ });+ };++ const failVersion = (errorText: string) => {+ const current = useChatStore.getState().messages.find((m) => m.id === messageId);+ const nextVersions = patchActiveVersion(current?.versions, { text: "", error: errorText });+ useChatStore+ .getState()+ .updateMessage(+ messageId,+ nextVersions.length > 0 ? { text: "", versions: nextVersions } : { text: "", error: errorText },+ );+ setLoadingMessage(chatId, null);+ };++ try {+ await startStream({+ repoId: modelId,+ messages: messagesForRun,+ messageId,+ chatId,+ onDone: () => setLoadingMessage(chatId, null),+ updateText,+ onError: (_id, errorText) => failVersion(errorText),+ onFinishReason: (reason) => {+ if (reason === "ContextLimitReached") {+ toast.warning("Conversation reached the model's context limit; reply may be truncated");+ } else if (reason === "Length") {+ toast.warning("Reply hit the output length limit and may be truncated");+ }+ },+ });+ } catch (e) {+ failVersion(`Error: ${e instanceof Error ? e.message : String(e)}`);+ }+ });+ if (accepted === null) toast.error("Model is not ready yet, please wait");+ },+ [chatId, globalInstructions, toast, startStream],+ );+};diff --git a/apps/mirai-gui/client/src/features/chat/hooks/use-send-chat-message.test.tsx b/apps/mirai-gui/client/src/features/chat/hooks/use-send-chat-message.test.tsxnew file mode 100644index 000000000..021985578--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/hooks/use-send-chat-message.test.tsx@@ -0,0 +1,382 @@+import { act, cleanup, renderHook, waitFor } from "@testing-library/react";+import { afterEach, beforeEach, expect, it, vi } from "vitest";+import { ChatNotFoundError, type ChatData, type ChatMetadata } from "@/platform/services/storage";+import { useChatSessionStore } from "@/stores/use-chat-session-store";+import { useChatStore } from "@/stores/use-chat-store";+import { useRuntimeSessionStore } from "@/stores/use-runtime-session-store";+import { Roles } from "@/types/chat";+import type { ToastApi } from "@/components/ui/toast/use-toast";+import type { StartStreamOptions } from "./use-llm-stream";+import { useSendChatMessage } from "./use-send-chat-message";+import { useStopChatRun } from "./use-stop-chat-run";+import type { ChatComposerState } from "./use-chat-composer-state";++const mocks = vi.hoisted(() => ({ platform: {} as Record<string, unknown> }));+vi.mock("@/platform/platform-singleton", () => ({ getPlatform: () => mocks.platform }));++const CHAT_A = "a";+const CHAT_B = "b";+const chatDefaults = useChatStore.getState();+const sessionDefaults = useChatSessionStore.getState();+const runtimeDefaults = useRuntimeSessionStore.getState();+const metadata: ChatMetadata = {+ id: CHAT_A,+ title: "Untitled",+ messageCount: 0,+ createdAt: 1,+ updatedAt: 1,+ modelId: "model",+ modelName: "Model",+};++const startStream = vi.fn<(options: StartStreamOptions) => Promise<void>>(async () => {+ expect(useChatSessionStore.getState().operationState).toBe("running");+});+const composer = { attachedFiles: [], clear: vi.fn() } as unknown as ChatComposerState;+const toast = { error: vi.fn(), info: vi.fn(), warning: vi.fn() } as unknown as ToastApi;+const noop = () => {};++const renderSend = (chatId = CHAT_A) =>+ renderHook(() => {+ const { stop } = useStopChatRun({+ chatId,+ cancelStream: async () => {},+ });+ const send = useSendChatMessage({+ chatId,+ composer,+ globalInstructions: "",+ runStatusBlockReason: null,+ toast,+ setScrollTargetId: noop,+ startStream,+ });+ return { send, stop };+ });++const generateTitle = vi.fn();+const cancelTitleGen = vi.fn();+const ejectSession = vi.fn(async () => {});+let chats = new Map<string, ChatData>();+const updateChatTitle = vi.fn(async (id: string, title: string, expectedTitle?: string) => {+ const chat = chats.get(id);+ if (!chat) return;+ if (expectedTitle !== undefined && chat.metadata.title !== expectedTitle) return;+ chat.metadata.title = title;+});++const deferred = <T,>() => {+ let resolve!: (value: T) => void;+ let reject!: (error: Error) => void;+ const promise = new Promise<T>((yes, no) => {+ resolve = yes;+ reject = no;+ });+ return { promise, resolve, reject };+};++beforeEach(() => {+ vi.clearAllMocks();+ useChatStore.setState(chatDefaults, true);+ useChatSessionStore.setState(sessionDefaults, true);+ useRuntimeSessionStore.setState(runtimeDefaults, true);+ useChatStore.getState().createNewChat(CHAT_A);+ useChatStore.getState().setChatModel(CHAT_A, "model", "Model");+ chats = new Map<string, ChatData>();+ generateTitle.mockResolvedValue("Title");+ cancelTitleGen.mockResolvedValue(undefined);+ mocks.platform = {+ storage: {+ createOrReplaceChat: vi.fn(async (chat: ChatData) => {+ chats.set(chat.metadata.id, structuredClone(chat));+ }),+ appendMessage: vi.fn(async (id: string, message: ChatData["messages"][number]) => {+ const chat = chats.get(id);+ if (!chat) throw new ChatNotFoundError(id);+ chat.messages = [...chat.messages.filter((m) => m.id !== message.id), structuredClone(message)];+ }),+ loadChat: vi.fn(async (id: string) => structuredClone(chats.get(id) ?? null)),+ listChats: vi.fn(async () => [...chats.values()].map((c) => c.metadata)),+ updateChatTitle,+ updateStoredMessage: vi.fn(async () => {}),+ removeMessage: vi.fn(async (id: string, messageId: string) => {+ const chat = chats.get(id);+ if (chat) chat.messages = chat.messages.filter((m) => m.id !== messageId);+ }),+ deleteChat: vi.fn(async (id: string) => {+ chats.delete(id);+ }),+ },+ chat: { generateTitle, cancelTitleGen },+ session: { ejectSession },+ };+});++afterEach(cleanup);++it("does not read another chat's history when the user navigates during persistence", async () => {+ let finishPersist!: () => void;+ useChatStore.setState({+ persistMessage: vi+ .fn()+ .mockImplementationOnce(+ () =>+ new Promise<void>((resolve) => {+ finishPersist = resolve;+ }),+ )+ .mockResolvedValue(undefined),+ generateChatTitle: vi.fn(async () => ({ ok: true })),+ });+ const hook = renderSend();+ let sending!: Promise<void>;+ act(() => {+ sending = hook.result.current.send("question in a");+ });+ await waitFor(() => expect(finishPersist).toBeTypeOf("function"));++ useChatStore.getState().createNewChat(CHAT_B);+ useChatStore.getState().addMessageTo(CHAT_B, { sender: Roles.User, text: "private content of b" });+ useChatStore.getState().addMessageTo(CHAT_B, { sender: Roles.Assistant, text: "answer in b" });+ await act(async () => {+ finishPersist();+ await sending;+ });++ expect(JSON.stringify(startStream.mock.calls)).not.toContain("private content of b");+ expect(useChatStore.getState().messages).toHaveLength(2);+});++it("does not start a response after Stop during title generation following a remount", async () => {+ useChatStore.setState({ savedChats: [metadata] });+ let resolveTitle!: (value: string) => void;+ generateTitle.mockImplementation(+ () =>+ new Promise((resolve) => {+ resolveTitle = resolve;+ }),+ );+ cancelTitleGen.mockImplementation(async () => {+ resolveTitle("");+ });+ const original = renderSend();+ let sending!: Promise<void>;+ act(() => {+ sending = original.result.current.send("hello");+ });+ await waitFor(() => expect(generateTitle).toHaveBeenCalled());+ original.unmount();++ const remounted = renderSend();+ await act(async () => {+ await remounted.result.current.stop();+ await sending;+ });++ expect(cancelTitleGen).toHaveBeenCalledTimes(1);+ expect(startStream).not.toHaveBeenCalled();+ expect(updateChatTitle).not.toHaveBeenCalled();+});++it("keeps the Stop of one chat's title generation when another chat sends meanwhile", async () => {+ useChatStore.setState({ savedChats: [metadata] });+ let resolveTitle!: (value: string) => void;+ generateTitle.mockImplementation(+ () =>+ new Promise((resolve) => {+ resolveTitle = resolve;+ }),+ );+ const a = renderSend(CHAT_A);+ let sending!: Promise<void>;+ act(() => {+ sending = a.result.current.send("hello");+ });+ await waitFor(() => expect(generateTitle).toHaveBeenCalled());+ await act(() => a.result.current.stop());++ useChatStore.getState().createNewChat(CHAT_B);+ useChatStore.getState().setChatModel(CHAT_B, "model", "Model");+ const b = renderSend(CHAT_B);+ await act(async () => void (await b.result.current.send("meanwhile")));+ expect(toast.error).toHaveBeenCalledWith("Generating chat title, please wait");++ await act(async () => {+ resolveTitle("");+ await sending;+ });++ expect(startStream).not.toHaveBeenCalled();+ expect(updateChatTitle).not.toHaveBeenCalled();+});++it("keeps another chat's history out of a send that waited for a model eject", async () => {+ useChatStore.getState().addMessageTo(CHAT_A, { sender: Roles.User, text: "history A" });+ const answerId = useChatStore.getState().addMessageTo(CHAT_A, { sender: Roles.Assistant, text: "answer A" }).id;+ await useChatStore.getState().persistMessage(CHAT_A, answerId);+ useRuntimeSessionStore.setState({ residentSession: { repoId: "old-model" } });+ const eject = deferred<void>();+ ejectSession.mockReturnValueOnce(eject.promise);+ const hook = renderSend();+ let sending!: Promise<void>;+ act(() => {+ sending = hook.result.current.send("prompt A");+ });+ await waitFor(() => expect(ejectSession).toHaveBeenCalled());++ useChatStore.getState().createNewChat(CHAT_B);+ useChatStore.getState().addMessageTo(CHAT_B, { sender: Roles.User, text: "private history B" });+ useChatStore.getState().addMessageTo(CHAT_B, { sender: Roles.Assistant, text: "private answer B" });+ await act(async () => {+ useRuntimeSessionStore.setState({ residentSession: null });+ eject.resolve();+ await sending;+ });++ expect(startStream).toHaveBeenCalledTimes(1);+ const sent = startStream.mock.calls[0]?.[0].messages.map((m) => m.content).join("\n");+ expect(sent).toContain("history A");+ expect(sent).not.toContain("private history B");+ expect(useChatStore.getState().messages.map((m) => m.text)).toEqual(["private history B", "private answer B"]);+ expect(chats.get(CHAT_A)?.messages.map((m) => m.text)).toContain("prompt A");+});++it("keeps a failed save of one chat out of the chat opened meanwhile", async () => {+ const save = deferred<void>();+ (mocks.platform.storage as { createOrReplaceChat: ReturnType<typeof vi.fn> }).createOrReplaceChat.mockReturnValueOnce(+ save.promise,+ );+ const hook = renderSend();+ let sending!: Promise<void>;+ act(() => {+ sending = hook.result.current.send("prompt A");+ });+ await waitFor(() => expect(useChatStore.getState().savedChats.map((c) => c.id)).toContain(CHAT_A));++ useChatStore.getState().createNewChat(CHAT_B);+ useChatStore.getState().addMessageTo(CHAT_B, { sender: Roles.User, text: "private history B" });+ await act(async () => {+ save.reject(new Error("disk full"));+ await sending;+ });++ expect(useChatStore.getState().messages.map((m) => m.text)).toEqual(["private history B"]);+ expect(chats.get(CHAT_A)?.messages.map((m) => m.error)).toEqual(["Error: disk full"]);+});++it("does not start a reply for a chat deleted during title generation", async () => {+ const title = deferred<string>();+ generateTitle.mockReturnValueOnce(title.promise);+ const hook = renderSend();+ let sending!: Promise<void>;+ act(() => {+ sending = hook.result.current.send("prompt A");+ });+ await waitFor(() => expect(generateTitle).toHaveBeenCalled());++ await act(() => useChatStore.getState().deleteChat(CHAT_A));+ await act(async () => {+ title.resolve("");+ await sending;+ });++ expect(cancelTitleGen).toHaveBeenCalledTimes(1);+ expect(startStream).not.toHaveBeenCalled();+ expect(chats.has(CHAT_A)).toBe(false);+});++it("keeps a manual rename made while the title was generating", async () => {+ const title = deferred<string>();+ generateTitle.mockReturnValueOnce(title.promise);+ const hook = renderSend();+ let sending!: Promise<void>;+ act(() => {+ sending = hook.result.current.send("prompt A");+ });+ await waitFor(() => expect(generateTitle).toHaveBeenCalled());++ await act(() => useChatStore.getState().updateChatTitle(CHAT_A, "Chosen by user"));+ await act(async () => {+ title.resolve("Automatic title");+ await sending;+ });++ expect(chats.get(CHAT_A)?.metadata.title).toBe("Chosen by user");+ expect(startStream).toHaveBeenCalledTimes(1);+});++it("reports a failed eject instead of rejecting the send", async () => {+ useRuntimeSessionStore.setState({ residentSession: { repoId: "old-model" } });+ ejectSession.mockRejectedValueOnce(new Error("IPC unavailable"));+ vi.spyOn(console, "error").mockImplementation(() => {});+ const hook = renderSend();++ await act(async () => void (await hook.result.current.send("prompt A")));++ expect(toast.error).toHaveBeenCalledWith("Failed to eject previous model");+ expect(startStream).not.toHaveBeenCalled();+ expect(composer.clear).not.toHaveBeenCalled();+});++it("clears the composer with the sent text once the message is accepted", async () => {+ const hook = renderSend();++ await act(async () => void (await hook.result.current.send("prompt A")));++ expect(composer.clear).toHaveBeenCalledWith("prompt A");+ await waitFor(() => expect(startStream).toHaveBeenCalled());+});++it("stores a new chat's first exchange without duplicates", async () => {+ const hook = renderSend();++ await act(() => hook.result.current.send("hello"));++ const stored = chats.get(CHAT_A)?.messages ?? [];+ expect(stored.map((m) => m.sender)).toEqual([Roles.User, Roles.Assistant]);+ expect(new Set(stored.map((m) => m.id)).size).toBe(2);+});++it("refuses a second send while the first is still being written", async () => {+ const firstWrite = deferred<void>();+ (mocks.platform.storage as { createOrReplaceChat: ReturnType<typeof vi.fn> }).createOrReplaceChat.mockReturnValueOnce(+ firstWrite.promise,+ );+ const hook = renderSend();++ let first!: Promise<void>;+ act(() => {+ first = hook.result.current.send("first");+ });+ await waitFor(() => expect(useChatStore.getState().messages).toHaveLength(2));+ await act(() => hook.result.current.send("second"));++ expect(toast.error).toHaveBeenCalledWith("A response is already generating.");+ expect(useChatStore.getState().messages.map((m) => m.text)).toEqual(["first", ""]);++ await act(async () => {+ firstWrite.resolve();+ await first;+ });+ expect(startStream).toHaveBeenCalledTimes(1);+ expect(useChatSessionStore.getState().operationState).toBe("idle");+});++it("turns the placeholder into the error bubble when the first write fails", async () => {+ (mocks.platform.storage as { createOrReplaceChat: ReturnType<typeof vi.fn> }).createOrReplaceChat+ .mockRejectedValueOnce(new Error("disk full"))+ .mockImplementation(async (chat: ChatData) => {+ chats.set(chat.metadata.id, structuredClone(chat));+ });+ const hook = renderSend();++ await act(() => hook.result.current.send("hello"));++ const messages = useChatStore.getState().messages;+ expect(messages.map((m) => [m.sender, m.error ?? m.text])).toEqual([+ [Roles.User, "hello"],+ [Roles.Assistant, "Error: disk full"],+ ]);+ expect(chats.get(CHAT_A)?.messages.map((m) => m.id)).toEqual(messages.map((m) => m.id));+ expect(useChatSessionStore.getState()).toMatchObject({ loadingMessage: null, operationState: "idle" });+});diff --git a/apps/mirai-gui/client/src/features/chat/hooks/use-send-chat-message.ts b/apps/mirai-gui/client/src/features/chat/hooks/use-send-chat-message.tsnew file mode 100644index 000000000..d38a2ad9a--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/hooks/use-send-chat-message.ts@@ -0,0 +1,160 @@+import { useCallback } from "react";+import { useChatSessionStore } from "@/stores/use-chat-session-store";+import { useChatStore } from "@/stores/use-chat-store";+import type { AttachedFile } from "@/types/files";+import { Roles } from "../types";+import { attachmentStorage } from "../services/attachment-storage";+import { ChatRunBlockReason } from "../types";+import { getChatRunBlockMessage, prepareChatModelForRun } from "../services/chat-run-preflight";+import { buildChatRunInput } from "../services/build-chat-run-input";+import type { ChatComposerState } from "./use-chat-composer-state";+import type { StartStreamOptions } from "./use-llm-stream";+import type { ToastApi } from "@/components/ui/toast/use-toast";++type UseSendChatMessageParams = {+ chatId: string;+ composer: ChatComposerState;+ globalInstructions: string | null | undefined;+ runStatusBlockReason: ChatRunBlockReason | null;+ toast: ToastApi;+ setScrollTargetId: (id: string | null) => void;+ startStream: (options: StartStreamOptions) => Promise<void | null>;+};++export const useSendChatMessage = (params: UseSendChatMessageParams) => {+ const { chatId, composer, globalInstructions, runStatusBlockReason, toast, setScrollTargetId, startStream } = params;++ return useCallback(+ async (message: string): Promise<void> => {+ const session = useChatSessionStore.getState();+ useChatStore.getState().setCurrentChatId(chatId);++ const storeState = useChatStore.getState();+ const modelId = storeState.chatModels[chatId]?.modelId;+ if (!modelId) throw new Error("Model is not selected");++ // Captured before any await: the user may open another chat while this+ // one waits for an eject or a write, and the store then holds that chat.+ const history = storeState.messages;++ if (runStatusBlockReason !== null) {+ if (runStatusBlockReason === ChatRunBlockReason.OtherChatGenerating) {+ toast.error("A response is already generating in another chat");+ }+ return;+ }++ const target = { repoId: modelId } as const;+ const ready = await prepareChatModelForRun({ chatId, modelId }, target, {+ onEjectStart: () => toast.info("Ejecting previous model…"),+ });+ if (!ready.ok) {+ toast.error(getChatRunBlockMessage(ready.reason));+ return;+ }++ const canRunNow = useChatSessionStore.getState().canRun(target);+ if (!canRunNow) {+ toast.error("Model is not ready yet, please wait");+ return;+ }++ const accepted = await session.withOperation("running", async () => {+ const fileIds = composer.attachedFiles.map((file: AttachedFile) => {+ attachmentStorage.saveFile(file);+ return file.id;+ });+ const attachmentIds = fileIds.length > 0 ? fileIds : undefined;++ const userMessage = useChatStore.getState().addMessageTo(chatId, {+ text: message,+ sender: Roles.User,+ attachmentIds,+ });+ const filesToSend = [...composer.attachedFiles];+ composer.clear(message);+ setScrollTargetId(userMessage.id);++ // Created before the first await so Stop during title generation has a reply to remove.+ const placeholder = useChatStore.getState().addMessageTo(chatId, {+ text: "",+ sender: Roles.Assistant,+ modelId: modelId || undefined,+ modelName: storeState.chatModels[chatId]?.modelName || undefined,+ perf: {},+ attachmentIds,+ });+ session.setLoadingMessage(chatId, placeholder.id);++ const failReply = async (errText: string) => {+ session.setLoadingMessage(chatId, null);+ useChatStore.getState().updateMessage(placeholder.id, { text: "", error: errText, attachmentIds });+ await useChatStore+ .getState()+ .persistMessage(chatId, placeholder.id, { ...placeholder, text: "", error: errText })+ .catch((err) => console.error("[storage] failed to persist error message", err));+ };++ try {+ await useChatStore.getState().persistMessage(chatId, userMessage.id, userMessage);+ await useChatStore.getState().persistMessage(chatId, placeholder.id, placeholder);++ const { messages: messagesForRun } = buildChatRunInput({+ history,+ prompt: message,+ attachments: filesToSend,+ globalInstructions,+ });++ const titleGenResult = await useChatStore.getState().generateChatTitle(chatId, message);++ if (useChatSessionStore.getState().consumeTitleGenAbort(chatId)) {+ // The placeholder is already on disk; left there it would come back+ // as a blank bubble after a reload.+ session.setCanceledMessage(chatId, null);+ session.setLoadingMessage(chatId, null);+ await useChatStore.getState().discardMessage(chatId, placeholder.id);+ return;+ }++ if (!titleGenResult.ok && titleGenResult.error) {+ await failReply(`Error: ${titleGenResult.error}`);+ return;+ }++ await startStream({+ repoId: modelId,+ messages: messagesForRun,+ messageId: placeholder.id,+ chatId,+ updateText: (id: string, updatedText: string) => {+ useChatStore.getState().updateMessage(id, { text: updatedText, attachmentIds });+ },+ onDone: () => session.setLoadingMessage(chatId, null),+ onError: (id, errorText) => {+ const current = useChatStore.getState().messages.find((m) => m.id === id);+ useChatStore.getState().updateMessage(id, {+ text: "",+ error: errorText,+ attachmentIds: current?.attachmentIds,+ });+ void useChatStore.getState().persistMessageError(chatId, id, "", errorText, current?.attachmentIds);+ session.setLoadingMessage(chatId, null);+ },+ onFinishReason: (reason) => {+ if (reason === "ContextLimitReached") {+ toast.warning("Conversation reached the model's context limit; reply may be truncated");+ } else if (reason === "Length") {+ toast.warning("Reply hit the output length limit and may be truncated");+ }+ },+ });+ } catch (e) {+ await failReply(`Error: ${e instanceof Error ? e.message : String(e)}`);+ }+ });+ if (accepted === null) toast.error("Model is not ready yet, please wait");+ },+ [chatId, composer, globalInstructions, runStatusBlockReason, toast, setScrollTargetId, startStream],+ );+};diff --git a/apps/mirai-gui/client/src/features/chat/hooks/use-stop-chat-run.ts b/apps/mirai-gui/client/src/features/chat/hooks/use-stop-chat-run.tsnew file mode 100644index 000000000..660432792--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/hooks/use-stop-chat-run.ts@@ -0,0 +1,38 @@+import { useChatSessionStore } from "@/stores/use-chat-session-store";+import { useChatStore } from "@/stores/use-chat-store";+import { useCallback } from "react";++type UseStopChatRunParams = {+ chatId: string;+ cancelStream: () => Promise<void>;+};++export const useStopChatRun = ({ chatId, cancelStream }: UseStopChatRunParams) => {+ const stop = useCallback(async () => {+ const session = useChatSessionStore.getState();+ if (!session.canStop()) {+ if (session.titleGenChatId === chatId) await session.cancelActiveRunForChat(chatId);+ return;+ }+ const stoppedMessageId = session.loadingMessage?.chatId === chatId ? session.loadingMessage.messageId : null;+ try {+ await cancelStream();+ if (stoppedMessageId) {+ session.setCanceledMessage(chatId, stoppedMessageId);+ const canceledMsg = useChatStore.getState().messages.find((m) => m.id === stoppedMessageId);+ if (canceledMsg) {+ void useChatStore.getState().persistMessagePatch(chatId, stoppedMessageId, {+ text: canceledMsg.text,+ versions: canceledMsg.versions,+ error: canceledMsg.error,+ output: canceledMsg.output,+ });+ }+ }+ } catch (e) {+ console.warn("[chat] stop failed", e);+ }+ }, [cancelStream, chatId]);++ return { stop };+};diff --git a/apps/mirai-gui/client/src/features/chat/services/attachment-files.ts b/apps/mirai-gui/client/src/features/chat/services/attachment-files.tsnew file mode 100644index 000000000..7b82061f9--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/services/attachment-files.ts@@ -0,0 +1,43 @@+import type { AttachedFile } from "@/types/files";+import { SUPPORTED_FILE_TYPES, MAX_TOTAL_ATTACHMENTS_SIZE, MAX_SINGLE_FILE_SIZE } from "@/constants/attachments";++const generateFileId = (): string => {+ return `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;+};++const getFileExtension = (filename: string): string => {+ return filename.split(".").pop()?.toLowerCase() || "";+};++export const isValidFileType = (file: File): boolean => {+ const extension = getFileExtension(file.name);+ return SUPPORTED_FILE_TYPES.text.includes(`.${extension}`);+};++export const isValidFileSize = (file: File, currentFiles: AttachedFile[] = []): boolean => {+ if (file.size > MAX_SINGLE_FILE_SIZE) return false;+ const currentTotalSize = currentFiles.reduce((sum, f) => sum + f.size, 0);+ const newTotalSize = currentTotalSize + file.size;+ return newTotalSize <= MAX_TOTAL_ATTACHMENTS_SIZE;+};++export const processFile = async (file: File): Promise<AttachedFile> => {+ const extension = getFileExtension(file.name);+ if (!SUPPORTED_FILE_TYPES.text.includes(`.${extension}`)) {+ throw new Error("Unsupported file type");+ }+ if (file.size > MAX_SINGLE_FILE_SIZE) {+ throw new Error("File too large");+ }++ const text = await file.text();++ return {+ id: generateFileId(),+ name: file.name,+ mimeType: file.type,+ size: file.size,+ content: text,+ extension,+ };+};diff --git a/apps/mirai-gui/client/src/features/chat/services/attachment-storage.ts b/apps/mirai-gui/client/src/features/chat/services/attachment-storage.tsnew file mode 100644index 000000000..b88961fdb--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/services/attachment-storage.ts@@ -0,0 +1,65 @@+import type { AttachedFile } from "@/types/files";++const ATTACHMENTS_KEY = "mirai-attached-files";++type AttachmentsById = {+ [fileId: string]: AttachedFile;+};++class AttachmentStorage {+ private storage: AttachmentsById = {};++ constructor() {+ this.loadFromStorage();+ }++ private loadFromStorage(): void {+ try {+ const stored = localStorage.getItem(ATTACHMENTS_KEY);+ if (stored) {+ this.storage = JSON.parse(stored);+ }+ } catch (error) {+ console.error("Error loading attachment storage:", error);+ this.storage = {};+ }+ }++ private saveToStorage(): void {+ try {+ localStorage.setItem(ATTACHMENTS_KEY, JSON.stringify(this.storage));+ } catch (error) {+ console.error("Error saving attachment storage:", error);+ }+ }++ saveFile(file: AttachedFile): void {+ this.storage[file.id] = file;+ this.saveToStorage();+ }++ getFiles(fileIds: string[]): AttachedFile[] {+ return fileIds.map((id) => this.storage[id]).filter((file) => file !== undefined);+ }++ deleteFiles(fileIds: string[]): void {+ fileIds.forEach((id) => delete this.storage[id]);+ this.saveToStorage();+ }++ cleanup(): void {+ const sevenDaysAgo = Date.now() - 7 * 24 * 60 * 60 * 1000;+ const fileIdsToDelete: string[] = [];++ Object.values(this.storage).forEach((file) => {+ const timestamp = Number.parseInt(file.id.split("-")[0] ?? "", 10);+ if (Number.isFinite(timestamp) && timestamp < sevenDaysAgo) {+ fileIdsToDelete.push(file.id);+ }+ });++ this.deleteFiles(fileIdsToDelete);+ }+}++export const attachmentStorage = new AttachmentStorage();diff --git a/apps/mirai-gui/client/src/features/chat/services/build-chat-run-input.ts b/apps/mirai-gui/client/src/features/chat/services/build-chat-run-input.tsnew file mode 100644index 000000000..d23396d26--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/services/build-chat-run-input.ts@@ -0,0 +1,58 @@+import type { Message } from "@/types/message";+import { Roles, type NonSystemRole } from "../types";+import type { AttachedFile } from "@/types/files";+import { attachmentStorage } from "./attachment-storage";+import { formatMessageWithAttachments, normalizeMessagesForRun, type ChatRunMessage } from "./message-format";++type HistoryMessage = {+ role: NonSystemRole;+ content: string;+ reasoningContent?: string;+};++const projectHistoryMessage = (m: Message): HistoryMessage => {+ const hasVersions = Array.isArray(m.versions) && (m.versions?.length ?? 0) > 0;+ const activeVersion = hasVersions ? m.versions?.[m.currentVersionIndex ?? (m.versions?.length ?? 1) - 1] : undefined;+ const parsed = hasVersions ? activeVersion?.output?.text?.parsed : m.output?.text?.parsed;+ const text = hasVersions ? (activeVersion?.text ?? m.text) : m.text;+ // History stores attachment ids separately, so reconstruct the content sent to the model.+ const content =+ m.sender === Roles.User && m.attachmentIds?.length+ ? formatMessageWithAttachments(text, attachmentStorage.getFiles(m.attachmentIds))+ : text;+ return {+ role: m.sender,+ content,+ ...(m.sender === Roles.Assistant && parsed?.chainOfThought ? { reasoningContent: parsed.chainOfThought } : {}),+ };+};++type BuildChatRunInputParams = {+ history: Message[];+ prompt: string;+ attachments: AttachedFile[];+ globalInstructions?: string | null;+};++type BuildChatRunInputResult = {+ messages: ChatRunMessage[];+};++export const buildChatRunInput = (params: BuildChatRunInputParams): BuildChatRunInputResult => {+ const { history, prompt, attachments, globalInstructions } = params;++ const formattedPrompt = formatMessageWithAttachments(prompt, attachments);++ const historyMessages = history+ .map(projectHistoryMessage)+ .filter((m) => !(m.role === Roles.Assistant && m.content.trim().length === 0));++ const base: ChatRunMessage[] = globalInstructions?.trim()+ ? [{ role: Roles.System, content: globalInstructions }, ...historyMessages]+ : historyMessages;++ const preNormalized: ChatRunMessage[] = [...base, { role: Roles.User, content: formattedPrompt }];+ const messages = normalizeMessagesForRun(preNormalized);++ return { messages };+};diff --git a/apps/mirai-gui/client/src/features/chat/services/chat-run-preflight.ts b/apps/mirai-gui/client/src/features/chat/services/chat-run-preflight.tsnew file mode 100644index 000000000..2cb6a28cb--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/services/chat-run-preflight.ts@@ -0,0 +1,92 @@+import { useRuntimeSessionStore } from "@/stores/use-runtime-session-store";+import { useChatSessionStore } from "@/stores/use-chat-session-store";+import { useChatStore } from "@/stores/use-chat-store";+import { isOtherChatGenerating } from "@/features/runtime/runtime-busy";+import { ejectAndWait } from "@/features/runtime/eject-runtime-session";+import type { RuntimeSessionRef } from "@/types/session";+import { ChatRunBlockReason, type ChatRunReadyResult } from "../types";++type UiContext = {+ chatId: string;+ modelId: string | null | undefined;+};++const getUiBlockReason = (ctx: UiContext): ChatRunBlockReason | null => {+ if (!ctx.modelId) return ChatRunBlockReason.NoModel;+ if (useChatStore.getState().autoSelectSuppressed?.[ctx.chatId]) return ChatRunBlockReason.AutoSelectSuppressed;+ if (isOtherChatGenerating(useChatSessionStore.getState(), ctx.chatId)) return ChatRunBlockReason.OtherChatGenerating;+ return null;+};++const getSessionBlockReason = (target: RuntimeSessionRef): ChatRunBlockReason | null => {+ const state = useChatSessionStore.getState();++ const residentSession = useRuntimeSessionStore.getState().residentSession;+ const residentConflict = !!residentSession && residentSession.repoId !== target.repoId;++ if (state.isModelLoading) return ChatRunBlockReason.Loading;+ if (state.isEjecting || state.operationState === "ejecting") return ChatRunBlockReason.Ejecting;+ if (state.isTitleGenerating) return ChatRunBlockReason.TitleGenerating;+ if (state.isGenerating || state.operationState === "running") return ChatRunBlockReason.Running;+ if (state.operationState === "stopping") return ChatRunBlockReason.Stopping;+ if (residentConflict) return ChatRunBlockReason.ResidentConflict;+ return null;+};++export const getChatRunBlockMessage = (reason: ChatRunBlockReason): string => {+ switch (reason) {+ case ChatRunBlockReason.NoModel:+ return "Please select a model first.";+ case ChatRunBlockReason.AutoSelectSuppressed:+ return "Please select a model first.";+ case ChatRunBlockReason.OtherChatGenerating:+ return "Another chat is generating a response.";+ case ChatRunBlockReason.Running:+ return "A response is already generating.";+ case ChatRunBlockReason.Stopping:+ return "Stopping current generation, please wait";+ case ChatRunBlockReason.TitleGenerating:+ return "Generating chat title, please wait";+ case ChatRunBlockReason.Ejecting:+ return "Ejecting previous model, please wait";+ case ChatRunBlockReason.Loading:+ return "Loading model, please wait";+ case ChatRunBlockReason.EjectFailed:+ return "Failed to eject previous model";+ case ChatRunBlockReason.ResidentConflict:+ return "Model is not ready yet, please wait";+ default:+ return "Model is not ready yet, please wait";+ }+};++type PreflightOptions = {+ onEjectStart?: () => void;+};++export const prepareChatModelForRun = async (+ ctx: UiContext,+ target: RuntimeSessionRef,+ options?: PreflightOptions,+): Promise<ChatRunReadyResult> => {+ const uiReason = getUiBlockReason(ctx);+ if (uiReason) return { ok: false, reason: uiReason };++ const initialReason = getSessionBlockReason(target);+ if (initialReason === ChatRunBlockReason.ResidentConflict) {+ const state = useChatSessionStore.getState();+ const resident = useRuntimeSessionStore.getState().residentSession;+ if (!resident || !state.canEject()) return { ok: false, reason: initialReason };+ options?.onEjectStart?.();+ const ejected = await ejectAndWait(resident).catch((error: unknown) => {+ console.error("[chat] eject before run failed", { repoId: resident.repoId }, error);+ return false;+ });+ if (!ejected) return { ok: false, reason: ChatRunBlockReason.EjectFailed };+ } else if (initialReason) {+ return { ok: false, reason: initialReason };+ }++ const nextReason = getSessionBlockReason(target);+ return nextReason ? { ok: false, reason: nextReason } : { ok: true };+};diff --git a/apps/mirai-gui/client/src/features/chat/services/export-chats.ts b/apps/mirai-gui/client/src/features/chat/services/export-chats.tsnew file mode 100644index 000000000..5cb1ab0b4--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/services/export-chats.ts@@ -0,0 +1,40 @@+import { format } from "date-fns";+import { getPlatform } from "@/platform/platform-singleton";+import { platformInfo } from "@/platform/platform-info";++function triggerBrowserDownload(data: Uint8Array, filename: string): void {+ const blob = new Blob([data as unknown as BlobPart], { type: "application/zip" });+ const url = URL.createObjectURL(blob);+ try {+ const a = document.createElement("a");+ a.href = url;+ a.download = filename;+ document.body.appendChild(a);+ a.click();+ a.remove();+ } finally {+ setTimeout(() => URL.revokeObjectURL(url), 0);+ }+}++export async function exportAllChatsZip(): Promise<boolean> {+ const { storage, dialogs } = getPlatform();+ const data = await storage.exportAllChatsZip();+ if (!data) return false;++ const humanDate = format(Date.now(), "dd.MM.yyyy HH.mm");+ const defaultName = `mirai-chats ${humanDate}.zip`;++ if (!platformInfo.features.fileSystem) {+ triggerBrowserDownload(data, defaultName);+ return true;+ }++ const targetPath = await dialogs.showSaveDialog({+ title: "Export chats",+ defaultPath: defaultName,+ filters: [{ name: "ZIP archive", extensions: ["zip"] }],+ });+ if (!targetPath) return false;+ return !!(await storage.saveBinaryFile(targetPath, data));+}diff --git a/apps/mirai-gui/client/src/features/chat/services/message-format.test.ts b/apps/mirai-gui/client/src/features/chat/services/message-format.test.tsnew file mode 100644index 000000000..307cb7ce0--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/services/message-format.test.ts@@ -0,0 +1,23 @@+import { expect, it } from "vitest";+import { Roles } from "@/types/chat";+import { normalizeMessagesForRun } from "./message-format";++it("keeps both texts when two user turns follow each other", () => {+ const out = normalizeMessagesForRun([+ { role: Roles.User, content: "first question" },+ { role: Roles.User, content: "a follow-up" },+ ]);++ expect(out).toEqual([{ role: Roles.User, content: "first question\n\na follow-up" }]);+});++it("drops empty assistant turns and keeps alternation", () => {+ const out = normalizeMessagesForRun([+ { role: Roles.User, content: "q" },+ { role: Roles.Assistant, content: "" },+ { role: Roles.Assistant, content: "a" },+ { role: Roles.User, content: "q2" },+ ]);++ expect(out.map((m) => m.role)).toEqual([Roles.User, Roles.Assistant, Roles.User]);+});diff --git a/apps/mirai-gui/client/src/features/chat/services/message-format.ts b/apps/mirai-gui/client/src/features/chat/services/message-format.tsnew file mode 100644index 000000000..2d91b8f7e--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/services/message-format.ts@@ -0,0 +1,37 @@+import type { AttachedFile } from "@/types/files";+import type { ChatRole } from "@/types/chat";+import { Roles } from "@/types/chat";++export const formatMessageWithAttachments = (text: string, files: AttachedFile[]): string =>+ files.length === 0+ ? text+ : files.reduce((acc, file) => acc + `\n\n\`\`\`${file.extension || "txt"}\n${file.content}\n\`\`\``, text);++export type ChatRunMessage = {+ role: ChatRole;+ content: string;+ reasoningContent?: string;+};++export const normalizeMessagesForRun = (messages: ChatRunMessage[]): ChatRunMessage[] => {+ const leading = messages[0];+ const system = leading?.role === Roles.System ? [leading] : [];+ const rest = system.length > 0 ? messages.slice(1) : messages;++ const cleaned = rest.filter((m) =>+ m.role === Roles.User ? true : m.role === Roles.Assistant ? m.content.trim().length > 0 : false,+ );++ const alternated = cleaned.reduce<ChatRunMessage[]>((acc, m) => {+ const prev = acc.at(-1);+ if (!prev) {+ return m.role === Roles.User ? [m] : acc;+ }+ // Two user turns in a row follow a stopped reply; dropping either would lose text.+ return prev.role === m.role+ ? [...acc.slice(0, -1), { ...prev, content: `${prev.content}\n\n${m.content}` }]+ : [...acc, m];+ }, []);++ return system.concat(alternated);+};diff --git a/apps/mirai-gui/client/src/features/chat/services/regenerate-versions.ts b/apps/mirai-gui/client/src/features/chat/services/regenerate-versions.tsnew file mode 100644index 000000000..b99d960c3--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/services/regenerate-versions.ts@@ -0,0 +1,49 @@+import type { Message, MessageVersion } from "@/types/message";+import { v4 as uuidv4 } from "uuid";++// If the target has no versions yet, freeze its body as version 0 so+// perf/stats/output/error from the prior turn are preserved.+export const projectAssistantVersion = (+ target: Message,+ modelId: string,+ modelName: string,+ attachmentIds?: string[],+): MessageVersion[] => {+ const newVersion: MessageVersion = {+ id: uuidv4(),+ text: "",+ modelId,+ modelName,+ timestamp: Date.now(),+ perf: {},+ attachmentIds,+ };++ if (Array.isArray(target.versions) && target.versions.length > 0) {+ return [...target.versions, newVersion];+ }++ const frozenOriginal: MessageVersion = {+ id: uuidv4(),+ text: target.text,+ modelId: target.modelId || "",+ modelName: target.modelName || "",+ timestamp: target.timestamp,+ attachmentIds: target.attachmentIds,+ ...(target.perf ? { perf: target.perf } : {}),+ ...(target.stats ? { stats: target.stats } : {}),+ ...(target.error ? { error: target.error } : {}),+ ...(target.output?.text?.parsed ? { output: { text: { parsed: target.output.text.parsed } } } : {}),+ };++ return [frozenOriginal, newVersion];+};++export const patchActiveVersion = (+ versions: MessageVersion[] | undefined,+ patch: Partial<MessageVersion>,+): MessageVersion[] => {+ const active = versions?.at(-1);+ if (!versions || !active) return versions ?? [];+ return [...versions.slice(0, -1), { ...active, ...patch }];+};diff --git a/apps/mirai-gui/client/src/features/chat/services/reveal-loop.test.ts b/apps/mirai-gui/client/src/features/chat/services/reveal-loop.test.tsnew file mode 100644index 000000000..3dc63d967--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/services/reveal-loop.test.ts@@ -0,0 +1,56 @@+import { afterEach, expect, it, vi } from "vitest";+import { createRevealLoop } from "./reveal-loop";++const setVisibility = (state: DocumentVisibilityState) =>+ Object.defineProperty(document, "visibilityState", { configurable: true, get: () => state });++afterEach(() => {+ setVisibility("visible");+ vi.restoreAllMocks();+});++it("shows everything at once and settles drain while the window is hidden", async () => {+ setVisibility("hidden");+ const raf = vi.spyOn(window, "requestAnimationFrame");+ const applied: string[] = [];+ const loop = createRevealLoop({ baseText: "", isActive: () => true, apply: (text) => applied.push(text) });++ loop.append("Hello");+ loop.append(" world");+ await loop.drain();++ expect(applied.at(-1)).toBe("Hello world");+ expect(raf).not.toHaveBeenCalled();+});++it("settles drain when the window is hidden after a frame was already requested", async () => {+ const raf = vi.spyOn(window, "requestAnimationFrame").mockReturnValue(1);+ const caf = vi.spyOn(window, "cancelAnimationFrame").mockImplementation(() => {});+ const applied: string[] = [];+ const loop = createRevealLoop({ baseText: "", isActive: () => true, apply: (text) => applied.push(text) });++ loop.append("Hello");+ expect(raf).toHaveBeenCalledTimes(1);+ setVisibility("hidden");+ loop.append(" world");+ await loop.drain();++ expect(caf).toHaveBeenCalledWith(1);+ expect(applied.at(-1)).toBe("Hello world");+});++it("settles a drain already waiting for a frame when the window is hidden", async () => {+ vi.spyOn(window, "requestAnimationFrame").mockReturnValue(1);+ const caf = vi.spyOn(window, "cancelAnimationFrame").mockImplementation(() => {});+ const applied: string[] = [];+ const loop = createRevealLoop({ baseText: "", isActive: () => true, apply: (text) => applied.push(text) });++ loop.append("Hello world");+ const drained = loop.drain();+ setVisibility("hidden");+ document.dispatchEvent(new Event("visibilitychange"));+ await drained;++ expect(caf).toHaveBeenCalledWith(1);+ expect(applied.at(-1)).toBe("Hello world");+});diff --git a/apps/mirai-gui/client/src/features/chat/services/reveal-loop.ts b/apps/mirai-gui/client/src/features/chat/services/reveal-loop.tsnew file mode 100644index 000000000..e56a0785e--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/services/reveal-loop.ts@@ -0,0 +1,92 @@+import { RevealPacer } from "./reveal-pacer";++type RevealLoopOptions = {+ baseText: string;+ /** False once another run has taken over; the loop then stops without applying anything. */+ isActive: () => boolean;+ apply: (visibleText: string) => void;+};++export type RevealLoop = {+ append: (delta: string) => void;+ /** Resolves once everything appended so far is on screen, or once the loop is cancelled. */+ drain: () => Promise<void>;+ cancel: () => void;+};++// Drives a RevealPacer from requestAnimationFrame, so received text reaches the+// store once per frame instead of once per chunk.+export const createRevealLoop = ({ baseText, isActive, apply }: RevealLoopOptions): RevealLoop => {+ const pacer = new RevealPacer(baseText);+ let lastFrameAt = 0;+ let frame: number | null = null;+ let waiters: Array<() => void> = [];++ const releaseWaiters = (): void => {+ const pending = waiters;+ waiters = [];+ pending.forEach((resolve) => resolve());+ };++ // A hidden window gets no animation frames, even one already requested.+ const onVisibilityChange = (): void => {+ if (document.visibilityState === "hidden") schedule();+ };+ const cancelFrame = (): void => {+ if (frame === null) return;+ window.cancelAnimationFrame(frame);+ frame = null;+ document.removeEventListener("visibilitychange", onVisibilityChange);+ };++ const schedule = (): void => {+ if (document.visibilityState === "hidden") {+ cancelFrame();+ if (isActive()) {+ const visible = pacer.flush();+ if (visible !== null) apply(visible);+ }+ releaseWaiters();+ return;+ }+ if (frame !== null) return;+ document.addEventListener("visibilitychange", onVisibilityChange);+ frame = window.requestAnimationFrame((now) => {+ frame = null;+ document.removeEventListener("visibilitychange", onVisibilityChange);+ if (!isActive()) {+ releaseWaiters();+ return;+ }+ const dtMs = lastFrameAt === 0 ? 16 : Math.min(now - lastFrameAt, 100);+ lastFrameAt = now;+ const visible = pacer.step(dtMs);+ if (visible !== null) apply(visible);+ if (pacer.isCaughtUp) {+ releaseWaiters();+ } else {+ schedule();+ }+ });+ };++ return {+ append: (delta) => {+ pacer.append(delta);+ schedule();+ },+ drain: () => {+ pacer.markDone();+ if (pacer.isCaughtUp && frame === null) return Promise.resolve();+ return new Promise((resolve) => {+ waiters.push(resolve);+ schedule();+ });+ },+ cancel: () => {+ cancelFrame();+ pacer.reset();+ releaseWaiters();+ },+ };+};diff --git a/apps/mirai-gui/client/src/features/chat/services/reveal-pacer.test.ts b/apps/mirai-gui/client/src/features/chat/services/reveal-pacer.test.tsnew file mode 100644index 000000000..ac253cb34--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/services/reveal-pacer.test.ts@@ -0,0 +1,84 @@+import { afterEach, describe, expect, it, vi } from "vitest";+import { RevealPacer } from "./reveal-pacer";+import { createRevealLoop } from "./reveal-loop";++describe("RevealPacer", () => {+ it("holds text back during warm-up, then paces it at the measured rate", () => {+ const pacer = new RevealPacer("");+ pacer.append("hello");++ expect(pacer.step(100)).toBeNull();+ expect(pacer.step(100)).toBe("he");+ expect(pacer.isCaughtUp).toBe(false);+ });++ it("skips the warm-up once the stream is done", () => {+ const pacer = new RevealPacer("");+ pacer.append("hi");+ pacer.markDone();++ expect(pacer.step(50)).toBe("hi");+ expect(pacer.isCaughtUp).toBe(true);+ });++ it("caps the reveal rate at 600 characters per second", () => {+ const pacer = new RevealPacer("");+ pacer.append("x".repeat(10_000));++ expect(pacer.step(200)?.length).toBe(120);+ });++ it("keeps the base text visible and paces only what arrived after it", () => {+ const pacer = new RevealPacer("abc");+ pacer.append("def");++ expect(pacer.step(200)).toBe("abcdef");+ });+});++describe("createRevealLoop", () => {+ const frames: Array<(now: number) => void> = [];+ let now = 0;+ const runFrame = () => {+ now += 16;+ const pending = frames.splice(0, frames.length);+ pending.forEach((cb) => cb(now));+ };++ afterEach(() => {+ vi.unstubAllGlobals();+ frames.length = 0;+ now = 0;+ });++ it("shows the whole text before drain resolves", async () => {+ vi.stubGlobal("requestAnimationFrame", (cb: (now: number) => void) => frames.push(cb));+ vi.stubGlobal("cancelAnimationFrame", () => undefined);+ const shown: string[] = [];+ const loop = createRevealLoop({ baseText: "", isActive: () => true, apply: (text) => shown.push(text) });++ loop.append("streamed reply");+ const drained = loop.drain();+ for (let i = 0; i < 100 && frames.length > 0; i += 1) runFrame();+ await drained;++ expect(shown.at(-1)).toBe("streamed reply");+ expect(frames).toHaveLength(0);+ });++ it("stops applying once another run took over", async () => {+ vi.stubGlobal("requestAnimationFrame", (cb: (now: number) => void) => frames.push(cb));+ vi.stubGlobal("cancelAnimationFrame", () => undefined);+ const shown: string[] = [];+ let active = true;+ const loop = createRevealLoop({ baseText: "", isActive: () => active, apply: (text) => shown.push(text) });++ loop.append("first");+ active = false;+ const drained = loop.drain();+ runFrame();+ await drained;++ expect(shown).toEqual([]);+ });+});diff --git a/apps/mirai-gui/client/src/features/chat/services/reveal-pacer.ts b/apps/mirai-gui/client/src/features/chat/services/reveal-pacer.tsnew file mode 100644index 000000000..8dcc385a8--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/services/reveal-pacer.ts@@ -0,0 +1,57 @@+// Paces streamed text at the rate it arrives, measured over the frames so far.++const WARMUP_MS = 200;+const MAX_CHARS_PER_SEC = 600;+const MIN_ELAPSED_MS = 50;++export class RevealPacer {+ private received: string;+ private readonly baseLength: number;+ private revealed: number;+ private elapsedMs = 0;+ private done = false;++ constructor(baseText: string) {+ this.received = baseText;+ this.baseLength = baseText.length;+ this.revealed = baseText.length;+ }++ append(delta: string): void {+ this.received += delta;+ }++ markDone(): void {+ this.done = true;+ }++ get isCaughtUp(): boolean {+ return this.revealed >= this.received.length;+ }++ reset(): void {+ this.received = "";+ this.revealed = 0;+ }++ /** Shows everything received; returns the full text, or null if it was already visible. */+ flush(): string | null {+ if (this.revealed >= this.received.length) return null;+ this.revealed = this.received.length;+ return this.received;+ }++ // Returns newly visible text, or null if nothing changed this frame.+ step(dtMs: number): string | null {+ if (this.revealed >= this.received.length) return null;+ this.elapsedMs += dtMs;+ if (!this.done && this.elapsedMs < WARMUP_MS) return null;++ const receivedSinceBase = this.received.length - this.baseLength;+ const ratePerMs = Math.min(receivedSinceBase / Math.max(this.elapsedMs, MIN_ELAPSED_MS), MAX_CHARS_PER_SEC / 1000);+ const before = Math.floor(this.revealed);+ this.revealed = Math.min(this.received.length, this.revealed + ratePerMs * dtMs);+ const after = Math.floor(this.revealed);+ return after > before ? this.received.slice(0, after) : null;+ }+}diff --git a/apps/mirai-gui/client/src/features/chat/services/run-metrics.ts b/apps/mirai-gui/client/src/features/chat/services/run-metrics.tsnew file mode 100644index 000000000..af6e7e937--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/services/run-metrics.ts@@ -0,0 +1,17 @@+import type { SessionOutputStats } from "@/types/llm-stream";++export type RunMetrics = {+ ttftSec?: number;+ totalSec?: number;+ tps?: number;+ tokensOut: number;+};++export function getRunMetrics(stats: SessionOutputStats): RunMetrics {+ return {+ ttftSec: stats.prefillStats.duration,+ totalSec: stats.totalStats.duration,+ tps: stats.generateStats?.tokensPerSecond,+ tokensOut: stats.totalStats.tokensCountOutput,+ };+}diff --git a/apps/mirai-gui/client/src/features/chat/types.ts b/apps/mirai-gui/client/src/features/chat/types.tsnew file mode 100644index 000000000..834e829fa--- /dev/null+++ b/apps/mirai-gui/client/src/features/chat/types.ts@@ -0,0 +1,17 @@+export { Roles } from "@/types/chat";+export type { ChatRole, NonSystemRole } from "@/types/chat";++export enum ChatRunBlockReason {+ NoModel = "noModel",+ AutoSelectSuppressed = "autoSelectSuppressed",+ OtherChatGenerating = "otherChatGenerating",+ Loading = "loading",+ Ejecting = "ejecting",+ Running = "running",+ Stopping = "stopping",+ TitleGenerating = "titleGenerating",+ ResidentConflict = "residentConflict",+ EjectFailed = "ejectFailed",+}++export type ChatRunReadyResult = { ok: true } | { ok: false; reason: ChatRunBlockReason };diff --git a/apps/mirai-gui/client/src/features/local-models/components/family-card.tsx b/apps/mirai-gui/client/src/features/local-models/components/family-card.tsxnew file mode 100644index 000000000..fd8ddf8e0--- /dev/null+++ b/apps/mirai-gui/client/src/features/local-models/components/family-card.tsx@@ -0,0 +1,123 @@+import { ChevronRight } from "lucide-react";+import type { ReactNode } from "react";+import { twMerge } from "tailwind-merge";+import { Tooltip } from "@/components/ui/tooltip";+import { Text } from "@/components/ui/typography";++export type FamilyCardBadgeTone = "neutral" | "success";+export type FamilyCardBadgeVariant = "outline" | "filled";++export type FamilyCardBadge = {+ label: ReactNode;+ tooltip?: ReactNode;+ tone?: FamilyCardBadgeTone;+ variant?: FamilyCardBadgeVariant;+};++export type FamilyCardProps = {+ vendorIcon: ReactNode;+ familyName: ReactNode;+ vendorName: ReactNode;+ badges?: FamilyCardBadge[];+ onClick?: () => void;+ compact?: boolean;+};++const TONE_CLASSES: Record<FamilyCardBadgeTone, { outline: string; filled: string; text: string }> = {+ neutral: {+ outline: "border-border-outlined bg-transparent",+ filled: "border-border-outlined bg-surface-secondary",+ text: "text-text-muted",+ },+ success: {+ outline: "border-success-border bg-transparent",+ filled: "border-success-border bg-success-bg",+ text: "text-success",+ },+};++function Chip({ badge }: { badge: FamilyCardBadge }) {+ const { label, tooltip, tone = "neutral", variant = "outline" } = badge;+ const tones = TONE_CLASSES[tone];+ const surface = variant === "filled" ? tones.filled : tones.outline;++ const chip = (+ <div+ className={twMerge(+ "flex items-center justify-center h-7 px-2 py-0.5 rounded border-[0.5px] cursor-default",+ surface,+ )}+ >+ <Text+ as="span"+ opticalSize={14}+ className={twMerge("text-[13px] font-[450] leading-[1.3] whitespace-nowrap", tones.text)}+ >+ {label}+ </Text>+ </div>+ );++ if (tooltip) {+ return (+ <Tooltip content={tooltip} side="top">+ {chip}+ </Tooltip>+ );+ }+ return chip;+}++export function FamilyCard({ vendorIcon, familyName, vendorName, badges, onClick, compact = false }: FamilyCardProps) {+ const fallbackAria = typeof familyName === "string" ? `Open ${familyName} models` : undefined;++ const heading = (+ <div className="flex items-center gap-4 min-w-0 flex-1">+ <span className="shrink-0 flex items-center justify-center w-4 h-4 [&>svg]:w-4 [&>svg]:h-4">{vendorIcon}</span>+ <div className="flex items-baseline gap-1.5 min-w-0">+ <Text as="span" size="sm" color="primary" opticalSize={14} className="truncate leading-[1.5] font-[450]">+ {familyName}+ </Text>+ <Text as="span" size="sm" color="muted" opticalSize={14} className="truncate leading-[1.5] font-[450]">+ from {vendorName}+ </Text>+ </div>+ </div>+ );++ const chips = badges?.map((badge, idx) => <Chip key={idx} badge={badge} />);++ const chevron = <ChevronRight size={14} className="text-text-muted shrink-0" />;++ if (compact) {+ return (+ <button+ type="button"+ onClick={onClick}+ aria-label={fallbackAria}+ className="w-full flex flex-col items-stretch gap-3 px-4 py-3 rounded-lg border-[0.5px] border-border-default bg-surface-elevated transition-colors duration-150 cursor-pointer outline-hidden focus-visible:shadow-focus hover:bg-surface-tertiary text-left"+ >+ <div className="flex items-center gap-3 min-w-0">+ {heading}+ {chevron}+ </div>+ {chips && chips.length > 0 && <div className="flex items-center gap-1.5 flex-wrap">{chips}</div>}+ </button>+ );+ }++ return (+ <button+ type="button"+ onClick={onClick}+ aria-label={fallbackAria}+ className="w-full flex items-center justify-between gap-4 h-12 pl-4 pr-3 rounded-lg border-[0.5px] border-border-default bg-surface-elevated transition-colors duration-150 cursor-pointer outline-hidden focus-visible:shadow-focus hover:bg-surface-tertiary"+ >+ {heading}+ <div className="flex items-center gap-1.5 shrink-0">+ {chips}+ <span className="ml-1">{chevron}</span>+ </div>+ </button>+ );+}diff --git a/apps/mirai-gui/client/src/features/local-models/components/family-detail-page.tsx b/apps/mirai-gui/client/src/features/local-models/components/family-detail-page.tsxnew file mode 100644index 000000000..8f116df32--- /dev/null+++ b/apps/mirai-gui/client/src/features/local-models/components/family-detail-page.tsx@@ -0,0 +1,103 @@+import { useIsMobile } from "@/hooks/use-media-query";+import { useModelsStore } from "@/stores/use-models-store";+import type { PlatformModel } from "@/types/models";+import { formatModelSize } from "@/utils/format";+import { ModelVendorIcon } from "@/components/model-vendor-icon";+import { ModelCard } from "./model-card";+import { ModelTable } from "./model-table";+import { useShiftHeld } from "@/hooks/use-shift-held";+import { useMemo, type MouseEvent } from "react";+import { buildFamilyDetailView, formatQuantization, toModelCardState, type FamilyEntry } from "../lib/view";++export type FamilyDetailPageProps = {+ family: FamilyEntry;+ searchQuery: string;+ sortModels: (list: PlatformModel[]) => PlatformModel[];+ onDownload: (model: PlatformModel) => Promise<void> | void;+ onPause: (model: PlatformModel) => void;+ onResume: (model: PlatformModel) => void;+ onCancel: (model: PlatformModel) => Promise<void> | void;+ onDelete: (model: PlatformModel, event: MouseEvent<HTMLElement>) => void;+ onOpen: (model: PlatformModel) => void;+};++export function FamilyDetailPage({+ family,+ searchQuery,+ sortModels,+ onDownload,+ onPause,+ onResume,+ onCancel,+ onDelete,+ onOpen,+}: FamilyDetailPageProps) {+ const isMobile = useIsMobile();+ const shiftHeld = useShiftHeld();+ const models = useModelsStore((s) => s.models);+ const modelStatesById = useModelsStore((s) => s.modelStatesById);+ const modelPhasesById = useModelsStore((s) => s.modelPhasesById);++ const detail = useMemo(+ () =>+ buildFamilyDetailView({+ models,+ modelPhasesById,+ familyIdentifier: family.familyIdentifier,+ searchLower: searchQuery.trim().toLowerCase(),+ sortModels,+ }),+ [models, modelPhasesById, family.familyIdentifier, searchQuery, sortModels],+ );++ const renderRow = (model: PlatformModel) => {+ const state = modelStatesById[model.repoId];+ const cardState = toModelCardState(state?.phase, state?.downloadedKbytes, state?.totalKbytes);+ const isPaused = cardState.status === "paused";++ const card = (+ <ModelCard+ compact={isMobile}+ name={model.name}+ logo={<ModelVendorIcon vendor={model.vendor} size={16} className="h-4 w-4" />}+ size={formatModelSize(model.size)}+ parameters={formatQuantization(model)}+ state={cardState}+ onDownload={() => void onDownload(model)}+ onPause={() => (isPaused ? onResume(model) : onPause(model))}+ onCancel={() => void onCancel(model)}+ onRetry={() => void onDownload(model)}+ onDelete={(event) => onDelete(model, event)}+ quickDelete={shiftHeld}+ onOpen={() => onOpen(model)}+ />+ );++ return <div key={model.repoId}>{card}</div>;+ };++ if (detail.installed.length === 0 && detail.available.length === 0) {+ return (+ <div className="flex min-h-[200px] items-center justify-center">+ <span className="text-[13px] text-text-muted">+ {searchQuery ? `No models matching "${searchQuery}"` : "No models in this family"}+ </span>+ </div>+ );+ }++ return (+ <div className="flex flex-col gap-6">+ {detail.installed.length > 0 && (+ <ModelTable title="Installed" compact={isMobile}>+ {detail.installed.map((m) => renderRow(m))}+ </ModelTable>+ )}+ {detail.available.length > 0 && (+ <ModelTable title="Available" compact={isMobile}>+ {detail.available.map((m) => renderRow(m))}+ </ModelTable>+ )}+ </div>+ );+}diff --git a/apps/mirai-gui/client/src/features/local-models/components/local-models-page/index.tsx b/apps/mirai-gui/client/src/features/local-models/components/local-models-page/index.tsxnew file mode 100644index 000000000..612aaa709--- /dev/null+++ b/apps/mirai-gui/client/src/features/local-models/components/local-models-page/index.tsx@@ -0,0 +1,262 @@+import { Loader } from "@/components/loader";+import { useIsMobile } from "@/hooks/use-media-query";+import { useChatStore } from "@/stores/use-chat-store";+import { useDownloadManager } from "../../hooks/use-download-manager";+import { useModelsStore } from "@/stores/use-models-store";+import type { PlatformModel } from "@/types/models";+import { ModelVendorIcon } from "@/components/model-vendor-icon";+import { createNewestTextModelComparator, createSizeAccessor } from "../../lib/model-sort";+import { useNavigate } from "@tanstack/react-router";+import { Button } from "@/components/ui/button";+import { FamilyCard, type FamilyCardBadge } from "../family-card";+import { HoverPopoverProvider } from "@/components/ui/popover/hover-popover/provider";+import { Modal } from "@/components/ui/modal";+import { Text } from "@/components/ui/typography";+import { TooltipProvider } from "@/components/ui/tooltip/provider";+import { RefreshCcw } from "lucide-react";+import { useCallback, useEffect, useMemo, useState } from "react";+import { v4 as uuidv4 } from "uuid";+import { buildFamiliesView, formatParamRange, isPartnerFamily, type FamilyEntry } from "../../lib/view";+import { FamilyDetailPage } from "../family-detail-page";+import { LocalModelsHeader } from "./local-models-header";+import { useModelDeletion } from "./use-model-deletion";++const TEXT_14 = "text-[14px] font-[450] leading-[1.5]";+const TEXT_14_STYLE = { fontVariationSettings: "'opsz' 20" } as const;++export function LocalModelsPage() {+ const navigate = useNavigate();+ const isMobile = useIsMobile();+ const createNewChat = useChatStore((s) => s.createNewChat);+ const { handleDownload, handlePause, handleResume, handleCancel } = useDownloadManager();++ const [loading, setLoading] = useState(true);+ const [searchQuery, setSearchQuery] = useState("");+ const [modelsSearch, setModelsSearch] = useState("");+ const [selectedFamilyId, setSelectedFamilyId] = useState<string | null>(null);+ const [refreshing, setRefreshing] = useState(false);++ const selectFamily = useCallback((id: string | null) => {+ setSelectedFamilyId(id);+ setModelsSearch("");+ }, []);++ const models = useModelsStore((s) => s.models);+ const loadingModels = useModelsStore((s) => s.loading);+ const modelsInitialized = useModelsStore((s) => s.initialized);+ const modelsError = useModelsStore((s) => s.error);+ const fetchModels = useModelsStore((s) => s.fetchModels);+ const getModelState = useModelsStore((s) => s.getModelState);+ const modelPhasesById = useModelsStore((s) => s.modelPhasesById);+ const installedAtById = useModelsStore((s) => s.installedAtById);++ const { pendingDeleteModel, isDeletingModel, requestDeleteModel, confirmDeleteModel, closeDeleteModal } =+ useModelDeletion(fetchModels);++ useEffect(() => {+ const loadPage = async () => {+ try {+ await fetchModels();+ } finally {+ setLoading(false);+ }+ };++ void loadPage();+ }, [fetchModels]);++ const getSize = useMemo(() => createSizeAccessor(getModelState), [getModelState]);+ const newestTextModelComparator = useMemo(() => createNewestTextModelComparator(), []);++ const sortModels = useCallback(+ (list: PlatformModel[]) => {+ const next = [...list];+ next.sort((a, b) => {+ const sizeDiff = getSize(a) - getSize(b);+ if (sizeDiff !== 0) return sizeDiff;+ return newestTextModelComparator(a, b);+ });+ return next;+ },+ [getSize, newestTextModelComparator],+ );++ const searchLower = searchQuery.trim().toLowerCase();++ const families: FamilyEntry[] = useMemo(+ () => buildFamiliesView({ models, modelPhasesById, installedAtById, searchLower }),+ [models, modelPhasesById, installedAtById, searchLower],+ );++ const selectedFamily = useMemo(+ () => (selectedFamilyId ? families.find((f) => f.familyIdentifier === selectedFamilyId) : undefined),+ [families, selectedFamilyId],+ );++ const handleInstalledModelClick = useCallback(+ (model: PlatformModel) => {+ const newChatId = uuidv4();+ createNewChat(newChatId);+ navigate({+ to: "/chat/$chatId",+ params: { chatId: newChatId },+ search: {+ model: model.repoId,+ modelName: model.name,+ isNew: true,+ },+ });+ },+ [createNewChat, navigate],+ );++ const handleRefresh = useCallback(async () => {+ try {+ setRefreshing(true);+ await fetchModels();+ } finally {+ setRefreshing(false);+ }+ }, [fetchModels]);++ if (loading || loadingModels || !modelsInitialized) {+ return (+ <div className="flex h-[calc(100vh-24px)] items-center justify-center">+ <Loader />+ </div>+ );+ }++ return (+ <TooltipProvider>+ <HoverPopoverProvider>+ <div className="flex h-[calc(100vh-24px)] flex-col bg-background">+ <div className="w-full flex h-full overflow-hidden bg-surface-elevated">+ <div className="flex-1 min-w-0 flex flex-col">+ <LocalModelsHeader+ selectedFamily={selectedFamily}+ isMobile={isMobile}+ searchQuery={searchQuery}+ modelsSearch={modelsSearch}+ onSearchQueryChange={setSearchQuery}+ onModelsSearchChange={setModelsSearch}+ onBack={() => selectFamily(null)}+ />+ <div style={{ borderBottom: "0.5px solid var(--color-border-default)" }}></div>++ <div className="flex-1 overflow-y-auto scrollbar-hide">+ <div className="px-4 py-4">+ {modelsError ? (+ <div className="my-4">+ <div className="flex items-start gap-2 rounded-md border border-red-200 bg-red-50 p-3 dark:border-red-800 dark:bg-red-900/20">+ <div className="mt-[6px] h-2 w-2 rounded-full bg-red-500" />+ <div className="flex-1">+ <div className="text-sm text-red-700 dark:text-red-300">Failed to load models</div>+ <div className="mt-1 break-all text-xs text-red-700/80 dark:text-red-300/80">+ {modelsError}+ </div>+ </div>+ <div className="shrink-0">+ <Button+ icon={<RefreshCcw size={16} />}+ kind="secondary"+ size="sm"+ loading={refreshing}+ disabled={refreshing}+ onClick={handleRefresh}+ >+ {refreshing ? "Retrying…" : "Retry"}+ </Button>+ </div>+ </div>+ </div>+ ) : models.length === 0 ? (+ <div className="flex min-h-[320px] items-center justify-center">+ <span className={`${TEXT_14} text-text-muted`} style={TEXT_14_STYLE}>+ No models available for this device+ </span>+ </div>+ ) : selectedFamily ? (+ <FamilyDetailPage+ family={selectedFamily}+ searchQuery={modelsSearch}+ sortModels={sortModels}+ onDownload={handleDownload}+ onPause={handlePause}+ onResume={handleResume}+ onCancel={handleCancel}+ onDelete={requestDeleteModel}+ onOpen={handleInstalledModelClick}+ />+ ) : families.length === 0 ? (+ <div className="flex min-h-[200px] items-center justify-center">+ <span className="text-[13px] text-text-muted">+ {searchQuery ? `No families matching "${searchQuery}"` : "No model families"}+ </span>+ </div>+ ) : (+ <div className="flex flex-col gap-1.5">+ {families.map((family) => {+ const sizeRange = formatParamRange(family.paramRange?.min, family.paramRange?.max);+ const badges: FamilyCardBadge[] = [+ ...(isPartnerFamily(family.familyName)+ ? [+ {+ label: "Partner",+ tooltip: "Partner of Mirai — co-developed and verified to work on your hardware",+ tone: "success" as const,+ variant: "filled" as const,+ },+ ]+ : []),+ {+ label: `${family.totalCount} ${family.totalCount === 1 ? "model" : "models"}`,+ },+ ...(family.installedCount > 0+ ? [+ {+ label: `${family.installedCount} installed ${family.installedCount === 1 ? "model" : "models"}`,+ tone: "success" as const,+ },+ ]+ : []),+ ...(sizeRange ? [{ label: sizeRange }] : []),+ ];+ return (+ <FamilyCard+ key={family.familyIdentifier}+ compact={isMobile}+ vendorIcon={<ModelVendorIcon vendor={family.vendor} size={16} className="h-4 w-4" />}+ familyName={family.familyName}+ vendorName={family.vendor}+ badges={badges}+ onClick={() => selectFamily(family.familyIdentifier)}+ />+ );+ })}+ </div>+ )}+ </div>+ </div>+ </div>+ </div>+ <Modal+ open={pendingDeleteModel != null}+ onClose={closeDeleteModal}+ title="Delete model"+ primaryLabel="Delete"+ primaryKind="danger"+ primaryDisabled={isDeletingModel}+ onPrimary={() => {+ void confirmDeleteModel();+ }}+ >+ <Text as="p" color="secondary" opticalSize={20} className="text-[15px] font-[450] leading-[1.6]">+ Are you sure you want to delete model "{pendingDeleteModel?.repoId ?? ""}"? This action cannot be undone.+ </Text>+ </Modal>+ </div>+ </HoverPopoverProvider>+ </TooltipProvider>+ );+}diff --git a/apps/mirai-gui/client/src/features/local-models/components/local-models-page/local-models-header.tsx b/apps/mirai-gui/client/src/features/local-models/components/local-models-page/local-models-header.tsxnew file mode 100644index 000000000..5cb66427d--- /dev/null+++ b/apps/mirai-gui/client/src/features/local-models/components/local-models-page/local-models-header.tsx@@ -0,0 +1,92 @@+import { ChevronLeft, MonitorSmartphone } from "lucide-react";+import { PageHeader } from "@/components/page-header";+import type { FamilyEntry } from "../../lib/view";+import { IconAction } from "@/components/ui/icon-action";+import { SearchInput } from "@/components/ui/search-input";+import { Tooltip } from "@/components/ui/tooltip";+import { ModelVendorIcon } from "@/components/model-vendor-icon";++const TEXT_14 = "text-[14px] font-[450] leading-[1.5]";+const TEXT_14_STYLE = { fontVariationSettings: "'opsz' 20" } as const;++type LocalModelsHeaderProps = {+ selectedFamily?: FamilyEntry;+ isMobile: boolean;+ searchQuery: string;+ modelsSearch: string;+ onSearchQueryChange: (value: string) => void;+ onModelsSearchChange: (value: string) => void;+ onBack: () => void;+};++export function LocalModelsHeader({+ selectedFamily,+ isMobile,+ searchQuery,+ modelsSearch,+ onSearchQueryChange,+ onModelsSearchChange,+ onBack,+}: LocalModelsHeaderProps) {+ const search = selectedFamily+ ? { value: modelsSearch, onChange: onModelsSearchChange, placeholder: "Search models" }+ : { value: searchQuery, onChange: onSearchQueryChange, placeholder: "Search families" };++ return (+ <>+ <PageHeader+ title={+ <div data-tauri-drag-region="deep" className="flex h-[52px] shrink-0 items-center gap-2 px-4 min-w-0">+ {selectedFamily ? (+ <>+ <Tooltip content="Back to families" side="bottom">+ <span className="shrink-0">+ <IconAction label="Back to families" icon={<ChevronLeft size={16} />} onClick={onBack} />+ </span>+ </Tooltip>+ <ModelVendorIcon vendor={selectedFamily.vendor} size={16} className="h-4 w-4" />+ <span className={`${TEXT_14} text-text-primary truncate`} style={TEXT_14_STYLE}>+ {selectedFamily.familyName}+ </span>+ {!isMobile && (+ <span className={`${TEXT_14} text-text-muted truncate`} style={TEXT_14_STYLE}>+ from {selectedFamily.vendor}+ </span>+ )}+ </>+ ) : (+ <>+ <MonitorSmartphone size={16} className="text-text-primary shrink-0" />+ <span className={`${TEXT_14} text-text-primary truncate`} style={TEXT_14_STYLE}>+ Choose local model to chat+ </span>+ </>+ )}+ <div className="flex-1" />+ {!isMobile && (+ <SearchInput+ value={search.value}+ onChange={search.onChange}+ placeholder={search.placeholder}+ className="w-[260px] shrink-0"+ />+ )}+ </div>+ }+ />+ {isMobile && (+ <div+ className="flex shrink-0 items-center gap-2 px-4 py-2"+ style={{ borderTop: "0.5px solid var(--color-border-default)" }}+ >+ <SearchInput+ value={search.value}+ onChange={search.onChange}+ placeholder={search.placeholder}+ className="min-w-0 flex-1"+ />+ </div>+ )}+ </>+ );+}diff --git a/apps/mirai-gui/client/src/features/local-models/components/local-models-page/use-model-deletion.ts b/apps/mirai-gui/client/src/features/local-models/components/local-models-page/use-model-deletion.tsnew file mode 100644index 000000000..3c869e542--- /dev/null+++ b/apps/mirai-gui/client/src/features/local-models/components/local-models-page/use-model-deletion.ts@@ -0,0 +1,68 @@+import { useToast } from "@/components/ui/toast/use-toast";+import { ejectRuntimeSessionAndWait } from "@/features/runtime/eject-runtime-session";+import { useModelsStore } from "@/stores/use-models-store";+import { useRuntimeSessionStore } from "@/stores/use-runtime-session-store";+import type { PlatformModel } from "@/types/models";+import { useCallback, useState, type MouseEvent } from "react";++type ModelDeletion = {+ pendingDeleteModel: PlatformModel | null;+ isDeletingModel: boolean;+ requestDeleteModel: (model: PlatformModel, event: MouseEvent<HTMLElement>) => void;+ confirmDeleteModel: () => Promise<void>;+ closeDeleteModal: () => void;+};++export function useModelDeletion(fetchModels: () => Promise<void>): ModelDeletion {+ const toast = useToast();+ const [pendingDeleteModel, setPendingDeleteModel] = useState<PlatformModel | null>(null);+ const [isDeletingModel, setIsDeletingModel] = useState(false);++ const deleteModel = useCallback(+ async (model: PlatformModel) => {+ try {+ const residentSession = useRuntimeSessionStore.getState().residentSession;+ if (residentSession?.repoId === model.repoId) {+ await ejectRuntimeSessionAndWait({ target: residentSession });+ }++ await useModelsStore.getState().deleteLocalModel(model.repoId);+ toast.success(`Uninstalled ${model.name}`);+ } catch (error) {+ toast.error(`Failed to uninstall ${model.name}`);+ console.error(error);+ } finally {+ await fetchModels();+ }+ },+ [fetchModels, toast],+ );++ const requestDeleteModel = useCallback(+ (model: PlatformModel, event: MouseEvent<HTMLElement>) => {+ if (event.shiftKey) {+ void deleteModel(model);+ return;+ }+ setPendingDeleteModel(model);+ },+ [deleteModel],+ );++ const confirmDeleteModel = useCallback(async () => {+ if (!pendingDeleteModel || isDeletingModel) return;+ setIsDeletingModel(true);+ try {+ await deleteModel(pendingDeleteModel);+ } finally {+ setIsDeletingModel(false);+ setPendingDeleteModel(null);+ }+ }, [deleteModel, pendingDeleteModel, isDeletingModel]);++ const closeDeleteModal = useCallback(() => {+ setPendingDeleteModel(null);+ }, []);++ return { pendingDeleteModel, isDeletingModel, requestDeleteModel, confirmDeleteModel, closeDeleteModal };+}diff --git a/apps/mirai-gui/client/src/features/local-models/components/model-card/chip.tsx b/apps/mirai-gui/client/src/features/local-models/components/model-card/chip.tsxnew file mode 100644index 000000000..f47d91106--- /dev/null+++ b/apps/mirai-gui/client/src/features/local-models/components/model-card/chip.tsx@@ -0,0 +1,31 @@+import type { ReactNode } from "react";+import { twMerge } from "tailwind-merge";+import { Text } from "@/components/ui/typography";++function Chip({ children, className }: { children: ReactNode; className?: string }) {+ return (+ <div+ className={twMerge(+ "group/chip flex items-center justify-center h-7 px-2 py-0.5 rounded border-[0.5px] border-border-outlined bg-transparent hover:border-border-outlined-hover",+ className,+ )}+ >+ {children}+ </div>+ );+}++export function ChipText({ children }: { children: ReactNode }) {+ return (+ <Chip>+ <Text+ as="span"+ color="muted"+ opticalSize={14}+ className="text-[13px] font-[450] leading-[1.3] group-hover/chip:text-text-primary"+ >+ {children}+ </Text>+ </Chip>+ );+}diff --git a/apps/mirai-gui/client/src/features/local-models/components/model-card/download-actions.tsx b/apps/mirai-gui/client/src/features/local-models/components/model-card/download-actions.tsxnew file mode 100644index 000000000..8ea9b4274--- /dev/null+++ b/apps/mirai-gui/client/src/features/local-models/components/model-card/download-actions.tsx@@ -0,0 +1,86 @@+import { Download, RefreshCw, X } from "lucide-react";+import { IconAction } from "@/components/ui/icon-action";+import { IconPauseFilled } from "@/components/icons/pause-filled-icon";+import { IconPlayFilled } from "@/components/icons/play-filled-icon";+import { Tooltip } from "@/components/ui/tooltip";+import type { ModelCardStatus } from "./types";++const ACTION_BUTTON_CLASS =+ "h-7 px-1.5 py-0.5 rounded bg-border-default text-text-primary hover:bg-control-surface-hover active:bg-control-surface-active";++type DownloadActionsProps = {+ status: ModelCardStatus;+ isDownloading: boolean;+ isPaused: boolean;+ isError: boolean;+ onDownload?: () => void;+ onPause?: () => void;+ onCancel?: () => void;+ onRetry?: () => void;+};++export function DownloadActions({+ status,+ isDownloading,+ isPaused,+ isError,+ onDownload,+ onPause,+ onCancel,+ onRetry,+}: DownloadActionsProps) {+ return (+ <>+ {isError && onRetry && (+ <Tooltip content="Retry" side="top">+ <span>+ <IconAction+ label="Retry download"+ icon={<RefreshCw size={14} />}+ onClick={onRetry}+ className={ACTION_BUTTON_CLASS}+ />+ </span>+ </Tooltip>+ )}+ {status === "available" && onDownload && (+ <Tooltip content="Download" side="top">+ <span>+ <IconAction+ label="Download model"+ icon={<Download size={16} />}+ onClick={onDownload}+ className={ACTION_BUTTON_CLASS}+ />+ </span>+ </Tooltip>+ )}+ {isDownloading && (+ <>+ <Tooltip content={isPaused ? "Resume" : "Pause"} side="top">+ <span>+ <IconAction+ label={isPaused ? "Resume download" : "Pause download"}+ icon={isPaused ? <IconPlayFilled /> : <IconPauseFilled />}+ onClick={onPause}+ className={ACTION_BUTTON_CLASS}+ />+ </span>+ </Tooltip>+ {onCancel && (+ <Tooltip content="Cancel" side="top">+ <span>+ <IconAction+ label="Cancel download"+ icon={<X size={14} />}+ onClick={onCancel}+ className={ACTION_BUTTON_CLASS}+ />+ </span>+ </Tooltip>+ )}+ </>+ )}+ </>+ );+}diff --git a/apps/mirai-gui/client/src/features/local-models/components/model-card/index.tsx b/apps/mirai-gui/client/src/features/local-models/components/model-card/index.tsxnew file mode 100644index 000000000..513af1dfa--- /dev/null+++ b/apps/mirai-gui/client/src/features/local-models/components/model-card/index.tsx@@ -0,0 +1 @@+export { ModelCardRow as ModelCard } from "./model-card-row";diff --git a/apps/mirai-gui/client/src/features/local-models/components/model-card/model-badges.tsx b/apps/mirai-gui/client/src/features/local-models/components/model-card/model-badges.tsxnew file mode 100644index 000000000..66e0a3be5--- /dev/null+++ b/apps/mirai-gui/client/src/features/local-models/components/model-card/model-badges.tsx@@ -0,0 +1,24 @@+import { Tooltip } from "@/components/ui/tooltip";+import { ChipText } from "./chip";++type ModelBadgesProps = {+ parameters?: string;+ size?: string;+};++export function ModelBadges({ parameters, size }: ModelBadgesProps) {+ return (+ <>+ {parameters && (+ <Tooltip content="Parameters" side="top">+ <ChipText>{parameters}</ChipText>+ </Tooltip>+ )}+ {size && (+ <Tooltip content="Size" side="top">+ <ChipText>{size}</ChipText>+ </Tooltip>+ )}+ </>+ );+}diff --git a/apps/mirai-gui/client/src/features/local-models/components/model-card/model-card-row.tsx b/apps/mirai-gui/client/src/features/local-models/components/model-card/model-card-row.tsxnew file mode 100644index 000000000..72f6d26e7--- /dev/null+++ b/apps/mirai-gui/client/src/features/local-models/components/model-card/model-card-row.tsx@@ -0,0 +1,139 @@+import type { KeyboardEvent } from "react";+import { twMerge } from "tailwind-merge";+import { IconCheckStroke } from "@/components/icons/check-stroke-icon";+import { Tooltip } from "@/components/ui/tooltip";+import { Text } from "@/components/ui/typography";+import type { ModelCardProps } from "./types";+import { deriveModelCardState } from "./model-card-state";+import { DownloadActions } from "./download-actions";+import { ModelBadges } from "./model-badges";+import { ModelHeading } from "./model-heading";+import { ModelOptions } from "./model-options";++export function ModelCardRow({+ name,+ logo,+ parameters,+ size,+ state,+ onDownload,+ onPause,+ onCancel,+ onDelete,+ onRetry,+ onOpen,+ compact = false,+ quickDelete = false,+}: ModelCardProps) {+ const { status, isDownloading, isDownloaded, isPaused, isError, progress } = deriveModelCardState(state);++ return (+ <div+ className={twMerge(+ "relative py-2.5 transition-colors duration-150",+ isDownloaded && "cursor-pointer hover:bg-surface-tertiary outline-hidden focus-visible:shadow-focus",+ isError && "bg-danger-bg",+ )}+ {...(isDownloaded && onOpen+ ? {+ tabIndex: 0,+ onClick: onOpen,+ onKeyDown: (event: KeyboardEvent<HTMLDivElement>) => {+ if (event.target !== event.currentTarget) return;+ if (event.key === "Enter" || event.key === " ") {+ event.preventDefault();+ onOpen();+ }+ },+ }+ : {})}+ >+ <div+ className={twMerge(+ "grid gap-3 pl-4 pr-3 items-center",+ compact ? "grid-cols-[minmax(0,1fr)_auto]" : "grid-cols-[minmax(0,1fr)_80px_200px_120px]",+ )}+ >+ <ModelHeading name={name} logo={logo} />++ {!compact && (+ <div className="text-left">+ {size && (+ <Text+ as="span"+ color="muted"+ opticalSize={14}+ className="text-[13px] font-[450] leading-[1.3] tabular-nums"+ >+ {size}+ </Text>+ )}+ </div>+ )}++ {!compact && (+ <div className="text-left min-w-0">+ {parameters && (+ <Text+ as="span"+ color="muted"+ opticalSize={14}+ className="text-[13px] font-[450] leading-[1.3] truncate block"+ >+ {parameters}+ </Text>+ )}+ </div>+ )}++ <div className="flex items-center justify-end gap-1.5">+ {isDownloading && (+ <Text+ as="span"+ opticalSize={14}+ className="text-[12px] font-[450] leading-[1.3] text-text-muted tabular-nums w-9 text-right"+ >+ {Math.round(progress)}%+ </Text>+ )}+ <DownloadActions+ status={status}+ isDownloading={isDownloading}+ isPaused={isPaused}+ isError={isError}+ onDownload={onDownload}+ onPause={onPause}+ onCancel={onCancel}+ onRetry={onRetry}+ />+ {isDownloaded && (+ <>+ <Tooltip content="Installed" side="top">+ <div className="flex items-center justify-center h-7 w-7 rounded border-[0.5px] border-border-outlined text-success">+ <IconCheckStroke />+ </div>+ </Tooltip>+ <div className="relative" onClick={(event) => event.stopPropagation()}>+ <ModelOptions quickDelete={quickDelete} onDelete={onDelete} />+ </div>+ </>+ )}+ </div>+ </div>++ {compact && (size || parameters) && (+ <div className="mt-2.5 pl-4 pr-3 flex items-center gap-1.5 flex-wrap">+ <ModelBadges parameters={parameters} size={size} />+ </div>+ )}++ {isDownloading && (+ <div className="mt-2.5 pl-4 pr-3">+ <div className="h-0.5 bg-border-default rounded overflow-hidden">+ <div className="h-full bg-primary transition-[width] duration-200" style={{ width: `${progress}%` }} />+ </div>+ </div>+ )}+ </div>+ );+}diff --git a/apps/mirai-gui/client/src/features/local-models/components/model-card/model-card-state.ts b/apps/mirai-gui/client/src/features/local-models/components/model-card/model-card-state.tsnew file mode 100644index 000000000..3d4d3b00e--- /dev/null+++ b/apps/mirai-gui/client/src/features/local-models/components/model-card/model-card-state.ts@@ -0,0 +1,19 @@+import type { ModelCardState, ModelCardStatus } from "./types";++export function deriveModelCardState(state: ModelCardState = { status: "available" }): {+ status: ModelCardStatus;+ isDownloading: boolean;+ isDownloaded: boolean;+ isPaused: boolean;+ isError: boolean;+ progress: number;+} {+ return {+ status: state.status,+ isDownloading: state.status === "downloading" || state.status === "paused",+ isDownloaded: state.status === "downloaded",+ isPaused: state.status === "paused",+ isError: state.status === "error",+ progress: ("progress" in state ? state.progress : undefined) ?? 0,+ };+}diff --git a/apps/mirai-gui/client/src/features/local-models/components/model-card/model-heading.tsx b/apps/mirai-gui/client/src/features/local-models/components/model-card/model-heading.tsxnew file mode 100644index 000000000..4a3d62c75--- /dev/null+++ b/apps/mirai-gui/client/src/features/local-models/components/model-card/model-heading.tsx@@ -0,0 +1,18 @@+import type { ReactNode } from "react";+import { Text } from "@/components/ui/typography";++type ModelHeadingProps = {+ name: string;+ logo: ReactNode;+};++export function ModelHeading({ name, logo }: ModelHeadingProps) {+ return (+ <div className="flex items-center gap-3 min-w-0">+ <span className="shrink-0 flex items-center justify-center w-4 h-4 [&>svg]:w-4 [&>svg]:h-4">{logo}</span>+ <Text as="span" size="sm" color="primary" opticalSize={14} className="truncate leading-[1.5] font-[450]">+ {name}+ </Text>+ </div>+ );+}diff --git a/apps/mirai-gui/client/src/features/local-models/components/model-card/model-options.tsx b/apps/mirai-gui/client/src/features/local-models/components/model-card/model-options.tsxnew file mode 100644index 000000000..cd4ae274a--- /dev/null+++ b/apps/mirai-gui/client/src/features/local-models/components/model-card/model-options.tsx@@ -0,0 +1,48 @@+import { Ellipsis, Trash2 } from "lucide-react";+import type { MouseEvent } from "react";+import { HoverPopover } from "@/components/ui/popover/hover-popover";++type ModelOptionsProps = {+ quickDelete?: boolean;+ onDelete?: (event: MouseEvent<HTMLElement>) => void;+};++export function ModelOptions({ quickDelete = false, onDelete }: ModelOptionsProps) {+ if (quickDelete) {+ return (+ <button+ type="button"+ aria-label="Delete model"+ onClick={onDelete}+ className="flex items-center justify-center h-7 w-7 rounded cursor-pointer text-danger bg-transparent hover:border-border-outlined-hover border-[0.5px] border-border-outlined outline-hidden focus-visible:shadow-focus"+ >+ <Trash2 size={14} />+ </button>+ );+ }++ return (+ <HoverPopover+ side="top"+ align="end"+ trigger={+ <button+ type="button"+ aria-label="Model options"+ className="group/chip flex items-center justify-center h-7 w-7 rounded cursor-pointer text-text-muted hover:text-text-primary bg-transparent hover:border-border-outlined-hover border-[0.5px] border-border-outlined outline-hidden focus-visible:shadow-focus"+ >+ <Ellipsis size={16} />+ </button>+ }+ items={[+ {+ id: "delete",+ label: "Delete",+ icon: <Trash2 size={14} />,+ danger: true,+ onClick: onDelete,+ },+ ]}+ />+ );+}diff --git a/apps/mirai-gui/client/src/features/local-models/components/model-card/types.ts b/apps/mirai-gui/client/src/features/local-models/components/model-card/types.tsnew file mode 100644index 000000000..027f73adc--- /dev/null+++ b/apps/mirai-gui/client/src/features/local-models/components/model-card/types.ts@@ -0,0 +1,26 @@+import type { MouseEvent, ReactNode } from "react";++export type ModelCardState =+ | { status: "available" }+ | { status: "downloading"; progress: number }+ | { status: "paused"; progress: number }+ | { status: "downloaded" }+ | { status: "error"; progress?: number };++export type ModelCardStatus = ModelCardState["status"];++export type ModelCardProps = {+ name: string;+ logo: ReactNode;+ parameters?: string;+ size?: string;+ state?: ModelCardState;+ onDownload?: () => void;+ onPause?: () => void;+ onCancel?: () => void;+ onDelete?: (event: MouseEvent<HTMLElement>) => void;+ quickDelete?: boolean;+ onRetry?: () => void;+ onOpen?: () => void;+ compact?: boolean;+};diff --git a/apps/mirai-gui/client/src/features/local-models/components/model-table.tsx b/apps/mirai-gui/client/src/features/local-models/components/model-table.tsxnew file mode 100644index 000000000..e4d462149--- /dev/null+++ b/apps/mirai-gui/client/src/features/local-models/components/model-table.tsx@@ -0,0 +1,32 @@+import type { ReactNode } from "react";++export type ModelTableProps = {+ title: ReactNode;+ children: ReactNode;+ compact?: boolean;+};++const HEADER_CELL_CLS = "text-[11px] font-medium uppercase tracking-[0.06em] text-text-muted";++const GRID_TEMPLATE = "grid grid-cols-[minmax(0,1fr)_80px_200px_120px] gap-3 pl-4 pr-3";+const GRID_TEMPLATE_COMPACT = "grid grid-cols-[minmax(0,1fr)_auto] gap-3 pl-4 pr-3";++export function ModelTable({ title, children, compact = false }: ModelTableProps) {+ const firstHeader = typeof title === "string" ? `${title} models` : title;+ const gridTemplate = compact ? GRID_TEMPLATE_COMPACT : GRID_TEMPLATE;++ return (+ <div className="flex flex-col gap-2">+ <div className={`${gridTemplate} pb-1`}>+ <span className={HEADER_CELL_CLS}>{firstHeader}</span>+ {!compact && <span className={HEADER_CELL_CLS}>Size</span>}+ {!compact && <span className={HEADER_CELL_CLS}>Quantization</span>}+ <span aria-hidden />+ </div>++ <div className="rounded-md border-[0.5px] border-border-default overflow-hidden divide-y-[0.5px] divide-border-default bg-surface-elevated">+ {children}+ </div>+ </div>+ );+}diff --git a/apps/mirai-gui/client/src/features/local-models/hooks/use-download-manager.ts b/apps/mirai-gui/client/src/features/local-models/hooks/use-download-manager.tsnew file mode 100644index 000000000..ba234d1f8--- /dev/null+++ b/apps/mirai-gui/client/src/features/local-models/hooks/use-download-manager.ts@@ -0,0 +1,70 @@+import { useToast } from "@/components/ui/toast/use-toast";+import type { PlatformModel } from "@/types/models";+import { useCallback } from "react";+import { useModelsStore } from "@/stores/use-models-store";+import { modelDownloadPhases } from "@/types/model-manager";+import { getPlatform } from "@/platform/platform-singleton";++const failureCopy = {+ start: (name: string) => `Failed to start download for ${name}`,+ resume: (name: string) => `Failed to resume ${name}`,+} as const;++const errorText = (e: unknown): string => (e instanceof Error ? e.message : String(e));++export const useDownloadManager = () => {+ const toast = useToast();++ const begin = useCallback(+ async (model: PlatformModel, action: keyof typeof failureCopy) => {+ const { getModelState, updateModelState } = useModelsStore.getState();+ // A retry starts from a clean row instead of showing the previous failure until the first tick.+ if (getModelState(model.repoId)?.phase === modelDownloadPhases.error) {+ updateModelState(model.repoId, {+ phase: modelDownloadPhases.downloading,+ downloadedKbytes: 0,+ totalKbytes: 0,+ error: "",+ });+ }+ const { models } = getPlatform();+ try {+ await (action === "start" ? models.startDownload(model.repoId) : models.resumeDownload(model.repoId));+ } catch (e) {+ const error = errorText(e);+ updateModelState(model.repoId, { phase: modelDownloadPhases.error, error });+ toast.error(`${failureCopy[action](model.name)}: ${error}`);+ }+ },+ [toast],+ );++ const handleDownload = useCallback((model: PlatformModel) => begin(model, "start"), [begin]);+ const handleResume = useCallback((model: PlatformModel) => begin(model, "resume"), [begin]);++ const handlePause = useCallback(+ async (model: PlatformModel) => {+ try {+ await getPlatform().models.pauseDownload(model.repoId);+ } catch (e) {+ toast.error(`Failed to pause ${model.name}: ${errorText(e)}`);+ }+ },+ [toast],+ );++ const handleCancel = useCallback(+ async (model: PlatformModel) => {+ try {+ await getPlatform().models.deleteModel(model.repoId);+ } catch (e) {+ const error = errorText(e);+ useModelsStore.getState().updateModelState(model.repoId, { phase: modelDownloadPhases.error, error });+ toast.error(`Failed to cancel ${model.name}: ${error}`);+ }+ },+ [toast],+ );++ return { handleDownload, handlePause, handleResume, handleCancel };+};diff --git a/apps/mirai-gui/client/src/features/local-models/lib/model-sort.ts b/apps/mirai-gui/client/src/features/local-models/lib/model-sort.tsnew file mode 100644index 000000000..3507a1b5e--- /dev/null+++ b/apps/mirai-gui/client/src/features/local-models/lib/model-sort.ts@@ -0,0 +1,191 @@+import type { PlatformModel } from "@/types/models";+import { formatModelName } from "@/utils/format";++export type SizeAccessor = (model: PlatformModel) => number;++export function createSizeAccessor(getModelState: (id: string) => { totalKbytes?: number } | undefined): SizeAccessor {+ return (m: PlatformModel): number => {+ const id = m.repoId;+ const fromState = getModelState(id)?.totalKbytes ?? 0;+ const fromModel = typeof m.size === "number" ? m.size / 1000 : 0;+ return fromState > 0 ? fromState : fromModel > 0 ? fromModel : 0;+ };+}++const collator = new Intl.Collator(undefined, {+ numeric: true,+ sensitivity: "base",+});++type ReleaseHint = {+ familyBase: string;+ familyVersion: number | null;+ datedSuffix: number | null;+ parameterSize: number | null;+ variantRank: number;+};++const COMMUNITY_MIRROR_OWNERS = new Set(["mlx-community"]);++const getRepoOwner = (repoId: string): string => {+ const parts = repoId.split("/");+ return (parts[0] || "").toLowerCase();+};++const normalizeFamilyBase = (value: string): string => value.replace(/[^a-z]/gi, "").toLowerCase();++const compareFamilyBase = (a: string, b: string): number => {+ if (a === b) return 0;++ if (a && b) {+ if (a.includes(b)) return 1;+ if (b.includes(a)) return -1;+ }++ return collator.compare(a, b);+};++const getRepositorySourcePenalty = (repoId: string): number => {+ const owner = getRepoOwner(repoId);+ return COMMUNITY_MIRROR_OWNERS.has(owner) ? 1 : 0;+};++const getVariantRank = (model: PlatformModel, slug: string): number => {+ const normalizedSlug = slug.toLowerCase();+ const isAwq = /(?:^|[-_])awq(?:[-_]|$)/i.test(normalizedSlug);+ const quantization = (model.quantization ?? "").toLowerCase();+ const is4Bit = quantization.includes("4bit") || /(?:^|[-_])4bit(?:[-_]|$)/i.test(normalizedSlug);+ const is8Bit = quantization.includes("8bit") || /(?:^|[-_])8bit(?:[-_]|$)/i.test(normalizedSlug);+ const isQuantized = isAwq || is4Bit || is8Bit;++ const formatRank = (() => {+ if (!isQuantized) return 0;+ if (is8Bit) return 1;+ if (is4Bit || isAwq) return 2;+ return 3;+ })();++ const sourcePenalty = getRepositorySourcePenalty(model.repoId);++ return formatRank * 10 + sourcePenalty;+};++const getReleaseHint = (model: PlatformModel): ReleaseHint => {+ const slug = formatModelName(model.repoId ?? "");++ const joinedVersionMatch = slug.match(/^([A-Za-z]+)(\d+(?:\.\d+)?)(?=[-_.]|$)/);+ if (joinedVersionMatch) {+ return {+ familyBase: normalizeFamilyBase(joinedVersionMatch[1] ?? ""),+ familyVersion: Number.parseFloat(joinedVersionMatch[2] ?? ""),+ datedSuffix: getDatedSuffix(slug),+ parameterSize: getParameterSize(slug),+ variantRank: getVariantRank(model, slug),+ };+ }++ const separatedVersionMatch = slug.match(/^([A-Za-z]+(?:-[A-Za-z]+)*)-(\d+(?:\.\d+)?)(?=[-_.]|$)/);+ if (separatedVersionMatch) {+ return {+ familyBase: normalizeFamilyBase(separatedVersionMatch[1] ?? ""),+ familyVersion: Number.parseFloat(separatedVersionMatch[2] ?? ""),+ datedSuffix: getDatedSuffix(slug),+ parameterSize: getParameterSize(slug),+ variantRank: getVariantRank(model, slug),+ };+ }++ return {+ familyBase: normalizeFamilyBase(slug.split(/[-_.]/)[0] ?? slug),+ familyVersion: null,+ datedSuffix: getDatedSuffix(slug),+ parameterSize: getParameterSize(slug),+ variantRank: getVariantRank(model, slug),+ };+};++const getDatedSuffix = (slug: string): number | null => {+ const tokens = slug.split(/[-_]/).filter(Boolean);+ for (let index = tokens.length - 1; index >= 0; index -= 1) {+ const token = tokens[index];+ if (token && /^\d{4,6}$/.test(token)) {+ return Number.parseInt(token, 10);+ }+ }++ return null;+};++const getParameterSize = (slug: string): number | null => {+ const match = slug.match(/(?:^|[-_])(\d+(?:\.\d+)?)([BM])(?:[-_]|$)/i);+ if (!match) return null;++ const value = Number.parseFloat(match[1] ?? "");+ const unit = (match[2] ?? "").toUpperCase();++ if (!Number.isFinite(value)) return null;+ if (unit === "M") return value / 1000;+ return value;+};++const compareSourceIndex = (a: PlatformModel, b: PlatformModel): number => {+ const indexA = typeof a.sourceIndex === "number" ? a.sourceIndex : Number.MAX_SAFE_INTEGER;+ const indexB = typeof b.sourceIndex === "number" ? b.sourceIndex : Number.MAX_SAFE_INTEGER;+ return indexA - indexB;+};++export function createNewestTextModelComparator() {+ return (a: PlatformModel, b: PlatformModel): number => {+ const releaseA = getReleaseHint(a);+ const releaseB = getReleaseHint(b);++ const familyBaseComparison = compareFamilyBase(releaseA.familyBase, releaseB.familyBase);++ if (familyBaseComparison === 0) {+ if (+ releaseA.familyVersion !== null &&+ releaseB.familyVersion !== null &&+ releaseA.familyVersion !== releaseB.familyVersion+ ) {+ return releaseB.familyVersion - releaseA.familyVersion;+ }++ if (releaseA.familyVersion !== releaseB.familyVersion) {+ return releaseA.familyVersion === null ? 1 : -1;+ }+ } else if (familyBaseComparison !== 0) {+ return familyBaseComparison;+ }++ if (familyBaseComparison === 0 && releaseA.familyVersion === releaseB.familyVersion) {+ if (releaseA.datedSuffix !== null && releaseB.datedSuffix !== null) {+ if (releaseA.datedSuffix !== releaseB.datedSuffix) {+ return releaseB.datedSuffix - releaseA.datedSuffix;+ }+ } else if (releaseA.datedSuffix !== releaseB.datedSuffix) {+ return releaseA.datedSuffix === null ? 1 : -1;+ }+ }++ if (familyBaseComparison === 0 && releaseA.familyVersion === releaseB.familyVersion) {+ if (+ releaseA.parameterSize !== null &&+ releaseB.parameterSize !== null &&+ releaseA.parameterSize !== releaseB.parameterSize+ ) {+ return releaseB.parameterSize - releaseA.parameterSize;+ }++ if (releaseA.variantRank !== releaseB.variantRank) {+ return releaseA.variantRank - releaseB.variantRank;+ }+ }++ const bySourceIndex = compareSourceIndex(a, b);+ if (bySourceIndex !== 0) {+ return bySourceIndex;+ }++ return collator.compare(a.repoId ?? "", b.repoId ?? "");+ };+}diff --git a/apps/mirai-gui/client/src/features/local-models/lib/view.ts b/apps/mirai-gui/client/src/features/local-models/lib/view.tsnew file mode 100644index 000000000..cee8a47ea--- /dev/null+++ b/apps/mirai-gui/client/src/features/local-models/lib/view.ts@@ -0,0 +1,189 @@+import { modelDownloadPhases } from "@/types/model-manager";+import type { PlatformModel } from "@/types/models";+import { createNewestTextModelComparator } from "./model-sort";+import type { ModelCardState } from "../components/model-card/types";++export function toModelCardState(phase?: string, downloadedKbytes?: number, totalKbytes?: number): ModelCardState {+ const progress =+ totalKbytes && totalKbytes > 0 ? Math.min(100, Math.round(((downloadedKbytes ?? 0) / totalKbytes) * 100)) : 0;++ const mappedState: Record<string, ModelCardState> = {+ [modelDownloadPhases.downloaded]: { status: "downloaded" },+ [modelDownloadPhases.paused]: { status: "paused", progress },+ [modelDownloadPhases.downloading]: { status: "downloading", progress },+ [modelDownloadPhases.error]: progress > 0 ? { status: "error", progress } : { status: "error" },+ [modelDownloadPhases.notDownloaded]: { status: "available" },+ [modelDownloadPhases.locked]: { status: "available" },+ };++ return mappedState[phase ?? modelDownloadPhases.notDownloaded] ?? { status: "available" };+}++function formatParamSize(params?: number): string | undefined {+ if (!params || params <= 0) return undefined;+ const billions = params / 1e9;+ if (billions >= 1) {+ return billions >= 10 ? `${Math.round(billions)}B` : `${billions.toFixed(1).replace(/\.0$/, "")}B`;+ }+ const millions = params / 1e6;+ return `${Math.round(millions)}M`;+}++export function formatParamRange(min?: number, max?: number): string | undefined {+ if (!min || !max) return undefined;+ if (min === max) return formatParamSize(min);+ const lo = formatParamSize(min);+ const hi = formatParamSize(max);+ if (!lo || !hi) return undefined;+ return `${lo} – ${hi}`;+}++export function formatQuantization(model: { quantization?: string | null; quantizationBits?: number }): string {+ if (!model.quantization) return "Unquantized";+ const method = model.quantization.toUpperCase();+ return typeof model.quantizationBits === "number" ? `${method} · ${model.quantizationBits}-bit` : method;+}++export type FamilyEntry = {+ familyIdentifier: string;+ familyName: string;+ vendor: string;+ totalCount: number;+ installedCount: number;+ paramRange: { min: number; max: number } | null;+ lastActiveAt: number;+ representative: PlatformModel;+};++type FamilyAccumulator = {+ familyIdentifier: string;+ familyName: string;+ vendor: string;+ totalCount: number;+ installedCount: number;+ paramSizes: number[];+ lastActiveAt: number;+ representative: PlatformModel;+};++function familyKey(model: PlatformModel): string {+ return model.familyIdentifier ?? model.family ?? model.vendor ?? model.repoId;+}++const PARTNER_FAMILIES = new Set<string>(["LFM2.5"]);++export function isPartnerFamily(familyName: string): boolean {+ return PARTNER_FAMILIES.has(familyName.trim());+}++export function buildFamiliesView(params: {+ models: PlatformModel[];+ modelPhasesById: Record<string, string | undefined>;+ installedAtById: Record<string, number>;+ searchLower: string;+}): FamilyEntry[] {+ const { models, modelPhasesById, installedAtById, searchLower } = params;++ const accByKey = new Map<string, FamilyAccumulator>();+ for (const model of models) {+ const key = familyKey(model);+ const existing = accByKey.get(key);+ const phase = modelPhasesById[model.repoId];+ const isInstalled = phase === modelDownloadPhases.downloaded;+ const stamp = installedAtById[model.repoId] ?? 0;+ if (existing) {+ existing.totalCount += 1;+ if (isInstalled) existing.installedCount += 1;+ if (typeof model.paramSize === "number") existing.paramSizes.push(model.paramSize);+ if (stamp > existing.lastActiveAt) existing.lastActiveAt = stamp;+ } else {+ accByKey.set(key, {+ familyIdentifier: key,+ familyName: model.family ?? model.name,+ vendor: model.vendor,+ totalCount: 1,+ installedCount: isInstalled ? 1 : 0,+ paramSizes: typeof model.paramSize === "number" ? [model.paramSize] : [],+ lastActiveAt: stamp,+ representative: model,+ });+ }+ }++ const entries: FamilyEntry[] = Array.from(accByKey.values()).map((acc) => ({+ familyIdentifier: acc.familyIdentifier,+ familyName: acc.familyName,+ vendor: acc.vendor,+ totalCount: acc.totalCount,+ installedCount: acc.installedCount,+ paramRange:+ acc.paramSizes.length > 0 ? { min: Math.min(...acc.paramSizes), max: Math.max(...acc.paramSizes) } : null,+ lastActiveAt: acc.lastActiveAt,+ representative: acc.representative,+ }));++ const filtered = searchLower+ ? entries.filter(+ (e) => e.familyName.toLowerCase().includes(searchLower) || e.vendor.toLowerCase().includes(searchLower),+ )+ : entries;++ if (searchLower) {+ return filtered.sort((a, b) => a.familyName.localeCompare(b.familyName));+ }++ // Families with a downloaded model first, by most recent install; then the rest+ // by family ordering (Llama-3 above Llama-2, Qwen3 above Qwen-2, etc).+ const active: FamilyEntry[] = [];+ const others: FamilyEntry[] = [];+ for (const entry of filtered) {+ if (entry.lastActiveAt > 0) {+ active.push(entry);+ } else {+ others.push(entry);+ }+ }+ active.sort((a, b) => b.lastActiveAt - a.lastActiveAt || a.familyName.localeCompare(b.familyName));+ const compareModels = createNewestTextModelComparator();+ others.sort((a, b) => compareModels(a.representative, b.representative));+ return [...active, ...others];+}++export type FamilyDetailView = {+ installed: PlatformModel[];+ available: PlatformModel[];+};++export function buildFamilyDetailView(params: {+ models: PlatformModel[];+ modelPhasesById: Record<string, string | undefined>;+ familyIdentifier: string;+ searchLower: string;+ sortModels: (list: PlatformModel[]) => PlatformModel[];+}): FamilyDetailView {+ const { models, modelPhasesById, familyIdentifier, searchLower, sortModels } = params;++ const installed: PlatformModel[] = [];+ const available: PlatformModel[] = [];++ for (const model of models) {+ if (familyKey(model) !== familyIdentifier) continue;+ if (searchLower) {+ const haystack = `${model.name} ${formatQuantization(model)}`.toLowerCase();+ if (!haystack.includes(searchLower)) continue;+ }+ const phase = modelPhasesById[model.repoId];+ const isActive =+ phase === modelDownloadPhases.downloaded ||+ phase === modelDownloadPhases.downloading ||+ phase === modelDownloadPhases.paused ||+ phase === modelDownloadPhases.error;+ if (isActive) installed.push(model);+ else available.push(model);+ }++ return {+ installed: sortModels(installed),+ available: sortModels(available),+ };+}diff --git a/apps/mirai-gui/client/src/features/runtime/eject-runtime-session.ts b/apps/mirai-gui/client/src/features/runtime/eject-runtime-session.tsnew file mode 100644index 000000000..1c6864a5f--- /dev/null+++ b/apps/mirai-gui/client/src/features/runtime/eject-runtime-session.ts@@ -0,0 +1,73 @@+import { useRuntimeSessionStore } from "@/stores/use-runtime-session-store";+import { isRuntimeBusy } from "./runtime-busy";+import { useChatSessionStore } from "@/stores/use-chat-session-store";+import { runtimeSessionEjectReasons, type RuntimeSessionEjectReason, type RuntimeSessionRef } from "@/types/session";+import { getPlatform } from "@/platform/platform-singleton";++type EjectRuntimeSessionOptions = {+ target: RuntimeSessionRef;+ reason?: RuntimeSessionEjectReason;+};++const isTargetGone = (current: RuntimeSessionRef | null, target: RuntimeSessionRef): boolean =>+ !current || current.repoId !== target.repoId;++const waitForRuntimeSessionEject = (target: RuntimeSessionRef, abandoned: AbortSignal): Promise<void> =>+ new Promise((resolve) => {+ const current = useRuntimeSessionStore.getState();+ const alreadyGone = isTargetGone(current.residentSession, target);+ const currentlyEjectingTarget = !isTargetGone(current.ejectingSession, target);+ if (alreadyGone && !currentlyEjectingTarget) {+ resolve();+ return;+ }++ const unsubscribe = useRuntimeSessionStore.subscribe((state) => {+ const targetGone = isTargetGone(state.residentSession, target);+ const isEjectingTarget = !isTargetGone(state.ejectingSession, target);+ if (targetGone && !isEjectingTarget) {+ unsubscribe();+ resolve();+ }+ });+ abandoned.addEventListener("abort", unsubscribe, { once: true });+ });++// Subscribes before the request so an eject that completes first is not missed.+const requestRuntimeSessionEject = async (target: RuntimeSessionRef): Promise<void> => {+ const abandon = new AbortController();+ const ejected = waitForRuntimeSessionEject(target, abandon.signal);+ try {+ await getPlatform().session.ejectSession(toRuntimeEjectPayload(target));+ } catch (error) {+ abandon.abort();+ throw error;+ }+ await ejected;+};++const toRuntimeEjectPayload = (target: RuntimeSessionRef) => ({ repoId: target.repoId });++export const ejectRuntimeSessionAndWait = async ({+ target,+ reason = runtimeSessionEjectReasons.auto,+}: EjectRuntimeSessionOptions): Promise<boolean> => {+ if (isRuntimeBusy()) {+ throw new Error("Cannot eject a model while generation is in progress");+ }++ await requestRuntimeSessionEject(target);+ useChatSessionStore.getState().setLastEjectedWithReason(target, reason);++ return true;+};++export const ejectAndWait = async (+ target: RuntimeSessionRef,+ reason: RuntimeSessionEjectReason = runtimeSessionEjectReasons.auto,+): Promise<boolean> => {+ const result = await useChatSessionStore+ .getState()+ .withOperation("ejecting", () => ejectRuntimeSessionAndWait({ target, reason }));+ return result === true;+};diff --git a/apps/mirai-gui/client/src/features/runtime/runtime-busy.ts b/apps/mirai-gui/client/src/features/runtime/runtime-busy.tsnew file mode 100644index 000000000..3ab58e9a1--- /dev/null+++ b/apps/mirai-gui/client/src/features/runtime/runtime-busy.ts@@ -0,0 +1,30 @@+import { useChatSessionStore } from "@/stores/use-chat-session-store";++type BusyFields = {+ isGenerating: boolean;+ isTitleGenerating: boolean;+ operationState: string;+};++type GenerationFields = {+ isGenerating: boolean;+ activeGeneratingChatId: string | null;+};++// operationState is set as soon as a run operation starts, before isGenerating:+// the previous run is released in between.+const selectRuntimeBusy = (state: BusyFields): boolean =>+ state.isGenerating ||+ state.isTitleGenerating ||+ state.operationState === "running" ||+ state.operationState === "stopping";++export const isRuntimeBusy = (): boolean => selectRuntimeBusy(useChatSessionStore.getState());++export const useRuntimeBusy = (): boolean => useChatSessionStore(selectRuntimeBusy);++export const isChatGenerating = (state: GenerationFields, chatId: string): boolean =>+ state.isGenerating && state.activeGeneratingChatId === chatId;++export const isOtherChatGenerating = (state: GenerationFields, chatId: string): boolean =>+ state.isGenerating && !!state.activeGeneratingChatId && state.activeGeneratingChatId !== chatId;diff --git a/apps/mirai-gui/client/src/features/settings/components/about-tab.tsx b/apps/mirai-gui/client/src/features/settings/components/about-tab.tsxnew file mode 100644index 000000000..73cf99ef6--- /dev/null+++ b/apps/mirai-gui/client/src/features/settings/components/about-tab.tsx@@ -0,0 +1,90 @@+import { ChevronRight, Heart } from "lucide-react";+const links = [+ {+ title: "Website",+ url: "https://trymirai.com/",+ },+ { title: "GitHub", url: "https://github.com/trymirai" },+ { title: "Vision", url: "https://trymirai.com/about-us" },+ { title: "Docs", url: "https://docs.trymirai.com/" },+];++const productLinks = [+ {+ title: "Mirai platform",+ description: "A web console for setting up the SDK in your product.",+ url: "https://platform.trymirai.com",+ },+ {+ title: "Command-line interface",+ description: "Send messages to a model interactively, or start a local server.",+ url: "https://github.com/trymirai/uzu#cli",+ },+ {+ title: "Rust inference engine",+ description: "Runs models on the hardware they were built for.",+ url: "https://github.com/trymirai/uzu",+ },+];++export default function AboutTab() {+ return (+ <div className="h-full flex flex-col justify-between">+ <div className="flex flex-col">+ <div className="flex flex-col gap-4 px-5 lg:max-w-[800px] mx-auto w-full">+ <Heart className="w-6 h-6 text-blue" />+ <h3 className="text-[18px] font-medium leading-[130%] tracking-[0.2px] text-label-title truncate">+ Built by a team that shares a vision for <br />+ accessible and powerful local AI.+ </h3>+ </div>+ <div className="mt-5 h-[1px] bg-cell-border" />++ <div className="grid grid-cols-4 lg:max-w-[800px] mx-auto w-full">+ {links.map((link) => (+ <a+ key={link.url}+ href={link.url}+ target="_blank"+ rel="noopener noreferrer"+ className="hover:bg-bg-sub flex items-center justify-between px-5 py-5 border-r last:border-r-0 border-cell-border"+ >+ <h4 className="text-[15px] font-[350] leading-[150%] text-label-title overflow-hidden">{link.title}</h4>+ <ChevronRight className="w-[14px] h-[14px] text-label-muted" />+ </a>+ ))}+ </div>++ <div className="mb-5 h-[1px] bg-cell-border" />+ </div>++ <div>+ <h3 className="lg:max-w-[800px] mx-auto w-full text-xs font-mono leading-[130%] text-label-muted px-5">+ Our products+ </h3>+ <div className="flex flex-col w-full mt-3">+ {productLinks.map((link, index) => (+ <div key={link.url} className="w-full">+ <a+ href={link.url}+ target="_blank"+ rel="noopener noreferrer"+ className="lg:max-w-[800px] mx-auto w-full hover:bg-bg-sub flex items-center justify-between px-5 py-5"+ >+ <div className="flex flex-col gap-1">+ <h4 className="text-[15px] font-[350] leading-[150%] text-label-title overflow-hidden">+ {link.title}+ </h4>+ <p className="text-[13px] font-[350] leading-[150%] text-label-muted">{link.description}</p>+ </div>++ <ChevronRight className="w-[14px] h-[14px] text-label-muted" />+ </a>+ {index < productLinks.length - 1 && <div className="h-[1px] bg-cell-border" />}+ </div>+ ))}+ </div>+ </div>+ </div>+ );+}diff --git a/apps/mirai-gui/client/src/features/settings/components/clear-data-dialog.tsx b/apps/mirai-gui/client/src/features/settings/components/clear-data-dialog.tsxnew file mode 100644index 000000000..bed501250--- /dev/null+++ b/apps/mirai-gui/client/src/features/settings/components/clear-data-dialog.tsx@@ -0,0 +1,202 @@+import { useEffect, useRef, useState } from "react";+import { Checkbox } from "@/components/ui/checkbox";+import { Modal } from "@/components/ui/modal";+import { Text } from "@/components/ui/typography";+import { formatBytes, formatModelSize } from "@/utils/format";+import { useCleanupStore } from "@/stores/use-cleanup-store";+import { useChatStore } from "@/stores/use-chat-store";+import { useRuntimeSessionStore } from "@/stores/use-runtime-session-store";++type CleanupCategory = "dialogs" | "models" | "logs";+type Step = "select" | "confirm" | "result";++const ALL_CATEGORIES: CleanupCategory[] = ["dialogs", "models", "logs"];++const plural = (n: number, one: string, many: string): string => `${n} ${n === 1 ? one : many}`;++const getCategoryLabel = (cat: CleanupCategory): string => {+ switch (cat) {+ case "dialogs":+ return "Dialogs";+ case "models":+ return "Downloaded models";+ case "logs":+ return "Logs";+ }+};++const getCategoryDescription = (+ cat: CleanupCategory,+ preview: ReturnType<typeof useCleanupStore.getState>["preview"],+): string => {+ if (!preview) return "";+ switch (cat) {+ case "dialogs":+ return `${plural(preview.dialogs.count, "chat", "chats")} · ${formatBytes(preview.dialogs.sizeBytes)}`;+ case "models":+ return `${plural(preview.models.count, "model", "models")} · ${formatModelSize(preview.models.sizeBytes) ?? formatBytes(preview.models.sizeBytes)}`;+ case "logs":+ return formatBytes(preview.logs.sizeBytes);+ }+};++const getConfirmSummary = (categories: CleanupCategory[]): string => {+ const labels = categories.map(getCategoryLabel);+ if (labels.length === 0) return "";+ if (labels.length === 1) return labels[0]!;+ return `${labels.slice(0, -1).join(", ")} and ${labels[labels.length - 1]}`;+};++type Props = {+ open: boolean;+ onClose: () => void;+};++export function ClearDataDialog({ open, onClose }: Props) {+ const [step, setStep] = useState<Step>("select");+ const [selected, setSelected] = useState<Set<CleanupCategory>>(new Set(ALL_CATEGORIES));+ const previewAppliedRef = useRef(false);++ const preview = useCleanupStore((s) => s.preview);+ const previewLoading = useCleanupStore((s) => s.previewLoading);+ const result = useCleanupStore((s) => s.result);+ const executing = useCleanupStore((s) => s.executing);+ const fetchPreview = useCleanupStore((s) => s.fetchPreview);+ const execute = useCleanupStore((s) => s.execute);+ const reset = useCleanupStore((s) => s.reset);++ useEffect(() => {+ if (!open) {+ previewAppliedRef.current = false;+ return;+ }+ setStep("select");+ reset();+ setSelected(new Set(ALL_CATEGORIES));+ const residentRepoId = useRuntimeSessionStore.getState().residentSession?.repoId;+ const residentIdentifiers = residentRepoId ? [residentRepoId] : [];+ void fetchPreview(residentIdentifiers);+ }, [open, fetchPreview, reset]);++ useEffect(() => {+ if (!preview || previewAppliedRef.current) return;+ previewAppliedRef.current = true;+ setSelected((prev) => {+ const next = new Set(prev);+ if (preview.dialogs.count === 0) next.delete("dialogs");+ if (preview.models.count === 0) next.delete("models");+ if (preview.logs.sizeBytes === 0) next.delete("logs");+ return next;+ });+ }, [preview]);++ const handleClose = () => {+ onClose();+ };++ const handleDelete = async () => {+ const residentRepoId = useRuntimeSessionStore.getState().residentSession?.repoId;+ const residentIdentifiers = residentRepoId ? [residentRepoId] : [];++ await execute([...selected], residentIdentifiers);+ const executed = useCleanupStore.getState().result?.executed ?? [];+ if (executed.includes("dialogs")) {+ await useChatStore.getState().loadSavedChats();+ useChatStore.getState().clearChat();+ useChatStore.getState().setCurrentChatId(null);+ }+ setStep("result");+ };++ const selectedCategories = ALL_CATEGORIES.filter((c) => selected.has(c));+ const loading = previewLoading || executing;++ if (step === "select") {+ return (+ <Modal+ open={open}+ onClose={handleClose}+ title="Clear data"+ primaryLabel="Review"+ primaryKind="danger"+ onPrimary={() => setStep("confirm")}+ primaryDisabled={selectedCategories.length === 0 || loading}+ >+ <div className="flex flex-col gap-3">+ <Text as="p" color="secondary" opticalSize={20} className="text-[13px] leading-[1.5]">+ Select the data categories you want to permanently delete.+ </Text>+ <div className="flex flex-col gap-2">+ {ALL_CATEGORIES.map((cat) => (+ <div+ key={cat}+ className="flex items-start gap-3 pb-2 cursor-pointer"+ onClick={() =>+ setSelected((prev) => {+ const next = new Set(prev);+ if (next.has(cat)) next.delete(cat);+ else next.add(cat);+ return next;+ })+ }+ >+ <Checkbox checked={selected.has(cat)} onChange={() => {}} className="mt-0.5 shrink-0" />+ <div className="flex flex-col gap-0.5">+ <span className="text-[14px] font-[450] leading-[1.4] text-label-title">{getCategoryLabel(cat)}</span>+ {preview && (+ <span className="text-[12px] text-label-muted">{getCategoryDescription(cat, preview)}</span>+ )}+ </div>+ </div>+ ))}+ </div>+ </div>+ </Modal>+ );+ }++ if (step === "confirm") {+ return (+ <Modal+ open={open}+ onClose={handleClose}+ title="Are you sure?"+ primaryLabel="Delete"+ primaryKind="danger"+ onPrimary={() => void handleDelete()}+ primaryDisabled={loading}+ secondaryLabel="Back"+ onSecondary={() => setStep("select")}+ >+ <div className="flex flex-col gap-3">+ <Text as="p" color="secondary" opticalSize={20} className="text-[14px] leading-[1.6]">+ This will permanently delete: <strong>{getConfirmSummary(selectedCategories)}</strong>.+ </Text>+ <Text as="p" color="secondary" opticalSize={20} className="text-[14px] leading-[1.6]">+ This action cannot be undone.+ </Text>+ </div>+ </Modal>+ );+ }++ const executed = result?.executed ?? [];++ return (+ <Modal open={open} onClose={handleClose} title="Done" primaryLabel="Close" onPrimary={handleClose}>+ <div className="flex flex-col gap-2">+ {ALL_CATEGORIES.filter((c) => selected.has(c)).map((cat) => {+ const done = executed.includes(cat);+ return (+ <div key={cat} className="flex items-center gap-2">+ <span className="text-[14px]">{done ? "✓" : "✗"}</span>+ <Text as="span" color={done ? "primary" : "secondary"} opticalSize={20} className="text-[14px]">+ {getCategoryLabel(cat)} {done ? "cleared" : "failed"}+ </Text>+ </div>+ );+ })}+ </div>+ </Modal>+ );+}diff --git a/apps/mirai-gui/client/src/features/settings/components/general-tab.test.tsx b/apps/mirai-gui/client/src/features/settings/components/general-tab.test.tsxnew file mode 100644index 000000000..c2f57e439--- /dev/null+++ b/apps/mirai-gui/client/src/features/settings/components/general-tab.test.tsx@@ -0,0 +1,53 @@+import { fireEvent, render, screen } from "@testing-library/react";+import { describe, expect, it, vi } from "vitest";+import GeneralTab from "./general-tab";++vi.mock("@/platform/platform-singleton", () => ({+ getPlatform: () => ({ system: { getCliStatus: () => Promise.resolve("installed") } }),+}));++vi.mock("@/platform/platform-info", () => ({+ platformInfo: { isTauri: true, features: { globalShortcut: true } },+}));++const settings = {+ enableThinking: true,+ runOnStartup: false,+ quickEntryShortcut: "CommandOrControl+Shift+M",+ autoEjectEnabled: true,+ autoEjectMinutes: 7,+ fetch: vi.fn(),+ fetchDesktopSettings: vi.fn(() => Promise.resolve()),+ setEnableThinking: vi.fn(),+ setRunOnStartup: vi.fn(),+ registerQuickEntryShortcut: vi.fn(() => Promise.resolve(true)),+ unregisterQuickEntryShortcut: vi.fn(() => Promise.resolve()),+ setAutoEjectEnabled: vi.fn(),+ setAutoEjectMinutes: vi.fn(),+};++vi.mock("@/stores/use-settings-store", () => ({ useSettingsStore: () => settings }));++vi.mock("@/stores/use-global-instructions-store", () => ({+ useGlobalInstructionsStore: (selector: (s: unknown) => unknown) =>+ selector({ instructions: "", loadInstructions: vi.fn(), saveInstructions: vi.fn() }),+}));++vi.mock("@/stores/use-app-store", () => ({+ useAppStore: (selector: (s: unknown) => unknown) => selector({ isDarkMode: true, setDarkMode: vi.fn() }),+}));++describe("quick entry shortcut capture", () => {+ it("registers a combination with a system modifier and ignores one without", async () => {+ render(<GeneralTab />);+ fireEvent.click(screen.getByRole("button", { name: /⌘ ⇧ M/ }));+ await new Promise((r) => setTimeout(r, 0));++ fireEvent.keyDown(window, { key: "k", code: "KeyK", metaKey: true, shiftKey: true });+ expect(settings.registerQuickEntryShortcut).toHaveBeenCalledWith("CommandOrControl+Shift+K");++ settings.registerQuickEntryShortcut.mockClear();+ fireEvent.keyDown(window, { key: "j", code: "KeyJ", shiftKey: true });+ expect(settings.registerQuickEntryShortcut).not.toHaveBeenCalled();+ });+});diff --git a/apps/mirai-gui/client/src/features/settings/components/general-tab.tsx b/apps/mirai-gui/client/src/features/settings/components/general-tab.tsxnew file mode 100644index 000000000..b772ad0bb--- /dev/null+++ b/apps/mirai-gui/client/src/features/settings/components/general-tab.tsx@@ -0,0 +1,113 @@+import GlobalInstructions from "@/features/chat-history/components/global-instructions";+import { Toggle } from "@/components/ui/toggle";+import { platformInfo } from "@/platform/platform-info";+import { useAppStore } from "@/stores/use-app-store";+import { useGlobalInstructionsStore } from "@/stores/use-global-instructions-store";+import { useSettingsStore } from "@/stores/use-settings-store";+import { useEffect } from "react";+import { AutoEjectSetting } from "./general/auto-eject-setting";+import { CliInstallSetting } from "./general/cli-install-setting";+import { FeedbackFooter } from "./general/feedback-footer";+import { QuickEntryShortcutSetting } from "./general/quick-entry-shortcut-setting";+import { SettingDivider, SettingRow } from "./general/setting-row";++export default function GeneralTab() {+ const {+ enableThinking,+ runOnStartup,+ quickEntryShortcut,+ autoEjectEnabled,+ autoEjectMinutes,+ fetch: fetchSettings,+ fetchDesktopSettings,+ setEnableThinking,+ setRunOnStartup,+ registerQuickEntryShortcut,+ unregisterQuickEntryShortcut,+ setAutoEjectEnabled,+ setAutoEjectMinutes,+ } = useSettingsStore();++ const instructions = useGlobalInstructionsStore((s) => s.instructions);+ const loadInstructions = useGlobalInstructionsStore((s) => s.loadInstructions);+ const saveInstructions = useGlobalInstructionsStore((s) => s.saveInstructions);++ const isDarkMode = useAppStore((s) => s.isDarkMode);+ const setDarkMode = useAppStore((s) => s.setDarkMode);++ useEffect(() => {+ loadInstructions();+ fetchSettings();+ fetchDesktopSettings().catch(() => {});+ }, [loadInstructions, fetchSettings, fetchDesktopSettings]);++ return (+ <div className="h-full flex flex-col">+ <div className="flex flex-col gap-5 pb-5">+ <div className="flex flex-col gap-2 px-5 lg:max-w-[800px] mx-auto w-full">+ <GlobalInstructions instructions={instructions} onSave={saveInstructions} />+ </div>++ <SettingDivider />+ <SettingRow+ title="Dark mode"+ description="Use the dark appearance across the app"+ control={<Toggle label="Dark mode" checked={isDarkMode} onChange={() => setDarkMode(!isDarkMode)} />}+ />++ {platformInfo.features.startupLaunch && (+ <>+ <SettingDivider />+ <SettingRow+ title="Run on startup"+ description="Automatically start Mirai when you log in to your computer"+ control={+ <Toggle label="Run on startup" checked={runOnStartup} onChange={() => setRunOnStartup(!runOnStartup)} />+ }+ />+ </>+ )}++ {platformInfo.features.globalShortcut && (+ <>+ <SettingDivider />+ <QuickEntryShortcutSetting+ quickEntryShortcut={quickEntryShortcut}+ registerQuickEntryShortcut={registerQuickEntryShortcut}+ unregisterQuickEntryShortcut={unregisterQuickEntryShortcut}+ />+ </>+ )}++ <CliInstallSetting />++ <SettingDivider />+ <SettingRow+ title="Default reasoning mode"+ description="Let reasoning models think by default. You can override this for each model."+ control={+ <Toggle+ label="Default reasoning mode"+ checked={enableThinking}+ onChange={() => setEnableThinking(!enableThinking)}+ />+ }+ />++ {platformInfo.features.autoEject && (+ <>+ <SettingDivider />+ <AutoEjectSetting+ autoEjectEnabled={autoEjectEnabled}+ autoEjectMinutes={autoEjectMinutes}+ setAutoEjectEnabled={setAutoEjectEnabled}+ setAutoEjectMinutes={setAutoEjectMinutes}+ />+ </>+ )}+ </div>++ <FeedbackFooter />+ </div>+ );+}diff --git a/apps/mirai-gui/client/src/features/settings/components/general/auto-eject-setting.tsx b/apps/mirai-gui/client/src/features/settings/components/general/auto-eject-setting.tsxnew file mode 100644index 000000000..5c18f87f8--- /dev/null+++ b/apps/mirai-gui/client/src/features/settings/components/general/auto-eject-setting.tsx@@ -0,0 +1,62 @@+import { Toggle } from "@/components/ui/toggle";+import { Input as HeadlessInput } from "@headlessui/react";+import { useEffect, useState } from "react";+import { twMerge } from "tailwind-merge";+import { SettingRow } from "./setting-row";++const MIN_IDLE_MINUTES = 1;+const MAX_IDLE_MINUTES = 240;++export function AutoEjectSetting({+ autoEjectEnabled,+ autoEjectMinutes,+ setAutoEjectEnabled,+ setAutoEjectMinutes,+}: {+ autoEjectEnabled: boolean;+ autoEjectMinutes: number;+ setAutoEjectEnabled: (value: boolean) => Promise<void>;+ setAutoEjectMinutes: (minutes: number) => Promise<void>;+}) {+ const [minutesInput, setMinutesInput] = useState(String(autoEjectMinutes));++ useEffect(() => {+ setMinutesInput(String(autoEjectMinutes));+ }, [autoEjectMinutes]);++ return (+ <SettingRow+ title="Auto‑eject models when idle"+ description="Automatically unload local models after inactivity"+ control={+ <Toggle label="Auto-eject" checked={autoEjectEnabled} onChange={() => setAutoEjectEnabled(!autoEjectEnabled)} />+ }+ >+ <div className="mt-3 flex items-center gap-3">+ <label className="text-[13px] text-label-title min-w-[140px]">Idle timeout (minutes)</label>+ <HeadlessInput+ type="text"+ inputMode="numeric"+ value={minutesInput}+ className={twMerge(+ "max-w-[72px] px-2 py-1 text-[13px] border border-cell-border bg-background placeholder:text-label-muted rounded-[8px] focus:outline-hidden",+ !autoEjectEnabled ? "opacity-60 cursor-not-allowed" : "",+ )}+ onChange={(e) => {+ setMinutesInput(e.target.value);+ }}+ onBlur={async () => {+ const parsed = Number(minutesInput);+ const clamped = Number.isFinite(parsed)+ ? Math.max(MIN_IDLE_MINUTES, Math.min(MAX_IDLE_MINUTES, Math.round(parsed)))+ : autoEjectMinutes;+ setMinutesInput(String(clamped));+ await setAutoEjectMinutes(clamped);+ }}+ disabled={!autoEjectEnabled}+ aria-disabled={!autoEjectEnabled}+ />+ </div>+ </SettingRow>+ );+}diff --git a/apps/mirai-gui/client/src/features/settings/components/general/cli-install-setting.tsx b/apps/mirai-gui/client/src/features/settings/components/general/cli-install-setting.tsxnew file mode 100644index 000000000..6e4477ea7--- /dev/null+++ b/apps/mirai-gui/client/src/features/settings/components/general/cli-install-setting.tsx@@ -0,0 +1,61 @@+import { useToast } from "@/components/ui/toast/use-toast";+import { getPlatform } from "@/platform/platform-singleton";+import { platformInfo } from "@/platform/platform-info";+import { Button } from "@/components/ui/button";+import { useEffect, useState } from "react";+import { SettingDivider, SettingRow } from "./setting-row";++export function CliInstallSetting() {+ const [isInstalling, setIsInstalling] = useState(false);+ const [cliMissing, setCliMissing] = useState(false);+ const toast = useToast();++ useEffect(() => {+ if (!platformInfo.features.cliInstall) return;+ void getPlatform()+ .system.getCliStatus()+ .then((status) => setCliMissing(status === "missing"));+ }, []);++ const install = async () => {+ if (isInstalling) return;+ setIsInstalling(true);+ try {+ const result = await getPlatform().system.installCli();+ if (result === "installed" || result === "already-installed") {+ toast.success("The mirai command is now available in your terminal");+ setCliMissing(false);+ }+ } catch (error) {+ toast.error("Failed to install the CLI");+ console.error(error);+ } finally {+ setIsInstalling(false);+ }+ };++ if (!platformInfo.features.cliInstall || !cliMissing) return null;++ return (+ <>+ <SettingDivider />+ <SettingRow+ title="Command line tool"+ description="Install the mirai command to use Mirai from the terminal"+ control={+ <Button+ kind="primary"+ size="xs"+ loading={isInstalling}+ disabled={isInstalling}+ onClick={() => {+ void install();+ }}+ >+ {isInstalling ? "Installing…" : "Install"}+ </Button>+ }+ />+ </>+ );+}diff --git a/apps/mirai-gui/client/src/features/settings/components/general/feedback-footer.tsx b/apps/mirai-gui/client/src/features/settings/components/general/feedback-footer.tsxnew file mode 100644index 000000000..36042711b--- /dev/null+++ b/apps/mirai-gui/client/src/features/settings/components/general/feedback-footer.tsx@@ -0,0 +1,20 @@+import { Button } from "@/components/ui/button";+import { Heart } from "lucide-react";+import { SettingDivider } from "./setting-row";++export function FeedbackFooter() {+ return (+ <div className="mt-auto sticky bottom-0 z-10">+ <SettingDivider />+ <div className="bg-background/80 backdrop-blur flex items-center justify-between px-5 py-3 lg:max-w-[800px] mx-auto w-full gap-3">+ <div className="flex items-center gap-2 text-[13px] text-label-muted max-w-[210px] lg:max-w-none">+ <Heart className="min-w-4 min-h-4 text-blue" />+ <span>Let us know your feedback or request a new feature</span>+ </div>+ <Button kind="primary" size="xs" href="https://discord.gg/trymirai" target="_blank">+ Give Feedback+ </Button>+ </div>+ </div>+ );+}diff --git a/apps/mirai-gui/client/src/features/settings/components/general/quick-entry-shortcut-setting.tsx b/apps/mirai-gui/client/src/features/settings/components/general/quick-entry-shortcut-setting.tsxnew file mode 100644index 000000000..dc5e2fa22--- /dev/null+++ b/apps/mirai-gui/client/src/features/settings/components/general/quick-entry-shortcut-setting.tsx@@ -0,0 +1,57 @@+import { Button } from "@/components/ui/button";+import { X as XIcon } from "lucide-react";+import { SettingRow } from "./setting-row";+import { useShortcutCapture } from "./use-shortcut-capture";++export function QuickEntryShortcutSetting({+ quickEntryShortcut,+ registerQuickEntryShortcut,+ unregisterQuickEntryShortcut,+}: {+ quickEntryShortcut: string | null;+ registerQuickEntryShortcut: (accelerator: string) => Promise<boolean>;+ unregisterQuickEntryShortcut: () => Promise<void>;+}) {+ const { isCapturing, setIsCapturing, buttonRef, shortcutDisplay } = useShortcutCapture(+ quickEntryShortcut,+ registerQuickEntryShortcut,+ );+ const capturingRing = isCapturing ? "ring-2 ring-blue ring-offset-2 ring-offset-background" : "";++ return (+ <SettingRow+ title="Quick entry keyboard shortcut"+ description={isCapturing ? "Hold ⌘, ⌃ or ⌥, then a key" : "Open Mirai from anywhere with a shortcut"}+ control={+ quickEntryShortcut ? (+ <Button+ kind="primary"+ size="xs"+ icon={<XIcon width={16} height={16} />}+ iconPosition="right"+ className={capturingRing}+ ref={buttonRef}+ onClick={async () => {+ await unregisterQuickEntryShortcut();+ setIsCapturing(true);+ }}+ >+ {shortcutDisplay}+ </Button>+ ) : (+ <Button+ kind="primary"+ size="xs"+ className={capturingRing}+ ref={buttonRef}+ onClick={() => {+ setIsCapturing(true);+ }}+ >+ Set shortcut+ </Button>+ )+ }+ />+ );+}diff --git a/apps/mirai-gui/client/src/features/settings/components/general/setting-row.tsx b/apps/mirai-gui/client/src/features/settings/components/general/setting-row.tsxnew file mode 100644index 000000000..d97a016e2--- /dev/null+++ b/apps/mirai-gui/client/src/features/settings/components/general/setting-row.tsx@@ -0,0 +1,30 @@+import type { ReactNode } from "react";++export function SettingDivider() {+ return <div className="h-[1px] bg-cell-border" />;+}++export function SettingRow({+ title,+ description,+ control,+ children,+}: {+ title: string;+ description: ReactNode;+ control?: ReactNode;+ children?: ReactNode;+}) {+ return (+ <div className="px-5 lg:max-w-[800px] mx-auto w-full">+ <div className="flex items-center justify-between gap-3">+ <div className="flex flex-col gap-1">+ <h4 className="text-[15px] font-[350] leading-[150%] text-label-title overflow-hidden">{title}</h4>+ <p className="text-[13px] text-label-muted">{description}</p>+ </div>+ {control}+ </div>+ {children}+ </div>+ );+}diff --git a/apps/mirai-gui/client/src/features/settings/components/general/use-shortcut-capture.ts b/apps/mirai-gui/client/src/features/settings/components/general/use-shortcut-capture.tsnew file mode 100644index 000000000..62c346cc6--- /dev/null+++ b/apps/mirai-gui/client/src/features/settings/components/general/use-shortcut-capture.ts@@ -0,0 +1,132 @@+import { useEffect, useRef, useState } from "react";+import { useToast } from "@/components/ui/toast/use-toast";++const DISPLAY_KEYS: Record<string, string> = {+ Meta: "⌘",+ Control: "⌃",+ Alt: "⌥",+ Option: "⌥",+ Shift: "⇧",+ " ": "Space",+};++const CODE_KEYS: Record<string, string> = {+ Minus: "-",+ Equal: "=",+ BracketLeft: "[",+ BracketRight: "]",+ Semicolon: ";",+ Quote: "'",+ Backquote: "`",+ Backslash: "\\",+ Comma: ",",+ Period: ".",+ Slash: "/",+ Space: "Space",+};++function formatKeys(keys: string[]): string {+ return keys+ .map((k) => DISPLAY_KEYS[k] || k)+ .join(" ")+ .replace(" Space", " Space");+}++function acceleratorFrom(event: KeyboardEvent): string | null {+ const modifiers: string[] = [];+ if (event.metaKey) modifiers.push("Meta");+ if (event.ctrlKey) modifiers.push("Control");+ if (event.altKey) modifiers.push("Alt");+ if (event.shiftKey) modifiers.push("Shift");++ if (["Meta", "Control", "Alt", "Shift"].includes(event.key)) return null;++ const mappedCode = CODE_KEYS[event.code];+ let primary: string | null = null;+ if (event.code.startsWith("Key")) {+ primary = event.code.slice(3).toUpperCase();+ } else if (event.code.startsWith("Digit")) {+ primary = event.code.slice(5);+ } else if (mappedCode) {+ primary = mappedCode;+ } else if (/^F\d{1,2}$/.test(event.key)) {+ primary = event.key;+ } else if (event.key === " ") {+ primary = "Space";+ }+ if (!primary) return null;++ // Shift alone won't fire a global hotkey on macOS; keep capturing until+ // a system modifier is added rather than store a dead shortcut.+ if (!modifiers.some((m) => m === "Meta" || m === "Control" || m === "Alt")) return null;++ return [...modifiers]+ .map((p) => (p === "Meta" ? "CommandOrControl" : p))+ .concat(primary)+ .join("+");+}++export function useShortcutCapture(+ quickEntryShortcut: string | null,+ registerQuickEntryShortcut: (accelerator: string) => Promise<boolean>,+) {+ const toast = useToast();+ const [isCapturing, setIsCapturing] = useState(false);+ const buttonRef = useRef<HTMLButtonElement | null>(null);++ useEffect(() => {+ if (!isCapturing) return;++ function onKeyDown(e: KeyboardEvent) {+ e.preventDefault();+ if (e.key === "Escape") {+ setIsCapturing(false);+ return;+ }+ const accelerator = acceleratorFrom(e);+ if (!accelerator) return;+ void registerQuickEntryShortcut(accelerator).then((ok) => {+ setIsCapturing(false);+ if (!ok) toast.error("This shortcut can't be registered", { id: "shortcut-register-failed" });+ });+ }++ window.addEventListener("keydown", onKeyDown, { capture: true });+ return () => window.removeEventListener("keydown", onKeyDown, true);+ }, [isCapturing, registerQuickEntryShortcut, toast]);++ useEffect(() => {+ if (!isCapturing) return;++ const handlePossibleOutside = (event: Event) => {+ const buttonEl = buttonRef.current;+ if (!buttonEl) {+ setIsCapturing(false);+ return;+ }+ if (!(event.target instanceof Node) || !buttonEl.contains(event.target)) {+ setIsCapturing(false);+ }+ };++ const handleWindowBlur = () => setIsCapturing(false);++ document.addEventListener("mousedown", handlePossibleOutside);+ document.addEventListener("touchstart", handlePossibleOutside);+ document.addEventListener("contextmenu", handlePossibleOutside);+ window.addEventListener("blur", handleWindowBlur);++ return () => {+ document.removeEventListener("mousedown", handlePossibleOutside);+ document.removeEventListener("touchstart", handlePossibleOutside);+ document.removeEventListener("contextmenu", handlePossibleOutside);+ window.removeEventListener("blur", handleWindowBlur);+ };+ }, [isCapturing]);++ const shortcutDisplay = quickEntryShortcut+ ? formatKeys(quickEntryShortcut.split("+").map((p) => (p === "CommandOrControl" ? "Meta" : p)))+ : "";++ return { isCapturing, setIsCapturing, buttonRef, shortcutDisplay };+}diff --git a/apps/mirai-gui/client/src/features/settings/components/privacy-tab.tsx b/apps/mirai-gui/client/src/features/settings/components/privacy-tab.tsxnew file mode 100644index 000000000..39030ce08--- /dev/null+++ b/apps/mirai-gui/client/src/features/settings/components/privacy-tab.tsx@@ -0,0 +1,150 @@+import { ChevronRight, Download, Shield } from "lucide-react";+import { Button } from "@/components/ui/button";+import { useToast } from "@/components/ui/toast/use-toast";+import { useEffect, useState } from "react";+import { ClearDataDialog } from "./clear-data-dialog";+import { FeedbackFooter } from "./general/feedback-footer";+import { SettingDivider, SettingRow } from "./general/setting-row";+import { platformInfo } from "@/platform/platform-info";+import { useSettingsStore } from "@/stores/use-settings-store";+import { exportAllChatsZip } from "@/features/chat/services/export-chats";++const links = [+ {+ title: "Terms of Service",+ url: "https://artifacts.trymirai.com/legal/Mirai_Tech_Terms_of_Use.pdf",+ },+ {+ title: "Privacy Policy",+ url: "https://artifacts.trymirai.com/legal/Mirai_Tech_Privacy_Policy.pdf",+ },+];++export default function PrivacyTab() {+ const [isExporting, setIsExporting] = useState(false);+ const [isExportingLogs, setIsExportingLogs] = useState(false);+ const [clearDataOpen, setClearDataOpen] = useState(false);+ const toast = useToast();+ const { fetch: fetchSettings, exportLogs } = useSettingsStore();++ useEffect(() => {+ fetchSettings();+ }, [fetchSettings]);++ const handleExportChats = async () => {+ if (isExporting) return;+ setIsExporting(true);+ try {+ const ok = await exportAllChatsZip();+ if (ok) toast.success("Exported chats to ZIP");+ else toast.info("Nothing to export");+ } catch {+ toast.error("Export failed");+ } finally {+ setIsExporting(false);+ }+ };++ const handleExportLogs = async () => {+ if (isExportingLogs) return;+ setIsExportingLogs(true);+ const result = await exportLogs();+ setIsExportingLogs(false);+ if (result === "ok") toast.success("Exported logs");+ else if (result === "error") toast.error("Failed to export logs");+ };++ return (+ <div className="h-full flex flex-col">+ <div className="flex flex-col">+ <div className="flex flex-col gap-4 px-5 lg:max-w-[800px] mx-auto w-full">+ <Shield className="w-6 h-6 text-blue" />+ <div className="flex flex-col gap-1">+ <h3 className="text-[18px] font-medium leading-[130%] tracking-[0.2px] text-label-title break-words">+ All data is processed and stored locally on your device.+ </h3>+ <p className="text-[13px] font-[350] leading-[150%] text-label-muted">+ Your privacy is built into the core of how Mirai runs.+ </p>+ </div>+ </div>+ <div className="mt-5">+ <SettingDivider />+ </div>++ <div className="flex flex-col">+ {links.map((link, index) => (+ <div key={link.url} className="w-full">+ <a+ href={link.url}+ target="_blank"+ rel="noopener noreferrer"+ className="lg:max-w-[800px] mx-auto w-full hover:bg-bg-sub flex items-center justify-between px-5 py-5"+ >+ <h4 className="text-[15px] font-[350] leading-[150%] text-label-title">{link.title}</h4>++ <ChevronRight className="w-[14px] h-[14px] text-label-muted" />+ </a>+ {index < links.length - 1 && <SettingDivider />}+ </div>+ ))}+ </div>++ <div className="flex flex-col gap-5">+ <SettingDivider />+ <SettingRow+ title="Export all your chats"+ description="As Markdown files in .zip archive"+ control={+ <Button+ kind="primary"+ size="sm"+ loading={isExporting}+ icon={<Download size={16} />}+ onClick={handleExportChats}+ disabled={isExporting}+ >+ Export+ </Button>+ }+ />+ {platformInfo.features.logExport && (+ <>+ <SettingDivider />+ <SettingRow+ title="Export logs"+ description="Save the current Mirai log file for debugging"+ control={+ <Button+ kind="primary"+ size="sm"+ loading={isExportingLogs}+ icon={<Download size={16} />}+ onClick={handleExportLogs}+ disabled={isExportingLogs}+ >+ Export+ </Button>+ }+ />+ </>+ )}+ <SettingDivider />+ <SettingRow+ title="Clear data"+ description="Delete dialogs, models, or logs"+ control={+ <Button kind="secondary" size="sm" onClick={() => setClearDataOpen(true)}>+ Clear data+ </Button>+ }+ />+ <SettingDivider />+ </div>+ </div>+ <ClearDataDialog open={clearDataOpen} onClose={() => setClearDataOpen(false)} />++ <FeedbackFooter />+ </div>+ );+}diff --git a/apps/mirai-gui/client/src/features/settings/components/settings-page.tsx b/apps/mirai-gui/client/src/features/settings/components/settings-page.tsxnew file mode 100644index 000000000..d6893b39a--- /dev/null+++ b/apps/mirai-gui/client/src/features/settings/components/settings-page.tsx@@ -0,0 +1,81 @@+import { Link, useSearch } from "@tanstack/react-router";+import GeneralTab from "./general-tab";+import PrivacyTab from "./privacy-tab";+import AboutTab from "./about-tab";+import { useSidebarStore } from "@/stores/use-sidebar-store";+import { Button } from "@/components/ui/button";+import { twMerge } from "tailwind-merge";++export type SettingsTab = "general" | "privacy" | "about";++export function SettingsPage() {+ const { tab } = useSearch({ from: "/settings" });+ const sections: { key: SettingsTab; label: string }[] = [+ { key: "general", label: "General" },+ { key: "privacy", label: "Privacy" },+ { key: "about", label: "About Mirai" },+ ];++ const tabComponents: Record<SettingsTab, React.ReactNode> = {+ general: <GeneralTab />,+ privacy: <PrivacyTab />,+ about: <AboutTab />,+ };++ const isSidebarOpen = useSidebarStore((s) => s.isOpen);++ return (+ <div className="h-[calc(100vh-24px)] w-full bg-background text-label-title pt-4">+ <div className="h-full flex flex-col">+ <div className={twMerge("px-5 text-center lg:text-left sticky top-0 z-10 bg-background")}>+ <h1+ className={twMerge(+ "text-[15px] leading-[150%] font-medium mb-4 transition-all duration-300 ease-in-out",+ !isSidebarOpen && "text-center",+ )}+ >+ Settings+ </h1>+ </div>+ <div className="h-[1px] bg-cell-border" />++ <div className="lg:hidden px-5 py-4 sticky top-[52px] z-10 bg-background">+ <div className="flex gap-2 overflow-x-auto thin-scrollbar">+ {sections.map((s) => (+ <Link key={s.key} to="/settings" search={{ tab: s.key }} className="flex-shrink-0">+ <Button kind={s.key === tab ? "primary" : "ghost"} size="sm" className="whitespace-nowrap">+ {s.label}+ </Button>+ </Link>+ ))}+ </div>+ </div>++ <div className="flex flex-1 min-h-0">+ <aside className="hidden lg:block w-[152px] flex-shrink-0 h-full pt-2 overflow-auto thin-scrollbar border-r border-cell-border">+ <nav className="flex flex-col gap-2">+ {sections.map((s) => (+ <Link key={s.key} to="/settings" search={{ tab: s.key }} className="flex px-3">+ <div+ className={`flex items-center gap-3 px-2 py-[6px] w-full rounded-md ${s.key === tab ? "bg-bg-hover dark:bg-bg-hover" : ""} hover:bg-bg-hover `}+ >+ <span className="text-[13px] font-[350] leading-[150%] text-label-title">{s.label}</span>+ </div>+ </Link>+ ))}+ </nav>+ </aside>++ <section+ className={twMerge(+ "flex-1 lg:px-0 h-full overflow-auto thin-scrollbar [scrollbar-gutter:stable]",+ "pt-5 lg:pt-5",+ )}+ >+ {tabComponents[tab]}+ </section>+ </div>+ </div>+ </div>+ );+}diff --git a/apps/mirai-gui/client/src/features/welcome/components/welcome-page.tsx b/apps/mirai-gui/client/src/features/welcome/components/welcome-page.tsxnew file mode 100644index 000000000..90be8bccf--- /dev/null+++ b/apps/mirai-gui/client/src/features/welcome/components/welcome-page.tsx@@ -0,0 +1,37 @@+import { useEffect, useState } from "react";+import WelcomeScreen from "./welcome-screen";++const waitFrames = (count: number): Promise<void> =>+ new Promise<void>((resolve) => {+ const step = (n: number): void => {+ if (n <= 0) {+ resolve();+ return;+ }+ requestAnimationFrame(() => step(n - 1));+ };+ step(count);+ });++export function WelcomePage() {+ const [show, setShow] = useState(false);++ useEffect(() => {+ let cancelled = false;+ void document.fonts.ready+ .catch(() => undefined)+ .then(() => waitFrames(10))+ .then(() => {+ if (!cancelled) setShow(true);+ });+ return () => {+ cancelled = true;+ };+ }, []);++ return (+ <div className="relative w-screen h-screen flex items-start justify-center bg-background dark:bg-[linear-gradient(180deg,#1A1A1A_0%,#0A0A0A_100%)]">+ {show ? <WelcomeScreen /> : null}+ </div>+ );+}diff --git a/apps/mirai-gui/client/src/features/welcome/components/welcome-screen.tsx b/apps/mirai-gui/client/src/features/welcome/components/welcome-screen.tsxnew file mode 100644index 000000000..a80465275--- /dev/null+++ b/apps/mirai-gui/client/src/features/welcome/components/welcome-screen.tsx@@ -0,0 +1,160 @@+import { platformInfo } from "@/platform/platform-info";+import { useNavigate } from "@tanstack/react-router";+import { cubicBezier, motion } from "motion/react";+import { Lock, WifiOff } from "lucide-react";+import type { ReactNode } from "react";+import { twMerge } from "tailwind-merge";+import { useAppStore } from "@/stores/use-app-store";++import { LightningIcon } from "@/components/icons/lightning-icon";+import { Logo } from "@/components/icons/logo";+import { LogoLightMode } from "@/components/icons/logo-light-mode";+import { Button } from "@/components/ui/button";++const ease = cubicBezier(0.22, 1, 0.36, 1);++function WelcomeScreen() {+ const completeWelcome = useAppStore((s) => s.completeWelcome);+ const isDarkMode = useAppStore((s) => s.isDarkMode);+ const navigate = useNavigate();++ const handleContinue = () => {+ completeWelcome();+ navigate({ to: platformInfo.isTauri ? "/local-models" : "/chats" });+ };++ const featureItem = (icon: ReactNode, text: string, delayS: number) => (+ <motion.div+ className="flex items-center gap-2"+ initial={{ y: 10, opacity: 0 }}+ animate={{ y: 0, opacity: 1 }}+ transition={{ duration: 1.5, ease, delay: delayS }}+ >+ <div className="text-label-title">{icon}</div>+ <span className="text-[13px] leading-[130%] font-normal text-label-muted">{text}</span>+ </motion.div>+ );++ const renderAnimatedTitle = (text: string, baseDelay = 0.5, charDelay = 0.05) => {+ const chars = Array.from(text);++ return (+ <h1 className="text-[28px] leading-[130%] font-medium text-label-title">+ {chars.map((ch, i) => (+ <motion.span+ key={`${i}-${ch}`}+ style={{ display: "inline-block" }}+ initial={{+ opacity: 0,+ y: 40,+ scale: 2,+ filter: "blur(30px)",+ }}+ animate={{ opacity: 1, y: 0, scale: 1, filter: "blur(0px)" }}+ transition={{+ ease,+ duration: 1.5,+ delay: baseDelay + i * charDelay,+ }}+ >+ {ch === " " ? "\u00A0" : ch}+ </motion.span>+ ))}+ </h1>+ );+ };++ const renderAnimatedSubtitle = (lines: string[], baseDelay = 1, lineDelay = 0) => (+ <div className="mt-4 md:mt-3 text-[16px] leading-[130%] font-[450] text-label-muted">+ {lines.map((line, i) => (+ <motion.div+ key={`${i}-${line}`}+ initial={{+ opacity: 0,+ scale: 0.5,+ filter: "blur(50px)",+ }}+ animate={{ opacity: 1, scale: 1, filter: "blur(0px)" }}+ transition={{+ ease,+ duration: 1.5,+ delay: baseDelay + i * lineDelay,+ }}+ >+ {line}+ </motion.div>+ ))}+ </div>+ );++ return (+ <div className={twMerge("relative max-h-screen flex justify-center h-full", !isDarkMode && "bg-background")}>+ <div className="w-full max-w-[500px] md:min-h-0 px-6 md:px-8 pt-10 md:pt-12 pb-8 md:pb-10 grid grid-rows-[auto_1fr_auto] md:flex md:flex-col md:justify-center">+ <div className="contents">+ <motion.div+ className="flex md:justify-center"+ initial={{ scale: 2, opacity: 0 }}+ animate={{ scale: 1, opacity: 1 }}+ transition={{ duration: 1.5, ease, delay: 0 }}+ >+ {isDarkMode ? (+ <Logo+ width={66}+ height={57}+ className="text-label-title"+ style={{+ willChange: "transform,opacity",+ transform: "translateZ(0)",+ }}+ />+ ) : (+ <LogoLightMode+ width={48}+ height={24}+ style={{+ willChange: "transform,opacity",+ transform: "translateZ(0)",+ }}+ />+ )}+ </motion.div>++ <div className="flex flex-col md:items-center justify-center md:text-center md:mt-[162px]">+ {renderAnimatedTitle("Welcome to Mirai", 0.5, 0.05)}+ {renderAnimatedSubtitle(+ [+ platformInfo.isWeb+ ? "Your private AI assistant, accessible anywhere"+ : "Try the full private and local AI potential of your Mac",+ ],+ 1,+ 0,+ )}+ </div>++ <div className="flex flex-col items-start md:items-center w-full md:mt-[120px]">+ <div className="flex flex-col md:flex-row md:items-center md:justify-center md:gap-6 gap-4">+ {featureItem(<Lock size={14} />, "100% Private", 2.0)}+ {featureItem(<LightningIcon className="w-[14px] h-[15px]" />, "Blazing Fast Responses", 2.2)}+ {!platformInfo.isWeb && featureItem(<WifiOff size={14} />, "Works Offline", 2.4)}+ </div>++ <div className="w-full mt-8">+ <motion.div+ initial={{ opacity: 0 }}+ animate={{ opacity: 1 }}+ transition={{ duration: 2, ease, delay: 3.2 }}+ >+ <Button kind="primary" size="lg" fullWidth onClick={handleContinue}>+ Get started+ </Button>+ </motion.div>+ </div>+ </div>+ </div>+ </div>+ </div>+ );+}++export default WelcomeScreen;diff --git a/apps/mirai-gui/client/src/hooks/session-wiring/adapters.test.ts b/apps/mirai-gui/client/src/hooks/session-wiring/adapters.test.tsnew file mode 100644index 000000000..796669b53--- /dev/null+++ b/apps/mirai-gui/client/src/hooks/session-wiring/adapters.test.ts@@ -0,0 +1,79 @@+import { beforeEach, expect, it, vi } from "vitest";+import type { SessionLoadingPayload, SessionStatePayload } from "@/platform/services/session";+import { useChatSessionStore } from "@/stores/use-chat-session-store";+import { useRuntimeSessionStore } from "@/stores/use-runtime-session-store";+import { bindChatLoading, bindChatSessionState } from "./adapters";++const mocks = vi.hoisted(() => ({+ loading: null as ((p: SessionLoadingPayload) => void) | null,+ state: null as ((p: SessionStatePayload) => void) | null,+}));+vi.mock("@/platform/platform-singleton", () => ({+ getPlatform: () => ({+ session: {+ onSessionLoading: (cb: (p: SessionLoadingPayload) => void) => {+ mocks.loading = cb;+ return () => {};+ },+ onSessionState: (cb: (p: SessionStatePayload) => void) => {+ mocks.state = cb;+ return () => {};+ },+ },+ }),+}));++const sessionDefaults = useChatSessionStore.getState();+const runtimeDefaults = useRuntimeSessionStore.getState();+const REPO = "vendor/model";++beforeEach(() => {+ useChatSessionStore.setState(sessionDefaults, true);+ useRuntimeSessionStore.setState(runtimeDefaults, true);+ bindChatLoading();+ bindChatSessionState();+});++it("marks the model as loading on the start event", () => {+ mocks.loading?.({ status: "start", repoId: REPO });++ expect(useChatSessionStore.getState().isModelLoading).toBe(true);+ expect(useRuntimeSessionStore.getState().loadingSession).toEqual({ repoId: REPO });+});++it("clears the loading state on the error event", () => {+ mocks.loading?.({ status: "start", repoId: REPO });+ mocks.loading?.({ status: "error", repoId: REPO });++ expect(useChatSessionStore.getState().isModelLoading).toBe(false);+ expect(useRuntimeSessionStore.getState().loadingSession).toBeNull();+});++it("keeps a held run operation across a model load", () => {+ useChatSessionStore.setState({ operationState: "running", operationId: "held-by-test" });+ mocks.loading?.({ status: "start", repoId: REPO });+ expect(useChatSessionStore.getState().operationState).toBe("running");+ mocks.state?.({ active: true, repoId: REPO, isEjecting: false });++ expect(useChatSessionStore.getState().isModelLoading).toBe(false);+ expect(useChatSessionStore.getState().operationState).toBe("running");+});++it("keeps a held run operation across a backend eject", () => {+ useRuntimeSessionStore.setState({ residentSession: { repoId: REPO } });+ useChatSessionStore.setState({ operationState: "running", operationId: "held-by-test" });+ mocks.state?.({ active: true, repoId: REPO, isEjecting: true });+ expect(useChatSessionStore.getState()).toMatchObject({ isEjecting: true, operationState: "running" });+ mocks.state?.({ active: false, repoId: REPO, isEjecting: false });++ expect(useChatSessionStore.getState()).toMatchObject({ isEjecting: false, operationState: "running" });+});++it("turns a finished load into the resident session", () => {+ mocks.loading?.({ status: "start", repoId: REPO });+ mocks.state?.({ active: true, repoId: REPO, isEjecting: false });++ expect(useChatSessionStore.getState().isModelLoading).toBe(false);+ expect(useRuntimeSessionStore.getState().loadingSession).toBeNull();+ expect(useRuntimeSessionStore.getState().residentSession).toEqual({ repoId: REPO });+});diff --git a/apps/mirai-gui/client/src/hooks/session-wiring/adapters.ts b/apps/mirai-gui/client/src/hooks/session-wiring/adapters.tsnew file mode 100644index 000000000..6e541ea10--- /dev/null+++ b/apps/mirai-gui/client/src/hooks/session-wiring/adapters.ts@@ -0,0 +1,68 @@+import { useRuntimeSessionStore } from "@/stores/use-runtime-session-store";+import { useChatSessionStore } from "@/stores/use-chat-session-store";+import type { RuntimeSessionRef } from "@/types/session";+import { getPlatform } from "@/platform/platform-singleton";+import type { SessionLoadingPayload, SessionStatePayload } from "@/platform/services/session";++const toChatSession = (payload: { repoId?: string; active?: boolean }): RuntimeSessionRef | null => {+ if (!payload.repoId || payload.active === false) {+ return null;+ }+ return { repoId: payload.repoId };+};++const toChatSessionTarget = (payload: { repoId?: string }): RuntimeSessionRef | null =>+ payload.repoId ? { repoId: payload.repoId } : null;++const applyChatSessionState = (payload: SessionStatePayload, session: RuntimeSessionRef | null): void => {+ const target = toChatSessionTarget(payload);+ if (!target) {+ return;+ }++ const currentResident = useRuntimeSessionStore.getState().residentSession;+ const currentEjecting = useRuntimeSessionStore.getState().ejectingSession;+ const isCurrentResidentTarget = currentResident?.repoId === target.repoId;+ const isCurrentEjectingTarget = currentEjecting?.repoId === target.repoId;++ if (payload.isEjecting === true) {+ if (isCurrentResidentTarget || isCurrentEjectingTarget) {+ useChatSessionStore.getState().setEjecting(true);+ useRuntimeSessionStore.getState().setEjectingSession(target);+ }+ }++ if (payload.active === true) {+ useChatSessionStore.getState().endModelLoading();+ useRuntimeSessionStore.getState().setResidentSession(session);+ }++ if (payload.active === false && isCurrentResidentTarget) {+ useRuntimeSessionStore.getState().setResidentSession(null);+ }++ if (payload.isEjecting === false && (isCurrentEjectingTarget || isCurrentResidentTarget)) {+ useChatSessionStore.getState().setEjecting(false);+ useRuntimeSessionStore.getState().setEjectingSession(null);+ }+};++const applyChatLoading = (payload: SessionLoadingPayload): void => {+ if (payload.status === "start") {+ useChatSessionStore.getState().startModelLoading();+ useRuntimeSessionStore.getState().startLoadingSession({ repoId: payload.repoId });+ }+ if (payload.status === "error") {+ useChatSessionStore.getState().endModelLoading();+ useRuntimeSessionStore.getState().endLoadingSession();+ }+};++export const bindChatSessionState = (): (() => void) => {+ const { session } = getPlatform();+ return session.onSessionState((payload) => {+ applyChatSessionState(payload, toChatSession(payload));+ });+};++export const bindChatLoading = (): (() => void) => getPlatform().session.onSessionLoading(applyChatLoading);diff --git a/apps/mirai-gui/client/src/hooks/session-wiring/index.ts b/apps/mirai-gui/client/src/hooks/session-wiring/index.tsnew file mode 100644index 000000000..1a329b3fe--- /dev/null+++ b/apps/mirai-gui/client/src/hooks/session-wiring/index.ts@@ -0,0 +1,14 @@+import { useEffect } from "react";+import { bindChatLoading, bindChatSessionState } from "./adapters";++export const useSessionWiring = (enabled: boolean = true) => {+ useEffect(() => {+ if (!enabled) return;+ const unbindState = bindChatSessionState();+ const unbindLoading = bindChatLoading();+ return () => {+ unbindState();+ unbindLoading();+ };+ }, [enabled]);+};diff --git a/apps/mirai-gui/client/src/hooks/use-app-initialization.ts b/apps/mirai-gui/client/src/hooks/use-app-initialization.tsnew file mode 100644index 000000000..a198b2f93--- /dev/null+++ b/apps/mirai-gui/client/src/hooks/use-app-initialization.ts@@ -0,0 +1,29 @@+import { useAppStore } from "@/stores/use-app-store";+import { getPlatform } from "@/platform/platform-singleton";+import { platformInfo } from "@/platform/platform-info";+import { useModelParamsStore } from "@/stores/use-model-params-store";+import { useModelsStore } from "@/stores/use-models-store";+import { attachmentStorage } from "@/features/chat/services/attachment-storage";+import { useEffect } from "react";+import { useSessionWiring } from "./session-wiring";+import { useDownloadWiring } from "./use-download-wiring";+import { useUpdateInitialization } from "./use-update-initialization";++export const useAppInitialization = (enabled: boolean = true) => {+ useSessionWiring(enabled);+ useDownloadWiring(enabled);+ useUpdateInitialization(enabled && platformInfo.features.autoUpdate);++ useEffect(() => {+ if (!enabled) return;+ attachmentStorage.cleanup();+ void useModelParamsStore.getState().load();+ void useModelsStore.getState().fetchModels();+ if (platformInfo.isTauri) {+ void useAppStore.getState().fetchVersion();+ void getPlatform()+ .systemUi.setWindowTheme(useAppStore.getState().isDarkMode)+ .catch(() => {});+ }+ }, [enabled]);+};diff --git a/apps/mirai-gui/client/src/hooks/use-app-navigation-events.ts b/apps/mirai-gui/client/src/hooks/use-app-navigation-events.tsnew file mode 100644index 000000000..39cbf6813--- /dev/null+++ b/apps/mirai-gui/client/src/hooks/use-app-navigation-events.ts@@ -0,0 +1,65 @@+import { useChatStore } from "@/stores/use-chat-store";+import { useModelsStore } from "@/stores/use-models-store";+import { useNavigate } from "@tanstack/react-router";+import { useCallback, useEffect } from "react";+import { v4 as uuidv4 } from "uuid";+import { getPlatform } from "@/platform/platform-singleton";+import { navigationRequestTypes, type NavigationRequest } from "@/platform/platform-client";++type NavigationHandlers = {+ [K in NavigationRequest["type"]]: (req: Extract<NavigationRequest, { type: K }>) => void;+};++export const useAppNavigationEvents = (): void => {+ const createNewChat = useChatStore((s) => s.createNewChat);+ const navigate = useNavigate();++ const openNewChatForModel = useCallback(+ (identifier: string) => {+ const model = useModelsStore.getState().models.find((m) => m.repoId === identifier);+ const modelName = model?.name ?? identifier;+ const newChatId = uuidv4();+ createNewChat(newChatId);+ navigate({+ to: "/chat/$chatId",+ params: { chatId: newChatId },+ search: {+ model: identifier,+ modelName,+ isNew: true,+ },+ });+ },+ [createNewChat, navigate],+ );++ useEffect(() => {+ const handlers: NavigationHandlers = {+ [navigationRequestTypes.newChat]: () => {+ const newChatId = uuidv4();+ createNewChat(newChatId);+ navigate({ to: "/chat/$chatId", params: { chatId: newChatId }, search: { isNew: true } });+ },+ [navigationRequestTypes.openPreferences]: () => navigate({ to: "/settings", search: { tab: "general" } }),+ };++ const offPlatform = getPlatform().system.onNavigationRequest((req) => {+ const handler = handlers[req.type] as (r: NavigationRequest) => void;+ handler(req);+ });++ const onOpenChatForModelDom = (ev: Event) => {+ if (!(ev instanceof CustomEvent)) return;+ const identifier = typeof ev.detail?.identifier === "string" ? ev.detail.identifier : "";+ if (!identifier) return;+ openNewChatForModel(identifier);+ };++ window.addEventListener(navigationRequestTypes.openChatForModel, onOpenChatForModelDom as EventListener);++ return () => {+ offPlatform();+ window.removeEventListener(navigationRequestTypes.openChatForModel, onOpenChatForModelDom as EventListener);+ };+ }, [createNewChat, navigate, openNewChatForModel]);+};diff --git a/apps/mirai-gui/client/src/hooks/use-download-wiring.ts b/apps/mirai-gui/client/src/hooks/use-download-wiring.tsnew file mode 100644index 000000000..e8e95840b--- /dev/null+++ b/apps/mirai-gui/client/src/hooks/use-download-wiring.ts@@ -0,0 +1,10 @@+import { getPlatform } from "@/platform/platform-singleton";+import { useModelsStore } from "@/stores/use-models-store";+import { useEffect } from "react";++export const useDownloadWiring = (enabled: boolean = true) => {+ useEffect(() => {+ if (!enabled) return;+ return getPlatform().models.onDownloadEvent((event) => useModelsStore.getState().applyDownloadEvent(event));+ }, [enabled]);+};diff --git a/apps/mirai-gui/client/src/hooks/use-global-download-toasts.ts b/apps/mirai-gui/client/src/hooks/use-global-download-toasts.tsnew file mode 100644index 000000000..4f6ac3549--- /dev/null+++ b/apps/mirai-gui/client/src/hooks/use-global-download-toasts.ts@@ -0,0 +1,39 @@+import { useToast } from "@/components/ui/toast/use-toast";+import { getPlatform } from "@/platform/platform-singleton";+import { navigationRequestTypes } from "@/platform/platform-client";+import { useModelsStore } from "@/stores/use-models-store";+import { useEffect } from "react";++const isAppFocused = (): boolean => document.visibilityState === "visible" && document.hasFocus();++const modelName = (identifier: string): string =>+ useModelsStore.getState().models.find((model) => model.repoId === identifier)?.name ?? identifier;++const openChatForModel = (identifier: string): void => {+ window.dispatchEvent(new CustomEvent(navigationRequestTypes.openChatForModel, { detail: { identifier } }));+};++export const useGlobalDownloadToasts = (): void => {+ const toast = useToast();++ useEffect(+ () =>+ getPlatform().models.onDownloadEvent((event) => {+ // The backend raises a system notification when the window is out of sight.+ if (!isAppFocused()) return;+ const name = modelName(event.identifier);+ switch (event.kind) {+ case "done":+ toast.success(`Downloaded ${name}`, { onClick: () => openChatForModel(event.identifier) });+ return;+ case "error":+ toast.error(`Failed to download ${name}: ${event.error}`);+ return;+ case "locked":+ toast.info(`${name} download is locked by another process (${event.lockedBy}).`);+ return;+ }+ }),+ [toast],+ );+};diff --git a/apps/mirai-gui/client/src/hooks/use-media-query.ts b/apps/mirai-gui/client/src/hooks/use-media-query.tsnew file mode 100644index 000000000..e54777933--- /dev/null+++ b/apps/mirai-gui/client/src/hooks/use-media-query.ts@@ -0,0 +1,23 @@+import { useState, useEffect } from "react";++export function useMediaQuery(query: string): boolean {+ const [matches, setMatches] = useState(() =>+ typeof window !== "undefined" ? window.matchMedia(query).matches : false,+ );++ useEffect(() => {+ const media = window.matchMedia(query);+ setMatches(media.matches);++ const listener = (event: MediaQueryListEvent) => setMatches(event.matches);+ media.addEventListener("change", listener);++ return () => media.removeEventListener("change", listener);+ }, [query]);++ return matches;+}++export function useIsMobile(): boolean {+ return useMediaQuery("(max-width: 767px)");+}diff --git a/apps/mirai-gui/client/src/hooks/use-save-failure-toast.test.ts b/apps/mirai-gui/client/src/hooks/use-save-failure-toast.test.tsnew file mode 100644index 000000000..78eaa04ee--- /dev/null+++ b/apps/mirai-gui/client/src/hooks/use-save-failure-toast.test.ts@@ -0,0 +1,21 @@+import { cleanup, renderHook } from "@testing-library/react";+import { afterEach, beforeEach, expect, it, vi } from "vitest";+import { useChatStore } from "@/stores/use-chat-store";+import { useSaveFailureToast } from "./use-save-failure-toast";++const mocks = vi.hoisted(() => ({ error: vi.fn() }));+vi.mock("@/components/ui/toast/use-toast", () => ({ useToast: () => ({ error: mocks.error }) }));++afterEach(cleanup);++beforeEach(() => {+ mocks.error.mockClear();+ useChatStore.setState({ saveFailureCount: 0 });+});++it("does not warn about failures that happened before it mounted", () => {+ useChatStore.setState({ saveFailureCount: 3 });+ renderHook(() => useSaveFailureToast());++ expect(mocks.error).not.toHaveBeenCalled();+});diff --git a/apps/mirai-gui/client/src/hooks/use-save-failure-toast.ts b/apps/mirai-gui/client/src/hooks/use-save-failure-toast.tsnew file mode 100644index 000000000..3acdaf83f--- /dev/null+++ b/apps/mirai-gui/client/src/hooks/use-save-failure-toast.ts@@ -0,0 +1,15 @@+import { useEffect, useRef } from "react";+import { useToast } from "@/components/ui/toast/use-toast";+import { useChatStore } from "@/stores/use-chat-store";++// A reply can finish and fail to save while another page is open, so the toast lives at the root.+export const useSaveFailureToast = (): void => {+ const toast = useToast();+ const saveFailureCount = useChatStore((s) => s.saveFailureCount);+ const seenRef = useRef(saveFailureCount);+ useEffect(() => {+ if (saveFailureCount === seenRef.current) return;+ seenRef.current = saveFailureCount;+ toast.error("Failed to save the message. It may be missing after a restart.", { id: "chat-save-failed" });+ }, [saveFailureCount, toast]);+};diff --git a/apps/mirai-gui/client/src/hooks/use-shift-held.ts b/apps/mirai-gui/client/src/hooks/use-shift-held.tsnew file mode 100644index 000000000..6cf5f08d1--- /dev/null+++ b/apps/mirai-gui/client/src/hooks/use-shift-held.ts@@ -0,0 +1,31 @@+import { useSyncExternalStore } from "react";++let shiftHeld = false;+const listeners = new Set<() => void>();++const setShiftHeld = (value: boolean) => {+ if (shiftHeld === value) return;+ shiftHeld = value;+ listeners.forEach((notify) => notify());+};++if (typeof window !== "undefined") {+ window.addEventListener("keydown", (e) => setShiftHeld(e.shiftKey), true);+ // On a Shift keyup e.shiftKey can still read true; without the key check the flag sticks.+ window.addEventListener("keyup", (e) => setShiftHeld(e.shiftKey && e.key !== "Shift"), true);+ // Keyup never arrives if focus left the window while Shift was down.+ window.addEventListener("blur", () => setShiftHeld(false));+}++const subscribe = (notify: () => void): (() => void) => {+ listeners.add(notify);+ return () => {+ listeners.delete(notify);+ };+};++const getSnapshot = (): boolean => shiftHeld;+const getServerSnapshot = (): boolean => false;++/** True while Shift is held; window-level singleton, safe for many subscribers. */+export const useShiftHeld = (): boolean => useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);diff --git a/apps/mirai-gui/client/src/hooks/use-update-initialization.ts b/apps/mirai-gui/client/src/hooks/use-update-initialization.tsnew file mode 100644index 000000000..5a10e0c6c--- /dev/null+++ b/apps/mirai-gui/client/src/hooks/use-update-initialization.ts@@ -0,0 +1,61 @@+import { useEffect } from "react";+import { toast } from "react-hot-toast";+import { dismissUpdateToast, showReadyUpdateToast } from "@/components/update-toast/notifications";+import { UpdateCheckOutcome, UpdatePhase, useUpdateStore } from "@/stores/use-update-store";++const UPDATE_TOAST_ID = "update-toast";+const UPDATE_CHECK_INTERVAL_MS = 6 * 60 * 60 * 1000;+const UPDATE_RETRY_INTERVAL_MS = 60 * 60 * 1000;++const startUpdateChecks = (): (() => void) => {+ const { initUpdateCheck, checkForUpdate } = useUpdateStore.getState();+ let timer: ReturnType<typeof setTimeout> | undefined;+ let stopped = false;++ const loop = async (check: () => Promise<UpdateCheckOutcome>) => {+ const outcome = await check();+ if (stopped) return;+ const delay = outcome === UpdateCheckOutcome.Failed ? UPDATE_RETRY_INTERVAL_MS : UPDATE_CHECK_INTERVAL_MS;+ timer = setTimeout(() => void loop(checkForUpdate), delay);+ };+ void loop(initUpdateCheck);++ return () => {+ stopped = true;+ clearTimeout(timer);+ };+};++export const useUpdateInitialization = (enabled: boolean = true) => {+ const status = useUpdateStore((s) => s.status);+ const { startDownload, applyUpdate, dismiss } = useUpdateStore.getState();++ useEffect(() => (enabled ? startUpdateChecks() : undefined), [enabled]);++ // Downloads start silently; the user only sees the toast once it can install.+ useEffect(() => {+ if (status.phase === UpdatePhase.Idle) {+ dismissUpdateToast(UPDATE_TOAST_ID);+ if (status.downloadError) {+ toast.error(`Update download failed: ${status.downloadError}`);+ useUpdateStore.setState({ status: { phase: UpdatePhase.Idle } });+ }+ return;+ }++ if (status.phase === UpdatePhase.Available) {+ void startDownload(status.version);+ return;+ }++ if (status.phase === UpdatePhase.Downloaded) {+ showReadyUpdateToast({+ version: status.version,+ toastId: UPDATE_TOAST_ID,+ errorMessage: status.applyError,+ onApplyNow: () => applyUpdate(),+ onLater: () => dismiss(),+ });+ }+ }, [status, startDownload, applyUpdate, dismiss]);+};diff --git a/apps/mirai-gui/client/src/index.css b/apps/mirai-gui/client/src/index.cssnew file mode 100644index 000000000..b9d1fb8bd--- /dev/null+++ b/apps/mirai-gui/client/src/index.css@@ -0,0 +1,197 @@+@font-face {+ font-family: InterVariable;+ font-style: normal;+ font-weight: 100 900;+ font-display: swap;+ src: url("/fonts/InterVariable.woff2") format("woff2");+}+@font-face {+ font-family: InterVariable;+ font-style: italic;+ font-weight: 100 900;+ font-display: swap;+ src: url("/fonts/InterVariable-Italic.woff2") format("woff2");+}++@font-face {+ font-family: "Geist Mono";+ font-style: normal;+ font-weight: 100 900;+ font-display: swap;+ src: url("/fonts/GeistMono-VariableFont_wght.ttf") format("truetype");+}++@import "tailwindcss";+@import "./styles/theme.css";+/* node_modules is skipped by source detection; streamdown ships class names. */+@source "../../node_modules/streamdown/dist";+@custom-variant dark (&:where(.dark, .dark *));++@utility thin-scrollbar {+ &::-webkit-scrollbar {+ width: 6px;+ height: 6px;+ }+ &::-webkit-scrollbar-track {+ background-color: transparent;+ }+ &::-webkit-scrollbar-thumb {+ background-color: var(--color-gray-500);+ border-radius: 9999px;+ }+}++@layer base {+ /* Tailwind 4 defaults borders to currentColor, buttons to cursor: default and+ placeholders to a translucent currentColor; the app was designed on the+ Tailwind 3 defaults, kept here. */+ *,+ ::after,+ ::before,+ ::backdrop,+ ::file-selector-button {+ border-color: var(--color-gray-200);+ }+ button:not(:disabled),+ [role="button"]:not(:disabled) {+ cursor: pointer;+ }+ input::placeholder,+ textarea::placeholder {+ opacity: 1;+ color: #9ca3af;+ }++ /* Native scrollbars and form controls must follow the app theme; without+ this WebKit draws them for the light scheme (black bar on dark lists). */+ :root {+ color-scheme: light;+ font-synthesis: none;+ text-rendering: optimizeLegibility;+ }+ :root.dark {+ color-scheme: dark;+ }++ html,+ body,+ #root {+ height: 100%;+ }++ body {+ @apply bg-background text-label-title font-sans;+ font-family: InterVariable, Inter, system-ui, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;+ }+ code,+ kbd,+ samp,+ pre {+ @apply font-mono;+ }++ input[type="number"]::-webkit-outer-spin-button,+ input[type="number"]::-webkit-inner-spin-button {+ -webkit-appearance: none;+ margin: 0;+ }+ input[type="number"] {+ -moz-appearance: textfield;+ appearance: textfield;+ }++ .shiki {+ --shiki-font-family: var(--font-mono);+ font-family: var(--font-mono);+ font-variant-ligatures: none;+ }+ .shiki code {+ font-family: inherit;+ }++ a[data-streamdown="link"] {+ @apply font-[350]! text-blue! no-underline! hover:underline!;+ font-feature-settings:+ "liga" 0,+ "clig" 0;+ }++ [data-streamdown="code-block"] {+ @apply w-full overflow-hidden border border-cell-border bg-bg-modal;+ /* The 200px placeholder flashes a scrollbar as the block scrolls into view. */+ content-visibility: visible !important;+ }++ [data-streamdown="code-block-header"] {+ @apply relative border-b border-cell-border bg-bg-modal px-3 py-2 text-xs text-label-muted;+ padding-right: 2.5rem;+ }++ [data-streamdown="code-block-actions"] {+ border: 0 !important;+ padding: 0 !important;+ backdrop-filter: none !important;+ }++ [data-streamdown="code-block-actions"] button {+ @apply min-w-6 min-h-6;+ }++ [data-streamdown="code-block-body"] {+ @apply p-4;+ background: transparent !important;+ border: 0 !important;+ font-size: 12px !important;+ line-height: 1rem !important;+ font-weight: 400;+ font-variant-ligatures: none;+ }++ [data-streamdown="code-block-body"] code {+ font-size: inherit;+ line-height: inherit;+ font-variant-ligatures: none;+ }++ [data-streamdown="code-block-body"]::-webkit-scrollbar {+ @apply w-[6px];+ height: 6px;+ }++ [data-streamdown="code-block-body"]::-webkit-scrollbar-track {+ @apply bg-transparent;+ }++ [data-streamdown="code-block-body"]::-webkit-scrollbar-thumb {+ @apply bg-button-border rounded-full;+ }++ .dark [data-streamdown="code-block-body"]::-webkit-scrollbar-thumb {+ @apply bg-cell-border;+ }++ [data-streamdown="code-block-body"] span::before {+ content: none !important;+ display: none !important;+ }+}++@layer components {+ .scrollbar-hide {+ scrollbar-width: none;+ }+ .scrollbar-hide::-webkit-scrollbar {+ display: none;+ }++ .drag-layer {+ /* Dragging is handled by data-tauri-drag-region on real containers, so this+ overlay only needs to stay click-transparent. */+ pointer-events: none;+ z-index: 50;+ }+ .overlay-button {+ pointer-events: auto;+ z-index: 60;+ }+}diff --git a/apps/mirai-gui/client/src/index.tsx b/apps/mirai-gui/client/src/index.tsxnew file mode 100644index 000000000..d4a739a98--- /dev/null+++ b/apps/mirai-gui/client/src/index.tsx@@ -0,0 +1,47 @@+import React from "react";++import ReactDOM from "react-dom/client";+import { RouterProvider } from "@tanstack/react-router";+import { createAppRouter } from "./router";+import "./index.css";+import { RuntimeLoader } from "@rive-app/react-canvas";+import riveWasmUrl from "@rive-app/canvas/rive.wasm?url";+import { initPlatform } from "./platform/platform-singleton";+import { TauriPlatformClient } from "./platform/tauri-platform-client";+import { WebPlatformClient } from "./platform/web-platform-client";+import { platformInfo } from "./platform/platform-info";+import { APP_STORE_KEY } from "./stores/migrate-app-storage";++RuntimeLoader.setWasmUrl(riveWasmUrl);++type PersistedAppState = { isDarkMode?: unknown; skipWelcome?: unknown };++const readPersistedAppState = (): PersistedAppState => {+ try {+ const stored = localStorage.getItem(APP_STORE_KEY);+ return stored ? (JSON.parse(stored)?.state ?? {}) : {};+ } catch {+ return {};+ }+};++const persistedAppState = readPersistedAppState();++document.documentElement.classList.toggle("dark", persistedAppState.isDarkMode !== false);++const getInitialPath = (): string => {+ if (!persistedAppState.skipWelcome) return "/welcome";+ return platformInfo.isTauri ? "/local-models" : "/chats";+};++if (platformInfo.isTauri) {+ initPlatform(new TauriPlatformClient());+} else {+ initPlatform(new WebPlatformClient());+}++ReactDOM.createRoot(document.getElementById("root")!).render(+ <React.StrictMode>+ <RouterProvider router={createAppRouter(getInitialPath())} />+ </React.StrictMode>,+);diff --git a/apps/mirai-gui/client/src/platform/platform-client.ts b/apps/mirai-gui/client/src/platform/platform-client.tsnew file mode 100644index 000000000..6991e6550--- /dev/null+++ b/apps/mirai-gui/client/src/platform/platform-client.ts@@ -0,0 +1,24 @@+import type { ChatService } from "./services/chat";+import type { DialogsService } from "./services/dialogs";+import type { ModelsService } from "./services/models";+import type { SessionService } from "./services/session";+import type { SettingsService } from "./services/settings";+import type { StorageService } from "./services/storage";+import type { SystemService } from "./services/system";+import type { SystemUiService } from "./services/system-ui";+import type { UpdaterService } from "./services/updater";++export type PlatformClient = {+ chat: ChatService;+ session: SessionService;+ models: ModelsService;+ storage: StorageService;+ settings: SettingsService;+ system: SystemService;+ systemUi: SystemUiService;+ updater: UpdaterService;+ dialogs: DialogsService;+};++export { navigationRequestTypes } from "./types/navigation";+export type { NavigationRequest } from "./types/navigation";diff --git a/apps/mirai-gui/client/src/platform/platform-info.ts b/apps/mirai-gui/client/src/platform/platform-info.tsnew file mode 100644index 000000000..e0435159d--- /dev/null+++ b/apps/mirai-gui/client/src/platform/platform-info.ts@@ -0,0 +1,17 @@+export const platformInfo = {+ isWeb: __PLATFORM__ === "web",+ isTauri: __PLATFORM__ === "tauri",+ features: {+ autoUpdate: __PLATFORM__ === "tauri",+ fileSystem: __PLATFORM__ === "tauri",+ logExport: __PLATFORM__ === "tauri",+ localModelDownloads: __PLATFORM__ === "tauri",+ startupLaunch: __PLATFORM__ === "tauri",+ globalShortcut: __PLATFORM__ === "tauri",+ autoEject: __PLATFORM__ === "tauri",+ cliInstall: __PLATFORM__ === "tauri",+ // Overlay title bar with in-content macOS traffic lights: UI must reserve+ // space on the top-left so controls don't sit under the traffic lights.+ nativeTitleBar: __PLATFORM__ === "tauri",+ },+} as const;diff --git a/apps/mirai-gui/client/src/platform/platform-singleton.ts b/apps/mirai-gui/client/src/platform/platform-singleton.tsnew file mode 100644index 000000000..e4c403cf7--- /dev/null+++ b/apps/mirai-gui/client/src/platform/platform-singleton.ts@@ -0,0 +1,17 @@+import type { PlatformClient } from "./platform-client";++let client: PlatformClient | null = null;++export function initPlatform(impl: PlatformClient): void {+ if (client !== null) {+ throw new Error("Platform already initialized.");+ }+ client = impl;+}++export function getPlatform(): PlatformClient {+ if (client === null) {+ throw new Error("Platform not initialized. Call initPlatform() before use.");+ }+ return client;+}diff --git a/apps/mirai-gui/client/src/platform/services/chat/empty-stats.ts b/apps/mirai-gui/client/src/platform/services/chat/empty-stats.tsnew file mode 100644index 000000000..5d6b4cd97--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/chat/empty-stats.ts@@ -0,0 +1,10 @@+import type { SessionOutputStats } from "@/types/llm-stream";++export const emptyStats = (): SessionOutputStats => ({+ prefillStats: {+ duration: 0,+ tokensCount: 0,+ tokensPerSecond: 0,+ },+ totalStats: { duration: 0, tokensCountInput: 0, tokensCountOutput: 0 },+});diff --git a/apps/mirai-gui/client/src/platform/services/chat/index.ts b/apps/mirai-gui/client/src/platform/services/chat/index.tsnew file mode 100644index 000000000..5f1e25e8c--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/chat/index.ts@@ -0,0 +1,18 @@+import type { LlmAsyncStream, LlmRunParams } from "@/types/llm-stream";+import type { SamplingPolicyPayload } from "@/types/sampling";++export type TitleGenParams = {+ repoId: string;+ messages: Array<{ role: "system" | "user" | "assistant"; content: string }>;+};++export type SamplingDefaults = Omit<Extract<SamplingPolicyPayload, { type: "Stochastic" }>, "type">;++export type ChatService = {+ runStream(params: LlmRunParams): LlmAsyncStream;+ cancelRun(runId: string): Promise<void>;+ generateTitle(params: TitleGenParams): Promise<string>;+ cancelTitleGen(): Promise<void>;+ /** Model's own generation defaults; null until that model's session is loaded. */+ getSamplingDefaults(repoId: string): Promise<SamplingDefaults | null>;+};diff --git a/apps/mirai-gui/client/src/platform/services/chat/run-stream.test.ts b/apps/mirai-gui/client/src/platform/services/chat/run-stream.test.tsnew file mode 100644index 000000000..4780daf66--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/chat/run-stream.test.ts@@ -0,0 +1,125 @@+import { describe, expect, it, vi } from "vitest";+import type { LlmRunParams, SessionOutputStats } from "@/types/llm-stream";+import { runLlmStream, type RunEvent, type RunTransport } from "./run-stream";++const params: LlmRunParams = { repoId: "vendor/model", messages: [{ role: "user", content: "hi" }] };++const stats: SessionOutputStats = {+ prefillStats: { duration: 0.1, tokensCount: 3, tokensPerSecond: 30 },+ generateStats: { duration: 1, tokensCount: 10, tokensPerSecond: 10 },+ totalStats: { duration: 1.1, tokensCountInput: 3, tokensCountOutput: 10 },+};++const fakeTransport = (start?: RunTransport["start"]) => {+ let emit: (event: RunEvent) => void = () => {+ throw new Error("run was not started");+ };+ const transport: RunTransport = {+ start:+ start ??+ ((_runId, _params, onEvent) => {+ emit = onEvent;+ return new Promise(() => {});+ }),+ cancel: vi.fn(() => Promise.resolve()),+ };+ return { transport, emit: (event: RunEvent) => emit(event) };+};++const readAll = async (stream: ReadableStream<string>): Promise<string> => {+ const reader = stream.getReader();+ let text = "";+ for (;;) {+ const { done, value } = await reader.read();+ if (done) return text;+ text += value;+ }+};++describe("runLlmStream", () => {+ it("streams chunks, closes on done and resolves the result", async () => {+ const { transport, emit } = fakeTransport();+ const run = runLlmStream(transport, params);+ const parsed = vi.fn();+ run.onParsed(parsed);++ emit({ type: "chunk", delta: "Hel" });+ emit({ type: "chunk", delta: "lo", parsed: { chainOfThought: "thinking" } });+ emit({ type: "done", text: "Hello", stats, finishReason: "Stop", parsed: { response: "Hello" } });++ expect(await readAll(run.stream)).toBe("Hello");+ expect(await run.result).toEqual({ text: "Hello", stats, finishReason: "Stop", parsed: { response: "Hello" } });+ expect(parsed.mock.calls).toEqual([[{ chainOfThought: "thinking" }], [{ response: "Hello" }]]);+ });++ it("ignores events that arrive after done", async () => {+ const { transport, emit } = fakeTransport();+ const run = runLlmStream(transport, params);++ emit({ type: "done", text: "A", stats, finishReason: "Stop" });+ emit({ type: "chunk", delta: "late" });+ emit({ type: "error", error: "late failure" });++ expect(await readAll(run.stream)).toBe("");+ expect((await run.result).error).toBeUndefined();+ });++ it("reports a backend error on both the stream and the result", async () => {+ const { transport, emit } = fakeTransport();+ const run = runLlmStream(transport, params);++ emit({ type: "error", error: "model exploded" });++ await expect(readAll(run.stream)).rejects.toThrow("model exploded");+ expect(await run.result).toMatchObject({ text: "", error: "model exploded" });+ });++ it("turns a rejected start into an error instead of hanging", async () => {+ const { transport } = fakeTransport(() => Promise.reject(new Error("invalid payload")));+ const run = runLlmStream(transport, params);++ expect(await run.result).toMatchObject({ text: "", error: "Error: invalid payload" });+ await expect(readAll(run.stream)).rejects.toThrow("invalid payload");+ });++ it("settles as cancelled on cancel and drops whatever the backend sends next", async () => {+ const { transport, emit } = fakeTransport();+ const run = runLlmStream(transport, params);++ emit({ type: "chunk", delta: "partial" });+ await run.cancel();+ await run.cancel();+ emit({ type: "done", text: "partial and more", stats, finishReason: "Stop" });++ expect(transport.cancel).toHaveBeenCalledWith(run.runId);+ expect(await run.result).toMatchObject({ text: "", finishReason: "Cancelled" });+ });++ it("settles as cancelled even when the cancel call fails", async () => {+ const { transport } = fakeTransport();+ transport.cancel = () => Promise.reject(new Error("ipc down"));+ const run = runLlmStream(transport, params);++ await expect(run.cancel()).rejects.toThrow("ipc down");+ expect(await run.result).toMatchObject({ finishReason: "Cancelled" });+ });++ it("settles as cancelled when the reader is cancelled", async () => {+ const { transport } = fakeTransport();+ const run = runLlmStream(transport, params);++ await run.stream.getReader().cancel();++ expect(await run.result).toMatchObject({ finishReason: "Cancelled" });+ });++ it("keeps the first outcome when cancel races a finished run", async () => {+ const { transport, emit } = fakeTransport();+ const run = runLlmStream(transport, params);++ emit({ type: "done", text: "Done", stats, finishReason: "Stop" });+ await run.cancel();++ expect(await run.result).toMatchObject({ text: "Done", finishReason: "Stop" });+ });+});diff --git a/apps/mirai-gui/client/src/platform/services/chat/run-stream.ts b/apps/mirai-gui/client/src/platform/services/chat/run-stream.tsnew file mode 100644index 000000000..a4224395f--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/chat/run-stream.ts@@ -0,0 +1,107 @@+import type {+ LlmAsyncStream,+ LlmRunParams,+ LlmRunResult,+ ParsedPatch,+ SessionOutputFinishReason,+ SessionOutputStats,+} from "@/types/llm-stream";+import { v4 as uuidv4 } from "uuid";+import { emptyStats } from "./empty-stats";++export type RunEvent =+ | { type: "chunk"; delta: string; parsed?: ParsedPatch }+ | {+ type: "done";+ text: string;+ stats: SessionOutputStats;+ finishReason?: SessionOutputFinishReason;+ parsed?: ParsedPatch;+ }+ | { type: "error"; error?: string };++export type RunTransport = {+ /** Resolves when the backend has finished the run; events arrive through `onEvent` meanwhile. */+ start: (runId: string, params: LlmRunParams, onEvent: (event: RunEvent) => void) => Promise<void>;+ cancel: (runId: string) => Promise<void>;+};++export function runLlmStream(transport: RunTransport, params: LlmRunParams): LlmAsyncStream {+ const runId = uuidv4();+ const parsedListeners = new Set<(patch: ParsedPatch) => void>();+ let settled = false;+ let resolveResult!: (result: LlmRunResult) => void;+ const result = new Promise<LlmRunResult>((resolve) => {+ resolveResult = resolve;+ });++ // The first terminal outcome wins; anything the backend sends afterwards is dropped.+ const settle = (outcome: LlmRunResult): boolean => {+ if (settled) return false;+ settled = true;+ resolveResult(outcome);+ return true;+ };++ // Nothing else settles `result` once the reader is gone, so every awaiter would hang.+ const settleCanceled = () => settle({ text: "", finishReason: "Cancelled", stats: emptyStats() });++ const notifyParsed = (patch: ParsedPatch | undefined) => {+ if (patch) parsedListeners.forEach((listener) => listener(patch));+ };++ const stream = new ReadableStream<string>({+ start(controller) {+ const fail = (message: string) => {+ if (!settle({ text: "", error: message, stats: emptyStats() })) return;+ controller.error(new Error(message));+ };++ const onEvent = (event: RunEvent) => {+ if (settled) return;+ switch (event.type) {+ case "chunk":+ controller.enqueue(event.delta ?? "");+ notifyParsed(event.parsed);+ return;+ case "done":+ settle({+ text: event.text,+ stats: event.stats,+ finishReason: event.finishReason,+ parsed: event.parsed,+ });+ controller.close();+ notifyParsed(event.parsed);+ return;+ case "error":+ fail(event.error || "Unknown error");+ }+ };++ // Run failures arrive as an error event; a rejection means the call itself+ // never reached the backend.+ transport.start(runId, params, onEvent).catch((e: unknown) => fail(String(e)));+ },+ cancel() {+ settleCanceled();+ },+ });++ return {+ runId,+ stream,+ result,+ cancel: async () => {+ try {+ await transport.cancel(runId);+ } finally {+ settleCanceled();+ }+ },+ onParsed: (listener) => {+ parsedListeners.add(listener);+ return () => parsedListeners.delete(listener);+ },+ };+}diff --git a/apps/mirai-gui/client/src/platform/services/chat/tauri.ts b/apps/mirai-gui/client/src/platform/services/chat/tauri.tsnew file mode 100644index 000000000..27c230de4--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/chat/tauri.ts@@ -0,0 +1,39 @@+import { Channel } from "@tauri-apps/api/core";+import { invoke } from "../shared/invoke";+import type { LlmRunParams } from "@/types/llm-stream";+import type { ChatService, SamplingDefaults, TitleGenParams } from ".";+import { runLlmStream, type RunEvent, type RunTransport } from "./run-stream";++const cancelRun = async (runId: string): Promise<void> => {+ await invoke("cancel_run", { runId });+};++const tauriRunTransport: RunTransport = {+ start: async (runId, params, onEvent) => {+ const channel = new Channel<RunEvent>();+ channel.onmessage = onEvent;+ await invoke("run_stream", { payload: { runId, ...params }, onEvent: channel });+ },+ cancel: cancelRun,+};++export const tauriChat: ChatService = {+ runStream: (params: LlmRunParams) => runLlmStream(tauriRunTransport, params),+ cancelRun,++ generateTitle: (params: TitleGenParams) =>+ invoke<string>("title_gen", { payload: { repoId: params.repoId, messages: params.messages } }),++ cancelTitleGen: async () => {+ await invoke("cancel_title_gen");+ },++ getSamplingDefaults: async (repoId: string) => {+ try {+ return await invoke<SamplingDefaults | null>("chat_sampling_defaults", { repoId });+ } catch (e) {+ console.warn("chat_sampling_defaults failed", { repoId, error: String(e) });+ return null;+ }+ },+};diff --git a/apps/mirai-gui/client/src/platform/services/chat/web.ts b/apps/mirai-gui/client/src/platform/services/chat/web.tsnew file mode 100644index 000000000..d41c58d83--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/chat/web.ts@@ -0,0 +1,24 @@+import type { ChatService } from ".";+import { emptyStats } from "./empty-stats";+import { noopUnsubscribe } from "../shared/noop";+import type { LlmAsyncStream } from "@/types/llm-stream";++export const webChat: ChatService = {+ runStream(): LlmAsyncStream {+ const stream = new ReadableStream<string>({+ start(c) {+ c.close();+ },+ });+ const result = Promise.resolve({+ text: "",+ error: "Chat not available on web",+ stats: emptyStats(),+ });+ return { runId: "", stream, result, cancel: () => Promise.resolve(), onParsed: noopUnsubscribe };+ },+ cancelRun: () => Promise.resolve(),+ generateTitle: () => Promise.reject(new Error("Not available on web")),+ cancelTitleGen: () => Promise.resolve(),+ getSamplingDefaults: () => Promise.resolve(null),+};diff --git a/apps/mirai-gui/client/src/platform/services/dialogs/index.ts b/apps/mirai-gui/client/src/platform/services/dialogs/index.tsnew file mode 100644index 000000000..bebdaa29c--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/dialogs/index.ts@@ -0,0 +1,13 @@+export type FileDialogFilter = { name: string; extensions: string[] };++export type SaveDialogOptions = {+ title?: string;+ defaultPath?: string;+ filters?: FileDialogFilter[];+};++export type DialogsService = {+ /** Resolves to the chosen absolute path; null when cancelled, unsupported or failed. */+ showSaveDialog(options: SaveDialogOptions): Promise<string | null>;+ readTextFile(absolutePath: string): Promise<string | null>;+};diff --git a/apps/mirai-gui/client/src/platform/services/dialogs/tauri.ts b/apps/mirai-gui/client/src/platform/services/dialogs/tauri.tsnew file mode 100644index 000000000..8585edb2e--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/dialogs/tauri.ts@@ -0,0 +1,25 @@+import { invoke } from "../shared/invoke";+import { save } from "@tauri-apps/plugin-dialog";+import type { DialogsService } from ".";++export const tauriDialogs: DialogsService = {+ showSaveDialog: async (options) => {+ try {+ const path = await save({+ title: options.title,+ defaultPath: options.defaultPath,+ filters: options.filters,+ });+ return path ?? null;+ } catch {+ return null;+ }+ },+ readTextFile: async (absolutePath) => {+ try {+ return await invoke<string | null>("read_text_file", { absolutePath });+ } catch {+ return null;+ }+ },+};diff --git a/apps/mirai-gui/client/src/platform/services/dialogs/web.ts b/apps/mirai-gui/client/src/platform/services/dialogs/web.tsnew file mode 100644index 000000000..8f1873b46--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/dialogs/web.ts@@ -0,0 +1,6 @@+import type { DialogsService } from ".";++export const webDialogs: DialogsService = {+ showSaveDialog: () => Promise.resolve(null),+ readTextFile: () => Promise.resolve(null),+};diff --git a/apps/mirai-gui/client/src/platform/services/models/index.ts b/apps/mirai-gui/client/src/platform/services/models/index.tsnew file mode 100644index 000000000..7ec7e671e--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/models/index.ts@@ -0,0 +1,17 @@+import type { EngineModel } from "@/types/model-manager";++export type DownloadEvent = { identifier: string; seq: number } & (+ | { kind: "progress"; completedBytes: number; totalBytes: number | null }+ | { kind: "error"; error: string }+ | { kind: "locked"; lockedBy: string }+ | { kind: "done" | "paused" | "resumed" | "deleted" }+);++export type ModelsService = {+ getModels(): Promise<EngineModel[]>;+ startDownload(identifier: string): Promise<void>;+ pauseDownload(identifier: string): Promise<void>;+ resumeDownload(identifier: string): Promise<void>;+ deleteModel(identifier: string): Promise<void>;+ onDownloadEvent(listener: (event: DownloadEvent) => void): () => void;+};diff --git a/apps/mirai-gui/client/src/platform/services/models/tauri.ts b/apps/mirai-gui/client/src/platform/services/models/tauri.tsnew file mode 100644index 000000000..1c106847d--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/models/tauri.ts@@ -0,0 +1,38 @@+import { listen } from "@tauri-apps/api/event";+import { invoke } from "../shared/invoke";+import type { EngineModel } from "@/types/model-manager";+import type { DownloadEvent, ModelsService } from ".";++// One backend subscription for the app's lifetime, fanned out to listeners.+const listeners = new Set<(event: DownloadEvent) => void>();+let listening = false;++const ensureListening = (): void => {+ if (listening) return;+ listening = true;+ void listen<DownloadEvent>("download-state", ({ payload: event }) => {+ listeners.forEach((listener) => {+ try {+ listener(event);+ } catch (e) {+ // State wiring and toasts are independent; one failing must not starve the other.+ console.error("[downloads] listener failed", { kind: event.kind, identifier: event.identifier }, e);+ }+ });+ });+};++export const tauriModels: ModelsService = {+ getModels: () => invoke<EngineModel[]>("chat_models_get"),++ startDownload: (repoId) => invoke("download_resume", { repoId }),+ pauseDownload: (repoId) => invoke("download_pause", { repoId }),+ resumeDownload: (repoId) => invoke("download_resume", { repoId }),+ deleteModel: (repoId) => invoke("download_delete", { repoId }),++ onDownloadEvent: (listener) => {+ ensureListening();+ listeners.add(listener);+ return () => listeners.delete(listener);+ },+};diff --git a/apps/mirai-gui/client/src/platform/services/models/web.ts b/apps/mirai-gui/client/src/platform/services/models/web.tsnew file mode 100644index 000000000..132fb28d5--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/models/web.ts@@ -0,0 +1,13 @@+import type { ModelsService } from ".";+import { noopUnsubscribe } from "../shared/noop";++const unavailable = () => Promise.reject(new Error("Not available on web"));++export const webModels: ModelsService = {+ getModels: () => Promise.resolve([]),+ startDownload: unavailable,+ pauseDownload: unavailable,+ resumeDownload: unavailable,+ deleteModel: unavailable,+ onDownloadEvent: noopUnsubscribe,+};diff --git a/apps/mirai-gui/client/src/platform/services/session/index.ts b/apps/mirai-gui/client/src/platform/services/session/index.tsnew file mode 100644index 000000000..84295cadc--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/session/index.ts@@ -0,0 +1,16 @@+export type SessionStatePayload = {+ active: boolean;+ repoId?: string;+ isEjecting?: boolean;+};++export type SessionLoadingPayload = {+ status: "start" | "error";+ repoId: string;+};++export type SessionService = {+ onSessionState(cb: (payload: SessionStatePayload) => void): () => void;+ onSessionLoading(cb: (payload: SessionLoadingPayload) => void): () => void;+ ejectSession(params: { repoId: string }): Promise<void>;+};diff --git a/apps/mirai-gui/client/src/platform/services/session/tauri.ts b/apps/mirai-gui/client/src/platform/services/session/tauri.tsnew file mode 100644index 000000000..7600cc961--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/session/tauri.ts@@ -0,0 +1,39 @@+import { listen } from "@tauri-apps/api/event";+import { invoke } from "../shared/invoke";+import type { SessionLoadingPayload, SessionService, SessionStatePayload } from ".";++const stateListeners = new Set<(p: SessionStatePayload) => void>();+const loadingListeners = new Set<(p: SessionLoadingPayload) => void>();+let listening = false;++const fanOut = <T>(set: Set<(p: T) => void>, payload: T): void => {+ set.forEach((cb) => {+ try {+ cb(payload);+ } catch (error) {+ // The other listeners still get the event.+ console.error("[session] listener failed", error);+ }+ });+};++const ensureListening = (): void => {+ if (listening) return;+ listening = true;+ void listen<SessionStatePayload>("session-state", (event) => fanOut(stateListeners, event.payload));+ void listen<SessionLoadingPayload>("session-loading", (event) => fanOut(loadingListeners, event.payload));+};++const subscribe = <T>(set: Set<(p: T) => void>, cb: (p: T) => void): (() => void) => {+ ensureListening();+ set.add(cb);+ return () => {+ set.delete(cb);+ };+};++export const tauriSession: SessionService = {+ onSessionState: (cb) => subscribe(stateListeners, cb),+ onSessionLoading: (cb) => subscribe(loadingListeners, cb),+ ejectSession: ({ repoId }) => invoke("eject_session", { repoId }),+};diff --git a/apps/mirai-gui/client/src/platform/services/session/web.ts b/apps/mirai-gui/client/src/platform/services/session/web.tsnew file mode 100644index 000000000..6f73ab367--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/session/web.ts@@ -0,0 +1,8 @@+import type { SessionService } from ".";+import { noopUnsubscribe } from "../shared/noop";++export const webSession: SessionService = {+ onSessionState: noopUnsubscribe,+ onSessionLoading: noopUnsubscribe,+ ejectSession: () => Promise.reject(new Error("Not available on web")),+};diff --git a/apps/mirai-gui/client/src/platform/services/settings/index.ts b/apps/mirai-gui/client/src/platform/services/settings/index.tsnew file mode 100644index 000000000..dacfe4a0b--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/settings/index.ts@@ -0,0 +1,12 @@+import type { ModelParams } from "@/types/sampling";++export type SettingsService = {+ getEnableThinking(): Promise<boolean>;+ setEnableThinking(enabled: boolean): Promise<boolean>;+ getModelParams(): Promise<Record<string, ModelParams>>;+ setModelParams(repoId: string, params: ModelParams | null): Promise<void>;+ getAutoEjectEnabled(): Promise<boolean>;+ setAutoEjectEnabled(enabled: boolean): Promise<boolean>;+ getAutoEjectMinutes(): Promise<number>;+ setAutoEjectMinutes(minutes: number): Promise<boolean>;+};diff --git a/apps/mirai-gui/client/src/platform/services/settings/tauri.ts b/apps/mirai-gui/client/src/platform/services/settings/tauri.tsnew file mode 100644index 000000000..4c413dc7d--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/settings/tauri.ts@@ -0,0 +1,42 @@+import { invoke } from "../shared/invoke";+import type { ModelParams } from "@/types/sampling";+import type { SettingsService } from ".";++// Keys are read by every installed version; renaming one resets that+// preference on upgrade.++type StoredSettings = {+ enableThinking?: boolean;+ autoEjectEnabled?: boolean;+ autoEjectMinutes?: number;+ modelParams?: Record<string, ModelParams>;+};++const load = (): Promise<StoredSettings> => invoke<StoredSettings>("settings_load");++const patch = (values: Record<string, unknown>): Promise<void> => invoke("settings_patch", { patch: values });++const autoEjectEnabledOf = (s: StoredSettings): boolean => s.autoEjectEnabled !== false;+const autoEjectMinutesOf = (s: StoredSettings): number =>+ typeof s.autoEjectMinutes === "number" && Number.isFinite(s.autoEjectMinutes) ? s.autoEjectMinutes : 2;++export const tauriSettings: SettingsService = {+ getEnableThinking: async () => (await load()).enableThinking !== false,+ setEnableThinking: async (enabled) => {+ await patch({ enableThinking: enabled });+ return enabled;+ },+ getModelParams: async () => (await load()).modelParams ?? {},+ setModelParams: (repoId, params) => invoke("model_params_set", { repoId, params }),+ getAutoEjectEnabled: async () => autoEjectEnabledOf(await load()),+ // Rust writes the keys and applies them to its idle timer in one step.+ setAutoEjectEnabled: async (enabled) => {+ await invoke("set_auto_eject_config", { enabled });+ return enabled;+ },+ getAutoEjectMinutes: async () => autoEjectMinutesOf(await load()),+ setAutoEjectMinutes: async (minutes) => {+ await invoke("set_auto_eject_config", { minutes });+ return true;+ },+};diff --git a/apps/mirai-gui/client/src/platform/services/settings/web.ts b/apps/mirai-gui/client/src/platform/services/settings/web.tsnew file mode 100644index 000000000..b5af5a070--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/settings/web.ts@@ -0,0 +1,36 @@+import type { ModelParams } from "@/types/sampling";+import type { SettingsService } from ".";+import { readJson, writeJson } from "../shared/browser-store";++const SETTINGS_KEY = "mirai.web.settings";+const MODEL_PARAMS_KEY = "mirai.web.modelParams";++type StoredSettings = { enableThinking: boolean };++const DEFAULTS: StoredSettings = { enableThinking: false };++const load = (): StoredSettings => ({ ...DEFAULTS, ...readJson<Partial<StoredSettings>>(SETTINGS_KEY, {}) });++export const webSettings: SettingsService = {+ getEnableThinking: async () => load().enableThinking,++ setEnableThinking: async (enabled) => {+ writeJson(SETTINGS_KEY, { ...load(), enableThinking: enabled });+ return enabled;+ },++ getModelParams: async () => readJson<Record<string, ModelParams>>(MODEL_PARAMS_KEY, {}),++ setModelParams: async (repoId, params) => {+ const all = readJson<Record<string, ModelParams>>(MODEL_PARAMS_KEY, {});+ if (params === null) delete all[repoId];+ else all[repoId] = params;+ writeJson(MODEL_PARAMS_KEY, all);+ },++ // No resident engine in the browser, so auto-eject is inert.+ getAutoEjectEnabled: async () => true,+ setAutoEjectEnabled: async (enabled) => enabled,+ getAutoEjectMinutes: async () => 2,+ setAutoEjectMinutes: async () => true,+};diff --git a/apps/mirai-gui/client/src/platform/services/shared/browser-store.ts b/apps/mirai-gui/client/src/platform/services/shared/browser-store.tsnew file mode 100644index 000000000..6817e4f22--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/shared/browser-store.ts@@ -0,0 +1,16 @@+export const readJson = <T>(key: string, fallback: T): T => {+ try {+ const raw = localStorage.getItem(key);+ return raw ? (JSON.parse(raw) as T) : fallback;+ } catch {+ return fallback;+ }+};++export const writeJson = (key: string, value: unknown): void => {+ try {+ localStorage.setItem(key, JSON.stringify(value));+ } catch {+ // Private mode and full quotas both throw here; losing a preference is survivable.+ }+};diff --git a/apps/mirai-gui/client/src/platform/services/shared/invoke.ts b/apps/mirai-gui/client/src/platform/services/shared/invoke.tsnew file mode 100644index 000000000..f1a55b078--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/shared/invoke.ts@@ -0,0 +1,8 @@+import { invoke as tauriInvoke, type InvokeArgs } from "@tauri-apps/api/core";++// The backend serializes its errors as plain strings, so a rejected invoke+// carries a string, while the client reads failures through Error.+export const invoke = <T>(command: string, args?: InvokeArgs): Promise<T> =>+ tauriInvoke<T>(command, args).catch((error: unknown) => {+ throw error instanceof Error ? error : new Error(String(error));+ });diff --git a/apps/mirai-gui/client/src/platform/services/shared/keyed-listeners.ts b/apps/mirai-gui/client/src/platform/services/shared/keyed-listeners.tsnew file mode 100644index 000000000..1bc82f65e--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/shared/keyed-listeners.ts@@ -0,0 +1,26 @@+export const createKeyedListeners = () => {+ const byKey = new Map<string, Set<(payload: never) => void>>();++ const on = (key: string, cb: (payload: never) => void): (() => void) => {+ const set = byKey.get(key) ?? new Set();+ set.add(cb);+ byKey.set(key, set);+ return () => {+ set.delete(cb);+ if (set.size === 0) byKey.delete(key);+ };+ };++ const emit = (key: string, payload: unknown): void => {+ byKey.get(key)?.forEach((cb) => {+ try {+ (cb as (p: unknown) => void)(payload);+ } catch (error) {+ // The other listeners still get the event.+ console.error("[platform] listener failed", { key }, error);+ }+ });+ };++ return { on, emit };+};diff --git a/apps/mirai-gui/client/src/platform/services/shared/noop.ts b/apps/mirai-gui/client/src/platform/services/shared/noop.tsnew file mode 100644index 000000000..899957427--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/shared/noop.ts@@ -0,0 +1 @@+export const noopUnsubscribe = () => () => {};diff --git a/apps/mirai-gui/client/src/platform/services/storage/chat-files.ts b/apps/mirai-gui/client/src/platform/services/storage/chat-files.tsnew file mode 100644index 000000000..d62d1fb4e--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/storage/chat-files.ts@@ -0,0 +1,7 @@+import { invoke } from "../shared/invoke";++// Chat files are relative names; the Rust side confines them to the chats dir.+export const listChatFiles = () => invoke<string[]>("chat_list_files");+export const loadChatFile = (path: string) => invoke<string | null>("chat_load_file", { path });+export const saveChatFile = (path: string, content: string) => invoke<void>("chat_save_file", { path, content });+export const deleteChatFile = (path: string) => invoke<void>("chat_delete_file", { path });diff --git a/apps/mirai-gui/client/src/platform/services/storage/chat-repository.ts b/apps/mirai-gui/client/src/platform/services/storage/chat-repository.tsnew file mode 100644index 000000000..1f8d862b8--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/storage/chat-repository.ts@@ -0,0 +1,115 @@+import type { Message } from "@/types/message";+import { ChatNotFoundError } from ".";+import type { ChatData, ChatMetadata, StorageService } from ".";+import { deleteChatFile, listChatFiles, loadChatFile, saveChatFile } from "./chat-files";+import { extractMessageBlocks, parseMessage, parseMetadata } from "./markdown/parse";+import { serializeToMarkdown } from "./markdown/serialize";+import { withFileQueue } from "./file-queue";++type ChatRepository = Pick<+ StorageService,+ | "listChats"+ | "loadChat"+ | "createOrReplaceChat"+ | "removeMessage"+ | "appendMessage"+ | "updateStoredMessage"+ | "updateChatTitle"+ | "deleteChat"+>;++const writeChat = async (chat: ChatData): Promise<void> => {+ await saveChatFile(`${chat.metadata.id}.md`, serializeToMarkdown(chat));+};++const withChatLock = <T>(chatId: string, run: () => Promise<T>): Promise<T> => withFileQueue(`chat:${chatId}`, run);++// A read error must throw: appendMessage takes null for a missing chat and rewrites it from memory.+const loadChat = async (chatId: string): Promise<ChatData | null> => {+ const content = await loadChatFile(`${chatId}.md`);+ if (!content) return null;+ const messages = extractMessageBlocks(content)+ .map(parseMessage)+ .filter((m): m is Message => m !== null);+ return { metadata: parseMetadata(content, chatId, messages.length), messages };+};++export const chatRepository: ChatRepository = {+ async listChats() {+ const files = await listChatFiles();+ const results = await Promise.all(+ files+ .filter((f) => f.endsWith(".md"))+ .map(async (file) => {+ try {+ const chatId = file.replace(".md", "");+ const markdown = await loadChatFile(`${chatId}.md`);+ if (!markdown) return undefined;+ const countMatch = markdown.match(/\*\*Messages:\*\*\s*(\d+)/m);+ const count = countMatch ? Number(countMatch[1]) : extractMessageBlocks(markdown).length;+ return parseMetadata(markdown, chatId, count);+ } catch {+ return undefined;+ }+ }),+ );+ return results.filter((m): m is ChatMetadata => m !== undefined).sort((a, b) => b.updatedAt - a.updatedAt);+ },++ loadChat,++ createOrReplaceChat(chat) {+ return withChatLock(chat.metadata.id, () => writeChat(chat));+ },++ appendMessage(chatId, message) {+ return withChatLock(chatId, async () => {+ const existing = await loadChat(chatId);+ if (!existing) throw new ChatNotFoundError(chatId);+ // A recovery rewrite from memory may already hold this message.+ const others = existing.messages.filter((m) => m.id !== message.id);+ await writeChat({+ metadata: { ...existing.metadata, messageCount: others.length + 1, updatedAt: Date.now() },+ messages: [...others, message],+ });+ });+ },++ updateStoredMessage(chatId, messageId, patch) {+ return withChatLock(chatId, async () => {+ const existing = await loadChat(chatId);+ if (!existing) throw new Error(`Chat ${chatId} not found`);+ const messages = existing.messages.map((m) => (m.id === messageId ? { ...m, ...patch } : m));+ await writeChat({+ metadata: { ...existing.metadata, updatedAt: Date.now() },+ messages,+ });+ });+ },++ removeMessage(chatId, messageId) {+ return withChatLock(chatId, async () => {+ const existing = await loadChat(chatId);+ if (!existing) return;+ const messages = existing.messages.filter((m) => m.id !== messageId);+ if (messages.length === existing.messages.length) return;+ await writeChat({ metadata: { ...existing.metadata, messageCount: messages.length }, messages });+ });+ },++ updateChatTitle(chatId, title, expectedTitle) {+ return withChatLock(chatId, async () => {+ const existing = await loadChat(chatId);+ if (!existing) return;+ if (expectedTitle !== undefined && existing.metadata.title !== expectedTitle) return;+ await writeChat({+ ...existing,+ metadata: { ...existing.metadata, title, updatedAt: Date.now() },+ });+ });+ },++ deleteChat(chatId) {+ return withChatLock(chatId, () => deleteChatFile(`${chatId}.md`));+ },+};diff --git a/apps/mirai-gui/client/src/platform/services/storage/export-zip.ts b/apps/mirai-gui/client/src/platform/services/storage/export-zip.tsnew file mode 100644index 000000000..01f2b453b--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/storage/export-zip.ts@@ -0,0 +1,21 @@+import JSZip from "jszip";+import { listChatFiles, loadChatFile } from "./chat-files";+import { stripHtmlComments, wrapCotInDetails } from "./markdown/parse";++export const buildChatsZip = async (): Promise<Uint8Array | null> => {+ const zip = new JSZip();+ const files = await listChatFiles();+ const mdFiles = files.filter((f) => f.endsWith(".md"));+ if (mdFiles.length === 0) return null;+ for (const file of mdFiles) {+ try {+ const content = await loadChatFile(file);+ if (!content) continue;+ const normalized = content.replace(/\*\*TTFB:\*\*/g, "**TTFT:**");+ zip.file(file, stripHtmlComments(wrapCotInDetails(normalized)));+ } catch {+ continue;+ }+ }+ return zip.generateAsync({ type: "uint8array", compression: "DEFLATE" });+};diff --git a/apps/mirai-gui/client/src/platform/services/storage/file-queue.test.ts b/apps/mirai-gui/client/src/platform/services/storage/file-queue.test.tsnew file mode 100644index 000000000..aab6d89f4--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/storage/file-queue.test.ts@@ -0,0 +1,25 @@+import { expect, it, vi } from "vitest";+import { withFileQueue } from "./file-queue";++it("runs writes to one key in call order even when an earlier one is slower", async () => {+ let finishFirst!: () => void;+ const order: string[] = [];+ const first = withFileQueue("k", () =>+ new Promise<void>((resolve) => (finishFirst = () => resolve())).then(() => order.push("first")),+ );+ const second = withFileQueue("k", async () => void order.push("second"));+ await Promise.resolve();+ expect(order).toEqual([]);++ finishFirst();+ await Promise.all([first, second]);+ expect(order).toEqual(["first", "second"]);+});++it("lets the next write run after a failed one", async () => {+ const failing = withFileQueue("k", () => Promise.reject(new Error("disk full")));+ const next = vi.fn(async () => "ok");++ await expect(failing).rejects.toThrow("disk full");+ await expect(withFileQueue("k", next)).resolves.toBe("ok");+});diff --git a/apps/mirai-gui/client/src/platform/services/storage/file-queue.ts b/apps/mirai-gui/client/src/platform/services/storage/file-queue.tsnew file mode 100644index 000000000..8e9a62339--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/storage/file-queue.ts@@ -0,0 +1,14 @@+// Every write reads and rewrites the whole file, so two at once would lose each other's changes.+const chains = new Map<string, Promise<unknown>>();++export const withFileQueue = <T>(key: string, run: () => Promise<T>): Promise<T> => {+ const prev = chains.get(key) ?? Promise.resolve();+ const next = prev.then(run, run);+ const tail: Promise<unknown> = next+ .catch(() => undefined)+ .finally(() => {+ if (chains.get(key) === tail) chains.delete(key);+ });+ chains.set(key, tail);+ return next;+};diff --git a/apps/mirai-gui/client/src/platform/services/storage/index.ts b/apps/mirai-gui/client/src/platform/services/storage/index.tsnew file mode 100644index 000000000..546ea25dd--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/storage/index.ts@@ -0,0 +1,52 @@+import type { Message } from "@/types/message";++export type ChatMetadata = {+ id: string;+ title: string;+ modelId?: string;+ modelName?: string;+ createdAt: number;+ updatedAt: number;+ messageCount: number;+};++export type ChatData = {+ metadata: ChatMetadata;+ messages: Message[];+};++export type StorageCleanupPreview = {+ dialogs: { count: number; sizeBytes: number };+ models: { count: number; sizeBytes: number };+ logs: { sizeBytes: number };+};++/** Thrown by appendMessage when the chat is gone from storage; callers recreate it. */+export class ChatNotFoundError extends Error {+ constructor(chatId: string) {+ super(`Chat ${chatId} not found`);+ this.name = "ChatNotFoundError";+ }+}++export type StorageService = {+ listChats(): Promise<ChatMetadata[]>;+ loadChat(chatId: string): Promise<ChatData | null>;+ createOrReplaceChat(chat: ChatData): Promise<void>;+ appendMessage(chatId: string, message: Message): Promise<void>;+ updateStoredMessage(chatId: string, messageId: string, patch: Partial<Message>): Promise<void>;+ removeMessage(chatId: string, messageId: string): Promise<void>;+ /** With `expectedTitle`, writes only while the stored title is still that one. */+ updateChatTitle(chatId: string, title: string, expectedTitle?: string): Promise<void>;+ deleteChat(chatId: string): Promise<void>;+ exportAllChatsZip(): Promise<Uint8Array | null>;++ saveBinaryFile(absolutePath: string, data: Uint8Array): Promise<boolean>;+ saveGlobalInstructions(content: string): Promise<void>;+ loadGlobalInstructions(): Promise<string | null>;+ previewCleanup(skipModelIdentifiers?: string[]): Promise<StorageCleanupPreview>;+ executeCleanup(+ categories: string[],+ skipModelIdentifiers?: string[],+ ): Promise<{ executed: string[]; modelsSkipped: string[] }>;+};diff --git a/apps/mirai-gui/client/src/platform/services/storage/markdown/parse.ts b/apps/mirai-gui/client/src/platform/services/storage/markdown/parse.tsnew file mode 100644index 000000000..ebb1ea694--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/storage/markdown/parse.ts@@ -0,0 +1,187 @@+import type { Message, PerfStats, MessageVersion as StoreMessageVersion } from "@/types/message";+import { parse } from "date-fns";+import type { ChatMetadata } from "..";++const extractContent = (text: string): string => {+ const match = text.match(/<!-- START_CONTENT -->\n([\s\S]*?)\n<!-- END_CONTENT -->/);+ return match?.[1] ?? "";+};++const extractChainOfThought = (text: string): string | undefined => {+ const match = text.match(/<!-- START_COT -->\n([\s\S]*?)\n<!-- END_COT -->/m);+ return match?.[1] || undefined;+};++const extractError = (text: string): string | undefined => {+ const match = text.match(/<!-- START_ERROR -->\n([\s\S]*?)\n<!-- END_ERROR -->/m);+ return match?.[1] || undefined;+};++const parseDate = (s: string | undefined): number => {+ if (!s) return Date.now();+ const t = parse(s, "PPpp", new Date()).getTime();+ return Number.isNaN(t) ? Date.now() : t;+};++const parsePerf = (block: string): PerfStats | undefined => {+ const blockMatch = block.match(/<!-- START_PERF -->\n([\s\S]*?)\n<!-- END_PERF -->/m);+ const scope = blockMatch?.[1] ?? block;+ const toNum = (m: RegExpMatchArray | null) => (m?.[1] ? Number(m[1]) : undefined);+ const perf: PerfStats = {+ ttftSec:+ toNum(scope.match(/\*\*TTFT:\*\*\s*([0-9]+(?:\.[0-9]+)?)s/m)) ??+ toNum(scope.match(/\*\*TTFB:\*\*\s*([0-9]+(?:\.[0-9]+)?)s/m)),+ tps: toNum(scope.match(/\*\*TPS:\*\*\s*([0-9]+(?:\.[0-9]+)?)/m)),+ totalSec: toNum(scope.match(/\*\*Total:\*\*\s*([0-9]+(?:\.[0-9]+)?)s/m)),+ tokensOut: toNum(scope.match(/\*\*TokensOut:\*\*\s*([0-9]+)/m)),+ };+ return Object.values(perf).some((v) => typeof v === "number") ? perf : undefined;+};++const parseVersions = (block: string): { versions: StoreMessageVersion[]; currentVersionIndex: number } => {+ const headerRegex = /^#### Version \d+.*$/gm;+ const headers: Array<{ start: number; header: string }> = [];+ let match: RegExpExecArray | null;+ while ((match = headerRegex.exec(block)) !== null) {+ headers.push({ start: match.index, header: match[0] });+ }++ let currentVersionIndex = 0;+ const versions = headers+ .map((h, idx) => {+ const content = block.slice(h.start, headers[idx + 1]?.start ?? block.length);+ const isActive = h.header.includes("⭐ ACTIVE");+ if (isActive) currentVersionIndex = idx;++ const timeMatch = content.match(/\*\*Time:\*\* (.+)$/m);+ if (!timeMatch) return null;++ const idMatch = content.match(/<!-- VID:\s*([^>]+?)\s*-->/m);+ const modelMatch = content.match(/\*\*Model:\*\* (.+)$/m);+ const attachmentIds = content.match(/\*\*Attachments:\*\* (.+)$/m)?.[1]?.split(",");+ const versionText = extractContent(content);+ const cot = extractChainOfThought(content);+ const versionError = extractError(content);+ const versionPerf = parsePerf(content);+ const outputParsed =+ cot || versionText+ ? {+ text: {+ parsed: { ...(cot ? { chainOfThought: cot } : {}), ...(versionText ? { response: versionText } : {}) },+ },+ }+ : undefined;++ return {+ id: idMatch?.[1] || `${Date.now()}-${idx}`,+ modelId: "",+ modelName: modelMatch?.[1] || "",+ timestamp: parseDate(timeMatch[1]),+ text: versionText,+ ...(outputParsed ? { output: outputParsed } : {}),+ ...(versionPerf ? { perf: versionPerf } : {}),+ ...(attachmentIds ? { attachmentIds } : {}),+ ...(versionError ? { error: versionError } : {}),+ };+ })+ .filter((v): v is NonNullable<typeof v> => v !== null) as StoreMessageVersion[];++ return {+ versions,+ currentVersionIndex: Math.min(currentVersionIndex, Math.max(0, versions.length - 1)),+ };+};++export const parseMessage = (block: string): Message | null => {+ const headerMatch = block.match(/^## (👤|🤖) (.+?) - (.+)$/m);+ if (!headerMatch) return null;++ const [, marker, who, when] = headerMatch;+ const sender = marker === "👤" ? "user" : "assistant";+ const timestamp = parseDate(when);+ const modelName = who?.match(/^(.+?) \((.+)\)$/)?.[2];+ const idMatch = block.match(/<!-- ID:\s*([^>]+?)\s*-->/m);+ const attachmentIds = block.match(/\*\*Attachments:\*\* (.+)$/m)?.[1]?.split(",");+ const id = idMatch?.[1] || `${Date.now()}-${Math.random()}`;++ if (block.includes("### 📝 Versions")) {+ const { versions, currentVersionIndex } = parseVersions(block);+ return {+ id,+ text: versions[currentVersionIndex]?.text || "",+ sender: sender as Message["sender"],+ modelName,+ timestamp,+ versions,+ currentVersionIndex,+ ...(attachmentIds ? { attachmentIds } : {}),+ };+ }++ const cot = extractChainOfThought(block);+ const resp = extractContent(block);+ const errorText = extractError(block);+ const perf = parsePerf(block);+ const outputParsed =+ cot || resp+ ? { text: { parsed: { ...(cot ? { chainOfThought: cot } : {}), ...(resp ? { response: resp } : {}) } } }+ : undefined;++ return {+ id,+ text: resp,+ sender: sender as Message["sender"],+ modelName,+ timestamp,+ ...(outputParsed ? { output: outputParsed } : {}),+ ...(perf ? { perf } : {}),+ ...(attachmentIds ? { attachmentIds } : {}),+ ...(errorText ? { error: errorText } : {}),+ };+};++export const extractMessageBlocks = (markdown: string): string[] => {+ const blocks: string[] = [];+ const headerRegex = /^## (👤|🤖) .+ - .+$/gm;+ let match: RegExpExecArray | null;+ while ((match = headerRegex.exec(markdown)) !== null) {+ const start = match.index;+ const endContentIdx = markdown.indexOf("<!-- END_CONTENT -->", start);+ if (endContentIdx === -1) continue;+ const delimRegex = /\n---\r?\n/gm;+ delimRegex.lastIndex = endContentIdx;+ const dMatch = delimRegex.exec(markdown);+ blocks.push(markdown.slice(start, dMatch ? dMatch.index + dMatch[0].length : markdown.length));+ }+ return blocks;+};++export const parseMetadata = (markdown: string, chatId: string, messagesCount: number): ChatMetadata => {+ return {+ id: chatId,+ title: markdown.match(/^# (.+)$/m)?.[1] ?? "Untitled",+ modelId: markdown.match(/\*\*ModelId:\*\* (.+)$/m)?.[1],+ modelName: markdown.match(/\*\*Model:\*\* (.+)$/m)?.[1],+ createdAt: parseDate(markdown.match(/\*\*Created:\*\* (.+)$/m)?.[1]),+ updatedAt: parseDate(markdown.match(/\*\*Updated:\*\* (.+)$/m)?.[1]),+ messageCount: messagesCount,+ };+};++export function wrapCotInDetails(markdown: string): string {+ return markdown.replace(/(<!-- START_COT -->\n)([\s\S]*?)(\n<!-- END_COT -->)/g, (_match, start, body, end) => {+ const trimmedBody = body.replace(/^\n+|\n+$/g, "");+ return [+ "<details>",+ "<summary>Thinking</summary>",+ "",+ start.trimEnd(),+ trimmedBody,+ end.trimStart(),+ "",+ "</details>",+ ].join("\n");+ });+}++export const stripHtmlComments = (markdown: string): string => markdown.replace(/<!--[\s\S]*?-->/g, () => "");diff --git a/apps/mirai-gui/client/src/platform/services/storage/markdown/roundtrip.test.ts b/apps/mirai-gui/client/src/platform/services/storage/markdown/roundtrip.test.tsnew file mode 100644index 000000000..9efb4e0df--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/storage/markdown/roundtrip.test.ts@@ -0,0 +1,28 @@+import { expect, it } from "vitest";+import type { ChatData } from "..";+import { extractMessageBlocks, parseMessage } from "./parse";+import { serializeToMarkdown } from "./serialize";++const chat: ChatData = {+ metadata: {+ id: "chat",+ title: "Untitled",+ messageCount: 2,+ createdAt: 1_700_000_000_000,+ updatedAt: 1_700_000_000_000,+ modelId: "vendor/model",+ modelName: "Model",+ },+ messages: [+ { id: "u1", text: "hello", sender: "user", timestamp: 1_700_000_000_000 },+ { id: "a1", text: "", sender: "assistant", modelName: "Model", timestamp: 1_700_000_000_001, perf: {} },+ ],+};++it("keeps an empty assistant placeholder through a serialize/parse round-trip", () => {+ const markdown = serializeToMarkdown(chat);+ const messages = extractMessageBlocks(markdown).map(parseMessage);++ expect(messages.map((m) => m?.id)).toEqual(["u1", "a1"]);+ expect(messages[1]).toMatchObject({ sender: "assistant", text: "" });+});diff --git a/apps/mirai-gui/client/src/platform/services/storage/markdown/serialize.ts b/apps/mirai-gui/client/src/platform/services/storage/markdown/serialize.tsnew file mode 100644index 000000000..6312086f7--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/storage/markdown/serialize.ts@@ -0,0 +1,94 @@+import { format } from "date-fns";+import type { Message, MessageVersion as StoreMessageVersion, PerfStats } from "@/types/message";+import type { ChatData } from "..";++const sanitize = (text: string): string => text.replace(/\uFFFD/g, "");++const formatPerfToMarkdown = (perf?: PerfStats): string[] => {+ if (!perf) return [];+ const entries = [+ ["TTFT", perf.ttftSec, (v: number) => `${v.toFixed(3)}s`],+ ["TPS", perf.tps, (v: number) => `${Math.round(v)}`],+ ["Total", perf.totalSec, (v: number) => `${v.toFixed(3)}s`],+ ["TokensOut", perf.tokensOut, (v: number) => `${v}`],+ ] as const;+ const lines = entries+ .filter(([, value]) => typeof value === "number" && (value as number) > 0)+ .map(([label, value, fmt]) => `**${label}:** ${fmt(value as number)}`);+ return lines.length ? ["<!-- START_PERF -->", ...lines, "<!-- END_PERF -->"] : [];+};++const formatVersionToMarkdown = (version: StoreMessageVersion, index: number, isActive: boolean): string => {+ const cot = version.output?.text?.parsed?.chainOfThought;+ const response = version.output?.text?.parsed?.response ?? (cot ? "" : version.text);+ const errorLines = version.error ? ["<!-- START_ERROR -->", sanitize(version.error), "<!-- END_ERROR -->"] : [];+ return [+ `#### Version ${index + 1}${isActive ? " ⭐ ACTIVE" : ""}`,+ `<!-- VID: ${version.id} -->`,+ `**Time:** ${format(version.timestamp, "PPpp")}`,+ ...(version.modelName ? [`**Model:** ${version.modelName}`] : []),+ ...formatPerfToMarkdown(version.perf),+ ...(version.attachmentIds?.length ? [`**Attachments:** ${version.attachmentIds.join(",")}`] : []),+ ...errorLines,+ ...(cot ? ["<!-- START_COT -->", sanitize(cot), "<!-- END_COT -->"] : []),+ "",+ "<!-- START_CONTENT -->",+ sanitize(response || ""),+ "<!-- END_CONTENT -->",+ "",+ ].join("\n");+};++const formatMessageToMarkdown = (message: Message): string => {+ const sender = message.sender === "user" ? "👤 User" : "🤖 Assistant";+ const modelInfo = message.modelName ? ` (${message.modelName})` : "";+ const header = `## ${sender}${modelInfo} - ${format(message.timestamp, "PPpp")}\n\n`;++ if (message.versions?.length) {+ const versionsContent = message.versions+ .map((v, i) => formatVersionToMarkdown(v, i, i === message.currentVersionIndex!))+ .join("\n");+ return (+ header ++ `<!-- ID: ${message.id} -->\n### 📝 Versions (${message.versions.length})\n\n` ++ versionsContent ++ "---\n\n"+ );+ }++ const cot = message.output?.text?.parsed?.chainOfThought;+ const response = message.output?.text?.parsed?.response ?? (cot ? "" : message.text);+ const errorLines = message.error ? ["<!-- START_ERROR -->", sanitize(message.error), "<!-- END_ERROR -->"] : [];++ return (+ header ++ [+ `<!-- ID: ${message.id} -->`,+ ...formatPerfToMarkdown(message.perf),+ ...(message.attachmentIds?.length ? [`**Attachments:** ${message.attachmentIds.join(",")}`] : []),+ ...errorLines,+ ...(cot ? ["<!-- START_COT -->", sanitize(cot), "<!-- END_COT -->"] : []),+ "<!-- START_CONTENT -->",+ sanitize(response || ""),+ "<!-- END_CONTENT -->",+ "",+ "---",+ "",+ ].join("\n")+ );+};++export const serializeToMarkdown = (chat: ChatData): string =>+ [+ `# ${chat.metadata.title}`,+ "",+ `**Model:** ${chat.metadata.modelName || "Unknown"}`,+ ...(chat.metadata.modelId ? [`**ModelId:** ${chat.metadata.modelId}`] : []),+ `**Created:** ${format(chat.metadata.createdAt, "PPpp")}`,+ `**Updated:** ${format(chat.metadata.updatedAt, "PPpp")}`,+ `**Messages:** ${chat.metadata.messageCount}`,+ "",+ "---",+ "",+ ...chat.messages.map(formatMessageToMarkdown),+ ].join("\n");diff --git a/apps/mirai-gui/client/src/platform/services/storage/tauri.ts b/apps/mirai-gui/client/src/platform/services/storage/tauri.tsnew file mode 100644index 000000000..ba7745485--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/storage/tauri.ts@@ -0,0 +1,23 @@+import { invoke } from "../shared/invoke";+import type { StorageCleanupPreview, StorageService } from ".";+import { chatRepository } from "./chat-repository";+import { buildChatsZip } from "./export-zip";+import { withFileQueue } from "./file-queue";++export const tauriStorage: StorageService = {+ ...chatRepository,+ exportAllChatsZip: buildChatsZip,++ saveBinaryFile: (absolutePath, data) => invoke<boolean>("save_binary_file", { absolutePath, data: Array.from(data) }),+ saveGlobalInstructions: (content) =>+ withFileQueue("global-instructions", () => invoke<void>("global_instructions_save", { content })),+ loadGlobalInstructions: () => invoke<string | null>("global_instructions_load"),++ previewCleanup: (skipModelIdentifiers) =>+ invoke<StorageCleanupPreview>("cleanup_preview", { skipModelIdentifiers: skipModelIdentifiers ?? [] }),+ executeCleanup: (categories, skipModelIdentifiers) =>+ invoke<{ executed: string[]; modelsSkipped: string[] }>("cleanup_execute", {+ categories,+ skipModelIdentifiers: skipModelIdentifiers ?? [],+ }),+};diff --git a/apps/mirai-gui/client/src/platform/services/storage/web.ts b/apps/mirai-gui/client/src/platform/services/storage/web.tsnew file mode 100644index 000000000..a8f9c19b6--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/storage/web.ts@@ -0,0 +1,27 @@+import type { StorageService } from ".";++// Inference is native, so the browser build can never produce a chat. Nothing+// is persisted here: the calls exist only to satisfy the platform contract.+export const webStorage: StorageService = {+ listChats: () => Promise.resolve([]),+ loadChat: () => Promise.resolve(null),+ createOrReplaceChat: () => Promise.resolve(),+ appendMessage: () => Promise.resolve(),+ updateStoredMessage: () => Promise.resolve(),+ removeMessage: () => Promise.resolve(),+ updateChatTitle: () => Promise.resolve(),+ deleteChat: () => Promise.resolve(),+ exportAllChatsZip: () => Promise.resolve(null),++ saveBinaryFile: () => Promise.resolve(false),+ saveGlobalInstructions: () => Promise.resolve(),+ loadGlobalInstructions: () => Promise.resolve(null),++ previewCleanup: () =>+ Promise.resolve({+ dialogs: { count: 0, sizeBytes: 0 },+ models: { count: 0, sizeBytes: 0 },+ logs: { sizeBytes: 0 },+ }),+ executeCleanup: () => Promise.resolve({ executed: [], modelsSkipped: [] }),+};diff --git a/apps/mirai-gui/client/src/platform/services/system-ui/index.ts b/apps/mirai-gui/client/src/platform/services/system-ui/index.tsnew file mode 100644index 000000000..978fbd8f0--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/system-ui/index.ts@@ -0,0 +1,8 @@+export type SystemUiService = {+ getRunOnStartup(): Promise<boolean>;+ setRunOnStartup(value: boolean): Promise<void>;+ getQuickEntryShortcut(): Promise<string | null>;+ registerQuickEntryShortcut(accelerator: string): Promise<boolean>;+ unregisterQuickEntryShortcut(): Promise<void>;+ setWindowTheme(dark: boolean): Promise<boolean>;+};diff --git a/apps/mirai-gui/client/src/platform/services/system-ui/tauri.ts b/apps/mirai-gui/client/src/platform/services/system-ui/tauri.tsnew file mode 100644index 000000000..ad8754a4b--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/system-ui/tauri.ts@@ -0,0 +1,11 @@+import { invoke } from "../shared/invoke";+import type { SystemUiService } from ".";++export const tauriSystemUi: SystemUiService = {+ getRunOnStartup: () => invoke<boolean>("get_run_on_startup"),+ setRunOnStartup: (value) => invoke<void>("set_run_on_startup", { value }),+ getQuickEntryShortcut: () => invoke<string | null>("get_quick_entry_shortcut"),+ registerQuickEntryShortcut: (accelerator) => invoke<boolean>("register_quick_entry_shortcut", { accelerator }),+ unregisterQuickEntryShortcut: () => invoke<void>("unregister_quick_entry_shortcut"),+ setWindowTheme: (dark) => invoke<boolean>("set_window_theme", { dark }),+};diff --git a/apps/mirai-gui/client/src/platform/services/system-ui/web.ts b/apps/mirai-gui/client/src/platform/services/system-ui/web.tsnew file mode 100644index 000000000..ea2e3f31c--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/system-ui/web.ts@@ -0,0 +1,10 @@+import type { SystemUiService } from ".";++export const webSystemUi: SystemUiService = {+ getRunOnStartup: () => Promise.resolve(false),+ setRunOnStartup: () => Promise.resolve(),+ getQuickEntryShortcut: () => Promise.resolve(null),+ registerQuickEntryShortcut: () => Promise.resolve(false),+ unregisterQuickEntryShortcut: () => Promise.resolve(),+ setWindowTheme: () => Promise.resolve(false),+};diff --git a/apps/mirai-gui/client/src/platform/services/system/index.ts b/apps/mirai-gui/client/src/platform/services/system/index.tsnew file mode 100644index 000000000..7a0f3d6ec--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/system/index.ts@@ -0,0 +1,15 @@+import type { NavigationRequest } from "../../types/navigation";++export type SystemService = {+ onNavigationRequest(cb: (req: NavigationRequest) => void): () => void;+ /** App version, or null where the platform has no packaged version (web). */+ getAppVersion(): Promise<string | null>;+ /** Absolute path of the backend log file, or null where there is none. */+ getLogFilePath(): Promise<string | null>;+ /**+ * Install the mirai CLI wrapper now; also clears a persisted startup decline.+ */+ installCli(): Promise<"installed" | "already-installed" | "cancelled" | "unsupported">;+ /** "missing" is the only state where offering an install makes sense. */+ getCliStatus(): Promise<"missing" | "installed" | "foreign" | "unavailable">;+};diff --git a/apps/mirai-gui/client/src/platform/services/system/tauri.ts b/apps/mirai-gui/client/src/platform/services/system/tauri.tsnew file mode 100644index 000000000..042381a25--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/system/tauri.ts@@ -0,0 +1,58 @@+import { getVersion } from "@tauri-apps/api/app";+import { invoke } from "../shared/invoke";+import { listen } from "@tauri-apps/api/event";+import { navigationRequestTypes, type NavigationRequest } from "../../types/navigation";+import type { SystemService } from ".";++// WKWebView has no window-open handler wired up, so target="_blank" anchors+// would silently do nothing; intercept clicks and open externally via Rust.+let interceptingLinks = false;+export const ensureExternalLinkInterception = (): void => {+ if (interceptingLinks) return;+ interceptingLinks = true;+ document.addEventListener(+ "click",+ (event) => {+ const target = event.target;+ if (!(target instanceof Element)) return;+ const anchor = target.closest("a[href]");+ if (!(anchor instanceof HTMLAnchorElement)) return;+ const href = anchor.href;+ if (!/^https?:\/\//.test(href)) return;+ if (new URL(href).origin === window.location.origin) return;+ event.preventDefault();+ void invoke("open_external", { url: href }).catch(() => undefined);+ },+ true,+ );+};++export const tauriSystem: SystemService = {+ onNavigationRequest: (cb) => {+ const offs: Array<() => void> = [];+ let disposed = false;+ // listen() resolves after the caller may already have unsubscribed.+ const track = (p: Promise<() => void>): void => {+ void p.then((off) => (disposed ? off() : offs.push(off))).catch(() => undefined);+ };+ track(+ listen("app:new-chat", () => {+ cb({ type: navigationRequestTypes.newChat } satisfies NavigationRequest);+ }),+ );+ track(+ listen("app:open-preferences", () => {+ cb({ type: navigationRequestTypes.openPreferences } satisfies NavigationRequest);+ }),+ );+ return () => {+ disposed = true;+ offs.forEach((off) => off());+ };+ },+ getAppVersion: () => getVersion().catch(() => null),+ getLogFilePath: () => invoke<string>("get_log_file_path").catch(() => null),+ installCli: () => invoke<"installed" | "already-installed" | "cancelled">("cli_install"),+ getCliStatus: () =>+ invoke<"missing" | "installed" | "foreign" | "unavailable">("cli_status").catch(() => "unavailable" as const),+};diff --git a/apps/mirai-gui/client/src/platform/services/system/web.ts b/apps/mirai-gui/client/src/platform/services/system/web.tsnew file mode 100644index 000000000..0320b51a2--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/system/web.ts@@ -0,0 +1,10 @@+import type { SystemService } from ".";+import { noopUnsubscribe } from "../shared/noop";++export const webSystem: SystemService = {+ onNavigationRequest: noopUnsubscribe,+ getAppVersion: () => Promise.resolve(null),+ getLogFilePath: () => Promise.resolve(null),+ installCli: () => Promise.resolve("unsupported" as const),+ getCliStatus: () => Promise.resolve("unavailable" as const),+};diff --git a/apps/mirai-gui/client/src/platform/services/updater/index.ts b/apps/mirai-gui/client/src/platform/services/updater/index.tsnew file mode 100644index 000000000..cb4dfcb30--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/updater/index.ts@@ -0,0 +1,18 @@+import type { UpdateStatus } from "@/types/update";++export type CheckForUpdateResult = {+ currentVersion: string;+ latestVersion?: string;+ hasUpdate: boolean;+ hasDownloadable?: boolean;+ reason?: string;+};++export type UpdaterService = {+ checkForUpdate(): Promise<CheckForUpdateResult>;+ getUpdateStatus(): Promise<UpdateStatus>;+ startUpdateDownload(version: string): Promise<{ ok: boolean; error?: string }>;+ applyUpdate(): Promise<{ ok: boolean; error?: string }>;+ onUpdateDownloadDone(cb: (payload: { version: string }) => void): () => void;+ onUpdateDownloadError(cb: (payload: { version: string; error: string }) => void): () => void;+};diff --git a/apps/mirai-gui/client/src/platform/services/updater/tauri.ts b/apps/mirai-gui/client/src/platform/services/updater/tauri.tsnew file mode 100644index 000000000..0e8a5bdce--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/updater/tauri.ts@@ -0,0 +1,44 @@+import { invoke } from "@tauri-apps/api/core";+import { listen } from "@tauri-apps/api/event";+import type { UpdateStatus } from "@/types/update";+import type { CheckForUpdateResult, UpdaterService } from ".";+import { createKeyedListeners } from "../shared/keyed-listeners";++type RustCheck = {+ currentVersion: string;+ latestVersion?: string;+ hasUpdate: boolean;+ hasDownloadable: boolean;+ reason?: string;+};++const state = {+ listeners: createKeyedListeners(),+ listening: false,+};++const ensureListening = (): void => {+ if (state.listening) return;+ state.listening = true;+ void listen<{ version: string }>("update-download-done", (e) => state.listeners.emit("done", e.payload));+ void listen<{ version: string; error: string }>("update-download-error", (e) =>+ state.listeners.emit("error", e.payload),+ );+};++const on = (kind: "done" | "error", cb: (payload: never) => void): (() => void) => {+ ensureListening();+ return state.listeners.on(kind, cb);+};++export const tauriUpdater: UpdaterService = {+ checkForUpdate: async (): Promise<CheckForUpdateResult> => {+ const res = await invoke<RustCheck>("update_check");+ return { ...res };+ },+ getUpdateStatus: () => invoke<UpdateStatus>("update_status"),+ startUpdateDownload: (version) => invoke<{ ok: boolean; error?: string }>("update_download", { version }),+ applyUpdate: () => invoke<{ ok: boolean; error?: string }>("update_apply"),+ onUpdateDownloadDone: (cb) => on("done", cb),+ onUpdateDownloadError: (cb) => on("error", cb),+};diff --git a/apps/mirai-gui/client/src/platform/services/updater/web.ts b/apps/mirai-gui/client/src/platform/services/updater/web.tsnew file mode 100644index 000000000..1fbc6de79--- /dev/null+++ b/apps/mirai-gui/client/src/platform/services/updater/web.ts@@ -0,0 +1,11 @@+import type { UpdaterService } from ".";+import { noopUnsubscribe } from "../shared/noop";++export const webUpdater: UpdaterService = {+ checkForUpdate: () => Promise.resolve({ currentVersion: "", hasUpdate: false }),+ getUpdateStatus: () => Promise.resolve({ phase: "idle" as const }),+ startUpdateDownload: () => Promise.resolve({ ok: false, error: "unsupported" }),+ applyUpdate: () => Promise.resolve({ ok: false, error: "unsupported" }),+ onUpdateDownloadDone: noopUnsubscribe,+ onUpdateDownloadError: noopUnsubscribe,+};diff --git a/apps/mirai-gui/client/src/platform/tauri-platform-client.ts b/apps/mirai-gui/client/src/platform/tauri-platform-client.tsnew file mode 100644index 000000000..6dd2088f6--- /dev/null+++ b/apps/mirai-gui/client/src/platform/tauri-platform-client.ts@@ -0,0 +1,26 @@+import type { PlatformClient } from "./platform-client";+import { tauriChat } from "./services/chat/tauri";+import { tauriDialogs } from "./services/dialogs/tauri";+import { tauriModels } from "./services/models/tauri";+import { tauriSession } from "./services/session/tauri";+import { tauriSettings } from "./services/settings/tauri";+import { tauriStorage } from "./services/storage/tauri";+import { ensureExternalLinkInterception, tauriSystem } from "./services/system/tauri";+import { tauriSystemUi } from "./services/system-ui/tauri";+import { tauriUpdater } from "./services/updater/tauri";++export class TauriPlatformClient implements PlatformClient {+ readonly chat = tauriChat;+ readonly session = tauriSession;+ readonly models = tauriModels;+ readonly storage = tauriStorage;+ readonly settings = tauriSettings;+ readonly system = tauriSystem;+ readonly systemUi = tauriSystemUi;+ readonly updater = tauriUpdater;+ readonly dialogs = tauriDialogs;++ constructor() {+ ensureExternalLinkInterception();+ }+}diff --git a/apps/mirai-gui/client/src/platform/types/navigation.ts b/apps/mirai-gui/client/src/platform/types/navigation.tsnew file mode 100644index 000000000..a2ef44e8e--- /dev/null+++ b/apps/mirai-gui/client/src/platform/types/navigation.ts@@ -0,0 +1,8 @@+export const navigationRequestTypes = {+ openChatForModel: "open-chat-for-model",+ newChat: "new-chat",+ openPreferences: "open-preferences",+} as const;++export type NavigationRequest =+ { type: typeof navigationRequestTypes.newChat } | { type: typeof navigationRequestTypes.openPreferences };diff --git a/apps/mirai-gui/client/src/platform/web-platform-client.ts b/apps/mirai-gui/client/src/platform/web-platform-client.tsnew file mode 100644index 000000000..c47c4a9b3--- /dev/null+++ b/apps/mirai-gui/client/src/platform/web-platform-client.ts@@ -0,0 +1,24 @@+import type { PlatformClient } from "./platform-client";+import { webChat } from "./services/chat/web";+import { webModels } from "./services/models/web";+import { webSession } from "./services/session/web";+import { webSettings } from "./services/settings/web";+import { webDialogs } from "./services/dialogs/web";+import { webStorage } from "./services/storage/web";+import { webSystem } from "./services/system/web";+import { webSystemUi } from "./services/system-ui/web";+import { webUpdater } from "./services/updater/web";++// Browser build: no engine and no backend. Inference is unavailable, settings+// live in localStorage, chats are not persisted at all.+export class WebPlatformClient implements PlatformClient {+ readonly chat = webChat;+ readonly session = webSession;+ readonly models = webModels;+ readonly storage = webStorage;+ readonly settings = webSettings;+ readonly system = webSystem;+ readonly systemUi = webSystemUi;+ readonly updater = webUpdater;+ readonly dialogs = webDialogs;+}diff --git a/apps/mirai-gui/client/src/route-tree.gen.ts b/apps/mirai-gui/client/src/route-tree.gen.tsnew file mode 100644index 000000000..d22989d1d--- /dev/null+++ b/apps/mirai-gui/client/src/route-tree.gen.ts@@ -0,0 +1,168 @@+/* eslint-disable */++// @ts-nocheck++// noinspection JSUnusedGlobalSymbols++// This file was automatically generated by TanStack Router.+// You should NOT make any changes in this file as it will be overwritten.+// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.++import { Route as rootRouteImport } from './routes/__root'+import { Route as IndexRouteImport } from './routes/index'+import { Route as ChatsRouteImport } from './routes/chats'+import { Route as LocalModelsRouteImport } from './routes/local-models'+import { Route as SettingsRouteImport } from './routes/settings'+import { Route as WelcomeRouteImport } from './routes/welcome'+import { Route as ChatChatIdRouteImport } from './routes/chat/$chatId'++const IndexRoute = IndexRouteImport.update({+ id: '/',+ path: '/',+ getParentRoute: () => rootRouteImport,+} as any)+const ChatsRoute = ChatsRouteImport.update({+ id: '/chats',+ path: '/chats',+ getParentRoute: () => rootRouteImport,+} as any)+const LocalModelsRoute = LocalModelsRouteImport.update({+ id: '/local-models',+ path: '/local-models',+ getParentRoute: () => rootRouteImport,+} as any)+const SettingsRoute = SettingsRouteImport.update({+ id: '/settings',+ path: '/settings',+ getParentRoute: () => rootRouteImport,+} as any)+const WelcomeRoute = WelcomeRouteImport.update({+ id: '/welcome',+ path: '/welcome',+ getParentRoute: () => rootRouteImport,+} as any)+const ChatChatIdRoute = ChatChatIdRouteImport.update({+ id: '/chat/$chatId',+ path: '/chat/$chatId',+ getParentRoute: () => rootRouteImport,+} as any)++export interface FileRoutesByFullPath {+ '/': typeof IndexRoute+ '/chats': typeof ChatsRoute+ '/local-models': typeof LocalModelsRoute+ '/settings': typeof SettingsRoute+ '/welcome': typeof WelcomeRoute+ '/chat/$chatId': typeof ChatChatIdRoute+}+export interface FileRoutesByTo {+ '/': typeof IndexRoute+ '/chats': typeof ChatsRoute+ '/local-models': typeof LocalModelsRoute+ '/settings': typeof SettingsRoute+ '/welcome': typeof WelcomeRoute+ '/chat/$chatId': typeof ChatChatIdRoute+}+export interface FileRoutesById {+ __root__: typeof rootRouteImport+ '/': typeof IndexRoute+ '/chats': typeof ChatsRoute+ '/local-models': typeof LocalModelsRoute+ '/settings': typeof SettingsRoute+ '/welcome': typeof WelcomeRoute+ '/chat/$chatId': typeof ChatChatIdRoute+}+export interface FileRouteTypes {+ fileRoutesByFullPath: FileRoutesByFullPath+ fullPaths:+ | '/'+ | '/chats'+ | '/local-models'+ | '/settings'+ | '/welcome'+ | '/chat/$chatId'+ fileRoutesByTo: FileRoutesByTo+ to:+ | '/'+ | '/chats'+ | '/local-models'+ | '/settings'+ | '/welcome'+ | '/chat/$chatId'+ id:+ | '__root__'+ | '/'+ | '/chats'+ | '/local-models'+ | '/settings'+ | '/welcome'+ | '/chat/$chatId'+ fileRoutesById: FileRoutesById+}+export interface RootRouteChildren {+ IndexRoute: typeof IndexRoute+ ChatsRoute: typeof ChatsRoute+ LocalModelsRoute: typeof LocalModelsRoute+ SettingsRoute: typeof SettingsRoute+ WelcomeRoute: typeof WelcomeRoute+ ChatChatIdRoute: typeof ChatChatIdRoute+}++declare module '@tanstack/react-router' {+ interface FileRoutesByPath {+ '/': {+ id: '/'+ path: '/'+ fullPath: '/'+ preLoaderRoute: typeof IndexRouteImport+ parentRoute: typeof rootRouteImport+ }+ '/chats': {+ id: '/chats'+ path: '/chats'+ fullPath: '/chats'+ preLoaderRoute: typeof ChatsRouteImport+ parentRoute: typeof rootRouteImport+ }+ '/local-models': {+ id: '/local-models'+ path: '/local-models'+ fullPath: '/local-models'+ preLoaderRoute: typeof LocalModelsRouteImport+ parentRoute: typeof rootRouteImport+ }+ '/settings': {+ id: '/settings'+ path: '/settings'+ fullPath: '/settings'+ preLoaderRoute: typeof SettingsRouteImport+ parentRoute: typeof rootRouteImport+ }+ '/welcome': {+ id: '/welcome'+ path: '/welcome'+ fullPath: '/welcome'+ preLoaderRoute: typeof WelcomeRouteImport+ parentRoute: typeof rootRouteImport+ }+ '/chat/$chatId': {+ id: '/chat/$chatId'+ path: '/chat/$chatId'+ fullPath: '/chat/$chatId'+ preLoaderRoute: typeof ChatChatIdRouteImport+ parentRoute: typeof rootRouteImport+ }+ }+}++const rootRouteChildren: RootRouteChildren = {+ IndexRoute: IndexRoute,+ ChatsRoute: ChatsRoute,+ LocalModelsRoute: LocalModelsRoute,+ SettingsRoute: SettingsRoute,+ WelcomeRoute: WelcomeRoute,+ ChatChatIdRoute: ChatChatIdRoute,+}+export const routeTree = rootRouteImport+ ._addFileChildren(rootRouteChildren)+ ._addFileTypes<FileRouteTypes>()diff --git a/apps/mirai-gui/client/src/router.ts b/apps/mirai-gui/client/src/router.tsnew file mode 100644index 000000000..19eac161b--- /dev/null+++ b/apps/mirai-gui/client/src/router.ts@@ -0,0 +1,16 @@+import { createBrowserHistory, createRouter } from "@tanstack/react-router";+import { routeTree } from "./route-tree.gen";++export const createAppRouter = (initialPath: string) => {+ const history = createBrowserHistory();+ if (window.location.pathname === "/") history.replace(initialPath);+ return createRouter({ routeTree, history, notFoundMode: "root" });+};++export type AppRouter = ReturnType<typeof createAppRouter>;++declare module "@tanstack/react-router" {+ interface Register {+ router: AppRouter;+ }+}diff --git a/apps/mirai-gui/client/src/routes/__root.tsx b/apps/mirai-gui/client/src/routes/__root.tsxnew file mode 100644index 000000000..3fc77a5e4--- /dev/null+++ b/apps/mirai-gui/client/src/routes/__root.tsx@@ -0,0 +1,64 @@+import { ErrorPage } from "@/components/error-page";+import { FooterBar } from "@/components/footer-bar";+import { useAppNavigationEvents } from "@/hooks/use-app-navigation-events";+import { useSaveFailureToast } from "@/hooks/use-save-failure-toast";+import { useIsMobile } from "@/hooks/use-media-query";+import { useGlobalDownloadToasts } from "@/hooks/use-global-download-toasts";+import { platformInfo } from "@/platform/platform-info";+import { useSidebarStore } from "@/stores/use-sidebar-store";+import { createRootRoute, Outlet, useLocation } from "@tanstack/react-router";+import { useEffect } from "react";+import { twMerge } from "tailwind-merge";+import LeftBar from "@/components/left-bar";+import { ToastProvider } from "@/components/ui/toast/toast-provider";+import { useAppInitialization } from "@/hooks/use-app-initialization";++export const Route = createRootRoute({+ component: RootComponent,+ notFoundComponent: () => <ErrorPage />,+});++function RootComponent() {+ const location = useLocation();+ const isWelcome = location.pathname === "/welcome";+ const isMobile = useIsMobile();+ const setMobile = useSidebarStore((s) => s.setMobile);++ useAppInitialization(!isWelcome);+ useGlobalDownloadToasts();+ useAppNavigationEvents();+ useSaveFailureToast();++ useEffect(() => {+ setMobile(isMobile);+ }, [isMobile, setMobile]);++ if (location.pathname === "/welcome") {+ return (+ <div className="min-h-screen overflow-hidden">+ <div+ data-tauri-drag-region+ style={platformInfo.isTauri ? { pointerEvents: "auto" } : undefined}+ className="drag-layer fixed top-0 left-0 right-0 h-10 select-none"+ />+ <Outlet />+ </div>+ );+ }++ return (+ <div className="min-h-screen bg-background text-label-title flex thin-scrollbar">+ <div className="drag-layer fixed top-0 left-0 right-0 h-10 select-none" />+ <LeftBar />+ <div className={twMerge("relative flex-1 flex flex-col h-[100dvh] overflow-hidden", isMobile ? "w-full" : "")}>+ <main className="flex-1 overflow-auto thin-scrollbar">+ <div>+ <Outlet />+ </div>+ </main>+ <FooterBar />+ </div>+ <ToastProvider />+ </div>+ );+}diff --git a/apps/mirai-gui/client/src/routes/chat/$chatId.tsx b/apps/mirai-gui/client/src/routes/chat/$chatId.tsxnew file mode 100644index 000000000..2fbbfcb66--- /dev/null+++ b/apps/mirai-gui/client/src/routes/chat/$chatId.tsx@@ -0,0 +1,6 @@+import { createFileRoute } from "@tanstack/react-router";+import { ChatPage } from "@/features/chat/components/chat-page";++export const Route = createFileRoute("/chat/$chatId")({+ component: ChatPage,+});diff --git a/apps/mirai-gui/client/src/routes/chats.tsx b/apps/mirai-gui/client/src/routes/chats.tsxnew file mode 100644index 000000000..7143d8c57--- /dev/null+++ b/apps/mirai-gui/client/src/routes/chats.tsx@@ -0,0 +1,6 @@+import { createFileRoute } from "@tanstack/react-router";+import { ChatHistoryPage } from "@/features/chat-history/components/chat-history-page";++export const Route = createFileRoute("/chats")({+ component: ChatHistoryPage,+});diff --git a/apps/mirai-gui/client/src/routes/index.tsx b/apps/mirai-gui/client/src/routes/index.tsxnew file mode 100644index 000000000..511a100dc--- /dev/null+++ b/apps/mirai-gui/client/src/routes/index.tsx@@ -0,0 +1,10 @@+import { platformInfo } from "@/platform/platform-info";+import { createFileRoute, Navigate } from "@tanstack/react-router";++export const Route = createFileRoute("/")({+ component: HomePage,+});++function HomePage() {+ return <Navigate to={platformInfo.isWeb ? "/chats" : "/local-models"} />;+}diff --git a/apps/mirai-gui/client/src/routes/local-models.tsx b/apps/mirai-gui/client/src/routes/local-models.tsxnew file mode 100644index 000000000..4ed6a8df2--- /dev/null+++ b/apps/mirai-gui/client/src/routes/local-models.tsx@@ -0,0 +1,10 @@+import { createFileRoute } from "@tanstack/react-router";+import { LocalModelsPage } from "@/features/local-models/components/local-models-page";++export const Route = createFileRoute("/local-models")({+ component: LocalModelsRoute,+});++function LocalModelsRoute() {+ return <LocalModelsPage />;+}diff --git a/apps/mirai-gui/client/src/routes/settings.tsx b/apps/mirai-gui/client/src/routes/settings.tsxnew file mode 100644index 000000000..da95deeb7--- /dev/null+++ b/apps/mirai-gui/client/src/routes/settings.tsx@@ -0,0 +1,14 @@+import { createFileRoute } from "@tanstack/react-router";+import { SettingsPage, type SettingsTab } from "@/features/settings/components/settings-page";++export const Route = createFileRoute("/settings")({+ component: SettingsPage,+ validateSearch: (search: Record<string, unknown>) => {+ const allowed = new Set<SettingsTab>(["general", "privacy", "about"]);+ const tab =+ typeof search.tab === "string" && allowed.has(search.tab as SettingsTab)+ ? (search.tab as SettingsTab)+ : "general";+ return { tab };+ },+});diff --git a/apps/mirai-gui/client/src/routes/welcome.tsx b/apps/mirai-gui/client/src/routes/welcome.tsxnew file mode 100644index 000000000..dc766cff8--- /dev/null+++ b/apps/mirai-gui/client/src/routes/welcome.tsx@@ -0,0 +1,6 @@+import { createFileRoute } from "@tanstack/react-router";+import { WelcomePage } from "@/features/welcome/components/welcome-page";++export const Route = createFileRoute("/welcome")({+ component: WelcomePage,+});diff --git a/apps/mirai-gui/client/src/stores/chat/message-patches.ts b/apps/mirai-gui/client/src/stores/chat/message-patches.tsnew file mode 100644index 000000000..1f4c5014b--- /dev/null+++ b/apps/mirai-gui/client/src/stores/chat/message-patches.ts@@ -0,0 +1,60 @@+import type { Message, MessageVersion, ParsedOutput } from "@/types/message";+import type { OutputShape, ParsedPatch } from "@/types/llm-stream";++export function withParsedOutput(output: OutputShape | undefined, patch: ParsedPatch): OutputShape {+ return {+ ...(output || {}),+ text: {+ ...(output?.text || {}),+ parsed: {+ ...(output?.text?.parsed || {}),+ ...(patch.chainOfThought !== undefined ? { chainOfThought: patch.chainOfThought } : {}),+ ...(patch.response !== undefined ? { response: patch.response } : {}),+ },+ },+ };+}++const mergeParsedIntoOutput = (+ output: Message["output"] | undefined,+ parsed?: ParsedOutput,+): Message["output"] | undefined => (parsed ? withParsedOutput(output, parsed) : output);++export const computeErrorPatch = (+ message: Message,+ text: string,+ error: string,+ attachmentIds?: string[],+): Partial<Message> => {+ const hasVersions = Array.isArray(message.versions) && (message.versions.length || 0) > 0;+ if (hasVersions) {+ const versionsArr = message.versions || [];+ const idx = typeof message.currentVersionIndex === "number" ? message.currentVersionIndex : versionsArr.length - 1;+ const versions: MessageVersion[] = versionsArr.map((v, i): MessageVersion =>+ i === idx ? { ...v, text, error, ...(attachmentIds ? { attachmentIds } : {}) } : v,+ );+ return { text, error, versions, ...(attachmentIds ? { attachmentIds } : {}) };+ }+ return { text, error, ...(attachmentIds ? { attachmentIds } : {}) };+};++export const computeFinalizedUpdates = (message: Message, text: string, parsed?: ParsedOutput): Partial<Message> => {+ const hasVersions = Array.isArray(message.versions) && (message.versions.length || 0) > 0;+ if (hasVersions) {+ const versionsArr = message.versions || [];+ const idx = typeof message.currentVersionIndex === "number" ? message.currentVersionIndex : versionsArr.length - 1;+ const versions: MessageVersion[] = versionsArr.map((v, i): MessageVersion =>+ i === idx+ ? {+ ...v,+ text,+ error: undefined,+ output: mergeParsedIntoOutput(v.output, parsed),+ }+ : v,+ );+ return { text, error: undefined, versions };+ }+ const output = mergeParsedIntoOutput(message.output, parsed);+ return { text, error: undefined, ...(output ? { output } : {}) };+};diff --git a/apps/mirai-gui/client/src/stores/chat/persistence.test.ts b/apps/mirai-gui/client/src/stores/chat/persistence.test.tsnew file mode 100644index 000000000..132e368af--- /dev/null+++ b/apps/mirai-gui/client/src/stores/chat/persistence.test.ts@@ -0,0 +1,108 @@+import { beforeEach, expect, it, vi } from "vitest";+import type { ChatData, ChatMetadata } from "@/platform/services/storage";+import { serializeToMarkdown } from "@/platform/services/storage/markdown/serialize";+import { extractMessageBlocks, parseMessage } from "@/platform/services/storage/markdown/parse";+import { useChatStore } from "@/stores/use-chat-store";+import { Roles } from "@/types/chat";++const mocks = vi.hoisted(() => ({ invoke: vi.fn(), storage: {} as Record<string, unknown> }));+vi.mock("@tauri-apps/api/core", () => ({ invoke: mocks.invoke }));+vi.mock("@/platform/platform-singleton", () => ({ getPlatform: () => ({ storage: mocks.storage }) }));++import { tauriStorage } from "@/platform/services/storage/tauri";++const CHAT_A = "a";+const CHAT_B = "b";+const chatDefaults = useChatStore.getState();+const metadata: ChatMetadata = {+ id: CHAT_A,+ title: "Untitled",+ messageCount: 0,+ createdAt: 1,+ updatedAt: 1,+ modelId: "model",+ modelName: "Model",+};++const inMemoryStorage = () => {+ const chats = new Map<string, ChatData>();+ return {+ chats,+ createOrReplaceChat: vi.fn(async (chat: ChatData) => {+ chats.set(chat.metadata.id, structuredClone(chat));+ }),+ appendMessage: vi.fn(async (id: string, message: ChatData["messages"][number]) => {+ const chat = chats.get(id);+ if (chat) chat.messages = [...chat.messages.filter((m) => m.id !== message.id), structuredClone(message)];+ }),+ loadChat: vi.fn(async (id: string) => chats.get(id) ?? null),+ listChats: vi.fn(async () => [...chats.values()].map((c) => c.metadata)),+ updateStoredMessage: vi.fn(async () => {}),+ removeMessage: vi.fn(async () => {}),+ };+};++beforeEach(() => {+ vi.clearAllMocks();+ useChatStore.setState(chatDefaults, true);+ useChatStore.getState().createNewChat(CHAT_A);+ mocks.storage = inMemoryStorage();+});++it("does not recreate an existing chat when reading it fails", async () => {+ mocks.storage = tauriStorage as unknown as Record<string, unknown>;+ mocks.invoke.mockImplementation(async (cmd: string) => {+ if (cmd === "chat_load_file") throw new Error("read failed: EIO");+ if (cmd === "chat_list_files") return [];+ return undefined;+ });+ useChatStore.setState({ savedChats: [metadata] });+ const id = useChatStore.getState().addMessageTo(CHAT_A, { sender: Roles.User, text: "new message" }).id;++ await expect(useChatStore.getState().persistMessage(CHAT_A, id)).rejects.toThrow("read failed");+ expect(mocks.invoke.mock.calls.filter(([cmd]) => cmd === "chat_save_file")).toHaveLength(0);+});++it("persists a generation error for a chat that is no longer open", async () => {+ const storage = mocks.storage as ReturnType<typeof inMemoryStorage>;+ const id = useChatStore.getState().addMessageTo(CHAT_A, { sender: Roles.Assistant, text: "" }).id;+ storage.chats.set(CHAT_A, { metadata, messages: useChatStore.getState().messages });+ useChatStore.getState().createNewChat(CHAT_B);++ await useChatStore.getState().persistMessageError(CHAT_A, id, "", "Error: Context overflow");++ expect(storage.updateStoredMessage).toHaveBeenCalledWith(+ CHAT_A,+ id,+ expect.objectContaining({ error: "Error: Context overflow" }),+ );+});++it("counts a failed final save", async () => {+ const storage = mocks.storage as ReturnType<typeof inMemoryStorage>;+ const id = useChatStore.getState().addMessageTo(CHAT_A, { sender: Roles.Assistant, text: "complete answer" }).id;+ storage.updateStoredMessage.mockRejectedValue(new Error("disk full"));++ await useChatStore.getState().finalizeAssistantMessage(CHAT_A, id, "complete answer");++ expect(useChatStore.getState().saveFailureCount).toBe(1);+ expect(useChatStore.getState().messages.find((m) => m.id === id)?.text).toBe("complete answer");+});++it("keeps one copy of a message the file already holds when appending it", async () => {+ mocks.storage = tauriStorage as unknown as Record<string, unknown>;+ const message = { id: "m1", sender: Roles.Assistant, text: "", timestamp: 1 };+ const onDisk = serializeToMarkdown({ metadata: { ...metadata, messageCount: 1 }, messages: [message] });+ let saved = "";+ mocks.invoke.mockImplementation(async (cmd: string, args: { content?: string }) => {+ if (cmd === "chat_load_file") return onDisk;+ if (cmd === "chat_save_file") saved = args.content ?? "";+ return undefined;+ });++ await tauriStorage.appendMessage(CHAT_A, { ...message, text: "done" });++ const messages = extractMessageBlocks(saved).map(parseMessage);+ expect(messages.map((m) => m?.id)).toEqual(["m1"]);+ expect(messages[0]?.text).toBe("done");+});diff --git a/apps/mirai-gui/client/src/stores/chat/persistence.ts b/apps/mirai-gui/client/src/stores/chat/persistence.tsnew file mode 100644index 000000000..a7552122a--- /dev/null+++ b/apps/mirai-gui/client/src/stores/chat/persistence.ts@@ -0,0 +1,146 @@+import { getPlatform } from "@/platform/platform-singleton";+import { ChatNotFoundError } from "@/platform/services/storage";+import type { ChatMetadata } from "@/platform/services/storage";+import { UNTITLED_CHAT_TITLE } from "@/constants/chat";+import type { Message, ParsedOutput } from "@/types/message";+import { computeErrorPatch, computeFinalizedUpdates } from "./message-patches";+import type { ChatStoreApi } from "./types";++const reportSaveFailure = (set: ChatStoreApi["set"]) => set((s) => ({ saveFailureCount: s.saveFailureCount + 1 }));++export const persistMessage = async (+ { get, set }: ChatStoreApi,+ chatId: string,+ messageId: string,+ known?: Message,+): Promise<void> => {+ const state = get();+ const message = known ?? state.messages.find((m) => m.id === messageId);+ if (!message) return;+ const { storage } = getPlatform();+ const chatExists = state.savedChats.some((c) => c.id === chatId);+ if (chatExists) {+ try {+ await storage.appendMessage(chatId, message);+ } catch (e) {+ if (!(e instanceof ChatNotFoundError)) throw e;+ const chatModel = get().chatModels[chatId];+ const now = Date.now();+ const fallbackMetadata: ChatMetadata = {+ id: chatId,+ title: UNTITLED_CHAT_TITLE,+ modelId: chatModel?.modelId,+ modelName: chatModel?.modelName,+ createdAt: now,+ updatedAt: now,+ messageCount: get().messages.length,+ };+ set((s) => ({ savedChats: [fallbackMetadata, ...s.savedChats.filter((c) => c.id !== chatId)] }));+ // Don't merge with foreign-chat messages if user navigated away mid-recovery.+ const currentMessages = get().currentChatId === chatId ? get().messages : [message];+ await storage.createOrReplaceChat({+ metadata: { ...fallbackMetadata, messageCount: currentMessages.length },+ messages: currentMessages,+ });+ }+ } else {+ const chatModel = state.chatModels[chatId];+ const now = Date.now();+ // savedChats loads lazily: this chat may already have a file, which a partial write would truncate.+ const messages = state.currentChatId === chatId ? state.messages : [message];+ const newMetadata: ChatMetadata = {+ id: chatId,+ title: UNTITLED_CHAT_TITLE,+ modelId: chatModel?.modelId,+ modelName: chatModel?.modelName,+ createdAt: now,+ updatedAt: now,+ messageCount: messages.length,+ };+ // Mark chat as existing before the await so a concurrent persistMessage+ // takes the append path instead of racing into a second createOrReplaceChat.+ set((s) => ({ savedChats: [newMetadata, ...s.savedChats] }));+ await storage.createOrReplaceChat({ metadata: newMetadata, messages });+ }+ const savedChats = await storage.listChats();+ set({ savedChats });+};++export const persistMessagePatch = async (+ { set }: ChatStoreApi,+ chatId: string,+ messageId: string,+ patch: Partial<Message>,+): Promise<void> => {+ try {+ await getPlatform().storage.updateStoredMessage(chatId, messageId, patch);+ } catch (e) {+ console.error("[storage] persistMessagePatch failed", { chatId, messageId }, e);+ reportSaveFailure(set);+ }+};++export const persistMessageError = async (+ { get, set }: ChatStoreApi,+ chatId: string,+ messageId: string,+ text: string,+ error: string,+ attachmentIds?: string[],+): Promise<void> => {+ const { storage } = getPlatform();+ try {+ const message = await findMessage({ get }, storage, chatId, messageId);+ if (!message) return;+ const patch = computeErrorPatch(message, text, error, attachmentIds);+ await storage.updateStoredMessage(chatId, messageId, patch);+ } catch (e) {+ console.error("[storage] persistMessageError failed", { chatId, messageId }, e);+ reportSaveFailure(set);+ }+};++// The user may have opened another chat while this one was generating; then+// the message is only on disk.+const findMessage = async (+ { get }: Pick<ChatStoreApi, "get">,+ storage: ReturnType<typeof getPlatform>["storage"],+ chatId: string,+ messageId: string,+): Promise<Message | undefined> => {+ if (get().currentChatId === chatId) return get().messages.find((m) => m.id === messageId);+ const chatData = await storage.loadChat(chatId);+ return chatData?.messages.find((m) => m.id === messageId);+};++export const finalizeAssistantMessage = async (+ { get, set }: ChatStoreApi,+ chatId: string,+ messageId: string,+ text: string,+ parsed?: ParsedOutput,+): Promise<void> => {+ const { storage } = getPlatform();+ const inView = get().currentChatId === chatId;+ if (inView) {+ const current = get().messages.find((m) => m.id === messageId);+ if (!current) return;+ get().updateMessage(messageId, computeFinalizedUpdates(current, text, parsed));+ }+ try {+ // Read back so perf/stats written by applyPerf right before finalize+ // make it into the persisted patch.+ const latest = await findMessage({ get }, storage, chatId, messageId);+ if (!latest) return;+ const patch: Partial<Message> = {+ ...computeFinalizedUpdates(latest, text, parsed),+ ...(inView && latest.perf ? { perf: latest.perf } : {}),+ ...(inView && latest.stats ? { stats: latest.stats } : {}),+ };+ await storage.updateStoredMessage(chatId, messageId, patch);+ set({ savedChats: await storage.listChats() });+ } catch (e) {+ console.error("[storage] finalizeAssistantMessage failed", { chatId, messageId }, e);+ reportSaveFailure(set);+ }+};diff --git a/apps/mirai-gui/client/src/stores/chat/title-generation.ts b/apps/mirai-gui/client/src/stores/chat/title-generation.tsnew file mode 100644index 000000000..fac040f06--- /dev/null+++ b/apps/mirai-gui/client/src/stores/chat/title-generation.ts@@ -0,0 +1,62 @@+import { getPlatform } from "@/platform/platform-singleton";+import { useChatSessionStore } from "@/stores/use-chat-session-store";+import { CHAT_TITLE_MAX_LENGTH, DEFAULT_CHAT_TITLE, UNTITLED_CHAT_TITLE } from "@/constants/chat";+import { Roles } from "@/types/chat";+import type { ChatStoreApi } from "./types";++const sanitizeChatTitle = (raw: string): string => {+ if (!raw) return "";+ let title = raw.trim();+ title = title.replace(/[\r\n]+/g, " ");+ title = title.replace(/\s+/g, " ").trim();+ title = title.replace(/^["'`]+|["'`]+$/g, "");+ return title;+};++const isPlaceholderChatTitle = (title?: string | null): boolean => {+ const normalized = (title ?? "").trim().toLowerCase();+ return normalized.length === 0 || normalized === "untitled" || normalized === "new chat";+};++// The store's messages belong to whichever chat is open by now, so the send+// operation passes the user text itself.+export const runChatTitleGeneration = async (+ chatId: string,+ userText: string,+ get: ChatStoreApi["get"],+ set: ChatStoreApi["set"],+): Promise<void> => {+ const chatModel = get().chatModels[chatId];+ if (!chatId || userText.trim().length === 0) return;++ const chatData = await getPlatform().storage.loadChat(chatId);+ const existingTitle = chatData?.metadata.title ?? UNTITLED_CHAT_TITLE;+ if (!isPlaceholderChatTitle(existingTitle)) return;++ const repoIdToUse = chatModel?.modelId || chatData?.metadata.modelId;+ if (!repoIdToUse) return;++ const firstUserQuoted = userText.replace(/\s+/g, " ").trim().replace(/"/g, '\\"');+ // Small models copy a fallback phrase from the prompt instead of titling.+ const userOnlyInstruction =+ `Write a chat title of 2 to 4 words for the message below. Reply with the title only, no quotes, no punctuation at the end. ` ++ `Message: "${firstUserQuoted}"`;++ const title = await getPlatform().chat.generateTitle({+ repoId: repoIdToUse,+ messages: [{ role: Roles.User, content: userOnlyInstruction }],+ });+ // A cancelled generation returns whatever came out before the cancel, usually+ // nothing; writing that or the default here would stop the next message from+ // generating a real title.+ if (useChatSessionStore.getState().titleGenAbortChatId === chatId) return;++ const candidateRaw = sanitizeChatTitle(title);+ // Longer than a manual rename allows means the model answered instead of titling.+ const candidate = candidateRaw.length > CHAT_TITLE_MAX_LENGTH ? "New chat" : candidateRaw || DEFAULT_CHAT_TITLE;+ const { storage } = getPlatform();+ // The user may have renamed the chat while the model was thinking.+ await storage.updateChatTitle(chatId, candidate, existingTitle);+ const savedChats = await storage.listChats();+ set({ savedChats });+};diff --git a/apps/mirai-gui/client/src/stores/chat/types.ts b/apps/mirai-gui/client/src/stores/chat/types.tsnew file mode 100644index 000000000..89a28b59b--- /dev/null+++ b/apps/mirai-gui/client/src/stores/chat/types.ts@@ -0,0 +1,6 @@+import type { ChatState } from "../use-chat-store";++export type ChatStoreApi = {+ get: () => ChatState;+ set: (partial: Partial<ChatState> | ((state: ChatState) => Partial<ChatState>)) => void;+};diff --git a/apps/mirai-gui/client/src/stores/migrate-app-storage.ts b/apps/mirai-gui/client/src/stores/migrate-app-storage.tsnew file mode 100644index 000000000..134bcc079--- /dev/null+++ b/apps/mirai-gui/client/src/stores/migrate-app-storage.ts@@ -0,0 +1,46 @@+export const APP_STORE_KEY = "mirai-store";++// Keys written by earlier releases. The names are fixed by what is already in+// users' browser storage, so they are read verbatim and never renamed.+const LEGACY_APP_STORE_KEY = "mirai-electron-store";+const LEGACY_AUTH_STORE_KEY = "mirai-auth-store";++const readState = (key: string): Record<string, unknown> | null => {+ try {+ const raw = localStorage.getItem(key);+ if (!raw) return null;+ const parsed = JSON.parse(raw);+ const state = parsed?.state;+ return state && typeof state === "object" ? (state as Record<string, unknown>) : null;+ } catch {+ return null;+ }+};++const migrateAppStorage = (): void => {+ try {+ if (localStorage.getItem(APP_STORE_KEY)) {+ localStorage.removeItem(LEGACY_APP_STORE_KEY);+ localStorage.removeItem(LEGACY_AUTH_STORE_KEY);+ return;+ }++ const legacyApp = readState(LEGACY_APP_STORE_KEY);+ const legacyAuth = readState(LEGACY_AUTH_STORE_KEY);++ const state: Record<string, unknown> = {};+ if (typeof legacyApp?.isDarkMode === "boolean") state.isDarkMode = legacyApp.isDarkMode;+ const skipWelcome = legacyApp?.skipWelcome ?? legacyAuth?.skipWelcome;+ if (typeof skipWelcome === "boolean") state.skipWelcome = skipWelcome;++ if (Object.keys(state).length > 0) {+ localStorage.setItem(APP_STORE_KEY, JSON.stringify({ state, version: 0 }));+ }+ localStorage.removeItem(LEGACY_APP_STORE_KEY);+ localStorage.removeItem(LEGACY_AUTH_STORE_KEY);+ } catch {+ // Boot must survive a blocked or full localStorage.+ }+};++export { migrateAppStorage };diff --git a/apps/mirai-gui/client/src/stores/model-download-state.test.ts b/apps/mirai-gui/client/src/stores/model-download-state.test.tsnew file mode 100644index 000000000..66d4de8e2--- /dev/null+++ b/apps/mirai-gui/client/src/stores/model-download-state.test.ts@@ -0,0 +1,95 @@+import { describe, expect, it } from "vitest";+import { modelDownloadPhases as phases, type ModelDownloadState } from "@/types/model-manager";+import { downloadStatePatch } from "./model-download-state";++const identifier = "vendor/model";+const MB = 1024 * 1024;++const state = (patch: Partial<ModelDownloadState>): ModelDownloadState => ({+ totalKbytes: 4096,+ downloadedKbytes: 1024,+ phase: phases.downloading,+ seq: 0,+ ...patch,+});++const progress = (completedBytes: number, totalBytes: number | null = 4 * MB) =>+ ({ kind: "progress", identifier, seq: 0, completedBytes, totalBytes }) as const;++describe("downloadStatePatch", () => {+ it("starts tracking a model it has not seen before", () => {+ expect(downloadStatePatch(undefined, progress(MB))).toEqual({+ downloadedKbytes: 1024,+ totalKbytes: 4096,+ phase: phases.downloading,+ });+ });++ it("keeps the known total when a tick carries none", () => {+ expect(downloadStatePatch(state({}), progress(2 * MB, null))).toEqual({+ downloadedKbytes: 2048,+ phase: phases.downloading,+ });+ });++ it("does not reactivate a paused or finished download on a late tick", () => {+ expect(downloadStatePatch(state({ phase: phases.paused }), progress(2 * MB))).toEqual({+ downloadedKbytes: 2048,+ totalKbytes: 4096,+ });+ expect(downloadStatePatch(state({ phase: phases.downloaded }), progress(4 * MB))).toEqual({+ downloadedKbytes: 4096,+ totalKbytes: 4096,+ });+ });++ it("keeps an error until bytes actually grow", () => {+ const failed = state({ phase: phases.error, error: "disk full" });+ expect(downloadStatePatch(failed, progress(MB))).toEqual({ downloadedKbytes: 1024, totalKbytes: 4096 });+ expect(downloadStatePatch(failed, progress(2 * MB))).toEqual({+ downloadedKbytes: 2048,+ totalKbytes: 4096,+ phase: phases.downloading,+ error: "",+ });+ });++ it("leaves a locked download once progress arrives", () => {+ expect(downloadStatePatch(state({ phase: phases.locked }), progress(2 * MB))).toMatchObject({+ phase: phases.downloading,+ error: "",+ });+ });++ it("ignores resumed while an error is showing", () => {+ expect(+ downloadStatePatch(state({ phase: phases.error, error: "x" }), { kind: "resumed", identifier, seq: 0 }),+ ).toBeNull();+ expect(downloadStatePatch(state({ phase: phases.paused }), { kind: "resumed", identifier, seq: 0 })).toEqual({+ phase: phases.downloading,+ error: "",+ });+ });++ it("maps terminal events", () => {+ expect(downloadStatePatch(state({}), { kind: "done", identifier, seq: 0 })).toEqual({+ phase: phases.downloaded,+ error: "",+ });+ expect(downloadStatePatch(state({}), { kind: "error", identifier, seq: 0, error: "boom" })).toEqual({+ phase: phases.error,+ error: "boom",+ });+ expect(downloadStatePatch(state({}), { kind: "locked", identifier, seq: 0, lockedBy: "cli" })).toEqual({+ phase: phases.locked,+ error: "",+ });+ expect(downloadStatePatch(state({}), { kind: "paused", identifier, seq: 0 })).toEqual({ phase: phases.paused });+ expect(downloadStatePatch(state({}), { kind: "deleted", identifier, seq: 0 })).toEqual({+ phase: phases.notDownloaded,+ downloadedKbytes: 0,+ totalKbytes: 0,+ error: "",+ });+ });+});diff --git a/apps/mirai-gui/client/src/stores/model-download-state.ts b/apps/mirai-gui/client/src/stores/model-download-state.tsnew file mode 100644index 000000000..b19a85cd5--- /dev/null+++ b/apps/mirai-gui/client/src/stores/model-download-state.ts@@ -0,0 +1,71 @@+import type { DownloadEvent } from "@/platform/services/models";+import { modelDownloadPhases, type ModelDownloadState } from "@/types/model-manager";+import { toDownloadProgressKbytes } from "@/utils/download-progress";++const progressPatch = (+ current: ModelDownloadState | undefined,+ completedBytes: number,+ totalBytes: number | null,+): Partial<ModelDownloadState> => {+ const { downloadedKbytes, totalKbytes } = toDownloadProgressKbytes(completedBytes, totalBytes);+ const phase = current?.phase;+ // Progress ticks keep arriving briefly after pause, completion and a failure.+ // Only bytes that actually grew may pull an errored download back to active.+ const grew = downloadedKbytes > (current?.downloadedKbytes ?? 0);+ const becomesActive =+ phase !== modelDownloadPhases.downloaded &&+ phase !== modelDownloadPhases.paused &&+ (phase !== modelDownloadPhases.error || grew);+ const clearsError = phase === modelDownloadPhases.locked || phase === modelDownloadPhases.error;++ return {+ downloadedKbytes,+ ...(totalKbytes ? { totalKbytes } : {}),+ ...(becomesActive ? { phase: modelDownloadPhases.downloading } : {}),+ ...(becomesActive && clearsError ? { error: "" } : {}),+ };+};++export const downloadStatePatch = (+ current: ModelDownloadState | undefined,+ event: DownloadEvent,+): Partial<ModelDownloadState> | null => {+ switch (event.kind) {+ case "progress":+ return progressPatch(current, event.completedBytes, event.totalBytes);+ case "done":+ return { phase: modelDownloadPhases.downloaded, error: "" };+ case "error":+ return { phase: modelDownloadPhases.error, error: event.error };+ case "locked":+ return { phase: modelDownloadPhases.locked, error: "" };+ case "paused":+ return { phase: modelDownloadPhases.paused };+ case "resumed":+ // A terminal error stays visible until progress proves the download recovered.+ return current?.phase === modelDownloadPhases.error+ ? null+ : { phase: modelDownloadPhases.downloading, error: "" };+ case "deleted":+ return { phase: modelDownloadPhases.notDownloaded, downloadedKbytes: 0, totalKbytes: 0, error: "" };+ }+};++type WithTotalKbytes = {+ totalKbytes: number;+};++// A catalog snapshot may not know the size yet; keep the one already seen.+export const preserveTotalKbytes = <TState extends WithTotalKbytes>(+ incomingState: TState,+ previousState?: TState,+): TState => {+ const fallbackTotalKbytes =+ previousState?.totalKbytes && previousState.totalKbytes > 0 ? previousState.totalKbytes : undefined;+ const effectiveTotalKbytes =+ incomingState.totalKbytes && incomingState.totalKbytes > 0 ? incomingState.totalKbytes : fallbackTotalKbytes;++ return typeof effectiveTotalKbytes === "number"+ ? { ...incomingState, totalKbytes: effectiveTotalKbytes }+ : incomingState;+};diff --git a/apps/mirai-gui/client/src/stores/use-app-store.ts b/apps/mirai-gui/client/src/stores/use-app-store.tsnew file mode 100644index 000000000..bb8a13ace--- /dev/null+++ b/apps/mirai-gui/client/src/stores/use-app-store.ts@@ -0,0 +1,57 @@+import { getPlatform } from "@/platform/platform-singleton";+import { APP_STORE_KEY, migrateAppStorage } from "./migrate-app-storage";+import { create } from "zustand";+import { persist } from "zustand/middleware";++type AppState = {+ skipWelcome: boolean;+ completeWelcome: () => void;+ isDarkMode: boolean;+ setDarkMode: (isDark: boolean) => void;+ appVersion: string;+ fetchVersion(): Promise<void>;+};++// Runs before create(persist(...)) so hydration sees the migrated key regardless+// of module order.+migrateAppStorage();++export const useAppStore = create<AppState>()(+ persist(+ (set) => ({+ skipWelcome: false,+ isDarkMode: true,+ appVersion: "",++ completeWelcome: () => set({ skipWelcome: true }),++ setDarkMode: (isDark) => {+ set({ isDarkMode: isDark });+ if (isDark) {+ document.documentElement.classList.add("dark");+ } else {+ document.documentElement.classList.remove("dark");+ }+ void getPlatform()+ .systemUi.setWindowTheme(isDark)+ .catch(() => {});+ },++ fetchVersion: async () => {+ try {+ const version = await getPlatform().system.getAppVersion();+ if (version) set({ appVersion: version });+ } catch (error) {+ console.error("Failed to fetch app version:", error);+ }+ },+ }),+ {+ name: APP_STORE_KEY,+ partialize: (state) => ({+ isDarkMode: state.isDarkMode,+ skipWelcome: state.skipWelcome,+ }),+ },+ ),+);diff --git a/apps/mirai-gui/client/src/stores/use-chat-session-store.test.ts b/apps/mirai-gui/client/src/stores/use-chat-session-store.test.tsnew file mode 100644index 000000000..9cc767399--- /dev/null+++ b/apps/mirai-gui/client/src/stores/use-chat-session-store.test.ts@@ -0,0 +1,27 @@+import { beforeEach, expect, it } from "vitest";+import { useChatSessionStore } from "./use-chat-session-store";++const defaults = useChatSessionStore.getState();++beforeEach(() => {+ useChatSessionStore.setState(defaults, true);+});++it("ignores a loading-message clear that comes from another chat", () => {+ const { setLoadingMessage } = useChatSessionStore.getState();+ setLoadingMessage("a", "m1");++ setLoadingMessage("b", null);+ expect(useChatSessionStore.getState().loadingMessage).toEqual({ chatId: "a", messageId: "m1" });++ setLoadingMessage("a", null);+ expect(useChatSessionStore.getState().loadingMessage).toBeNull();+});++it("marks only the stopped chat's message as canceled", () => {+ const { setCanceledMessage } = useChatSessionStore.getState();+ setCanceledMessage("a", "m1");++ setCanceledMessage("b", null);+ expect(useChatSessionStore.getState().canceledMessage).toEqual({ chatId: "a", messageId: "m1" });+});diff --git a/apps/mirai-gui/client/src/stores/use-chat-session-store.ts b/apps/mirai-gui/client/src/stores/use-chat-session-store.tsnew file mode 100644index 000000000..d1e6811d3--- /dev/null+++ b/apps/mirai-gui/client/src/stores/use-chat-session-store.ts@@ -0,0 +1,212 @@+import { useRuntimeSessionStore } from "./use-runtime-session-store";+import type { RuntimeSessionRef, RuntimeSessionEjectReason } from "@/types/session";+import { v4 as uuidv4 } from "uuid";+import { create } from "zustand";+import { getPlatform } from "@/platform/platform-singleton";++type SessionKey = RuntimeSessionRef;++type ChatMessageRef = { chatId: string; messageId: string };++type OperationState = "idle" | "running" | "stopping" | "ejecting";++type SessionStoreState = {+ isGenerating: boolean;+ isEjecting: boolean;+ isModelLoading: boolean;+ operationState: OperationState;+ operationId: string | null;+ lastEjected: SessionKey | null;+ lastEjectedReason?: RuntimeSessionEjectReason | null;+ isTitleGenerating: boolean;+ titleGenChatId: string | null;+ // Set by cancelActiveRunForChat while that chat's title is generating; the+ // send flow that owns the run consumes it and settles the placeholder.+ titleGenAbortChatId: string | null;+ activeGeneratingChatId: string | null;+ activeAssistantMessageId: string | null;+ activeAssistantMessageText: string | null;+ // The assistant placeholder from its creation until the reply settles; it+ // exists before the run does (title generation runs in between).+ loadingMessage: ChatMessageRef | null;+ canceledMessage: ChatMessageRef | null;++ setLoadingMessage: (chatId: string, messageId: string | null) => void;+ setCanceledMessage: (chatId: string, messageId: string | null) => void;+ setGenerating: (running: boolean) => void;+ setEjecting: (ejecting: boolean) => void;+ startModelLoading: () => void;+ endModelLoading: () => void;+ setTitleGenerating: (v: boolean) => void;+ setTitleGenChat: (chatId: string | null) => void;+ consumeTitleGenAbort: (chatId: string) => boolean;+ setLastEjected: (key: SessionKey | null) => void;+ setLastEjectedWithReason: (key: SessionKey | null, reason: RuntimeSessionEjectReason | null) => void;++ setActiveGenerating: (chatId: string, assistantMessageId: string) => void;+ clearActiveGenerating: () => void;+ setActiveAssistantMessageText: (text: string | null) => void;+ cancelTitleGen: () => Promise<boolean>;+ activeRunId: string | null;+ setActiveRunId: (runId: string | null) => void;+ cancelActiveRunForChat: (chatId: string) => Promise<void>;++ canRun: (key: SessionKey) => boolean;+ canStop: () => boolean;+ canEject: () => boolean;++ withOperation: <T>(op: Exclude<OperationState, "idle">, effect: () => Promise<T>) => Promise<T | null>;+};++export const useChatSessionStore = create<SessionStoreState>((set, get) => ({+ isGenerating: false,+ isEjecting: false,+ isModelLoading: false,+ operationState: "idle",+ operationId: null,+ lastEjected: null,+ lastEjectedReason: null,++ isTitleGenerating: false,+ titleGenChatId: null,+ titleGenAbortChatId: null,+ activeGeneratingChatId: null,+ activeAssistantMessageId: null,+ activeAssistantMessageText: null,+ loadingMessage: null,+ canceledMessage: null,++ setLoadingMessage: (chatId, messageId) =>+ set((s) => {+ if (messageId) return { loadingMessage: { chatId, messageId } };+ return s.loadingMessage?.chatId === chatId ? { loadingMessage: null } : {};+ }),+ setCanceledMessage: (chatId, messageId) =>+ set((s) => {+ if (messageId) return { canceledMessage: { chatId, messageId } };+ return s.canceledMessage?.chatId === chatId ? { canceledMessage: null } : {};+ }),+ setGenerating: (running) => set({ isGenerating: running }),+ // The backend can eject on its own timer while a run is being prepared.+ setEjecting: (ejecting) => {+ const st = get().operationState;+ const next = ejecting ? (st === "idle" ? "ejecting" : st) : st === "ejecting" ? "idle" : st;+ set({ isEjecting: ejecting, operationState: next });+ },+ // A model load only ever happens inside a run.+ startModelLoading: () => set({ isModelLoading: true }),+ // Loads never overlap, so the terminal event is not matched to a load;+ // ignoring a mismatched one would strand isModelLoading and block send,+ // stop and eject.+ endModelLoading: () => set({ isModelLoading: false }),+ setTitleGenerating: (v) => set({ isTitleGenerating: v }),+ setTitleGenChat: (chatId) => set({ titleGenChatId: chatId }),+ consumeTitleGenAbort: (chatId) => {+ const requested = get().titleGenAbortChatId === chatId;+ if (requested) set({ titleGenAbortChatId: null });+ return requested;+ },+ setLastEjected: (key) => set({ lastEjected: key, lastEjectedReason: null }),+ setLastEjectedWithReason: (key, reason) => set({ lastEjected: key, lastEjectedReason: reason }),++ setActiveGenerating: (chatId, assistantMessageId) =>+ set({+ activeGeneratingChatId: chatId,+ activeAssistantMessageId: assistantMessageId,+ activeAssistantMessageText: null,+ }),+ clearActiveGenerating: () =>+ set({+ activeGeneratingChatId: null,+ activeAssistantMessageId: null,+ activeAssistantMessageText: null,+ activeRunId: null,+ }),+ setActiveAssistantMessageText: (text) => set({ activeAssistantMessageText: text }),++ activeRunId: null,+ setActiveRunId: (runId) => set({ activeRunId: runId }),+ cancelActiveRunForChat: async (chatId) => {+ const { titleGenChatId, cancelTitleGen, activeGeneratingChatId, activeRunId } = get();+ if (titleGenChatId === chatId) {+ set({ titleGenAbortChatId: chatId });+ await cancelTitleGen().catch(() => undefined);+ }+ if (activeGeneratingChatId === chatId && activeRunId) {+ await getPlatform()+ .chat.cancelRun(activeRunId)+ .catch(() => undefined);+ }+ },++ cancelTitleGen: async () => {+ try {+ await getPlatform().chat.cancelTitleGen();+ return true;+ } catch {+ return false;+ }+ },++ canRun: (key) => {+ const s = get();+ const notLoading = !s.isModelLoading;+ const notEjecting = !s.isEjecting && s.operationState !== "ejecting";+ const notRunning = !s.isGenerating && s.operationState !== "running";+ const notStopping = s.operationState !== "stopping";+ const notTitling = !s.isTitleGenerating;+ const resident = useRuntimeSessionStore.getState().residentSession;+ const residentConflict = !!resident && resident.repoId !== key.repoId;+ return !residentConflict && notLoading && notEjecting && notRunning && notStopping && notTitling;+ },+ canStop: () => {+ const s = get();+ // A run still loading its model can be stopped: the backend checks for a cancel first.+ const running = s.isGenerating;+ const notEjecting = !s.isEjecting && s.operationState !== "ejecting";+ const notTitling = !s.isTitleGenerating;+ return running && notEjecting && notTitling && s.operationState !== "stopping";+ },+ canEject: () => {+ const s = get();+ const resident = useRuntimeSessionStore.getState().residentSession;+ const hasResident = !!resident;+ const notLoading = !s.isModelLoading;+ const notEjecting = !s.isEjecting && s.operationState !== "ejecting";+ const notRunning = !s.isGenerating && s.operationState !== "running";+ const notStopping = s.operationState !== "stopping";+ const notTitling = !s.isTitleGenerating;+ return hasResident && notLoading && notEjecting && notRunning && notStopping && notTitling;+ },++ withOperation: async (op, effect) => {+ const s = get();+ const st: OperationState = s.operationState;++ const isEjectingState = st === "ejecting";+ const isRunningState = st === "running";+ const isStoppingState = st === "stopping";+ const sameOp = st === op;+ const isTitling = s.isTitleGenerating;++ const isBlocked =+ isTitling ||+ sameOp ||+ (op === "running" && (isStoppingState || isEjectingState)) ||+ (op === "stopping" && isEjectingState) ||+ (op === "ejecting" && (isRunningState || isStoppingState));++ if (isBlocked) return Promise.resolve(null);++ const id = uuidv4();+ set({ operationState: op, operationId: id });+ try {+ const result = await effect();+ return result;+ } finally {+ const cur = get();+ const same = cur.operationId === id && cur.operationState === op;+ if (same) set({ operationState: "idle", operationId: null });+ }+ },+}));diff --git a/apps/mirai-gui/client/src/stores/use-chat-store.ts b/apps/mirai-gui/client/src/stores/use-chat-store.tsnew file mode 100644index 000000000..21e9b9b42--- /dev/null+++ b/apps/mirai-gui/client/src/stores/use-chat-store.ts@@ -0,0 +1,296 @@+import { useChatSessionStore } from "./use-chat-session-store";+import { defaultReasoningEffort, useModelParamsStore } from "./use-model-params-store";+import type { Message, PerfStats } from "@/types/message";+import type { ChatMetadata } from "@/platform/services/storage";+import { v4 as uuidv4 } from "uuid";+import { create } from "zustand";+import { getPlatform } from "@/platform/platform-singleton";+import type { LlmAsyncStream, LlmRunParams, SessionOutputStats } from "@/types/llm-stream";+import { finalizeAssistantMessage, persistMessage, persistMessageError, persistMessagePatch } from "./chat/persistence";+import { runChatTitleGeneration } from "./chat/title-generation";++export type ChatState = {+ chatModels: Record<string, { modelId: string; modelName: string }>;+ lastUsedModel: {+ modelId: string;+ modelName: string;+ } | null;+ messages: Message[];+ currentChatId: string | null;+ savedChats: ChatMetadata[];+ autoSelectSuppressed?: Record<string, boolean>;+ /** Bumped when a message failed to reach disk; the UI reports it. */+ saveFailureCount: number;++ setChatModel: (chatId: string, modelId: string, modelName: string) => void;++ // For a run that may outlive the page: the message enters the view only+ // while that chat is open, the caller persists it by value.+ addMessageTo: (chatId: string, message: Omit<Message, "id" | "timestamp">) => Message;+ updateMessage: (id: string, updates: Partial<Message>) => void;+ discardMessage: (chatId: string, id: string) => Promise<void>;+ switchMessageVersion: (messageId: string, versionIndex: number) => void;+ updateMessagePerf: (messageId: string, perf: Partial<PerfStats>, stats?: SessionOutputStats) => void;+ updateVersionPerf: (+ messageId: string,+ versionIndex: number,+ perf: Partial<PerfStats>,+ stats?: SessionOutputStats,+ ) => void;++ getEffectiveModelForMessage: (+ messageId: string,+ chatId: string,+ ) => { modelId: string | null; modelName: string | null };+ clearChat: () => void;+ setCurrentChatId: (chatId: string | null) => void;+ persistMessage: (chatId: string, messageId: string, message?: Message) => Promise<void>;+ persistMessagePatch: (chatId: string, messageId: string, patch: Partial<Message>) => Promise<void>;+ persistMessageError: (+ chatId: string,+ messageId: string,+ text: string,+ error: string,+ attachmentIds?: string[],+ ) => Promise<void>;+ finalizeAssistantMessage: (+ chatId: string,+ messageId: string,+ text: string,+ parsed?: { chainOfThought?: string; response?: string },+ ) => Promise<void>;+ loadChat: (chatId: string) => Promise<void>;+ loadSavedChats: () => Promise<void>;+ deleteChat: (chatId: string) => Promise<void>;+ createNewChat: (chatId: string) => void;+ updateChatTitle: (chatId: string, title: string) => Promise<void>;+ generateChatTitle: (chatId: string, userText: string) => Promise<{ ok: boolean; error?: string }>;+ suppressAutoSelect: (chatId: string, value: boolean) => void;++ runChatStream: (params: LlmRunParams) => LlmAsyncStream;+};++export const useChatStore = create<ChatState>((set, get) => ({+ chatModels: {},+ lastUsedModel: null,+ messages: [],+ currentChatId: null,+ savedChats: [],+ autoSelectSuppressed: {},+ saveFailureCount: 0,++ setChatModel: (chatId: string, modelId: string, modelName: string) => {+ set((state) => ({+ chatModels: {+ ...state.chatModels,+ [chatId]: { modelId, modelName },+ },+ lastUsedModel: modelId ? { modelId, modelName } : state.lastUsedModel,+ }));+ },++ addMessageTo: (chatId, messageData) => {+ const message: Message = { ...messageData, id: uuidv4(), timestamp: Date.now() };+ if (get().currentChatId === chatId) set((state) => ({ messages: [...state.messages, message] }));+ return message;+ },++ updateMessage: (id: string, updates: Partial<Message>) => {+ set((state) => ({+ messages: state.messages.map((msg) => (msg.id === id ? { ...msg, ...updates } : msg)),+ }));+ },++ discardMessage: async (chatId: string, id: string) => {+ if (get().currentChatId === chatId) {+ set((s) => ({ messages: s.messages.filter((m) => m.id !== id) }));+ }+ const { storage } = getPlatform();+ try {+ await storage.removeMessage(chatId, id);+ set({ savedChats: await storage.listChats() });+ } catch (e) {+ console.error("[storage] discardMessage failed", { chatId, id }, e);+ }+ },++ switchMessageVersion: (messageId: string, versionIndex: number) => {+ set((state) => ({+ messages: state.messages.map((msg) => {+ if (msg.id !== messageId || !msg.versions) return msg;++ const version = msg.versions[versionIndex];+ if (!version) return msg;++ return {+ ...msg,+ text: version.text,+ modelId: version.modelId,+ modelName: version.modelName,+ currentVersionIndex: versionIndex,+ timestamp: version.timestamp,+ output: version.output || msg.output,+ };+ }),+ }));+ },++ updateMessagePerf: (messageId, perf, stats) => {+ set((state) => ({+ messages: state.messages.map((msg) =>+ msg.id === messageId+ ? {+ ...msg,+ perf: { ...(msg.perf || {}), ...perf },+ stats: stats ?? msg.stats,+ }+ : msg,+ ),+ }));+ },++ updateVersionPerf: (messageId, versionIndex, perf, stats) => {+ set((state) => ({+ messages: state.messages.map((msg) => {+ if (msg.id !== messageId || !msg.versions) return msg;+ const updatedVersions = msg.versions.map((v, i) =>+ i === versionIndex+ ? {+ ...v,+ perf: { ...(v.perf || {}), ...perf },+ stats: stats ?? v.stats,+ }+ : v,+ );+ return { ...msg, versions: updatedVersions };+ }),+ }));+ },++ getEffectiveModelForMessage: (messageId: string, chatId: string) => {+ const { messages, chatModels } = get();+ const message = messages.find((msg) => msg.id === messageId);+ const chatModel = chatModels[chatId];++ if (!message) {+ return chatModel+ ? { modelId: chatModel.modelId, modelName: chatModel.modelName }+ : { modelId: null, modelName: null };+ }++ return {+ modelId: message.modelId || (chatModel ? chatModel.modelId : null),+ modelName: message.modelName || (chatModel ? chatModel.modelName : null),+ };+ },++ clearChat: () => {+ set({ messages: [] });+ },++ setCurrentChatId: (chatId: string | null) => {+ set({ currentChatId: chatId });+ },++ persistMessage: (chatId, messageId, message) => persistMessage({ get, set }, chatId, messageId, message),++ persistMessagePatch: (chatId, messageId, patch) => persistMessagePatch({ get, set }, chatId, messageId, patch),++ persistMessageError: (chatId, messageId, text, error, attachmentIds) =>+ persistMessageError({ get, set }, chatId, messageId, text, error, attachmentIds),++ finalizeAssistantMessage: (chatId, messageId, text, parsed) =>+ finalizeAssistantMessage({ get, set }, chatId, messageId, text, parsed),++ loadChat: async (chatId: string) => {+ const chatData = await getPlatform().storage.loadChat(chatId);+ // The user may have opened another chat while this one was being read.+ if (get().currentChatId !== chatId) return;+ if (chatData) {+ set({+ messages: chatData.messages,+ currentChatId: chatId,+ });++ if (chatData.metadata.modelId && chatData.metadata.modelName) {+ get().setChatModel(chatId, chatData.metadata.modelId, chatData.metadata.modelName);+ }+ }+ },++ loadSavedChats: async () => {+ const savedChats = await getPlatform().storage.listChats();+ set({ savedChats });+ },++ deleteChat: async (chatId: string) => {+ await useChatSessionStore.getState().cancelActiveRunForChat(chatId);+ await getPlatform().storage.deleteChat(chatId);+ const { savedChats } = get();+ const updatedChats = savedChats.filter((chat) => chat.id !== chatId);+ set({ savedChats: updatedChats });++ if (get().currentChatId === chatId) {+ set({ messages: [], currentChatId: null });+ }+ },++ createNewChat: (chatId: string) => {+ set({+ messages: [],+ currentChatId: chatId,+ });+ },++ updateChatTitle: async (chatId: string, title: string) => {+ const { storage } = getPlatform();+ await storage.updateChatTitle(chatId, title);+ const savedChats = await storage.listChats();+ set({ savedChats });+ },++ generateChatTitle: async (chatId: string, userText: string): Promise<{ ok: boolean; error?: string }> => {+ const s = useChatSessionStore.getState();+ const st = s.operationState;+ const blocked =+ s.isGenerating ||+ s.isEjecting ||+ s.isModelLoading ||+ s.isTitleGenerating ||+ st === "stopping" ||+ st === "ejecting";+ if (blocked) return { ok: true };++ useChatSessionStore.getState().setTitleGenerating(true);+ useChatSessionStore.getState().setTitleGenChat(chatId);++ try {+ await runChatTitleGeneration(chatId, userText, get, set);+ return { ok: true };+ } catch (error) {+ return { ok: false, error: error instanceof Error ? error.message : String(error) };+ } finally {+ useChatSessionStore.getState().setTitleGenerating(false);+ useChatSessionStore.getState().setTitleGenChat(null);+ }+ },++ suppressAutoSelect: (chatId: string, value: boolean) => {+ set((state) => ({+ autoSelectSuppressed: {+ ...(state.autoSelectSuppressed || {}),+ [chatId]: value,+ },+ }));+ },++ runChatStream: (params: LlmRunParams) => {+ const { getParams, globalReasoningEnabled } = useModelParamsStore.getState();+ const modelParams = getParams(params.repoId);+ return getPlatform().chat.runStream({+ ...params,+ samplingPolicy: modelParams.sampling,+ reasoningEffort: modelParams.reasoningEffort ?? defaultReasoningEffort(globalReasoningEnabled),+ });+ },+}));diff --git a/apps/mirai-gui/client/src/stores/use-cleanup-store.ts b/apps/mirai-gui/client/src/stores/use-cleanup-store.tsnew file mode 100644index 000000000..6500f908a--- /dev/null+++ b/apps/mirai-gui/client/src/stores/use-cleanup-store.ts@@ -0,0 +1,55 @@+import { create } from "zustand";+import { getPlatform } from "@/platform/platform-singleton";+import type { StorageCleanupPreview } from "@/platform/services/storage";++type CleanupCategory = "dialogs" | "models" | "logs";++type CleanupResult = {+ executed: string[];+ modelsSkipped: string[];+};++type CleanupStoreState = {+ preview: StorageCleanupPreview | null;+ previewLoading: boolean;+ result: CleanupResult | null;+ executing: boolean;+ fetchPreview: (skipModelIdentifiers?: string[]) => Promise<void>;+ execute: (categories: CleanupCategory[], skipModelIdentifiers?: string[]) => Promise<void>;+ reset: () => void;+};++export const useCleanupStore = create<CleanupStoreState>()((set) => ({+ preview: null,+ previewLoading: false,+ result: null,+ executing: false,++ fetchPreview: async (skipModelIdentifiers) => {+ set({ previewLoading: true });+ const { storage } = getPlatform();+ try {+ const preview = await storage.previewCleanup(skipModelIdentifiers);+ set({ preview });+ } catch {+ set({ preview: null });+ } finally {+ set({ previewLoading: false });+ }+ },++ execute: async (categories, skipModelIdentifiers) => {+ set({ executing: true });+ const { storage } = getPlatform();+ try {+ const result = await storage.executeCleanup(categories, skipModelIdentifiers);+ set({ result });+ } catch {+ set({ result: { executed: [], modelsSkipped: [] } });+ } finally {+ set({ executing: false });+ }+ },++ reset: () => set({ preview: null, previewLoading: false, result: null, executing: false }),+}));diff --git a/apps/mirai-gui/client/src/stores/use-global-instructions-store.ts b/apps/mirai-gui/client/src/stores/use-global-instructions-store.tsnew file mode 100644index 000000000..c6d7f9cad--- /dev/null+++ b/apps/mirai-gui/client/src/stores/use-global-instructions-store.ts@@ -0,0 +1,42 @@+import { create } from "zustand";+import { getPlatform } from "@/platform/platform-singleton";++type GlobalInstructionsState = {+ instructions: string;+ isLoading: boolean;+ loadInstructions: () => Promise<void>;+ saveInstructions: (instructions: string) => Promise<boolean>;+};++export const useGlobalInstructionsStore = create<GlobalInstructionsState>((set) => ({+ instructions: "",+ isLoading: false,++ loadInstructions: async () => {+ set({ isLoading: true });+ const { storage } = getPlatform();+ try {+ const instructions = await storage.loadGlobalInstructions();+ set({ instructions: instructions || "" });+ } catch (error) {+ console.error("Failed to load global instructions:", error);+ } finally {+ set({ isLoading: false });+ }+ },++ saveInstructions: async (instructions: string) => {+ set({ isLoading: true });+ const { storage } = getPlatform();+ try {+ await storage.saveGlobalInstructions(instructions);+ set({ instructions });+ return true;+ } catch (error) {+ console.error("Failed to save global instructions:", error);+ return false;+ } finally {+ set({ isLoading: false });+ }+ },+}));diff --git a/apps/mirai-gui/client/src/stores/use-model-params-store.ts b/apps/mirai-gui/client/src/stores/use-model-params-store.tsnew file mode 100644index 000000000..fc4c2fba6--- /dev/null+++ b/apps/mirai-gui/client/src/stores/use-model-params-store.ts@@ -0,0 +1,108 @@+import { create } from "zustand";+import { getPlatform } from "@/platform/platform-singleton";+import { isReasoningEffort, normalizeSampling, type ModelParams, type ReasoningEffort } from "@/types/sampling";++const DEFAULT_PARAMS: ModelParams = { sampling: { type: "Default" } };++export const STOCHASTIC_SEED = { temperature: 0.7, topK: 40, topP: 0.95, minP: 0.05 } as const;++export const defaultReasoningEffort = (globalReasoningEnabled: boolean): ReasoningEffort =>+ globalReasoningEnabled ? "default" : "disabled";++export const isCustomParams = (params: ModelParams | undefined, globalReasoningEnabled: boolean): boolean => {+ if (!params) return false;+ const samplingChanged = params.sampling.type !== "Default";+ const reasoningOverridden =+ params.reasoningEffort !== undefined && params.reasoningEffort !== defaultReasoningEffort(globalReasoningEnabled);+ return samplingChanged || reasoningOverridden;+};++// Settings written before reasoning levels stored a boolean.+const migrateParams = (raw: unknown): ModelParams | null => {+ if (!raw || typeof raw !== "object") return null;+ const { sampling, reasoningEffort, reasoningEnabled } = raw as {+ sampling?: ModelParams["sampling"];+ reasoningEffort?: unknown;+ reasoningEnabled?: unknown;+ };+ if (!sampling) return null;+ const effort: ReasoningEffort | undefined = isReasoningEffort(reasoningEffort)+ ? reasoningEffort+ : typeof reasoningEnabled === "boolean"+ ? defaultReasoningEffort(reasoningEnabled)+ : undefined;+ return { sampling: normalizeSampling(sampling), ...(effort !== undefined ? { reasoningEffort: effort } : {}) };+};++type ModelParamsState = {+ paramsByRepoId: Record<string, ModelParams>;+ globalReasoningEnabled: boolean;+ loaded: boolean;+ load: () => Promise<void>;+ getParams: (repoId: string) => ModelParams;+ setParams: (repoId: string, params: ModelParams) => void;+ resetParams: (repoId: string) => void;+ setGlobalReasoningEnabled: (enabled: boolean) => void;+};++const persistTimers = new Map<string, ReturnType<typeof setTimeout>>();++const persist = (repoId: string, params: ModelParams | null): void => {+ const existing = persistTimers.get(repoId);+ if (existing) clearTimeout(existing);+ persistTimers.set(+ repoId,+ setTimeout(() => {+ persistTimers.delete(repoId);+ void getPlatform()+ .settings.setModelParams(repoId, params)+ .catch((e) => console.warn("setModelParams failed", e));+ }, 250),+ );+};++export const useModelParamsStore = create<ModelParamsState>((set, get) => ({+ paramsByRepoId: {},+ globalReasoningEnabled: true,+ loaded: false,++ load: async () => {+ try {+ const [stored, globalReasoningEnabled] = await Promise.all([+ getPlatform().settings.getModelParams(),+ getPlatform().settings.getEnableThinking(),+ ]);+ const paramsByRepoId: Record<string, ModelParams> = {};+ for (const [repoId, raw] of Object.entries(stored ?? {})) {+ const migrated = migrateParams(raw);+ if (migrated) paramsByRepoId[repoId] = migrated;+ }+ set({+ paramsByRepoId,+ globalReasoningEnabled: typeof globalReasoningEnabled === "boolean" ? globalReasoningEnabled : true,+ loaded: true,+ });+ } catch (e) {+ console.warn("useModelParamsStore.load failed", e);+ set({ loaded: true });+ }+ },++ getParams: (repoId) => get().paramsByRepoId[repoId] ?? DEFAULT_PARAMS,++ setParams: (repoId, params) => {+ set((state) => ({ paramsByRepoId: { ...state.paramsByRepoId, [repoId]: params } }));+ persist(repoId, params);+ },++ resetParams: (repoId) => {+ set((state) => {+ const next = { ...state.paramsByRepoId };+ delete next[repoId];+ return { paramsByRepoId: next };+ });+ persist(repoId, null);+ },++ setGlobalReasoningEnabled: (enabled) => set({ globalReasoningEnabled: enabled }),+}));diff --git a/apps/mirai-gui/client/src/stores/use-models-store.test.ts b/apps/mirai-gui/client/src/stores/use-models-store.test.tsnew file mode 100644index 000000000..4401b24f9--- /dev/null+++ b/apps/mirai-gui/client/src/stores/use-models-store.test.ts@@ -0,0 +1,57 @@+import { beforeEach, expect, it, vi } from "vitest";+import type { EngineModel } from "@/types/model-manager";+import { modelDownloadPhases } from "@/types/model-manager";+import { useModelsStore } from "./use-models-store";++const mocks = vi.hoisted(() => ({ getModels: vi.fn() }));+vi.mock("@/platform/platform-singleton", () => ({ getPlatform: () => ({ models: { getModels: mocks.getModels } }) }));++const REPO_ID = "vendor/model";+const defaults = useModelsStore.getState();++const snapshot = (phase: EngineModel["state"]["phase"], seq: number): EngineModel => ({+ identifier: REPO_ID,+ repoId: REPO_ID,+ vendor: "Vendor",+ name: "Model",+ reasoning: { kind: "unsupported" },+ state: { phase, totalKbytes: 100, downloadedKbytes: 50, seq },+});++beforeEach(() => {+ vi.clearAllMocks();+ useModelsStore.setState(defaults, true);+});++it("keeps a download event that arrived while the catalog request was in flight", async () => {+ let resolveModels!: (value: EngineModel[]) => void;+ mocks.getModels.mockImplementation(+ () =>+ new Promise((resolve) => {+ resolveModels = resolve;+ }),+ );+ const fetching = useModelsStore.getState().fetchModels();++ useModelsStore.getState().applyDownloadEvent({ kind: "done", identifier: REPO_ID, seq: 7 });+ resolveModels([snapshot(modelDownloadPhases.downloading, 3)]);+ await fetching;++ expect(useModelsStore.getState().modelStatesById[REPO_ID]?.phase).toBe(modelDownloadPhases.downloaded);+});++it("applies a snapshot that is newer than the last event", async () => {+ useModelsStore.getState().applyDownloadEvent({ kind: "paused", identifier: REPO_ID, seq: 2 });+ mocks.getModels.mockResolvedValue([snapshot(modelDownloadPhases.downloaded, 5)]);++ await useModelsStore.getState().fetchModels();++ expect(useModelsStore.getState().modelStatesById[REPO_ID]?.phase).toBe(modelDownloadPhases.downloaded);+});++it("ignores an event older than the state it already holds", () => {+ useModelsStore.getState().applyDownloadEvent({ kind: "done", identifier: REPO_ID, seq: 9 });+ useModelsStore.getState().applyDownloadEvent({ kind: "paused", identifier: REPO_ID, seq: 4 });++ expect(useModelsStore.getState().modelStatesById[REPO_ID]?.phase).toBe(modelDownloadPhases.downloaded);+});diff --git a/apps/mirai-gui/client/src/stores/use-models-store.ts b/apps/mirai-gui/client/src/stores/use-models-store.tsnew file mode 100644index 000000000..17cf70f68--- /dev/null+++ b/apps/mirai-gui/client/src/stores/use-models-store.ts@@ -0,0 +1,194 @@+import type { DownloadEvent } from "@/platform/services/models";+import { ModelKind } from "@/types/models";+import { downloadStatePatch, preserveTotalKbytes } from "./model-download-state";+import {+ modelDownloadPhases,+ type ModelDownloadPhase,+ type ModelDownloadState,+ type VendorIcons,+} from "@/types/model-manager";+import { extractFamily } from "@/utils/extract-family";+import { create } from "zustand";+import { persist } from "zustand/middleware";+import type { PlatformModel } from "@/types/models";+import { useModelParamsStore } from "./use-model-params-store";+import { getPlatform } from "@/platform/platform-singleton";++type ModelsState = {+ models: PlatformModel[];+ loading: boolean;+ /** First fetch settled, success or failure; gates initial spinners. */+ initialized: boolean;+ /** At least one fetch succeeded; gates logic that must trust `models`. */+ hasLoadedModels: boolean;+ error: string | null;+ modelStatesById: Record<string, ModelDownloadState>;+ modelPhasesById: Record<string, ModelDownloadPhase>;+ installedAtById: Record<string, number>;+ vendorIconsByName: Record<string, VendorIcons>;+ fetchModels: () => Promise<void>;+ deleteLocalModel: (repoId: string) => Promise<void>;+ getModelState: (repoId: string) => ModelDownloadState | undefined;+ updateModelState: (repoId: string, patch: Partial<ModelDownloadState>) => void;+ applyDownloadEvent: (event: DownloadEvent) => void;+};++let fetchInFlight: Promise<void> | null = null;++export const useModelsStore = create<ModelsState>()(+ persist(+ (set, get) => ({+ models: [],+ loading: false,+ initialized: false,+ hasLoadedModels: false,+ error: null,+ modelStatesById: {},+ modelPhasesById: {},+ installedAtById: {},+ vendorIconsByName: {},++ fetchModels: async () => {+ if (fetchInFlight) return fetchInFlight;+ fetchInFlight = (async () => {+ const firstLoad = get().initialized === false;+ set(firstLoad ? { loading: true, error: null } : { error: null });+ try {+ const rawModels = await getPlatform().models.getModels();++ const prevById = get().modelStatesById;+ const prevInstalledAt = get().installedAtById;++ const entries = rawModels.map((m) => {+ const repoId = m.repoId ?? m.identifier;+ const prev = prevById[repoId];+ const mergedState = prev && prev.seq > m.state.seq ? prev : preserveTotalKbytes(m.state, prev);+ return { repoId, mergedState };+ });++ const byId: Record<string, ModelDownloadState> = Object.fromEntries(+ entries.map(({ repoId, mergedState }) => [repoId, mergedState]),+ );+ const phaseById: Record<string, ModelDownloadPhase> = Object.fromEntries(+ entries.map(({ repoId, mergedState }) => [repoId, mergedState.phase]),+ );++ const now = Date.now();+ const newlyInstalledEntries = entries.flatMap(({ repoId, mergedState }) =>+ mergedState.phase === modelDownloadPhases.downloaded && prevInstalledAt[repoId] === undefined+ ? [[repoId, now] as const]+ : [],+ );+ const installedAt: Record<string, number> =+ newlyInstalledEntries.length > 0+ ? { ...prevInstalledAt, ...Object.fromEntries(newlyInstalledEntries) }+ : prevInstalledAt;++ const mapped: PlatformModel[] = rawModels.map((m, sourceIndex) => {+ const repoId = m.repoId ?? m.identifier;+ const mergedState = byId[repoId];+ const totalBytes = (mergedState?.totalKbytes ?? 0) * 1024;+ const familyName = m.familyName ?? extractFamily(m.name);+ return {+ vendor: m.vendor,+ name: m.name,+ quantization: m.quantization ?? null,+ ...(typeof m.quantizationBits === "number" ? { quantizationBits: m.quantizationBits } : {}),+ repoId,+ kind: ModelKind.Text,+ reasoning: m.reasoning,+ size: totalBytes,+ ...(typeof m.paramSize === "number" ? { paramSize: m.paramSize } : {}),+ family: familyName,+ ...(m.familyIdentifier ? { familyIdentifier: m.familyIdentifier } : {}),+ sourceIndex,+ };+ });++ const vendorIconsByName: Record<string, VendorIcons> = Object.fromEntries(+ rawModels.flatMap((m) => (m.vendorIcons ? [[m.vendor, m.vendorIcons] as const] : [])),+ );++ set({+ models: mapped,+ modelStatesById: byId,+ modelPhasesById: phaseById,+ installedAtById: installedAt,+ vendorIconsByName,+ loading: false,+ initialized: true,+ hasLoadedModels: true,+ error: null,+ });+ } catch (error) {+ set({+ loading: false,+ initialized: true,+ error: error instanceof Error ? error.message : "Failed to fetch models",+ });+ }+ })().finally(() => {+ fetchInFlight = null;+ });+ return fetchInFlight;+ },++ deleteLocalModel: async (repoId: string) => {+ await getPlatform().models.deleteModel(repoId);+ useModelParamsStore.getState().resetParams(repoId);+ },++ getModelState: (repoId: string) => get().modelStatesById[repoId],++ applyDownloadEvent: (event) => {+ const current = get().modelStatesById[event.identifier];+ if (current && event.seq <= current.seq) return;+ // seq advances even for an event without a state change, so a snapshot+ // taken before it cannot come back on top later.+ const patch = downloadStatePatch(current, event) ?? {};+ get().updateModelState(event.identifier, { ...patch, seq: event.seq });+ },++ updateModelState: (repoId: string, patch: Partial<ModelDownloadState>) => {+ const prev = get().modelStatesById;+ const next: ModelDownloadState = {+ totalKbytes: 0,+ downloadedKbytes: 0,+ phase: modelDownloadPhases.notDownloaded,+ seq: 0,+ ...prev[repoId],+ ...patch,+ };+ const prevPhase = prev[repoId]?.phase;+ const nextPhase = next.phase;+ const prevInstalledAt = get().installedAtById;+ const isFreshInstall =+ prevPhase !== modelDownloadPhases.downloaded &&+ nextPhase === modelDownloadPhases.downloaded &&+ prevInstalledAt[repoId] === undefined;+ const justRemoved = nextPhase === modelDownloadPhases.notDownloaded && repoId in prevInstalledAt;+ const installedAtPatch = isFreshInstall+ ? { ...prevInstalledAt, [repoId]: Date.now() }+ : justRemoved+ ? Object.fromEntries(Object.entries(prevInstalledAt).filter(([id]) => id !== repoId))+ : undefined;+ set({+ modelStatesById: { ...prev, [repoId]: next },+ ...(prevPhase !== nextPhase+ ? {+ modelPhasesById: {+ ...get().modelPhasesById,+ [repoId]: nextPhase,+ },+ }+ : {}),+ ...(installedAtPatch ? { installedAtById: installedAtPatch } : {}),+ });+ },+ }),+ {+ name: "mirai-models-store",+ partialize: (state) => ({ installedAtById: state.installedAtById }),+ },+ ),+);diff --git a/apps/mirai-gui/client/src/stores/use-runtime-session-store.ts b/apps/mirai-gui/client/src/stores/use-runtime-session-store.tsnew file mode 100644index 000000000..2b307ef92--- /dev/null+++ b/apps/mirai-gui/client/src/stores/use-runtime-session-store.ts@@ -0,0 +1,31 @@+import type { RuntimeSessionRef } from "@/types/session";+import { create } from "zustand";++export type RuntimeSessionState = {+ residentSession: RuntimeSessionRef | null;+ loadingSession: RuntimeSessionRef | null;+ ejectingSession: RuntimeSessionRef | null;+ setResidentSession: (session: RuntimeSessionRef | null) => void;+ startLoadingSession: (session: RuntimeSessionRef) => void;+ endLoadingSession: () => void;+ setEjectingSession: (session: RuntimeSessionRef | null) => void;+};++export const useRuntimeSessionStore = create<RuntimeSessionState>((set) => ({+ residentSession: null,+ loadingSession: null,+ ejectingSession: null,++ setResidentSession: (session) =>+ set((state) => ({+ residentSession: session,+ loadingSession: state.loadingSession?.repoId === session?.repoId ? null : state.loadingSession,+ ejectingSession: state.ejectingSession?.repoId === session?.repoId ? null : state.ejectingSession,+ })),++ startLoadingSession: (session) => set({ loadingSession: session }),++ endLoadingSession: () => set({ loadingSession: null }),++ setEjectingSession: (session) => set({ ejectingSession: session }),+}));diff --git a/apps/mirai-gui/client/src/stores/use-settings-store.ts b/apps/mirai-gui/client/src/stores/use-settings-store.tsnew file mode 100644index 000000000..17de96199--- /dev/null+++ b/apps/mirai-gui/client/src/stores/use-settings-store.ts@@ -0,0 +1,121 @@+import { create } from "zustand";+import { getPlatform } from "@/platform/platform-singleton";+import { useModelParamsStore } from "./use-model-params-store";++type SettingsState = {+ enableThinking: boolean;+ runOnStartup: boolean;+ quickEntryShortcut: string | null;+ autoEjectEnabled: boolean;+ autoEjectMinutes: number;++ fetch: () => Promise<void>;+ fetchDesktopSettings: () => Promise<void>;+ setEnableThinking: (enabled: boolean) => Promise<void>;+ setRunOnStartup: (value: boolean) => Promise<void>;+ registerQuickEntryShortcut: (accelerator: string) => Promise<boolean>;+ unregisterQuickEntryShortcut: () => Promise<void>;+ setAutoEjectEnabled: (value: boolean) => Promise<void>;+ setAutoEjectMinutes: (minutes: number) => Promise<void>;+ exportLogs: () => Promise<"ok" | "cancelled" | "error">;+};++export const useSettingsStore = create<SettingsState>((set, get) => ({+ enableThinking: true,+ runOnStartup: false,+ quickEntryShortcut: null,+ autoEjectEnabled: true,+ autoEjectMinutes: 2,++ fetch: async () => {+ const { settings } = getPlatform();+ const [thinking, aeEnabled, aeMinutes] = await Promise.all([+ settings.getEnableThinking().catch(() => true),+ settings.getAutoEjectEnabled().catch(() => true),+ settings.getAutoEjectMinutes().catch(() => 2),+ ]);+ set({+ enableThinking: thinking,+ autoEjectEnabled: aeEnabled,+ autoEjectMinutes: Number.isFinite(aeMinutes) ? aeMinutes : 2,+ });+ },++ fetchDesktopSettings: async () => {+ const { systemUi } = getPlatform();+ const [startup, shortcut] = await Promise.all([+ systemUi.getRunOnStartup().catch(() => false),+ systemUi.getQuickEntryShortcut().catch(() => null),+ ]);+ set({ runOnStartup: startup, quickEntryShortcut: shortcut });+ },++ setEnableThinking: async (enabled) => {+ const { settings } = getPlatform();+ set({ enableThinking: enabled });+ useModelParamsStore.getState().setGlobalReasoningEnabled(enabled);+ await settings.setEnableThinking(enabled).catch(() => {+ set({ enableThinking: !enabled });+ useModelParamsStore.getState().setGlobalReasoningEnabled(!enabled);+ });+ },++ setRunOnStartup: async (value) => {+ set({ runOnStartup: value });+ await getPlatform()+ .systemUi.setRunOnStartup(value)+ .catch(() => set({ runOnStartup: !value }));+ },++ registerQuickEntryShortcut: async (accelerator) => {+ const ok = await getPlatform()+ .systemUi.registerQuickEntryShortcut(accelerator)+ .catch(() => false);+ if (ok) set({ quickEntryShortcut: accelerator });+ return ok;+ },++ unregisterQuickEntryShortcut: async () => {+ try {+ await getPlatform().systemUi.unregisterQuickEntryShortcut();+ set({ quickEntryShortcut: null });+ } catch (e) {+ console.error("[settings] unregisterQuickEntryShortcut failed", e);+ }+ },++ setAutoEjectEnabled: async (value) => {+ set({ autoEjectEnabled: value });+ await getPlatform()+ .settings.setAutoEjectEnabled(value)+ .catch(() => set({ autoEjectEnabled: !value }));+ },++ setAutoEjectMinutes: async (minutes) => {+ const prev = get().autoEjectMinutes;+ set({ autoEjectMinutes: minutes });+ await getPlatform()+ .settings.setAutoEjectMinutes(minutes)+ .catch(() => set({ autoEjectMinutes: prev }));+ },++ exportLogs: async () => {+ try {+ const { system, dialogs, storage } = getPlatform();+ const logFilePath = await system.getLogFilePath();+ if (!logFilePath) return "error";+ const content = await dialogs.readTextFile(logFilePath);+ if (content === null) return "error";+ const destination = await dialogs.showSaveDialog({+ title: "Export logs",+ defaultPath: "mirai.log",+ filters: [{ name: "Log files", extensions: ["log", "txt"] }],+ });+ if (!destination) return "cancelled";+ const saved = await storage.saveBinaryFile(destination, new TextEncoder().encode(content));+ return saved ? "ok" : "error";+ } catch {+ return "error";+ }+ },+}));diff --git a/apps/mirai-gui/client/src/stores/use-sidebar-store.ts b/apps/mirai-gui/client/src/stores/use-sidebar-store.tsnew file mode 100644index 000000000..fc6628b2f--- /dev/null+++ b/apps/mirai-gui/client/src/stores/use-sidebar-store.ts@@ -0,0 +1,45 @@+import { create } from "zustand";+import { persist } from "zustand/middleware";++type SidebarState = {+ isOpen: boolean;+ isMobile: boolean;+ toggle: () => void;+ setMobile: (isMobile: boolean) => void;+ closeOnMobile: () => void;+};++export const useSidebarStore = create<SidebarState>()(+ persist(+ (set, get) => ({+ isOpen: true,+ isMobile: false,+ toggle: () => set((state) => ({ isOpen: !state.isOpen })),+ setMobile: (isMobile: boolean) => {+ const currentState = get();+ const wasMobile = currentState.isMobile;++ set({ isMobile });++ if (isMobile && currentState.isOpen) {+ set({ isOpen: false });+ } else if (!isMobile && wasMobile && !currentState.isOpen) {+ set({ isOpen: true });+ }+ },+ closeOnMobile: () => {+ const state = get();+ if (state.isMobile) {+ set({ isOpen: false });+ }+ },+ }),+ {+ name: "mirai-sidebar-store",+ partialize: (state: SidebarState) => ({+ isOpen: state.isOpen,+ isMobile: state.isMobile,+ }),+ },+ ),+);diff --git a/apps/mirai-gui/client/src/stores/use-update-store.ts b/apps/mirai-gui/client/src/stores/use-update-store.tsnew file mode 100644index 000000000..9e1ca82ee--- /dev/null+++ b/apps/mirai-gui/client/src/stores/use-update-store.ts@@ -0,0 +1,156 @@+import { getPlatform } from "@/platform/platform-singleton";+import { UpdateStatusPhase } from "@/types/update";+import { create } from "zustand";++export const UpdatePhase = {+ ...UpdateStatusPhase,+ Available: "available",+} as const;+export type UpdatePhase = (typeof UpdatePhase)[keyof typeof UpdatePhase];++export const UpdateCheckOutcome = {+ Checked: "checked",+ Failed: "failed",+} as const;+export type UpdateCheckOutcome = (typeof UpdateCheckOutcome)[keyof typeof UpdateCheckOutcome];++export type UpdateDownloadStatus =+ | { phase: typeof UpdatePhase.Idle; downloadError?: string }+ | { phase: typeof UpdatePhase.Available; version: string }+ | { phase: typeof UpdatePhase.Downloading; version: string }+ | { phase: typeof UpdatePhase.Downloaded; version: string; applyError?: string };++type UpdateState = {+ status: UpdateDownloadStatus;+ _downloadListenersCleanup: (() => void) | null;++ initUpdateCheck(): Promise<UpdateCheckOutcome>;+ checkForUpdate(): Promise<UpdateCheckOutcome>;+ startDownload(version: string): Promise<void>;+ watchDownload(version: string): void;+ _reconcileDownload(version: string): Promise<void>;+ applyUpdate(): Promise<void>;+ dismiss(): void;+};++export const useUpdateStore = create<UpdateState>()((set, get) => ({+ status: { phase: UpdatePhase.Idle },+ _downloadListenersCleanup: null,++ async initUpdateCheck() {+ const outcome = await get().checkForUpdate();+ try {+ const status = await getPlatform().updater.getUpdateStatus();+ // Hydrate every backend phase, not only Downloaded: a webview reload while+ // a download is in flight must resume watching, or the store stays stuck+ // showing "downloading" forever with no listeners.+ if (status.phase === UpdateStatusPhase.Downloaded) {+ set({ status: { phase: UpdatePhase.Downloaded, version: status.version } });+ } else if (status.phase === UpdateStatusPhase.Downloading) {+ get().watchDownload(status.version);+ await get()._reconcileDownload(status.version);+ }+ } catch (e) {+ console.warn("[update] status hydration failed", e);+ }+ return outcome;+ },++ async checkForUpdate() {+ try {+ const updater = getPlatform().updater;+ const res = await updater.checkForUpdate();+ if (res.reason) return UpdateCheckOutcome.Failed;+ if (!res.hasUpdate || !res.latestVersion || !res.hasDownloadable) return UpdateCheckOutcome.Checked;++ const controllerStatus = await updater.getUpdateStatus();+ const updateAlreadyInFlight = controllerStatus.phase !== UpdateStatusPhase.Idle;+ if (updateAlreadyInFlight) return UpdateCheckOutcome.Checked;++ set({ status: { phase: UpdatePhase.Available, version: res.latestVersion } });+ return UpdateCheckOutcome.Checked;+ } catch {+ return UpdateCheckOutcome.Failed;+ }+ },++ watchDownload(version) {+ const updater = getPlatform().updater;++ const prevCleanup = get()._downloadListenersCleanup;+ if (prevCleanup) prevCleanup();++ set({ status: { phase: UpdatePhase.Downloading, version } });++ const cleanup = () => {+ offDone();+ offError();+ set({ _downloadListenersCleanup: null });+ };++ const offDone = updater.onUpdateDownloadDone(({ version: v }) => {+ if (v !== version) return;+ cleanup();+ set({ status: { phase: UpdatePhase.Downloaded, version } });+ });++ const offError = updater.onUpdateDownloadError(({ version: v, error }) => {+ if (v !== version) return;+ cleanup();+ set({ status: { phase: UpdatePhase.Idle, downloadError: error } });+ });++ set({ _downloadListenersCleanup: cleanup });+ },++ // listen() is async, so an event can fire before the handler is live and be+ // lost; every watcher rechecks the backend snapshot to catch that.+ async _reconcileDownload(version) {+ if (get().status.phase !== UpdatePhase.Downloading) return;+ try {+ const status = await getPlatform().updater.getUpdateStatus();+ if (status.phase === UpdateStatusPhase.Downloaded && get().status.phase === UpdatePhase.Downloading) {+ get()._downloadListenersCleanup?.();+ set({ status: { phase: UpdatePhase.Downloaded, version } });+ }+ } catch {+ // Reconciliation is a safety net for a missed event; the listeners still stand.+ }+ },++ async startDownload(version) {+ const updater = getPlatform().updater;++ get().watchDownload(version);++ const result = await updater.startUpdateDownload(version);+ if (!result.ok) {+ get()._downloadListenersCleanup?.();+ set({ status: { phase: UpdatePhase.Idle, downloadError: result.error } });+ return;+ }++ await get()._reconcileDownload(version);+ },++ async applyUpdate() {+ const current = get().status;+ if (current.phase !== UpdatePhase.Downloaded) return;+ const version = current.version;+ try {+ const result = await getPlatform().updater.applyUpdate();+ if (!result.ok) {+ set({+ status: { phase: UpdatePhase.Downloaded, version, applyError: result.error || "Failed to apply update" },+ });+ }+ } catch (e: unknown) {+ const msg = e instanceof Error ? e.message : "Failed to apply update";+ set({ status: { phase: UpdatePhase.Downloaded, version, applyError: msg } });+ }+ },++ dismiss() {+ set({ status: { phase: UpdatePhase.Idle } });+ },+}));diff --git a/apps/mirai-gui/client/src/styles/theme.css b/apps/mirai-gui/client/src/styles/theme.cssnew file mode 100644index 000000000..d0017b5f2--- /dev/null+++ b/apps/mirai-gui/client/src/styles/theme.css@@ -0,0 +1,136 @@+/* Light values live in @theme so Tailwind generates the utilities; the .dark+ block below overrides the same variables, so every color utility follows+ the theme without a dark: twin. */+@theme {+ --font-sans:+ InterVariable, Inter, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",+ "Segoe UI Symbol", "Noto Color Emoji";+ --font-mono:+ "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;+ --breakpoint-lg: 1050px;+ --ease-spring: cubic-bezier(0.23, 1, 0.32, 1);++ /* Gray scale replaces Tailwind's so only these steps exist. */+ --color-gray-*: initial;+ --color-gray-50: #fff;+ --color-gray-100: #fcfcfc;+ --color-gray-200: #f9f9f9;+ --color-gray-300: #f0f0f0;+ --color-gray-500: #e0e0e0;+ --color-gray-600: #d9d9d9;+ --color-gray-700: #cecece;+ --color-gray-1000: #838383;+ --color-gray-1100: #646464;+ --color-gray-1200: #202020;++ --color-red-500: #fb2c36;+ --color-red-600: #e40014;+ --color-green-500: #00c758;+ --color-blue-500: #3080ff;+ --color-amber-500: #f99c00;++ --color-background: #fcfcfc;+ --color-primary: var(--color-gray-1200);+ --color-primary-hover: var(--color-gray-1100);+ --color-primary-active: var(--color-gray-1000);+ --color-primary-contrast: var(--color-gray-50);+ --color-secondary: var(--color-gray-50);+ --color-secondary-hover: var(--color-gray-200);+ --color-secondary-active: var(--color-gray-300);+ --color-secondary-contrast: var(--color-gray-1200);+ --color-tertiary-hover: var(--color-gray-200);+ --color-control-surface-hover: var(--color-gray-500);+ --color-control-surface-active: var(--color-gray-500);+ --color-danger: var(--color-red-500);+ --color-danger-hover: var(--color-red-600);+ --color-danger-active: #c70010;+ --color-danger-contrast: #ffffff;+ --color-danger-bg: rgb(from var(--color-red-500) r g b / 0.08);+ --color-success: var(--color-green-500);+ --color-success-bg: rgb(from var(--color-green-500) r g b / 0.08);+ --color-success-border: rgb(from var(--color-green-500) r g b / 0.4);+ --color-text-primary: var(--color-gray-1200);+ --color-text-secondary: var(--color-gray-1100);+ --color-text-muted: var(--color-gray-1000);+ --color-text-disabled: var(--color-gray-700);+ --color-border-default: rgb(from var(--color-black) r g b / 0.1);+ --color-border-strong: rgb(from var(--color-black) r g b / 0.2);+ --color-border-outlined: rgb(from var(--color-black) r g b / 0.15);+ --color-border-outlined-hover: rgb(from var(--color-black) r g b / 0.22);+ --color-slider-track: var(--color-gray-500);+ --color-surface-secondary: var(--color-gray-100);+ --color-surface-tertiary: var(--color-gray-300);+ --color-surface-elevated: var(--color-gray-50);+ --color-overlay: rgba(0, 0, 0, 0.4);++ --color-bg-sidebar: #f5f5f5;+ --color-bg-hover: #e5e5e5;+ --color-bg-sub: #f4f5f5;+ --color-bg-modal: #ffffff;+ --color-card-hover: #f6f8f8;+ --color-button-border: #dfe1e2;+ --color-cell-border: #e5e5e5;+ --color-label-title: #000000;+ --color-label-muted: #526168;+ --color-blue: #33bbff;+ --color-error: #ff2020;+ --color-progress: #ff6a20;++ --shadow-sm:+ 0px 0px 0px 1px rgb(from var(--color-black) r g b / 0.06),+ 0px 1px 2px -1px rgb(from var(--color-black) r g b / 0.06),+ 0px 2px 4px 0px rgb(from var(--color-black) r g b / 0.04);+ --shadow-md:+ 0px 0px 0px 1px rgb(from var(--color-black) r g b / 0.06),+ 0px 2px 4px -1px rgb(from var(--color-black) r g b / 0.06),+ 0px 4px 8px -1px rgb(from var(--color-black) r g b / 0.06);+ --shadow-lg:+ 0px 0px 0px 1px rgb(from var(--color-black) r g b / 0.04),+ 0px 4px 8px -2px rgb(from var(--color-black) r g b / 0.06),+ 0px 8px 16px -4px rgb(from var(--color-black) r g b / 0.08);+ --shadow-xl:+ 0px 0px 0px 1px rgb(from var(--color-black) r g b / 0.04),+ 0px 8px 16px -4px rgb(from var(--color-black) r g b / 0.08),+ 0px 16px 32px -8px rgb(from var(--color-black) r g b / 0.1);+ --shadow-custom: var(--shadow-sm);+ --shadow-custom-hover: var(--shadow-md);+ --shadow-focus: 0 0 0 2px #fff, 0 0 0 4px #0969da;+}++.dark {+ --color-gray-50: #0f0f0f;+ --color-gray-100: #111;+ --color-gray-200: #191919;+ --color-gray-300: #222;+ --color-gray-500: #313131;+ --color-gray-600: #3a3a3a;+ --color-gray-700: #484848;+ --color-gray-1000: #7b7b7b;+ --color-gray-1100: #b5b5b5;+ --color-gray-1200: #eee;++ --color-background: #0a0a0a;+ --color-border-default: rgb(from var(--color-white) r g b / 0.07);+ --color-border-strong: rgb(from var(--color-white) r g b / 0.2);+ --color-border-outlined: rgb(from var(--color-white) r g b / 0.12);+ --color-border-outlined-hover: rgb(from var(--color-white) r g b / 0.2);+ --color-surface-tertiary: var(--color-gray-200);+ --color-surface-elevated: var(--color-gray-100);+ --color-overlay: rgba(0, 0, 0, 0.7);++ --color-bg-sidebar: #050506;+ --color-bg-hover: #181a1b;+ --color-bg-sub: #1f1f1f;+ --color-bg-modal: #141414;+ --color-card-hover: #1f1f1f;+ --color-button-border: #343434;+ --color-cell-border: #212227;+ --color-label-title: #ffffff;+ --color-label-muted: #9198a1;++ --shadow-sm: 0 0 0 1px rgb(from var(--color-white) r g b / 0.1);+ --shadow-md: 0 0 0 1px rgb(from var(--color-white) r g b / 0.15);+ --shadow-lg: 0 0 0 1px rgb(from var(--color-white) r g b / 0.1);+ --shadow-xl: 0 0 0 1px rgb(from var(--color-white) r g b / 0.1);+ --shadow-focus: 0 0 0 2px #0b0b0b, 0 0 0 4px #58a6ff;+}diff --git a/apps/mirai-gui/client/src/types/chat.ts b/apps/mirai-gui/client/src/types/chat.tsnew file mode 100644index 000000000..671fb414c--- /dev/null+++ b/apps/mirai-gui/client/src/types/chat.ts@@ -0,0 +1,9 @@+export type ChatRole = "system" | "user" | "assistant";++export const Roles = {+ System: "system",+ User: "user",+ Assistant: "assistant",+} as const;++export type NonSystemRole = Exclude<ChatRole, "system">;diff --git a/apps/mirai-gui/client/src/types/files.ts b/apps/mirai-gui/client/src/types/files.tsnew file mode 100644index 000000000..04f03bb95--- /dev/null+++ b/apps/mirai-gui/client/src/types/files.ts@@ -0,0 +1,8 @@+export type AttachedFile = {+ id: string;+ name: string;+ mimeType: string;+ size: number;+ content: string;+ extension: string;+};diff --git a/apps/mirai-gui/client/src/types/llm-stream.ts b/apps/mirai-gui/client/src/types/llm-stream.tsnew file mode 100644index 000000000..1ca8cc7db--- /dev/null+++ b/apps/mirai-gui/client/src/types/llm-stream.ts@@ -0,0 +1,49 @@+import type { ChatRole } from "@/types/chat";+import type { ReasoningEffort, SamplingPolicyPayload } from "@/types/sampling";++export type LlmRunParams = {+ repoId: string;+ messages: Array<{ role: ChatRole; content: string; reasoningContent?: string }>;+ samplingPolicy?: SamplingPolicyPayload;+ reasoningEffort?: ReasoningEffort;+};++export type SessionOutputStats = {+ prefillStats: {+ duration: number;+ tokensCount: number;+ tokensPerSecond: number;+ };+ generateStats?: {+ duration: number;+ tokensCount: number;+ tokensPerSecond: number;+ };+ totalStats: {+ duration: number;+ tokensCountInput: number;+ tokensCountOutput: number;+ };+};++export type ParsedPatch = { response?: string; chainOfThought?: string };+export type OutputShape = { text?: { parsed?: ParsedPatch; raw?: string } };++export type SessionOutputFinishReason =+ "Stop" | "Length" | "Cancelled" | "ContextLimitReached" | "ToolCalls" | "Rejected";++export type LlmRunResult = {+ text: string;+ stats: SessionOutputStats;+ finishReason?: SessionOutputFinishReason;+ parsed?: { chainOfThought?: string; response?: string };+ error?: string;+};++export type LlmAsyncStream = {+ runId: string;+ stream: ReadableStream<string>;+ result: Promise<LlmRunResult>;+ cancel: () => Promise<void>;+ onParsed: (cb: (p: { chainOfThought?: string; response?: string }) => void) => () => void;+};diff --git a/apps/mirai-gui/client/src/types/message.ts b/apps/mirai-gui/client/src/types/message.tsnew file mode 100644index 000000000..a4577978d--- /dev/null+++ b/apps/mirai-gui/client/src/types/message.ts@@ -0,0 +1,43 @@+import type { SessionOutputStats } from "./llm-stream";+import type { NonSystemRole } from "./chat";++export type ParsedOutput = {+ response?: string;+ chainOfThought?: string;+};++export type PerfStats = {+ ttftSec?: number;+ totalSec?: number;+ tps?: number;+ tokensOut?: number;+};++export type MessageVersion = {+ id: string;+ text: string;+ modelId: string;+ modelName: string;+ timestamp: number;+ perf?: PerfStats;+ stats?: SessionOutputStats;+ attachmentIds?: string[];+ output?: { text?: { parsed?: ParsedOutput; raw?: string } };+ error?: string;+};++export type Message = {+ id: string;+ text: string;+ sender: NonSystemRole;+ modelId?: string;+ modelName?: string;+ timestamp: number;+ versions?: MessageVersion[];+ currentVersionIndex?: number;+ perf?: PerfStats;+ stats?: SessionOutputStats;+ attachmentIds?: string[];+ output?: { text?: { parsed?: ParsedOutput; raw?: string } };+ error?: string;+};diff --git a/apps/mirai-gui/client/src/types/model-manager.ts b/apps/mirai-gui/client/src/types/model-manager.tsnew file mode 100644index 000000000..b52fabec7--- /dev/null+++ b/apps/mirai-gui/client/src/types/model-manager.ts@@ -0,0 +1,38 @@+import type { ReasoningSupport } from "./sampling";++export const modelDownloadPhases = {+ notDownloaded: "NotDownloaded",+ downloading: "Downloading",+ paused: "Paused",+ downloaded: "Downloaded",+ locked: "Locked",+ error: "Error",+} as const;++export type ModelDownloadPhase = (typeof modelDownloadPhases)[keyof typeof modelDownloadPhases];++export type ModelDownloadState = {+ totalKbytes: number;+ downloadedKbytes: number;+ phase: ModelDownloadPhase;+ error?: string;+ // Backend event sequence this state reflects; older events and snapshots are ignored.+ seq: number;+};++export type VendorIcons = { light: string; dark: string };++export type EngineModel = {+ identifier: string;+ repoId?: string;+ vendor: string;+ vendorIcons?: VendorIcons;+ name: string;+ familyIdentifier?: string;+ familyName?: string;+ paramSize?: number;+ reasoning: ReasoningSupport;+ quantization?: string | null;+ quantizationBits?: number;+ state: ModelDownloadState;+};diff --git a/apps/mirai-gui/client/src/types/models.ts b/apps/mirai-gui/client/src/types/models.tsnew file mode 100644index 000000000..a4722f2bd--- /dev/null+++ b/apps/mirai-gui/client/src/types/models.ts@@ -0,0 +1,23 @@+import type { ReasoningSupport } from "./sampling";++export enum ModelKind {+ Text = "text",+}++export type UzuModel = {+ repoId: string;+ kind: ModelKind;+ name: string;+ vendor: string;+ reasoning: ReasoningSupport;+ quantization?: string | null;+ quantizationBits?: number;+};++export type PlatformModel = UzuModel & {+ size?: number;+ family?: string;+ familyIdentifier?: string;+ paramSize?: number;+ sourceIndex?: number;+};diff --git a/apps/mirai-gui/client/src/types/sampling.test.ts b/apps/mirai-gui/client/src/types/sampling.test.tsnew file mode 100644index 000000000..cacdb4ccd--- /dev/null+++ b/apps/mirai-gui/client/src/types/sampling.test.ts@@ -0,0 +1,14 @@+import { describe, expect, it } from "vitest";+import { normalizeSampling } from "./sampling";++describe("normalizeSampling", () => {+ it("turns a saved zero temperature into argmax", () => {+ expect(normalizeSampling({ type: "Stochastic", temperature: 0, topK: 40 })).toEqual({ type: "Argmax" });+ });++ it("keeps everything else as saved", () => {+ const stochastic = { type: "Stochastic", temperature: 0.7, topK: 40 } as const;+ expect(normalizeSampling(stochastic)).toBe(stochastic);+ expect(normalizeSampling({ type: "Default" })).toEqual({ type: "Default" });+ });+});diff --git a/apps/mirai-gui/client/src/types/sampling.ts b/apps/mirai-gui/client/src/types/sampling.tsnew file mode 100644index 000000000..00913e079--- /dev/null+++ b/apps/mirai-gui/client/src/types/sampling.ts@@ -0,0 +1,35 @@+export type SamplingPolicyPayload =+ | { type: "Default" }+ | { type: "Argmax" }+ | {+ type: "Stochastic";+ temperature?: number;+ topK?: number;+ topP?: number;+ minP?: number;+ repetitionPenalty?: number;+ suffixRepetitionLength?: number;+ };++// Same floor as the CLI.+export const TEMPERATURE_MIN = 0.05;++export const normalizeSampling = (sampling: SamplingPolicyPayload): SamplingPolicyPayload =>+ sampling.type === "Stochastic" && sampling.temperature !== undefined && sampling.temperature <= 0+ ? { type: "Argmax" }+ : sampling;++export type ReasoningEffort = "disabled" | "default" | "low" | "medium" | "high" | "xhigh";++export const REASONING_EFFORTS: readonly ReasoningEffort[] = ["disabled", "default", "low", "medium", "high", "xhigh"];++export const isReasoningEffort = (value: unknown): value is ReasoningEffort =>+ typeof value === "string" && (REASONING_EFFORTS as readonly string[]).includes(value);++export type ReasoningSupport =+ { kind: "unsupported" } | { kind: "alwaysOn" } | { kind: "toggle" } | { kind: "levels"; efforts: ReasoningEffort[] };++export type ModelParams = {+ sampling: SamplingPolicyPayload;+ reasoningEffort?: ReasoningEffort;+};diff --git a/apps/mirai-gui/client/src/types/session.ts b/apps/mirai-gui/client/src/types/session.tsnew file mode 100644index 000000000..ca6cce861--- /dev/null+++ b/apps/mirai-gui/client/src/types/session.ts@@ -0,0 +1,10 @@+export const runtimeSessionEjectReasons = {+ user: "user",+ auto: "auto",+} as const;++export type RuntimeSessionEjectReason = (typeof runtimeSessionEjectReasons)[keyof typeof runtimeSessionEjectReasons];++export type RuntimeSessionRef = {+ repoId: string;+};diff --git a/apps/mirai-gui/client/src/types/update.ts b/apps/mirai-gui/client/src/types/update.tsnew file mode 100644index 000000000..d6161097b--- /dev/null+++ b/apps/mirai-gui/client/src/types/update.ts@@ -0,0 +1,11 @@+export const UpdateStatusPhase = {+ Idle: "idle",+ Downloading: "downloading",+ Downloaded: "downloaded",+} as const;+export type UpdateStatusPhase = (typeof UpdateStatusPhase)[keyof typeof UpdateStatusPhase];++export type UpdateStatus =+ | { phase: typeof UpdateStatusPhase.Idle }+ | { phase: typeof UpdateStatusPhase.Downloading; version: string }+ | { phase: typeof UpdateStatusPhase.Downloaded; version: string };diff --git a/apps/mirai-gui/client/src/utils/clipboard.ts b/apps/mirai-gui/client/src/utils/clipboard.tsnew file mode 100644index 000000000..0c66784ed--- /dev/null+++ b/apps/mirai-gui/client/src/utils/clipboard.ts@@ -0,0 +1,6 @@+export async function writeItemsWithFocus(items: ClipboardItem[]): Promise<void> {+ if (!document.hasFocus()) {+ window.focus();+ }+ await navigator.clipboard.write(items);+}diff --git a/apps/mirai-gui/client/src/utils/download-progress.ts b/apps/mirai-gui/client/src/utils/download-progress.tsnew file mode 100644index 000000000..83b908c67--- /dev/null+++ b/apps/mirai-gui/client/src/utils/download-progress.ts@@ -0,0 +1,7 @@+export const toDownloadProgressKbytes = (+ completedBytes: number | null | undefined,+ totalBytes: number | null | undefined,+): { downloadedKbytes: number; totalKbytes: number } => ({+ downloadedKbytes: Math.floor((completedBytes ?? 0) / 1024),+ totalKbytes: typeof totalBytes === "number" && totalBytes > 0 ? Math.floor(totalBytes / 1024) : 0,+});diff --git a/apps/mirai-gui/client/src/utils/extract-family.ts b/apps/mirai-gui/client/src/utils/extract-family.tsnew file mode 100644index 000000000..6fbd6367d--- /dev/null+++ b/apps/mirai-gui/client/src/utils/extract-family.ts@@ -0,0 +1,10 @@+const stripSize = (s: string): string => s.replace(/-\d+(?:\.\d+)?B$/i, "");+const stripVariant = (s: string): string => s.replace(/-(?:Instruct|AWQ)$/i, "");++const applyRulesOnce = (s: string): string => [stripVariant, stripSize].reduce((acc, fn) => fn(acc), s);++export function extractFamily(name: string): string {+ const base = String(name || "").trim();+ const next = applyRulesOnce(base);+ return next === base ? base : extractFamily(next);+}diff --git a/apps/mirai-gui/client/src/utils/format.ts b/apps/mirai-gui/client/src/utils/format.tsnew file mode 100644index 000000000..82569c722--- /dev/null+++ b/apps/mirai-gui/client/src/utils/format.ts@@ -0,0 +1,19 @@+export const formatBytes = (bytes: number): string => {+ if (bytes === 0) return "0 B";+ if (bytes < 1_000) return `${bytes} B`;+ if (bytes < 1_000_000) return `${(bytes / 1_000).toFixed(1)} KB`;+ if (bytes < 1_000_000_000) return `${(bytes / 1_000_000).toFixed(1)} MB`;+ return `${(bytes / 1_000_000_000).toFixed(1)} GB`;+};++export const formatModelSize = (sizeBytes?: number | null): string | undefined => {+ if (!sizeBytes || sizeBytes <= 0) return undefined;+ const sizeGb = sizeBytes / 1e9;+ if (sizeGb >= 1) return `${sizeGb.toFixed(sizeGb >= 10 ? 0 : 1)} GB`;+ return `${Math.round(sizeBytes / 1e6)} MB`;+};++export const formatModelName = (repoId: string): string => {+ if (!repoId) return "";+ return repoId.split("/").at(-1) || repoId;+};diff --git a/apps/mirai-gui/client/src/utils/platform.ts b/apps/mirai-gui/client/src/utils/platform.tsnew file mode 100644index 000000000..9a081cbbd--- /dev/null+++ b/apps/mirai-gui/client/src/utils/platform.ts@@ -0,0 +1,6 @@+export function isMacPlatform(): boolean {+ if (typeof navigator === "undefined") return false;+ const platform = navigator.platform ?? "";+ if (platform) return platform.toLowerCase().includes("mac");+ return (navigator.userAgent ?? "").includes("Mac");+}diff --git a/apps/mirai-gui/client/src/vite-env.d.ts b/apps/mirai-gui/client/src/vite-env.d.tsnew file mode 100644index 000000000..f8745d3de--- /dev/null+++ b/apps/mirai-gui/client/src/vite-env.d.ts@@ -0,0 +1,3 @@+/// <reference types="vite/client" />++declare const __PLATFORM__: "web" | "tauri";diff --git a/apps/mirai-gui/client/tsconfig.json b/apps/mirai-gui/client/tsconfig.jsonnew file mode 100644index 000000000..49baa007d--- /dev/null+++ b/apps/mirai-gui/client/tsconfig.json@@ -0,0 +1,29 @@+{+ "compilerOptions": {+ "target": "ES2020",+ "module": "ESNext",+ "lib": ["ES2020", "DOM", "DOM.Iterable"],+ "strict": true,+ "esModuleInterop": true,+ "skipLibCheck": true,+ "forceConsistentCasingInFileNames": true,+ "resolveJsonModule": true,+ "noImplicitReturns": true,+ "noUnusedLocals": true,+ "noUnusedParameters": true,+ "noUncheckedIndexedAccess": true,+ "noFallthroughCasesInSwitch": true,+ "moduleResolution": "bundler",+ // Without this tsc also picks up node_modules/@types above the repo.+ "typeRoots": ["../node_modules/@types"],+ "allowSyntheticDefaultImports": true,+ "jsx": "react-jsx",+ "isolatedModules": true,+ "verbatimModuleSyntax": true,+ "paths": {+ "@/*": ["./src/*"]+ }+ },+ "include": ["src/**/*"],+ "exclude": ["node_modules"]+}diff --git a/apps/mirai-gui/desktop/Cargo.lock b/apps/mirai-gui/desktop/Cargo.locknew file mode 100644index 000000000..9babff416--- /dev/null+++ b/apps/mirai-gui/desktop/Cargo.lock@@ -0,0 +1,8313 @@+# This file is automatically @generated by Cargo.+# It is not intended for manual editing.+version = 4++[[package]]+name = "adler2"+version = "2.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"++[[package]]+name = "ahash"+version = "0.8.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75"+dependencies = [+ "cfg-if",+ "const-random",+ "getrandom 0.3.4",+ "once_cell",+ "serde",+ "version_check",+ "zerocopy",+]++[[package]]+name = "aho-corasick"+version = "1.1.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"+dependencies = [+ "memchr",+]++[[package]]+name = "aligned"+version = "0.4.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ee4508988c62edf04abd8d92897fca0c2995d907ce1dfeaf369dac3716a40685"+dependencies = [+ "as-slice",+]++[[package]]+name = "aligned-vec"+version = "0.6.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "dc890384c8602f339876ded803c97ad529f3842aba97f6392b3dba0dd171769b"+dependencies = [+ "equator",+]++[[package]]+name = "alloc-no-stdlib"+version = "3.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c2fb6cfd47bf496ff64095c20eaba0c201404ee38714d4142fcfa1dc334fcc7a"++[[package]]+name = "alloc-stdlib"+version = "0.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0b5c1865780388bfa186411ab5f247819487fc4864c6e9c3106611fa347586e1"+dependencies = [+ "alloc-no-stdlib",+]++[[package]]+name = "alsa"+version = "0.11.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "812947049edcd670a82cd5c73c3661d2e58468577ba8489de58e1a73c04cbd5d"+dependencies = [+ "alsa-sys",+ "bitflags 2.13.0",+ "cfg-if",+ "libc",+]++[[package]]+name = "alsa-sys"+version = "0.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ad7569085a265dd3f607ebecce7458eaab2132a84393534c95b18dcbc3f31e04"+dependencies = [+ "libc",+ "pkg-config",+]++[[package]]+name = "android_system_properties"+version = "0.1.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"+dependencies = [+ "libc",+]++[[package]]+name = "anstream"+version = "1.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d"+dependencies = [+ "anstyle",+ "anstyle-parse",+ "anstyle-query",+ "anstyle-wincon",+ "colorchoice",+ "is_terminal_polyfill",+ "utf8parse",+]++[[package]]+name = "anstyle"+version = "1.0.14"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000"++[[package]]+name = "anstyle-parse"+version = "1.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e"+dependencies = [+ "utf8parse",+]++[[package]]+name = "anstyle-query"+version = "1.1.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc"+dependencies = [+ "windows-sys 0.61.2",+]++[[package]]+name = "anstyle-wincon"+version = "3.0.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d"+dependencies = [+ "anstyle",+ "once_cell_polyfill",+ "windows-sys 0.61.2",+]++[[package]]+name = "anyhow"+version = "1.0.103"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2a4385e2e34eb35d6b3efe798b9eb88096925d87726c0798709bf56d9ed84af3"++[[package]]+name = "apple-native-keyring-store"+version = "1.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a7be2f067ccd8d4b4d4a66ddafe0f32a5dff31732f32dbff85fefc40929b1f72"+dependencies = [+ "keyring-core",+ "log",+ "security-framework",+]++[[package]]+name = "arbitrary"+version = "1.4.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1"+dependencies = [+ "derive_arbitrary",+]++[[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.118",+]++[[package]]+name = "arrayref"+version = "0.3.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb"++[[package]]+name = "arrayvec"+version = "0.7.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56"++[[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 = "async-broadcast"+version = "0.7.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532"+dependencies = [+ "event-listener",+ "event-listener-strategy",+ "futures-core",+ "pin-project-lite",+]++[[package]]+name = "async-channel"+version = "2.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2"+dependencies = [+ "concurrent-queue",+ "event-listener-strategy",+ "futures-core",+ "pin-project-lite",+]++[[package]]+name = "async-executor"+version = "1.14.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c96bf972d85afc50bf5ab8fe2d54d1586b4e0b46c97c50a0c9e71e2f7bcd812a"+dependencies = [+ "async-task",+ "concurrent-queue",+ "fastrand",+ "futures-lite",+ "pin-project-lite",+ "slab",+]++[[package]]+name = "async-io"+version = "2.6.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc"+dependencies = [+ "autocfg",+ "cfg-if",+ "concurrent-queue",+ "futures-io",+ "futures-lite",+ "parking",+ "polling",+ "rustix",+ "slab",+ "windows-sys 0.61.2",+]++[[package]]+name = "async-lock"+version = "3.4.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "290f7f2596bd5b78a9fec8088ccd89180d7f9f55b94b0576823bbbdc72ee8311"+dependencies = [+ "event-listener",+ "event-listener-strategy",+ "pin-project-lite",+]++[[package]]+name = "async-openai"+version = "0.35.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "583553a05a8cbf55bbd67d6a824a206c21030556fdc5f43de387959f888fb6be"+dependencies = [+ "async-openai-macros",+ "backoff",+ "base64 0.22.1",+ "bytes",+ "derive_builder",+ "eventsource-stream",+ "futures",+ "getrandom 0.3.4",+ "rand 0.9.4",+ "reqwest 0.12.28",+ "reqwest-eventsource",+ "secrecy",+ "serde",+ "serde_json",+ "serde_urlencoded",+ "thiserror 2.0.18",+ "tokio",+ "tokio-stream",+ "tokio-util",+ "tracing",+ "url",+]++[[package]]+name = "async-openai-macros"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "81872a8e595e8ceceab71c6ba1f9078e313b452a1e31934e6763ef5d308705e4"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.118",+]++[[package]]+name = "async-process"+version = "2.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fc50921ec0055cdd8a16de48773bfeec5c972598674347252c0399676be7da75"+dependencies = [+ "async-channel",+ "async-io",+ "async-lock",+ "async-signal",+ "async-task",+ "blocking",+ "cfg-if",+ "event-listener",+ "futures-lite",+ "rustix",+]++[[package]]+name = "async-recursion"+version = "1.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.118",+]++[[package]]+name = "async-signal"+version = "0.2.14"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "52b5aaafa020cf5053a01f2a60e8ff5dccf550f0f77ec54a4e47285ac2bab485"+dependencies = [+ "async-io",+ "async-lock",+ "atomic-waker",+ "cfg-if",+ "futures-core",+ "futures-io",+ "rustix",+ "signal-hook-registry",+ "slab",+ "windows-sys 0.61.2",+]++[[package]]+name = "async-task"+version = "4.7.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de"++[[package]]+name = "async-trait"+version = "0.1.92"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 3.0.3",+]++[[package]]+name = "atk"+version = "0.18.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "241b621213072e993be4f6f3a9e4b45f65b7e6faad43001be957184b7bb1824b"+dependencies = [+ "atk-sys",+ "glib",+ "libc",+]++[[package]]+name = "atk-sys"+version = "0.18.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c5e48b684b0ca77d2bbadeef17424c2ea3c897d44d566a1617e7e8f30614d086"+dependencies = [+ "glib-sys",+ "gobject-sys",+ "libc",+ "system-deps",+]++[[package]]+name = "atomic-waker"+version = "1.1.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"++[[package]]+name = "auto-launch"+version = "0.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1f012b8cc0c850f34117ec8252a44418f2e34a2cf501de89e29b241ae5f79471"+dependencies = [+ "dirs 4.0.0",+ "thiserror 1.0.69",+ "winreg 0.10.1",+]++[[package]]+name = "autocfg"+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.18",+ "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 = "aws-lc-rs"+version = "1.18.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b281d307588d634de920874890732659e2e7672f72b5e10e81badc1a8a83621e"+dependencies = [+ "aws-lc-sys",+ "zeroize",+]++[[package]]+name = "aws-lc-sys"+version = "0.45.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9bff6c3b54fad79a2e60b8102caf565819711497c1f5f092f49508e2f5c31b27"+dependencies = [+ "cc",+ "cmake",+ "dunce",+ "fs_extra",+ "pkg-config",+]++[[package]]+name = "backend-remote"+version = "0.6.1"+dependencies = [+ "async-openai",+ "futures",+ "indexmap 2.14.0",+ "reqwest 0.13.4",+ "serde",+ "serde_json",+ "shoji",+ "thiserror 2.0.18",+ "tokio-util",+]++[[package]]+name = "backoff"+version = "0.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b62ddb9cb1ec0a098ad4bbf9344d0713fa193ae1a80af55febcff2627b6a00c1"+dependencies = [+ "futures-core",+ "getrandom 0.2.17",+ "instant",+ "pin-project-lite",+ "rand 0.8.6",+ "tokio",+]++[[package]]+name = "base64"+version = "0.13.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"++[[package]]+name = "base64"+version = "0.21.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567"++[[package]]+name = "base64"+version = "0.22.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"++[[package]]+name = "beef"+version = "0.5.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1"++[[package]]+name = "bindings"+version = "0.6.1"+dependencies = [+ "heck 0.5.0",+ "proc-macro2",+ "quote",+ "syn 2.0.118",+]++[[package]]+name = "bit-set"+version = "0.5.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1"+dependencies = [+ "bit-vec 0.6.3",+]++[[package]]+name = "bit-set"+version = "0.8.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3"+dependencies = [+ "bit-vec 0.8.0",+]++[[package]]+name = "bit-vec"+version = "0.6.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb"++[[package]]+name = "bit-vec"+version = "0.8.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7"++[[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"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"++[[package]]+name = "bitflags"+version = "2.13.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8"+dependencies = [+ "serde_core",+]++[[package]]+name = "bitstream-io"+version = "4.10.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7eff00be299a18769011411c9def0d827e8f2d7bf0c3dbf53633147a8867fd1f"+dependencies = [+ "no_std_io2",+]++[[package]]+name = "blake3"+version = "1.8.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0aa83c34e62843d924f905e0f5c866eb1dd6545fc4d719e803d9ba6030371fce"+dependencies = [+ "arrayref",+ "arrayvec",+ "cc",+ "cfg-if",+ "constant_time_eq",+ "cpufeatures 0.3.0",+]++[[package]]+name = "block-buffer"+version = "0.10.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"+dependencies = [+ "generic-array",+]++[[package]]+name = "block2"+version = "0.6.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5"+dependencies = [+ "objc2",+]++[[package]]+name = "blocking"+version = "1.6.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e83f8d02be6967315521be875afa792a316e28d57b5a2d401897e2a7921b7f21"+dependencies = [+ "async-channel",+ "async-task",+ "futures-io",+ "futures-lite",+ "piper",+]++[[package]]+name = "bon"+version = "3.10.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9e3fac94a66da67200398458a25412bcc3f9b6443b5119a6cad9cf3ccfcd8cc6"+dependencies = [+ "bon-macros",+]++[[package]]+name = "bon-macros"+version = "3.10.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d4654961ad0494e4774c5c60b4cb4cd0ae9b9d92d039d901638b1dba97ebebf5"+dependencies = [+ "darling 0.24.1",+ "ident_case",+ "prettyplease 0.3.0",+ "proc-macro2",+ "quote",+ "syn 3.0.3",+]++[[package]]+name = "brotli"+version = "9.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f8b851b75c23ca7873623d612fe49bd1989aeb03d08fb9432187eb253d3d4c6b"+dependencies = [+ "alloc-no-stdlib",+ "alloc-stdlib",+ "brotli-decompressor",+]++[[package]]+name = "brotli-decompressor"+version = "6.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "941cd9bd4ddab83cb46fa5a2d428f1c857b24ac78cb876cf7beb710840934bd7"+dependencies = [+ "alloc-no-stdlib",+ "alloc-stdlib",+]++[[package]]+name = "bs58"+version = "0.5.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4"+dependencies = [+ "tinyvec",+]++[[package]]+name = "bstr"+version = "1.12.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5cee35f73844aa3014bb606320a6c1f010249dbdf43342fe54b5a4f6a8ed4b79"+dependencies = [+ "memchr",+ "regex-automata",+ "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"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"++[[package]]+name = "bytemuck"+version = "1.25.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c8efb64bd706a16a1bdde310ae86b351e4d21550d98d056f22f8a7f7a2183fec"+dependencies = [+ "bytemuck_derive",+]++[[package]]+name = "bytemuck_derive"+version = "1.10.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f9abbd1bc6865053c427f7198e6af43bfdedc55ab791faed4fbd361d789575ff"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.118",+]++[[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"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495"++[[package]]+name = "bytes"+version = "1.12.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8ae3f5d315924270530207e2a68396c3cc547f6dca3fbdca317cfb1a51edb593"+dependencies = [+ "serde",+]++[[package]]+name = "cairo-rs"+version = "0.18.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8ca26ef0159422fb77631dc9d17b102f253b876fe1586b03b803e63a309b4ee2"+dependencies = [+ "bitflags 2.13.0",+ "cairo-sys-rs",+ "glib",+ "libc",+ "once_cell",+ "thiserror 1.0.69",+]++[[package]]+name = "cairo-sys-rs"+version = "0.18.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "685c9fa8e590b8b3d678873528d83411db17242a73fccaed827770ea0fedda51"+dependencies = [+ "glib-sys",+ "libc",+ "system-deps",+]++[[package]]+name = "camino"+version = "1.2.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5f2d30e4173c4026932d51d31d6b0613b1fd3014bf3f9f8943d4ba139c437ba0"+dependencies = [+ "serde_core",+]++[[package]]+name = "cargo-platform"+version = "0.1.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea"+dependencies = [+ "serde",+]++[[package]]+name = "cargo_metadata"+version = "0.19.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "dd5eb614ed4c27c5d706420e4320fbe3216ab31fa1c33cd8246ac36dae4479ba"+dependencies = [+ "camino",+ "cargo-platform",+ "semver",+ "serde",+ "serde_json",+ "thiserror 2.0.18",+]++[[package]]+name = "cargo_toml"+version = "1.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "82f4b26e751e711a5302649417f2da046dce6391b2ea30a4820f37462314f0b9"+dependencies = [+ "semver",+ "serde",+ "toml 1.1.2+spec-1.1.0",+]++[[package]]+name = "castaway"+version = "0.2.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "dec551ab6e7578819132c713a93c022a05d60159dc86e7a7050223577484c55a"+dependencies = [+ "rustversion",+]++[[package]]+name = "cc"+version = "1.2.66"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f5d6cac793997bd970000024b2934968efe83b382de4fdcf4fcb46b6ee4ad996"+dependencies = [+ "find-msvc-tools",+ "jobserver",+ "libc",+ "shlex",+]++[[package]]+name = "cesu8"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c"++[[package]]+name = "cfb"+version = "0.7.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d38f2da7a0a2c4ccf0065be06397cc26a81f4e528be095826eee9d4adbb8c60f"+dependencies = [+ "byteorder",+ "fnv",+ "uuid",+]++[[package]]+name = "cfb"+version = "0.14.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a347dcabdae9c31b0825fd6a8bed285ec9c2acb89c47827126d52fa4f59cece3"+dependencies = [+ "fnv",+ "uuid",+ "web-time",+]++[[package]]+name = "cfg-expr"+version = "0.15.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d067ad48b8650848b989a59a86c6c36a995d02d2bf778d45c3c5d57bc2718f02"+dependencies = [+ "smallvec",+ "target-lexicon",+]++[[package]]+name = "cfg-if"+version = "1.0.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"++[[package]]+name = "cfg_aliases"+version = "0.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"++[[package]]+name = "chacha20"+version = "0.10.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06"+dependencies = [+ "cfg-if",+ "cpufeatures 0.3.0",+ "rand_core 0.10.1",+]++[[package]]+name = "chrono"+version = "0.4.45"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327"+dependencies = [+ "iana-time-zone",+ "js-sys",+ "num-traits",+ "serde",+ "wasm-bindgen",+ "windows-link 0.2.1",+]++[[package]]+name = "clang-ast"+version = "0.1.35"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2d76fac0a007075fa8d38a6ec08df340bea2035cc0a6e9b0f6594bff1627692b"+dependencies = [+ "foldhash",+ "serde_core",+]++[[package]]+name = "clap"+version = "4.6.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1ddb117e43bbf7dacf0a4190fef4d345b9bad68dfc649cb349e7d17d28428e51"+dependencies = [+ "clap_builder",+ "clap_derive",+]++[[package]]+name = "clap_builder"+version = "4.6.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f"+dependencies = [+ "anstream",+ "anstyle",+ "clap_lex",+ "strsim",+]++[[package]]+name = "clap_derive"+version = "4.6.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f2ce8604710f6733aa641a2b3731eaa1e8b3d9973d5e3565da11800813f997a9"+dependencies = [+ "heck 0.5.0",+ "proc-macro2",+ "quote",+ "syn 2.0.118",+]++[[package]]+name = "clap_lex"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9"++[[package]]+name = "cmake"+version = "0.1.58"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c0f78a02292a74a88ac736019ab962ece0bc380e3f977bf72e376c5d78ff0678"+dependencies = [+ "cc",+]++[[package]]+name = "color_quant"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"++[[package]]+name = "colorchoice"+version = "1.0.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570"++[[package]]+name = "combine"+version = "4.6.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd"+dependencies = [+ "bytes",+ "memchr",+]++[[package]]+name = "compact_str"+version = "0.9.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9dfdd1c2274d9aa354115b09dc9a901d6c5576818cdf70d14cae2bdb47df00ab"+dependencies = [+ "castaway",+ "cfg-if",+ "itoa",+ "rustversion",+ "ryu",+ "serde",+ "static_assertions",+]++[[package]]+name = "concurrent-queue"+version = "2.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973"+dependencies = [+ "crossbeam-utils",+]++[[package]]+name = "confy"+version = "2.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8807c397789cbe02bbdb1a27ea5f345584132808697b2a3f957c829829ee4814"+dependencies = [+ "etcetera",+ "lazy_static",+ "serde",+ "thiserror 2.0.18",+ "toml 0.9.12+spec-1.1.0",+]++[[package]]+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 = "constant_time_eq"+version = "0.4.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3d52eff69cd5e647efe296129160853a42795992097e8af39800e1060caeea9b"++[[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 = "cookie"+version = "0.18.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747"+dependencies = [+ "time",+ "version_check",+]++[[package]]+name = "core-foundation"+version = "0.9.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f"+dependencies = [+ "core-foundation-sys",+ "libc",+]++[[package]]+name = "core-foundation"+version = "0.10.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6"+dependencies = [+ "core-foundation-sys",+ "libc",+]++[[package]]+name = "core-foundation-sys"+version = "0.8.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"++[[package]]+name = "core-graphics"+version = "0.25.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "064badf302c3194842cf2c5d61f56cc88e54a759313879cdf03abdd27d0c3b97"+dependencies = [+ "bitflags 2.13.0",+ "core-foundation 0.10.1",+ "core-graphics-types",+ "foreign-types",+ "libc",+]++[[package]]+name = "core-graphics-types"+version = "0.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb"+dependencies = [+ "bitflags 2.13.0",+ "core-foundation 0.10.1",+ "libc",+]++[[package]]+name = "coreaudio-rs"+version = "0.14.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7d5d7dca3ebcf65a035582c9ad4385371a9d9ee6537474d2a278f4e1e475bb58"+dependencies = [+ "bitflags 2.13.0",+ "libc",+ "objc2-audio-toolbox",+ "objc2-core-audio",+ "objc2-core-audio-types",+ "objc2-core-foundation",+]++[[package]]+name = "cpal"+version = "0.17.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d8942da362c0f0d895d7cac616263f2f9424edc5687364dfd1d25ef7eba506d7"+dependencies = [+ "alsa",+ "coreaudio-rs",+ "dasp_sample",+ "jni 0.21.1",+ "js-sys",+ "libc",+ "mach2",+ "ndk",+ "ndk-context",+ "num-derive",+ "num-traits",+ "objc2",+ "objc2-audio-toolbox",+ "objc2-avf-audio",+ "objc2-core-audio",+ "objc2-core-audio-types",+ "objc2-core-foundation",+ "objc2-foundation",+ "wasm-bindgen",+ "wasm-bindgen-futures",+ "web-sys",+ "windows 0.61.3",+]++[[package]]+name = "cpufeatures"+version = "0.2.17"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280"+dependencies = [+ "libc",+]++[[package]]+name = "cpufeatures"+version = "0.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201"+dependencies = [+ "libc",+]++[[package]]+name = "crc32c"+version = "0.6.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3a47af21622d091a8f0fb295b88bc886ac74efcc613efc19f5d0b21de5c89e47"+dependencies = [+ "rustc_version",+]++[[package]]+name = "crc32fast"+version = "1.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511"+dependencies = [+ "cfg-if",+]++[[package]]+name = "crossbeam-channel"+version = "0.5.15"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2"+dependencies = [+ "crossbeam-utils",+]++[[package]]+name = "crossbeam-deque"+version = "0.8.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51"+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-utils"+version = "0.8.21"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"++[[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 = "cssparser"+version = "0.37.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8c9cdaae01d5ed7882b04d795e7f752f46ff52d2fa3b50a20d28c464510bba98"+dependencies = [+ "cssparser-macros",+ "dtoa-short",+ "itoa",+ "phf",+ "smallvec",+]++[[package]]+name = "cssparser-macros"+version = "0.7.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d045de693cb712d0b22c6a64be5b953f67b3ce00ab5ad3dd5d8b441886ab8e1a"+dependencies = [+ "quote",+ "syn 3.0.3",+]++[[package]]+name = "ctor"+version = "1.0.13"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "914a755b7c2d4af2bdcff7ce1739e2db9a1b81a9b07123d8015786ae03c0980d"++[[package]]+name = "darling"+version = "0.20.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee"+dependencies = [+ "darling_core 0.20.11",+ "darling_macro 0.20.11",+]++[[package]]+name = "darling"+version = "0.23.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "25ae13da2f202d56bd7f91c25fba009e7717a1e4a1cc98a76d844b65ae912e9d"+dependencies = [+ "darling_core 0.23.0",+ "darling_macro 0.23.0",+]++[[package]]+name = "darling"+version = "0.24.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ed17f5901b6630b993ca003def43f2f8ef4014fc13b047b57aad617ff32bc2ec"+dependencies = [+ "darling_core 0.24.1",+ "darling_macro 0.24.1",+]++[[package]]+name = "darling_core"+version = "0.20.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e"+dependencies = [+ "fnv",+ "ident_case",+ "proc-macro2",+ "quote",+ "strsim",+ "syn 2.0.118",+]++[[package]]+name = "darling_core"+version = "0.23.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9865a50f7c335f53564bb694ef660825eb8610e0a53d3e11bf1b0d3df31e03b0"+dependencies = [+ "ident_case",+ "proc-macro2",+ "quote",+ "strsim",+ "syn 2.0.118",+]++[[package]]+name = "darling_core"+version = "0.24.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6837e2cf7485aaae18f86181d2f0e9a7ed297a025e220aeabf63fdebd3a2ddff"+dependencies = [+ "ident_case",+ "proc-macro2",+ "quote",+ "strsim",+ "syn 3.0.3",+]++[[package]]+name = "darling_macro"+version = "0.20.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead"+dependencies = [+ "darling_core 0.20.11",+ "quote",+ "syn 2.0.118",+]++[[package]]+name = "darling_macro"+version = "0.23.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ac3984ec7bd6cfa798e62b4a642426a5be0e68f9401cfc2a01e3fa9ea2fcdb8d"+dependencies = [+ "darling_core 0.23.0",+ "quote",+ "syn 2.0.118",+]++[[package]]+name = "darling_macro"+version = "0.24.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2ac7135c3ef02b2f7833bbeb1be5ba7f966dcde8a87c6b87f65a778d71a02785"+dependencies = [+ "darling_core 0.24.1",+ "quote",+ "syn 3.0.3",+]++[[package]]+name = "dary_heap"+version = "0.3.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8b1e3a325bc115f096c8b77bbf027a7c2592230e70be2d985be950d3d5e60ebe"+dependencies = [+ "serde",+]++[[package]]+name = "dasp_sample"+version = "0.11.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0c87e182de0887fd5361989c677c4e8f5000cd9491d6d563161a8f3a5519fc7f"++[[package]]+name = "dbus"+version = "0.9.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3ab69f03cc8c4340c9c8e315114e1658e6775a9b16a04357973aa21cec22b32e"+dependencies = [+ "libc",+ "libdbus-sys",+ "windows-sys 0.61.2",+]++[[package]]+name = "depfile"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ab7b3a8c29cb8b0b8e17acfcdb203b4a89a3e50718efe5f8e4f4d765be0dd1a1"+dependencies = [+ "logos",+]++[[package]]+name = "deranged"+version = "0.5.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c"+dependencies = [+ "serde_core",+]++[[package]]+name = "derive_arbitrary"+version = "1.4.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1e567bd82dcff979e4b03460c307b3cdc9e96fde3d73bed1496d2bc75d9dd62a"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.118",+]++[[package]]+name = "derive_builder"+version = "0.20.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "507dfb09ea8b7fa618fcf76e953f4f5e192547945816d5358edffe39f6f94947"+dependencies = [+ "derive_builder_macro",+]++[[package]]+name = "derive_builder_core"+version = "0.20.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2d5bcf7b024d6835cfb3d473887cd966994907effbe9227e8c8219824d06c4e8"+dependencies = [+ "darling 0.20.11",+ "proc-macro2",+ "quote",+ "syn 2.0.118",+]++[[package]]+name = "derive_builder_macro"+version = "0.20.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c"+dependencies = [+ "derive_builder_core",+ "syn 2.0.118",+]++[[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",+ "proc-macro2",+ "quote",+ "rustc_version",+ "syn 2.0.118",+ "unicode-xid",+]++[[package]]+name = "digest"+version = "0.10.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"+dependencies = [+ "block-buffer",+ "crypto-common",+]++[[package]]+name = "dirs"+version = "4.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059"+dependencies = [+ "dirs-sys 0.3.7",+]++[[package]]+name = "dirs"+version = "6.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e"+dependencies = [+ "dirs-sys 0.5.0",+]++[[package]]+name = "dirs"+version = "7.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8d57d423b3c82e89b9a24ca3091fee61f456a26edbd28d26c65906f4bc1dcd8f"+dependencies = [+ "dirs-sys 0.5.0",+]++[[package]]+name = "dirs-sys"+version = "0.3.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6"+dependencies = [+ "libc",+ "redox_users 0.4.6",+ "winapi",+]++[[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 0.5.2",+ "windows-sys 0.61.2",+]++[[package]]+name = "dispatch2"+version = "0.3.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38"+dependencies = [+ "bitflags 2.13.0",+ "block2",+ "libc",+ "objc2",+]++[[package]]+name = "displaydoc"+version = "0.2.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1ac70aa55017e108007fbaf5aa0f54b021c98f92ff8af59d42eda9da96e3dd4f"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.118",+]++[[package]]+name = "dlopen2"+version = "0.8.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5e2c5bd4158e66d1e215c49b837e11d62f3267b30c92f1d171c4d3105e3dc4d4"+dependencies = [+ "dlopen2_derive",+ "libc",+ "once_cell",+ "winapi",+]++[[package]]+name = "dlopen2_derive"+version = "0.4.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0fbbb781877580993a8707ec48672673ec7b81eeba04cfd2310bd28c08e47c8f"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.118",+]++[[package]]+name = "dom_query"+version = "0.28.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fac5fca71e65e94cc718a6e2af65d6e0f9c6027751c2aa562fbb5087fda639bc"+dependencies = [+ "bit-set 0.8.0",+ "cssparser",+ "foldhash",+ "html5ever",+ "precomputed-hash",+ "selectors",+ "tendril",+]++[[package]]+name = "download-manager"+version = "0.6.1"+dependencies = [+ "async-trait",+ "base64 0.22.1",+ "bindings",+ "block2",+ "bon",+ "crc32c",+ "futures-util",+ "kiban",+ "objc2",+ "objc2-foundation",+ "reqwest 0.13.4",+ "serde",+ "serde_json",+ "sha1",+ "sha2",+ "thiserror 2.0.18",+ "tokio",+ "tokio-stream",+ "tracing",+ "uuid",+]++[[package]]+name = "dpi"+version = "0.1.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76"+dependencies = [+ "serde",+]++[[package]]+name = "dtoa"+version = "1.0.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4c3cf4824e2d5f025c7b531afcb2325364084a16806f6d47fbc1f5fbd9960590"++[[package]]+name = "dtoa-short"+version = "0.3.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cd1511a7b6a56299bd043a9c167a6d2bfb37bf84a6dfceaba651168adfb43c87"+dependencies = [+ "dtoa",+]++[[package]]+name = "dunce"+version = "1.0.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813"++[[package]]+name = "dyn-clone"+version = "1.0.20"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555"++[[package]]+name = "either"+version = "1.16.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "91622ff5e7162018101f2fea40d6ebf4a78bbe5a49736a2020649edf9693679e"++[[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.2+spec-1.1.0",+ "vswhom",+ "winreg 0.55.0",+]++[[package]]+name = "embed_plist"+version = "1.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4ef6b89e5b37196644d8796de5268852ff179b44e96276cf4290264843743bb7"++[[package]]+name = "encoding_rs"+version = "0.8.35"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3"+dependencies = [+ "cfg-if",+]++[[package]]+name = "endi"+version = "1.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "66b7e2430c6dff6a955451e2cfc438f09cea1965a9d6f87f7e3b90decc014099"++[[package]]+name = "enumflags2"+version = "0.7.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1027f7680c853e056ebcec683615fb6fbbc07dbaa13b4d5d9442b146ded4ecef"+dependencies = [+ "enumflags2_derive",+ "serde",+]++[[package]]+name = "enumflags2_derive"+version = "0.7.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "67c78a4d8fdf9953a5c9d458f9efe940fd97a0cab0941c075a813ac594733827"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.118",+]++[[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.118",+]++[[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"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"+dependencies = [+ "libc",+ "windows-sys 0.61.2",+]++[[package]]+name = "esaxx-rs"+version = "0.1.10"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d817e038c30374a4bcb22f94d0a8a0e216958d4c3dcde369b1439fec4bdda6e6"++[[package]]+name = "etcetera"+version = "0.10.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "26c7b13d0780cb82722fd59f6f57f925e143427e4a75313a6c77243bf5326ae6"+dependencies = [+ "cfg-if",+ "home",+ "windows-sys 0.59.0",+]++[[package]]+name = "event-listener"+version = "5.4.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e13b66accf52311f30a0db42147dadea9850cb48cd070028831ae5f5d4b856ab"+dependencies = [+ "concurrent-queue",+ "parking",+ "pin-project-lite",+]++[[package]]+name = "event-listener-strategy"+version = "0.5.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93"+dependencies = [+ "event-listener",+ "pin-project-lite",+]++[[package]]+name = "eventsource-stream"+version = "0.2.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "74fef4569247a5f429d9156b9d0a2599914385dd189c539334c625d8099d90ab"+dependencies = [+ "futures-core",+ "nom 7.1.3",+ "pin-project-lite",+]++[[package]]+name = "exr"+version = "1.74.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4300e043a56aa2cb633c01af81ca8f699a321879a7854d3896a0ba89056363be"+dependencies = [+ "bit_field",+ "half",+ "lebe",+ "miniz_oxide",+ "rayon-core",+ "smallvec",+ "zune-inflate",+]++[[package]]+name = "extended"+version = "0.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "af9673d8203fcb076b19dfd17e38b3d4ae9f44959416ea532ce72415a6020365"++[[package]]+name = "fancy-regex"+version = "0.13.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "531e46835a22af56d1e3b66f04844bed63158bc094a628bec1d321d9b4c44bf2"+dependencies = [+ "bit-set 0.5.3",+ "regex-automata",+ "regex-syntax",+]++[[package]]+name = "fancy-regex"+version = "0.14.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6e24cb5a94bcae1e5408b0effca5cd7172ea3c5755049c5f3af4cd283a165298"+dependencies = [+ "bit-set 0.8.0",+ "regex-automata",+ "regex-syntax",+]++[[package]]+name = "fancy-regex"+version = "0.17.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "72cf461f865c862bb7dc573f643dd6a2b6842f7c30b07882b56bd148cc2761b8"+dependencies = [+ "bit-set 0.8.0",+ "regex-automata",+ "regex-syntax",+]++[[package]]+name = "fastrand"+version = "2.4.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6"++[[package]]+name = "fax"+version = "0.2.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "caf1079563223d5d59d83c85886a56e586cfd5c1a26292e971a0fa266531ac5a"++[[package]]+name = "fdeflate"+version = "0.3.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c"+dependencies = [+ "simd-adler32",+]++[[package]]+name = "field-offset"+version = "0.3.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f"+dependencies = [+ "memoffset",+ "rustc_version",+]++[[package]]+name = "filetime"+version = "0.2.29"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5c287a33c7f0a620c38e641e7f60827713987b3c0f26e8ddc9462cc69cf75759"+dependencies = [+ "cfg-if",+ "libc",+]++[[package]]+name = "find-msvc-tools"+version = "0.1.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"++[[package]]+name = "flate2"+version = "1.1.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c"+dependencies = [+ "crc32fast",+ "miniz_oxide",+]++[[package]]+name = "fnv"+version = "1.0.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"++[[package]]+name = "foldhash"+version = "0.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"++[[package]]+name = "foreign-types"+version = "0.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965"+dependencies = [+ "foreign-types-macros",+ "foreign-types-shared",+]++[[package]]+name = "foreign-types-macros"+version = "0.2.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.118",+]++[[package]]+name = "foreign-types-shared"+version = "0.3.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b"++[[package]]+name = "form_urlencoded"+version = "1.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf"+dependencies = [+ "percent-encoding",+]++[[package]]+name = "fs_extra"+version = "1.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c"++[[package]]+name = "futures"+version = "0.3.32"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8b147ee9d1f6d097cef9ce628cd2ee62288d963e16fb287bd9286455b241382d"+dependencies = [+ "futures-channel",+ "futures-core",+ "futures-executor",+ "futures-io",+ "futures-sink",+ "futures-task",+ "futures-util",+]++[[package]]+name = "futures-channel"+version = "0.3.32"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d"+dependencies = [+ "futures-core",+ "futures-sink",+]++[[package]]+name = "futures-core"+version = "0.3.32"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d"++[[package]]+name = "futures-executor"+version = "0.3.32"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "baf29c38818342a3b26b5b923639e7b1f4a61fc5e76102d4b1981c6dc7a7579d"+dependencies = [+ "futures-core",+ "futures-task",+ "futures-util",+]++[[package]]+name = "futures-io"+version = "0.3.32"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718"++[[package]]+name = "futures-lite"+version = "2.6.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad"+dependencies = [+ "fastrand",+ "futures-core",+ "futures-io",+ "parking",+ "pin-project-lite",+]++[[package]]+name = "futures-macro"+version = "0.3.32"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.118",+]++[[package]]+name = "futures-sink"+version = "0.3.32"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893"++[[package]]+name = "futures-task"+version = "0.3.32"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393"++[[package]]+name = "futures-timer"+version = "3.0.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "af43fadb8a98512d547e37b4e92e0ced13e205c061b87b4623eff01d918d6968"++[[package]]+name = "futures-util"+version = "0.3.32"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6"+dependencies = [+ "futures-channel",+ "futures-core",+ "futures-io",+ "futures-macro",+ "futures-sink",+ "futures-task",+ "memchr",+ "pin-project-lite",+ "slab",+]++[[package]]+name = "gdk"+version = "0.18.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d9f245958c627ac99d8e529166f9823fb3b838d1d41fd2b297af3075093c2691"+dependencies = [+ "cairo-rs",+ "gdk-pixbuf",+ "gdk-sys",+ "gio",+ "glib",+ "libc",+ "pango",+]++[[package]]+name = "gdk-pixbuf"+version = "0.18.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "50e1f5f1b0bfb830d6ccc8066d18db35c487b1b2b1e8589b5dfe9f07e8defaec"+dependencies = [+ "gdk-pixbuf-sys",+ "gio",+ "glib",+ "libc",+ "once_cell",+]++[[package]]+name = "gdk-pixbuf-sys"+version = "0.18.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3f9839ea644ed9c97a34d129ad56d38a25e6756f99f3a88e15cd39c20629caf7"+dependencies = [+ "gio-sys",+ "glib-sys",+ "gobject-sys",+ "libc",+ "system-deps",+]++[[package]]+name = "gdk-sys"+version = "0.18.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5c2d13f38594ac1e66619e188c6d5a1adb98d11b2fcf7894fc416ad76aa2f3f7"+dependencies = [+ "cairo-sys-rs",+ "gdk-pixbuf-sys",+ "gio-sys",+ "glib-sys",+ "gobject-sys",+ "libc",+ "pango-sys",+ "pkg-config",+ "system-deps",+]++[[package]]+name = "gdkwayland-sys"+version = "0.18.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "140071d506d223f7572b9f09b5e155afbd77428cd5cc7af8f2694c41d98dfe69"+dependencies = [+ "gdk-sys",+ "glib-sys",+ "gobject-sys",+ "libc",+ "pkg-config",+ "system-deps",+]++[[package]]+name = "gdkx11"+version = "0.18.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3caa00e14351bebbc8183b3c36690327eb77c49abc2268dd4bd36b856db3fbfe"+dependencies = [+ "gdk",+ "gdkx11-sys",+ "gio",+ "glib",+ "libc",+ "x11",+]++[[package]]+name = "gdkx11-sys"+version = "0.18.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6e2e7445fe01ac26f11601db260dd8608fe172514eb63b3b5e261ea6b0f4428d"+dependencies = [+ "gdk-sys",+ "glib-sys",+ "libc",+ "system-deps",+ "x11",+]++[[package]]+name = "generic-array"+version = "0.14.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"+dependencies = [+ "typenum",+ "version_check",+]++[[package]]+name = "gethostname"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8"+dependencies = [+ "rustix",+ "windows-link 0.2.1",+]++[[package]]+name = "getrandom"+version = "0.2.17"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"+dependencies = [+ "cfg-if",+ "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.14.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ee8cfcc411d9adbbaba82fb72661cc1bcca13e8bba98b364e62b2dba8f960159"+dependencies = [+ "color_quant",+ "weezl",+]++[[package]]+name = "gio"+version = "0.18.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d4fc8f532f87b79cbc51a79748f16a6828fb784be93145a322fa14d06d354c73"+dependencies = [+ "futures-channel",+ "futures-core",+ "futures-io",+ "futures-util",+ "gio-sys",+ "glib",+ "libc",+ "once_cell",+ "pin-project-lite",+ "smallvec",+ "thiserror 1.0.69",+]++[[package]]+name = "gio-sys"+version = "0.18.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "37566df850baf5e4cb0dfb78af2e4b9898d817ed9263d1090a2df958c64737d2"+dependencies = [+ "glib-sys",+ "gobject-sys",+ "libc",+ "system-deps",+ "winapi",+]++[[package]]+name = "glib"+version = "0.18.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "233daaf6e83ae6a12a52055f568f9d7cf4671dabb78ff9560ab6da230ce00ee5"+dependencies = [+ "bitflags 2.13.0",+ "futures-channel",+ "futures-core",+ "futures-executor",+ "futures-task",+ "futures-util",+ "gio-sys",+ "glib-macros",+ "glib-sys",+ "gobject-sys",+ "libc",+ "memchr",+ "once_cell",+ "smallvec",+ "thiserror 1.0.69",+]++[[package]]+name = "glib-macros"+version = "0.18.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0bb0228f477c0900c880fd78c8759b95c7636dbd7842707f49e132378aa2acdc"+dependencies = [+ "heck 0.4.1",+ "proc-macro-crate 2.0.2",+ "proc-macro-error",+ "proc-macro2",+ "quote",+ "syn 2.0.118",+]++[[package]]+name = "glib-sys"+version = "0.18.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "063ce2eb6a8d0ea93d2bf8ba1957e78dbab6be1c2220dd3daca57d5a9d869898"+dependencies = [+ "libc",+ "system-deps",+]++[[package]]+name = "glob"+version = "0.3.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280"++[[package]]+name = "global-hotkey"+version = "0.8.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8c386b0a4a70cb2d39fffd74480f985b6f0bfbcb934b6a6b6b7e630e448f242e"+dependencies = [+ "crossbeam-channel",+ "keyboard-types 0.7.0",+ "objc2",+ "objc2-app-kit",+ "once_cell",+ "serde",+ "thiserror 2.0.18",+ "windows-sys 0.59.0",+ "x11rb",+ "xkeysym",+]++[[package]]+name = "gobject-sys"+version = "0.18.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0850127b514d1c4a4654ead6dedadb18198999985908e6ffe4436f53c785ce44"+dependencies = [+ "glib-sys",+ "libc",+ "system-deps",+]++[[package]]+name = "gtk"+version = "0.18.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fd56fb197bfc42bd5d2751f4f017d44ff59fbb58140c6b49f9b3b2bdab08506a"+dependencies = [+ "atk",+ "cairo-rs",+ "field-offset",+ "futures-channel",+ "gdk",+ "gdk-pixbuf",+ "gio",+ "glib",+ "gtk-sys",+ "gtk3-macros",+ "libc",+ "pango",+ "pkg-config",+]++[[package]]+name = "gtk-sys"+version = "0.18.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8f29a1c21c59553eb7dd40e918be54dccd60c52b049b75119d5d96ce6b624414"+dependencies = [+ "atk-sys",+ "cairo-sys-rs",+ "gdk-pixbuf-sys",+ "gdk-sys",+ "gio-sys",+ "glib-sys",+ "gobject-sys",+ "libc",+ "pango-sys",+ "system-deps",+]++[[package]]+name = "gtk3-macros"+version = "0.18.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "52ff3c5b21f14f0736fed6dcfc0bfb4225ebf5725f3c0209edeec181e4d73e9d"+dependencies = [+ "proc-macro-crate 1.3.1",+ "proc-macro-error",+ "proc-macro2",+ "quote",+ "syn 2.0.118",+]++[[package]]+name = "h2"+version = "0.4.19"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ef8e5e5a340588f4452631496976cf8636d4a7ecf600239fdc27615d2530bc16"+dependencies = [+ "atomic-waker",+ "bytes",+ "fnv",+ "futures-core",+ "futures-sink",+ "http",+ "indexmap 2.14.0",+ "slab",+ "tokio",+ "tokio-util",+ "tracing",+]++[[package]]+name = "half"+version = "2.7.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b"+dependencies = [+ "bytemuck",+ "cfg-if",+ "crunchy",+ "num-traits",+ "zerocopy",+]++[[package]]+name = "hanashi"+version = "0.6.1"+dependencies = [+ "indexmap 2.14.0",+ "libc",+ "minijinja",+ "minijinja-contrib",+ "openai-harmony",+ "regex",+ "serde",+ "serde_json",+ "shoji",+ "thiserror 2.0.18",+ "token-stream-parser",+ "tokenizers",+ "tracing",+]++[[package]]+name = "hashbrown"+version = "0.12.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"++[[package]]+name = "hashbrown"+version = "0.17.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"++[[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.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c"++[[package]]+name = "hex"+version = "0.4.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"++[[package]]+name = "home"+version = "0.5.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d"+dependencies = [+ "windows-sys 0.61.2",+]++[[package]]+name = "hound"+version = "3.5.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "62adaabb884c94955b19907d60019f4e145d091c75345379e70d1ee696f7854f"++[[package]]+name = "html5ever"+version = "0.39.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "46a1761807faccc9a19e86944bbf40610014066306f96edcdedc2fb714bcb7b8"+dependencies = [+ "log",+ "markup5ever",+]++[[package]]+name = "http"+version = "1.4.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6970f50e31d6fc17d3fa27329444bfa74e196cf62e95052a3f6fee181dba6425"+dependencies = [+ "bytes",+ "itoa",+]++[[package]]+name = "http-body"+version = "1.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184"+dependencies = [+ "bytes",+ "http",+]++[[package]]+name = "http-body-util"+version = "0.1.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a"+dependencies = [+ "bytes",+ "futures-core",+ "http",+ "http-body",+ "pin-project-lite",+]++[[package]]+name = "httparse"+version = "1.10.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"++[[package]]+name = "hyper"+version = "1.10.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "55281c53a1894c864990125767da440a4e630446785086f52523b20033b74498"+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.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "33ca68d021ef39cf6463ab54c1d0f5daf03377b70561305bb89a8f83aab66e0f"+dependencies = [+ "http",+ "hyper",+ "hyper-util",+ "rustls",+ "rustls-native-certs",+ "tokio",+ "tokio-rustls",+ "tower-service",+ "webpki-roots",+]++[[package]]+name = "hyper-util"+version = "0.1.20"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0"+dependencies = [+ "base64 0.22.1",+ "bytes",+ "futures-channel",+ "futures-util",+ "http",+ "http-body",+ "hyper",+ "ipnet",+ "libc",+ "percent-encoding",+ "pin-project-lite",+ "socket2",+ "system-configuration",+ "tokio",+ "tower-service",+ "tracing",+ "windows-registry",+]++[[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.61.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 = "ico"+version = "0.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3e795dff5605e0f04bff85ca41b51a96b83e80b281e96231bcaaf1ac35103371"+dependencies = [+ "byteorder",+ "png 0.17.16",+]++[[package]]+name = "icu_collections"+version = "2.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c"+dependencies = [+ "displaydoc",+ "potential_utf",+ "utf8_iter",+ "yoke",+ "zerofrom",+ "zerovec",+]++[[package]]+name = "icu_locale_core"+version = "2.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29"+dependencies = [+ "displaydoc",+ "litemap",+ "tinystr",+ "writeable",+ "zerovec",+]++[[package]]+name = "icu_normalizer"+version = "2.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4"+dependencies = [+ "icu_collections",+ "icu_normalizer_data",+ "icu_properties",+ "icu_provider",+ "smallvec",+ "zerovec",+]++[[package]]+name = "icu_normalizer_data"+version = "2.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38"++[[package]]+name = "icu_properties"+version = "2.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de"+dependencies = [+ "icu_collections",+ "icu_locale_core",+ "icu_properties_data",+ "icu_provider",+ "zerotrie",+ "zerovec",+]++[[package]]+name = "icu_properties_data"+version = "2.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14"++[[package]]+name = "icu_provider"+version = "2.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421"+dependencies = [+ "displaydoc",+ "icu_locale_core",+ "writeable",+ "yoke",+ "zerofrom",+ "zerotrie",+ "zerovec",+]++[[package]]+name = "ident_case"+version = "1.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"++[[package]]+name = "idna"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de"+dependencies = [+ "idna_adapter",+ "smallvec",+ "utf8_iter",+]++[[package]]+name = "idna_adapter"+version = "1.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714"+dependencies = [+ "icu_normalizer",+ "icu_properties",+]++[[package]]+name = "image"+version = "0.25.10"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "85ab80394333c02fe689eaf900ab500fbd0c2213da414687ebf995a65d5a6104"+dependencies = [+ "bytemuck",+ "byteorder-lite",+ "color_quant",+ "exr",+ "gif",+ "image-webp",+ "moxcms",+ "num-traits",+ "png 0.18.1",+ "qoi",+ "ravif",+ "rayon",+ "rgb",+ "tiff",+ "zune-core",+ "zune-jpeg",+]++[[package]]+name = "image-webp"+version = "0.2.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "525e9ff3e1a4be2fbea1fdf0e98686a6d98b4d8f937e1bf7402245af1909e8c3"+dependencies = [+ "byteorder-lite",+ "quick-error",+]++[[package]]+name = "imgref"+version = "1.12.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "89194689a993ab15268672e99e7b0e19da2da3268ac682e8f02d29d4d1434cd7"++[[package]]+name = "indexmap"+version = "1.9.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"+dependencies = [+ "autocfg",+ "hashbrown 0.12.3",+ "serde",+]++[[package]]+name = "indexmap"+version = "2.14.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9"+dependencies = [+ "equivalent",+ "hashbrown 0.17.1",+ "serde",+ "serde_core",+]++[[package]]+name = "infer"+version = "0.19.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a588916bfdfd92e71cacef98a63d9b1f0d74d6599980d11894290e7ddefffcf7"+dependencies = [+ "cfb 0.7.3",+]++[[package]]+name = "infer"+version = "0.22.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f4200d433cbd5178df7797c9c2e75b348b728e39631cf14520d1e2fc424201f4"+dependencies = [+ "cfb 0.14.0",+]++[[package]]+name = "instant"+version = "0.1.13"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222"+dependencies = [+ "cfg-if",+]++[[package]]+name = "interpolate_name"+version = "0.2.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.118",+]++[[package]]+name = "ipnet"+version = "2.12.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2"++[[package]]+name = "is_terminal_polyfill"+version = "1.70.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695"++[[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 = "javascriptcore-rs"+version = "1.1.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ca5671e9ffce8ffba57afc24070e906da7fc4b1ba66f2cabebf61bf2ea257fcc"+dependencies = [+ "bitflags 1.3.2",+ "glib",+ "javascriptcore-rs-sys",+]++[[package]]+name = "javascriptcore-rs-sys"+version = "1.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "af1be78d14ffa4b75b66df31840478fef72b51f8c2465d4ca7c194da9f7a5124"+dependencies = [+ "glib-sys",+ "gobject-sys",+ "libc",+ "system-deps",+]++[[package]]+name = "jni"+version = "0.21.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97"+dependencies = [+ "cesu8",+ "cfg-if",+ "combine",+ "jni-sys 0.3.1",+ "log",+ "thiserror 1.0.69",+ "walkdir",+ "windows-sys 0.45.0",+]++[[package]]+name = "jni"+version = "0.22.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498"+dependencies = [+ "cfg-if",+ "combine",+ "jni-macros",+ "jni-sys 0.4.1",+ "log",+ "simd_cesu8",+ "thiserror 2.0.18",+ "walkdir",+ "windows-link 0.2.1",+]++[[package]]+name = "jni-macros"+version = "0.22.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3"+dependencies = [+ "proc-macro2",+ "quote",+ "rustc_version",+ "simd_cesu8",+ "syn 2.0.118",+]++[[package]]+name = "jni-sys"+version = "0.3.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258"+dependencies = [+ "jni-sys 0.4.1",+]++[[package]]+name = "jni-sys"+version = "0.4.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2"+dependencies = [+ "jni-sys-macros",+]++[[package]]+name = "jni-sys-macros"+version = "0.4.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264"+dependencies = [+ "quote",+ "syn 2.0.118",+]++[[package]]+name = "jobserver"+version = "0.1.35"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3"+dependencies = [+ "getrandom 0.4.3",+ "libc",+]++[[package]]+name = "js-sys"+version = "0.3.103"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "53b44bfcdb3f8d5837a46dae1ca9660a837176eee74a28b229bc626816589102"+dependencies = [+ "cfg-if",+ "futures-util",+ "wasm-bindgen",+]++[[package]]+name = "json-patch"+version = "4.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7421438de105a0827e44fadd05377727847d717c80ce29a229f85fd04c427b72"+dependencies = [+ "jsonptr",+ "serde",+ "serde_json",+ "thiserror 2.0.18",+]++[[package]]+name = "json-transform"+version = "0.6.1"+dependencies = [+ "fancy-regex 0.17.0",+ "indexmap 2.14.0",+ "llm_json",+ "regex",+ "serde",+ "serde_json",+ "thiserror 2.0.18",+ "tracing",+]++[[package]]+name = "jsonptr"+version = "0.7.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a5a3cc660ba5d72bce0b3bb295bf20847ccbb40fd423f3f05b61273672e561fe"+dependencies = [+ "serde",+ "serde_json",+]++[[package]]+name = "kanka"+version = "0.6.1"+dependencies = [+ "libc",+ "obfstr",+ "objc2-core-foundation",+]++[[package]]+name = "keisoku"+version = "0.6.1"+dependencies = [+ "bitflags 2.13.0",+ "kanka",+ "libc",+ "obfstr",+ "objc2-core-foundation",+ "objc2-io-kit",+ "serde",+ "serde_json",+ "sysinfo",+ "thiserror 2.0.18",+]++[[package]]+name = "keyboard-types"+version = "0.7.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b750dcadc39a09dbadd74e118f6dd6598df77fa01df0cfcdc52c28dece74528a"+dependencies = [+ "bitflags 2.13.0",+ "serde",+ "unicode-segmentation",+]++[[package]]+name = "keyboard-types"+version = "0.8.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0fbe853b403ae61a04233030ae8a79d94975281ed9770a1f9e246732b534b28d"+dependencies = [+ "bitflags 2.13.0",+ "serde",+]++[[package]]+name = "keyring-core"+version = "1.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fb1e621458ca9c51aa110bd0339d4751a056b9576bf1253aee1aa560dda0fc9d"+dependencies = [+ "log",+]++[[package]]+name = "kiban"+version = "0.6.1"+dependencies = [+ "async-trait",+ "futures-util",+ "tokio",+ "wasm-bindgen",+ "wasm-bindgen-futures",+ "web-sys",+ "web-time",+]++[[package]]+name = "lazy_static"+version = "1.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"++[[package]]+name = "lebe"+version = "0.5.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7a79a3332a6609480d7d0c9eab957bca6b455b91bb84e66d19f5ff66294b85b8"++[[package]]+name = "libappindicator"+version = "0.9.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "03589b9607c868cc7ae54c0b2a22c8dc03dd41692d48f2d7df73615c6a95dc0a"+dependencies = [+ "glib",+ "gtk",+ "gtk-sys",+ "libappindicator-sys",+ "log",+]++[[package]]+name = "libappindicator-sys"+version = "0.9.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6e9ec52138abedcc58dc17a7c6c0c00a2bdb4f3427c7f63fa97fd0d859155caf"+dependencies = [+ "gtk-sys",+ "libloading",+ "once_cell",+]++[[package]]+name = "libc"+version = "0.2.186"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"++[[package]]+name = "libdbus-sys"+version = "0.2.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "328c4789d42200f1eeec05bd86c9c13c7f091d2ba9a6ea35acdf51f31bc0f043"+dependencies = [+ "pkg-config",+]++[[package]]+name = "libfuzzer-sys"+version = "0.4.13"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a9fd2f41a1cba099f79a0b6b6c35656cf7c03351a7bae8ff0f28f25270f929d2"+dependencies = [+ "arbitrary",+ "cc",+]++[[package]]+name = "libloading"+version = "0.7.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f"+dependencies = [+ "cfg-if",+ "winapi",+]++[[package]]+name = "libm"+version = "0.2.16"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"++[[package]]+name = "libredox"+version = "0.1.18"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c943259e342f1e06ff2da7a83eabdfe7f92ce10262688dbf1895ff0b3e6e4652"+dependencies = [+ "libc",+]++[[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.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0"++[[package]]+name = "llm_json"+version = "1.0.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8e3a81b4dfc9cbadf5adde6e601f1b8ec0806d2b41da589e40cdc082e8e223b2"+dependencies = [+ "clap",+ "serde_json",+ "thiserror 1.0.69",+]++[[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.33"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad"++[[package]]+name = "logos"+version = "0.15.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ff472f899b4ec2d99161c51f60ff7075eeb3097069a36050d8037a6325eb8154"+dependencies = [+ "logos-derive",+]++[[package]]+name = "logos-codegen"+version = "0.15.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "192a3a2b90b0c05b27a0b2c43eecdb7c415e29243acc3f89cc8247a5b693045c"+dependencies = [+ "beef",+ "fnv",+ "lazy_static",+ "proc-macro2",+ "quote",+ "regex-syntax",+ "rustc_version",+ "syn 2.0.118",+]++[[package]]+name = "logos-derive"+version = "0.15.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "605d9697bcd5ef3a42d38efc51541aa3d6a4a25f7ab6d1ed0da5ac632a26b470"+dependencies = [+ "logos-codegen",+]++[[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.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154"++[[package]]+name = "mac-notification-sys"+version = "0.6.15"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fd604973958ddcc11b561193c0fb96ba146506ef2f231ef2e7c35fd2cbc9beca"+dependencies = [+ "cc",+ "log",+ "objc2",+ "objc2-foundation",+ "time",+ "uuid",+]++[[package]]+name = "mach2"+version = "0.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6a1b95cd5421ec55b445b5ae102f5ea0e768de1f82bd3001e11f426c269c3aea"+dependencies = [+ "libc",+]++[[package]]+name = "macro_rules_attribute"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "65049d7923698040cd0b1ddcced9b0eb14dd22c5f86ae59c3740eab64a676520"+dependencies = [+ "macro_rules_attribute-proc_macro",+ "paste",+]++[[package]]+name = "macro_rules_attribute-proc_macro"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "670fdfda89751bc4a84ac13eaa63e205cf0fd22b4c9a5fbfa085b63c1f1d3a30"++[[package]]+name = "markup5ever"+version = "0.39.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7122d987ec5f704ee56f6e5b41a7d93722e9aae27ae07cafa4036c4d3f9757de"+dependencies = [+ "log",+ "tendril",+ "web_atoms",+]++[[package]]+name = "matchers"+version = "0.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9"+dependencies = [+ "regex-automata",+]++[[package]]+name = "maybe-rayon"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8ea1f30cedd69f0a2954655f7188c6a834246d2bcf1e315e2ac40c4b24dc9519"+dependencies = [+ "cfg-if",+ "rayon",+]++[[package]]+name = "memchr"+version = "2.8.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "88904434abc2901f197fe8cc55f0445e7ded921dba5911dad2e2b39b48e663c4"++[[package]]+name = "memo-map"+version = "0.3.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "38d1115007560874e373613744c6fba374c17688327a71c1476d1a5954cc857b"++[[package]]+name = "memoffset"+version = "0.9.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"+dependencies = [+ "autocfg",+]++[[package]]+name = "mime"+version = "0.3.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 = "minijinja"+version = "2.21.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cb3d648e68cea56d9858d535ee28f9538404e2dd8cb08ed0bd05dca379477f39"+dependencies = [+ "indexmap 2.14.0",+ "memo-map",+ "serde",+ "serde_json",+]++[[package]]+name = "minijinja-contrib"+version = "2.21.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "85342f6fac0be8ccd5bd00d9066be538f34f393f577b75d81b17c8398a6b43bb"+dependencies = [+ "minijinja",+ "serde",+]++[[package]]+name = "minimal-lexical"+version = "0.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"++[[package]]+name = "minisign-verify"+version = "0.2.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "22f9645cb765ea72b8111f36c522475d2daa0d22c957a9826437e97534bc4e9e"++[[package]]+name = "miniz_oxide"+version = "0.8.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"+dependencies = [+ "adler2",+ "simd-adler32",+]++[[package]]+name = "mio"+version = "1.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "02bd0af71c67b473010cbbc60715ee815645a4dc942899111f494b4b737d6fda"+dependencies = [+ "libc",+ "wasi",+ "windows-sys 0.61.2",+]++[[package]]+name = "mirai-gui"+version = "0.6.1"+dependencies = [+ "chrono",+ "futures",+ "hanashi",+ "serde",+ "serde_json",+ "tauri",+ "tauri-build",+ "tauri-plugin-autostart",+ "tauri-plugin-dialog",+ "tauri-plugin-global-shortcut",+ "tauri-plugin-notification",+ "tauri-plugin-updater",+ "thiserror 2.0.18",+ "tokio",+ "uzu",+]++[[package]]+name = "monostate"+version = "0.1.18"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3341a273f6c9d5bef1908f17b7267bbab0e95c9bf69a0d4dcf8e9e1b2c76ef67"+dependencies = [+ "monostate-impl",+ "serde",+ "serde_core",+]++[[package]]+name = "monostate-impl"+version = "0.1.18"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e4db6d5580af57bf992f59068d4ea26fd518574ff48d7639b255a36f9de6e7e9"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.118",+]++[[package]]+name = "moxcms"+version = "0.8.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bb85c154ba489f01b25c0d36ae69a87e4a1c73a72631fc6c0eb6dde34a73e44b"+dependencies = [+ "num-traits",+ "pxfm",+]++[[package]]+name = "mtl-rs"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d9f1de2bca596db925db758d497cbf9cb394a2981933319b3777510097e1d360"+dependencies = [+ "bitflags 2.13.0",+ "block2",+ "dispatch2",+ "objc2",+ "objc2-core-foundation",+ "objc2-foundation",+ "objc2-io-surface",+]++[[package]]+name = "muda"+version = "0.20.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cca139e57da4383727f189e43e66e84fa372347027fc996f9f1a007ec0a37996"+dependencies = [+ "crossbeam-channel",+ "dpi",+ "gtk",+ "keyboard-types 0.8.3",+ "objc2",+ "objc2-app-kit",+ "objc2-core-foundation",+ "objc2-foundation",+ "once_cell",+ "png 0.18.1",+ "serde",+ "thiserror 2.0.18",+ "windows-sys 0.61.2",+]++[[package]]+name = "nagare"+version = "0.6.1"+dependencies = [+ "bindings",+ "bon",+ "chrono",+ "futures",+ "hanashi",+ "indexmap 2.14.0",+ "keisoku",+ "nagare-macros",+ "reqwest 0.13.4",+ "schemars 1.2.1",+ "serde",+ "serde_json",+ "shoji",+ "thiserror 2.0.18",+ "tokenizers",+ "tokio",+ "tokio-util",+ "tracing",+ "uuid",+]++[[package]]+name = "nagare-macros"+version = "0.6.1"+dependencies = [+ "proc-macro-crate 3.5.0",+ "proc-macro2",+ "quote",+ "syn 2.0.118",+]++[[package]]+name = "ndk"+version = "0.9.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4"+dependencies = [+ "bitflags 2.13.0",+ "jni-sys 0.3.1",+ "log",+ "ndk-sys",+ "num_enum",+ "raw-window-handle",+ "thiserror 1.0.69",+]++[[package]]+name = "ndk-context"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b"++[[package]]+name = "ndk-sys"+version = "0.6.0+11769913"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873"+dependencies = [+ "jni-sys 0.3.1",+]++[[package]]+name = "new_debug_unreachable"+version = "1.0.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"++[[package]]+name = "no_std_io2"+version = "0.9.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "418abd1b6d34fbf6cae440dc874771b0525a604428704c76e48b29a5e67b8003"+dependencies = [+ "memchr",+]++[[package]]+name = "nom"+version = "7.1.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"+dependencies = [+ "memchr",+ "minimal-lexical",+]++[[package]]+name = "nom"+version = "8.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405"+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 = "notify-rust"+version = "4.18.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c5b4c1b4f2aa9f25f63a7a49d3dd0ed567b3670da15330a66b29434be899b891"+dependencies = [+ "futures-lite",+ "log",+ "mac-notification-sys",+ "serde",+ "tauri-winrt-notification",+ "zbus",+]++[[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 = "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-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.118",+]++[[package]]+name = "num-integer"+version = "0.1.46"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"+dependencies = [+ "num-traits",+]++[[package]]+name = "num-rational"+version = "0.4.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824"+dependencies = [+ "num-bigint",+ "num-integer",+ "num-traits",+]++[[package]]+name = "num-traits"+version = "0.2.19"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"+dependencies = [+ "autocfg",+ "libm",+]++[[package]]+name = "num_enum"+version = "0.7.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26"+dependencies = [+ "num_enum_derive",+ "rustversion",+]++[[package]]+name = "num_enum_derive"+version = "0.7.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8"+dependencies = [+ "proc-macro-crate 3.5.0",+ "proc-macro2",+ "quote",+ "syn 2.0.118",+]++[[package]]+name = "obfstr"+version = "0.4.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7cf5f1acbf6ef57cef9d127e72c4afd01d6b08692616fd09afad7f7807d6eb78"++[[package]]+name = "objc2"+version = "0.6.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3a12a8ed07aefc768292f076dc3ac8c48f3781c8f2d5851dd3d98950e8c5a89f"+dependencies = [+ "objc2-encode",+ "objc2-exception-helper",+]++[[package]]+name = "objc2-app-kit"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c"+dependencies = [+ "bitflags 2.13.0",+ "block2",+ "objc2",+ "objc2-core-foundation",+ "objc2-foundation",+ "objc2-quartz-core",+]++[[package]]+name = "objc2-audio-toolbox"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6948501a91121d6399b79abaa33a8aa4ea7857fe019f341b8c23ad6e81b79b08"+dependencies = [+ "bitflags 2.13.0",+ "libc",+ "objc2",+ "objc2-core-audio",+ "objc2-core-audio-types",+ "objc2-core-foundation",+ "objc2-foundation",+]++[[package]]+name = "objc2-avf-audio"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "13a380031deed8e99db00065c45937da434ca987c034e13b87e4441f9e4090be"+dependencies = [+ "objc2",+ "objc2-foundation",+]++[[package]]+name = "objc2-cloud-kit"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "73ad74d880bb43877038da939b7427bba67e9dd42004a18b809ba7d87cee241c"+dependencies = [+ "bitflags 2.13.0",+ "objc2",+ "objc2-foundation",+]++[[package]]+name = "objc2-core-audio"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e1eebcea8b0dbff5f7c8504f3107c68fc061a3eb44932051c8cf8a68d969c3b2"+dependencies = [+ "dispatch2",+ "objc2",+ "objc2-core-audio-types",+ "objc2-core-foundation",+ "objc2-foundation",+]++[[package]]+name = "objc2-core-audio-types"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5a89f2ec274a0cf4a32642b2991e8b351a404d290da87bb6a9a9d8632490bd1c"+dependencies = [+ "bitflags 2.13.0",+ "objc2",+]++[[package]]+name = "objc2-core-data"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0b402a653efbb5e82ce4df10683b6b28027616a2715e90009947d50b8dd298fa"+dependencies = [+ "objc2",+ "objc2-foundation",+]++[[package]]+name = "objc2-core-foundation"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536"+dependencies = [+ "bitflags 2.13.0",+ "block2",+ "dispatch2",+ "libc",+ "objc2",+]++[[package]]+name = "objc2-core-graphics"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807"+dependencies = [+ "bitflags 2.13.0",+ "dispatch2",+ "objc2",+ "objc2-core-foundation",+ "objc2-io-surface",+]++[[package]]+name = "objc2-core-image"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e5d563b38d2b97209f8e861173de434bd0214cf020e3423a52624cd1d989f006"+dependencies = [+ "objc2",+ "objc2-foundation",+]++[[package]]+name = "objc2-core-location"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ca347214e24bc973fc025fd0d36ebb179ff30536ed1f80252706db19ee452009"+dependencies = [+ "objc2",+ "objc2-foundation",+]++[[package]]+name = "objc2-core-text"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0cde0dfb48d25d2b4862161a4d5fcc0e3c24367869ad306b0c9ec0073bfed92d"+dependencies = [+ "bitflags 2.13.0",+ "objc2",+ "objc2-core-foundation",+ "objc2-core-graphics",+]++[[package]]+name = "objc2-encode"+version = "4.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33"++[[package]]+name = "objc2-exception-helper"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c7a1c5fbb72d7735b076bb47b578523aedc40f3c439bea6dfd595c089d79d98a"+dependencies = [+ "cc",+]++[[package]]+name = "objc2-foundation"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272"+dependencies = [+ "bitflags 2.13.0",+ "block2",+ "libc",+ "objc2",+ "objc2-core-foundation",+]++[[package]]+name = "objc2-io-kit"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "33fafba39597d6dc1fb709123dfa8289d39406734be322956a69f0931c73bb15"+dependencies = [+ "libc",+ "objc2-core-foundation",+]++[[package]]+name = "objc2-io-surface"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d"+dependencies = [+ "bitflags 2.13.0",+ "libc",+ "objc2",+ "objc2-core-foundation",+ "objc2-foundation",+]++[[package]]+name = "objc2-osa-kit"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f112d1746737b0da274ef79a23aac283376f335f4095a083a267a082f21db0c0"+dependencies = [+ "bitflags 2.13.0",+ "objc2",+ "objc2-app-kit",+ "objc2-foundation",+]++[[package]]+name = "objc2-quartz-core"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f"+dependencies = [+ "bitflags 2.13.0",+ "objc2",+ "objc2-core-foundation",+ "objc2-foundation",+]++[[package]]+name = "objc2-ui-kit"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d87d638e33c06f577498cbcc50491496a3ed4246998a7fbba7ccb98b1e7eab22"+dependencies = [+ "bitflags 2.13.0",+ "block2",+ "objc2",+ "objc2-cloud-kit",+ "objc2-core-data",+ "objc2-core-foundation",+ "objc2-core-graphics",+ "objc2-core-image",+ "objc2-core-location",+ "objc2-core-text",+ "objc2-foundation",+ "objc2-quartz-core",+ "objc2-user-notifications",+]++[[package]]+name = "objc2-user-notifications"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9df9128cbbfef73cda168416ccf7f837b62737d748333bfe9ab71c245d76613e"+dependencies = [+ "objc2",+ "objc2-foundation",+]++[[package]]+name = "objc2-web-kit"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b2e5aaab980c433cf470df9d7af96a7b46a9d892d521a2cbbb2f8a4c16751e7f"+dependencies = [+ "bitflags 2.13.0",+ "block2",+ "objc2",+ "objc2-app-kit",+ "objc2-core-foundation",+ "objc2-foundation",+]++[[package]]+name = "once_cell"+version = "1.21.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"+dependencies = [+ "portable-atomic",+]++[[package]]+name = "once_cell_polyfill"+version = "1.70.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe"++[[package]]+name = "openai-harmony"+version = "0.0.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e77e82af451fc95deeb728a40b84db8ee82d341e136c268de415123a560b9b72"+dependencies = [+ "anyhow",+ "base64 0.22.1",+ "bstr",+ "clap",+ "fancy-regex 0.13.0",+ "futures",+ "image",+ "regex",+ "reqwest 0.12.28",+ "rustc-hash 1.1.0",+ "serde",+ "serde_json",+ "serde_with",+ "sha1",+ "sha2",+ "thiserror 2.0.18",+]++[[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-stream"+version = "0.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50"+dependencies = [+ "futures-core",+ "pin-project-lite",+]++[[package]]+name = "osakit"+version = "0.3.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "732c71caeaa72c065bb69d7ea08717bd3f4863a4f451402fc9513e29dbd5261b"+dependencies = [+ "objc2",+ "objc2-foundation",+ "objc2-osa-kit",+ "serde",+ "serde_json",+ "thiserror 2.0.18",+]++[[package]]+name = "pango"+version = "0.18.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7ca27ec1eb0457ab26f3036ea52229edbdb74dee1edd29063f5b9b010e7ebee4"+dependencies = [+ "gio",+ "glib",+ "libc",+ "once_cell",+ "pango-sys",+]++[[package]]+name = "pango-sys"+version = "0.18.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "436737e391a843e5933d6d9aa102cb126d501e815b83601365a948a518555dc5"+dependencies = [+ "glib-sys",+ "gobject-sys",+ "libc",+ "system-deps",+]++[[package]]+name = "parking"+version = "2.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba"++[[package]]+name = "parking_lot"+version = "0.12.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a"+dependencies = [+ "lock_api",+ "parking_lot_core",+]++[[package]]+name = "parking_lot_core"+version = "0.9.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1"+dependencies = [+ "cfg-if",+ "libc",+ "redox_syscall",+ "smallvec",+ "windows-link 0.2.1",+]++[[package]]+name = "paste"+version = "1.0.15"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"++[[package]]+name = "pastey"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "35fb2e5f958ec131621fdd531e9fc186ed768cbe395337403ae56c17a74c68ec"++[[package]]+name = "percent-encoding"+version = "2.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"++[[package]]+name = "phf"+version = "0.13.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf"+dependencies = [+ "phf_macros",+ "phf_shared",+ "serde",+]++[[package]]+name = "phf_codegen"+version = "0.13.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "49aa7f9d80421bca176ca8dbfebe668cc7a2684708594ec9f3c0db0805d5d6e1"+dependencies = [+ "phf_generator",+ "phf_shared",+]++[[package]]+name = "phf_generator"+version = "0.13.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737"+dependencies = [+ "fastrand",+ "phf_shared",+]++[[package]]+name = "phf_macros"+version = "0.13.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "812f032b54b1e759ccd5f8b6677695d5268c588701effba24601f6932f8269ef"+dependencies = [+ "phf_generator",+ "phf_shared",+ "proc-macro2",+ "quote",+ "syn 2.0.118",+]++[[package]]+name = "phf_shared"+version = "0.13.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266"+dependencies = [+ "siphasher",+]++[[package]]+name = "pin-project-lite"+version = "0.2.17"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"++[[package]]+name = "piper"+version = "0.2.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c835479a4443ded371d6c535cbfd8d31ad92c5d23ae9770a61bc155e4992a3c1"+dependencies = [+ "atomic-waker",+ "fastrand",+ "futures-io",+]++[[package]]+name = "pkg-config"+version = "0.3.33"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "19f132c84eca552bf34cab8ec81f1c1dcc229b811638f9d283dceabe58c5569e"++[[package]]+name = "plist"+version = "1.10.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7da1d65da6dd5d1e44199ac0f58712d241c0f439f80adea8924d832384087f85"+dependencies = [+ "base64 0.22.1",+ "indexmap 2.14.0",+ "quick-xml",+ "serde",+ "time",+]++[[package]]+name = "png"+version = "0.17.16"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "82151a2fc869e011c153adc57cf2789ccb8d9906ce52c0b39a6b5697749d7526"+dependencies = [+ "bitflags 1.3.2",+ "crc32fast",+ "fdeflate",+ "flate2",+ "miniz_oxide",+]++[[package]]+name = "png"+version = "0.18.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61"+dependencies = [+ "bitflags 2.13.0",+ "crc32fast",+ "fdeflate",+ "flate2",+ "miniz_oxide",+]++[[package]]+name = "polling"+version = "3.11.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218"+dependencies = [+ "cfg-if",+ "concurrent-queue",+ "hermit-abi",+ "pin-project-lite",+ "rustix",+ "windows-sys 0.61.2",+]++[[package]]+name = "portable-atomic"+version = "1.13.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49"++[[package]]+name = "potential_utf"+version = "0.1.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564"+dependencies = [+ "zerovec",+]++[[package]]+name = "powerfmt"+version = "0.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"++[[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 = "prettyplease"+version = "0.2.37"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"+dependencies = [+ "proc-macro2",+ "syn 2.0.118",+]++[[package]]+name = "prettyplease"+version = "0.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2bfe0f4c752e450fc2faf62654f1c134747922825d5b04ca717b8874f41a40c0"+dependencies = [+ "proc-macro2",+ "syn 3.0.3",+]++[[package]]+name = "proc-macro-crate"+version = "1.3.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919"+dependencies = [+ "once_cell",+ "toml_edit 0.19.15",+]++[[package]]+name = "proc-macro-crate"+version = "2.0.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b00f26d3400549137f92511a46ac1cd8ce37cb5598a96d382381458b992a5d24"+dependencies = [+ "toml_datetime 0.6.3",+ "toml_edit 0.20.2",+]++[[package]]+name = "proc-macro-crate"+version = "3.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f"+dependencies = [+ "toml_edit 0.25.12+spec-1.1.0",+]++[[package]]+name = "proc-macro-error"+version = "1.0.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"+dependencies = [+ "proc-macro-error-attr",+ "proc-macro2",+ "quote",+ "syn 1.0.109",+ "version_check",+]++[[package]]+name = "proc-macro-error-attr"+version = "1.0.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"+dependencies = [+ "proc-macro2",+ "quote",+ "version_check",+]++[[package]]+name = "proc-macro2"+version = "1.0.106"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"+dependencies = [+ "unicode-ident",+]++[[package]]+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.118",+]++[[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 = "2.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3"++[[package]]+name = "quick-xml"+version = "0.41.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e660451e55124f798a69a5af3f49ccfbefbd41910eefd25caf2393e1f3473ec1"+dependencies = [+ "memchr",+]++[[package]]+name = "quinn"+version = "0.11.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0c1a41e437b6bbd489372cd4971de128e85c855f56c57f283d20ff016cf7c0a8"+dependencies = [+ "bytes",+ "cfg_aliases",+ "pin-project-lite",+ "quinn-proto",+ "quinn-udp",+ "rustc-hash 2.1.3",+ "rustls",+ "socket2",+ "thiserror 2.0.18",+ "tokio",+ "tracing",+ "web-time",+]++[[package]]+name = "quinn-proto"+version = "0.11.16"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2f4bfc015262b9df63c8845072ce59068853ff5872180c2ce2f13038b970e560"+dependencies = [+ "aws-lc-rs",+ "bytes",+ "getrandom 0.4.3",+ "lru-slab",+ "rand 0.10.2",+ "rand_pcg",+ "ring",+ "rustc-hash 2.1.3",+ "rustls",+ "rustls-pki-types",+ "slab",+ "thiserror 2.0.18",+ "tinyvec",+ "tracing",+ "web-time",+]++[[package]]+name = "quinn-udp"+version = "0.5.15"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "35a133f956daabe89a61a685c2649f13d82d5aa4bd5d12d1277e1072a21c0694"+dependencies = [+ "cfg_aliases",+ "libc",+ "once_cell",+ "socket2",+ "tracing",+ "windows-sys 0.61.2",+]++[[package]]+name = "quote"+version = "1.0.46"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "dfbc457d0c7a0759a614551b11a6409e5951f6c7537be1f1b7682b9ae9230368"+dependencies = [+ "proc-macro2",+]++[[package]]+name = "r-efi"+version = "5.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"++[[package]]+name = "r-efi"+version = "6.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"++[[package]]+name = "rand"+version = "0.8.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5ca0ecfa931c29007047d1bc58e623ab12e5590e8c7cc53200d5202b69266d8a"+dependencies = [+ "libc",+ "rand_chacha 0.3.1",+ "rand_core 0.6.4",+]++[[package]]+name = "rand"+version = "0.9.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "44c5af06bb1b7d3216d91932aed5265164bf384dc89cd6ba05cf59a35f5f76ea"+dependencies = [+ "rand_chacha 0.9.0",+ "rand_core 0.9.5",+]++[[package]]+name = "rand"+version = "0.10.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c7f5fa3a058cd35567ef9bfa5e75732bee0f9e4c55fa90477bef2dfcdbc4be80"+dependencies = [+ "chacha20",+ "getrandom 0.4.3",+ "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]]+name = "rand_core"+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 = "rangemap"+version = "1.7.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "973443cf09a9c8656b574a866ab68dfa19f0867d0340648c7d2f6a71b8a8ea68"++[[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",+ "libc",+ "libfuzzer-sys",+ "log",+ "maybe-rayon",+ "new_debug_unreachable",+ "noop_proc_macro",+ "num-derive",+ "num-traits",+ "paste",+ "profiling",+ "rand 0.9.4",+ "rand_chacha 0.9.0",+ "simd_helpers",+ "thiserror 2.0.18",+ "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",+ "rav1e",+ "rayon",+ "rgb",+]++[[package]]+name = "raw-window-handle"+version = "0.6.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539"++[[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-cond"+version = "0.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2964d0cf57a3e7a06e8183d14a8b527195c706b7983549cd5462d5aa3747438f"+dependencies = [+ "either",+ "itertools",+ "rayon",+]++[[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 = "redox_syscall"+version = "0.5.18"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d"+dependencies = [+ "bitflags 2.13.0",+]++[[package]]+name = "redox_users"+version = "0.4.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43"+dependencies = [+ "getrandom 0.2.17",+ "libredox",+ "thiserror 1.0.69",+]++[[package]]+name = "redox_users"+version = "0.5.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac"+dependencies = [+ "getrandom 0.2.17",+ "libredox",+ "thiserror 2.0.18",+]++[[package]]+name = "ref-cast"+version = "1.0.25"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f354300ae66f76f1c85c5f84693f0ce81d747e2c3f21a45fef496d89c960bf7d"+dependencies = [+ "ref-cast-impl",+]++[[package]]+name = "ref-cast-impl"+version = "1.0.25"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.118",+]++[[package]]+name = "regex"+version = "1.12.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f1292b7759ae1cb9ec195452d1390a074f0cd8541ab7a5a8c31cd6db45d4a6ba"+dependencies = [+ "aho-corasick",+ "memchr",+ "regex-automata",+ "regex-syntax",+]++[[package]]+name = "regex-automata"+version = "0.4.14"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f"+dependencies = [+ "aho-corasick",+ "memchr",+ "regex-syntax",+]++[[package]]+name = "regex-syntax"+version = "0.8.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"++[[package]]+name = "reqwest"+version = "0.12.28"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147"+dependencies = [+ "base64 0.22.1",+ "bytes",+ "futures-channel",+ "futures-core",+ "futures-util",+ "http",+ "http-body",+ "http-body-util",+ "hyper",+ "hyper-rustls",+ "hyper-util",+ "js-sys",+ "log",+ "mime_guess",+ "percent-encoding",+ "pin-project-lite",+ "quinn",+ "rustls",+ "rustls-native-certs",+ "rustls-pki-types",+ "serde",+ "serde_json",+ "serde_urlencoded",+ "sync_wrapper",+ "tokio",+ "tokio-rustls",+ "tokio-util",+ "tower",+ "tower-http",+ "tower-service",+ "url",+ "wasm-bindgen",+ "wasm-bindgen-futures",+ "wasm-streams 0.4.2",+ "web-sys",+ "webpki-roots",+]++[[package]]+name = "reqwest"+version = "0.13.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "219c5811de6525e5416c7d5d53bb656d3afdbc6c5af816e0802bcfa42dbdc1c3"+dependencies = [+ "base64 0.22.1",+ "bytes",+ "encoding_rs",+ "futures-channel",+ "futures-core",+ "futures-util",+ "h2",+ "http",+ "http-body",+ "http-body-util",+ "hyper",+ "hyper-rustls",+ "hyper-util",+ "js-sys",+ "log",+ "mime",+ "percent-encoding",+ "pin-project-lite",+ "quinn",+ "rustls",+ "rustls-pki-types",+ "rustls-platform-verifier",+ "serde",+ "serde_json",+ "serde_urlencoded",+ "sync_wrapper",+ "tokio",+ "tokio-rustls",+ "tokio-util",+ "tower",+ "tower-http",+ "tower-service",+ "url",+ "wasm-bindgen",+ "wasm-bindgen-futures",+ "wasm-streams 0.5.0",+ "web-sys",+]++[[package]]+name = "reqwest-eventsource"+version = "0.6.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "632c55746dbb44275691640e7b40c907c16a2dc1a5842aa98aaec90da6ec6bde"+dependencies = [+ "eventsource-stream",+ "futures-core",+ "futures-timer",+ "mime",+ "nom 7.1.3",+ "pin-project-lite",+ "reqwest 0.12.28",+ "thiserror 1.0.69",+]++[[package]]+name = "rfd"+version = "0.16.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a15ad77d9e70a92437d8f74c35d99b4e4691128df018833e99f90bcd36152672"+dependencies = [+ "block2",+ "dispatch2",+ "glib-sys",+ "gobject-sys",+ "gtk-sys",+ "js-sys",+ "log",+ "objc2",+ "objc2-app-kit",+ "objc2-core-foundation",+ "objc2-foundation",+ "raw-window-handle",+ "wasm-bindgen",+ "wasm-bindgen-futures",+ "web-sys",+ "windows-sys 0.60.2",+]++[[package]]+name = "rgb"+version = "0.8.53"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "47b34b781b31e5d73e9fbc8689c70551fd1ade9a19e3e28cfec8580a79290cc4"++[[package]]+name = "rhai"+version = "1.25.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "dd4dd0f8c36625202a4ba553c416c19b719947cd2a31d1bda06126e4a5727daf"+dependencies = [+ "ahash",+ "bitflags 2.13.0",+ "num-traits",+ "once_cell",+ "rhai_codegen",+ "smallvec",+ "smartstring",+ "thin-vec",+ "web-time",+]++[[package]]+name = "rhai_codegen"+version = "3.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3cd3a7535e50bf36857e7be7bec276d334e8c2dfa469c2201226fd01638ea5ca"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.118",+]++[[package]]+name = "ring"+version = "0.17.14"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7"+dependencies = [+ "cc",+ "cfg-if",+ "getrandom 0.2.17",+ "libc",+ "untrusted",+ "windows-sys 0.52.0",+]++[[package]]+name = "rodio"+version = "0.22.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d0a536bb79db59098ef71a4dd4246c02eb87b316deceb1b68e0cde7167ec01eb"+dependencies = [+ "cpal",+ "dasp_sample",+ "num-rational",+ "symphonia",+ "thiserror 2.0.18",+]++[[package]]+name = "rustc-hash"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"++[[package]]+name = "rustc-hash"+version = "2.1.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d"++[[package]]+name = "rustc_version"+version = "0.4.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92"+dependencies = [+ "semver",+]++[[package]]+name = "rustix"+version = "1.1.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190"+dependencies = [+ "bitflags 2.13.0",+ "errno",+ "libc",+ "linux-raw-sys",+ "windows-sys 0.61.2",+]++[[package]]+name = "rustls"+version = "0.23.45"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0d41d731c7d2f962d1ccc364cec258de3c0e93b38c2fb3ba97ac74513048d634"+dependencies = [+ "aws-lc-rs",+ "once_cell",+ "ring",+ "rustls-pki-types",+ "rustls-webpki",+ "subtle",+ "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-pki-types"+version = "1.15.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "764899a24af3980067ee14bc143654f297b22eaebfe3c7b6b211920a5a59b046"+dependencies = [+ "web-time",+ "zeroize",+]++[[package]]+name = "rustls-platform-verifier"+version = "0.7.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "26d1e2536ce4f35f4846aa13bff16bd0ff40157cdb14cc056c7b14ba41233ba0"+dependencies = [+ "core-foundation 0.10.1",+ "core-foundation-sys",+ "jni 0.22.4",+ "log",+ "once_cell",+ "rustls",+ "rustls-native-certs",+ "rustls-platform-verifier-android",+ "rustls-webpki",+ "security-framework",+ "security-framework-sys",+ "webpki-root-certs",+ "windows-sys 0.61.2",+]++[[package]]+name = "rustls-platform-verifier-android"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f"++[[package]]+name = "rustls-webpki"+version = "0.103.15"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f3c3cf1d8b1e7d4927e2d154c3fcb02979afb9939629c62cd9048d4f07b60ac2"+dependencies = [+ "aws-lc-rs",+ "ring",+ "rustls-pki-types",+ "untrusted",+]++[[package]]+name = "rustversion"+version = "1.0.22"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"++[[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"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"+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 = "0.8.22"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3fbf2ae1b8bc8e02df939598064d22402220cd5bbcca1c76f7d6a310974d5615"+dependencies = [+ "dyn-clone",+ "indexmap 1.9.3",+ "schemars_derive 0.8.22",+ "serde",+ "serde_json",+ "url",+ "uuid",+]++[[package]]+name = "schemars"+version = "0.9.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f"+dependencies = [+ "dyn-clone",+ "ref-cast",+ "serde",+ "serde_json",+]++[[package]]+name = "schemars"+version = "1.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a2b42f36aa1cd011945615b92222f6bf73c599a102a300334cd7f8dbeec726cc"+dependencies = [+ "dyn-clone",+ "ref-cast",+ "schemars_derive 1.2.1",+ "serde",+ "serde_json",+]++[[package]]+name = "schemars_derive"+version = "0.8.22"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "32e265784ad618884abaea0600a9adf15393368d840e0222d101a072f3f7534d"+dependencies = [+ "proc-macro2",+ "quote",+ "serde_derive_internals",+ "syn 2.0.118",+]++[[package]]+name = "schemars_derive"+version = "1.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7d115b50f4aaeea07e79c1912f645c7513d81715d0420f8bc77a18c6260b307f"+dependencies = [+ "proc-macro2",+ "quote",+ "serde_derive_internals",+ "syn 2.0.118",+]++[[package]]+name = "scopeguard"+version = "1.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"++[[package]]+name = "secrecy"+version = "0.10.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e891af845473308773346dc847b2c23ee78fe442e0472ac50e22a18a93d3ae5a"+dependencies = [+ "serde",+ "zeroize",+]++[[package]]+name = "security-framework"+version = "3.7.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d"+dependencies = [+ "bitflags 2.13.0",+ "core-foundation 0.10.1",+ "core-foundation-sys",+ "libc",+ "security-framework-sys",+]++[[package]]+name = "security-framework-sys"+version = "2.17.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3"+dependencies = [+ "core-foundation-sys",+ "libc",+]++[[package]]+name = "selectors"+version = "0.38.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8adfa1c298912827b8a28b223b3b874357397ae706e6190acd9bf28cee99114d"+dependencies = [+ "bitflags 2.13.0",+ "cssparser",+ "derive_more",+ "log",+ "new_debug_unreachable",+ "phf",+ "phf_codegen",+ "precomputed-hash",+ "rustc-hash 2.1.3",+ "servo_arc",+ "smallvec",+]++[[package]]+name = "semver"+version = "1.0.28"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd"+dependencies = [+ "serde",+ "serde_core",+]++[[package]]+name = "serde"+version = "1.0.228"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"+dependencies = [+ "serde_core",+ "serde_derive",+]++[[package]]+name = "serde-untagged"+version = "0.1.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f9faf48a4a2d2693be24c6289dbe26552776eb7737074e6722891fadbe6c5058"+dependencies = [+ "erased-serde",+ "serde",+ "serde_core",+ "typeid",+]++[[package]]+name = "serde_core"+version = "1.0.228"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"+dependencies = [+ "serde_derive",+]++[[package]]+name = "serde_derive"+version = "1.0.228"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.118",+]++[[package]]+name = "serde_derive_internals"+version = "0.29.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.118",+]++[[package]]+name = "serde_json"+version = "1.0.150"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e8014e44b4736ed0538adeecded0fce2a272f22dc9578a7eb6b2d9993c74cfb9"+dependencies = [+ "indexmap 2.14.0",+ "itoa",+ "memchr",+ "serde",+ "serde_core",+ "zmij",+]++[[package]]+name = "serde_repr"+version = "0.1.20"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "175ee3e80ae9982737ca543e96133087cbd9a485eecc3bc4de9c1a37b47ea59c"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.118",+]++[[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"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26"+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 = "serde_with"+version = "3.21.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "76a5c54c7310e7b8b9577c286d7e399ddd876c3e12b3ed917a8aabc4b96e9e8c"+dependencies = [+ "base64 0.22.1",+ "bs58",+ "chrono",+ "hex",+ "indexmap 1.9.3",+ "indexmap 2.14.0",+ "schemars 0.9.0",+ "schemars 1.2.1",+ "serde_core",+ "serde_json",+ "serde_with_macros",+ "time",+]++[[package]]+name = "serde_with_macros"+version = "3.21.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "84d57bc0c8b9a17920c178daa6bb924850d54a9c97ab45194bb8c17ad66bb660"+dependencies = [+ "darling 0.23.0",+ "proc-macro2",+ "quote",+ "syn 2.0.118",+]++[[package]]+name = "serialize-to-javascript"+version = "0.1.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "04f3666a07a197cdb77cdf306c32be9b7f598d7060d50cfd4d5aa04bfd92f6c5"+dependencies = [+ "serde",+ "serde_json",+ "serialize-to-javascript-impl",+]++[[package]]+name = "serialize-to-javascript-impl"+version = "0.1.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "772ee033c0916d670af7860b6e1ef7d658a4629a6d0b4c8c3e67f09b3765b75d"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.118",+]++[[package]]+name = "servo_arc"+version = "0.4.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "170fb83ab34de17dc69aa7c67482b22218ddb85da56546f9bd6b929e32a05930"+dependencies = [+ "stable_deref_trait",+]++[[package]]+name = "sha1"+version = "0.10.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba"+dependencies = [+ "cfg-if",+ "cpufeatures 0.2.17",+ "digest",+]++[[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",+]++[[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 = "shlex"+version = "2.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"++[[package]]+name = "shoji"+version = "0.6.1"+dependencies = [+ "bindings",+ "futures",+ "hound",+ "indexmap 2.14.0",+ "serde",+ "serde_json",+ "thiserror 2.0.18",+ "tokenizers",+ "tokio-util",+]++[[package]]+name = "signal-hook-registry"+version = "1.4.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b"+dependencies = [+ "errno",+ "libc",+]++[[package]]+name = "simd-adler32"+version = "0.3.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214"++[[package]]+name = "simd_cesu8"+version = "1.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "94f90157bb87cddf702797c5dadfa0be7d266cdf49e22da2fcaa32eff75b2c33"+dependencies = [+ "rustc_version",+ "simdutf8",+]++[[package]]+name = "simd_helpers"+version = "0.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "95890f873bec569a0362c235787f3aca6e1e887302ba4840839bcc6459c42da6"+dependencies = [+ "quote",+]++[[package]]+name = "simdutf8"+version = "0.1.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e"++[[package]]+name = "siphasher"+version = "1.0.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8ee5873ec9cce0195efcb7a4e9507a04cd49aec9c83d0389df45b1ef7ba2e649"++[[package]]+name = "slab"+version = "0.4.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"++[[package]]+name = "smallvec"+version = "1.15.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90"++[[package]]+name = "smartstring"+version = "1.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3fb72c633efbaa2dd666986505016c32c3044395ceaf881518399d2f4127ee29"+dependencies = [+ "autocfg",+ "static_assertions",+ "version_check",+]++[[package]]+name = "socket2"+version = "0.6.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "52d1cfed4120b4d927bf7c0f86d2087a4a7d6027c906d9f9d525a80573b9be51"+dependencies = [+ "libc",+ "windows-sys 0.61.2",+]++[[package]]+name = "softbuffer"+version = "0.4.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "aac18da81ebbf05109ab275b157c22a653bb3c12cf884450179942f81bcbf6c3"+dependencies = [+ "bytemuck",+ "js-sys",+ "ndk",+ "objc2",+ "objc2-core-foundation",+ "objc2-core-graphics",+ "objc2-foundation",+ "objc2-quartz-core",+ "raw-window-handle",+ "redox_syscall",+ "tracing",+ "wasm-bindgen",+ "web-sys",+ "windows-sys 0.61.2",+]++[[package]]+name = "soup3"+version = "0.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "471f924a40f31251afc77450e781cb26d55c0b650842efafc9c6cbd2f7cc4f9f"+dependencies = [+ "futures-channel",+ "gio",+ "glib",+ "libc",+ "soup3-sys",+]++[[package]]+name = "soup3-sys"+version = "0.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7ebe8950a680a12f24f15ebe1bf70db7af98ad242d9db43596ad3108aab86c27"+dependencies = [+ "gio-sys",+ "glib-sys",+ "gobject-sys",+ "libc",+ "system-deps",+]++[[package]]+name = "spm_precompiled"+version = "0.1.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5851699c4033c63636f7ea4cf7b7c1f1bf06d0cc03cfb42e711de5a5c46cf326"+dependencies = [+ "base64 0.13.1",+ "nom 7.1.3",+ "serde",+ "unicode-segmentation",+]++[[package]]+name = "stable_deref_trait"+version = "1.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"++[[package]]+name = "static_assertions"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"++[[package]]+name = "string_cache"+version = "0.9.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a18596f8c785a729f2819c0f6a7eae6ebeebdfffbfe4214ae6b087f690e31901"+dependencies = [+ "new_debug_unreachable",+ "parking_lot",+ "phf_shared",+ "precomputed-hash",+]++[[package]]+name = "string_cache_codegen"+version = "0.6.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "585635e46db231059f76c5849798146164652513eb9e8ab2685939dd90f29b69"+dependencies = [+ "phf_generator",+ "phf_shared",+ "proc-macro2",+ "quote",+]++[[package]]+name = "strsim"+version = "0.11.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"++[[package]]+name = "subtle"+version = "2.6.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"++[[package]]+name = "swift-rs"+version = "1.0.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e45c444e496845d3f2a351146bff59aae4975b2280238df1dfaa0c7d1846f38e"+dependencies = [+ "base64 0.21.7",+ "serde",+ "serde_json",+]++[[package]]+name = "symlink"+version = "0.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a7973cce6668464ea31f176d85b13c7ab3bba2cb3b77a2ed26abd7801688010a"++[[package]]+name = "symphonia"+version = "0.5.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5773a4c030a19d9bfaa090f49746ff35c75dfddfa700df7a5939d5e076a57039"+dependencies = [+ "lazy_static",+ "symphonia-codec-pcm",+ "symphonia-core",+ "symphonia-format-riff",+ "symphonia-metadata",+]++[[package]]+name = "symphonia-codec-pcm"+version = "0.5.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4e89d716c01541ad3ebe7c91ce4c8d38a7cf266a3f7b2f090b108fb0cb031d95"+dependencies = [+ "log",+ "symphonia-core",+]++[[package]]+name = "symphonia-core"+version = "0.5.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ea00cc4f79b7f6bb7ff87eddc065a1066f3a43fe1875979056672c9ef948c2af"+dependencies = [+ "arrayvec",+ "bitflags 1.3.2",+ "bytemuck",+ "lazy_static",+ "log",+]++[[package]]+name = "symphonia-format-riff"+version = "0.5.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c2d7c3df0e7d94efb68401d81906eae73c02b40d5ec1a141962c592d0f11a96f"+dependencies = [+ "extended",+ "log",+ "symphonia-core",+ "symphonia-metadata",+]++[[package]]+name = "symphonia-metadata"+version = "0.5.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "36306ff42b9ffe6e5afc99d49e121e0bd62fe79b9db7b9681d48e29fa19e6b16"+dependencies = [+ "encoding_rs",+ "lazy_static",+ "log",+ "symphonia-core",+]++[[package]]+name = "syn"+version = "1.0.109"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"+dependencies = [+ "proc-macro2",+ "unicode-ident",+]++[[package]]+name = "syn"+version = "2.0.118"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1b9ae57f904213ebb649ce6895b8a66c66f0203b9319718f69a5612a065b1422"+dependencies = [+ "proc-macro2",+ "quote",+ "unicode-ident",+]++[[package]]+name = "syn"+version = "3.0.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "53e9bae58849f64dfa4f5d5ae372c8341f7305f82a3868709269343628b659a3"+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.13.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.118",+]++[[package]]+name = "sysinfo"+version = "0.38.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "92ab6a2f8bfe508deb3c6406578252e491d299cbbf3bc0529ecc3313aee4a52f"+dependencies = [+ "libc",+ "memchr",+ "ntapi",+ "objc2-core-foundation",+ "objc2-io-kit",+ "windows 0.62.2",+]++[[package]]+name = "system-configuration"+version = "0.7.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b"+dependencies = [+ "bitflags 2.13.0",+ "core-foundation 0.9.4",+ "system-configuration-sys",+]++[[package]]+name = "system-configuration-sys"+version = "0.6.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4"+dependencies = [+ "core-foundation-sys",+ "libc",+]++[[package]]+name = "system-deps"+version = "6.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a3e535eb8dded36d55ec13eddacd30dec501792ff23a0b1682c38601b8cf2349"+dependencies = [+ "cfg-expr",+ "heck 0.5.0",+ "pkg-config",+ "toml 0.8.2",+ "version-compare",+]++[[package]]+name = "tao"+version = "0.37.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f37f381f4e048e6cdf038b5705f8cf14ad108279d46eb968140a7b291aba9400"+dependencies = [+ "bitflags 2.13.0",+ "block2",+ "core-foundation 0.10.1",+ "core-graphics",+ "crossbeam-channel",+ "dbus",+ "dispatch2",+ "dlopen2",+ "dpi",+ "gdkwayland-sys",+ "gdkx11-sys",+ "gtk",+ "jni 0.21.1",+ "libc",+ "log",+ "ndk",+ "ndk-context",+ "ndk-sys",+ "objc2",+ "objc2-app-kit",+ "objc2-foundation",+ "objc2-ui-kit",+ "parking_lot",+ "percent-encoding",+ "raw-window-handle",+ "tao-macros",+ "unicode-segmentation",+ "url",+ "windows 0.62.2",+ "windows-core 0.62.2",+ "windows-version",+ "x11-dl",+]++[[package]]+name = "tao-macros"+version = "0.1.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5f7eeb6d99155545da6150a1795945f16ac9c178deb2a5f2e74d776107bd5849"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.118",+]++[[package]]+name = "tar"+version = "0.4.46"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3f6221d9a6003c78398e3b239969f352578258df48c8eb051caadae0015bc840"+dependencies = [+ "filetime",+ "libc",+ "xattr",+]++[[package]]+name = "target-lexicon"+version = "0.12.16"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"++[[package]]+name = "tauri"+version = "2.12.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ed99ee9694a2deb776d91cae48ac7411ddfc89ecae2f9b5041111d8c88f2ace9"+dependencies = [+ "anyhow",+ "bytes",+ "cookie",+ "dirs 7.0.0",+ "dunce",+ "embed_plist",+ "getrandom 0.3.4",+ "glob",+ "gtk",+ "heck 0.5.0",+ "http",+ "jni 0.21.1",+ "libc",+ "log",+ "mime",+ "muda",+ "objc2",+ "objc2-app-kit",+ "objc2-foundation",+ "objc2-ui-kit",+ "objc2-web-kit",+ "percent-encoding",+ "plist",+ "raw-window-handle",+ "reqwest 0.13.4",+ "serde",+ "serde_json",+ "serde_repr",+ "serialize-to-javascript",+ "swift-rs",+ "tauri-build",+ "tauri-macros",+ "tauri-runtime",+ "tauri-runtime-wry",+ "tauri-utils",+ "thiserror 2.0.18",+ "tokio",+ "tray-icon",+ "url",+ "webkit2gtk",+ "webview2-com",+ "window-vibrancy",+ "windows 0.62.2",+]++[[package]]+name = "tauri-build"+version = "2.7.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "59563ca5b331fd97f27ee9672ec8d36d33bb3c9e2c9f6710a1a5687256052e45"+dependencies = [+ "anyhow",+ "cargo_toml",+ "dirs 7.0.0",+ "glob",+ "heck 0.5.0",+ "json-patch",+ "schemars 0.8.22",+ "semver",+ "serde",+ "serde_json",+ "tauri-utils",+ "tauri-winres",+ "walkdir",+]++[[package]]+name = "tauri-codegen"+version = "2.7.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e50213e463086ecc283d7e9f51c30cc0fd304ad457425158018be26dbf0d0a80"+dependencies = [+ "base64 0.22.1",+ "brotli",+ "ico",+ "json-patch",+ "plist",+ "png 0.18.1",+ "proc-macro2",+ "quote",+ "semver",+ "serde",+ "serde_json",+ "sha2",+ "syn 2.0.118",+ "tauri-utils",+ "thiserror 2.0.18",+ "time",+ "url",+ "uuid",+ "walkdir",+]++[[package]]+name = "tauri-macros"+version = "2.7.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8129fb43bb6e0d6b73ad3315cd172beaab17cd28899c594b1b32c80edbbfd99c"+dependencies = [+ "heck 0.5.0",+ "proc-macro2",+ "quote",+ "syn 2.0.118",+ "tauri-codegen",+ "tauri-utils",+]++[[package]]+name = "tauri-plugin"+version = "2.7.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1140cf34a3b3b836a13103dcab17f18831d5cc3534cbd435dc01a5c6daa65aa2"+dependencies = [+ "anyhow",+ "glob",+ "plist",+ "schemars 0.8.22",+ "serde",+ "serde_json",+ "tauri-utils",+ "walkdir",+]++[[package]]+name = "tauri-plugin-autostart"+version = "2.5.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "459383cebc193cdd03d1ba4acc40f2c408a7abce419d64bdcd2d745bc2886f70"+dependencies = [+ "auto-launch",+ "serde",+ "serde_json",+ "tauri",+ "tauri-plugin",+ "thiserror 2.0.18",+]++[[package]]+name = "tauri-plugin-dialog"+version = "2.8.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "daf9a5c92e39bdd84f22f6be9230e39d0c4e140345f71ffe6058dca4f71127cf"+dependencies = [+ "log",+ "raw-window-handle",+ "rfd",+ "serde",+ "serde_json",+ "tauri",+ "tauri-plugin",+ "tauri-plugin-fs",+ "thiserror 2.0.18",+ "url",+]++[[package]]+name = "tauri-plugin-fs"+version = "2.6.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "466eb32466fe5021b6728b06862f9ff14a9f7e1af890047654e03a96d7c0e1bb"+dependencies = [+ "anyhow",+ "dunce",+ "glob",+ "log",+ "objc2-foundation",+ "percent-encoding",+ "schemars 0.8.22",+ "serde",+ "serde_json",+ "serde_repr",+ "tauri",+ "tauri-plugin",+ "tauri-utils",+ "thiserror 2.0.18",+ "toml 1.1.2+spec-1.1.0",+ "url",+]++[[package]]+name = "tauri-plugin-global-shortcut"+version = "2.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b4dd9f4c5136c09cd962da0c86dc4accd4666db2ea591cf16e6597435843bd2b"+dependencies = [+ "global-hotkey",+ "log",+ "serde",+ "serde_json",+ "tauri",+ "tauri-plugin",+ "thiserror 2.0.18",+]++[[package]]+name = "tauri-plugin-notification"+version = "2.3.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "01fc2c5ff41105bd1f7242d8201fdf3efd70749b82fa013a17f2126357d194cc"+dependencies = [+ "log",+ "notify-rust",+ "rand 0.9.4",+ "serde",+ "serde_json",+ "serde_repr",+ "tauri",+ "tauri-plugin",+ "thiserror 2.0.18",+ "time",+ "url",+]++[[package]]+name = "tauri-plugin-updater"+version = "2.10.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "806d9dac662c2e4594ff03c647a552f2c9bd544e7d0f683ec58f872f952ce4af"+dependencies = [+ "base64 0.22.1",+ "dirs 6.0.0",+ "flate2",+ "futures-util",+ "http",+ "infer 0.19.0",+ "log",+ "minisign-verify",+ "osakit",+ "percent-encoding",+ "reqwest 0.13.4",+ "rustls",+ "semver",+ "serde",+ "serde_json",+ "tar",+ "tauri",+ "tauri-plugin",+ "tempfile",+ "thiserror 2.0.18",+ "time",+ "tokio",+ "url",+ "windows-sys 0.60.2",+ "zip",+]++[[package]]+name = "tauri-runtime"+version = "2.12.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c2a57a2a9b8c8b7fc00d35b510fe808ded7f9f1b44fc1cdda6aee38632ea5413"+dependencies = [+ "cookie",+ "dpi",+ "gtk",+ "http",+ "jni 0.21.1",+ "objc2",+ "objc2-ui-kit",+ "objc2-web-kit",+ "raw-window-handle",+ "serde",+ "serde_json",+ "tauri-utils",+ "thiserror 2.0.18",+ "url",+ "webkit2gtk",+ "webview2-com",+ "windows 0.62.2",+]++[[package]]+name = "tauri-runtime-wry"+version = "2.12.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7f9e7e0c9f80a5130773cfabb6df4dc924518fb1b2c923726966804634b57d22"+dependencies = [+ "gtk",+ "http",+ "jni 0.21.1",+ "log",+ "objc2",+ "objc2-app-kit",+ "once_cell",+ "percent-encoding",+ "raw-window-handle",+ "softbuffer",+ "tao",+ "tauri-runtime",+ "tauri-utils",+ "url",+ "webkit2gtk",+ "webview2-com",+ "windows 0.62.2",+ "wry",+]++[[package]]+name = "tauri-utils"+version = "2.10.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2ff55a614843b9a3f010f211df637c94df2607175b8d0f6e0f4a7c19e18621ee"+dependencies = [+ "anyhow",+ "brotli",+ "cargo_metadata",+ "ctor",+ "dom_query",+ "dunce",+ "glob",+ "http",+ "infer 0.22.0",+ "json-patch",+ "log",+ "memchr",+ "phf",+ "plist",+ "proc-macro2",+ "quote",+ "regex",+ "schemars 0.8.22",+ "semver",+ "serde",+ "serde-untagged",+ "serde_json",+ "serde_with",+ "swift-rs",+ "thiserror 2.0.18",+ "toml 0.9.12+spec-1.1.0",+ "url",+ "urlpattern",+ "uuid",+ "walkdir",+]++[[package]]+name = "tauri-winres"+version = "0.3.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cc65d45c68858bfe420dd29e834b5d15dbecf8a07a8a16cf4d532c7b1f69d4b6"+dependencies = [+ "dunce",+ "embed-resource",+ "toml 1.1.2+spec-1.1.0",+]++[[package]]+name = "tauri-winrt-notification"+version = "0.7.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9ed071c670382e85fc2f48ae706492d8c338f4f89bf72520d32f8abfe880aade"+dependencies = [+ "thiserror 2.0.18",+ "windows 0.61.3",+ "windows-version",+]++[[package]]+name = "tempfile"+version = "3.27.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"+dependencies = [+ "fastrand",+ "getrandom 0.4.3",+ "once_cell",+ "rustix",+ "windows-sys 0.61.2",+]++[[package]]+name = "tendril"+version = "0.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c4790fc369d5a530f4b544b094e31388b9b3a37c0f4652ade4505945f5660d24"+dependencies = [+ "new_debug_unreachable",+ "utf-8",+]++[[package]]+name = "thin-vec"+version = "0.2.18"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b0f7e269b48f0a7dd0146680fa24b50cc67fc0373f086a5b2f99bd084639b482"++[[package]]+name = "thiserror"+version = "1.0.69"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"+dependencies = [+ "thiserror-impl 1.0.69",+]++[[package]]+name = "thiserror"+version = "2.0.18"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4"+dependencies = [+ "thiserror-impl 2.0.18",+]++[[package]]+name = "thiserror-impl"+version = "1.0.69"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.118",+]++[[package]]+name = "thiserror-impl"+version = "2.0.18"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.118",+]++[[package]]+name = "thread_local"+version = "1.1.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185"+dependencies = [+ "cfg-if",+]++[[package]]+name = "tiff"+version = "0.11.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b63feaf3343d35b6ca4d50483f94843803b0f51634937cc2ec519fc32232bc52"+dependencies = [+ "fax",+ "flate2",+ "half",+ "quick-error",+ "weezl",+ "zune-jpeg",+]++[[package]]+name = "time"+version = "0.3.53"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "18dfaaeddcb932337b5e7866ee7d0ce9b76d2fd092997146f187ec09b4558a50"+dependencies = [+ "deranged",+ "num-conv",+ "powerfmt",+ "serde_core",+ "time-core",+ "time-macros",+]++[[package]]+name = "time-core"+version = "0.1.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109"++[[package]]+name = "time-macros"+version = "0.2.31"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c431b87111666e491a90baa837f914fb45cd5dc3c268591b0220ff5057f2085f"+dependencies = [+ "num-conv",+ "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 = "tinystr"+version = "0.8.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d"+dependencies = [+ "displaydoc",+ "zerovec",+]++[[package]]+name = "tinyvec"+version = "1.11.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3e61e67053d25a4e82c844e8424039d9745781b3fc4f32b8d55ed50f5f667ef3"+dependencies = [+ "tinyvec_macros",+]++[[package]]+name = "tinyvec_macros"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"++[[package]]+name = "token-stream-parser"+version = "0.6.1"+dependencies = [+ "indexmap 2.14.0",+ "json-transform",+ "serde",+ "serde_json",+ "thiserror 2.0.18",+ "tracing",+]++[[package]]+name = "tokenizers"+version = "0.22.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b238e22d44a15349529690fb07bd645cf58149a1b1e44d6cb5bd1641ff1a6223"+dependencies = [+ "ahash",+ "aho-corasick",+ "compact_str",+ "dary_heap",+ "derive_builder",+ "esaxx-rs",+ "fancy-regex 0.14.0",+ "getrandom 0.3.4",+ "itertools",+ "log",+ "macro_rules_attribute",+ "monostate",+ "paste",+ "rand 0.9.4",+ "rayon",+ "rayon-cond",+ "regex",+ "regex-syntax",+ "serde",+ "serde_json",+ "spm_precompiled",+ "thiserror 2.0.18",+ "unicode-normalization-alignments",+ "unicode-segmentation",+ "unicode_categories",+]++[[package]]+name = "tokio"+version = "1.52.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8fc7f01b389ac15039e4dc9531aa973a135d7a4135281b12d7c1bc79fd57fffe"+dependencies = [+ "bytes",+ "libc",+ "mio",+ "parking_lot",+ "pin-project-lite",+ "signal-hook-registry",+ "socket2",+ "tokio-macros",+ "windows-sys 0.61.2",+]++[[package]]+name = "tokio-macros"+version = "2.7.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "385a6cb71ab9ab790c5fe8d67f1645e6c450a7ce006a33de03daa956cf70a496"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.118",+]++[[package]]+name = "tokio-rustls"+version = "0.26.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61"+dependencies = [+ "rustls",+ "tokio",+]++[[package]]+name = "tokio-stream"+version = "0.1.18"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70"+dependencies = [+ "futures-core",+ "pin-project-lite",+ "tokio",+ "tokio-util",+]++[[package]]+name = "tokio-util"+version = "0.7.18"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098"+dependencies = [+ "bytes",+ "futures-core",+ "futures-sink",+ "futures-util",+ "pin-project-lite",+ "tokio",+]++[[package]]+name = "toml"+version = "0.8.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "185d8ab0dfbb35cf1399a6344d8484209c088f75f8f68230da55d48d95d43e3d"+dependencies = [+ "serde",+ "serde_spanned 0.6.9",+ "toml_datetime 0.6.3",+ "toml_edit 0.20.2",+]++[[package]]+name = "toml"+version = "0.9.12+spec-1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cf92845e79fc2e2def6a5d828f0801e29a2f8acc037becc5ab08595c7d5e9863"+dependencies = [+ "indexmap 2.14.0",+ "serde_core",+ "serde_spanned 1.1.1",+ "toml_datetime 0.7.5+spec-1.1.0",+ "toml_parser",+ "toml_writer",+ "winnow 0.7.15",+]++[[package]]+name = "toml"+version = "1.1.2+spec-1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "81f3d15e84cbcd896376e6730314d59fb5a87f31e4b038454184435cd57defee"+dependencies = [+ "indexmap 2.14.0",+ "serde_core",+ "serde_spanned 1.1.1",+ "toml_datetime 1.1.1+spec-1.1.0",+ "toml_parser",+ "toml_writer",+ "winnow 1.0.3",+]++[[package]]+name = "toml_datetime"+version = "0.6.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b"+dependencies = [+ "serde",+]++[[package]]+name = "toml_datetime"+version = "0.7.5+spec-1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347"+dependencies = [+ "serde_core",+]++[[package]]+name = "toml_datetime"+version = "1.1.1+spec-1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7"+dependencies = [+ "serde_core",+]++[[package]]+name = "toml_edit"+version = "0.19.15"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421"+dependencies = [+ "indexmap 2.14.0",+ "toml_datetime 0.6.3",+ "winnow 0.5.40",+]++[[package]]+name = "toml_edit"+version = "0.20.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338"+dependencies = [+ "indexmap 2.14.0",+ "serde",+ "serde_spanned 0.6.9",+ "toml_datetime 0.6.3",+ "winnow 0.5.40",+]++[[package]]+name = "toml_edit"+version = "0.25.12+spec-1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d2153edc6955a6c354fad8f5efd38b6a8769bdccf9fe50f8e1329f81b0baa5d7"+dependencies = [+ "indexmap 2.14.0",+ "toml_datetime 1.1.1+spec-1.1.0",+ "toml_parser",+ "winnow 1.0.3",+]++[[package]]+name = "toml_parser"+version = "1.1.2+spec-1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526"+dependencies = [+ "winnow 1.0.3",+]++[[package]]+name = "toml_writer"+version = "1.1.1+spec-1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "756daf9b1013ebe47a8776667b466417e2d4c5679d441c26230efd9ef78692db"++[[package]]+name = "tower"+version = "0.5.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4"+dependencies = [+ "futures-core",+ "futures-util",+ "pin-project-lite",+ "sync_wrapper",+ "tokio",+ "tower-layer",+ "tower-service",+]++[[package]]+name = "tower-http"+version = "0.6.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840"+dependencies = [+ "bitflags 2.13.0",+ "bytes",+ "futures-util",+ "http",+ "http-body",+ "pin-project-lite",+ "tower",+ "tower-layer",+ "tower-service",+ "url",+]++[[package]]+name = "tower-layer"+version = "0.3.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e"++[[package]]+name = "tower-service"+version = "0.3.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3"++[[package]]+name = "tracing"+version = "0.1.44"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100"+dependencies = [+ "pin-project-lite",+ "tracing-attributes",+ "tracing-core",+]++[[package]]+name = "tracing-appender"+version = "0.2.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "050686193eb999b4bb3bc2acfa891a13da00f79734704c4b8b4ef1a10b368a3c"+dependencies = [+ "crossbeam-channel",+ "symlink",+ "thiserror 2.0.18",+ "time",+ "tracing-subscriber",+]++[[package]]+name = "tracing-attributes"+version = "0.1.31"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.118",+]++[[package]]+name = "tracing-core"+version = "0.1.36"+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 = [+ "matchers",+ "nu-ansi-term",+ "once_cell",+ "regex-automata",+ "sharded-slab",+ "smallvec",+ "thread_local",+ "tracing",+ "tracing-core",+ "tracing-log",+]++[[package]]+name = "tray-icon"+version = "0.25.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b2b9c52859a94554803ccd4a24b98f74148ebc73b90676d783f3490b1bff9d72"+dependencies = [+ "crossbeam-channel",+ "dirs 7.0.0",+ "libappindicator",+ "muda",+ "objc2",+ "objc2-app-kit",+ "objc2-core-foundation",+ "objc2-core-graphics",+ "objc2-foundation",+ "once_cell",+ "png 0.18.1",+ "serde",+ "thiserror 2.0.18",+ "windows-sys 0.61.2",+]++[[package]]+name = "try-lock"+version = "0.2.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"++[[package]]+name = "typeid"+version = "1.0.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c"++[[package]]+name = "typenum"+version = "1.20.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20"++[[package]]+name = "uds_windows"+version = "1.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e"+dependencies = [+ "memoffset",+ "tempfile",+ "windows-sys 0.61.2",+]++[[package]]+name = "unicase"+version = "2.9.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142"++[[package]]+name = "unicode-ident"+version = "1.0.24"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"++[[package]]+name = "unicode-normalization-alignments"+version = "0.1.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "43f613e4fa046e69818dd287fdc4bc78175ff20331479dab6e1b0f98d57062de"+dependencies = [+ "smallvec",+]++[[package]]+name = "unicode-segmentation"+version = "1.13.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8"++[[package]]+name = "unicode-xid"+version = "0.2.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"++[[package]]+name = "unicode_categories"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e"++[[package]]+name = "untrusted"+version = "0.9.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"++[[package]]+name = "url"+version = "2.5.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed"+dependencies = [+ "form_urlencoded",+ "idna",+ "percent-encoding",+ "serde",+ "serde_derive",+]++[[package]]+name = "urlpattern"+version = "0.6.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "df16f50ef4cc145211879a3867ba757076b25dfee812040dcb0658bd9ae7904b"+dependencies = [+ "icu_properties",+ "regex",+ "serde",+ "url",+]++[[package]]+name = "utf-8"+version = "0.7.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"++[[package]]+name = "utf8_iter"+version = "1.0.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"++[[package]]+name = "utf8parse"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"++[[package]]+name = "uuid"+version = "1.23.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bf80a72845275afea99e7f2b434723d3bc7e38470fcd1c7ed39a599c73319a53"+dependencies = [+ "getrandom 0.4.3",+ "js-sys",+ "serde_core",+ "sha1_smol",+ "wasm-bindgen",+]++[[package]]+name = "uzu"+version = "0.6.1"+dependencies = [+ "anyhow",+ "apple-native-keyring-store",+ "async-openai",+ "backend-remote",+ "bindings",+ "bon",+ "chrono",+ "confy",+ "dirs 6.0.0",+ "download-manager",+ "fancy-regex 0.17.0",+ "futures",+ "futures-util",+ "hanashi",+ "indexmap 2.14.0",+ "keyring-core",+ "kiban",+ "nagare",+ "objc2",+ "objc2-foundation",+ "parking_lot",+ "rand 0.10.2",+ "reqwest 0.13.4",+ "rodio",+ "serde",+ "serde_json",+ "shoji",+ "sysinfo",+ "thiserror 2.0.18",+ "tokenizers",+ "tokio",+ "tokio-stream",+ "tokio-util",+ "tracing",+ "tracing-appender",+ "tracing-subscriber",+ "uuid",+ "uzu-engine",+]++[[package]]+name = "uzu-engine"+version = "0.6.1"+dependencies = [+ "anyhow",+ "bitflags 2.13.0",+ "blake3",+ "bytemuck",+ "clang-ast",+ "depfile",+ "derive_more",+ "half",+ "itertools",+ "libm",+ "monostate",+ "mtl-rs",+ "num-traits",+ "obfstr",+ "objc2",+ "parking_lot",+ "prettyplease 0.2.37",+ "proc-macro2",+ "quote",+ "rangemap",+ "rayon",+ "rhai",+ "serde",+ "serde_json",+ "shoji",+ "syn 2.0.118",+ "tempfile",+ "thiserror 2.0.18",+ "tokenizers",+ "uzu-engine-macros",+ "walkdir",+ "xxhash-rust",+]++[[package]]+name = "uzu-engine-macros"+version = "0.6.1"+dependencies = [+ "quote",+ "syn 2.0.118",+]++[[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 = "version-compare"+version = "0.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "03c2856837ef78f57382f06b2b8563a2f512f7185d732608fd9176cb3b8edf0e"++[[package]]+name = "version_check"+version = "0.9.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"++[[package]]+name = "vswhom"+version = "0.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "be979b7f07507105799e854203b470ff7c78a1639e330a58f183b5fea574608b"+dependencies = [+ "libc",+ "vswhom-sys",+]++[[package]]+name = "vswhom-sys"+version = "0.1.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fb067e4cbd1ff067d1df46c9194b5de0e98efd2810bbc95c5d5e5f25a3231150"+dependencies = [+ "cc",+ "libc",+]++[[package]]+name = "walkdir"+version = "2.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"+dependencies = [+ "same-file",+ "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"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"++[[package]]+name = "wasip2"+version = "1.0.4+wasi-0.2.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487"+dependencies = [+ "wit-bindgen",+]++[[package]]+name = "wasm-bindgen"+version = "0.2.126"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4b067c0c11094aef6b7a801c1e34a26affafdf3d051dba08456b868789aaf9a4"+dependencies = [+ "cfg-if",+ "once_cell",+ "rustversion",+ "serde",+ "serde_json",+ "wasm-bindgen-macro",+ "wasm-bindgen-shared",+]++[[package]]+name = "wasm-bindgen-futures"+version = "0.4.76"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c62df1340f32221cb9c54d6a27b030e3dba64361d4a95bed55f9aacb44da291d"+dependencies = [+ "js-sys",+ "wasm-bindgen",+]++[[package]]+name = "wasm-bindgen-macro"+version = "0.2.126"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "167ce5e579f6bcf889c4f7175a8a5a585de84e8ff93976ce393efa5f2837aab1"+dependencies = [+ "quote",+ "wasm-bindgen-macro-support",+]++[[package]]+name = "wasm-bindgen-macro-support"+version = "0.2.126"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f3997c7839262f4ef12cf90b818d6340c18e80f263f1a94bf157d0ec4420380e"+dependencies = [+ "bumpalo",+ "proc-macro2",+ "quote",+ "syn 2.0.118",+ "wasm-bindgen-shared",+]++[[package]]+name = "wasm-bindgen-shared"+version = "0.2.126"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "dc1b4cb0cc549fcf58d7dfc081778139b3d283a081644e833e84682ad71cea24"+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-streams"+version = "0.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9d1ec4f6517c9e11ae630e200b2b65d193279042e28edd4a2cda233e46670bbb"+dependencies = [+ "futures-util",+ "js-sys",+ "wasm-bindgen",+ "wasm-bindgen-futures",+ "web-sys",+]++[[package]]+name = "web-sys"+version = "0.3.103"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8622dcb61c0bcc9fffa6938bed81210af2da9a7e4a1a834b2e37a59b6dfb6141"+dependencies = [+ "js-sys",+ "wasm-bindgen",+]++[[package]]+name = "web-time"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb"+dependencies = [+ "js-sys",+ "wasm-bindgen",+]++[[package]]+name = "web_atoms"+version = "0.2.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "075474b12bcb3d2e3d4546580e9de478eeeead668a1761e2a8860c836b7ef297"+dependencies = [+ "phf",+ "phf_codegen",+ "string_cache",+ "string_cache_codegen",+]++[[package]]+name = "webkit2gtk"+version = "2.0.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a1027150013530fb2eaf806408df88461ae4815a45c541c8975e61d6f2fc4793"+dependencies = [+ "bitflags 1.3.2",+ "cairo-rs",+ "gdk",+ "gdk-sys",+ "gio",+ "gio-sys",+ "glib",+ "glib-sys",+ "gobject-sys",+ "gtk",+ "gtk-sys",+ "javascriptcore-rs",+ "libc",+ "once_cell",+ "soup3",+ "webkit2gtk-sys",+]++[[package]]+name = "webkit2gtk-sys"+version = "2.0.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "916a5f65c2ef0dfe12fff695960a2ec3d4565359fdbb2e9943c974e06c734ea5"+dependencies = [+ "bitflags 1.3.2",+ "cairo-sys-rs",+ "gdk-sys",+ "gio-sys",+ "glib-sys",+ "gobject-sys",+ "gtk-sys",+ "javascriptcore-rs-sys",+ "libc",+ "pkg-config",+ "soup3-sys",+ "system-deps",+]++[[package]]+name = "webpki-root-certs"+version = "1.0.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0d46a5a140e6f7afeccd8eae97eff335163939eac8b929834875168b29b3d267"+dependencies = [+ "rustls-pki-types",+]++[[package]]+name = "webpki-roots"+version = "1.0.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bf85cb06032201fa7c6f829d7db5a7e5aa45bcc0655327713065f6f0576731bf"+dependencies = [+ "rustls-pki-types",+]++[[package]]+name = "webview2-com"+version = "0.39.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3f89fca7a704cee10dcb3654c1dbb8941d1783132f1917358af75bec37a7d7e6"+dependencies = [+ "webview2-com-macros",+ "webview2-com-sys",+ "windows 0.62.2",+ "windows-core 0.62.2",+]++[[package]]+name = "webview2-com-macros"+version = "0.8.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "67a921c1b6914c367b2b823cd4cde6f96beec77d30a939c8199bb377cf9b9b54"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.118",+]++[[package]]+name = "webview2-com-sys"+version = "0.39.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b3a07132775117d6065853d9d1178157b8c90e228de47129d6bce2c7edebedfb"+dependencies = [+ "thiserror 2.0.18",+ "windows 0.62.2",+ "windows-core 0.62.2",+]++[[package]]+name = "weezl"+version = "0.1.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88"++[[package]]+name = "winapi"+version = "0.3.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"+dependencies = [+ "winapi-i686-pc-windows-gnu",+ "winapi-x86_64-pc-windows-gnu",+]++[[package]]+name = "winapi-i686-pc-windows-gnu"+version = "0.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"++[[package]]+name = "winapi-util"+version = "0.1.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"+dependencies = [+ "windows-sys 0.61.2",+]++[[package]]+name = "winapi-x86_64-pc-windows-gnu"+version = "0.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"++[[package]]+name = "window-vibrancy"+version = "0.8.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "111e51caca442cafd9bab396628ac4d814880eaea4e63dfd76a12e9f342b5580"+dependencies = [+ "objc2",+ "objc2-app-kit",+ "objc2-core-foundation",+ "objc2-foundation",+ "objc2-quartz-core",+ "raw-window-handle",+ "windows-sys 0.61.2",+ "windows-version",+]++[[package]]+name = "windows"+version = "0.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 0.3.2",+ "windows-core 0.62.2",+ "windows-future 0.3.2",+ "windows-numerics 0.3.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]]+name = "windows-collections"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610"+dependencies = [+ "windows-core 0.62.2",+]++[[package]]+name = "windows-core"+version = "0.61.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3"+dependencies = [+ "windows-implement",+ "windows-interface",+ "windows-link 0.1.3",+ "windows-result 0.3.4",+ "windows-strings 0.4.2",+]++[[package]]+name = "windows-core"+version = "0.62.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb"+dependencies = [+ "windows-implement",+ "windows-interface",+ "windows-link 0.2.1",+ "windows-result 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]]+name = "windows-future"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb"+dependencies = [+ "windows-core 0.62.2",+ "windows-link 0.2.1",+ "windows-threading 0.2.1",+]++[[package]]+name = "windows-implement"+version = "0.60.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.118",+]++[[package]]+name = "windows-interface"+version = "0.59.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.118",+]++[[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 0.62.2",+ "windows-link 0.2.1",+]++[[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.3.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6"+dependencies = [+ "windows-link 0.1.3",+]++[[package]]+name = "windows-result"+version = "0.4.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5"+dependencies = [+ "windows-link 0.2.1",+]++[[package]]+name = "windows-strings"+version = "0.4.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57"+dependencies = [+ "windows-link 0.1.3",+]++[[package]]+name = "windows-strings"+version = "0.5.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091"+dependencies = [+ "windows-link 0.2.1",+]++[[package]]+name = "windows-sys"+version = "0.45.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"+dependencies = [+ "windows-targets 0.42.2",+]++[[package]]+name = "windows-sys"+version = "0.52.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"+dependencies = [+ "windows-targets 0.52.6",+]++[[package]]+name = "windows-sys"+version = "0.59.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"+dependencies = [+ "windows-targets 0.52.6",+]++[[package]]+name = "windows-sys"+version = "0.60.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb"+dependencies = [+ "windows-targets 0.53.5",+]++[[package]]+name = "windows-sys"+version = "0.61.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"+dependencies = [+ "windows-link 0.2.1",+]++[[package]]+name = "windows-targets"+version = "0.42.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"+dependencies = [+ "windows_aarch64_gnullvm 0.42.2",+ "windows_aarch64_msvc 0.42.2",+ "windows_i686_gnu 0.42.2",+ "windows_i686_msvc 0.42.2",+ "windows_x86_64_gnu 0.42.2",+ "windows_x86_64_gnullvm 0.42.2",+ "windows_x86_64_msvc 0.42.2",+]++[[package]]+name = "windows-targets"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"+dependencies = [+ "windows_aarch64_gnullvm 0.52.6",+ "windows_aarch64_msvc 0.52.6",+ "windows_i686_gnu 0.52.6",+ "windows_i686_gnullvm 0.52.6",+ "windows_i686_msvc 0.52.6",+ "windows_x86_64_gnu 0.52.6",+ "windows_x86_64_gnullvm 0.52.6",+ "windows_x86_64_msvc 0.52.6",+]++[[package]]+name = "windows-targets"+version = "0.53.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3"+dependencies = [+ "windows-link 0.2.1",+ "windows_aarch64_gnullvm 0.53.1",+ "windows_aarch64_msvc 0.53.1",+ "windows_i686_gnu 0.53.1",+ "windows_i686_gnullvm 0.53.1",+ "windows_i686_msvc 0.53.1",+ "windows_x86_64_gnu 0.53.1",+ "windows_x86_64_gnullvm 0.53.1",+ "windows_x86_64_msvc 0.53.1",+]++[[package]]+name = "windows-threading"+version = "0.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6"+dependencies = [+ "windows-link 0.1.3",+]++[[package]]+name = "windows-threading"+version = "0.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37"+dependencies = [+ "windows-link 0.2.1",+]++[[package]]+name = "windows-version"+version = "0.1.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e4060a1da109b9d0326b7262c8e12c84df67cc0dbc9e33cf49e01ccc2eb63631"+dependencies = [+ "windows-link 0.2.1",+]++[[package]]+name = "windows_aarch64_gnullvm"+version = "0.42.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"++[[package]]+name = "windows_aarch64_gnullvm"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"++[[package]]+name = "windows_aarch64_gnullvm"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53"++[[package]]+name = "windows_aarch64_msvc"+version = "0.42.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"++[[package]]+name = "windows_aarch64_msvc"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"++[[package]]+name = "windows_aarch64_msvc"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006"++[[package]]+name = "windows_i686_gnu"+version = "0.42.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"++[[package]]+name = "windows_i686_gnu"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"++[[package]]+name = "windows_i686_gnu"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3"++[[package]]+name = "windows_i686_gnullvm"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"++[[package]]+name = "windows_i686_gnullvm"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c"++[[package]]+name = "windows_i686_msvc"+version = "0.42.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"++[[package]]+name = "windows_i686_msvc"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"++[[package]]+name = "windows_i686_msvc"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2"++[[package]]+name = "windows_x86_64_gnu"+version = "0.42.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"++[[package]]+name = "windows_x86_64_gnu"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"++[[package]]+name = "windows_x86_64_gnu"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499"++[[package]]+name = "windows_x86_64_gnullvm"+version = "0.42.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"++[[package]]+name = "windows_x86_64_gnullvm"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"++[[package]]+name = "windows_x86_64_gnullvm"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1"++[[package]]+name = "windows_x86_64_msvc"+version = "0.42.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"++[[package]]+name = "windows_x86_64_msvc"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"++[[package]]+name = "windows_x86_64_msvc"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650"++[[package]]+name = "winnow"+version = "0.5.40"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876"+dependencies = [+ "memchr",+]++[[package]]+name = "winnow"+version = "0.7.15"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945"++[[package]]+name = "winnow"+version = "1.0.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0592e1c9d151f854e6fd382574c3a0855250e1d9b2f99d9281c6e6391af352f1"+dependencies = [+ "memchr",+]++[[package]]+name = "winreg"+version = "0.10.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d"+dependencies = [+ "winapi",+]++[[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 = "wit-bindgen"+version = "0.57.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e"++[[package]]+name = "writeable"+version = "0.6.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4"++[[package]]+name = "wry"+version = "0.57.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a819957a01b3119af85e638a38d242af76dbc87d130dca67bfd0441072e21ff0"+dependencies = [+ "base64 0.22.1",+ "block2",+ "cookie",+ "crossbeam-channel",+ "dirs 7.0.0",+ "dom_query",+ "dpi",+ "dunce",+ "gdkx11",+ "gtk",+ "http",+ "javascriptcore-rs",+ "jni 0.21.1",+ "libc",+ "ndk",+ "objc2",+ "objc2-app-kit",+ "objc2-core-foundation",+ "objc2-foundation",+ "objc2-ui-kit",+ "objc2-web-kit",+ "once_cell",+ "percent-encoding",+ "raw-window-handle",+ "sha2",+ "soup3",+ "tao-macros",+ "thiserror 2.0.18",+ "url",+ "webkit2gtk",+ "webkit2gtk-sys",+ "webview2-com",+ "windows 0.62.2",+ "windows-core 0.62.2",+ "windows-version",+ "x11-dl",+]++[[package]]+name = "x11"+version = "2.21.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "502da5464ccd04011667b11c435cb992822c2c0dbde1770c988480d312a0db2e"+dependencies = [+ "libc",+ "pkg-config",+]++[[package]]+name = "x11-dl"+version = "2.21.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f"+dependencies = [+ "libc",+ "once_cell",+ "pkg-config",+]++[[package]]+name = "x11rb"+version = "0.13.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9993aa5be5a26815fe2c3eacfc1fde061fc1a1f094bf1ad2a18bf9c495dd7414"+dependencies = [+ "gethostname",+ "rustix",+ "x11rb-protocol",+]++[[package]]+name = "x11rb-protocol"+version = "0.13.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd"++[[package]]+name = "xattr"+version = "1.6.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "32e45ad4206f6d2479085147f02bc2ef834ac85886624a23575ae137c8aa8156"+dependencies = [+ "libc",+ "rustix",+]++[[package]]+name = "xkeysym"+version = "0.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56"++[[package]]+name = "xxhash-rust"+version = "0.8.16"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4d93c89cdc2d3a63c3ec48ffe926931bdc069eafa8e4402fe6d8f790c9d1e576"++[[package]]+name = "y4m"+version = "0.8.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7a5a4b21e1a62b67a2970e6831bc091d7b87e119e7f9791aef9702e3bef04448"++[[package]]+name = "yoke"+version = "0.8.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5"+dependencies = [+ "stable_deref_trait",+ "yoke-derive",+ "zerofrom",+]++[[package]]+name = "yoke-derive"+version = "0.8.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.118",+ "synstructure",+]++[[package]]+name = "zbus"+version = "5.17.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a28b97f866896a4be7aefd2b5a8e01bb6773d19a775d54ab28b4d094b9a4480e"+dependencies = [+ "async-broadcast",+ "async-executor",+ "async-io",+ "async-lock",+ "async-process",+ "async-recursion",+ "async-task",+ "async-trait",+ "blocking",+ "enumflags2",+ "event-listener",+ "futures-core",+ "futures-lite",+ "hex",+ "libc",+ "ordered-stream",+ "rustix",+ "serde",+ "serde_repr",+ "tracing",+ "uds_windows",+ "uuid",+ "windows-sys 0.61.2",+ "winnow 1.0.3",+ "zbus_macros",+ "zbus_names",+ "zvariant",+]++[[package]]+name = "zbus_macros"+version = "5.17.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5e05ad887425eecf5e8384dc2406a4a9313eb73468712fc1cdea362eb4fe0469"+dependencies = [+ "proc-macro-crate 3.5.0",+ "proc-macro2",+ "quote",+ "syn 2.0.118",+ "zbus_names",+ "zvariant",+ "zvariant_utils",+]++[[package]]+name = "zbus_names"+version = "4.3.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1039ca249fee9559680f3a9f05b55e0761fee51af4f6c1e7d8c1f31e549721d2"+dependencies = [+ "serde",+ "winnow 1.0.3",+ "zvariant",+]++[[package]]+name = "zerocopy"+version = "0.8.52"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ce1022995ff5ff5d841ad7d994facc23098cd40152f2c1d11cd607c6f530653f"+dependencies = [+ "zerocopy-derive",+]++[[package]]+name = "zerocopy-derive"+version = "0.8.52"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1ae7f38b72ec2a254e2b87ef277cf2cd4fb97cbebf944faa6f33354da0867930"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.118",+]++[[package]]+name = "zerofrom"+version = "0.1.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272"+dependencies = [+ "zerofrom-derive",+]++[[package]]+name = "zerofrom-derive"+version = "0.1.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.118",+ "synstructure",+]++[[package]]+name = "zeroize"+version = "1.9.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e"++[[package]]+name = "zerotrie"+version = "0.2.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf"+dependencies = [+ "displaydoc",+ "yoke",+ "zerofrom",+]++[[package]]+name = "zerovec"+version = "0.11.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239"+dependencies = [+ "yoke",+ "zerofrom",+ "zerovec-derive",+]++[[package]]+name = "zerovec-derive"+version = "0.11.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.118",+]++[[package]]+name = "zip"+version = "4.6.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "caa8cd6af31c3b31c6631b8f483848b91589021b28fffe50adada48d4f4d2ed1"+dependencies = [+ "arbitrary",+ "crc32fast",+ "indexmap 2.14.0",+ "memchr",+]++[[package]]+name = "zmij"+version = "1.0.21"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa"++[[package]]+name = "zune-core"+version = "0.5.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cb8a0807f7c01457d0379ba880ba6322660448ddebc890ce29bb64da71fb40f9"++[[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.5.15"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "27bc9d5b815bc103f142aa054f561d9187d191692ec7c2d1e2b4737f8dbd7296"+dependencies = [+ "zune-core",+]++[[package]]+name = "zvariant"+version = "5.13.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7cf057bb00bf5c9ad77abb6147b0ca4818236a1858416e9d988e40d6322fefa7"+dependencies = [+ "endi",+ "enumflags2",+ "serde",+ "winnow 1.0.3",+ "zvariant_derive",+ "zvariant_utils",+]++[[package]]+name = "zvariant_derive"+version = "5.13.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8118ca6bda77bfc0ab51d660db0c955f2505eef854c9a449435bccb616933b31"+dependencies = [+ "proc-macro-crate 3.5.0",+ "proc-macro2",+ "quote",+ "syn 2.0.118",+ "zvariant_utils",+]++[[package]]+name = "zvariant_utils"+version = "3.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "90cb9383f9b45290407a1258b202d3f8f01db719eb60b4e4055c6375af4fc7c7"+dependencies = [+ "proc-macro2",+ "quote",+ "serde",+ "syn 2.0.118",+ "winnow 1.0.3",+]diff --git a/apps/mirai-gui/desktop/Cargo.toml b/apps/mirai-gui/desktop/Cargo.tomlnew file mode 100644index 000000000..b7a5ca041--- /dev/null+++ b/apps/mirai-gui/desktop/Cargo.toml@@ -0,0 +1,31 @@+[package]+name = "mirai-gui"+version = "0.6.1"+edition = "2024"+license = "MIT"+publish = false++[workspace]++[build-dependencies]+tauri-build = { version = "2", features = [] }++[dependencies]+tauri = { version = "2", features = [] }+tauri-plugin-autostart = "2"+tauri-plugin-global-shortcut = "2"+tauri-plugin-dialog = "2"+tauri-plugin-notification = "2"+tauri-plugin-updater = "2"+serde = { version = "1", features = ["derive"] }+serde_json = "1"+thiserror = "2"+tokio = { version = "1", features = ["rt-multi-thread", "sync", "time"] }+futures = "0.3"+chrono = { version = "0.4", default-features = false, features = ["clock"] }++uzu = { path = "../../../crates/legacy/uzu", default-features = false, features = ["backend-metal"] }+hanashi = { path = "../../../crates/legacy/hanashi", default-features = false }++[profile.dev.build-override]+opt-level = 2diff --git a/apps/mirai-gui/desktop/build.rs b/apps/mirai-gui/desktop/build.rsnew file mode 100644index 000000000..d860e1e6a--- /dev/null+++ b/apps/mirai-gui/desktop/build.rs@@ -0,0 +1,3 @@+fn main() {+ tauri_build::build()+}diff --git a/apps/mirai-gui/desktop/capabilities/default.json b/apps/mirai-gui/desktop/capabilities/default.jsonnew file mode 100644index 000000000..8d9c76e29--- /dev/null+++ b/apps/mirai-gui/desktop/capabilities/default.json@@ -0,0 +1,7 @@+{+ "$schema": "../gen/schemas/desktop-schema.json",+ "identifier": "default",+ "description": "Grants the main window the core APIs; global event listen/emit is required for session-state and download-state events.",+ "windows": ["main"],+ "permissions": ["core:default", "core:window:allow-start-dragging", "dialog:default"]+}diff --git a/apps/mirai-gui/desktop/deny.toml b/apps/mirai-gui/desktop/deny.tomlnew file mode 100644index 000000000..4b83d0953--- /dev/null+++ b/apps/mirai-gui/desktop/deny.toml@@ -0,0 +1,29 @@+[graph]+targets = ["aarch64-apple-darwin"]++[advisories]+ignore = [+ "RUSTSEC-2024-0384", # instant via uzu/async-openai/backoff+ "RUSTSEC-2024-0436", # paste via hanashi/tokenizers+ "RUSTSEC-2025-0012", # backoff via uzu/async-openai+ "RUSTSEC-2026-0249", # smartstring via uzu-engine/rhai+]++[licenses]+allow = [+ "MIT",+ "MIT-0",+ "BSD-2-Clause",+ "BSD-3-Clause",+ "Apache-2.0",+ "MPL-2.0",+ "ISC",+ "Zlib",+ "BSL-1.0",+ "CC0-1.0",+ "CDLA-Permissive-2.0",+ "Unicode-3.0",+]++[bans]+multiple-versions = "allow"diff --git a/apps/mirai-gui/desktop/dmg-background.tiff b/apps/mirai-gui/desktop/dmg-background.tiffnew file mode 100644index 000000000..3df09f943Binary files /dev/null and b/apps/mirai-gui/desktop/dmg-background.tiff differdiff --git a/apps/mirai-gui/desktop/dmg-settings.py b/apps/mirai-gui/desktop/dmg-settings.pynew file mode 100644index 000000000..0ffed8542--- /dev/null+++ b/apps/mirai-gui/desktop/dmg-settings.py@@ -0,0 +1,25 @@+import os++# Headless DMG layout for CI, where Tauri's Finder-driven styling is skipped+# (tauri-apps/tauri#1731). dmgbuild writes the .DS_Store directly, no Finder.+# Values mirror bundle.macOS.dmg in tauri.conf.json; keep them in sync.++app_path = os.environ["DMG_APP_PATH"]+app_name = os.path.basename(app_path)++files = [app_path]+symlinks = {"Applications": "/Applications"}++# Read-only compressed UDIF; required for notarization/stapling (a read-write+# UDRW image is the classic "unsupported format" notary rejection).+format = "UDZO"+background = os.environ["DMG_BACKGROUND"]+window_rect = ((100, 100), (638, 398))+icon_size = 128+default_view = "icon-view"+show_icon_preview = False++icon_locations = {+ app_name: (165, 200),+ "Applications": (473, 200),+}diff --git a/apps/mirai-gui/desktop/icons/icon.icns b/apps/mirai-gui/desktop/icons/icon.icnsnew file mode 100644index 000000000..11e81b24dBinary files /dev/null and b/apps/mirai-gui/desktop/icons/icon.icns differdiff --git a/apps/mirai-gui/desktop/icons/icon.png b/apps/mirai-gui/desktop/icons/icon.pngnew file mode 100644index 000000000..ab1e605dcBinary files /dev/null and b/apps/mirai-gui/desktop/icons/icon.png differdiff --git a/apps/mirai-gui/desktop/src/chat/messages.rs b/apps/mirai-gui/desktop/src/chat/messages.rsnew file mode 100644index 000000000..751085487--- /dev/null+++ b/apps/mirai-gui/desktop/src/chat/messages.rs@@ -0,0 +1,148 @@+use uzu::types::{+ basic::ReasoningEffort,+ session::chat::{ChatMessage, ChatRole},+};++use super::payloads::{MsgIn, Parsed};++// Engine output only: U+FFFD shows up as "�" when the decoder splits a multi-byte+// character across tokens. Joiners and variation selectors hold composite emoji together.+pub(super) fn sanitize(s: &str) -> String {+ s.chars()+ .filter(|&c| {+ !((c.is_control() && c != '\n' && c != '\r' && c != '\t')+ || c == '\u{FFFD}'+ || c == '\u{FFFC}'+ || c == '\u{FEFF}')+ })+ .collect()+}++pub(super) fn build_non_system_message(+ message: &MsgIn,+ include_reasoning: bool,+) -> ChatMessage {+ let content = message.content.clone();+ if matches!(message.role, ChatRole::User {}) {+ return ChatMessage::user().with_text(content);+ }++ let mut assistant = ChatMessage::assistant();+ if include_reasoning && let Some(reasoning) = message.reasoning_content.as_deref().filter(|value| !value.is_empty())+ {+ assistant = assistant.with_reasoning(reasoning.to_string());+ }+ assistant.with_text(content)+}++// uzu reads reasoning effort from a system-message block.+pub(super) fn build_messages(+ raw: &[MsgIn],+ reasoning_effort: Option<ReasoningEffort>,+) -> Vec<ChatMessage> {+ let mut messages: Vec<ChatMessage> = raw+ .iter()+ .map(|m| match m.role {+ ChatRole::System {} => ChatMessage::system().with_text(m.content.clone()),+ _ => build_non_system_message(m, false),+ })+ .collect();++ if let Some(effort) = reasoning_effort {+ if let Some(index) = raw.iter().position(|m| matches!(m.role, ChatRole::System {})) {+ messages[index] = messages[index].with_reasoning_effort(effort);+ } else {+ messages.insert(0, ChatMessage::system().with_reasoning_effort(effort));+ }+ }+ messages+}++// uzu rejects another system message in an accumulated session.+pub(super) fn build_tail_messages(tail: &[MsgIn]) -> Vec<ChatMessage> {+ tail.iter().filter(|m| !matches!(m.role, ChatRole::System {})).map(|m| build_non_system_message(m, true)).collect()+}++pub(super) fn assistant_history_message(+ text: &str,+ reasoning: &str,+ promoted_reasoning: bool,+) -> Option<MsgIn> {+ if promoted_reasoning || text.trim().is_empty() {+ return None;+ }+ let content = sanitize(text);+ let reasoning_content = sanitize(reasoning.trim());+ if content != text || reasoning_content != reasoning {+ return None;+ }+ Some(MsgIn {+ role: ChatRole::Assistant {},+ content,+ reasoning_content: (!reasoning_content.is_empty()).then_some(reasoning_content),+ })+}++pub(super) fn parsed_from(+ text: &str,+ reasoning: &str,+) -> Option<Parsed> {+ let chain = reasoning.trim();+ let resp = text.trim();+ if chain.is_empty() && resp.is_empty() {+ return None;+ }+ Some(Parsed {+ chain_of_thought: (!chain.is_empty()).then(|| sanitize(chain)),+ response: (!resp.is_empty()).then(|| sanitize(resp)),+ })+}++#[cfg(test)]+mod tests {+ use super::{super::payloads::test_message, *};++ #[test]+ fn sanitize_drops_replacement_and_control_characters_but_keeps_emoji_sequences() {+ assert_eq!(sanitize("a\u{FFFD}b\u{0000}c\u{FEFF}d\n"), "abcd\n");+ assert_eq!(+ sanitize("👩\u{200D}💻 ❤\u{FE0F} 👨\u{200D}👩\u{200D}👧"),+ "👩\u{200D}💻 ❤\u{FE0F} 👨\u{200D}👩\u{200D}👧"+ );+ }++ #[test]+ fn user_text_reaches_the_model_as_typed() {+ let messages = build_messages(&[test_message(ChatRole::User {}, "what does \u{FFFD} mean?", None)], None);+ assert_eq!(messages[0].text().as_deref(), Some("what does \u{FFFD} mean?"));+ }++ #[test]+ fn incremental_tail_keeps_assistant_reasoning_blocks() {+ let messages = build_tail_messages(&[test_message(ChatRole::Assistant {}, "answer", Some("reasoning"))]);+ assert_eq!(messages[0].text().as_deref(), Some("answer"));+ assert_eq!(messages[0].reasoning().as_deref(), Some("reasoning"));+ }++ #[test]+ fn full_replay_omits_assistant_reasoning_blocks() {+ let messages = build_messages(&[test_message(ChatRole::Assistant {}, "answer", Some("reasoning"))], None);+ assert_eq!(messages[0].text().as_deref(), Some("answer"));+ assert_eq!(messages[0].reasoning(), None);+ }++ #[test]+ fn unsafe_generated_history_is_not_reused() {+ assert!(assistant_history_message("broken \u{FFFD}", "", false).is_none());+ assert!(assistant_history_message("emoji \u{2764}\u{FE0F}", "", false).is_some());+ assert!(assistant_history_message("answer", " reasoning ", false).is_none());+ assert!(assistant_history_message("answer", "reasoning", true).is_none());+ }++ #[test]+ fn exact_generated_history_keeps_reasoning() {+ let message = assistant_history_message("answer", "reasoning", false).expect("history message");+ assert_eq!(message.content, "answer");+ assert_eq!(message.reasoning_content.as_deref(), Some("reasoning"));+ }+}diff --git a/apps/mirai-gui/desktop/src/chat/mod.rs b/apps/mirai-gui/desktop/src/chat/mod.rsnew file mode 100644index 000000000..a4f0ccc20--- /dev/null+++ b/apps/mirai-gui/desktop/src/chat/mod.rs@@ -0,0 +1,398 @@+mod messages;+mod payloads;+mod session;+mod session_events;+mod stream;+mod title;++use std::collections::HashMap;++use payloads::{MsgIn, RunEvent, RunStreamPayload, SamplingDefaults, TitleGenPayload};+use session::arm_idle_timer;+use session_events::emit_session_state;+use stream::run_stream_inner;+use tauri::{AppHandle, Manager, ipc::Channel};+use title::{TITLE_GEN_RUN_ID, title_gen_inner};+use uzu::{+ session::chat::ChatSession,+ types::basic::{CancelToken, ReasoningEffort},+};++use crate::{error::AppResult, models::ReasoningSupport};++const MIN_AUTO_EJECT_IDLE_MS: u64 = 60_000;+const MAX_AUTO_EJECT_IDLE_MS: u64 = 24 * 60 * 60_000;+const DEFAULT_AUTO_EJECT_IDLE_MS: u64 = 2 * 60_000;++struct IdleConfig {+ enabled: bool,+ idle_ms: u64,+}++// The exact message prefix currently represented by the session's KV cache.+#[derive(Default)]+struct SessionHistory {+ repo_id: String,+ messages: Vec<MsgIn>,+ reasoning_effort: Option<ReasoningEffort>,+}++struct ResidentSession {+ repo_id: String,+ identifier: String,+ session: ChatSession,+ support: ReasoningSupport,+ // Read right after load: uzu holds the instance lock for a whole reply, so+ // asking the session later would block until generation ends.+ sampling_defaults: Option<SamplingDefaults>,+}++// A run is registered before its model loads: a cold load takes tens of+// seconds, and a Stop that arrives in that window has no stream token yet.+#[derive(Default)]+struct RunCancel {+ requested: bool,+ token: Option<CancelToken>,+}++pub struct ChatState {+ session: tokio::sync::Mutex<Option<ResidentSession>>,+ // Serializes reset()+reply across run_stream and title_gen: they share one+ // ChatSession, and a concurrent reset() clobbers the other's stream.+ run_lock: tokio::sync::Mutex<()>,+ cancels: std::sync::Mutex<HashMap<String, RunCancel>>,+ idle_config: std::sync::Mutex<IdleConfig>,+ idle_timer: std::sync::Mutex<Option<tauri::async_runtime::JoinHandle<()>>>,+ history: std::sync::Mutex<SessionHistory>,+}++impl Default for ChatState {+ fn default() -> Self {+ Self {+ session: tokio::sync::Mutex::new(None),+ run_lock: tokio::sync::Mutex::new(()),+ cancels: std::sync::Mutex::new(HashMap::new()),+ idle_config: std::sync::Mutex::new(IdleConfig {+ enabled: true,+ idle_ms: DEFAULT_AUTO_EJECT_IDLE_MS,+ }),+ idle_timer: std::sync::Mutex::new(None),+ history: std::sync::Mutex::new(SessionHistory::default()),+ }+ }+}++impl ChatState {+ fn register_run(+ &self,+ run_id: &str,+ ) {+ self.cancels.lock().expect("cancels mutex poisoned").insert(run_id.to_string(), RunCancel::default());+ }++ fn finish_run(+ &self,+ run_id: &str,+ ) {+ self.cancels.lock().expect("cancels mutex poisoned").remove(run_id);+ }++ fn request_cancel(+ &self,+ run_id: &str,+ ) {+ if let Some(run) = self.cancels.lock().expect("cancels mutex poisoned").get_mut(run_id) {+ run.requested = true;+ if let Some(token) = &run.token {+ token.cancel();+ }+ }+ }++ fn cancel_requested(+ &self,+ run_id: &str,+ ) -> bool {+ self.cancels.lock().expect("cancels mutex poisoned").get(run_id).is_some_and(|run| run.requested)+ }++ fn attach_cancel_token(+ &self,+ run_id: &str,+ token: CancelToken,+ ) {+ if let Some(run) = self.cancels.lock().expect("cancels mutex poisoned").get_mut(run_id) {+ if run.requested {+ token.cancel();+ }+ run.token = Some(token);+ }+ }++ fn cancel_idle_timer(&self) {+ if let Some(handle) = self.idle_timer.lock().expect("idle_timer mutex poisoned").take() {+ handle.abort();+ }+ }++ fn plan_run(+ &self,+ repo_id: &str,+ messages: &[MsgIn],+ reasoning_effort: Option<ReasoningEffort>,+ ) -> RunPlan {+ let history = self.history.lock().expect("history mutex poisoned");+ let continues = history.repo_id == repo_id+ && history.reasoning_effort == reasoning_effort+ && messages.len() > history.messages.len()+ && !history.messages.is_empty()+ && messages[..history.messages.len()] == history.messages[..];+ if continues {+ RunPlan::Continue {+ tail: messages[history.messages.len()..].to_vec(),+ }+ } else {+ RunPlan::Replay+ }+ }++ fn remember_history(+ &self,+ repo_id: &str,+ messages: Vec<MsgIn>,+ reasoning_effort: Option<ReasoningEffort>,+ ) {+ let mut history = self.history.lock().expect("history mutex poisoned");+ history.repo_id = repo_id.to_string();+ history.messages = messages;+ history.reasoning_effort = reasoning_effort;+ }++ fn forget_history(&self) {+ *self.history.lock().expect("history mutex poisoned") = SessionHistory::default();+ }++ async fn evict(+ &self,+ app: &AppHandle,+ repo_id: &str,+ ) -> bool {+ let mut guard = self.session.lock().await;+ let had_session = guard.is_some();+ if had_session {+ emit_session_state(app, false, repo_id, true);+ }+ *guard = None;+ self.forget_history();+ if had_session {+ emit_session_state(app, false, repo_id, false);+ }+ had_session+ }+}++enum RunPlan {+ Continue {+ tail: Vec<MsgIn>,+ },+ Replay,+}++// try_lock: while a load holds the session lock there is nothing to report yet,+// and the client re-asks once the session becomes resident.+#[tauri::command]+pub async fn chat_sampling_defaults(+ state: tauri::State<'_, ChatState>,+ repo_id: String,+) -> AppResult<Option<SamplingDefaults>> {+ let Ok(guard) = state.session.try_lock() else {+ return Ok(None);+ };+ Ok(guard.as_ref().filter(|resident| resident.repo_id == repo_id).and_then(|r| r.sampling_defaults.clone()))+}++#[tauri::command]+pub async fn run_stream(+ app: AppHandle,+ state: tauri::State<'_, ChatState>,+ payload: RunStreamPayload,+ on_event: Channel<RunEvent>,+) -> AppResult<()> {+ state.cancel_idle_timer();+ state.register_run(&payload.run_id);+ let result = run_stream_inner(&app, &state, &payload, &on_event).await;+ state.finish_run(&payload.run_id);+ if let Err(error) = result {+ crate::logger::error(+ "chat:run:error",+ Some(serde_json::json!({ "runId": payload.run_id, "repoId": payload.repo_id, "error": error })),+ );+ let _ = on_event.send(RunEvent::Error {+ error: error.to_string(),+ });+ }+ if state.session.lock().await.is_some() {+ arm_idle_timer(&app, &state, &payload.repo_id);+ }+ Ok(())+}++#[tauri::command]+pub async fn title_gen(+ app: AppHandle,+ state: tauri::State<'_, ChatState>,+ payload: TitleGenPayload,+) -> AppResult<String> {+ state.cancel_idle_timer();+ state.register_run(TITLE_GEN_RUN_ID);+ let result = title_gen_inner(&app, &state, &payload).await;+ state.finish_run(TITLE_GEN_RUN_ID);+ if state.session.lock().await.is_some() {+ arm_idle_timer(&app, &state, &payload.repo_id);+ }+ result+}++#[tauri::command]+pub fn cancel_run(+ state: tauri::State<'_, ChatState>,+ run_id: String,+) {+ state.request_cancel(&run_id);+}++#[tauri::command]+pub fn cancel_title_gen(state: tauri::State<'_, ChatState>) {+ state.request_cancel(TITLE_GEN_RUN_ID);+}++#[tauri::command]+pub async fn eject_session(+ app: AppHandle,+ state: tauri::State<'_, ChatState>,+ repo_id: String,+) -> AppResult<()> {+ state.cancel_idle_timer();+ if !state.evict(&app, &repo_id).await {+ emit_session_state(&app, false, &repo_id, false);+ }+ Ok(())+}++fn auto_eject_config_from(settings: &serde_json::Map<String, serde_json::Value>) -> (bool, Option<u64>) {+ let enabled = settings.get("autoEjectEnabled").and_then(|v| v.as_bool()).unwrap_or(true);+ let idle_ms = settings+ .get("autoEjectMinutes")+ .and_then(|v| v.as_f64())+ .filter(|m| m.is_finite() && *m > 0.0)+ .map(|minutes| ((minutes * 60_000.0) as u64).clamp(MIN_AUTO_EJECT_IDLE_MS, MAX_AUTO_EJECT_IDLE_MS));+ (enabled, idle_ms)+}++fn apply_auto_eject_config(+ app: &AppHandle,+ state: &ChatState,+ enabled: bool,+ idle_ms: Option<u64>,+) {+ let mut cfg = state.idle_config.lock().expect("idle_config mutex poisoned");+ cfg.enabled = enabled;+ if let Some(idle_ms) = idle_ms {+ cfg.idle_ms = idle_ms;+ }+ drop(cfg);+ if !enabled {+ state.cancel_idle_timer();+ return;+ }+ // An idle resident session gets the new timer now; a run in progress+ // re-arms it when it finishes.+ let Ok(_idle) = state.run_lock.try_lock() else {+ return;+ };+ let Ok(session) = state.session.try_lock() else {+ return;+ };+ if let Some(resident) = session.as_ref() {+ arm_idle_timer(app, state, &resident.repo_id);+ }+}++pub fn restore_auto_eject_config(app: &AppHandle) {+ let Ok(serde_json::Value::Object(settings)) = crate::storage::settings_load() else {+ return;+ };+ let (enabled, idle_ms) = auto_eject_config_from(&settings);+ apply_auto_eject_config(app, &app.state::<ChatState>(), enabled, idle_ms);+}++// Persisting and applying are one step, so the running timer never disagrees+// with what the next launch will read.+#[tauri::command]+pub fn set_auto_eject_config(+ app: AppHandle,+ state: tauri::State<'_, ChatState>,+ enabled: Option<bool>,+ minutes: Option<f64>,+) -> AppResult<()> {+ let mut patch = serde_json::Map::new();+ if let Some(enabled) = enabled {+ patch.insert("autoEjectEnabled".to_string(), enabled.into());+ }+ if let Some(minutes) = minutes {+ if !(minutes.is_finite() && minutes > 0.0) {+ return Err(crate::error::AppError::msg("autoEjectMinutes must be a positive number"));+ }+ patch.insert("autoEjectMinutes".to_string(), minutes.into());+ }+ let settings = crate::storage::settings_merge(patch)?;+ let (enabled, idle_ms) = auto_eject_config_from(&settings);+ apply_auto_eject_config(&app, &state, enabled, idle_ms);+ Ok(())+}++#[cfg(test)]+mod tests {+ use uzu::types::session::chat::ChatRole;++ #[test]+ fn auto_eject_defaults_to_enabled_with_no_interval_override() {+ let settings = serde_json::Map::new();+ assert_eq!(auto_eject_config_from(&settings), (true, None));+ }++ #[test]+ fn auto_eject_interval_is_clamped_and_bad_values_are_ignored() {+ let mut settings = serde_json::Map::new();+ settings.insert("autoEjectEnabled".to_string(), false.into());+ settings.insert("autoEjectMinutes".to_string(), 0.1.into());+ assert_eq!(auto_eject_config_from(&settings), (false, Some(MIN_AUTO_EJECT_IDLE_MS)));++ settings.insert("autoEjectMinutes".to_string(), 100_000.into());+ assert_eq!(auto_eject_config_from(&settings).1, Some(MAX_AUTO_EJECT_IDLE_MS));++ settings.insert("autoEjectMinutes".to_string(), (-3).into());+ assert_eq!(auto_eject_config_from(&settings).1, None);+ }++ use super::{payloads::test_message, *};++ #[test]+ fn continues_only_when_reasoning_prefix_matches() {+ let state = ChatState::default();+ let history = vec![+ test_message(ChatRole::User {}, "question", None),+ test_message(ChatRole::Assistant {}, "answer", Some("first path")),+ ];+ state.remember_history("model", history.clone(), Some(ReasoningEffort::Medium));++ let mut continued = history.clone();+ continued.push(test_message(ChatRole::User {}, "next", None));+ assert!(matches!(state.plan_run("model", &continued, Some(ReasoningEffort::Medium)), RunPlan::Continue { .. }));++ let mut changed = history;+ changed[1].reasoning_content = Some("second path".to_string());+ changed.push(test_message(ChatRole::User {}, "next", None));+ assert!(matches!(state.plan_run("model", &changed, Some(ReasoningEffort::Medium)), RunPlan::Replay));+ }+}diff --git a/apps/mirai-gui/desktop/src/chat/payloads.rs b/apps/mirai-gui/desktop/src/chat/payloads.rsnew file mode 100644index 000000000..5624761aa--- /dev/null+++ b/apps/mirai-gui/desktop/src/chat/payloads.rs@@ -0,0 +1,254 @@+use serde::{Deserialize, Serialize};+use uzu::types::{+ basic::{ReasoningEffort, SamplingMethod, SamplingPolicy},+ session::chat::{ChatReply, ChatReplyFinishReason, ChatRole},+};++#[derive(Deserialize, Clone)]+#[serde(rename_all = "camelCase")]+pub struct RunStreamPayload {+ pub run_id: String,+ pub repo_id: String,+ #[serde(default)]+ pub messages: Vec<MsgIn>,+ #[serde(default)]+ pub sampling_policy: Option<SamplingPolicyPayload>,+ #[serde(default)]+ pub reasoning_effort: Option<ReasoningEffort>,+}++#[derive(Serialize, Clone)]+#[serde(rename_all = "camelCase")]+pub struct SamplingDefaults {+ pub temperature: Option<f64>,+ pub top_k: Option<i64>,+ pub top_p: Option<f64>,+ pub min_p: Option<f64>,+ pub repetition_penalty: Option<f64>,+ pub suffix_repetition_length: Option<i64>,+}++#[derive(Deserialize, Clone, PartialEq)]+pub struct MsgIn {+ pub role: ChatRole,+ pub content: String,+ #[serde(default, rename = "reasoningContent")]+ pub reasoning_content: Option<String>,+}++#[derive(Deserialize, Clone)]+#[serde(tag = "type")]+pub enum SamplingPolicyPayload {+ Default,+ Argmax,+ #[serde(rename_all = "camelCase")]+ Stochastic {+ temperature: Option<f64>,+ top_k: Option<i64>,+ top_p: Option<f64>,+ min_p: Option<f64>,+ #[serde(default)]+ repetition_penalty: Option<f64>,+ #[serde(default)]+ suffix_repetition_length: Option<i64>,+ },+}++#[derive(Serialize, Clone, Default)]+#[serde(rename_all = "camelCase")]+pub struct Parsed {+ #[serde(skip_serializing_if = "Option::is_none")]+ pub chain_of_thought: Option<String>,+ #[serde(skip_serializing_if = "Option::is_none")]+ pub response: Option<String>,+}++#[derive(Serialize, Clone)]+#[serde(rename_all = "camelCase")]+pub struct RunStatsSection {+ pub duration: f64,+ pub tokens_count: u32,+ pub tokens_per_second: f64,+}++#[derive(Serialize, Clone)]+#[serde(rename_all = "camelCase")]+pub struct TotalStats {+ pub duration: f64,+ pub tokens_count_input: u32,+ pub tokens_count_output: u32,+}++#[derive(Serialize, Clone)]+#[serde(rename_all = "camelCase")]+pub struct SessionOutputStats {+ pub prefill_stats: RunStatsSection,+ pub generate_stats: RunStatsSection,+ pub total_stats: TotalStats,+}++#[derive(Serialize, Clone)]+#[serde(tag = "type", rename_all = "camelCase")]+pub enum RunEvent {+ #[serde(rename_all = "camelCase")]+ Chunk {+ delta: String,+ #[serde(skip_serializing_if = "Option::is_none")]+ parsed: Option<Parsed>,+ },+ #[serde(rename_all = "camelCase")]+ Done {+ text: String,+ stats: SessionOutputStats,+ #[serde(skip_serializing_if = "Option::is_none")]+ finish_reason: Option<ChatReplyFinishReason>,+ #[serde(skip_serializing_if = "Option::is_none")]+ parsed: Option<Parsed>,+ },+ #[serde(rename_all = "camelCase")]+ Error {+ error: String,+ },+}++pub(super) fn map_reply_stats(reply: Option<&ChatReply>) -> SessionOutputStats {+ let stats = reply.map(|r| &r.stats);+ let prefill_duration = stats.and_then(|s| s.time_to_first_token).unwrap_or(0.0);+ let total_duration = stats.map(|s| s.duration).unwrap_or(0.0);+ let generate_duration = (total_duration - prefill_duration).max(0.0);+ let input_tokens = stats.and_then(|s| s.tokens_count_input).unwrap_or(0);+ let output_tokens = stats.and_then(|s| s.tokens_count_output).unwrap_or(0);+ SessionOutputStats {+ prefill_stats: RunStatsSection {+ duration: prefill_duration,+ tokens_count: input_tokens,+ tokens_per_second: stats.and_then(|s| s.prefill_tokens_per_second).unwrap_or(0.0),+ },+ generate_stats: RunStatsSection {+ duration: generate_duration,+ tokens_count: output_tokens,+ tokens_per_second: stats.and_then(|s| s.generate_tokens_per_second).unwrap_or(0.0),+ },+ total_stats: TotalStats {+ duration: total_duration,+ tokens_count_input: input_tokens,+ tokens_count_output: output_tokens,+ },+ }+}++pub(super) fn sampling_policy(payload: &Option<SamplingPolicyPayload>) -> SamplingPolicy {+ match payload {+ None | Some(SamplingPolicyPayload::Default) => SamplingPolicy::Default {},+ Some(SamplingPolicyPayload::Argmax) => SamplingPolicy::Custom {+ method: SamplingMethod::Greedy {},+ },+ Some(SamplingPolicyPayload::Stochastic {+ temperature: Some(temperature),+ ..+ }) if *temperature <= 0.0 => SamplingPolicy::Custom {+ method: SamplingMethod::Greedy {},+ },+ Some(SamplingPolicyPayload::Stochastic {+ temperature,+ top_k,+ top_p,+ min_p,+ repetition_penalty,+ suffix_repetition_length,+ }) => {+ SamplingPolicy::Custom {+ method: SamplingMethod::Stochastic {+ temperature: *temperature,+ top_k: *top_k,+ top_p: *top_p,+ min_p: *min_p,+ repetition_penalty: *repetition_penalty,+ // uzu panics on penalty without suffix length (and on 0).+ suffix_repetition_length: repetition_penalty+ .map(|_| suffix_repetition_length.filter(|v| *v > 0).unwrap_or(32)),+ },+ }+ },+ }+}++#[derive(Deserialize, Clone)]+#[serde(rename_all = "camelCase")]+pub struct TitleGenPayload {+ pub repo_id: String,+ #[serde(default)]+ pub messages: Vec<MsgIn>,+}++#[cfg(test)]+pub(super) fn test_message(+ role: ChatRole,+ content: &str,+ reasoning: Option<&str>,+) -> MsgIn {+ MsgIn {+ role,+ content: content.to_string(),+ reasoning_content: reasoning.map(str::to_string),+ }+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn deserializes_client_reasoning_content() {+ let message: MsgIn = serde_json::from_value(serde_json::json!({+ "role": "assistant",+ "content": "answer",+ "reasoningContent": "reasoning"+ }))+ .expect("message");+ assert_eq!(message.role, ChatRole::Assistant {});+ assert_eq!(message.reasoning_content.as_deref(), Some("reasoning"));+ }++ #[test]+ fn zero_temperature_samples_greedily() {+ let stochastic = |temperature: f64| {+ Some(SamplingPolicyPayload::Stochastic {+ temperature: Some(temperature),+ top_k: Some(40),+ top_p: None,+ min_p: None,+ repetition_penalty: None,+ suffix_repetition_length: None,+ })+ };+ assert!(matches!(+ sampling_policy(&stochastic(0.0)),+ SamplingPolicy::Custom {+ method: SamplingMethod::Greedy {}+ }+ ));+ assert!(matches!(+ sampling_policy(&stochastic(0.7)),+ SamplingPolicy::Custom {+ method: SamplingMethod::Stochastic { .. }+ }+ ));+ }++ #[test]+ fn finish_reason_names_are_the_client_contract() {+ let names: Vec<String> = [+ ChatReplyFinishReason::Stop,+ ChatReplyFinishReason::Length,+ ChatReplyFinishReason::Cancelled,+ ChatReplyFinishReason::ContextLimitReached,+ ChatReplyFinishReason::ToolCalls,+ ChatReplyFinishReason::Rejected,+ ]+ .iter()+ .map(|reason| serde_json::to_value(reason).expect("json").as_str().expect("string").to_string())+ .collect();+ assert_eq!(names, ["Stop", "Length", "Cancelled", "ContextLimitReached", "ToolCalls", "Rejected"]);+ }+}diff --git a/apps/mirai-gui/desktop/src/chat/session.rs b/apps/mirai-gui/desktop/src/chat/session.rsnew file mode 100644index 000000000..4cec06fa2--- /dev/null+++ b/apps/mirai-gui/desktop/src/chat/session.rs@@ -0,0 +1,90 @@+use tauri::{AppHandle, Manager};+use uzu::{session::chat::ChatSession, types::session::chat::ChatConfig};++use super::{+ ChatState, ResidentSession,+ payloads::SamplingDefaults,+ session_events::{LoadingStatus, emit_session_loading, emit_session_state},+};+use crate::{+ engine::engine,+ error::{AppError, AppResult},+ models::{ReasoningSupport, find_chat_model, reasoning_support},+};++pub(super) fn arm_idle_timer(+ app: &AppHandle,+ state: &ChatState,+ repo_id: &str,+) {+ let (enabled, idle_ms) = {+ let cfg = state.idle_config.lock().expect("idle_config mutex poisoned");+ (cfg.enabled, cfg.idle_ms)+ };+ state.cancel_idle_timer();+ if !enabled {+ return;+ }+ let app = app.clone();+ let repo_id = repo_id.to_string();+ let handle = tauri::async_runtime::spawn(async move {+ tokio::time::sleep(std::time::Duration::from_millis(idle_ms)).await;+ let state = app.state::<ChatState>();+ state.evict(&app, &repo_id).await;+ });+ *state.idle_timer.lock().expect("idle_timer mutex poisoned") = Some(handle);+}++pub(super) async fn ensure_session(+ app: &AppHandle,+ state: &ChatState,+ repo_id: &str,+) -> AppResult<(ChatSession, ReasoningSupport)> {+ let model = find_chat_model(repo_id).await?;+ let engine = engine().await?;+ let download_state = engine.download_state(&model).await;+ let downloaded =+ download_state.as_ref().is_some_and(|s| matches!(s.phase, uzu::storage::DownloadPhase::Downloaded {}));+ if model.is_downloadable() && !downloaded {+ return Err(AppError::msg("Model is not downloaded"));+ }+ let mut guard = state.session.lock().await;+ if let Some(resident) = guard.as_ref()+ && resident.identifier == model.identifier+ {+ return Ok((resident.session.clone(), resident.support.clone()));+ }+ let support = reasoning_support(&model);+ *guard = None;+ state.forget_history();+ // Loading events only on the real load path: emitting them on session reuse+ // would flash the spinner and the resident-model chip.+ emit_session_loading(app, LoadingStatus::Start, repo_id, None);+ let config = ChatConfig::create();+ let session = match engine.chat(model.clone(), config).await {+ Ok(session) => session,+ Err(error) => {+ emit_session_loading(app, LoadingStatus::Error, repo_id, Some(error.to_string()));+ return Err(error.into());+ },+ };+ // uzu stores these as f32; widening leaves 0.6 as 0.6000000238.+ let round = |v: Option<f64>| v.map(|v| (v * 10_000.0).round() / 10_000.0);+ let sampling_defaults = session.sampling_defaults().await.map(|p| SamplingDefaults {+ temperature: round(p.temperature),+ top_k: p.top_k,+ top_p: round(p.top_p),+ min_p: round(p.min_p),+ repetition_penalty: round(p.repetition_penalty),+ suffix_repetition_length: p.suffix_repetition_length,+ });+ *guard = Some(ResidentSession {+ repo_id: repo_id.to_string(),+ identifier: model.identifier.clone(),+ session: session.clone(),+ support: support.clone(),+ sampling_defaults,+ });+ emit_session_state(app, true, repo_id, false);+ Ok((session, support))+}diff --git a/apps/mirai-gui/desktop/src/chat/session_events.rs b/apps/mirai-gui/desktop/src/chat/session_events.rsnew file mode 100644index 000000000..d60956202--- /dev/null+++ b/apps/mirai-gui/desktop/src/chat/session_events.rs@@ -0,0 +1,63 @@+use serde::Serialize;+use tauri::{AppHandle, Emitter};++#[derive(Serialize, Clone, Copy)]+#[serde(rename_all = "lowercase")]+pub enum LoadingStatus {+ Start,+ Error,+}++#[derive(Serialize, Clone)]+#[serde(rename_all = "camelCase")]+struct SessionLoadingEvent {+ status: LoadingStatus,+ repo_id: String,+}++#[derive(Serialize, Clone)]+#[serde(rename_all = "camelCase")]+struct SessionStateEvent {+ active: bool,+ repo_id: String,+ is_ejecting: bool,+}++pub fn emit_session_loading(+ app: &AppHandle,+ status: LoadingStatus,+ repo_id: &str,+ error: Option<String>,+) {+ crate::logger::info(+ "session:loading",+ Some(serde_json::json!({ "status": status, "repoId": repo_id, "error": error })),+ );+ let _ = app.emit(+ "session-loading",+ SessionLoadingEvent {+ status,+ repo_id: repo_id.to_string(),+ },+ );+}++pub fn emit_session_state(+ app: &AppHandle,+ active: bool,+ repo_id: &str,+ is_ejecting: bool,+) {+ crate::logger::info(+ "session:state",+ Some(serde_json::json!({ "active": active, "repoId": repo_id, "isEjecting": is_ejecting })),+ );+ let _ = app.emit(+ "session-state",+ SessionStateEvent {+ active,+ repo_id: repo_id.to_string(),+ is_ejecting,+ },+ );+}diff --git a/apps/mirai-gui/desktop/src/chat/stream.rs b/apps/mirai-gui/desktop/src/chat/stream.rsnew file mode 100644index 000000000..13d0154c0--- /dev/null+++ b/apps/mirai-gui/desktop/src/chat/stream.rs@@ -0,0 +1,204 @@+use tauri::{AppHandle, ipc::Channel};+use uzu::{+ session::chat::{ChatSessionError, ChatSessionStreamChunk},+ types::{+ basic::ReasoningEffort,+ session::chat::{ChatReply, ChatReplyConfig, ChatReplyFinishReason},+ },+};++use super::{+ ChatState, RunPlan,+ messages::{assistant_history_message, build_messages, build_tail_messages, parsed_from, sanitize},+ payloads::{Parsed, RunEvent, RunStreamPayload, map_reply_stats, sampling_policy},+ session::ensure_session,+};+use crate::error::{AppError, AppResult};++const DEFAULT_CHAT_TOKENS_LIMIT: u32 = 8_192;++// uzu turns LanguageModelStreamError::ContextOverflow into Backend { message },+// so the variant cannot tell an overflow from any other backend failure.+const ENGINE_CONTEXT_OVERFLOW: &str = "Context overflow";++fn stream_error(error: ChatSessionError) -> AppError {+ match &error {+ ChatSessionError::Backend {+ message,+ } if message == ENGINE_CONTEXT_OVERFLOW => {+ AppError::msg("Conversation is too long for this model's context window.")+ },+ _ => error.into(),+ }+}++pub(super) async fn run_stream_inner(+ app: &AppHandle,+ state: &ChatState,+ payload: &RunStreamPayload,+ on_event: &Channel<RunEvent>,+) -> AppResult<()> {+ let _run_guard = state.run_lock.lock().await;+ let (session, support) = ensure_session(app, state, &payload.repo_id).await?;+ if state.cancel_requested(&payload.run_id) {+ crate::logger::info("chat:run:cancelled-before-start", Some(serde_json::json!({ "runId": payload.run_id })));+ let _ = on_event.send(RunEvent::Done {+ text: String::new(),+ stats: map_reply_stats(None),+ finish_reason: Some(ChatReplyFinishReason::Cancelled),+ parsed: None,+ });+ return Ok(());+ }+ let effort = support.effective(payload.reasoning_effort);++ let reply_config = ChatReplyConfig::create()+ .with_token_limit(Some(DEFAULT_CHAT_TOKENS_LIMIT))+ .with_sampling_policy(sampling_policy(&payload.sampling_policy));++ let plan = state.plan_run(&payload.repo_id, &payload.messages, effort);+ crate::logger::info(+ "chat:run:start",+ Some(serde_json::json!({+ "runId": payload.run_id,+ "repoId": payload.repo_id,+ "requestedEffort": payload.reasoning_effort,+ "support": support,+ "effort": effort,+ "plan": match &plan { RunPlan::Continue { tail } => format!("continue:{}", tail.len()), RunPlan::Replay => "replay".to_string() },+ "messages": payload.messages.len(),+ })),+ );+ let messages = match plan {+ RunPlan::Continue {+ tail,+ } => build_tail_messages(&tail),+ RunPlan::Replay => {+ // Full replay requires resetting uzu's accumulated role validator.+ if let Err(error) = session.reset().await {+ state.evict(app, &payload.repo_id).await;+ return Err(error.into());+ }+ build_messages(&payload.messages, effort)+ },+ };+ state.forget_history();++ let stream = session.reply_with_stream(messages, reply_config).await;+ state.attach_cancel_token(&payload.run_id, stream.cancel_token());++ let should_promote_reasoning = effort == Some(ReasoningEffort::Disabled);+ let effective_channels = |reply: Option<&ChatReply>| -> (String, String) {+ let text = reply.and_then(|r| r.message.text()).unwrap_or_default();+ let reasoning = reply.and_then(|r| r.message.reasoning()).unwrap_or_default();+ if should_promote_reasoning && text.is_empty() && !reasoning.is_empty() {+ (reasoning, String::new())+ } else {+ (text, reasoning)+ }+ };++ let mut output: Option<ChatReply> = None;+ let mut last_parsed: Option<Parsed> = None;+ let mut prev_text_len = 0usize;+ let mut prev_reasoning_len = 0usize;++ while let Some(chunk) = stream.next().await {+ match chunk {+ ChatSessionStreamChunk::Error {+ error,+ } => {+ return Err(stream_error(error));+ },+ ChatSessionStreamChunk::Replies {+ replies,+ } => {+ let reply = replies.into_iter().next();+ if reply.is_some() {+ output = reply;+ }+ let (text, reasoning) = effective_channels(output.as_ref());+ last_parsed = parsed_from(&text, &reasoning);+ let text_grew = text.len() > prev_text_len;+ let reasoning_grew = reasoning.len() > prev_reasoning_len;+ // A previous length off a char boundary means a re-sent snapshot; skip+ // the delta, Done carries the full text.+ let delta = if text_grew {+ text.get(prev_text_len..).unwrap_or("")+ } else {+ ""+ };+ if text_grew {+ prev_text_len = text.len();+ }+ if reasoning_grew {+ prev_reasoning_len = reasoning.len();+ }+ if text_grew || reasoning_grew {+ let parsed_patch = reasoning_grew.then(|| parsed_from("", &reasoning)).flatten();+ let _ = on_event.send(RunEvent::Chunk {+ delta: sanitize(delta),+ parsed: parsed_patch,+ });+ }+ },+ }+ }++ let raw_text = output.as_ref().and_then(|r| r.message.text()).unwrap_or_default();+ let raw_reasoning = output.as_ref().and_then(|r| r.message.reasoning()).unwrap_or_default();+ let promoted_reasoning = should_promote_reasoning && raw_text.is_empty() && !raw_reasoning.is_empty();+ let (text, reasoning) = effective_channels(output.as_ref());+ let finish_reason = output.as_ref().and_then(|r| r.finish_reason.as_ref());++ // Cancelled or truncated replies may diverge from what the client persists.+ if let (Some(ChatReplyFinishReason::Stop), Some(assistant)) =+ (finish_reason, assistant_history_message(&raw_text, &raw_reasoning, promoted_reasoning))+ {+ let mut history = payload.messages.clone();+ history.push(assistant);+ state.remember_history(&payload.repo_id, history, effort);+ }+ let finish_reason = finish_reason.cloned();+ crate::logger::info(+ "chat:run:done",+ Some(serde_json::json!({+ "runId": payload.run_id,+ "finishReason": finish_reason,+ "textLen": raw_text.len(),+ "reasoningLen": raw_reasoning.len(),+ "promoted": promoted_reasoning,+ })),+ );++ let _ = on_event.send(RunEvent::Done {+ text: sanitize(&text),+ stats: map_reply_stats(output.as_ref()),+ finish_reason,+ parsed: last_parsed.or_else(|| parsed_from(&text, &reasoning)),+ });+ Ok(())+}++#[cfg(test)]+mod tests {+ use super::*;++ fn backend(message: &str) -> ChatSessionError {+ ChatSessionError::Backend {+ message: message.to_string(),+ }+ }++ #[test]+ fn engine_context_overflow_gets_a_readable_message() {+ let error = stream_error(backend(ENGINE_CONTEXT_OVERFLOW));+ assert_eq!(error.to_string(), "Conversation is too long for this model's context window.");+ }++ #[test]+ fn other_backend_errors_pass_through() {+ let error = stream_error(backend("No seed token"));+ assert_eq!(error.to_string(), "Backend error: No seed token");+ }+}diff --git a/apps/mirai-gui/desktop/src/chat/title.rs b/apps/mirai-gui/desktop/src/chat/title.rsnew file mode 100644index 000000000..4f128b974--- /dev/null+++ b/apps/mirai-gui/desktop/src/chat/title.rs@@ -0,0 +1,81 @@+use tauri::AppHandle;+use uzu::{+ session::chat::ChatSessionStreamChunk,+ types::{+ basic::SamplingPolicy,+ session::chat::{ChatReply, ChatReplyConfig},+ },+};++use super::{+ ChatState,+ messages::{build_messages, sanitize},+ payloads::TitleGenPayload,+ session::ensure_session,+};+use crate::{error::AppResult, models::ReasoningSupport};++const DEFAULT_TITLE_GEN_TOKENS_LIMIT: u32 = 40;+pub(super) const TITLE_GEN_RUN_ID: &str = "title-gen";++pub(super) async fn title_gen_inner(+ app: &AppHandle,+ state: &ChatState,+ payload: &TitleGenPayload,+) -> AppResult<String> {+ let _run_guard = state.run_lock.lock().await;+ let (session, support) = ensure_session(app, state, &payload.repo_id).await?;+ if state.cancel_requested(TITLE_GEN_RUN_ID) {+ return Ok(String::new());+ }+ // Such a model spends the whole budget on reasoning; a bigger budget would delay the reply.+ if matches!(support, ReasoningSupport::AlwaysOn) {+ crate::logger::info(+ "title-gen:skip",+ Some(serde_json::json!({ "repoId": payload.repo_id, "reason": "alwaysOn" })),+ );+ return Ok(String::new());+ }+ let messages = build_messages(&payload.messages, support.cheapest());++ let reply_config = ChatReplyConfig::create()+ .with_token_limit(Some(DEFAULT_TITLE_GEN_TOKENS_LIMIT))+ .with_sampling_policy(SamplingPolicy::Default {});++ // reset() invalidates the KV prefix tracked for chat runs.+ state.forget_history();+ if let Err(error) = session.reset().await {+ state.evict(app, &payload.repo_id).await;+ return Err(error.into());+ }+ let stream = session.reply_with_stream(messages, reply_config).await;+ state.attach_cancel_token(TITLE_GEN_RUN_ID, stream.cancel_token());++ let mut output: Option<ChatReply> = None;+ while let Some(chunk) = stream.next().await {+ match chunk {+ ChatSessionStreamChunk::Error {+ error,+ } => return Err(error.into()),+ ChatSessionStreamChunk::Replies {+ replies,+ } => {+ if let Some(reply) = replies.into_iter().next() {+ output = Some(reply);+ }+ },+ }+ }+ let text = output.as_ref().and_then(|r| r.message.text()).unwrap_or_default();+ let reasoning = output.as_ref().and_then(|r| r.message.reasoning()).unwrap_or_default();+ crate::logger::info(+ "title-gen:done",+ Some(serde_json::json!({+ "repoId": payload.repo_id,+ "finishReason": output.as_ref().and_then(|r| r.finish_reason.as_ref()),+ "textLen": text.chars().count(),+ "reasoningLen": reasoning.chars().count(),+ })),+ );+ Ok(sanitize(text.trim()))+}diff --git a/apps/mirai-gui/desktop/src/cli_installer/authorization.rs b/apps/mirai-gui/desktop/src/cli_installer/authorization.rsnew file mode 100644index 000000000..6ec37dd89--- /dev/null+++ b/apps/mirai-gui/desktop/src/cli_installer/authorization.rs@@ -0,0 +1,184 @@+use std::{+ ffi::CString,+ os::raw::{c_char, c_int, c_void},+};++type AuthorizationRef = *mut c_void;+type CFTypeRef = *const c_void;+type CFStringRef = *const c_void;++#[repr(C)]+struct AuthorizationItem {+ name: *const c_char,+ value_length: usize,+ value: *mut c_void,+ flags: u32,+}++#[repr(C)]+struct AuthorizationItemSet {+ count: u32,+ items: *mut AuthorizationItem,+}++const ERR_SUCCESS: i32 = 0;+const ERR_CANCELED: i32 = -60006;+const ERR_DENIED: i32 = -60005;++const FLAG_DEFAULTS: u32 = 0;+const FLAG_INTERACTION_ALLOWED: u32 = 1 << 0;+const FLAG_EXTEND_RIGHTS: u32 = 1 << 1;+const FLAG_DESTROY_RIGHTS: u32 = 1 << 3;++const K_CFSTRING_ENCODING_UTF8: u32 = 0x0800_0100;++#[link(name = "Security", kind = "framework")]+unsafe extern "C" {+ fn AuthorizationCreate(+ rights: *const AuthorizationItemSet,+ environment: *const AuthorizationItemSet,+ flags: u32,+ authorization: *mut AuthorizationRef,+ ) -> i32;+ fn AuthorizationRightGet(+ right_name: *const c_char,+ right_definition: *mut CFTypeRef,+ ) -> i32;+ fn AuthorizationRightSet(+ auth_ref: AuthorizationRef,+ right_name: *const c_char,+ right_definition: CFTypeRef,+ description_key: CFStringRef,+ bundle: *const c_void,+ locale_table_name: CFStringRef,+ ) -> i32;+ fn AuthorizationCopyRights(+ authorization: AuthorizationRef,+ rights: *const AuthorizationItemSet,+ environment: *const AuthorizationItemSet,+ flags: u32,+ authorized_rights: *mut *mut AuthorizationItemSet,+ ) -> i32;+ fn AuthorizationExecuteWithPrivileges(+ authorization: AuthorizationRef,+ path_to_tool: *const c_char,+ options: u32,+ arguments: *const *const c_char,+ communications_pipe: *mut *mut c_void,+ ) -> i32;+ fn AuthorizationFree(+ authorization: AuthorizationRef,+ flags: u32,+ ) -> i32;+}++#[link(name = "CoreFoundation", kind = "framework")]+unsafe extern "C" {+ fn CFStringCreateWithCString(+ alloc: *const c_void,+ c_str: *const c_char,+ encoding: u32,+ ) -> CFStringRef;+ fn CFRelease(cf: CFTypeRef);+}++unsafe extern "C" {+ fn fread(+ ptr: *mut c_void,+ size: usize,+ nitems: usize,+ stream: *mut c_void,+ ) -> usize;+ fn fclose(stream: *mut c_void) -> c_int;+}++#[derive(Debug, thiserror::Error)]+pub enum AuthError {+ // cli_install turns this into the Cancelled result instead of an error.+ #[error("cancelled")]+ Cancelled,+ #[error("{0}")]+ Other(String),+}++pub fn run_privileged(+ bundle_id: &str,+ right_suffix: &str,+ prompt: &str,+ sh_command: &str,+) -> Result<(), AuthError> {+ let right_name =+ CString::new(format!("{bundle_id}.{right_suffix}")).map_err(|e| AuthError::Other(e.to_string()))?;+ let rule = CString::new("authenticate-admin").unwrap();+ let prompt_c = CString::new(prompt).map_err(|e| AuthError::Other(e.to_string()))?;+ let shell = CString::new("/bin/sh").unwrap();+ let flag_c = CString::new("-c").unwrap();+ let cmd_c = CString::new(sh_command).map_err(|e| AuthError::Other(e.to_string()))?;++ unsafe {+ let mut auth: AuthorizationRef = std::ptr::null_mut();+ if AuthorizationCreate(std::ptr::null(), std::ptr::null(), FLAG_DEFAULTS, &mut auth) != ERR_SUCCESS {+ return Err(AuthError::Other("AuthorizationCreate failed".into()));+ }+ let free = |auth: AuthorizationRef| {+ AuthorizationFree(auth, FLAG_DESTROY_RIGHTS);+ };++ // Register the right only when absent to avoid churning the policy database.+ if AuthorizationRightGet(right_name.as_ptr(), std::ptr::null_mut()) == ERR_DENIED {+ let rule_cf = CFStringCreateWithCString(std::ptr::null(), rule.as_ptr(), K_CFSTRING_ENCODING_UTF8);+ let prompt_cf = CFStringCreateWithCString(std::ptr::null(), prompt_c.as_ptr(), K_CFSTRING_ENCODING_UTF8);+ AuthorizationRightSet(auth, right_name.as_ptr(), rule_cf, prompt_cf, std::ptr::null(), std::ptr::null());+ CFRelease(rule_cf);+ CFRelease(prompt_cf);+ }++ let mut right_item = AuthorizationItem {+ name: right_name.as_ptr(),+ value_length: 0,+ value: std::ptr::null_mut(),+ flags: 0,+ };+ let rights = AuthorizationItemSet {+ count: 1,+ items: &mut right_item,+ };+ let status = AuthorizationCopyRights(+ auth,+ &rights,+ std::ptr::null(),+ FLAG_EXTEND_RIGHTS | FLAG_INTERACTION_ALLOWED,+ std::ptr::null_mut(),+ );+ if status != ERR_SUCCESS {+ free(auth);+ return Err(if status == ERR_CANCELED {+ AuthError::Cancelled+ } else {+ AuthError::Other(format!("AuthorizationCopyRights failed: {status}"))+ });+ }++ let argv: [*const c_char; 3] = [flag_c.as_ptr(), cmd_c.as_ptr(), std::ptr::null()];+ let mut pipe: *mut c_void = std::ptr::null_mut();+ let status = AuthorizationExecuteWithPrivileges(auth, shell.as_ptr(), FLAG_DEFAULTS, argv.as_ptr(), &mut pipe);+ if status != ERR_SUCCESS {+ free(auth);+ return Err(if status == ERR_CANCELED {+ AuthError::Cancelled+ } else {+ AuthError::Other(format!("AuthorizationExecuteWithPrivileges failed: {status}"))+ });+ }++ // Drain to EOF: blocks until the privileged /bin/sh finishes+ // without reaping unrelated children.+ if !pipe.is_null() {+ let mut buf = [0u8; 256];+ while fread(buf.as_mut_ptr().cast(), 1, buf.len(), pipe) > 0 {}+ fclose(pipe);+ }+ free(auth);+ }+ Ok(())+}diff --git a/apps/mirai-gui/desktop/src/cli_installer/mod.rs b/apps/mirai-gui/desktop/src/cli_installer/mod.rsnew file mode 100644index 000000000..3371017a7--- /dev/null+++ b/apps/mirai-gui/desktop/src/cli_installer/mod.rs@@ -0,0 +1,270 @@+mod authorization;++pub use authorization::AuthError;+use serde::Serialize;+use tauri::{AppHandle, Manager};++use crate::error::{AppError, AppResult};++// Installs a /usr/local/bin/mirai wrapper resolving the CLI bundled in app+// resources. Writing there needs admin rights; a custom Authorization Services+// right (not system.privilege.admin) lets macOS remember the grant per app.++const WRAPPER_PATH: &str = "/usr/local/bin/mirai";+const WRAPPER_MARKER: &str = "# mirai-cli-wrapper";++const PROMPT_TEXT: &str = "Mirai is trying to install its command line interface (CLI) tool.";+const RIGHT_SUFFIX: &str = "cli-symlink";+// The wrapper resolves this one bundle; a build with another identifier owning+// /usr/local/bin/mirai would point it at the wrong app.+const BUNDLE_ID: &str = "com.mirai.tech.chat";++fn wrapper_script() -> String {+ format!(+ r#"#!/bin/bash+{WRAPPER_MARKER}+set -euo pipefail++APP_CANDIDATES=(+ "/Applications/Mirai.app"+)+FOUND_APP="$(/usr/bin/mdfind "kMDItemCFBundleIdentifier == '{BUNDLE_ID}'" | /usr/bin/grep -m1 -E '\.app$' || true)"+if [ -n "${{FOUND_APP}}" ]; then+ APP_CANDIDATES+=("${{FOUND_APP}}")+fi++for APP_PATH in "${{APP_CANDIDATES[@]}}"; do+ [ -d "${{APP_PATH}}" ] || continue+ CLI="${{APP_PATH}}/Contents/Resources/cli/mirai"+ if [ -x "${{CLI}}" ]; then+ exec "${{CLI}}" "$@"+ fi+ # Scoped to the bundle so it can't exec a stray 'mirai'.+ CLI="$(/usr/bin/find "${{APP_PATH}}/Contents" -type f -name 'mirai' -perm -111 -print -quit 2>/dev/null || true)"+ if [ -n "${{CLI}}" ]; then+ exec "${{CLI}}" "$@"+ fi+done++echo "mirai: Mirai CLI not found. Please reinstall Mirai." 1>&2+exit 1+"#+ )+}++// The wrapper execs the CLI shipped in app resources; a bundle built without it+// has nothing to install. Debug runs resolve resources to target/debug, where+// tauri-build leaves copies from earlier configs, so the file check alone is+// not enough there.+fn available(app: &AppHandle) -> bool {+ !cfg!(debug_assertions)+ && app.config().identifier == BUNDLE_ID+ && app.path().resource_dir().is_ok_and(|dir| dir.join("cli/mirai").is_file())+}++#[derive(Debug, PartialEq)]+enum WrapperState {+ Current,+ Missing,+ // A /usr/local/bin/mirai the app didn't write; leave it alone.+ Foreign,+}++fn wrapper_state() -> WrapperState {+ wrapper_state_at(std::path::Path::new(WRAPPER_PATH))+}++fn wrapper_state_at(path: &std::path::Path) -> WrapperState {+ match std::fs::read(path) {+ // The wrapper locates the CLI at run time, so an existing one needs no+ // reinstall.+ Ok(bytes) if String::from_utf8_lossy(&bytes).contains(WRAPPER_MARKER) => WrapperState::Current,+ Ok(_) => WrapperState::Foreign,+ // `read` follows symlinks, so NotFound alone may be a dangling link that+ // is still somebody's; only a path with no entry at all is missing.+ Err(error) if error.kind() == std::io::ErrorKind::NotFound && std::fs::symlink_metadata(path).is_err() => {+ WrapperState::Missing+ },+ Err(_) => WrapperState::Foreign,+ }+}++fn install_wrapper() -> AppResult<()> {+ let tmp = std::env::temp_dir().join("mirai-cli-wrapper.sh");+ std::fs::write(&tmp, wrapper_script())?;+ let sh_command =+ format!("mkdir -p /usr/local/bin && /usr/bin/install -m 755 '{}' '{}'", tmp.display(), WRAPPER_PATH);+ let result = authorization::run_privileged(BUNDLE_ID, RIGHT_SUFFIX, PROMPT_TEXT, &sh_command);+ let _ = std::fs::remove_file(&tmp);+ result?;+ if wrapper_state() != WrapperState::Current {+ return Err(AppError::msg("install command did not produce the wrapper"));+ }+ Ok(())+}++fn install_declined() -> bool {+ crate::storage::settings_load()+ .ok()+ .and_then(|s| s.get("cliInstallDeclined").and_then(|v| v.as_bool()))+ .unwrap_or(false)+}++fn persist_declined(declined: bool) {+ if let Err(e) = crate::storage::settings_patch(serde_json::json!({ "cliInstallDeclined": declined })) {+ crate::logger::warn(+ "cli-installer:settings-write-failed",+ Some(serde_json::json!({ "declined": declined, "error": e })),+ );+ }+}++#[derive(Serialize)]+#[serde(rename_all = "kebab-case")]+pub enum CliStatus {+ Installed,+ Foreign,+ Missing,+ Unavailable,+}++#[derive(Serialize)]+#[serde(rename_all = "kebab-case")]+pub enum CliInstalled {+ Installed,+ AlreadyInstalled,+ Cancelled,+}++#[tauri::command]+pub fn cli_status(app: AppHandle) -> CliStatus {+ if !available(&app) {+ return CliStatus::Unavailable;+ }+ match wrapper_state() {+ WrapperState::Current => CliStatus::Installed,+ WrapperState::Foreign => CliStatus::Foreign,+ WrapperState::Missing => CliStatus::Missing,+ }+}++#[tauri::command]+pub async fn cli_install(app: AppHandle) -> AppResult<CliInstalled> {+ if !available(&app) {+ return Err(AppError::msg("CLI install is unavailable in this build"));+ }+ match wrapper_state() {+ WrapperState::Current => Ok(CliInstalled::AlreadyInstalled),+ WrapperState::Foreign => {+ Err(AppError::msg(format!("{WRAPPER_PATH} is occupied by a binary Mirai didn't install")))+ },+ WrapperState::Missing => {+ crate::logger::info("cli-installer:prompt", Some(serde_json::json!({ "reason": "settings" })));+ let result = tokio::task::spawn_blocking(install_wrapper).await.map_err(AppError::msg)?;+ match &result {+ Ok(()) => {+ persist_declined(false);+ crate::logger::info("cli-installer:installed", Some(serde_json::json!({ "source": "settings" })));+ },+ Err(AppError::Authorization(AuthError::Cancelled)) => {+ crate::logger::info("cli-installer:declined", Some(serde_json::json!({ "source": "settings" })));+ },+ Err(e) => {+ crate::logger::warn(+ "cli-installer:failed",+ Some(serde_json::json!({ "source": "settings", "error": e })),+ );+ },+ }+ match result {+ Ok(()) => Ok(CliInstalled::Installed),+ Err(AppError::Authorization(AuthError::Cancelled)) => Ok(CliInstalled::Cancelled),+ Err(e) => Err(e),+ }+ },+ }+}++pub fn trigger_if_needed(app: &AppHandle) {+ if !available(app) {+ return;+ }+ tauri::async_runtime::spawn(async move {+ // Let the window come up before the admin prompt appears.+ tokio::time::sleep(std::time::Duration::from_secs(3)).await;+ match wrapper_state() {+ WrapperState::Current => {+ crate::logger::info("cli-installer:skip", Some(serde_json::json!({ "reason": "installed" })));+ },+ WrapperState::Foreign => {+ crate::logger::warn("cli-installer:skip", Some(serde_json::json!({ "reason": "foreign-binary" })));+ },+ WrapperState::Missing => {+ if install_declined() {+ crate::logger::info("cli-installer:skip", Some(serde_json::json!({ "reason": "declined" })));+ return;+ }+ crate::logger::info("cli-installer:prompt", Some(serde_json::json!({ "reason": "install" })));+ match tokio::task::spawn_blocking(install_wrapper).await {+ Ok(Ok(())) => crate::logger::info("cli-installer:installed", None),+ Ok(Err(AppError::Authorization(AuthError::Cancelled))) => {+ crate::logger::info("cli-installer:declined", None);+ persist_declined(true);+ },+ Ok(Err(e)) => crate::logger::warn("cli-installer:failed", Some(serde_json::json!({ "error": e }))),+ Err(e) => {+ crate::logger::warn("cli-installer:failed", Some(serde_json::json!({ "error": e.to_string() })))+ },+ }+ },+ }+ });+}++#[cfg(test)]+mod tests {+ use super::{WRAPPER_MARKER, WrapperState, wrapper_state_at};++ fn scratch(+ name: &str,+ bytes: Option<&[u8]>,+ ) -> std::path::PathBuf {+ let dir = std::env::temp_dir().join(format!("mirai-cli-installer-{}-{name}", std::process::id()));+ let _ = std::fs::remove_dir_all(&dir);+ std::fs::create_dir_all(&dir).unwrap();+ let path = dir.join("mirai");+ if let Some(bytes) = bytes {+ std::fs::write(&path, bytes).unwrap();+ }+ path+ }++ #[test]+ fn missing_only_when_the_file_does_not_exist() {+ assert_eq!(wrapper_state_at(&scratch("missing", None)), WrapperState::Missing);+ }++ #[test]+ fn own_wrapper_is_current() {+ let path = scratch("current", Some(format!("#!/bin/sh\n{WRAPPER_MARKER}\n").as_bytes()));+ assert_eq!(wrapper_state_at(&path), WrapperState::Current);+ }++ #[test]+ fn a_text_file_without_the_marker_is_foreign() {+ assert_eq!(wrapper_state_at(&scratch("text", Some(b"#!/bin/sh\necho hi\n"))), WrapperState::Foreign);+ }++ #[test]+ fn a_dangling_symlink_is_foreign_not_missing() {+ let path = scratch("dangling", None);+ std::os::unix::fs::symlink("/nonexistent/mirai-target", &path).unwrap();+ assert_eq!(wrapper_state_at(&path), WrapperState::Foreign);+ }++ #[test]+ fn a_binary_that_is_not_utf8_is_foreign_not_missing() {+ let path = scratch("binary", Some(&[0xcf, 0xfa, 0xed, 0xfe, 0xff, 0x00, 0xfe, 0x80]));+ assert_eq!(wrapper_state_at(&path), WrapperState::Foreign);+ }+}diff --git a/apps/mirai-gui/desktop/src/downloads/events.rs b/apps/mirai-gui/desktop/src/downloads/events.rsnew file mode 100644index 000000000..29b4de38e--- /dev/null+++ b/apps/mirai-gui/desktop/src/downloads/events.rs@@ -0,0 +1,251 @@+use serde::Serialize;+use tauri::{AppHandle, Manager};+use uzu::storage::{DownloadPhase, DownloadState};++use crate::models::PhaseKind;++#[derive(Serialize, Clone, PartialEq, Eq, Debug)]+#[serde(tag = "kind", rename_all = "camelCase", rename_all_fields = "camelCase")]+pub(super) enum DownloadEvent {+ Progress {+ completed_bytes: i64,+ total_bytes: Option<i64>,+ },+ Done,+ Error {+ error: String,+ },+ Paused,+ Resumed,+ Deleted,+ Locked {+ locked_by: String,+ },+}++#[derive(Serialize, Clone)]+#[serde(rename_all = "camelCase")]+pub(super) struct DownloadStateEvent {+ pub(super) seq: u64,+ pub(super) identifier: String,+ #[serde(flatten)]+ pub(super) event: DownloadEvent,+}++pub(super) fn events_for(+ state: &DownloadState,+ previous: Option<PhaseKind>,+) -> Vec<DownloadEvent> {+ match &state.phase {+ DownloadPhase::Downloading {} => {+ let progress = DownloadEvent::Progress {+ completed_bytes: state.downloaded_bytes,+ total_bytes: (state.total_bytes > 0).then_some(state.total_bytes),+ };+ // The engine has no distinct "resumed" phase, so entering Downloading+ // from any other phase is the signal that flips the UI back to an+ // active state before the first progress tick lands.+ if previous != Some(PhaseKind::Downloading) {+ vec![DownloadEvent::Resumed, progress]+ } else {+ vec![progress]+ }+ },+ DownloadPhase::Paused {} => vec![DownloadEvent::Paused],+ // done/error require a known prior phase: previous=None is the first+ // snapshot of an already-settled state (startup, delete re-emit), not a transition.+ DownloadPhase::Downloaded {} => {+ transition(previous, PhaseKind::Downloaded).then_some(DownloadEvent::Done).into_iter().collect()+ },+ DownloadPhase::Error {+ message,+ } => transition(previous, PhaseKind::Error)+ .then(|| DownloadEvent::Error {+ error: message.clone(),+ })+ .into_iter()+ .collect(),+ DownloadPhase::NotDownloaded {} => {+ transition(previous, PhaseKind::NotDownloaded).then_some(DownloadEvent::Deleted).into_iter().collect()+ },+ DownloadPhase::Locked {+ manager_id,+ } => transition(previous, PhaseKind::Locked)+ .then(|| DownloadEvent::Locked {+ locked_by: manager_id.clone(),+ })+ .into_iter()+ .collect(),+ }+}++fn transition(+ previous: Option<PhaseKind>,+ entered: PhaseKind,+) -> bool {+ matches!(previous, Some(p) if p != entered)+}++pub(super) fn announce(+ app: &AppHandle,+ event: &DownloadStateEvent,+) {+ match &event.event {+ DownloadEvent::Done => {+ crate::logger::info(+ "download:state",+ Some(serde_json::json!({ "identifier": event.identifier, "kind": "done" })),+ );+ notify_download(app, "Model downloaded", &event.identifier);+ },+ DownloadEvent::Error {+ error,+ } => {+ crate::logger::error(+ "download:state",+ Some(serde_json::json!({ "identifier": event.identifier, "kind": "error", "error": error })),+ );+ notify_download(app, "Download failed", error);+ },+ DownloadEvent::Locked {+ locked_by,+ } => crate::logger::info(+ "download:state",+ Some(serde_json::json!({ "identifier": event.identifier, "kind": "locked", "lockedBy": locked_by })),+ ),+ DownloadEvent::Progress {+ ..+ }+ | DownloadEvent::Paused+ | DownloadEvent::Resumed+ | DownloadEvent::Deleted => {},+ }+}++// In-view progress already shows the outcome; notify only when the window is out of sight.+fn can_notify(app: &AppHandle) -> bool {+ let Some(window) = app.get_webview_window("main") else {+ return false;+ };+ window.is_minimized().unwrap_or(false)+ || !window.is_visible().unwrap_or(true)+ || !window.is_focused().unwrap_or(true)+}++fn notify_download(+ app: &AppHandle,+ title: &str,+ body: &str,+) {+ if !can_notify(app) {+ return;+ }+ use tauri_plugin_notification::NotificationExt;+ let _ = app.notification().builder().title(title).body(body).show();+}++#[cfg(test)]+mod tests {+ use super::*;++ fn state(+ phase: DownloadPhase,+ downloaded_bytes: i64,+ total_bytes: i64,+ ) -> DownloadState {+ DownloadState {+ phase,+ downloaded_bytes,+ total_bytes,+ }+ }++ fn payload(event: DownloadEvent) -> serde_json::Value {+ serde_json::to_value(DownloadStateEvent {+ seq: 7,+ identifier: "vendor/model".into(),+ event,+ })+ .expect("serializable")+ }++ #[test]+ fn events_serialize_flat_with_kind_tag() {+ assert_eq!(+ payload(DownloadEvent::Progress {+ completed_bytes: 10,+ total_bytes: None+ }),+ serde_json::json!({ "seq": 7, "identifier": "vendor/model", "kind": "progress", "completedBytes": 10, "totalBytes": null })+ );+ assert_eq!(+ payload(DownloadEvent::Done),+ serde_json::json!({ "seq": 7, "identifier": "vendor/model", "kind": "done" })+ );+ assert_eq!(+ payload(DownloadEvent::Locked {+ locked_by: "cli".into()+ }),+ serde_json::json!({ "seq": 7, "identifier": "vendor/model", "kind": "locked", "lockedBy": "cli" })+ );+ }++ #[test]+ fn entering_downloading_announces_resume_before_progress() {+ let s = state(DownloadPhase::Downloading {}, 10, 100);+ assert_eq!(+ events_for(&s, Some(PhaseKind::Paused)),+ vec![+ DownloadEvent::Resumed,+ DownloadEvent::Progress {+ completed_bytes: 10,+ total_bytes: Some(100)+ }+ ]+ );+ assert_eq!(+ events_for(&s, Some(PhaseKind::Downloading)),+ vec![DownloadEvent::Progress {+ completed_bytes: 10,+ total_bytes: Some(100)+ }]+ );+ }++ #[test]+ fn settled_phases_are_events_only_as_transitions() {+ let done = state(DownloadPhase::Downloaded {}, 100, 100);+ assert_eq!(events_for(&done, None), vec![]);+ assert_eq!(events_for(&done, Some(PhaseKind::Downloaded)), vec![]);+ assert_eq!(events_for(&done, Some(PhaseKind::Downloading)), vec![DownloadEvent::Done]);++ let failed = state(+ DownloadPhase::Error {+ message: "The network connection was lost.".into(),+ },+ 0,+ 0,+ );+ assert_eq!(events_for(&failed, None), vec![]);+ assert_eq!(+ events_for(&failed, Some(PhaseKind::Downloading)),+ vec![DownloadEvent::Error {+ error: "The network connection was lost.".into()+ }]+ );++ let locked = state(+ DownloadPhase::Locked {+ manager_id: "cli".into(),+ },+ 0,+ 0,+ );+ assert_eq!(+ events_for(&locked, Some(PhaseKind::Paused)),+ vec![DownloadEvent::Locked {+ locked_by: "cli".into()+ }]+ );+ }+}diff --git a/apps/mirai-gui/desktop/src/downloads/intent.rs b/apps/mirai-gui/desktop/src/downloads/intent.rsnew file mode 100644index 000000000..5f1642bb4--- /dev/null+++ b/apps/mirai-gui/desktop/src/downloads/intent.rs@@ -0,0 +1,109 @@+use std::collections::HashMap;++use tauri::{AppHandle, Manager};+use uzu::{storage::DownloadPhase, types::model::Model};++use super::{DownloadsState, engine, ensure_watcher};++// True = the user left this model downloading, so the next launch resumes it.+// The engine can't tell that apart from a user pause: both restart as Paused.+fn readiness_file() -> crate::error::AppResult<std::path::PathBuf> {+ Ok(crate::storage::mirai_data_dir()?.join("model-readiness.json"))+}++fn read_readiness_file() -> HashMap<String, bool> {+ let Ok(path) = readiness_file() else {+ return HashMap::new();+ };+ let Ok(raw) = std::fs::read_to_string(path) else {+ return HashMap::new();+ };+ let Ok(parsed) = serde_json::from_str::<serde_json::Value>(&raw) else {+ return HashMap::new();+ };+ parsed+ .as_object()+ .map(|map| map.iter().filter_map(|(k, v)| v.as_bool().map(|b| (k.clone(), b))).collect())+ .unwrap_or_default()+}++// The in-memory map is the source of truth for the process; the file is+// written through under the same lock, so concurrent updates cannot lose keys.+static READINESS: std::sync::Mutex<Option<HashMap<String, bool>>> = std::sync::Mutex::new(None);++fn with_readiness<T>(f: impl FnOnce(&mut HashMap<String, bool>) -> T) -> T {+ let mut guard = READINESS.lock().expect("readiness mutex poisoned");+ f(guard.get_or_insert_with(read_readiness_file))+}++fn write_readiness_file(map: &HashMap<String, bool>) -> crate::error::AppResult<()> {+ let json = serde_json::to_string_pretty(map)?;+ crate::storage::write_atomic(&readiness_file()?, json.as_bytes())+}++pub(super) fn readiness_set(+ key: &str,+ value: bool,+) {+ with_readiness(|map| {+ map.insert(key.to_string(), value);+ if let Err(error) = write_readiness_file(map) {+ crate::logger::warn(+ "downloads:readiness-write-failed",+ Some(serde_json::json!({ "key": key, "value": value, "error": error })),+ );+ }+ });+}++pub(crate) fn forget_download_intent(model: &Model) {+ for repo_id in model.repo_ids() {+ readiness_set(&repo_id, false);+ }+}++pub fn auto_resume_on_startup(app: AppHandle) {+ tauri::async_runtime::spawn(async move {+ let Ok(engine) = engine().await else {+ return;+ };+ let wanted: Vec<String> =+ with_readiness(|map| map.iter().filter_map(|(k, v)| v.then_some(k.clone())).collect());+ if wanted.is_empty() {+ return;+ }+ let Ok(models) = engine.models_for_chat().await else {+ return;+ };+ for key in wanted {+ let found = models.iter().filter(|m| m.is_on_device()).find(|m| m.repo_ids().contains(&key));+ let Some(model) = found.cloned() else {+ continue;+ };+ let Some(state) = engine.download_state(&model).await else {+ continue;+ };+ // NotDownloaded with intent set = the cache moved to a new+ // checkpoint_version dir (engine update); re-fetch automatically.+ if !matches!(+ state.phase,+ DownloadPhase::Paused {} | DownloadPhase::Downloading {} | DownloadPhase::NotDownloaded {}+ ) {+ continue;+ }+ let downloads = app.state::<DownloadsState>();+ downloads.remember_one(&model.identifier, &key).await;+ ensure_watcher(app.clone(), &downloads);+ match engine.downloader(&model).resume().await {+ Ok(()) => crate::logger::info(+ "download:auto-resume",+ Some(serde_json::json!({ "identifier": model.identifier })),+ ),+ Err(error) => crate::logger::warn(+ "download:auto-resume-failed",+ Some(serde_json::json!({ "identifier": model.identifier, "error": error.to_string() })),+ ),+ }+ }+ });+}diff --git a/apps/mirai-gui/desktop/src/downloads/mod.rs b/apps/mirai-gui/desktop/src/downloads/mod.rsnew file mode 100644index 000000000..c92495fd9--- /dev/null+++ b/apps/mirai-gui/desktop/src/downloads/mod.rs@@ -0,0 +1,173 @@+mod events;+mod intent;++use std::{+ collections::HashMap,+ sync::atomic::{AtomicBool, AtomicU64, Ordering},+};++use events::{DownloadEvent, DownloadStateEvent, announce, events_for};+use futures::StreamExt;+pub use intent::auto_resume_on_startup;+pub(crate) use intent::forget_download_intent;+use intent::readiness_set;+use tauri::{AppHandle, Emitter, Manager};+use uzu::types::model::Model;++use crate::{+ engine::engine,+ error::AppResult,+ models::{PhaseKind, find_downloadable_model},+};++// The event key is the repoId the UI keys download state by.+#[derive(Clone)]+struct RepoInfo {+ event_key: String,+}++#[derive(Default)]+pub struct DownloadsState {+ repo_by_identifier: tokio::sync::Mutex<HashMap<String, RepoInfo>>,+ last_phase: tokio::sync::Mutex<HashMap<String, PhaseKind>>,+ watcher_started: AtomicBool,+ // Orders every emitted event against the snapshot chat_models_get returns,+ // so the client can tell which of the two is newer.+ event_seq: AtomicU64,+}++impl DownloadsState {+ pub(crate) fn event_seq(&self) -> u64 {+ self.event_seq.load(Ordering::SeqCst)+ }++ fn emit(+ &self,+ app: &AppHandle,+ info: &RepoInfo,+ event: DownloadEvent,+ ) {+ let event = DownloadStateEvent {+ seq: self.event_seq.fetch_add(1, Ordering::SeqCst) + 1,+ identifier: info.event_key.clone(),+ event,+ };+ announce(app, &event);+ let _ = app.emit("download-state", event);+ }++ pub async fn remember_repo_ids(+ &self,+ models: &[Model],+ ) {+ let mut map = self.repo_by_identifier.lock().await;+ for model in models {+ let event_key = match model.repo_ids().first() {+ Some(repo_id) => repo_id.clone(),+ None => continue,+ };+ map.insert(+ model.identifier.clone(),+ RepoInfo {+ event_key,+ },+ );+ }+ }++ async fn repo_info(+ &self,+ identifier: &str,+ ) -> RepoInfo {+ let map = self.repo_by_identifier.lock().await;+ map.get(identifier).cloned().unwrap_or_else(|| RepoInfo {+ event_key: identifier.to_string(),+ })+ }++ async fn remember_one(+ &self,+ identifier: &str,+ event_key: &str,+ ) {+ self.repo_by_identifier.lock().await.insert(+ identifier.to_string(),+ RepoInfo {+ event_key: event_key.to_string(),+ },+ );+ }+}++pub fn ensure_watcher(+ app: AppHandle,+ state: &DownloadsState,+) {+ if state.watcher_started.swap(true, Ordering::SeqCst) {+ return;+ }+ tauri::async_runtime::spawn(async move {+ let engine = match engine().await {+ Ok(engine) => engine,+ Err(error) => {+ crate::logger::error("downloads:watcher:engine", Some(serde_json::json!({ "error": error })));+ app.state::<DownloadsState>().watcher_started.store(false, Ordering::SeqCst);+ return;+ },+ };+ let mut stream = engine.storage_subscribe();+ while let Some(item) = stream.next().await {+ let Ok((identifier, download_state)) = item else {+ continue;+ };+ let downloads = app.state::<DownloadsState>();+ let previous =+ downloads.last_phase.lock().await.insert(identifier.clone(), PhaseKind::from(&download_state.phase));+ let info = downloads.repo_info(&identifier).await;+ for event in events_for(&download_state, previous) {+ downloads.emit(&app, &info, event);+ }+ }+ });+}++async fn run_downloader(+ model: &Model,+ action: impl AsyncFnOnce(uzu::engine::Downloader) -> Result<(), uzu::engine::EngineError>,+) -> AppResult<()> {+ let engine = engine().await?;+ Ok(action(engine.downloader(model)).await?)+}++async fn stop(+ repo_id: &str,+ action: impl AsyncFnOnce(uzu::engine::Downloader) -> Result<(), uzu::engine::EngineError>,+) -> AppResult<()> {+ let model = find_downloadable_model(repo_id).await?;+ run_downloader(&model, action).await?;+ forget_download_intent(&model);+ Ok(())+}++#[tauri::command]+pub async fn download_resume(+ app: AppHandle,+ state: tauri::State<'_, DownloadsState>,+ repo_id: String,+) -> AppResult<()> {+ ensure_watcher(app, &state);+ let model = find_downloadable_model(&repo_id).await?;+ run_downloader(&model, async |d| d.resume().await).await?;+ readiness_set(&repo_id, true);+ Ok(())+}++#[tauri::command]+pub async fn download_pause(repo_id: String) -> AppResult<()> {+ stop(&repo_id, async |d| d.pause().await).await+}++#[tauri::command]+pub async fn download_delete(repo_id: String) -> AppResult<()> {+ stop(&repo_id, async |d| d.delete().await).await+}diff --git a/apps/mirai-gui/desktop/src/engine.rs b/apps/mirai-gui/desktop/src/engine.rsnew file mode 100644index 000000000..46579b2b8--- /dev/null+++ b/apps/mirai-gui/desktop/src/engine.rs@@ -0,0 +1,32 @@+use tokio::sync::OnceCell;+use uzu::engine::{Engine, EngineConfig};++use crate::error::{AppError, AppResult};++static ENGINE: OnceCell<Engine> = OnceCell::const_new();++pub async fn engine() -> AppResult<Engine> {+ ENGINE+ .get_or_try_init(|| async {+ // Only local models are offered, so cloud provider keys from the+ // shell and the Ollama/LM Studio probes would be wasted work.+ let config = EngineConfig {+ openai_api_key: None,+ anthropic_api_key: None,+ gemini_api_key: None,+ xai_api_key: None,+ baseten_api_key: None,+ openrouter_api_key: None,+ allow_ollama_usage: false,+ allow_lmstudio_usage: false,+ ..EngineConfig::default()+ };+ Engine::new(config).await.map_err(|e| {+ let error = AppError::msg(format!("engine init failed: {e}"));+ crate::logger::error("engine:init:error", Some(serde_json::json!({ "error": error })));+ error+ })+ })+ .await+ .cloned()+}diff --git a/apps/mirai-gui/desktop/src/error.rs b/apps/mirai-gui/desktop/src/error.rsnew file mode 100644index 000000000..7ebdd1fc9--- /dev/null+++ b/apps/mirai-gui/desktop/src/error.rs@@ -0,0 +1,35 @@+use crate::cli_installer::AuthError;++#[derive(Debug, thiserror::Error)]+pub enum AppError {+ #[error(transparent)]+ Engine(#[from] uzu::engine::EngineError),+ #[error(transparent)]+ ChatSession(#[from] uzu::session::chat::ChatSessionError),+ #[error(transparent)]+ Authorization(#[from] AuthError),+ #[error(transparent)]+ Io(#[from] std::io::Error),+ #[error(transparent)]+ Json(#[from] serde_json::Error),+ #[error("{0}")]+ Message(String),+}++impl AppError {+ pub fn msg(message: impl std::fmt::Display) -> Self {+ Self::Message(message.to_string())+ }+}++// Commands reject with the plain message, the same shape as a String error.+impl serde::Serialize for AppError {+ fn serialize<S: serde::Serializer>(+ &self,+ serializer: S,+ ) -> Result<S::Ok, S::Error> {+ serializer.collect_str(self)+ }+}++pub type AppResult<T> = Result<T, AppError>;diff --git a/apps/mirai-gui/desktop/src/lib.rs b/apps/mirai-gui/desktop/src/lib.rsnew file mode 100644index 000000000..a6791e8cf--- /dev/null+++ b/apps/mirai-gui/desktop/src/lib.rs@@ -0,0 +1,158 @@+mod chat;+mod cli_installer;+mod downloads;+mod engine;+mod error;+mod logger;+mod models;+mod storage;+mod system_ui;+mod updater;++#[tauri::command]+fn open_external(url: String) -> bool {+ if !(url.starts_with("http://") || url.starts_with("https://")) {+ return false;+ }+ std::process::Command::new("open").arg(&url).spawn().is_ok()+}++fn is_app_url(url: &tauri::Url) -> bool {+ match url.scheme() {+ "tauri" => true,+ "http" | "https" => {+ url.host_str().is_some_and(|h| h == "localhost" || h == "127.0.0.1" || h == "tauri.localhost")+ },+ _ => false,+ }+}++// Backend crashes would otherwise vanish silently; log location + payload to+// stderr and the shared log file.+fn install_panic_logger() {+ let default = std::panic::take_hook();+ std::panic::set_hook(Box::new(move |info| {+ let location = info.location().map(|l| format!("{}:{}", l.file(), l.line())).unwrap_or_default();+ let payload = info+ .payload()+ .downcast_ref::<&str>()+ .map(|s| s.to_string())+ .or_else(|| info.payload().downcast_ref::<String>().cloned())+ .unwrap_or_else(|| "unknown".to_string());+ eprintln!("[panic] {location}: {payload}");+ logger::write_line("ERROR", "panic", Some(serde_json::json!({ "location": location, "payload": payload })));+ default(info);+ }));+}++pub fn run() {+ install_panic_logger();+ tauri::Builder::default()+ .plugin(tauri_plugin_global_shortcut::Builder::new().build())+ .plugin(tauri_plugin_dialog::init())+ .plugin(tauri_plugin_notification::init())+ .plugin(tauri_plugin_updater::Builder::new().build())+ .plugin(tauri_plugin_autostart::init(tauri_plugin_autostart::MacosLauncher::LaunchAgent, None))+ .setup(|app| {+ let window = tauri::WebviewWindowBuilder::new(app, "main", tauri::WebviewUrl::default())+ .title("Mirai")+ .inner_size(1200.0, 800.0)+ .min_inner_size(390.0, 400.0)+ .title_bar_style(tauri::TitleBarStyle::Overlay)+ .hidden_title(true)+ .traffic_light_position(tauri::LogicalPosition::new(20.0, 28.0))+ // In-window navigation to an external URL would replace the app;+ // hand it to the default browser instead.+ .on_navigation(|url| {+ if is_app_url(url) {+ return true;+ }+ if matches!(url.scheme(), "http" | "https") {+ let _ = std::process::Command::new("open").arg(url.as_str()).spawn();+ }+ false+ })+ .build()?;+ // Closing hides the window but keeps the process alive so the global+ // shortcut stays registered; ⌘Q quits.+ let hide_target = window.clone();+ window.on_window_event(move |event| {+ if let tauri::WindowEvent::CloseRequested {+ api,+ ..+ } = event+ {+ api.prevent_close();+ let _ = hide_target.hide();+ }+ });+ logger::info("app:start", Some(serde_json::json!({ "version": app.package_info().version.to_string() })));+ if let Err(error) = system_ui::setup_app_menu(app.handle()) {+ logger::error("menu:setup", Some(serde_json::json!({ "error": error.to_string() })));+ }+ system_ui::restore_from_settings(app.handle());+ chat::restore_auto_eject_config(app.handle());+ cli_installer::trigger_if_needed(app.handle());+ // Warm the engine so the first models/chat request doesn't pay init latency.+ tauri::async_runtime::spawn(async {+ let _ = engine::engine().await;+ });+ downloads::auto_resume_on_startup(app.handle().clone());+ Ok(())+ })+ .manage(chat::ChatState::default())+ .manage(downloads::DownloadsState::default())+ .manage(updater::UpdaterState::default())+ .invoke_handler(tauri::generate_handler![+ open_external,+ cli_installer::cli_install,+ cli_installer::cli_status,+ models::chat_models_get,+ chat::run_stream,+ chat::title_gen,+ chat::cancel_run,+ chat::cancel_title_gen,+ chat::eject_session,+ chat::set_auto_eject_config,+ chat::chat_sampling_defaults,+ downloads::download_resume,+ downloads::download_pause,+ downloads::download_delete,+ storage::chat_list_files,+ storage::chat_load_file,+ storage::chat_save_file,+ storage::chat_delete_file,+ storage::global_instructions_save,+ storage::global_instructions_load,+ storage::save_binary_file,+ storage::read_text_file,+ logger::get_log_file_path,+ storage::settings_load,+ storage::settings_patch,+ storage::model_params_set,+ storage::cleanup::cleanup_preview,+ storage::cleanup::cleanup_execute,+ system_ui::get_run_on_startup,+ system_ui::set_run_on_startup,+ system_ui::register_quick_entry_shortcut,+ system_ui::unregister_quick_entry_shortcut,+ system_ui::get_quick_entry_shortcut,+ system_ui::set_window_theme,+ updater::update_check,+ updater::update_download,+ updater::update_apply,+ updater::update_status,+ ])+ .build(tauri::generate_context!())+ .expect("error while running tauri application")+ .run(|app, event| {+ // Clicking the dock icon while the window is hidden must bring it+ // back; macOS delivers that as Reopen, not a window event.+ if let tauri::RunEvent::Reopen {+ ..+ } = event+ {+ system_ui::show_and_focus_main(app);+ }+ });+}diff --git a/apps/mirai-gui/desktop/src/logger.rs b/apps/mirai-gui/desktop/src/logger.rsnew file mode 100644index 000000000..73811acde--- /dev/null+++ b/apps/mirai-gui/desktop/src/logger.rs@@ -0,0 +1,79 @@+use std::{+ io::Write,+ path::{Path, PathBuf},+};++use crate::error::AppResult;++const MAX_LOG_SIZE_BYTES: u64 = 5 * 1024 * 1024;++pub fn log_file_path() -> AppResult<PathBuf> {+ Ok(crate::storage::mirai_data_dir()?.join("mirai.log"))+}++pub fn rotated_log_file_path() -> AppResult<PathBuf> {+ Ok(crate::storage::mirai_data_dir()?.join("mirai.log.1"))+}++fn rotate_if_needed(path: &Path) {+ let Ok(meta) = std::fs::metadata(path) else {+ return;+ };+ if meta.len() <= MAX_LOG_SIZE_BYTES {+ return;+ }+ let rotated = path.with_extension("log.1");+ let _ = std::fs::remove_file(&rotated);+ let _ = std::fs::rename(path, &rotated);+}++static LOG_LOCK: std::sync::Mutex<()> = std::sync::Mutex::new(());++pub(crate) fn write_line(+ level: &str,+ message: &str,+ data: Option<serde_json::Value>,+) {+ let Ok(path) = log_file_path() else {+ return;+ };+ let Ok(_guard) = LOG_LOCK.lock() else {+ return;+ };+ if let Some(parent) = path.parent() {+ let _ = std::fs::create_dir_all(parent);+ }+ rotate_if_needed(&path);+ let ts = chrono::Utc::now().format("%Y-%m-%dT%H:%M:%S%.3fZ");+ let suffix = data.map(|d| format!(" {d}")).unwrap_or_default();+ let line = format!("{ts} [{level}] {message}{suffix}\n");+ if let Ok(mut file) = std::fs::OpenOptions::new().create(true).append(true).open(&path) {+ let _ = file.write_all(line.as_bytes());+ }+}++pub fn info(+ message: &str,+ data: Option<serde_json::Value>,+) {+ write_line("INFO", message, data);+}++pub fn warn(+ message: &str,+ data: Option<serde_json::Value>,+) {+ write_line("WARN", message, data);+}++pub fn error(+ message: &str,+ data: Option<serde_json::Value>,+) {+ write_line("ERROR", message, data);+}++#[tauri::command]+pub fn get_log_file_path() -> AppResult<String> {+ Ok(log_file_path()?.to_string_lossy().to_string())+}diff --git a/apps/mirai-gui/desktop/src/main.rs b/apps/mirai-gui/desktop/src/main.rsnew file mode 100644index 000000000..6750e6a4e--- /dev/null+++ b/apps/mirai-gui/desktop/src/main.rs@@ -0,0 +1,3 @@+fn main() {+ mirai_gui::run()+}diff --git a/apps/mirai-gui/desktop/src/models.rs b/apps/mirai-gui/desktop/src/models.rsnew file mode 100644index 000000000..9bad3ec04--- /dev/null+++ b/apps/mirai-gui/desktop/src/models.rs@@ -0,0 +1,371 @@+use std::{+ collections::HashMap,+ sync::{Mutex, OnceLock},+};++use hanashi::chat::EncodingConfig;+use serde::Serialize;+use uzu::{+ storage::{DownloadPhase, DownloadState},+ types::{+ basic::{Image, ImageFormat, ImageTheme, ReasoningEffort},+ model::{Model, ModelVendor},+ },+};++use crate::{+ engine::engine,+ error::{AppError, AppResult},+};++#[derive(Serialize, Clone, Debug, PartialEq, Default)]+#[serde(tag = "kind", rename_all = "camelCase")]+pub enum ReasoningSupport {+ #[default]+ Unsupported,+ AlwaysOn,+ Toggle,+ Levels {+ efforts: Vec<ReasoningEffort>,+ },+}++impl ReasoningSupport {+ pub fn effective(+ &self,+ requested: Option<ReasoningEffort>,+ ) -> Option<ReasoningEffort> {+ match self {+ ReasoningSupport::Unsupported | ReasoningSupport::AlwaysOn => None,+ ReasoningSupport::Toggle => Some(if requested == Some(ReasoningEffort::Disabled) {+ ReasoningEffort::Disabled+ } else {+ ReasoningEffort::Default+ }),+ ReasoningSupport::Levels {+ efforts,+ } => requested+ .filter(|effort| efforts.contains(effort))+ .or_else(|| efforts.contains(&ReasoningEffort::Default).then_some(ReasoningEffort::Default))+ // hanashi rejects an effort missing from the mapping, so never invent one.+ .or_else(|| efforts.iter().copied().find(|effort| *effort != ReasoningEffort::Disabled)),+ }+ }++ pub fn cheapest(&self) -> Option<ReasoningEffort> {+ match self {+ ReasoningSupport::Unsupported | ReasoningSupport::AlwaysOn => None,+ ReasoningSupport::Toggle => Some(ReasoningEffort::Disabled),+ ReasoningSupport::Levels {+ efforts,+ } => efforts.iter().copied().find(|e| *e != ReasoningEffort::Default),+ }+ }+}++// uzu lists efforts in template-mapping order, which differs per model.+const EFFORT_ORDER: [ReasoningEffort; 6] = [+ ReasoningEffort::Disabled,+ ReasoningEffort::Default,+ ReasoningEffort::Low,+ ReasoningEffort::Medium,+ ReasoningEffort::High,+ ReasoningEffort::XHigh,+];++// Resolving an encoding parses four bundled configs; models share a handful of variants.+static ENCODING_SUPPORT: OnceLock<Mutex<HashMap<String, Option<ReasoningSupport>>>> = OnceLock::new();++fn reasoning_support_from_encoding(model: &Model) -> Option<ReasoningSupport> {+ let encoding = model.encoding.as_ref()?;+ let cache = ENCODING_SUPPORT.get_or_init(Default::default);+ if let Some(cached) = cache.lock().expect("encoding cache poisoned").get(&encoding.json) {+ return cached.clone();+ }+ let support = parse_reasoning_support(model, &encoding.json);+ cache.lock().expect("encoding cache poisoned").insert(encoding.json.clone(), support.clone());+ support+}++fn parse_reasoning_support(+ model: &Model,+ encoding_json: &str,+) -> Option<ReasoningSupport> {+ let config = match serde_json::from_str::<EncodingConfig>(encoding_json) {+ Ok(config) => config,+ Err(error) => {+ crate::logger::warn(+ "models:encoding:parse-error",+ Some(serde_json::json!({ "identifier": model.identifier, "error": error.to_string() })),+ );+ return None;+ },+ };+ let capabilities = match config.capabilities() {+ Ok(capabilities) => capabilities,+ Err(error) => {+ crate::logger::warn(+ "models:encoding:capabilities-error",+ Some(serde_json::json!({ "identifier": model.identifier, "error": error.to_string() })),+ );+ return None;+ },+ };+ if !capabilities.supports_reasoning {+ return Some(ReasoningSupport::Unsupported);+ }+ let has_levels = capabilities.reasoning_efforts.iter().any(|effort| {+ matches!(+ effort,+ ReasoningEffort::Low | ReasoningEffort::Medium | ReasoningEffort::High | ReasoningEffort::XHigh+ )+ });+ if has_levels {+ let efforts =+ EFFORT_ORDER.into_iter().filter(|effort| capabilities.reasoning_efforts.contains(effort)).collect();+ Some(ReasoningSupport::Levels {+ efforts,+ })+ } else if capabilities.supports_disable_reasoning {+ Some(ReasoningSupport::Toggle)+ } else {+ Some(ReasoningSupport::AlwaysOn)+ }+}++pub fn reasoning_support(model: &Model) -> ReasoningSupport {+ reasoning_support_from_encoding(model).unwrap_or_default()+}++// Serialized by variant name; the client matches on these strings.+#[derive(Serialize, Clone, Copy, Debug, PartialEq, Eq)]+pub enum PhaseKind {+ NotDownloaded,+ Downloading,+ Paused,+ Downloaded,+ Locked,+ Error,+}++impl From<&DownloadPhase> for PhaseKind {+ fn from(phase: &DownloadPhase) -> Self {+ match phase {+ DownloadPhase::NotDownloaded {} => PhaseKind::NotDownloaded,+ DownloadPhase::Downloading {} => PhaseKind::Downloading,+ DownloadPhase::Paused {} => PhaseKind::Paused,+ DownloadPhase::Downloaded {} => PhaseKind::Downloaded,+ DownloadPhase::Locked {+ ..+ } => PhaseKind::Locked,+ DownloadPhase::Error {+ ..+ } => PhaseKind::Error,+ }+ }+}++#[derive(Serialize, Clone)]+#[serde(rename_all = "camelCase")]+pub struct ModelDownloadState {+ pub total_kbytes: u64,+ pub downloaded_kbytes: u64,+ pub phase: PhaseKind,+ #[serde(skip_serializing_if = "Option::is_none")]+ pub error: Option<String>,+ // Event sequence at the time of the snapshot; download events carry theirs.+ pub seq: u64,+}++#[derive(Serialize)]+#[serde(rename_all = "camelCase")]+pub struct EngineModel {+ pub identifier: String,+ #[serde(skip_serializing_if = "Option::is_none")]+ pub repo_id: Option<String>,+ pub vendor: String,+ #[serde(skip_serializing_if = "Option::is_none")]+ pub vendor_icons: Option<VendorIcons>,+ pub name: String,+ #[serde(skip_serializing_if = "Option::is_none")]+ pub family_identifier: Option<String>,+ #[serde(skip_serializing_if = "Option::is_none")]+ pub family_name: Option<String>,+ #[serde(skip_serializing_if = "Option::is_none")]+ pub param_size: Option<i64>,+ pub reasoning: ReasoningSupport,+ pub quantization: Option<String>,+ #[serde(skip_serializing_if = "Option::is_none")]+ pub quantization_bits: Option<u32>,+ pub state: ModelDownloadState,+}++// Models served from a plain directory (LOCAL_PATH) have nothing to download.+pub fn model_download_state(+ model: &Model,+ state: Option<&DownloadState>,+ seq: u64,+) -> ModelDownloadState {+ if model.is_downloadable() {+ map_download_state(state, seq)+ } else {+ ModelDownloadState {+ total_kbytes: 0,+ downloaded_kbytes: 0,+ phase: PhaseKind::Downloaded,+ error: None,+ seq,+ }+ }+}++pub fn map_download_state(+ state: Option<&DownloadState>,+ seq: u64,+) -> ModelDownloadState {+ let Some(state) = state else {+ return ModelDownloadState {+ total_kbytes: 0,+ downloaded_kbytes: 0,+ phase: PhaseKind::NotDownloaded,+ error: None,+ seq,+ };+ };+ let error = match &state.phase {+ DownloadPhase::Error {+ message,+ } => Some(message.clone()),+ _ => None,+ };+ ModelDownloadState {+ total_kbytes: (state.total_bytes.max(0) as u64) / 1024,+ downloaded_kbytes: (state.downloaded_bytes.max(0) as u64) / 1024,+ phase: PhaseKind::from(&state.phase),+ error,+ seq,+ }+}++#[derive(Serialize)]+pub struct VendorIcons {+ pub light: String,+ pub dark: String,+}++// The registry serves each icon as SVG and PNG per theme; SVG scales cleanly.+fn icon_url(+ icons: &[Image],+ theme: ImageTheme,+) -> Option<String> {+ let of_theme = |format: ImageFormat| {+ icons.iter().find(|icon| icon.theme == theme && icon.format == format).map(|icon| icon.url.clone())+ };+ of_theme(ImageFormat::Svg).or_else(|| of_theme(ImageFormat::Png)).or_else(|| of_theme(ImageFormat::Webp))+}++fn vendor_icons(vendor: &ModelVendor) -> Option<VendorIcons> {+ let icons = &vendor.metadata.icons;+ let light = icon_url(icons, ImageTheme::Light);+ let dark = icon_url(icons, ImageTheme::Dark);+ Some(VendorIcons {+ light: light.clone().or_else(|| dark.clone())?,+ dark: dark.or(light)?,+ })+}++pub fn engine_model(+ model: &Model,+ state: ModelDownloadState,+ reasoning: ReasoningSupport,+) -> EngineModel {+ let vendor = model.family.as_ref().map(|f| &f.vendor).or_else(|| model.quantization.as_ref().map(|q| &q.vendor));+ EngineModel {+ identifier: model.identifier.clone(),+ repo_id: model.repo_ids().first().cloned(),+ vendor: vendor.map(|v| v.name()).unwrap_or_default(),+ vendor_icons: vendor.and_then(vendor_icons),+ name: model.name(),+ family_identifier: model.family.as_ref().map(|f| f.identifier.clone()),+ family_name: model.family.as_ref().map(|f| f.name()),+ param_size: model.properties.as_ref().map(|p| p.size),+ reasoning,+ quantization: model.quantization.as_ref().map(|q| q.method.clone()),+ quantization_bits: model.quantization.as_ref().map(|q| q.bits_per_weight),+ state,+ }+}++pub fn find_in(+ models: Vec<Model>,+ repo_id: &str,+) -> Option<Model> {+ let local: Vec<Model> = models.into_iter().filter(|m| m.is_on_device()).collect();+ local+ .iter()+ .find(|m| m.repo_ids().first().is_some_and(|id| id == repo_id))+ .or_else(|| local.iter().find(|m| m.repo_ids().iter().any(|id| id == repo_id)))+ // LOCAL_PATH models have no repo id; the client keys them by identifier.+ .or_else(|| local.iter().find(|m| m.identifier == repo_id))+ .cloned()+}++// List-based lookup on purpose: engine.model() can mis-resolve when provider+// keys are registered.+pub async fn find_chat_model(repo_id: &str) -> AppResult<Model> {+ let engine = engine().await?;+ let models = engine.models_for_chat().await?;+ find_in(models, repo_id).ok_or_else(|| AppError::msg(format!("Model not found: {repo_id}")))+}++// Cleanup enumerates by engine identifier (download_states' key), not repo_id.+// Searches every engine list, not just chat: the model cache is shared with+// other uzu-based apps, so it can hold weights this app never downloads.+pub async fn find_model_by_identifier(identifier: &str) -> Option<Model> {+ let engine = engine().await.ok()?;+ for models in [+ engine.models_for_chat().await.ok(),+ engine.models_for_text_to_speech().await.ok(),+ engine.models_for_classification().await.ok(),+ ]+ .into_iter()+ .flatten()+ {+ if let Some(model) = models.into_iter().find(|m| m.identifier == identifier) {+ return Some(model);+ }+ }+ None+}++pub async fn find_downloadable_model(key: &str) -> AppResult<Model> {+ let engine = engine().await?;+ let chat = engine.models_for_chat().await?;+ if let Some(model) = find_in(chat, key) {+ return Ok(model);+ }+ find_model_by_identifier(key).await.ok_or_else(|| AppError::msg(format!("Model not found: {key}")))+}++#[tauri::command]+pub async fn chat_models_get(+ app: tauri::AppHandle,+ state: tauri::State<'_, crate::downloads::DownloadsState>,+) -> AppResult<Vec<EngineModel>> {+ let engine = engine().await?;+ let models = engine.models_for_chat().await?;+ // Taken before the states: an event emitted while they are read then+ // carries a newer seq than this snapshot and wins on the client.+ let seq = state.event_seq();+ let states = engine.download_states().await;+ let local: Vec<Model> = models.into_iter().filter(|m| m.is_on_device()).collect();+ state.remember_repo_ids(&local).await;+ crate::downloads::ensure_watcher(app, &state);+ let mut result = Vec::with_capacity(local.len());+ for model in &local {+ let reasoning = reasoning_support(model);+ let state = model_download_state(model, states.get(&model.identifier), seq);+ result.push(engine_model(model, state, reasoning));+ }+ Ok(result)+}diff --git a/apps/mirai-gui/desktop/src/storage/cleanup.rs b/apps/mirai-gui/desktop/src/storage/cleanup.rsnew file mode 100644index 000000000..8c6ae6ca2--- /dev/null+++ b/apps/mirai-gui/desktop/src/storage/cleanup.rs@@ -0,0 +1,211 @@+use std::path::{Path, PathBuf};++use super::chats_dir;+use crate::error::AppResult;++#[derive(serde::Serialize, Default)]+#[serde(rename_all = "camelCase")]+struct CategorySize {+ count: u64,+ size_bytes: u64,+}++#[derive(serde::Serialize)]+#[serde(rename_all = "camelCase")]+pub struct CleanupPreview {+ dialogs: CategorySize,+ models: ModelsCategory,+ logs: LogsCategory,+}++#[derive(serde::Serialize, Default)]+#[serde(rename_all = "camelCase")]+struct ModelsCategory {+ count: u64,+ size_bytes: u64,+}++#[derive(serde::Serialize, Default)]+#[serde(rename_all = "camelCase")]+struct LogsCategory {+ size_bytes: u64,+}++fn log_files() -> Vec<PathBuf> {+ [crate::logger::log_file_path(), crate::logger::rotated_log_file_path()].into_iter().flatten().collect()+}++fn logs_size() -> LogsCategory {+ let size_bytes =+ log_files().iter().filter_map(|p| std::fs::metadata(p).ok()).filter(|m| m.is_file()).map(|m| m.len()).sum();+ LogsCategory {+ size_bytes,+ }+}++fn dir_size(+ dir: &Path,+ ext: Option<&str>,+) -> CategorySize {+ let Ok(entries) = std::fs::read_dir(dir) else {+ return CategorySize::default();+ };+ let mut out = CategorySize::default();+ for entry in entries.flatten() {+ let Ok(meta) = entry.metadata() else {+ continue;+ };+ if !meta.is_file() {+ continue;+ }+ if let Some(ext) = ext+ && !entry.file_name().to_str().is_some_and(|n| n.ends_with(ext))+ {+ continue;+ }+ out.count += 1;+ out.size_bytes += meta.len();+ }+ out+}++// The UI passes resident-session repoIds as the skip list, while+// download_states is keyed by engine identifier; match against both.+async fn is_skipped(+ identifier: &str,+ skip: &[String],+) -> bool {+ if skip.is_empty() {+ return false;+ }+ if skip.iter().any(|s| s == identifier) {+ return true;+ }+ match crate::models::find_model_by_identifier(identifier).await {+ Some(model) => model.repo_ids().iter().any(|repo_id| skip.iter().any(|s| s == repo_id)),+ None => false,+ }+}++async fn downloaded_models(skip: &[String]) -> ModelsCategory {+ let mut models = ModelsCategory::default();+ let Ok(engine) = crate::engine::engine().await else {+ return models;+ };+ let states = engine.download_states().await;+ for (identifier, state) in states.iter() {+ if !matches!(state.phase, uzu::storage::DownloadPhase::Downloaded {}) || is_skipped(identifier, skip).await {+ continue;+ }+ models.count += 1;+ models.size_bytes += state.total_bytes.max(0) as u64;+ }+ models+}++#[tauri::command]+pub async fn cleanup_preview(skip_model_identifiers: Vec<String>) -> AppResult<CleanupPreview> {+ Ok(CleanupPreview {+ dialogs: dir_size(&chats_dir()?, Some(".md")),+ models: downloaded_models(&skip_model_identifiers).await,+ logs: logs_size(),+ })+}++#[derive(serde::Serialize, serde::Deserialize, Clone, Copy, PartialEq, Eq)]+#[serde(rename_all = "camelCase")]+pub enum Category {+ Dialogs,+ Models,+ Logs,+}++#[derive(serde::Serialize)]+#[serde(rename_all = "camelCase")]+pub struct CleanupResult {+ executed: Vec<Category>,+ models_skipped: Vec<String>,+}++fn clear_dir(+ dir: &Path,+ ext: Option<&str>,+) {+ let Ok(entries) = std::fs::read_dir(dir) else {+ return;+ };+ for entry in entries.flatten() {+ if entry.metadata().map(|m| m.is_file()).unwrap_or(false) {+ if let Some(ext) = ext+ && !entry.file_name().to_str().is_some_and(|n| n.ends_with(ext))+ {+ continue;+ }+ let _ = std::fs::remove_file(entry.path());+ }+ }+}++#[tauri::command]+pub async fn cleanup_execute(+ categories: Vec<Category>,+ skip_model_identifiers: Vec<String>,+) -> AppResult<CleanupResult> {+ let skip = skip_model_identifiers;+ let mut executed = Vec::new();+ let mut models_skipped = Vec::new();++ if categories.contains(&Category::Dialogs) {+ clear_dir(&chats_dir()?, Some(".md"));+ executed.push(Category::Dialogs);+ }++ if categories.contains(&Category::Models) {+ let mut all_deleted = false;+ if let Ok(engine) = crate::engine::engine().await {+ all_deleted = true;+ let states = engine.download_states().await;+ for (identifier, state) in states.iter() {+ let is_active = matches!(+ state.phase,+ uzu::storage::DownloadPhase::Downloading {}+ | uzu::storage::DownloadPhase::Paused {}+ | uzu::storage::DownloadPhase::Locked { .. }+ );+ let is_removable = matches!(+ state.phase,+ uzu::storage::DownloadPhase::Downloaded {} | uzu::storage::DownloadPhase::Error { .. }+ );+ if is_active || is_skipped(identifier, &skip).await {+ models_skipped.push(identifier.clone());+ } else if is_removable && let Some(model) = crate::models::find_model_by_identifier(identifier).await {+ match engine.downloader(&model).delete().await {+ Ok(()) => crate::downloads::forget_download_intent(&model),+ Err(error) => {+ crate::logger::error(+ "cleanup:model-delete",+ Some(serde_json::json!({ "identifier": identifier, "error": error.to_string() })),+ );+ all_deleted = false;+ },+ }+ }+ }+ }+ if all_deleted {+ executed.push(Category::Models);+ }+ }++ if categories.contains(&Category::Logs) {+ for path in log_files() {+ let _ = std::fs::remove_file(path);+ }+ executed.push(Category::Logs);+ }++ Ok(CleanupResult {+ executed,+ models_skipped,+ })+}diff --git a/apps/mirai-gui/desktop/src/storage/mod.rs b/apps/mirai-gui/desktop/src/storage/mod.rsnew file mode 100644index 000000000..ba94efdbe--- /dev/null+++ b/apps/mirai-gui/desktop/src/storage/mod.rs@@ -0,0 +1,201 @@+pub mod cleanup;++use std::path::{Path, PathBuf};++use crate::error::{AppError, AppResult};++// Must stay "~/Library/Application Support/mirai": user chats and settings+// live here, and renaming the directory would strand them.+pub fn mirai_data_dir() -> AppResult<PathBuf> {+ let home = std::env::var_os("HOME").ok_or_else(|| AppError::msg("HOME not set"))?;+ Ok(PathBuf::from(home).join("Library/Application Support/mirai"))+}++pub fn chats_dir() -> AppResult<PathBuf> {+ Ok(mirai_data_dir()?.join("chats"))+}++pub fn settings_path() -> AppResult<PathBuf> {+ Ok(mirai_data_dir()?.join("settings.json"))+}++// tmp-then-rename so a crash mid-write can't leave a truncated file behind.+pub(crate) fn write_atomic(+ path: &Path,+ content: &[u8],+) -> AppResult<()> {+ if let Some(parent) = path.parent() {+ std::fs::create_dir_all(parent)?;+ }+ let mut tmp = path.as_os_str().to_owned();+ tmp.push(".tmp");+ let tmp = PathBuf::from(tmp);+ std::fs::write(&tmp, content)?;+ std::fs::rename(&tmp, path)?;+ Ok(())+}++// Confines a client-supplied path to the chats dir: strips any directory+// components so "../escape" can't reach outside the store.+fn resolve(rel: &str) -> AppResult<PathBuf> {+ let name = Path::new(rel).file_name().ok_or_else(|| AppError::msg(format!("Invalid chat path: {rel}")))?;+ Ok(chats_dir()?.join(name))+}++#[tauri::command]+pub async fn chat_list_files() -> AppResult<Vec<String>> {+ let dir = chats_dir()?;+ let Ok(entries) = std::fs::read_dir(&dir) else {+ return Ok(Vec::new());+ };+ let mut files = Vec::new();+ for entry in entries.flatten() {+ if let Some(name) = entry.file_name().to_str()+ && name.ends_with(".md")+ {+ files.push(name.to_string());+ }+ }+ Ok(files)+}++#[tauri::command]+pub async fn chat_load_file(path: String) -> AppResult<Option<String>> {+ read_optional(&resolve(&path)?)+}++#[tauri::command]+pub async fn chat_save_file(+ path: String,+ content: String,+) -> AppResult<()> {+ let full = resolve(&path)?;+ write_atomic(&full, content.as_bytes())+}++#[tauri::command]+pub async fn chat_delete_file(path: String) -> AppResult<()> {+ let full = resolve(&path)?;+ match std::fs::remove_file(full) {+ Ok(()) => Ok(()),+ Err(e) if e.kind() == std::io::ErrorKind::NotFound => Ok(()),+ Err(e) => Err(e.into()),+ }+}++fn global_instructions_path() -> AppResult<PathBuf> {+ Ok(chats_dir()?.join("global-instructions.txt"))+}++#[tauri::command]+pub async fn global_instructions_save(content: String) -> AppResult<()> {+ write_atomic(&global_instructions_path()?, content.as_bytes())+}++#[tauri::command]+pub async fn global_instructions_load() -> AppResult<Option<String>> {+ read_optional(&global_instructions_path()?)+}++fn read_optional(path: &Path) -> AppResult<Option<String>> {+ match std::fs::read_to_string(path) {+ Ok(content) => Ok(Some(content)),+ Err(e) if e.kind() == std::io::ErrorKind::NotFound => Ok(None),+ Err(e) => Err(e.into()),+ }+}++#[tauri::command]+pub async fn save_binary_file(+ absolute_path: String,+ data: Vec<u8>,+) -> AppResult<bool> {+ match std::fs::write(&absolute_path, &data) {+ Ok(()) => Ok(true),+ Err(_) => Ok(false),+ }+}++#[tauri::command]+pub async fn read_text_file(absolute_path: String) -> AppResult<Option<String>> {+ Ok(std::fs::read_to_string(&absolute_path).ok())+}++// settings.json keys are an on-disk contract: renaming one silently resets+// that preference for everyone who already has the file.+static SETTINGS_LOCK: std::sync::Mutex<()> = std::sync::Mutex::new(());++// A missing file is a fresh install. An unreadable one must not be treated the+// same way: the next patch would overwrite every stored preference with just+// its own keys. A file that does not parse is moved aside so it can be recovered.+fn read_settings() -> AppResult<serde_json::Map<String, serde_json::Value>> {+ let path = settings_path()?;+ let raw = match std::fs::read_to_string(&path) {+ Ok(raw) => raw,+ Err(e) if e.kind() == std::io::ErrorKind::NotFound => return Ok(serde_json::Map::new()),+ Err(e) => return Err(AppError::msg(format!("Failed to read settings: {e}"))),+ };+ match serde_json::from_str(&raw) {+ Ok(serde_json::Value::Object(map)) => Ok(map),+ _ => {+ let backup = path.with_extension("corrupt.json");+ crate::logger::error(+ "settings:corrupt",+ Some(serde_json::json!({ "path": path.display().to_string(), "backup": backup.display().to_string() })),+ );+ std::fs::rename(&path, &backup)+ .map_err(|e| AppError::msg(format!("Failed to set aside corrupt settings: {e}")))?;+ Ok(serde_json::Map::new())+ },+ }+}++#[tauri::command]+pub fn settings_load() -> AppResult<serde_json::Value> {+ let _guard = SETTINGS_LOCK.lock().expect("settings lock poisoned");+ read_settings().map(serde_json::Value::Object)+}++fn write_settings(settings: &serde_json::Map<String, serde_json::Value>) -> AppResult<()> {+ let json = serde_json::to_string_pretty(settings)?;+ write_atomic(&settings_path()?, json.as_bytes())+}++pub fn settings_merge(+ patch: serde_json::Map<String, serde_json::Value>+) -> AppResult<serde_json::Map<String, serde_json::Value>> {+ let _guard = SETTINGS_LOCK.lock().expect("settings lock poisoned");+ let mut current = read_settings()?;+ current.extend(patch);+ write_settings(¤t)?;+ Ok(current)+}++#[tauri::command]+pub fn settings_patch(patch: serde_json::Value) -> AppResult<()> {+ let serde_json::Value::Object(patch) = patch else {+ return Err(AppError::msg("settings patch must be an object"));+ };+ settings_merge(patch).map(|_| ())+}++// One model's entry changes under the settings lock, so the other models'+// parameters are never rewritten from a client-side copy.+#[tauri::command]+pub fn model_params_set(+ repo_id: String,+ params: Option<serde_json::Value>,+) -> AppResult<()> {+ let _guard = SETTINGS_LOCK.lock().expect("settings lock poisoned");+ let mut current = read_settings()?;+ let mut model_params = match current.remove("modelParams") {+ Some(serde_json::Value::Object(map)) => map,+ _ => serde_json::Map::new(),+ };+ match params {+ Some(params) => model_params.insert(repo_id, params),+ None => model_params.remove(&repo_id),+ };+ current.insert("modelParams".to_string(), serde_json::Value::Object(model_params));+ write_settings(¤t)+}diff --git a/apps/mirai-gui/desktop/src/system_ui.rs b/apps/mirai-gui/desktop/src/system_ui.rsnew file mode 100644index 000000000..0728bf15e--- /dev/null+++ b/apps/mirai-gui/desktop/src/system_ui.rs@@ -0,0 +1,153 @@+use tauri::{+ AppHandle, Emitter, Manager,+ menu::{Menu, MenuItem, PredefinedMenuItem},+};+use tauri_plugin_autostart::ManagerExt as AutostartExt;+use tauri_plugin_global_shortcut::GlobalShortcutExt;++use crate::error::{AppError, AppResult};++const MENU_NEW_CHAT_ID: &str = "menu:new-chat";+const MENU_SETTINGS_ID: &str = "menu:settings";++pub(crate) fn show_and_focus_main(app: &AppHandle) {+ if let Some(window) = app.get_webview_window("main") {+ let _ = window.show();+ let _ = window.unminimize();+ let _ = window.set_focus();+ }+}++#[tauri::command]+pub fn get_run_on_startup(app: AppHandle) -> bool {+ app.autolaunch().is_enabled().unwrap_or(false)+}++#[tauri::command]+pub fn set_run_on_startup(+ app: AppHandle,+ value: bool,+) -> AppResult<()> {+ let manager = app.autolaunch();+ let result = if value {+ manager.enable()+ } else {+ manager.disable()+ };+ result.map_err(AppError::msg)+}++pub fn setup_app_menu(app: &AppHandle) -> tauri::Result<()> {+ let menu = Menu::default(app)?;+ for item in menu.items()? {+ let Some(submenu) = item.as_submenu() else {+ continue;+ };+ if submenu.text().unwrap_or_default() == "File" {+ submenu.insert_items(+ &[+ &MenuItem::with_id(app, MENU_NEW_CHAT_ID, "New Chat", true, Some("CmdOrCtrl+N"))?,+ &MenuItem::with_id(app, MENU_SETTINGS_ID, "Settings", true, Some("CmdOrCtrl+,"))?,+ &PredefinedMenuItem::separator(app)?,+ ],+ 0,+ )?;+ }+ }+ app.set_menu(menu)?;+ app.on_menu_event(|app, event| match event.id().as_ref() {+ MENU_NEW_CHAT_ID => {+ show_and_focus_main(app);+ let _ = app.emit("app:new-chat", ());+ },+ MENU_SETTINGS_ID => {+ show_and_focus_main(app);+ let _ = app.emit("app:open-preferences", ());+ },+ _ => {},+ });+ Ok(())+}++fn apply_quick_entry_shortcut(+ app: &AppHandle,+ accelerator: &str,+) -> bool {+ let shortcut = app.global_shortcut();+ if shortcut.is_registered(accelerator) {+ return true;+ }+ let handler_app = app.clone();+ let registered = shortcut+ .on_shortcut(accelerator, move |_app, _shortcut, event| {+ if event.state() == tauri_plugin_global_shortcut::ShortcutState::Pressed {+ show_and_focus_main(&handler_app);+ }+ })+ .is_ok();+ if registered && let Some(previous) = get_quick_entry_shortcut().filter(|p| p != accelerator) {+ let _ = shortcut.unregister(previous.as_str());+ }+ registered+}++#[tauri::command]+pub fn register_quick_entry_shortcut(+ app: AppHandle,+ accelerator: String,+) -> bool {+ let ok = apply_quick_entry_shortcut(&app, &accelerator);+ if ok {+ persist_quick_entry_accelerator(Some(&accelerator));+ }+ ok+}++#[tauri::command]+pub fn unregister_quick_entry_shortcut(app: AppHandle) -> AppResult<()> {+ app.global_shortcut().unregister_all().map_err(AppError::msg)?;+ persist_quick_entry_accelerator(None);+ Ok(())+}++// The shortcut already works for this session; a failed write only loses it on+// the next launch, so log instead of failing the command.+fn persist_quick_entry_accelerator(accelerator: Option<&str>) {+ if let Err(e) = crate::storage::settings_patch(serde_json::json!({ "quickEntryAccelerator": accelerator })) {+ crate::logger::warn("shortcut:settings-write-failed", Some(serde_json::json!({ "error": e })));+ }+}++// Sync the native window appearance to the app theme: otherwise the window+// keeps the system appearance and macOS paints the inactive traffic lights for+// the wrong one (grey lights vanish on a dark background).+#[tauri::command]+pub fn set_window_theme(+ app: AppHandle,+ dark: bool,+) -> bool {+ let theme = if dark {+ tauri::Theme::Dark+ } else {+ tauri::Theme::Light+ };+ app.get_webview_window("main").map(|w| w.set_theme(Some(theme)).is_ok()).unwrap_or(false)+}++#[tauri::command]+pub fn get_quick_entry_shortcut() -> Option<String> {+ let settings = crate::storage::settings_load().ok()?;+ settings.get("quickEntryAccelerator").and_then(|v| v.as_str()).filter(|s| !s.is_empty()).map(str::to_string)+}++pub fn restore_from_settings(app: &AppHandle) {+ let settings = crate::storage::settings_load().unwrap_or_else(|_| serde_json::json!({}));+ if let Some(accelerator) = settings.get("quickEntryAccelerator").and_then(|v| v.as_str())+ && !accelerator.is_empty()+ && !apply_quick_entry_shortcut(app, accelerator)+ {+ // Otherwise settings keep showing a shortcut that does not work.+ crate::logger::warn("shortcut:restore-failed", Some(serde_json::json!({ "accelerator": accelerator })));+ persist_quick_entry_accelerator(None);+ }+}diff --git a/apps/mirai-gui/desktop/src/updater/mod.rs b/apps/mirai-gui/desktop/src/updater/mod.rsnew file mode 100644index 000000000..ddfb0a3d0--- /dev/null+++ b/apps/mirai-gui/desktop/src/updater/mod.rs@@ -0,0 +1,328 @@+mod staging;++use serde::Serialize;+use staging::{clean_stale_staging, staging_path};+use tauri::{AppHandle, Emitter};+use tauri_plugin_updater::{Update, UpdaterExt};+use tokio::sync::Mutex;++use crate::error::AppResult;++#[derive(Default)]+enum Phase {+ #[default]+ Idle,+ Downloading {+ version: String,+ },+ Downloaded {+ version: String,+ },+ Applying {+ version: String,+ },+}++#[derive(Default)]+pub struct UpdaterState {+ inner: Mutex<UpdaterInner>,+}++#[derive(Default)]+struct UpdaterInner {+ phase: Phase,+ pending: Option<Update>,+ // Staging to disk makes a failed apply retryable; the plugin still buffers the+ // whole archive in RAM, so this is not streaming.+ downloaded: Option<(Update, std::path::PathBuf)>,+}++#[derive(Serialize)]+pub struct CheckResult {+ #[serde(rename = "currentVersion")]+ current_version: String,+ #[serde(rename = "latestVersion", skip_serializing_if = "Option::is_none")]+ latest_version: Option<String>,+ #[serde(rename = "hasUpdate")]+ has_update: bool,+ #[serde(rename = "hasDownloadable")]+ has_downloadable: bool,+ #[serde(skip_serializing_if = "Option::is_none")]+ reason: Option<String>,+}++fn current_version(app: &AppHandle) -> String {+ app.package_info().version.to_string()+}++fn check_error(+ current: String,+ reason: String,+) -> CheckResult {+ CheckResult {+ current_version: current,+ latest_version: None,+ has_update: false,+ has_downloadable: false,+ reason: Some(reason),+ }+}++#[tauri::command]+pub async fn update_check(+ app: AppHandle,+ state: tauri::State<'_, UpdaterState>,+) -> AppResult<CheckResult> {+ let current = current_version(&app);++ {+ let inner = state.inner.lock().await;+ if !matches!(inner.phase, Phase::Idle) {+ return Ok(check_error(current, "update-in-progress".to_string()));+ }+ }++ let updater = match app.updater() {+ Ok(u) => u,+ Err(e) => return Ok(check_error(current, e.to_string())),+ };++ match updater.check().await {+ Ok(Some(update)) => {+ let latest = update.version.clone();+ let mut inner = state.inner.lock().await;+ // A download may have been claimed while check() ran; re-check.+ if !matches!(inner.phase, Phase::Idle) {+ return Ok(check_error(current, "update-in-progress".to_string()));+ }+ inner.pending = Some(update);+ crate::logger::info(+ "update:check",+ Some(serde_json::json!({ "currentVersion": current, "latestVersion": latest, "hasUpdate": true })),+ );+ Ok(CheckResult {+ current_version: current,+ latest_version: Some(latest),+ has_update: true,+ has_downloadable: true,+ reason: None,+ })+ },+ Ok(None) => Ok(CheckResult {+ current_version: current,+ latest_version: None,+ has_update: false,+ has_downloadable: false,+ reason: None,+ }),+ Err(e) => {+ crate::logger::warn("update:error", Some(serde_json::json!({ "phase": "check", "error": e.to_string() })));+ Ok(CheckResult {+ current_version: current,+ latest_version: None,+ has_update: false,+ has_downloadable: false,+ reason: Some(e.to_string()),+ })+ },+ }+}++#[derive(Serialize)]+pub struct OpResult {+ ok: bool,+ #[serde(skip_serializing_if = "Option::is_none")]+ error: Option<String>,+}++#[tauri::command]+pub async fn update_download(+ app: AppHandle,+ state: tauri::State<'_, UpdaterState>,+ version: String,+) -> AppResult<OpResult> {+ // Claim atomically so two calls can't both start a download.+ let update = {+ let mut inner = state.inner.lock().await;+ if !matches!(inner.phase, Phase::Idle) {+ return Ok(OpResult {+ ok: false,+ error: Some("already-in-progress".to_string()),+ });+ }+ let Some(update) = inner.pending.take() else {+ return Ok(OpResult {+ ok: false,+ error: Some("no-pending-update".to_string()),+ });+ };+ if update.version != version {+ inner.pending = Some(update);+ return Ok(OpResult {+ ok: false,+ error: Some("version-mismatch".to_string()),+ });+ }+ inner.phase = Phase::Downloading {+ version: version.clone(),+ };+ update+ };++ // The staging path lives only in process state, so a crashed run orphans its+ // file; sweep before writing a new one.+ clean_stale_staging();++ let staged = match update.download(|_, _| {}, || {}).await {+ Ok(bytes) => {+ let path = staging_path(&version);+ std::fs::write(&path, &bytes).map(|_| path).map_err(|e| e.to_string())+ },+ Err(e) => Err(e.to_string()),+ };+ match staged {+ Ok(path) => {+ let mut inner = state.inner.lock().await;+ inner.phase = Phase::Downloaded {+ version: version.clone(),+ };+ inner.downloaded = Some((update, path));+ drop(inner);+ crate::logger::info("update:download:done", Some(serde_json::json!({ "version": version })));+ let _ = app.emit("update-download-done", serde_json::json!({ "version": version }));+ Ok(OpResult {+ ok: true,+ error: None,+ })+ },+ Err(e) => {+ let mut inner = state.inner.lock().await;+ inner.phase = Phase::Idle;+ inner.pending = Some(update);+ drop(inner);+ crate::logger::warn(+ "update:error",+ Some(serde_json::json!({ "phase": "download", "version": version, "error": e.to_string() })),+ );+ let _ =+ app.emit("update-download-error", serde_json::json!({ "version": version, "error": e.to_string() }));+ Ok(OpResult {+ ok: false,+ error: Some(e.to_string()),+ })+ },+ }+}++#[tauri::command]+pub async fn update_apply(+ app: AppHandle,+ state: tauri::State<'_, UpdaterState>,+) -> AppResult<OpResult> {+ // Claim under one lock so a double-click can't run two installs that both+ // rename the .app; restore on failure so apply stays retryable.+ let (update, path, version) = {+ let mut inner = state.inner.lock().await;+ let version = match &inner.phase {+ Phase::Downloaded {+ version,+ } => version.clone(),+ Phase::Applying {+ ..+ } => {+ return Ok(OpResult {+ ok: false,+ error: Some("already-applying".to_string()),+ });+ },+ _ => {+ return Ok(OpResult {+ ok: false,+ error: Some("no-downloaded-update".to_string()),+ });+ },+ };+ let Some((update, path)) = inner.downloaded.take() else {+ return Ok(OpResult {+ ok: false,+ error: Some("no-downloaded-update".to_string()),+ });+ };+ inner.phase = Phase::Applying {+ version: version.clone(),+ };+ (update, path, version)+ };++ let bytes = match std::fs::read(&path) {+ Ok(b) => b,+ Err(e) => {+ restore_downloaded(&state, update, path, version).await;+ return Ok(OpResult {+ ok: false,+ error: Some(e.to_string()),+ });+ },+ };+ match update.install(bytes) {+ Ok(()) => {+ let _ = std::fs::remove_file(&path);+ crate::logger::info("update:apply", None);+ app.restart();+ },+ Err(e) => {+ crate::logger::error("update:apply:error", Some(serde_json::json!({ "error": e.to_string() })));+ restore_downloaded(&state, update, path, version).await;+ Ok(OpResult {+ ok: false,+ error: Some(e.to_string()),+ })+ },+ }+}++async fn restore_downloaded(+ state: &UpdaterState,+ update: Update,+ path: std::path::PathBuf,+ version: String,+) {+ let mut inner = state.inner.lock().await;+ inner.phase = Phase::Downloaded {+ version,+ };+ inner.downloaded = Some((update, path));+}++#[derive(Serialize)]+#[serde(tag = "phase", rename_all = "lowercase")]+pub enum StatusResult {+ Idle,+ Downloading {+ version: String,+ },+ Downloaded {+ version: String,+ },+}++#[tauri::command]+pub async fn update_status(state: tauri::State<'_, UpdaterState>) -> AppResult<StatusResult> {+ let inner = state.inner.lock().await;+ Ok(match &inner.phase {+ Phase::Idle => StatusResult::Idle,+ Phase::Downloading {+ version,+ } => StatusResult::Downloading {+ version: version.clone(),+ },+ Phase::Downloaded {+ version,+ }+ | Phase::Applying {+ version,+ } => StatusResult::Downloaded {+ version: version.clone(),+ },+ })+}diff --git a/apps/mirai-gui/desktop/src/updater/staging.rs b/apps/mirai-gui/desktop/src/updater/staging.rsnew file mode 100644index 000000000..77fb52452--- /dev/null+++ b/apps/mirai-gui/desktop/src/updater/staging.rs@@ -0,0 +1,32 @@+const STAGING_PREFIX: &str = "mirai-update-";++pub(super) fn staging_path(version: &str) -> std::path::PathBuf {+ // pid-scoped so two instances staging the same version can't clobber each other.+ let pid = std::process::id();+ std::env::temp_dir().join(format!("{STAGING_PREFIX}{version}-{pid}.tar.gz"))+}++// A younger file may be a peer's download in flight; only age tells them apart.+const STAGING_MAX_AGE: std::time::Duration = std::time::Duration::from_secs(24 * 60 * 60);++pub(super) fn clean_stale_staging() {+ let Ok(entries) = std::fs::read_dir(std::env::temp_dir()) else {+ return;+ };+ for entry in entries.flatten() {+ let name = entry.file_name();+ let name = name.to_string_lossy();+ if !(name.starts_with(STAGING_PREFIX) && name.ends_with(".tar.gz")) {+ continue;+ }+ let old_enough = entry+ .metadata()+ .and_then(|m| m.modified())+ .ok()+ .and_then(|t| t.elapsed().ok())+ .is_some_and(|age| age > STAGING_MAX_AGE);+ if old_enough {+ let _ = std::fs::remove_file(entry.path());+ }+ }+}diff --git a/apps/mirai-gui/desktop/tauri.conf.json b/apps/mirai-gui/desktop/tauri.conf.jsonnew file mode 100644index 000000000..edbd6d85d--- /dev/null+++ b/apps/mirai-gui/desktop/tauri.conf.json@@ -0,0 +1,41 @@+{+ "$schema": "https://schema.tauri.app/config/2",+ "productName": "Mirai",+ "mainBinaryName": "Mirai",+ "version": "../package.json",+ "identifier": "com.mirai.tech.chat",+ "build": {+ "beforeDevCommand": "pnpm run client:dev",+ "devUrl": "http://localhost:3002",+ "beforeBuildCommand": "pnpm run client:build",+ "frontendDist": "../client/dist-tauri"+ },+ "app": {+ "windows": [],+ "security": {+ "csp": "default-src 'self'; script-src 'self' 'wasm-unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob: https://assets.trymirai.com; font-src 'self'; connect-src 'self' ipc: http://ipc.localhost"+ }+ },+ "plugins": {+ "updater": {+ "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEU4RjRBNEIxRDVCNjEzMkQKUldRdEU3YlZzYVQwNkxkeWw5cFlRUE5veE1mdmMwdDVFcEQvSXdsVVZKNVhGUFovWDZOK0tKYloK",+ "endpoints": ["https://github.com/trymirai/uzu/releases/latest/download/latest.json"]+ }+ },+ "bundle": {+ "active": true,+ "targets": ["app", "dmg"],+ "icon": ["icons/icon.png", "icons/icon.icns"],+ "category": "public.app-category.productivity",+ "macOS": {+ "signingIdentity": "-",+ "minimumSystemVersion": "26.4",+ "dmg": {+ "background": "dmg-background.tiff",+ "windowSize": { "width": 638, "height": 398 },+ "appPosition": { "x": 165, "y": 200 },+ "applicationFolderPosition": { "x": 473, "y": 200 }+ }+ }+ }+}diff --git a/apps/mirai-gui/desktop/tauri.release.conf.json b/apps/mirai-gui/desktop/tauri.release.conf.jsonnew file mode 100644index 000000000..aaa6a6359--- /dev/null+++ b/apps/mirai-gui/desktop/tauri.release.conf.json@@ -0,0 +1,7 @@+{+ "$schema": "https://schema.tauri.app/config/2",+ "bundle": {+ "createUpdaterArtifacts": true,+ "resources": { "resources/cli/mirai": "cli/mirai" }+ }+}diff --git a/apps/mirai-gui/eslint.config.mjs b/apps/mirai-gui/eslint.config.mjsnew file mode 100644index 000000000..a92af5492--- /dev/null+++ b/apps/mirai-gui/eslint.config.mjs@@ -0,0 +1,52 @@+import js from "@eslint/js";+import { defineConfig } from "eslint/config";+import tseslint from "typescript-eslint";+import reactHooks from "eslint-plugin-react-hooks";++export default defineConfig([+ // eslint does not read .gitignore.+ { ignores: ["client/dist-*/**", "desktop/target/**", "desktop/gen/**", "client/src/route-tree.gen.ts"] },+ js.configs.recommended,+ {+ files: ["vite.config.ts"],+ languageOptions: {+ parser: tseslint.parser,+ globals: {+ process: "readonly",+ __dirname: "readonly",+ },+ },+ },+ {+ files: ["client/src/**/*.{ts,tsx}"],+ extends: [tseslint.configs.recommended],+ plugins: { "react-hooks": reactHooks },+ rules: {+ "react-hooks/exhaustive-deps": "error",+ "react-hooks/rules-of-hooks": "error",+ "@typescript-eslint/consistent-type-definitions": ["error", "type"],+ },+ },+ // Module augmentation only merges into an interface.+ {+ files: ["client/src/router.ts"],+ rules: { "@typescript-eslint/consistent-type-definitions": "off" },+ },+ {+ files: ["client/src/**/*.{ts,tsx}"],+ ignores: ["client/src/platform/**"],+ rules: {+ "no-restricted-imports": [+ "error",+ {+ patterns: [+ {+ group: ["@tauri-apps/api", "@tauri-apps/api/*", "@tauri-apps/plugin-*"],+ message: "Tauri APIs belong to platform/services/*/tauri.ts. Everywhere else go through getPlatform().",+ },+ ],+ },+ ],+ },+ },+]);diff --git a/apps/mirai-gui/package.json b/apps/mirai-gui/package.jsonnew file mode 100644index 000000000..fd2c0e1f5--- /dev/null+++ b/apps/mirai-gui/package.json@@ -0,0 +1,84 @@+{+ "name": "mirai-gui",+ "version": "0.6.1",+ "private": true,+ "type": "module",+ "packageManager": "[email protected]",+ "scripts": {+ "dev": "tauri dev",+ "build": "tauri build --target aarch64-apple-darwin",+ "client:dev": "vite",+ "client:build": "vite build",+ "web:dev": "vite --mode web",+ "web:build": "vite build --mode web",+ "typecheck": "tsc -p client/tsconfig.json --noEmit",+ "lint": "eslint .",+ "test": "vitest run",+ "lint:rust": "cargo clippy --manifest-path desktop/Cargo.toml --all-targets -- -D warnings",+ "test:rust": "cargo test --manifest-path desktop/Cargo.toml",+ "check": "pnpm typecheck && pnpm lint && pnpm test && pnpm lint:rust && pnpm test:rust",+ "format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,css,md}\"",+ "format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,json,css,md}\""+ },+ "author": "Mirai Team",+ "license": "MIT",+ "engines": {+ "node": ">=20.19"+ },+ "prettier": {+ "singleQuote": false,+ "trailingComma": "all",+ "printWidth": 120+ },+ "pnpm": {+ "onlyBuiltDependencies": [+ "esbuild"+ ]+ },+ "devDependencies": {+ "@eslint/js": "^10.0.1",+ "@tailwindcss/vite": "^4.3.3",+ "@tanstack/router-plugin": "^1.168.42",+ "@tauri-apps/cli": "^2.12.0",+ "@testing-library/react": "^16.3.3",+ "@types/hast": "^3.0.5",+ "@types/node": "^20.19.43",+ "@types/react": "^18.3.31",+ "@types/react-dom": "^18.3.7",+ "@vitejs/plugin-react": "^4.7.0",+ "eslint": "^10.11.0",+ "eslint-plugin-react-hooks": "^7.1.1",+ "jsdom": "^26.1.0",+ "prettier": "^3.9.9",+ "tailwindcss": "^4.3.3",+ "typescript": "^5.9.3",+ "typescript-eslint": "^8.71.0",+ "vite": "^5.4.21",+ "vitest": "^3.2.7"+ },+ "dependencies": {+ "@floating-ui/react-dom": "^2.1.9",+ "@headlessui/react": "^2.2.10",+ "@rive-app/canvas": "^2.44.0",+ "@rive-app/react-canvas": "^4.36.0",+ "@streamdown/cjk": "^1.0.4",+ "@streamdown/code": "^1.1.1",+ "@streamdown/math": "^1.0.3",+ "@tanstack/react-router": "^1.170.41",+ "@tauri-apps/api": "^2.12.0",+ "@tauri-apps/plugin-dialog": "^2.8.0",+ "date-fns": "^4.4.0",+ "jszip": "^3.10.2",+ "katex": "^0.16.47",+ "lucide-react": "^0.544.0",+ "motion": "^12.43.0",+ "react": "^18.3.1",+ "react-dom": "^18.3.1",+ "react-hot-toast": "^2.6.1",+ "shiki": "^3.23.0",+ "streamdown": "^2.7.0",+ "tailwind-merge": "^3.7.0",+ "uuid": "^14.0.2",+ "zustand": "^4.5.7"+ }+}diff --git a/apps/mirai-gui/pnpm-lock.yaml b/apps/mirai-gui/pnpm-lock.yamlnew file mode 100644index 000000000..cbdd95e45--- /dev/null+++ b/apps/mirai-gui/pnpm-lock.yaml@@ -0,0 +1,5676 @@+lockfileVersion: '9.0'++settings:+ autoInstallPeers: true+ excludeLinksFromLockfile: false++importers:++ .:+ dependencies:+ '@floating-ui/react-dom':+ specifier: ^2.1.9+ '@headlessui/react':+ specifier: ^2.2.10+ '@rive-app/canvas':+ specifier: ^2.44.0+ version: 2.44.0+ '@rive-app/react-canvas':+ specifier: ^4.36.0+ version: 4.36.0([email protected])+ '@streamdown/cjk':+ specifier: ^1.0.4+ version: 1.0.4(@types/[email protected])([email protected])([email protected])([email protected])([email protected])+ '@streamdown/code':+ specifier: ^1.1.1+ version: 1.1.1([email protected])+ '@streamdown/math':+ specifier: ^1.0.3+ version: 1.0.3([email protected])+ '@tanstack/react-router':+ specifier: ^1.170.41+ '@tauri-apps/api':+ specifier: ^2.12.0+ version: 2.12.0+ '@tauri-apps/plugin-dialog':+ specifier: ^2.8.0+ version: 2.8.0+ date-fns:+ specifier: ^4.4.0+ version: 4.4.0+ jszip:+ specifier: ^3.10.2+ version: 3.10.2+ katex:+ specifier: ^0.16.47+ version: 0.16.47+ lucide-react:+ specifier: ^0.544.0+ version: 0.544.0([email protected])+ motion:+ specifier: ^12.43.0+ react:+ specifier: ^18.3.1+ version: 18.3.1+ react-dom:+ specifier: ^18.3.1+ version: 18.3.1([email protected])+ react-hot-toast:+ specifier: ^2.6.1+ version: 2.6.1(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])+ shiki:+ specifier: ^3.23.0+ version: 3.23.0+ streamdown:+ specifier: ^2.7.0+ tailwind-merge:+ specifier: ^3.7.0+ version: 3.7.0+ uuid:+ specifier: ^14.0.2+ version: 14.0.2+ zustand:+ specifier: ^4.5.7+ version: 4.5.7(@types/[email protected])([email protected])+ devDependencies:+ '@eslint/js':+ specifier: ^10.0.1+ version: 10.0.1([email protected]([email protected]))+ '@tailwindcss/vite':+ specifier: ^4.3.3+ '@tanstack/router-plugin':+ specifier: ^1.168.42+ version: 1.168.42(@tanstack/[email protected]([email protected]([email protected]))([email protected]))([email protected])([email protected])([email protected](@types/[email protected])([email protected]))+ '@tauri-apps/cli':+ specifier: ^2.12.0+ version: 2.12.0+ '@testing-library/react':+ specifier: ^16.3.3+ version: 16.3.3(@testing-library/[email protected])(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])+ '@types/hast':+ specifier: ^3.0.5+ version: 3.0.5+ '@types/node':+ specifier: ^20.19.43+ version: 20.19.43+ '@types/react':+ specifier: ^18.3.31+ version: 18.3.31+ '@types/react-dom':+ specifier: ^18.3.7+ version: 18.3.7(@types/[email protected])+ '@vitejs/plugin-react':+ specifier: ^4.7.0+ eslint:+ specifier: ^10.11.0+ version: 10.11.0([email protected])+ eslint-plugin-react-hooks:+ specifier: ^7.1.1+ version: 7.1.1([email protected]([email protected]))+ jsdom:+ specifier: ^26.1.0+ version: 26.1.0+ prettier:+ specifier: ^3.9.9+ version: 3.9.9+ tailwindcss:+ specifier: ^4.3.3+ version: 4.3.3+ typescript:+ specifier: ^5.9.3+ version: 5.9.3+ typescript-eslint:+ specifier: ^8.71.0+ vite:+ specifier: ^5.4.21+ version: 5.4.21(@types/[email protected])([email protected])+ vitest:+ specifier: ^3.2.7+ version: 3.2.7(@types/[email protected])(@types/[email protected])([email protected])([email protected])++packages:++ '@asamuzakjp/[email protected]':+ resolution: {integrity: sha512-K1A6z8tS3XsmCMM86xoWdn7Fkdn9m6RSVtocUrJYIwZnFVkng/PvkEoWtOWmP+Scc6saYWHWZYbndEEXxl24jw==}++ '@babel/[email protected]':+ resolution: {integrity: sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==}+ engines: {node: '>=6.9.0'}++ '@babel/[email protected]':+ resolution: {integrity: sha512-locTkQyKvwIEgBzVrn8693ebc97F2U8ZHjbXwDXJ5Fn2TCpNwTlKcaKLkdHop5c/icOFE7qt7Q9JC5hnKNa6Gg==}+ engines: {node: '>=6.9.0'}++ '@babel/[email protected]':+ resolution: {integrity: sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==}+ engines: {node: '>=6.9.0'}++ '@babel/[email protected]':+ resolution: {integrity: sha512-gZbepsdh3WDtgZKWL+vTPh71LSBrm/Y4/QDZBVCcYfmeTEEuoOYwlSy+G1StfJg+/Zy550u/3TATbm7qDbbMtg==}+ engines: {node: '>=6.9.0'}++ '@babel/[email protected]':+ resolution: {integrity: sha512-wem6WaBj4NaVYVdNhLPPVacES6ZJ+KBBfSkTMD3YZxbP3rm3Di85tJU5ljaUNhaOynt+Aj0xruhYuzQBt8n71g==}+ engines: {node: '>=6.9.0'}++ '@babel/[email protected]':+ resolution: {integrity: sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA==}+ engines: {node: '>=6.9.0'}++ '@babel/[email protected]':+ resolution: {integrity: sha512-ejHwrQQYcm9xnTivShn2IDOlIzInN34AXskvq9QicvCtEzq1Vzclu/tKF8Jq1Cg8JG2GL6/EmjgsCT7lXepE3g==}+ engines: {node: '>=6.9.0'}++ '@babel/[email protected]':+ resolution: {integrity: sha512-UPUVSyXbOh627KiCIGQSgwWzGeBKLkaJ9PJEdrngIwMSzxLR4jS4+f1f1jb7VzBbg8nFLaYotvVPFCTqdrmTAg==}+ engines: {node: '>=6.9.0'}+ peerDependencies:+ '@babel/core': ^7.0.0++ '@babel/[email protected]':+ resolution: {integrity: sha512-G7sHYigPY17oO5SYWnfD/0MTBwVR781S/JI643e/JhUYgVgWE/61SoW3NH9KWUKyKq5LVh3npif99Wkt6j86Jw==}+ engines: {node: '>=6.9.0'}++ '@babel/[email protected]':+ resolution: {integrity: sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==}+ engines: {node: '>=6.9.0'}++ '@babel/[email protected]':+ resolution: {integrity: sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==}+ engines: {node: '>=6.9.0'}++ '@babel/[email protected]':+ resolution: {integrity: sha512-N9ZErrD+yW5geCDtBqnOoxmR8+tNKiGuxKlDpuJxfsqpa2dFcexaziGAE/qoHLiDDreVNMupxGmSoNlyvsA3gw==}+ engines: {node: '>=6.9.0'}++ '@babel/[email protected]':+ resolution: {integrity: sha512-1k2lAGRMfHTcwuNYcCNUmaUffmQv8KWMfh2iJUUeRlwlwH4FdNG7mfPI10NPfLHJFThE4Tyr4mv7kTNZOiPuBg==}+ engines: {node: '>=6.9.0'}++ '@babel/[email protected]':+ resolution: {integrity: sha512-CjXrNHTnvqBVqHgdBysY3vk2T8tpJHb5/RMeHJBTyVa9xgugCB0CJTx/3oO8RV2QRQP391RWpB7D6hLjm8V9uA==}+ engines: {node: '>=6.0.0'}+ hasBin: true++ '@babel/[email protected]':+ resolution: {integrity: sha512-TL0hMc9xzy86VD31nUiwzd5otRAcyEPcsegCxolO0PvcXuH1v0kECe/UIznYFihpkvU5wg/jk4v0TTEFfm53fw==}+ engines: {node: '>=6.9.0'}+ peerDependencies:+ '@babel/core': ^7.0.0-0++ '@babel/[email protected]':+ resolution: {integrity: sha512-06IyK09H3wi4cGbhDBwp5gUGo0IKtnYa8tyTiephirPCK6fbobVGiXMMI5zLQ4aKEYP3wZ3ArU44o+8KMrSG/Q==}+ engines: {node: '>=6.9.0'}+ peerDependencies:+ '@babel/core': ^7.0.0-0++ '@babel/[email protected]':+ resolution: {integrity: sha512-Nq8OhGWiZIZGV6hLHoyAKLLcJihP/xFeBMGJoUrxTX2psI8dCifzLhZISFb+VWS3wFMRDmCGw5R+dOySCqPLhw==}+ engines: {node: '>=6.9.0'}++ '@babel/[email protected]':+ resolution: {integrity: sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==}+ engines: {node: '>=6.9.0'}++ '@babel/[email protected]':+ resolution: {integrity: sha512-I5z7H3bf/41ktsNVLtpN0wAa336HkqIHQ5BuPLEhTkt1jVSyZpeNKIzTgEWmlxjdg81R0IgUCcaE+Ok3NvrfZg==}+ engines: {node: '>=6.9.0'}++ '@babel/[email protected]':+ resolution: {integrity: sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg==}+ engines: {node: '>=6.9.0'}++ '@cacheable/[email protected]':+ resolution: {integrity: sha512-CTLKqLItRCEixEAewD3/j9DB3/o96gpTPD4eJ1v+DGOlxZRZncRQkGYqqnAGCscYd6RNeXfGeiuCphsPtqyIfQ==}++ '@cacheable/[email protected]':+ resolution: {integrity: sha512-buipgOVDkkPXNR5+xBpDw7Zk2n1EvU7qBJCNUcL7rhQ//kfpOXPAvQ511Os0vpLYJ1pZnvudNytkQt2hst3wqA==}++ '@csstools/[email protected]':+ resolution: {integrity: sha512-S11EXWJyy0Mz5SYvRmY8nJYTFFd1LCNV+7cXyAgQtOOuzb4EsgfqDufL+9esx72/eLhsRdGZwaldu/h+E4t4BA==}+ engines: {node: '>=18'}++ '@csstools/[email protected]':+ resolution: {integrity: sha512-3N8oaj+0juUw/1H3YwmDDJXCgTB1gKU6Hc/bB502u9zR0q2vd786XJH9QfrKIEgFlZmhZiq6epXl4rHqhzsIgQ==}+ engines: {node: '>=18'}+ peerDependencies:+ '@csstools/css-parser-algorithms': ^3.0.5+ '@csstools/css-tokenizer': ^3.0.4++ '@csstools/[email protected]':+ resolution: {integrity: sha512-nbtKwh3a6xNVIp/VRuXV64yTKnb1IjTAEEh3irzS+HkKjAOYLTGNb9pmVNntZ8iVBHcWDA2Dof0QtPgFI1BaTA==}+ engines: {node: '>=18'}+ peerDependencies:+ '@csstools/css-parser-algorithms': ^3.0.5+ '@csstools/css-tokenizer': ^3.0.4++ '@csstools/[email protected]':+ resolution: {integrity: sha512-DaDeUkXZKjdGhgYaHNJTV9pV7Y9B3b644jCLs9Upc3VeNGg6LWARAT6O+Q+/COo+2gg/bM5rhpMAtf70WqfBdQ==}+ engines: {node: '>=18'}+ peerDependencies:+ '@csstools/css-tokenizer': ^3.0.4++ '@csstools/[email protected]':+ resolution: {integrity: sha512-Vd/9EVDiu6PPJt9yAh6roZP6El1xHrdvIVGjyBsHR0RYwNHgL7FJPyIIW4fANJNG6FtyZfvlRPpFI4ZM/lubvw==}+ engines: {node: '>=18'}++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==}+ engines: {node: '>=12'}+ cpu: [ppc64]+ os: [aix]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-OaGtL73Jck6pBKjNIe24BnFE6agGl+6KxDtTfHhy1HmhthfKouEcOhqpSL64K4/0WCtbKFLOdzD/44cJ4k9opA==}+ engines: {node: '>=18'}+ cpu: [ppc64]+ os: [aix]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==}+ engines: {node: '>=12'}+ cpu: [arm64]+ os: [android]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-IDrddSmpSv51ftWslJMvl3Q2ZT98fUSL2/rlUXuVqRXHCs5EUF1/f+jbjF5+NG9UffUDMCiTyh8iec7u8RlTLg==}+ engines: {node: '>=18'}+ cpu: [arm64]+ os: [android]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==}+ engines: {node: '>=12'}+ cpu: [arm]+ os: [android]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-5WNI1DaMtxQ7t7B6xa572XMXpHAaI/9Hnhk8lcxF4zVN4xstUgTlvuGDorBguKEnZO70qwEcLpfifMLoxiPqHQ==}+ engines: {node: '>=18'}+ cpu: [arm]+ os: [android]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==}+ engines: {node: '>=12'}+ cpu: [x64]+ os: [android]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-I853iMZ1hWZdNllhVZKm34f4wErd4lMyeV7BLzEExGEIZYsOzqDWDf+y082izYUE8gtJnYHdeDpN/6tUdwvfiw==}+ engines: {node: '>=18'}+ cpu: [x64]+ os: [android]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==}+ engines: {node: '>=12'}+ cpu: [arm64]+ os: [darwin]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-XIpIDMAjOELi/9PB30vEbVMs3GV1v2zkkPnuyRRURbhqjyzIINwj+nbQATh4H9GxUgH1kFsEyQMxwiLFKUS6Rg==}+ engines: {node: '>=18'}+ cpu: [arm64]+ os: [darwin]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==}+ engines: {node: '>=12'}+ cpu: [x64]+ os: [darwin]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-jhHfBzjYTA1IQu8VyrjCX4ApJDnH+ez+IYVEoJHeqJm9VhG9Dh2BYaJritkYK3vMaXrf7Ogr/0MQ8/MeIefsPQ==}+ engines: {node: '>=18'}+ cpu: [x64]+ os: [darwin]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==}+ engines: {node: '>=12'}+ cpu: [arm64]+ os: [freebsd]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-z93DmbnY6fX9+KdD4Ue/H6sYs+bhFQJNCPZsi4XWJoYblUqT06MQUdBCpcSfuiN72AbqeBFu5LVQTjfXDE2A6Q==}+ engines: {node: '>=18'}+ cpu: [arm64]+ os: [freebsd]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==}+ engines: {node: '>=12'}+ cpu: [x64]+ os: [freebsd]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-mrKX6H/vOyo5v71YfXWJxLVxgy1kyt1MQaD8wZJgJfG4gq4DpQGpgTB74e5yBeQdyMTbgxp0YtNj7NuHN0PoZg==}+ engines: {node: '>=18'}+ cpu: [x64]+ os: [freebsd]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==}+ engines: {node: '>=12'}+ cpu: [arm64]+ os: [linux]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-BlB7bIcLT3G26urh5Dmse7fiLmLXnRlopw4s8DalgZ8ef79Jj4aUcYbk90g8iCa2467HX8SAIidbL7gsqXHdRw==}+ engines: {node: '>=18'}+ cpu: [arm64]+ os: [linux]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==}+ engines: {node: '>=12'}+ cpu: [arm]+ os: [linux]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-HBU2Xv78SMgaydBmdor38lg8YDnFKSARg1Q6AT0/y2ezUAKiZvc211RDFHlEZRFNRVhcMamiToo7bDx3VEOYQw==}+ engines: {node: '>=18'}+ cpu: [arm]+ os: [linux]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==}+ engines: {node: '>=12'}+ cpu: [ia32]+ os: [linux]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-e7S3MOJPZGp2QW6AK6+Ly81rC7oOSerQ+P8L0ta4FhVi+/j/v2yZzx5CqqDaWjtPFfYz21Vi1S0auHrap3Ma3A==}+ engines: {node: '>=18'}+ cpu: [ia32]+ os: [linux]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==}+ engines: {node: '>=12'}+ cpu: [loong64]+ os: [linux]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-Sbe10Bnn0oUAB2AalYztvGcK+o6YFFA/9829PhOCUS9vkJElXGdphz0A3DbMdP8gmKkqPmPcMJmJOrI3VYB1JQ==}+ engines: {node: '>=18'}+ cpu: [loong64]+ os: [linux]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==}+ engines: {node: '>=12'}+ cpu: [mips64el]+ os: [linux]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-YcM5br0mVyZw2jcQeLIkhWtKPeVfAerES5PvOzaDxVtIyZ2NUBZKNLjC5z3/fUlDgT6w89VsxP2qzNipOaaDyA==}+ engines: {node: '>=18'}+ cpu: [mips64el]+ os: [linux]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==}+ engines: {node: '>=12'}+ cpu: [ppc64]+ os: [linux]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-++0HQvasdo20JytyDpFvQtNrEsAgNG2CY1CLMwGXfFTKGBGQT3bOeLSYE2l1fYdvML5KUuwn9Z8L1EWe2tzs1w==}+ engines: {node: '>=18'}+ cpu: [ppc64]+ os: [linux]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==}+ engines: {node: '>=12'}+ cpu: [riscv64]+ os: [linux]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-uNIBa279Y3fkjV+2cUjx36xkx7eSjb8IvnL01eXUKXez/CBHNRw5ekCGMPM0BcmqBxBcdgUWuUXmVWwm4CH9kg==}+ engines: {node: '>=18'}+ cpu: [riscv64]+ os: [linux]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==}+ engines: {node: '>=12'}+ cpu: [s390x]+ os: [linux]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-Mfiphvp3MjC/lctb+7D287Xw1DGzqJPb/J2aHHcHxflUo+8tmN/6d4k6I2yFR7BVo5/g7x2Monq4+Yew0EHRIA==}+ engines: {node: '>=18'}+ cpu: [s390x]+ os: [linux]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==}+ engines: {node: '>=12'}+ cpu: [x64]+ os: [linux]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-iSwByxzRe48YVkmpbgoxVzn76BXjlYFXC7NvLYq+b+kDjyyk30J0JY47DIn8z1MO3K0oSl9fZoRmZPQI4Hklzg==}+ engines: {node: '>=18'}+ cpu: [x64]+ os: [linux]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-9jNJl6FqaUG+COdQMjSCGW4QiMHH88xWbvZ+kRVblZsWrkXlABuGdFJ1E9L7HK+T0Yqd4akKNa/lO0+jDxQD4Q==}+ engines: {node: '>=18'}+ cpu: [arm64]+ os: [netbsd]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==}+ engines: {node: '>=12'}+ cpu: [x64]+ os: [netbsd]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-RLLdkflmqRG8KanPGOU7Rpg829ZHu8nFy5Pqdi9U01VYtG9Y0zOG6Vr2z4/S+/3zIyOxiK6cCeYNWOFR9QP87g==}+ engines: {node: '>=18'}+ cpu: [x64]+ os: [netbsd]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-YaFBlPGeDasft5IIM+CQAhJAqS3St3nJzDEgsgFixcfZeyGPCd6eJBWzke5piZuZ7CtL656eOSYKk4Ls2C0FRQ==}+ engines: {node: '>=18'}+ cpu: [arm64]+ os: [openbsd]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==}+ engines: {node: '>=12'}+ cpu: [x64]+ os: [openbsd]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-1MkgTCuvMGWuqVtAvkpkXFmtL8XhWy+j4jaSO2wxfJtilVCi0ZE37b8uOdMItIHz4I6z1bWWtEX4CJwcKYLcuA==}+ engines: {node: '>=18'}+ cpu: [x64]+ os: [openbsd]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-4Xd0xNiMVXKh6Fa7HEJQbrpP3m3DDn43jKxMjxLLRjWnRsfxjORYJlXPO4JNcXtOyfajXorRKY9NkOpTHptErg==}+ engines: {node: '>=18'}+ cpu: [arm64]+ os: [openharmony]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==}+ engines: {node: '>=12'}+ cpu: [x64]+ os: [sunos]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-WjH4s6hzo00nNezhp3wFIAfmGZ8U7KtrJNlFMRKxiI9mxEK1scOMAaa9i4crUtu+tBr+0IN6JCuAcSBJZfnphw==}+ engines: {node: '>=18'}+ cpu: [x64]+ os: [sunos]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==}+ engines: {node: '>=12'}+ cpu: [arm64]+ os: [win32]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-mGFrVJHmZiRqmP8xFOc6b84/7xa5y5YvR1x8djzXpJBSv/UsNK6aqec+6JDjConTgvvQefdGhFDAs2DLAds6gQ==}+ engines: {node: '>=18'}+ cpu: [arm64]+ os: [win32]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==}+ engines: {node: '>=12'}+ cpu: [ia32]+ os: [win32]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-b33gLVU2k11nVx1OhX3C8QQP6UHQK4ZtN56oFWvVXvz2VkDoe6fbG8TOgHFxEvqeqohmRnIHe5A1+HADk4OQww==}+ engines: {node: '>=18'}+ cpu: [ia32]+ os: [win32]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==}+ engines: {node: '>=12'}+ cpu: [x64]+ os: [win32]++ '@esbuild/[email protected]':+ resolution: {integrity: sha512-PPOl1mi6lpLNQxnGoyAfschAodRFYXJ+9fs6WHXz7CSWKbOqiMZsubC+BQsVKuul+3vKLuwTHsS2c2y9EoKwxQ==}+ engines: {node: '>=18'}+ cpu: [x64]+ os: [win32]++ '@eslint-community/[email protected]':+ resolution: {integrity: sha512-cuadcxVFE8sDK6iWJbs8Sn0av2Nrh2QSGQhVlBW9AaAHqHwjWsZHT8LJ4hFGPh7ASBV2deFdM7H/DPjulmh8rg==}+ engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}+ peerDependencies:+ eslint: ^6.0.0 || ^7.0.0 || >=8.0.0++ '@eslint-community/[email protected]':+ resolution: {integrity: sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==}+ engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0}++ '@eslint/[email protected]':+ resolution: {integrity: sha512-Y3kKLvC1dvTOT+oGlqNQ1XLqK6D1HU2YXPc52NmAlJZbMMWDzGYXMiPRJ8TYD39muD/OTjlZmNJ4ib7dvSrMBA==}+ engines: {node: ^20.19.0 || ^22.13.0 || >=24}++ '@eslint/[email protected]':+ resolution: {integrity: sha512-DObd/KKUsU+FaFv4PLxSRenpXfQWmPXXP3pPZ6/K1PCrMu2vQpMDMuQe/BqYeoLcz8ro0bVDF1RxOJgfVEdhUw==}+ engines: {node: ^20.19.0 || ^22.13.0 || >=24}++ '@eslint/[email protected]':+ resolution: {integrity: sha512-MwcE1P+AZ4C6DWlpin/OmOA54mmIZ/+xZuJiQd4SyB29oAJjN30UW9wkKNptW2ctp4cEsvhlLY/CsQ1uoHDloQ==}+ engines: {node: ^20.19.0 || ^22.13.0 || >=24}++ '@eslint/[email protected]':+ resolution: {integrity: sha512-zeR9k5pd4gxjZ0abRoIaxdc7I3nDktoXZk2qOv9gCNWx3mVwEn32VRhyLaRsDiJjTs0xq/T8mfPtyuXu7GWBcA==}+ engines: {node: ^20.19.0 || ^22.13.0 || >=24}+ peerDependencies:+ eslint: ^10.0.0+ peerDependenciesMeta:+ eslint:+ optional: true++ '@eslint/[email protected]':+ resolution: {integrity: sha512-vqTaUEgxzm+YDSdElad6PiRoX4t8VGDjCtt05zn4nU810UIx/uNEV7/lZJ6KwFThKZOzOxzXy48da+No7HZaMw==}+ engines: {node: ^20.19.0 || ^22.13.0 || >=24}++ '@eslint/[email protected]':+ resolution: {integrity: sha512-IkO+/KEUvwbVpiURZg+P7zF74z5Jxe0UgJxVni+RtoHQ6IZieXaO02kmadomap/q+l6bc/jdPGGqTjhuZnuz1Q==}+ engines: {node: ^20.19.0 || ^22.13.0 || >=24}++ '@floating-ui/[email protected]':+ resolution: {integrity: sha512-0CIZ5itps/8x7BG8dEIhs53BvCUH2PCoogtakwRTut+Arm58sJooJ0AuZhLw2HJYIR5cMLNPBSS728sPho2khQ==}++ '@floating-ui/[email protected]':+ resolution: {integrity: sha512-yXSrzeHZBTZadLOlfyhCkJHNeLJnHRnRInwdZ40L7ZiaAtrBwoYlsDrX3v5zB1Utk7CLfzcOVnVVWoXEky7Ceg==}++ '@floating-ui/[email protected]':+ resolution: {integrity: sha512-JDjEFGCpImxDCA7JJKviA0M9+RtmJdj0m/NVU5IMgBK+AmZouAQQ7/+2GLH0GXXY0YMw9oXPB8hKdbPYg5QLYg==}+ peerDependencies:+ react: '>=16.8.0'+ react-dom: '>=16.8.0'++ '@floating-ui/[email protected]':+ resolution: {integrity: sha512-yORQuuAtVpiRjpMhdc0wJj06b9JFjrYF4qp96j++v2NBpbi6SEGF7donUJ3TMieerQ6qVkAv1tgr7L4r5roTqw==}+ peerDependencies:+ react: '>=16.8.0'+ react-dom: '>=16.8.0'++ '@floating-ui/[email protected]':+ resolution: {integrity: sha512-HpCo8tmWzLVad5s2d19EhAz5zqrrQ6s69qd6moPMQvkOuSwDT1YgRfWSVuc4ennqrgv3OHppiOGMQ7oC13yIww==}++ '@headlessui/[email protected]':+ resolution: {integrity: sha512-5pVLNK9wlpxTUTy9GpgbX/SdcRh+HBnPktjM2wbiLTH4p+2EPHBO1aoSryUCuKUIItdDWO9ITlhUL8UnUN/oIA==}+ engines: {node: '>=10'}+ peerDependencies:+ react: ^18 || ^19 || ^19.0.0-rc+ react-dom: ^18 || ^19 || ^19.0.0-rc++ '@humanfs/[email protected]':+ resolution: {integrity: sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA==}+ engines: {node: '>=18.18.0'}++ '@humanfs/[email protected]':+ resolution: {integrity: sha512-gE1eQNZ3R++kTzFUpdGlpmy8kDZD/MLyHqDwqjkVQI0JMdI1D51sy1H958PNXYkM2rAac7e5/CnIKZrHtPh3BQ==}+ engines: {node: '>=18.18.0'}++ '@humanfs/[email protected]':+ resolution: {integrity: sha512-ZZ1w0aoQkwuUuC7Yf+7sdeaNfqQiiLcSRbfI08oAxqLtpXQr9AIVX7Ay7HLDuiLYAaFPu8oBYNq/QIi9URHJ3Q==}+ engines: {node: '>=18.18.0'}++ '@humanwhocodes/[email protected]':+ resolution: {integrity: sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==}+ engines: {node: '>=12.22'}++ '@humanwhocodes/[email protected]':+ resolution: {integrity: sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==}+ engines: {node: '>=18.18'}++ '@internationalized/[email protected]':+ resolution: {integrity: sha512-M1dEn4c1U1HsSlaVR8upZtSqvXrTkHDfv18H01uCSJyjVLDxnBR38v/fMxecmlwXKR4i9HeZcmgQAPE6A+aGJQ==}++ '@internationalized/[email protected]':+ resolution: {integrity: sha512-8UmMFia46DUt+k97zKd9fKWXcWHR+k8ae3eYzILETuT2KbIvLyOfac7zesw+sJdRAAZ7Q9pM1Mk22aXp2LD0Ig==}++ '@internationalized/[email protected]':+ resolution: {integrity: sha512-PDx6//vHSpRnHfxqMqto11zQvhsaU74O3mKv2F/0eicGZcl9NLjQmGlbHz/LsJh5tLKp4A4L7ZVTzN1/MmMTvA==}++ '@jridgewell/[email protected]':+ resolution: {integrity: sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==}++ '@jridgewell/[email protected]':+ resolution: {integrity: sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==}++ '@jridgewell/[email protected]':+ resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==}+ engines: {node: '>=6.0.0'}++ '@jridgewell/[email protected]':+ resolution: {integrity: sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==}++ '@jridgewell/[email protected]':+ resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==}++ '@keyv/[email protected]':+ resolution: {integrity: sha512-WbzE9sdmQtKy8vrNPa9BRnwZh5UF4s1KTmSK0KUVLo3eff5BlQNNWDnFOouNpKfPKDnms9xynJjsMYjMaT/aFQ==}+ engines: {node: '>= 18'}+ peerDependencies:+ keyv: ^5.6.0++ '@keyv/[email protected]':+ resolution: {integrity: sha512-dXn3FZhPv0US+7dtJsIi2R+c7qWYiReoEh5zUntWCf4oSpMNib8FDhSoed6m3QyZdx5hK7iLFkYk3rNxwt8vTA==}++ '@napi-rs/[email protected]':+ resolution: {integrity: sha512-oTXEIha4SsuXdTA4Iyskj0kpdx2yVXdhd75c2v3xGrHFfVMsbhTPZU/nMPL4sWKo4pBHm3aucLaqGlF696dTyQ==}+ engines: {node: ^22.20 || ^24.12 || >=25}+ cpu: [x64]+ os: [linux]+ libc: [glibc]++ '@react-aria/[email protected]':+ resolution: {integrity: sha512-CPxtkyrBi/HYY5P3lE/57sQ6qfa0lN8E55TOm89H0kNGv0lKt+/0zP7lWERzBjRr5IxBVrQX4gFEowBN52LPaA==}+ peerDependencies:+ react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1+ react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1++ '@react-aria/[email protected]':+ resolution: {integrity: sha512-Bqb+HrD5I5MHS2SKBhISYqo2SW8Y2dfzgF/Y1lIJq7xqLxheo9vzxPGEHhz+XzkgGfoqEJx8A6a3C7uiqS3HWA==}+ peerDependencies:+ react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1+ react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1++ '@react-types/[email protected]':+ resolution: {integrity: sha512-AzsuD9OfxTOZMMvTRhlN3oHBwOmFN7tDh27LzqmHt4+uOgPhJT7ZM7/kVs/8/o0WxayMUIk3hBmCFRHv1FUoag==}+ peerDependencies:+ react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1++ '@rive-app/[email protected]':+ resolution: {integrity: sha512-ak0GGwCbuWubi6rP9qB5YPy5CxYuTY3AiuTV4i1Vi7GXhuK2XB+M+4WJMuGcYGfGLzojaVMKaxtunD5OjjGzOQ==}++ '@rive-app/[email protected]':+ resolution: {integrity: sha512-34YVFivIXqRyOVzCTiKrkFkpFeXUUske3Zt9M+QPX1sjqxtoOkzqIkCij37LNNxxZm6xxydedEvo0DAPPAt5Fw==}+ peerDependencies:+ react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0++ '@rolldown/[email protected]':+ resolution: {integrity: sha512-+d0F4MKMCbeVUJwG96uQ4SgAznZNSq93I3V+9NHA4OpvqG8mRCpGdKmK8l/dl02h2CCDHwW2FqilnTyDcAnqjA==}++ '@rollup/[email protected]':+ resolution: {integrity: sha512-J25QJU+B78T4FhhBsNpLJyVWOi31mwtpcMwywHmOKH65Q9IWGA81gPj+dnwlhU8wktVriYE+tFAaQgrnJRzAZg==}+ cpu: [arm]+ os: [android]++ '@rollup/[email protected]':+ resolution: {integrity: sha512-LDopB3zuZM5Ux9TT2luNEBJW/tYbGU2g1d+VpKk6I+gSKDb+/7sYE6M225gRQt4RbMX6MSwMsVR/phdjVUgRLg==}+ cpu: [arm64]+ os: [android]++ '@rollup/[email protected]':+ resolution: {integrity: sha512-wlJEERGfeuHeBavCL2qVnNacOK43NDoZM4sjkeRPymd04OAE9T1zBqDJgmZ+CIsPTYKwdzpUC8vmOw84dwY4Tg==}+ cpu: [arm64]+ os: [darwin]++ '@rollup/[email protected]':+ resolution: {integrity: sha512-4nJJGg5jbo2wwPP4JP+LfEBA3bvP8rU9CLuhp7jWvq9sxEyhjQFTFdrqi+/dHEin/pd8jpT0vcehIpnZtmEdcQ==}+ cpu: [x64]+ os: [darwin]++ '@rollup/[email protected]':+ resolution: {integrity: sha512-DrZbyCDF1hneuO6jRbvZ2D7+PIBM6yIwYnJpg2vIk58T+wuFpiaGZrfUr59lDWw45bg+IrpTGLPiNi/Fk4w3Cg==}+ cpu: [arm64]+ os: [freebsd]++ '@rollup/[email protected]':+ resolution: {integrity: sha512-gqfUVMJMB3mehqywxp6hTBFfgtMQykZY19+cfiaYP0toIJLb/1DZRJHVkQQGP13W4TAwfZDWeg1qBcheTRioXQ==}+ cpu: [x64]+ os: [freebsd]++ '@rollup/[email protected]':+ resolution: {integrity: sha512-CFmhpvAwzSaWMlN3VN7UtmoTihlZNzoP0juQib5TQRnYUyDV8dXeWOp29sobWAT6gXl/hQgAClLlEiYozQG3OQ==}+ cpu: [arm]+ os: [linux]+ libc: [glibc]++ '@rollup/[email protected]':+ resolution: {integrity: sha512-Uc9H8eXCOayV6JLTH5bXKMId6qbhNHa818/BgYjm4jrlq3vZquC9cqyvHBw17xy5Mnj5f+I3gFK5JcEf3hSqrw==}+ cpu: [arm]+ os: [linux]+ libc: [musl]++ '@rollup/[email protected]':+ resolution: {integrity: sha512-VcPr/szv/1BFw112Kt//fxulXt/JPqzzidU84iW68L2DdjnOO8QFUv2zTSYBEPHD6movBD4z+bbr5y60GYM7Jw==}+ cpu: [arm64]+ os: [linux]+ libc: [glibc]++ '@rollup/[email protected]':+ resolution: {integrity: sha512-BnxtJ5/91BrIHYIkGrmjz/lbMhqEHt1dPFqIxIFR+jPn0xVc/oUSCtIT089zfp5ufwGDlYz2UC+Fe1SRBpYFbQ==}+ cpu: [arm64]+ os: [linux]+ libc: [musl]++ '@rollup/[email protected]':+ resolution: {integrity: sha512-LrYcHZwF+fAMNKHYTOQ5osWM4AZF7YF6D+XtsjDyEvljtt11twc+zHVXBLNEjxVSUnKYsOhvVz4Z213eW02COQ==}+ cpu: [loong64]+ os: [linux]+ libc: [glibc]++ '@rollup/[email protected]':+ resolution: {integrity: sha512-nj7QKQePAAUpCpJHtg0pR0W/b92A9NO17JS3BAQmHDn/yhmkir2p8llrKY9TOhleKIaSzy1JhxS3T9FVld6coA==}+ cpu: [loong64]+ os: [linux]+ libc: [musl]++ '@rollup/[email protected]':+ resolution: {integrity: sha512-5ylkX6dWMeBKge9nTU+Rxfb+ZfaCIJ9lRqIFaK0eAMcWp7OJbYnLveLgXmm0VrvuLKb8qIK+mHyH0qu88RM+iA==}+ cpu: [ppc64]+ os: [linux]+ libc: [glibc]++ '@rollup/[email protected]':+ resolution: {integrity: sha512-oHK4ZHYFDKjZviK34I+NwgfbGxgI7ztrNxj2hPTSSNFgeq1a/lEd7dHV2fdGAuTH4Iym3RHJg+vAbWaWG4B7Zg==}+ cpu: [ppc64]+ os: [linux]+ libc: [musl]++ '@rollup/[email protected]':+ resolution: {integrity: sha512-UcetmHZ6XOXuUByiKZyQmb55ZPr0LABr3Ec/HB9wKZn6CEAFWZkE+hsJErJ9hbPBC7nI0dKuELx7CoV6IM7TMg==}+ cpu: [riscv64]+ os: [linux]+ libc: [glibc]++ '@rollup/[email protected]':+ resolution: {integrity: sha512-C5CmDPQBtvjVo8cgQsBs+w6WB0JLkiixhgi6hVLV11hERWdn/p0XcPU2OUcZzac9BPOFq7SbaHFa8r3SWEysCQ==}+ cpu: [riscv64]+ os: [linux]+ libc: [musl]++ '@rollup/[email protected]':+ resolution: {integrity: sha512-lHVQHJFKsuuxLMi3MQO9XVL8Tje3JR82CzB+QDKC5NWBcsIWuwsn9uIM5e3lBhI+fF1/s63qnyYqsg65+8rV/w==}+ cpu: [s390x]+ os: [linux]+ libc: [glibc]++ '@rollup/[email protected]':+ resolution: {integrity: sha512-3W9bTFcQNJn71cSJVM9RKIiZOy8DO/XLDii8Uv/Pm6WKqDRj7JV3ZfuXIEfyuy5LXpIzAbB/1M4Ukp9GKNa7nA==}+ cpu: [x64]+ os: [linux]+ libc: [glibc]++ '@rollup/[email protected]':+ resolution: {integrity: sha512-VDC7rRJlee/scpki96GZ27Omf6yU87s1YXwVTpjE5841faVlDYYT565rgfmoR1U0sqL7z5ivQSDjcsF6VRXyBA==}+ cpu: [x64]+ os: [linux]+ libc: [musl]++ '@rollup/[email protected]':+ resolution: {integrity: sha512-z86Ok2p4pTdv5xqCKZsTooO7yBEiaJR/HzU3Wx8RmWsPoLppnMKROhJusQob8B3IE1ghC343kUW9rC2r+Wf3ig==}+ cpu: [x64]+ os: [openbsd]++ '@rollup/[email protected]':+ resolution: {integrity: sha512-IzQmj+xXwQFGhMAMKMQVXkMwMZN3TqkJgAE0nSsqvVwWWciP4AIPMmWRqOQ2GfX7TUDZr+xqGFcBS36CRPGw0g==}+ cpu: [arm64]+ os: [openharmony]++ '@rollup/[email protected]':+ resolution: {integrity: sha512-F6qpTaPc9bwBH85kjy0/BLmLSW1uv7AoOXCoRIkg2arlgCYlWYcAbiMkvZuAcaWk9TpCRG//okznLAqLGshkMw==}+ cpu: [arm64]+ os: [win32]++ '@rollup/[email protected]':+ resolution: {integrity: sha512-igoDsTFhhwECBeGbUuLeIk7t8Y1apa+cs6mDWpx2EZ0ch7oEQgzHbFUXN9euoHekCAQzXdXApAGkV6jznS7tWw==}+ cpu: [ia32]+ os: [win32]++ '@rollup/[email protected]':+ resolution: {integrity: sha512-U3teMeMbXFmaM5D+OTJpsOXd+wV/qftIeYF9kBKL4v73641qyJmoXFtA28DQLsnmlyayEsTe72xpLHrArq6vHw==}+ cpu: [x64]+ os: [win32]++ '@rollup/[email protected]':+ resolution: {integrity: sha512-ypfC34F3RKXvCXBglGqGMsUSMKlgwd1HX9AOAlx9RoZZ6GaI42YHVeKpzg3JG+wpBUJYTG+NNZhqbDWL8tBZkw==}+ cpu: [x64]+ os: [win32]++ '@shikijs/[email protected]':+ resolution: {integrity: sha512-NSWQz0riNb67xthdm5br6lAkvpDJRTgB36fxlo37ZzM2yq0PQFFzbd8psqC2XMPgCzo1fW6cVi18+ArJ44wqgA==}++ '@shikijs/[email protected]':+ resolution: {integrity: sha512-aHt9eiGFobmWR5uqJUViySI1bHMqrAgamWE1TYSUoftkAeCCAiGawPMwM+VCadylQtF4V3VNOZ5LmfItH5f3yA==}++ '@shikijs/[email protected]':+ resolution: {integrity: sha512-1nWINwKXxKKLqPibT5f4pAFLej9oZzQTsby8942OTlsJzOBZ0MWKiwzMsd+jhzu8YPCHAswGnnN1YtQfirL35g==}++ '@shikijs/[email protected]':+ resolution: {integrity: sha512-2Ep4W3Re5aB1/62RSYQInK9mM3HsLeB91cHqznAJMuylqjzNVAVCMnNWRHFtcNHXsoNRayP9z1qj4Sq3nMqYXg==}++ '@shikijs/[email protected]':+ resolution: {integrity: sha512-5qySYa1ZgAT18HR/ypENL9cUSGOeI2x+4IvYJu4JgVJdizn6kG4ia5Q1jDEOi7gTbN4RbuYtmHh0W3eccOrjMA==}++ '@shikijs/[email protected]':+ resolution: {integrity: sha512-3JZ5HXOZfYjsYSk0yPwBrkupyYSLpAE26Qc0HLghhZNGTZg/SKxXIIgoxOpmmeQP0RRSDJTk1/vPfw9tbw+jSQ==}++ '@shikijs/[email protected]':+ resolution: {integrity: sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg==}++ '@streamdown/[email protected]':+ resolution: {integrity: sha512-l5IVxqNhQDj9bDTu6h1sqxeEjZI7pW1uZ6Yu79l+9DqfmOkfGF0AJ0+y8oFi1hrFdscGqhXVNGjSgFJgh6Xh3A==}+ peerDependencies:+ react: ^18.0.0 || ^19.0.0++ '@streamdown/[email protected]':+ resolution: {integrity: sha512-i7HTNuDgZWb+VdrNVOam9gQhIc5MSSDXKWXgbUrn/4vSRaSMM+Rtl10MQj4wLWPNpF7p80waJsAqFP8HZfb0Jg==}+ peerDependencies:+ react: ^18.0.0 || ^19.0.0++ '@streamdown/[email protected]':+ resolution: {integrity: sha512-TOTRlPYs4LBNT8GaIWNCEVrcGVQsVcfc8WZ/x/0IyO+Rvsu6W+nF+YCS4Pl3JTVWQK8QX7LbWUChSilwlyzPZw==}+ peerDependencies:+ react: ^18.0.0 || ^19.0.0++ '@swc/[email protected]':+ resolution: {integrity: sha512-5lSsMOTXURePglDfvuAQUqkGek9Hg2kksOYay2m0+XR++b2NWYL/4sWyuvVBIs8oKnJaxkdi9whaL/sqN13afw==}++ '@tailwindcss/[email protected]':+ resolution: {integrity: sha512-/T8IKEsf9VTU6tLjgC7+sv2mOPtQxzE2jMw7u4Tt40Tx+QSZxpzh95/H6cMKoja9XuW7iMdLJYBB0o9G1CaAgg==}++ '@tailwindcss/[email protected]':+ resolution: {integrity: sha512-Y85A2gmPSkl5Ve5qR86GL4HT509cFqQh1aes9p3sSkyTPwt0Pppf3GkwGe4JPACcRYjgJIEhQgM6dBClnr0NYw==}+ engines: {node: '>= 20'}+ cpu: [arm64]+ os: [android]++ '@tailwindcss/[email protected]':+ resolution: {integrity: sha512-BiaWatpBcERQFDlOjRDpIVXuFK5PJez5SA4JMg6VYZdBYU+qKfV/vqjcIs+IYmtitf1xYQZTwXvU/8y4lfZUGw==}+ engines: {node: '>= 20'}+ cpu: [arm64]+ os: [darwin]++ '@tailwindcss/[email protected]':+ resolution: {integrity: sha512-fAeUqfV5ndhxRwai8cXGzdLvul9utWOmeTkv69unv4ZXixjn61Z+p9lCWdwOwA3TYboG3BwdVuN/RDjhBRl0mw==}+ engines: {node: '>= 20'}+ cpu: [x64]+ os: [darwin]++ '@tailwindcss/[email protected]':+ resolution: {integrity: sha512-iyf5bV6+wnAlflVeEy7R25dupxTNECZN5QMI0qNT6eT+EgaGdZcKhGkr5SdoaWiLJ3spLqIY9VCeSGrwmtg4kw==}+ engines: {node: '>= 20'}+ cpu: [x64]+ os: [freebsd]++ '@tailwindcss/[email protected]':+ resolution: {integrity: sha512-aAYUprJAJQWWbRrPvtjdroZ56Md+JM8pMiopS6xGEwDfLhqj+2ver2p4nU4Mb3CRqcMmNBjo8KkUgcxhkzVQGQ==}+ engines: {node: '>= 20'}+ cpu: [arm]+ os: [linux]++ '@tailwindcss/[email protected]':+ resolution: {integrity: sha512-nDxldcEENOxZRzC2uu9jrutZdAAQtb+8WWDCSnWL1zvBk1+FN+x6MtDViPB5AJMfttVCUhehGWus3XBPgatM/w==}+ engines: {node: '>= 20'}+ cpu: [arm64]+ os: [linux]+ libc: [glibc]++ '@tailwindcss/[email protected]':+ resolution: {integrity: sha512-Md44bD6veX/PC5iyF8cDVnw4HBIANZepRZZ7a8DQOvkfo5WUBwcp6iAuCUz23u+4SUkhJlD3eL7hNdW8ezd/kA==}+ engines: {node: '>= 20'}+ cpu: [arm64]+ os: [linux]+ libc: [musl]++ '@tailwindcss/[email protected]':+ resolution: {integrity: sha512-tx7us1muwOKAKWao2v/GaafFeQboE6aj88vC6ziN2NCGcRm8gWUhwjzg+YdVB1e4boAtdtma4L43onunI6NS4w==}+ engines: {node: '>= 20'}+ cpu: [x64]+ os: [linux]+ libc: [glibc]++ '@tailwindcss/[email protected]':+ resolution: {integrity: sha512-SJxX60smvHgasZoBy11dX6YRjXJFovwWBoedhbQPOBzgFWBHGB+TVPWB9BxzR7TTxU8FQZAI2AyiNCMzFm8Img==}+ engines: {node: '>= 20'}+ cpu: [x64]+ os: [linux]+ libc: [musl]++ '@tailwindcss/[email protected]':+ resolution: {integrity: sha512-jx1+rPhY/5Ympkktd656HBWEBLxP7dH06losBLjjf5vgCODXvi9KhtftWcMIwTFIDqBr7cRnQkdLnAG+IOlGvQ==}+ engines: {node: '>=14.0.0'}+ cpu: [wasm32]+ bundledDependencies:+ - '@napi-rs/wasm-runtime'+ - '@emnapi/core'+ - '@emnapi/runtime'+ - '@tybys/wasm-util'+ - '@emnapi/wasi-threads'+ - tslib++ '@tailwindcss/[email protected]':+ resolution: {integrity: sha512-3rc292Ca2ceK6Ulcc/bAVnTs/3nDtoPhyEKlgPv+yQJQi/JS/AMJlqzxvlDacL1nekbrcf6bTqp/jV4qgnPxNQ==}+ engines: {node: '>= 20'}+ cpu: [arm64]+ os: [win32]++ '@tailwindcss/[email protected]':+ resolution: {integrity: sha512-yJ0pwIVc/nYeGoV02WtsN8KYyLQv7kyI2wDnkezyJlGGjkd4QLwDGAwl47YpPJeuI0M0ObaXGSPjvWDPeTPggw==}+ engines: {node: '>= 20'}+ cpu: [x64]+ os: [win32]++ '@tailwindcss/[email protected]':+ resolution: {integrity: sha512-krXjAikiaFSPaK/FkAQT5UTx3VormQaiZ5hBFlJZ9UFQGB/rwg1MZIhHAG9smMQRTdyJxP6Qt5MwMtdyU5FWrA==}+ engines: {node: '>= 20'}++ '@tailwindcss/[email protected]':+ resolution: {integrity: sha512-yYU8cogLeSh/ms2jh8Fj7jaba/EWa7Ja6GoUqYZaraEuCI5YS6ms6ObZgjjedm+jm6XZjdNRWBpPP6Z86oOxcw==}+ peerDependencies:+ vite: ^5.2.0 || ^6 || ^7 || ^8++ '@tanstack/[email protected]':+ resolution: {integrity: sha512-utTS5L2OkeYUzXGohL1Z8sefu1GLNOJcxe8Hd6iIdc/Xo1K1nDB2JEp4iSFhvYh33xKC9V91TxrS8qfrpoKobQ==}+ engines: {node: '>=20.19'}++ '@tanstack/[email protected]':+ resolution: {integrity: sha512-Mpvw8Wm5MGDbTqI8Yc9flLKxbOHwoWocv0H2aGKcgw2a017oK5nZWqa954P+DrUx/8fI98YNywnHP5XcD3tQ9w==}+ engines: {node: '>=20.19'}+ peerDependencies:+ react: '>=18.0.0 || >=19.0.0'+ react-dom: '>=18.0.0 || >=19.0.0'++ '@tanstack/[email protected]':+ resolution: {integrity: sha512-oj5O5DmiMWE+ih+SioX2ayC1kbK7d3fpLx0B75fPJr9nY3zU+hoW010yr64qXsY/9fyiLVE2bn5mGNV3owm8RQ==}+ peerDependencies:+ react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0+ react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0++ '@tanstack/[email protected]':+ resolution: {integrity: sha512-JbDTAwtzZ99aOeCrAfW5EsE5KSq5RWh6Af2dtFwyLIIk48Ja7vm6n4axu/43T3vfjFnEGJalxJ1wyYjSQD6bSg==}+ peerDependencies:+ react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0+ react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0++ '@tanstack/[email protected]':+ resolution: {integrity: sha512-X+19pGuuLVPvvAvPYw9v/+ktRk5cCll8AtfpBpOhDRmVgUMrfqze0467xtq8YRVVs/mmo5rVtWn/7Tp32RDBKw==}+ engines: {node: '>=20.19'}++ '@tanstack/[email protected]':+ resolution: {integrity: sha512-WkEueqEvsBBudzO0fx1nWfOmRNW8OAvBoVABTGls9bAWzjdC+KDGHvjCNrvn88ofs1F6gqL8aWnzKCbxW3dCyQ==}+ engines: {node: '>=20.19'}++ '@tanstack/[email protected]':+ resolution: {integrity: sha512-vAR5WXJh/ErseEWQftDhsJcr2c++ucRQ6FbqN3ygMO44+ZxxRfW3sIpZmddHROVSmBk8jc6MrwjTPNjVhd62Vw==}+ engines: {node: '>=20.19'}+ peerDependencies:+ '@rsbuild/core': '>=1.0.2 || ^2.0.0'+ '@tanstack/react-router': ^1.170.41+ vite: '>=5.0.0 || >=6.0.0 || >=7.0.0 || >=8.0.0'+ vite-plugin-solid: ^2.11.10 || ^3.0.0-0+ webpack: '>=5.92.0'+ peerDependenciesMeta:+ '@rsbuild/core':+ optional: true+ '@tanstack/react-router':+ optional: true+ vite:+ optional: true+ vite-plugin-solid:+ optional: true+ webpack:+ optional: true++ '@tanstack/[email protected]':+ resolution: {integrity: sha512-Icb0xGuG1+54IV0WMLRcc3ErTx2HeJWyPG661FkQ8UT6guoBq1FJjFRqlG/JS0xi4mFFkBhvwO7tbLa32f3yxA==}+ engines: {node: '>=20.19'}++ '@tanstack/[email protected]':+ resolution: {integrity: sha512-sJ4mjol8uQsHV0gOJzzjwXfh2Fwm+Sz0+8deqiTm4jGbMdjzNSW+xZCFm0kUa870uhd8yi+DpKnZb5Kc4apa0Q==}++ '@tanstack/[email protected]':+ resolution: {integrity: sha512-+ILjvtHup6Y2hzQ6YzwMgX1Q+oQpxEGOXCEsCNaPoIP0VxMbizIBTmYTDtkerkIQS8/CbP1BRuyt8V/8BCsy1g==}++ '@tanstack/[email protected]':+ resolution: {integrity: sha512-uhOeFyxLcU41HzvrxsGpiWdcMbScY1EDgbZ5K7DVRMYInbLYWAC0EA/kx9wXAoSM8q82bUG2hRl8+EAjE6XAbA==}+ engines: {node: '>=20.19'}++ '@tauri-apps/[email protected]':+ resolution: {integrity: sha512-fUSxFX8VABYe9W9K5ROdEaKVkNUFRcMSRofjruvaxztXA+I0XnQHcYHF8m/a6iExRUxsUf0HsFWhPBuH9IgzJw==}++ '@tauri-apps/[email protected]':+ resolution: {integrity: sha512-v5J+jISihLGtih1+3yWagbsL+5dbLZORu4vaSI0vhY0Heb+MAW+T/1s1RyKxrQrwEPGBG5kqwfDDTnSbmVkuqA==}+ engines: {node: '>= 10'}+ cpu: [arm64]+ os: [darwin]++ '@tauri-apps/[email protected]':+ resolution: {integrity: sha512-g27I07pfW/dMS8vcNqB9lamgKF0TqLlcy8e7t9qDGsB1iaeyjJWb2TgBF4tM9ZwLqPAZUXbsz28oXljO12WC4g==}+ engines: {node: '>= 10'}+ cpu: [x64]+ os: [darwin]++ '@tauri-apps/[email protected]':+ resolution: {integrity: sha512-gXyQ710fNc99YuxFxNyeX9PLSrIpbtgBBj7GQo9tSeRT6fIK40q3/gm7X5jqZo7mWLR2m0R/2ALd3vAWo0Z32Q==}+ engines: {node: '>= 10'}+ cpu: [arm]+ os: [linux]++ '@tauri-apps/[email protected]':+ resolution: {integrity: sha512-H9cyXuq9WgxoHh2NZ+R+oN+W78x5UwaBDEp0/fmqUUkaBoioCuOZErM9xKiIV6bpNAhmw1RoWZ49u37q/vaiAg==}+ engines: {node: '>= 10'}+ cpu: [arm64]+ os: [linux]+ libc: [glibc]++ '@tauri-apps/[email protected]':+ resolution: {integrity: sha512-5tFuk3JKMBa1M/iN4gN32OYlSfhY3aqb5PO3zCugxaT+sfecyMKpc3EM9VDbhmwWBE9QD4Tfj7wGhlqx2yy2pQ==}+ engines: {node: '>= 10'}+ cpu: [arm64]+ os: [linux]+ libc: [musl]++ '@tauri-apps/[email protected]':+ resolution: {integrity: sha512-LOrMyV+nb7pKq8P0BZtTBQuyzm1ORjn16R9MlupmxuT5LqxtuYJlw3VMwbaeXCToJ8jbP5u9JnkfmbqDlvETXw==}+ engines: {node: '>= 10'}+ cpu: [riscv64]+ os: [linux]+ libc: [glibc]++ '@tauri-apps/[email protected]':+ resolution: {integrity: sha512-aMIkI+X9qvD2+k80QZB3tuOYT41/cEheikC510CwAIZ31KLXORsRASYYzM4mi1/58ICmtzSLFhCC08keir7COw==}+ engines: {node: '>= 10'}+ cpu: [x64]+ os: [linux]+ libc: [glibc]++ '@tauri-apps/[email protected]':+ resolution: {integrity: sha512-9gl3NhUbfuGhSKjeGCypKSdtoezOQRcDUrkhTWtLQEjnajets6peO6NadgI2DF0OzbiiFOzrnnIGMwBS+Ap6Iw==}+ engines: {node: '>= 10'}+ cpu: [x64]+ os: [linux]+ libc: [musl]++ '@tauri-apps/[email protected]':+ resolution: {integrity: sha512-1W+v86wsYLuyBDN0iDessD4CD9o+yNyO0m8Dp3+/vfjiZrJ/v7R7/aTRBeikaq2tLGgxeag0gxnFggBNBGw91A==}+ engines: {node: '>= 10'}+ cpu: [arm64]+ os: [win32]++ '@tauri-apps/[email protected]':+ resolution: {integrity: sha512-SsBjvq4f7YaBGqcWoE3cycoItPf0SrQeqFqWWgfxoeZWAIz01E31LDSeZ2p/etJiIY0R9oi045chkFfb0O7WGw==}+ engines: {node: '>= 10'}+ cpu: [ia32]+ os: [win32]++ '@tauri-apps/[email protected]':+ resolution: {integrity: sha512-9zzDKYUH4TKKBgRdDdVQX8fiRO5gJ8hD1nGsHU9DOHG5Jpm3arjbu9Xg1frR20EusG3Sl8X0dppoO/4EoUXUGg==}+ engines: {node: '>= 10'}+ cpu: [x64]+ os: [win32]++ '@tauri-apps/[email protected]':+ resolution: {integrity: sha512-GIShnAR4C16kSTA8NO02fo8fOw/I5z5sAUEB5S2HlPHFnBkbihL4c9a/MpkxOm1+q5S+tFd3X4QUjHWxfyGzpQ==}+ engines: {node: '>= 10'}+ hasBin: true++ '@tauri-apps/[email protected]':+ resolution: {integrity: sha512-HSSD5C8UFE9ijD1wue84F7jjaIReFmj8AAPtS+xyjYRltJafIc4BiWHY7SJ6vbbew6u+YljEJHfyNfy5VwywXg==}++ '@testing-library/[email protected]':+ resolution: {integrity: sha512-yzr2S9HyAIdhz2/6qHgbs665Q7PKVcDF05vsOlHPxG1mo36gKVesdYVeDLnXgfjJ03CrKRk08knc6+E/9m8v2Q==}+ engines: {node: '>=18'}++ '@testing-library/[email protected]':+ resolution: {integrity: sha512-Uo193NgQbPMz6lrrhtRQQFcMC6Re/ELLFbbuVL30WDlZxlpZf9/lMHTAVxPRLw1q1iu9OJmR1c2BLiENRstdBg==}+ engines: {node: '>=18'}+ peerDependencies:+ '@testing-library/dom': ^10.0.0+ '@types/react': ^18.0.0 || ^19.0.0+ '@types/react-dom': ^18.0.0 || ^19.0.0+ react: ^18.0.0 || ^19.0.0+ react-dom: ^18.0.0 || ^19.0.0+ peerDependenciesMeta:+ '@types/react':+ optional: true+ '@types/react-dom':+ optional: true++ '@types/[email protected]':+ resolution: {integrity: sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==}++ '@types/[email protected]':+ resolution: {integrity: sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==}++ '@types/[email protected]':+ resolution: {integrity: sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==}++ '@types/[email protected]':+ resolution: {integrity: sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==}++ '@types/[email protected]':+ resolution: {integrity: sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==}++ '@types/[email protected]':+ resolution: {integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==}++ '@types/[email protected]':+ resolution: {integrity: sha512-KSVgmQmzMwPlmtljOomayoR89W4FynCAi3E8PPs7vmDVPe84hT+vGPKkJfThkmXs0x0jAaa9U8uW8bbfyS2fWw==}++ '@types/[email protected]':+ resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==}++ '@types/[email protected]':+ resolution: {integrity: sha512-xJBAbDifo5hpffDBuHl0Y8ywswbiAp/Wi7Y/GtAgSlZyIABppyurxVueOPE8LUQOxdlgi6Zqce7uoEpqNTeiUw==}++ '@types/[email protected]':+ resolution: {integrity: sha512-52CcUVNFyfb1A2ALocQw/Dd1BQFNmSdkuC3BkZ6iqhdMfQz7JWOFRuJFloOzjk+6WijU56m9oKXFAXc7o3Towg==}++ '@types/[email protected]':+ resolution: {integrity: sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==}++ '@types/[email protected]':+ resolution: {integrity: sha512-rp/ezSWaD1m44dPKICGhiskI13nVr7qTloFwDa/IYkhhf5nzwP+zIQcIJh3WIFSBOy/H1PzB40jPjMDksN4F+g==}++ '@types/[email protected]':+ resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}++ '@types/[email protected]':+ resolution: {integrity: sha512-trgaNyfU+Xh2Tc+ABIb44a5AYUpicB3uwirOioeOkNPPbmgRNtcWyDeeFRzjPZENO9Vq8gvVqfhaaXWLlevVwg==}++ '@types/[email protected]':+ resolution: {integrity: sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==}++ '@types/[email protected]':+ resolution: {integrity: sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==}++ '@types/[email protected]':+ resolution: {integrity: sha512-6oYBAi5ikg4Pl+kGsoYtawUMBT2zZMCvPNF7pVLnHZfd1zf38DRiWn/gT01RYCdUqkv7Fhr+C9ot4/tb+2sVvA==}++ '@types/[email protected]':+ resolution: {integrity: sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw==}++ '@types/[email protected]':+ resolution: {integrity: sha512-MEe3UeoENYVFXzoXEWsvcpg6ZvlrFNlOQ7EOsvhI3CfAXwzPfO8Qwuxd40nepsYKqyyVQnTdEfv68q91yLcKrQ==}+ peerDependencies:+ '@types/react': ^18.0.0++ '@types/[email protected]':+ resolution: {integrity: sha512-vfEqpXTvwT91yhmwdfouStN2hSKwTvyRs8qpLfADyrq/kxDw0hZM7Wk9Ug1FELj8hIby+S/+kQCSRFF32nv2Qw==}++ '@types/[email protected]':+ resolution: {integrity: sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==}++ '@types/[email protected]':+ resolution: {integrity: sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==}++ '@typescript-eslint/[email protected]':+ resolution: {integrity: sha512-pqcS9c1HxZTHt7End4nXqd0s5lJrrFzrgCkKFJrsbUnaL6M3+6oBFZaslg6Gjsl3argl2DDRFROnXARaZ2e4Nw==}+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}+ peerDependencies:+ '@typescript-eslint/parser': ^8.71.0+ eslint: ^8.57.0 || ^9.0.0 || ^10.0.0+ typescript: '>=4.8.4 <6.1.0'++ '@typescript-eslint/[email protected]':+ resolution: {integrity: sha512-CG4nPk1f2zc8yw4pALqHsFYH2hdo+h1T9daSp21+Hnxi9LOE3GT9hAfTKJCBXVNM2GmYs1eMEP615wPoeOgk3A==}+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}+ peerDependencies:+ eslint: ^8.57.0 || ^9.0.0 || ^10.0.0+ typescript: '>=4.8.4 <6.1.0'++ '@typescript-eslint/[email protected]':+ resolution: {integrity: sha512-aABjw5rjBacYONVPaPiWOCjJu0vEF4a25iQuodlmQYL1trtLZ0X/y+2Vzl3BKI1odM4LnwLE1oUDXYp1wzx1TQ==}+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}+ peerDependencies:+ typescript: '>=4.8.4 <6.1.0'++ '@typescript-eslint/[email protected]':+ resolution: {integrity: sha512-gWF0BhUcnjZxSpLE8ngS/59n2SB0J3YqRxvX1+2aoRJk9hNtHSLOV+TcarFiOr5ipXm3yc1QrI4c9YZc8zyCxw==}+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}++ '@typescript-eslint/[email protected]':+ resolution: {integrity: sha512-Z1UlWHADEK2Mlb9NpWfDeSjqoZ5EyrOv4R3eQpbkzqn/EwaIdOpXXupEA1+0ZIOSJSZZDBHG0BrQyN8zUG6Pwg==}+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}+ peerDependencies:+ typescript: '>=4.8.4 <6.1.0'++ '@typescript-eslint/[email protected]':+ resolution: {integrity: sha512-i8uO1qbdxeKgRnS5sCRt6On3/nfo2d2DwQe3Yvjx543zLy7r8ySqRuPPiIIXAhS03U0v5NfAFx+rUgxFzKKwNw==}+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}+ peerDependencies:+ eslint: ^8.57.0 || ^9.0.0 || ^10.0.0+ typescript: '>=4.8.4 <6.1.0'++ '@typescript-eslint/[email protected]':+ resolution: {integrity: sha512-cJ4OoxPGWvFnBTnSZyaU+qJzGTqPTGJY+gDchj6cRyLRdmIdt4rcsE4twj+zPfrNiWuVi38wijHzShL++Z9atQ==}+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}++ '@typescript-eslint/[email protected]':+ resolution: {integrity: sha512-PEEF4G5sLLWAS5BpPrUvms4ySZkiBQQZM4z+3ReI46axK5Vqr/vXBQatJQIZZOYdGyPUAKTtsrWzpqKuU+3DEw==}+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}+ peerDependencies:+ typescript: '>=4.8.4 <6.1.0'++ '@typescript-eslint/[email protected]':+ resolution: {integrity: sha512-pKR/tEMVrXZG23UFKUn5BQf3zfmfk7KQceI2cGzywZ5nxM5Eu3hEJU1utjWzydtzBbcJAQhHN8iPCxobHpPcZQ==}+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}+ peerDependencies:+ eslint: ^8.57.0 || ^9.0.0 || ^10.0.0+ typescript: '>=4.8.4 <6.1.0'++ '@typescript-eslint/[email protected]':+ resolution: {integrity: sha512-8eQ9R218XORK+KLosnf4bu/QsUXvUyVwTbArg7/0NMB1Pu87OJKvj4nhFblkYE8gQV73mW1dx1ptlPCkwRGa7A==}+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}++ '@ungap/[email protected]':+ resolution: {integrity: sha512-1mEZtMKPM09vDmQt5y7YvmN2+DFTP7Tg0EWXdic8/C6VRnpb33e4ghisCIE3WZjsE2N8mf+QV1Zqh7ZFYLWInQ==}++ '@vitejs/[email protected]':+ resolution: {integrity: sha512-gUu9hwfWvvEDBBmgtAowQCojwZmJ5mcLn3aufeCsitijs3+f2NsrPtlAWIR6OPiqljl96GVCUbLe0HyqIpVaoA==}+ engines: {node: ^14.18.0 || >=16.0.0}+ peerDependencies:+ vite: ^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0++ '@vitest/[email protected]':+ resolution: {integrity: sha512-E8eBXaKibuvH2pSZErOjdVb5vF4PbKYcrnluBTYxEk1l/VhhwZg1kZQsdtjq+CsF5CFydf2Rdkz7jDHKSisi3w==}++ '@vitest/[email protected]':+ resolution: {integrity: sha512-Trr0hYO9CM3Wj6ksWHRhK9IZpIY6wTMO5u/MqXurMxT57sWBaOPEtP3Oq60ihZuh5JsiagKfz95OcxdEP6dBrA==}+ peerDependencies:+ msw: ^2.4.9+ vite: ^5.0.0 || ^6.0.0 || ^7.0.0-0+ peerDependenciesMeta:+ msw:+ optional: true+ vite:+ optional: true++ '@vitest/[email protected]':+ resolution: {integrity: sha512-KUHlwqVu0sRlhCdyPdQ/wBoTfRahjUky1MubOmYw9fWfIZy1gNoHpuaaQBPAaMaVYdQYHJLurzj8ECCj5OwTqA==}++ '@vitest/[email protected]':+ resolution: {integrity: sha512-sB9y4ovltoQP+WaUPwmSxO9WIg9Ig694Di5PalVPsYHklAdE027mehpWF2SQSVq+k6sFgaivbTjTJwZLSHbedA==}++ '@vitest/[email protected]':+ resolution: {integrity: sha512-7C+MwShwtBSI5Buwoyg3s/iY1eHL9PKAf+O1wVh/TdnjXUtkoL/9YQtre90i4MtNXM6edP1wJ2zOBpfCyhIS7g==}++ '@vitest/[email protected]':+ resolution: {integrity: sha512-Q2eQGI6d2L/hBtZ0qNuKcAGid68XK6cv1xsoaIma6PaJhHPoqcEJhYpXZ/5myCMqkNgtP6UKuBhbc0nHKnrkuQ==}++ '@vitest/[email protected]':+ resolution: {integrity: sha512-x6BDOd7dyo3PFLY3I9/HJ25X/6OurhGXk2/B9gOZNPF7XDVjeBK4k01lQE5uvDpbuheErh91qYuE1E2OEjK3Rw==}++ resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==}+ peerDependencies:+ acorn: ^6.0.0 || ^7.0.0 || ^8.0.0++ resolution: {integrity: sha512-lGq+9yr1/GuAWaVYIHRjvvySG5/4VfKIvC8EWxStPdcDh/Ka7FG3twP6v4d5BkravUilhIAsG4Qj83t02LWUPQ==}+ engines: {node: '>=0.4.0'}+ hasBin: true++ resolution: {integrity: sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==}+ engines: {node: '>= 14'}++ resolution: {integrity: sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==}++ resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==}+ engines: {node: '>=8'}++ resolution: {integrity: sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==}+ engines: {node: '>=10'}++ resolution: {integrity: sha512-9k3v7xcHwgdO/DruxGIg4HtjvlAZlcnsX/mzqUb1t3NkYnl9kK2UJ+Gq0io+vQf7iT//BD/HB/NBkUR1LWxoeA==}+ engines: {node: '>=14'}++ resolution: {integrity: sha512-ik3ZgC9dY/lYVVM++OISsaYDeg1tb0VtP5uL3ouh1koGOaUMDPpbFIei4JkFimWUFPn90sbMNMXQAIVOlnYKJA==}+ engines: {node: '>=10'}++ resolution: {integrity: sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==}++ resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==}+ engines: {node: '>=12'}++ resolution: {integrity: sha512-GERT7L2TiYcYDtYk1IpD+ASAYXjKbLTDPhBtYj7X1NuRMDTMtAx9kyBenub1Ev41lo91OHCKdmP+egTDmfQ7Ig==}++ resolution: {integrity: sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==}++ resolution: {integrity: sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==}+ engines: {node: 18 || 20 || >=22}++ resolution: {integrity: sha512-GLQdD3y6UF8iVuMJl5fHgE4jdn/ua7n+toKfLgNlg3BqQtOZjpy68T8Tup8/wGWZCDlm7KMg7tPb4MPn7oN0TQ==}+ engines: {node: '>=6.0.0'}+ hasBin: true++ resolution: {integrity: sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ==}+ engines: {node: 20 || >=22}++ resolution: {integrity: sha512-1R4kiYKXGViqEN0CnoDrXc1StD9niAwu+j2dukWzrD4bJgsD4lDmEp0CRbc6E/vYJIfTHwPmwyaKtVSudICdPA==}+ engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}+ hasBin: true++ resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==}+ engines: {node: '>=8'}++ resolution: {integrity: sha512-60cyAOytib/OzBw1JNSoSV/boK1AtHryDIjvVBk7XbN4ugfkM3+Sry7fEjNgPMGgOjuaZPAp8ruZ0Cxafwyq9g==}++ resolution: {integrity: sha512-/Uaf1lAzr59XcMpW0o96WoEfr+VXK2OX4U9AgFoiSHsVJ4HppnIFUjtYzsyDH2+tgANaQb2/oxYGwCPapN1FpA==}++ resolution: {integrity: sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==}++ resolution: {integrity: sha512-4zNhdJD/iOjSH0A05ea+Ke6MU5mmpQcbQsSOkgdaUMJ9zTlDTD/GYlwohmIE2u0gaxHYiVHEn1Fw9mZ/ktJWgw==}+ engines: {node: '>=18'}++ resolution: {integrity: sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==}++ resolution: {integrity: sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==}++ resolution: {integrity: sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==}++ resolution: {integrity: sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw==}++ resolution: {integrity: sha512-PAJdDJusoxnwm1VwW07VWwUN1sl7smmC3OKggvndJFadxxDRyFJBX/ggnu/KE4kQAB7a3Dp8f/YXC1FlUprWmA==}+ engines: {node: '>= 16'}++ resolution: {integrity: sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw==}+ engines: {node: '>= 20.19.0'}++ resolution: {integrity: sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==}+ engines: {node: '>=6'}++ resolution: {integrity: sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==}++ resolution: {integrity: sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==}+ engines: {node: '>= 12'}++ resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==}++ resolution: {integrity: sha512-UaXxwISYJPTr9hwQxMFYZ7kNhSXboMXP+Z3TRX6f1/NyaGPfuNUZOWP1pUEb75B2HjfklIYLVRfWiFZJyC6Npg==}++ resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==}++ resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==}+ engines: {node: '>= 8'}++ resolution: {integrity: sha512-2z+rWdzbbSZv6/rhtvzvqeZQHrBaqgogqt85sqFNbabZOuFbCVFb8kPeEtZjiKkbrm395irpNKiYeFeLiQnFPg==}+ engines: {node: '>=18'}++ resolution: {integrity: sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==}++ resolution: {integrity: sha512-ZYP5VBHshaDAiVZxjbRVcFJpc+4xGgT0bK3vzy1HLN8jTO975HEbuYzZJcHoQEY5K1a0z8YayJkyVETa08eNTg==}+ engines: {node: '>=18'}++ resolution: {integrity: sha512-+1UMbeh68lH1SegH83CGWwpb6OHHbpSgr3+s5Eww5M4CAgswBpoWS0AjTOfEJ33HiYKz1hdj/KTFprzXHmq/6w==}++ resolution: {integrity: sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==}+ engines: {node: '>=6.0'}+ peerDependencies:+ supports-color: '*'+ peerDependenciesMeta:+ supports-color:+ optional: true++ resolution: {integrity: sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==}++ resolution: {integrity: sha512-GtpQYB283KrPp6nRw50q3U9/VfOutZOe103qlN7BPP6Ad27xYnOIWv4lPzo8HCAL+mMZofJ9KEy30fq6MfaK6Q==}++ resolution: {integrity: sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==}+ engines: {node: '>=6'}++ resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==}++ resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==}+ engines: {node: '>=6'}++ resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==}+ engines: {node: '>=8'}++ resolution: {integrity: sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==}++ resolution: {integrity: sha512-DPi0FmjiSU5EvQV0++GFDOJ9ASQUVFh5kD+OzOnYdi7n3Wpm9hWWGfB/O2blfHcMVTL5WkQXSnRiK9makhrcnw==}+ engines: {node: '>=0.3.1'}++ resolution: {integrity: sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==}++ resolution: {integrity: sha512-TDJG36L9A3CWWwZ97HKaE+Iz1sW80pNp6sAU0owzCIV3Zc9eVyRqZK8Vz6NKuMIU8WjP0pIkoqCa0VRf/yFD0Q==}++ resolution: {integrity: sha512-9vhedylFonb2YGogzUKX6+Ja72gOJbN1QHAqdrvqLwhdl/QWbKopzoUC9EbQNVsAns/bx/4uyqalrQAoy1IByw==}+ engines: {node: '>=10.13.0'}++ resolution: {integrity: sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==}+ engines: {node: '>=0.12'}++ resolution: {integrity: sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==}++ resolution: {integrity: sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==}+ engines: {node: '>=12'}+ hasBin: true++ resolution: {integrity: sha512-CRbODhYyQx3qp7ZEwzxOk4JBqmD/seJrzPa/cGjY1VtIn5E09Oi9/dB4JwctnfZ8Q8iT7rioVv5k/FNT/uf54g==}+ engines: {node: '>=18'}+ hasBin: true++ resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==}+ engines: {node: '>=6'}++ resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==}+ engines: {node: '>=10'}++ resolution: {integrity: sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==}+ engines: {node: '>=12'}++ resolution: {integrity: sha512-f2I7Gw6JbvCexzIInuSbZpfdQ44D7iqdWX01FKLvrPgqxoE7oMj8clOfto8U6vYiz4yd5oKu39rRSVOe1zRu0g==}+ engines: {node: '>=18'}+ peerDependencies:+ eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0 || ^10.0.0++ resolution: {integrity: sha512-xS90H51cKw0jltxmvmHy2Iai1LIqrfbw57b79w/J7MfvDfkIkFZ+kj6zC3BjtUwh150HsSSdxXZcsuv72miDFQ==}+ engines: {node: ^20.19.0 || ^22.13.0 || >=24}++ resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==}+ engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}++ resolution: {integrity: sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==}+ engines: {node: ^20.19.0 || ^22.13.0 || >=24}++ resolution: {integrity: sha512-P7a6UEEqb9G95MYAtqkmsTbVXIYyzIfl6NGOIJk162PaahFxFyeGcrlXYFSiagECg4sEm8IseJdZBKR3rx6MsQ==}+ engines: {node: ^20.19.0 || ^22.13.0 || >=24}+ hasBin: true+ peerDependencies:+ jiti: '*'+ peerDependenciesMeta:+ jiti:+ optional: true++ resolution: {integrity: sha512-7p3DrVEIopW1B1avAGLuCSh1jubc01H2JHc8B4qqGblmg5gI9yumBgACjWo4JlIc04ufug4xJ3SQI8HkS/Rgzw==}+ engines: {node: ^20.19.0 || ^22.13.0 || >=24}++ resolution: {integrity: sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==}+ engines: {node: '>=0.10'}++ resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==}+ engines: {node: '>=4.0'}++ resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==}+ engines: {node: '>=4.0'}++ resolution: {integrity: sha512-hFtqIDZTIUZ9BXLb8y4pYGyk6+wekIivNVTcmvk8NoOh+VeRn5y6cEHzbURrWbfp1fIqdVipilzj+lfaadNZmg==}++ resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==}++ resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==}+ engines: {node: '>=0.10.0'}++ resolution: {integrity: sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==}+ engines: {node: '>=12.0.0'}++ resolution: {integrity: sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==}++ resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==}++ resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==}++ resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==}++ resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==}+ engines: {node: '>=12.0.0'}+ peerDependencies:+ picomatch: ^3 || ^4+ peerDependenciesMeta:+ picomatch:+ optional: true++ resolution: {integrity: sha512-+PFTHITI08JIGhnNpGNI8T8inUpgZfk3GNEqfT9R2zZV2iFXg3CvqzSl/uEhs7TSGujYRELEANyDvS8Fj7+S7Q==}++ resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==}+ engines: {node: '>=10'}++ resolution: {integrity: sha512-f++BY9pTk+983xK1FLzlLpmM0i0z+jHmx3QESGkURMXujQZz1k5wzwX6hjnQ8goaD0B+sYnDK1yZ6MTyZfUaqA==}++ resolution: {integrity: sha512-5+ybhBZANEJxaH3X5evAFatUxLfEHSr7n6kYJ+1Qd0mUqr4eu9gIf6GDbWHf8RJijHrjjO8G+la14SlL2SeS1Q==}++ resolution: {integrity: sha512-1eaL3RvR/kAlbG7UYcpMptEyzPoENO0c6w7ZnB3/hh2vSAz/6uGAFn6fdoqTBguNstf3MsFhJHsD/0DHiclG+g==}+ peerDependencies:+ '@emotion/is-prop-valid': '*'+ react: ^18.0.0 || ^19.0.0+ react-dom: ^18.0.0 || ^19.0.0+ peerDependenciesMeta:+ '@emotion/is-prop-valid':+ optional: true+ react:+ optional: true+ react-dom:+ optional: true++ resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==}+ engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}+ os: [darwin]++ resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==}+ engines: {node: '>=6.9.0'}++ resolution: {integrity: sha512-XjH1AECxf0giL2V1aU8vKyRR2ppRUb5c0EvT7zuJTokQ74bNo52zOtghqdWIqrhUD79fo3x0WfKZdOqxF6LG1Q==}+ engines: {node: '>=18'}++ resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==}+ engines: {node: '>=10.13.0'}++ resolution: {integrity: sha512-U7veizMqxyKlM58+Z5j2ngJBH/r9siDmxpvNxSw0PylF6WQvrASJEZrxh1hidRBJc2jqoBVSyOban5u8m+6Rxg==}+ peerDependencies:+ csstype: ^3.0.10++ resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==}++ resolution: {integrity: sha512-iZyKG96/JwPz1N55vj2Ie2vXbhu440zfUfJvSwEqEbeLluk7NnapfGqa7LH0mOsnDxTF85Mx8/dyR6HfqcbmbQ==}+ engines: {node: '>=20'}++ resolution: {integrity: sha512-N+LqofjR2zuzTjCPzyDUdSshy4Ma6li7p/c3pA78uTwzFgENbgbUrm2ugwsOdcjI1muO+o6Dgzp9p8WHtn/39Q==}++ resolution: {integrity: sha512-zJfpXq44yff2hmE0XmwEOzdWin5xwH+QIhMLOScpX91e/NSGPsAzNCvLQDIEPyO2TXi+lBmU6hjLIhV8MwP2kw==}++ resolution: {integrity: sha512-CUSRHXyKjzHov8yKsQjGOElXy/3EKpyX56ELnkHH34vDVw1N1XSQ1ZcAvTyAPtGqLTuKP/uxM+aLkSPqF/EtMw==}++ resolution: {integrity: sha512-3kxEVkEKt0zvcZ3hCRYI8rqrgwtlIOFMWkbclACvjlDw8Li9S2hk/d51OI0nr/gIpdMHNepwgOKqZ/sy0Clpyg==}++ resolution: {integrity: sha512-Val9mnv2IWpLbNPqc/pUem+a7Ipj2aHacCwgNfTiK0vJKl0LF+4Ba4+v1oPHFpf3bLYmreq0/l3Gud9S5OH42g==}++ resolution: {integrity: sha512-wkQCkSYoOGCRKERFWcxMVMOcYE2K1AaNLU8DXS9arxnLOUEWbOXKXiJUNzEpqZ3JOKpnha3jkFrumEjVliDe7A==}++ resolution: {integrity: sha512-Y8/SBAHkZGoNkpzqqfCldijcuUKh7/su31kEBp67cFY09Wy0mTRgtsLYsiIxMJxlu0f6AA5SUTbDR8K0rxnbUw==}++ resolution: {integrity: sha512-3yTWghByc50aGS7JlGhk61SPenfE/p1oaFeNwkOOyrscaOkMGrcW9+Cy/QAIOBpZxP1yqDIzFMR0+Np0i0+usg==}++ resolution: {integrity: sha512-OguPdidb+fbHQSU4Q4ZiLKnzWo8Wwsf5bZfbvu7//a9oTYoqD/fWpe96NuHkoS9h0ccGOTe0C4NGXdtS0iObOw==}++ resolution: {integrity: sha512-zl6s8LwNyo1P9uw+XJGvZtdFF1GdAkOg8ujOw+4Pyb76874fLps4ueHXDhXWdk6YHQ6OgUtinliG7RsYvCbbBg==}++ resolution: {integrity: sha512-MlWT6Pjt4CG9lFCjiz4BH7l9wmrMkfkJYCxFwKQic8+RTZgWPuWxwAfjJElsXkex7DJjfSJsQIt931ilUgmwdA==}++ resolution: {integrity: sha512-KK6y/BN8lbaq654j7JgBydev7wuNMcID54lkRav1P0CaE1e47P72AWWPiGKXTJU271ooYzcvTAn/Zt0REnvc7A==}++ resolution: {integrity: sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==}++ resolution: {integrity: sha512-g7df9rMFX/SPi34tyGCyUBREQoKkapwdY/T04Qn9TDWfHhAYt4/I0gMVirzK5wEzeUqIjEB+LXC/ypb7Aqno5w==}++ resolution: {integrity: sha512-0wUoCcLp+5Ev5pDW2OriHC2MJCbwLwuRx+gAqMTOkGKJJiBCLjtrvy4PWUGn6MIVefecRpzoOZ/UV6iGdOr+Cw==}++ resolution: {integrity: sha512-6pEjquH3rqaI6cYAXYPcz9MS4rY6R4ngRgrgfDshRptUZIc3lw0MCIJIGDj9++mfySOuPTHB4nrSW99BCvOPIA==}++ resolution: {integrity: sha512-MvG/clsADq1GPM2KGo2nyfaWVyn9naPiXrqIe4jYjXNZQt238kWyOGrsyc/DmRAQ+Re6yeo6yX/yoNCG5KAEVg==}++ resolution: {integrity: sha512-p/LgFzRN5FeoD3DLS6bkUapeye6E4SI6yJs6KetENd18S+FBthqYq2amJUWpt5z0EQwwHemidjY5OqJGEKm5uA==}++ resolution: {integrity: sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ==}+ engines: {node: '>=18'}++ resolution: {integrity: sha512-ol6UPyBWqsrO6EJySPz2O7ZSr856WDrEzM5zMqp+FJJLGMW35cLYmmZnl0vztAZxRUoNZJFTCohfjuIJ8I4QBQ==}++ resolution: {integrity: sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==}++ resolution: {integrity: sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==}+ engines: {node: '>= 14'}++ resolution: {integrity: sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==}+ engines: {node: '>= 14'}++ resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==}+ engines: {node: '>=0.10.0'}++ resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==}+ engines: {node: '>= 4'}++ resolution: {integrity: sha512-YChdK5txDjwGUvgR7oCJcLGkwi3LDh8Zx8tS7ndYciLEg/oOCL26VUBSUEtgS7EjiybcBqFxh5j0rAdDX7/bbg==}+ engines: {node: '>= 4'}++ resolution: {integrity: sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==}++ resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==}+ engines: {node: '>=0.8.19'}++ resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==}++ resolution: {integrity: sha512-Nb2ctOyNR8DqQoR0OwRG95uNWIC0C1lCgf5Naz5H6Ji72KZ8OcFZLz2P5sNgwlyoJ8Yif11oMuYs5pBQa86csA==}++ resolution: {integrity: sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ==}++ resolution: {integrity: sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw==}++ resolution: {integrity: sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==}++ resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==}+ engines: {node: '>=0.10.0'}++ resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==}+ engines: {node: '>=0.10.0'}++ resolution: {integrity: sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg==}++ resolution: {integrity: sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==}+ engines: {node: '>=12'}++ resolution: {integrity: sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==}++ resolution: {integrity: sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==}++ resolution: {integrity: sha512-iQcBXcd+Rv/pkubRyGh2utW2j1oPG5hZY6TUhVPpqK4G+o3IbxpJNx04hgksjc/N7GK5pEorUxDeg31cFgEk/w==}+ engines: {node: '>=18'}++ resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==}++ resolution: {integrity: sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ==}+ hasBin: true++ resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}++ resolution: {integrity: sha512-mxa9E9ITFOt0ban3j6L5MpjwegGz6lBQmM1IJkWeBZGcMxto50+eWdjC/52xDbS2vy0k7vIMK0Fe2wfL9OQSpQ==}++ resolution: {integrity: sha512-Cvc9WUhxSMEo4McES3P7oK3QaXldCfNWp7pl2NNeiIFlCoLr3kfq9kb1fxftiwk1FLV7CvpvDfonxtzUDeSOPg==}+ engines: {node: '>=18'}+ peerDependencies:+ canvas: ^3.0.0+ peerDependenciesMeta:+ canvas:+ optional: true++ resolution: {integrity: sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==}+ engines: {node: '>=6'}+ hasBin: true++ resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==}++ resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==}++ resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==}+ engines: {node: '>=6'}+ hasBin: true++ resolution: {integrity: sha512-3l+rb15IOWtUhU0H5MFqES/T6Kh7abYwjosBey/vD6hDt8zoEffkSC5Ws5SGtgVw3gBx2NEbhTeSW1+kWkpyTQ==}++ resolution: {integrity: sha512-Eeo8Ys1doU1z+x8AZsPpQu+p/QcZBI5PeOo7QGQdy2x2m0MU/hYagBbGOmXwr5KVbEfVuWv9LpnQWeehogurjg==}+ hasBin: true++ resolution: {integrity: sha512-CYDD3SOtsHtyXeEORYRx2qBtpDJFjRTGXUtmNEMGyzYOKj1TE3tycdlho7kA1Ufx9OYWZzg52QFBGALTirzDSw==}++ resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==}+ engines: {node: '>= 0.8.0'}++ resolution: {integrity: sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==}++ resolution: {integrity: sha512-YK7/ClTt4kAK0vo6w3X+Pnm0D2cf2vPHbhOXdoNti1Ga0al1P4TBZhwjATvjNwLEBCnKvjJc2jQgHXH0NEwlAg==}+ engines: {node: '>= 12.0.0'}+ cpu: [arm64]+ os: [android]++ resolution: {integrity: sha512-RzeG9Ju5bag2Bv1/lwlVJvBE3q6TtXskdZLLCyfg5pt+HLz9BqlICO7LZM7VHNTTn/5PRhHFBSjk5lc4cmscPQ==}+ engines: {node: '>= 12.0.0'}+ cpu: [arm64]+ os: [darwin]++ resolution: {integrity: sha512-U+QsBp2m/s2wqpUYT/6wnlagdZbtZdndSmut/NJqlCcMLTWp5muCrID+K5UJ6jqD2BFshejCYXniPDbNh73V8w==}+ engines: {node: '>= 12.0.0'}+ cpu: [x64]+ os: [darwin]++ resolution: {integrity: sha512-JCTigedEksZk3tHTTthnMdVfGf61Fky8Ji2E4YjUTEQX14xiy/lTzXnu1vwiZe3bYe0q+SpsSH/CTeDXK6WHig==}+ engines: {node: '>= 12.0.0'}+ cpu: [x64]+ os: [freebsd]++ resolution: {integrity: sha512-x6rnnpRa2GL0zQOkt6rts3YDPzduLpWvwAF6EMhXFVZXD4tPrBkEFqzGowzCsIWsPjqSK+tyNEODUBXeeVHSkw==}+ engines: {node: '>= 12.0.0'}+ cpu: [arm]+ os: [linux]++ resolution: {integrity: sha512-0nnMyoyOLRJXfbMOilaSRcLH3Jw5z9HDNGfT/gwCPgaDjnx0i8w7vBzFLFR1f6CMLKF8gVbebmkUN3fa/kQJpQ==}+ engines: {node: '>= 12.0.0'}+ cpu: [arm64]+ os: [linux]+ libc: [glibc]++ resolution: {integrity: sha512-UpQkoenr4UJEzgVIYpI80lDFvRmPVg6oqboNHfoH4CQIfNA+HOrZ7Mo7KZP02dC6LjghPQJeBsvXhJod/wnIBg==}+ engines: {node: '>= 12.0.0'}+ cpu: [arm64]+ os: [linux]+ libc: [musl]++ resolution: {integrity: sha512-V7Qr52IhZmdKPVr+Vtw8o+WLsQJYCTd8loIfpDaMRWGUZfBOYEJeyJIkqGIDMZPwPx24pUMfwSxxI8phr/MbOA==}+ engines: {node: '>= 12.0.0'}+ cpu: [x64]+ os: [linux]+ libc: [glibc]++ resolution: {integrity: sha512-bYcLp+Vb0awsiXg/80uCRezCYHNg1/l3mt0gzHnWV9XP1W5sKa5/TCdGWaR/zBM2PeF/HbsQv/j2URNOiVuxWg==}+ engines: {node: '>= 12.0.0'}+ cpu: [x64]+ os: [linux]+ libc: [musl]++ resolution: {integrity: sha512-8SbC8BR40pS6baCM8sbtYDSwEVQd4JlFTOlaD3gWGHfThTcABnNDBda6eTZeqbofalIJhFx0qKzgHJmcPTnGdw==}+ engines: {node: '>= 12.0.0'}+ cpu: [arm64]+ os: [win32]++ resolution: {integrity: sha512-Amq9B/SoZYdDi1kFrojnoqPLxYhQ4Wo5XiL8EVJrVsB8ARoC1PWW6VGtT0WKCemjy8aC+louJnjS7U18x3b06Q==}+ engines: {node: '>= 12.0.0'}+ cpu: [x64]+ os: [win32]++ resolution: {integrity: sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ==}+ engines: {node: '>= 12.0.0'}++ resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==}+ engines: {node: '>=10'}++ resolution: {integrity: sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==}++ resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==}+ hasBin: true++ resolution: {integrity: sha512-CdzqowRJCeLU72bHvWqwRBBlLcMEtIvGrlvef74kMnV2AolS9Y8xUv1I0U/MNAWMhBlKIoyuEgoJ0t/bbwHbLQ==}++ resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==}++ resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==}++ resolution: {integrity: sha512-t5tS44bqd825zAW45UQxpG2CvcC4urOwn2TrwSH8u+MjeE+1NnWl6QqeQ/6NdjMqdOygyiT9p3Ev0p1NJykxjw==}+ peerDependencies:+ react: ^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0++ resolution: {integrity: sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==}+ hasBin: true++ resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==}++ resolution: {integrity: sha512-wiYz4+JrLyb/DqW2hkFJxP7Vd7JuTDm77fvbM8VfEQdmSMqcImWeeRbHwZjBjIFki/VaMK2BhFi7oUUZeM5bqw==}++ resolution: {integrity: sha512-mBHK6FBHuBAlhgRe88w9F0O1AbwwXJUcQibUbC/QcdTbVGAD7aWza+xt3N6oT/jCZx3/OMeS+8rnuiHZcQ9s7A==}+ engines: {node: '>= 20'}+ hasBin: true++ resolution: {integrity: sha512-Tmd1Vg/m3Xz43afeNxDIhWRtFZgM2VLyaf4vSTYwudTyeuTneoL3qtWMA5jeLyz/O1vDJmmV4QuScFCA2tBPwg==}++ resolution: {integrity: sha512-W4mAWTvSlKvf8L6J+VN9yLSqQ9AOAAvHuoDAmPkz4dHf553m5gVj2ejadHJhoJmcmxEnOv6Pa8XJhpxE93kb8Q==}++ resolution: {integrity: sha512-5HVP2MKaP6L+G6YaxPNjuL0BPrq9orG3TsrZ9YXbA3vDw/ACI4MEsnoDpn6ZNm7GnZgtAcONJyPhOP8tNJQavQ==}++ resolution: {integrity: sha512-sqpDWlsHn7Ac9GNZQMeUzPQSMzR6Wv0WKRNvQRg0KqHh02fpTz69Qc1QSseNX29bhz1ROIyNyxExfawVKTm1GQ==}++ resolution: {integrity: sha512-OuJHqvr455pwu2OaOrir7dbzqs4jlWKOtlu9L6GjcIjjQwNyw02VntQsr/Ek6/A13vgnXfUhBekWRUP1OkNivw==}++ resolution: {integrity: sha512-78UEvebzz/rJIxLvE7ZtDd/vIQ0RHv+3Mh5DR96p7cS7HsBhYIICDBCu8csTNWNO6tBWfqXPWekRuj2FNOGOZg==}++ resolution: {integrity: sha512-IrtvNvjxC1o06taBAVJznEnkiHxLFTzgonUdy8hzFVeDun0uTjxxrRGVaNFqkU1wJR3RBPEfsxmU6jDWPofrTQ==}++ resolution: {integrity: sha512-0ulfdQOM3ysHhCJ1p06l0b0VKlhU0wuQs3thxZQagjcjPrlFRqY215uZGHHJan9GEAXd9MbfPjFJz+qMkVR6zQ==}++ resolution: {integrity: sha512-Tl9GBNeG/AhJnQM221bJR2HPvLOSnLE/T9cJI9tlc6zwQk2nPk/4f0cHkOdEixQPC/j8UtKDdITswvLAy1OZ1w==}++ resolution: {integrity: sha512-J6f+9hUp+ldTZqKRSg7Vw5V6MqjATc+3E4gf3CFNcuZNWD8XdyI6zQ8GqH7f8169MM6P7hMBRDVGnn7oHB9kXQ==}++ resolution: {integrity: sha512-lj/z8v0r6ZtsN/cGNNtemmmfoLAFZnjMbNyLzBafjzikOM+glrjNHPlf6lQDOTccj9n5b0PPihEBbhneMyGs1Q==}++ resolution: {integrity: sha512-EcmOpxsZ96CvlP03NghtH1EsLtr0n9Tm4lPUJUBccV9RwUOneqSycg19n5HGzCf+10LozMRSObtVr3ee1WoHtg==}++ resolution: {integrity: sha512-TqICwyvJJpBwvGAMZjj4J2n0X8QWp21b9l0o7eXyVJ25YNWYbJDVIyD1bZXE6WtV6RmKJVYmQAKWa0zWOABz2w==}++ resolution: {integrity: sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA==}++ resolution: {integrity: sha512-1ePVfB4P/vz3xSsm6H3D32r6VYGErxclnuLLFK02/2ReF+UdEKm7caulK6Vm0LBIp5gPRtB2Z1OYDznCkX3k2w==}+ engines: {node: '>=18'}+ peerDependencies:+ '@types/mdast': '*'+ peerDependenciesMeta:+ '@types/mdast':+ optional: true++ resolution: {integrity: sha512-BoaAm8mlJ+LAYz0Qs532Y3ciTuQYgBUPZcSFbvC/ZKmEMAKgulw84YvQK1gI34t/vL2euSfuaWlqczkTBgamkw==}+ engines: {node: '>=18'}+ peerDependencies:+ '@types/mdast': '*'+ peerDependenciesMeta:+ '@types/mdast':+ optional: true++ resolution: {integrity: sha512-wgyJtgUkUcdU7zci7uuwc/tzoAhm0TswWhaXuvnWolqug+8jY7bgNkBBL0dYBnHgc/tHL7lCzRdPsdUxUKKBqw==}++ resolution: {integrity: sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg==}++ resolution: {integrity: sha512-wxEeE8v8XVvOrxn1TZj74qYhAtTQsSqufHVS3uNVyT1MupXxhyaHk8/9xDNPh9BmL77QNDgWTkZ3RsYHB2ry7w==}++ resolution: {integrity: sha512-wVC0zwjJNqQeX+bb07YTPu/CvSAyCTafyYb7sMhX1r62/Lw5M/df3JyYaANyp8g15c1ypJRFSsookTqA1IDsUg==}+ engines: {node: '>=18'}+ peerDependencies:+ micromark: ^4.0.0+ micromark-util-types: ^2.0.0+ peerDependenciesMeta:+ micromark-util-types:+ optional: true++ resolution: {integrity: sha512-GcbXqTTHOsiZHyF753oIddP/J2eH8j9zpyQPhkof6B2JNxfEJabnQqxbCgzJNuNes0Y2jTNJ3LiYPSXr6eJA8w==}+ engines: {node: '>=18'}+ peerDependencies:+ micromark-util-types: '*'+ peerDependenciesMeta:+ micromark-util-types:+ optional: true++ resolution: {integrity: sha512-OkzoYVTL1ChbvQ8Cc1ayTIz7paFQz8iS9oIYmewncweUSwmWR+hkJF9spJ1lxB90XldJl26A1F4IkPOKS3bDXw==}+ engines: {node: '>=18'}+ peerDependencies:+ micromark: ^4.0.0+ micromark-util-types: ^2.0.0+ peerDependenciesMeta:+ micromark-util-types:+ optional: true++ resolution: {integrity: sha512-oOg7knzhicgQ3t4QCjCWgTmfNhvQbDDnJeVu9v81r7NltNCVmhPy1fJRX27pISafdjL+SVc4d3l48Gb6pbRypw==}++ resolution: {integrity: sha512-/yPhxI1ntnDNsiHtzLKYnE3vf9JZ6cAisqVDauhp4CEHxlb4uoOTxOCJ+9s51bIB8U1N1FJ1RXOKTIlD5B/gqw==}++ resolution: {integrity: sha512-ADVjpOOkjz1hhkZLlBiYA9cR2Anf8F4HqZUO6e5eDcPQd0Txw5fxLzzxnEkSkfnD0wziSGiv7sYhk/ktvbf1uw==}++ resolution: {integrity: sha512-pRzm4kDTu0MjlmBkxmS9yYhw60nncfcEwu9NNdPFSQEFXS95ZKyIIyTSHu/o3ReBUrLKYEq+7YaXCRn/bPB4MA==}++ resolution: {integrity: sha512-xHlTOmuCSotIA8TW1mDIM6X2O1SiX5P9IuDtqGonFhEK0qgRI4yeC6vMxEV2dgyr2TiD+2PQ10o+cOhdVAcwfg==}++ resolution: {integrity: sha512-qIBZhqxqI6fjLDYFTBIa4eivDMnP+OZqsNwmQ3xNLE4Cxwc+zfQEfbs6tzAo2Hjq+bh6q5F+Z8/cksrLFYWQQw==}++ resolution: {integrity: sha512-vsKArQsicm7t0z2GugkCKtZehqUm31oeGBV/KVSorWSy8ZlNAv7ytjFhvaryUiCUJYqs+NoE6AFhpQvBTM6Q4w==}++ resolution: {integrity: sha512-lvEqd+fHjATVs+2v/8kg9i5Q0AP2k85H0WUOwpIVvUML8BapsMvh1XAogmQjOCsLpoKRCVQqEkQBB3NhVBcsOg==}++ resolution: {integrity: sha512-Xe6rDdJlkmbFRExpTOmRj9N3MaWmbAgdpSrBQvCFqhezUn4AHqJHbaEnfbVYYiexVSs//tqOdY/DxhjdCiJnIA==}++ resolution: {integrity: sha512-VFMekyQExqIW7xIChcXn4ok29YE3rnuyveW3wZQWWqF4Nv9Wk5rgJ99KzPvHjkmPXF93FXIbBp6YdW3t71/7Vg==}++ resolution: {integrity: sha512-fS8hnLIjnjvdQIj39Geug8wWsR0HrYZ43KShKxNfwT7t2LOHo/LbWZEzEaSOjwtjdCsjoE6syHhonEzW0zv0+Q==}++ resolution: {integrity: sha512-5bZ+3CjhAd9eChYTHsjy6TGxpOFSKgKKJPJxr293jTbfry2KDoWkhBb6TcPVB4NmzaPhMs1Frm9AZH7OD4Cjzw==}++ resolution: {integrity: sha512-Ob0nuZ3PKt/n0hORHyvoD9uZhr+Za8sFoP+OnMcnWK5lngSzALgQYKMr9RJVOWLqQYuyn6ulqGWSXdwf6F80lQ==}++ resolution: {integrity: sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==}++ resolution: {integrity: sha512-QUNFEOPELfmvv+4xiNg2sRYeS/P84pTW0TCgP5zc9FpXetHY0ab7SxKyAQCNCc1eK0459uoLI1y5oO5Vc1dbhA==}++ resolution: {integrity: sha512-K0kHzM6afW/MbeWYWLjoHQv1sgg2Q9EccHEDzSkxiP/EaagNzCm7T/WMKZ3rjMbvIpvBiZgwR3dKMygtA4mG1Q==}++ resolution: {integrity: sha512-OnAnH8Ujmy59JcyZw8JSbK9cGpdVY44NKgSM7E9Eh7DiLS2E9RNQf0dONaGDzEG9yjEl5hcqeIsj4hfRkLH/Bg==}++ resolution: {integrity: sha512-ccUbYk6CwVdkmCQMyr64dXz42EfHGkPQlBj5p7YVGzq8I7CtjXZJrubAYezf7Rp+bjPseiROqe7G6foFd+lEuw==}++ resolution: {integrity: sha512-nDV/77Fj6eH1ynwscYTOsbK7rR//Uj0bZXBwJZRfaLEJ1iGBR6kIfNmlNqaqJf649EP0F3NWNdeJi03elllNUQ==}++ resolution: {integrity: sha512-Pa2ljlsEL6sVwFaYeyrOLSYbQt73JvGbPOYFq+9AElXiSnfI5Q4465RRZ1sHv7lDjDOnGRDDaqPXqClqWK/q1Q==}++ resolution: {integrity: sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw==}++ resolution: {integrity: sha512-2cNEiYDhCWKI+Gs9T0Tiysk136SnR13hhO8yW6BGNyhOC4qYFnwF1nKfD3HFAIXA5c45RrIG1ub11GiXeYd1xA==}++ resolution: {integrity: sha512-sxPqmo70LyARJs0w2UclACPUUEqltCkJ6PhKdMIDuJ3gSf/Q+/GIe3WKl0Ijb/GyH9lOpUkRAO2wp0GVkLvS9Q==}++ resolution: {integrity: sha512-VdQyxFWFT2/FGJgwQnJYbe1jjQoNTS4RjglmSjTUlpUMa95Htx9NHeYW4rGDJzbjvCsl9eLjMQwGeElsqmzcHg==}++ resolution: {integrity: sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ==}++ resolution: {integrity: sha512-XQLu552iSctvnEcgXw6+Sx75GflAPNED1qx7eBJ+wydBb2KCbRZe+NwvIEEMM83uml1+2WSXpBAcp9IUCgCYWA==}++ resolution: {integrity: sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q==}++ resolution: {integrity: sha512-oxB2Ik03hI0gv+VNn9tnh1t1YEe9MDPptViAEgfdf3YQHsn0pzGTgCdlSCJXcwhqm8phaEuM7zeEu3QQzVBrPg==}++ resolution: {integrity: sha512-oGYfQzHSG5dOMovQcJ3fyTmZlWAWpi0XA0sJwJs+i6OT88o1+Jtw/8z0CmdowSLxGhhFK89rQ/oXph/wN02PNw==}++ resolution: {integrity: sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==}+ engines: {node: 18 || 20 || >=22}++ resolution: {integrity: sha512-azKON4d9S65PEoFUiQTMTgPheEmzf2QngdRc50AKfJp9Q9mmcBVw22c8eMq9k8kxOFHdL7+WZY7N/5F/lwiDag==}++ resolution: {integrity: sha512-8nadJAJjTtqRkmRF36FoJTrywK9nnFmnPwnSMyxaOCU7GDjN9RTMJIxx9De8ErM+vpPhMccr/6fo5WciyQLnMQ==}++ resolution: {integrity: sha512-BQgQbSa9Hn3/mtbib0MK53y6JSANa+YKUKlaYnWzAVDH424RYQ5LVpV3pNiWH00BA2z4ojsSdMzqT7g2FQwjuQ==}+ peerDependencies:+ '@emotion/is-prop-valid': '*'+ react: ^18.0.0 || ^19.0.0+ react-dom: ^18.0.0 || ^19.0.0+ peerDependenciesMeta:+ '@emotion/is-prop-valid':+ optional: true+ react:+ optional: true+ react-dom:+ optional: true++ resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}++ resolution: {integrity: sha512-Y2tUNy4ouw6tq5oDSKeQYGOyhkUBhNOcGV/02KC+6kd9eDGqdZd++mjMiIDilrBYvjEnCYvVtsuHCuP+okSfug==}+ engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}+ hasBin: true++ resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==}++ resolution: {integrity: sha512-kQK9LGGFiHtrWiNhZtA7Qbw17AQz+dmsEKODRIVTXA9+e5MS/2gZEBhYJt13GrAz5/IOZKddH/0Z3TP/Zgo+yw==}+ engines: {node: '>=18'}++ resolution: {integrity: sha512-IlVB7OS7qrOsVYlpnFIkETjMwT9jwvmocJmmM+GZU/PAB3uGi9Ezd7vcWhWBUnSc0ya4ppmQITOyP1ez9gg8cg==}++ resolution: {integrity: sha512-6HVa5oIrgMC6aA6WF6XyyqbhRPJrKR02L20+2+zpDtO5QAzGHAUGw5TKQvwi5vctNnRHkJYmjAhRVQF2EKdTQw==}++ resolution: {integrity: sha512-csuQ9x3Yr0cEIs/Zgx/OEt9iBw9vqIunAPQkx19R/fiMq2oGVTgcMqO/V3Ybqefr1TBvosI6jU539ksaBULJyA==}++ resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==}+ engines: {node: '>= 0.8.0'}++ resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==}+ engines: {node: '>=10'}++ resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==}+ engines: {node: '>=10'}++ resolution: {integrity: sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==}++ resolution: {integrity: sha512-GG2AQYWoLgL877gQIKeRPGO1xF9+eG1ujIb5soS5gPvLQ1y2o8FL90w2QWNdf9I361Mpp7726c+lj3U0qK1uGw==}++ resolution: {integrity: sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==}++ resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==}+ engines: {node: '>=8'}++ resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==}+ engines: {node: '>=8'}++ resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==}++ resolution: {integrity: sha512-//nshmD55c46FuFw26xV/xFAaB5HF9Xdap7HJBBnrKdAd6/GxDBaNA1870O79+9ueg61cZLSVc+OaFlfmObYVQ==}+ engines: {node: '>= 14.16'}++ resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==}++ resolution: {integrity: sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==}+ engines: {node: '>=12'}++ resolution: {integrity: sha512-RRuzqDtt5Y9h3quz5hWhK+TPnsmVs6WwSU6LkJMeY4HstUEDuYTG8UJSdawMRzmzAtV+KEoG8N3Qg2qLy5vM/A==}+ engines: {node: ^10 || ^12 || >=14}++ resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==}+ engines: {node: '>= 0.8.0'}++ resolution: {integrity: sha512-Z/CJHIkdujO/OtN7nXUii0Rf3VT5SRuhjBA82Xvu2XhBUgX3nhP67T0LHceBdQLex7OOFGTox+Q5Yg8Jk2Qivg==}+ engines: {node: '>=14'}+ hasBin: true++ resolution: {integrity: sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==}+ engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0}++ resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==}++ resolution: {integrity: sha512-IAtzIB6sUiWaJYrX9smp3V46pBGbBeLFRGdh25kg1334VcBlD8HzhPeNIWQH9zhGmo2itIe25EHt9dQP7G5hmg==}++ resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==}+ engines: {node: '>=6'}++ resolution: {integrity: sha512-+Owyggi9IxT1ePKGafcI87ubSmxol6smwJ+RAHDQlx9+9cPwFWDiKFFCPuWhr9ignlGpZ9vDQLw67N4dcTVFEA==}+ engines: {node: '>=20'}++ resolution: {integrity: sha512-fdZZruC9/x/joCg0mhKGs5aHpwrXLCSZ4GOJmhhYyiE0ffyEsk9MLFt9LCOCF9tn8ErTD+UDQP4oDUSlZkmpCg==}+ peerDependencies:+ react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1+ react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1++ resolution: {integrity: sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==}+ peerDependencies:+ react: ^18.3.1++ resolution: {integrity: sha512-gjFsf05dxcku0FkyMtFH+XmYFdA2odXfBVknEr/IZ+XpUjwsgvtY2616sOpUynK+l9ykQDRNpaJ1hYfuximUiA==}+ engines: {node: '>=10'}+ peerDependencies:+ '@types/react': '*'+ '@types/react-dom': '*'+ react: '>=16'+ react-dom: '>=16'+ peerDependenciesMeta:+ '@types/react':+ optional: true+ '@types/react-dom':+ optional: true++ resolution: {integrity: sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==}++ resolution: {integrity: sha512-z6F7K9bV85EfseRCp2bzrpyQ0Gkw1uLoCel9XBVWPg/TjRj94SkJzUTGfOa4bs7iJvBWtQG0Wq7wnI0syw3EBQ==}+ engines: {node: '>=0.10.0'}++ resolution: {integrity: sha512-TnckvpDQGU0672wEaLZqdzvhuSeXWjgW6vijMWxiKOxc8CosQUfPGISdcZyfHqjX3XMjEtRxj4w9HumvX4h4mw==}+ peerDependencies:+ react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1++ resolution: {integrity: sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==}+ engines: {node: '>=0.10.0'}++ resolution: {integrity: sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==}++ resolution: {integrity: sha512-Kko+Y5XQ6fM+Ce3dq3m9YGxnacYZYl9cA1wZjaF3Vbry2L3i1qVg8+CAgNPsXRArPMUMCaOR7oa9Nqntc43JKA==}+ engines: {node: '>= 20.19.0'}++ resolution: {integrity: sha512-0YCaSCq2VRIebiaUviZNs0cBz1kg5kVS2UKUfNIx8YVs1cN3AV7NTctO5FOKBA+UT2BPJIWZauYHPqJODG50cg==}++ resolution: {integrity: sha512-8VhliFJAWRaUiVvREIiW2NXXTmHs4vMNnSzuJVhscgmGav3g9VDxLrQndI3dZZVVdp0ZO/5v0xmX516/7M9cng==}++ resolution: {integrity: sha512-6VwtthbV4o/7+OaAF9I5L5V3llLEsoPyq9P1JVXkedTP33c7MfCG0/5NOPcSJn0TzXcG9YUrR0gQSWioew3LDg==}++ resolution: {integrity: sha512-Qn7vR1xrf6fZCrkm9TDWi/AB4ylrHy+jqsNm1EHOAmbARYA6gsnVJBq/sdBh6kmT4NEZxH5vgIjrscefJAOXcw==}++ resolution: {integrity: sha512-OiM2wrZ/wuhKkigASodFoo8wimG3H12LWQaH8qSPVJn9apWKFSH3YOCtbKpBorTVw/eI7cuT21XBbvwEswbIOA==}++ resolution: {integrity: sha512-/aE8hCfKlQeA8LmyeyQvQF3eBiLRGNlfBJEvWH7ivp9sBqs7TNqBL5X3v157rM4IFETqDnIOO+z5M/biZbo9Ww==}++ resolution: {integrity: sha512-CsnhKNsyI8Tub6L4sm5ZFsme4puGfc6pYylvXo1AeqaGbjOYyzNv3qZPwvs0oMJ39eryyeOdmxwUIo94IpEhqg==}++ resolution: {integrity: sha512-JE3TGgouk/sy92SemNMEUhO5mNP4on04cmzOV3s3R5Dbk160ewmpM4tgPiinKKvoJ5UW2fTu7FOYsjVbusSA9w==}+ engines: {node: '>=18'}+ peerDependencies:+ '@types/mdast': ^4.0.0+ unified: ^11.0.0+ peerDependenciesMeta:+ '@types/mdast':+ optional: true++ resolution: {integrity: sha512-f+pKZRxCRwNEGFBKNRAZAqU91GIK1SAo3ZyFHWRUgC9zcxRR0BXKd6YwqgSsxtW0rNpUDtONj7H5nje2WL3fcA==}+ engines: {node: '>=18'}+ peerDependencies:+ '@types/mdast': ^4.0.0+ unified: ^11.0.0+ peerDependenciesMeta:+ '@types/mdast':+ optional: true++ resolution: {integrity: sha512-1quofZ2RQ9EWdeN34S79+KExV1764+wCUGop5CPL1WGdD0ocPpu91lzPGbwWMECpEpd42kJGQwzRfyov9j4yNg==}++ resolution: {integrity: sha512-MMqgnP74Igy+S3WwnhQ7kqGlEerTETXMvJhrUzDikVZ2/uogJCb+WHUg97hK9/jcfc0dkD73s3LN8zU49cTEtA==}++ resolution: {integrity: sha512-FCxlKLNGknS5ba/1lmpYijMUzX2esxW5xQqjWxw2eHFfS2MSdaHVINFmhjo+qN1WhZhNimq0dZATN9pH0IDrpA==}++ resolution: {integrity: sha512-Dh7l57ianaEoIpzbp0PC9UKAdCSVklD8E5Rpw7ETfbTl3FqcOOgq5q2LVDhgGCkaBv7p24JXikPdvhhmHvKMsw==}++ resolution: {integrity: sha512-1OSmLd3awB/t8qdoEOMazZkNsfVTeY4fTsgzcQFdXNq8ToTN4ZGwrMnlda4K6smTFKD+GRV6O48i6Z4iKgPPpw==}++ resolution: {integrity: sha512-mHiYhhwphs1IgIZmkToKLwJn0U99IjPXuutkA2acrNcG0vlEq2G4TGnd2eT0saIHwh2KjaCpvleHcsd5SAz96A==}++ resolution: {integrity: sha512-KRWwmNLlPw5M7HcdYfm15oBv9n9LPtjzpzCIxS/phwqvPyxHSoKX6Y2YU3pxSPfy0CLquVgsx/j/hBi6OvH1Nw==}+ engines: {node: '>=18.0.0', npm: '>=8.0.0'}+ hasBin: true++ resolution: {integrity: sha512-guoltQEx+9aMf2gDZ0s62EcV8lsXR+0w8915TC3ITdn2YueuNjdAYh/levpU9nFaoChh9RUS5ZdQMrKfVEN9tw==}++ resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==}++ resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==}++ resolution: {integrity: sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==}+ engines: {node: '>=v12.22.7'}++ resolution: {integrity: sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==}++ resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==}+ hasBin: true++ resolution: {integrity: sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==}+ engines: {node: '>=10'}+ hasBin: true++ resolution: {integrity: sha512-N7mWAMydj89EnYTHtRpS3LBrAz3J9O6oVrqpuXuvlAHfAUG8WEKqtbAd7SBiJNY5NfCAFhSdyAh7wI4Shjqy4g==}+ engines: {node: '>=10'}+ peerDependencies:+ seroval: ^1.0++ resolution: {integrity: sha512-HlSgSAkTk4EqHcje1ptJjfZi1YDv5KbhVJ/d3P7T/nAXua2VmDu+AKDX5VTdFfZf48nDkWB2TKYt0DrCSa+3wg==}+ engines: {node: '>=10'}++ resolution: {integrity: sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==}++ resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==}+ engines: {node: '>=8'}++ resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==}+ engines: {node: '>=8'}++ resolution: {integrity: sha512-55Dj73uq9ZXL5zyeRPzHQsK7Nbyt6Y10k5s7OjuFZGMhpp4r/rsLBH0o/0fstIzX1Lep9VxefWljK/SKCzygIA==}++ resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==}++ resolution: {integrity: sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==}+ engines: {node: '>=0.10.0'}++ resolution: {integrity: sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==}++ resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==}++ resolution: {integrity: sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg==}++ resolution: {integrity: sha512-SHYTCveHpRJfcIC8r+5EANczK21R0iNYo4i7wNaLeLeQjEnaVk4xMFhgV4E/mix69BpFSBui1NOESEXKlZfReA==}+ peerDependencies:+ react: ^18.0.0 || ^19.0.0+ react-dom: ^18.0.0 || ^19.0.0++ resolution: {integrity: sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==}++ resolution: {integrity: sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==}++ resolution: {integrity: sha512-8r3mkIM/2+PpjHoOtiAW8Rg3jJLHaV7xPwG+YRGrv6FP0wwk/toTpATxWYOW0BKdWwl82VT2tFYi5DlROa0Mxg==}++ resolution: {integrity: sha512-RjQetxJrrUJLQPHbLku6U/ocGtzyjbJMP9lCNK7Ag0CNh690nSH8woqWH9u16nMjYBAok+i7JO1NP2pOy8IsPQ==}++ resolution: {integrity: sha512-LIN7rULI0jBscWQYaSswptyderlarFkjQ+t79nzty8tcIAceVomEVlLzH5VP4Cmsv6MtKhs7qaAiwlcp+Mgaxw==}++ resolution: {integrity: sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==}++ resolution: {integrity: sha512-wieBHXygIm7OyQOu5hQlkk62/WyCFYGlWg7L6/ZCUZwx0o398Zkn4pVmMyfYhfMG8kGrj/Krt8eIk6UKC6VzwA==}++ resolution: {integrity: sha512-XPPUyAc+cvspz3lHTcR/QgPfW2A0lv/xQNIjX3HGhLR+Nq2lHaLq5MtTesHn8GUr3W3DguT2KT5x3NVgRtYwmA==}++ resolution: {integrity: sha512-gOhV3P7ufE62QDGg1zVaTgCR+EtPv92k2nIhVcVKcLmxT1sUBsQGhnZj175j+MqRt4zLF7ic+sCYjfhxMxj7YQ==}++ resolution: {integrity: sha512-uxc/zpqFg6x7C8vOE7lh6Lbda8eEL9zmVm/PLeTPBRhh1xCgdWaQ+J1CUieGpIfm2HdtsUpRv+HshiasBMcc6A==}+ engines: {node: '>=6'}++ resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==}++ resolution: {integrity: sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==}++ resolution: {integrity: sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==}+ engines: {node: '>=12.0.0'}++ resolution: {integrity: sha512-Zba82s87IFq9A9XmjiX5uZA/ARWDrB03OHlq+Vw1fSdt0I+4/Kutwy8BP4Y/y/aORMo61FQ0vIb5j44vSo5Pkg==}+ engines: {node: ^18.0.0 || >=20.0.0}++ resolution: {integrity: sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw==}+ engines: {node: '>=14.0.0'}++ resolution: {integrity: sha512-u8KszXvGfU68hVcZpRHKG28T0krMuv2G5nDhiHaMLen/gIuFEgIJhaJuO69qjnXg5paSrbPMFfx3brNuN8eVSg==}+ engines: {node: '>=14.0.0'}++ resolution: {integrity: sha512-Je6p7pkk+KMzMv2XXKmAE3McmolOQFdxkKw0R8EYNr7sELW46JqnNeTX8ybPiQgvg1ymCoF8LXs5fzFaZvJPTA==}++ resolution: {integrity: sha512-WMi/OQ2axVTf/ykqCQgXiIct+mSQDFdH2fkwhPwgEwvJ1kSzZRiinb0zF2Xb8u4+OqPChmyI6MEu4EezNJz+FQ==}+ hasBin: true++ resolution: {integrity: sha512-FVDYdxtnj0G6Qm/DhNPSb8Ju59ULcup3tuJxkFb5K8Bv2pUXILbf0xZWU8PX8Ov19OXljbUyveOFwRMwkXzO+A==}+ engines: {node: '>=16'}++ resolution: {integrity: sha512-hdF5ZgjTqgAntKkklYw0R03MG2x/bSzTtkxmIRw/sTNV8YXsCJ1tfLAX23lhxhHJlEf3CRCOCGGWw3vI3GaSPw==}+ engines: {node: '>=18'}++ resolution: {integrity: sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==}++ resolution: {integrity: sha512-tmMpK00BjZiUyVyvrBK7knerNgmgvcV/KLVyuma/SC+TQN167GrMRciANTz09+k3zW8L8t60jWO1GpfkZdjTaw==}++ resolution: {integrity: sha512-OJ/ibxhPlqrMM0UiNHJ/0CKQkoKF243/AEmplt3qpRgkW8VG7IfOS41h7V8TjITqdByHzrjcS/2si+y4lIh8NA==}+ engines: {node: '>=18.12'}+ peerDependencies:+ typescript: '>=4.8.4'++ resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==}++ resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==}+ engines: {node: '>= 0.8.0'}++ resolution: {integrity: sha512-fBdHYiqQ14RW6mOMXD14Svn82ZsCYAoQSzGRzyEjR59S5A2Krh/l7fGTOQ7iCr8gGy/mHVXtEF7s5fgjEdV0Pw==}+ engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}+ peerDependencies:+ eslint: ^8.57.0 || ^9.0.0 || ^10.0.0+ typescript: '>=4.8.4 <6.1.0'++ resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==}+ engines: {node: '>=14.17'}+ hasBin: true++ resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==}++ resolution: {integrity: sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==}++ resolution: {integrity: sha512-amQa0Ep2m6hE2g72AugUItjbuM8X8cGQnFoHk0pGfrFeT9GZhzN5SW8nRsiGKK7Aif4CrACPENkA6P/Lw6fHGQ==}++ resolution: {integrity: sha512-LsiILbtBETkDz8I9p1dQ0uyRUWuaQzd/cuEeS1hoRSyW5E5XGmTzlwY1OrNzzakGowI9Dr/I8HVaw4hTtnxy8g==}++ resolution: {integrity: sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==}++ resolution: {integrity: sha512-Hp5Kh3wLxv0PHj9m2yZhhLt58KzPtEYKQQ4yxfYFEO7EvHwzyDYnduhHnY1mDxoqr7VUwVuHXk9RXKIiYS1N8Q==}++ resolution: {integrity: sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==}++ resolution: {integrity: sha512-goh1s1TBrqSqukSc8wrjwWhL0hiJxgA8m4kFxGlQ+8FYQ3C/m11FcTs4YYem7V664AhHVvgoQLk890Ssdsr2IQ==}++ resolution: {integrity: sha512-m+vIdyeCOpdr/QeQCu2EzxX/ohgS8KbnPDgFni4dQsfSCtpz8UqDyY5GjRru8PDKuYn7Fq19j1CQ+nJSsGKOzg==}++ resolution: {integrity: sha512-9skdIFlCsPdFV7wUfZxNsFInlW+7nJmGu2gkTu0OUhF56aXGsHab9x52/QhdJ4lC7ZDPWTxbiC4ANqVlsuaW3w==}+ engines: {node: ^20.19.0 || >=22.12.0}+ peerDependencies:+ '@farmfe/core': '*'+ '@rsbuild/core': '*'+ '@rspack/core': '*'+ bun-types-no-globals: '*'+ esbuild: '*'+ rolldown: '*'+ rollup: '*'+ unloader: '*'+ vite: '*'+ webpack: '*'+ peerDependenciesMeta:+ '@farmfe/core':+ optional: true+ '@rsbuild/core':+ optional: true+ '@rspack/core':+ optional: true+ bun-types-no-globals:+ optional: true+ esbuild:+ optional: true+ rolldown:+ optional: true+ rollup:+ optional: true+ unloader:+ optional: true+ vite:+ optional: true+ webpack:+ optional: true++ resolution: {integrity: sha512-pJ2sYawQS0R/WI928Gj5GlPhTGzbMelq0+4INtSYNDV9ErKJcX6xjGWkoG/VnB3dpUm00zALaqkrUD77pO5TDQ==}+ hasBin: true+ peerDependencies:+ browserslist: '>= 4.21.0'++ resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==}++ resolution: {integrity: sha512-6L+EeigHMQhdaIPNIFUKwfWJSwWFQ8gJbJ2DLOs5sDIegTwR9fRxvnM3uciHKjIZhFz+KAv2emhWMRvDmMcY8A==}+ peerDependencies:+ react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0++ resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==}++ resolution: {integrity: sha512-xZe/16rV4aa+HGSOCiY2YeLT1OybRLrrkL/Rqaq7p7GMVXjFh+6wN4oMYgjFmnSnhY8t6Xpdl2l9qmnHYuMHwQ==}+ hasBin: true++ resolution: {integrity: sha512-5yXvWDEgqeiYiBe1lbxYF7UMAIm/IcopxMHrMQDq3nvKcjPKIhZklUKL+AE7J7uApI4kwe2snsK+eI6UTj9EHg==}++ resolution: {integrity: sha512-QTHzsGd1EhbZs4AsQ20JX1rC3cOlt/IWJruk893DfLRr57lcnOeMaWG4K0JrRta4mIJZKth2Au3mM3u03/JWKw==}++ resolution: {integrity: sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==}++ resolution: {integrity: sha512-EbKSKh+bh1E1IFxeO0pg1n4dvoOTt0UDiXMd/qn++r98+jPO1xtJilvXldeuQ8giIB5IkpjCgMleHMNEsGH6pg==}+ engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0}+ hasBin: true++ resolution: {integrity: sha512-o5a9xKjbtuhY6Bi5S3+HvbRERmouabWbyUcpXXUA1u+GNUKoROi9byOJ8M0nHbHYHkYICiMlqxkg1KkYmm25Sw==}+ engines: {node: ^18.0.0 || >=20.0.0}+ hasBin: true+ peerDependencies:+ '@types/node': ^18.0.0 || >=20.0.0+ less: '*'+ lightningcss: ^1.21.0+ sass: '*'+ sass-embedded: '*'+ stylus: '*'+ sugarss: '*'+ terser: ^5.4.0+ peerDependenciesMeta:+ '@types/node':+ optional: true+ less:+ optional: true+ lightningcss:+ optional: true+ sass:+ optional: true+ sass-embedded:+ optional: true+ stylus:+ optional: true+ sugarss:+ optional: true+ terser:+ optional: true++ resolution: {integrity: sha512-KrxIJ62Fd89gfysR4WotlgZABiz2dqFPgqGzX7s+CwsqLFomRH7777ZcrOD6+WVAh7khPQP41A+BKbpcJFrdEg==}+ engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0}+ hasBin: true+ peerDependencies:+ '@edge-runtime/vm': '*'+ '@types/debug': ^4.1.12+ '@types/node': ^18.0.0 || ^20.0.0 || >=22.0.0+ '@vitest/browser': 3.2.7+ '@vitest/ui': 3.2.7+ happy-dom: '*'+ jsdom: '*'+ peerDependenciesMeta:+ '@edge-runtime/vm':+ optional: true+ '@types/debug':+ optional: true+ '@types/node':+ optional: true+ '@vitest/browser':+ optional: true+ '@vitest/ui':+ optional: true+ happy-dom:+ optional: true+ jsdom:+ optional: true++ resolution: {integrity: sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==}+ engines: {node: '>=18'}++ resolution: {integrity: sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==}++ resolution: {integrity: sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==}+ engines: {node: '>=12'}++ resolution: {integrity: sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ==}++ resolution: {integrity: sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==}+ engines: {node: '>=18'}+ deprecated: Use @exodus/bytes instead for a more spec-conformant and faster implementation++ resolution: {integrity: sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==}+ engines: {node: '>=18'}++ resolution: {integrity: sha512-De72GdQZzNTUBBChsXueQUnPKDkg/5A5zp7pFDuQAj5UFoENpiACU0wlCvzpAGnTkj++ihpKwKyYewn/XNUbKw==}+ engines: {node: '>=18'}++ resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==}+ engines: {node: '>= 8'}+ hasBin: true++ resolution: {integrity: sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==}+ engines: {node: '>=8'}+ hasBin: true++ resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==}+ engines: {node: '>=0.10.0'}++ resolution: {integrity: sha512-Ydggc987+RO0AnWtZ/7Wq9FtNvcrL1b/RO0ud9mWjUPgDrsAAwQSF51sm2hm1XofbU/4jkpGEsLFsZZxU+1DOg==}+ engines: {node: '>=10.0.0'}+ peerDependencies:+ bufferutil: ^4.0.1+ utf-8-validate: '>=5.0.2'+ peerDependenciesMeta:+ bufferutil:+ optional: true+ utf-8-validate:+ optional: true++ resolution: {integrity: sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==}+ engines: {node: '>=18'}++ resolution: {integrity: sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==}++ resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==}++ resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==}+ engines: {node: '>=10'}++ resolution: {integrity: sha512-Q6/nZLe6jxuU80qb/4uJ4t5v2VEZ44lzQjPDhYJNztRQ4wyWc6VF3D3Kb/fAuPetZQnhS3hnajCf9CsWesghLQ==}+ engines: {node: '>=18.0.0'}+ peerDependencies:+ zod: ^3.25.0 || ^4.0.0++ resolution: {integrity: sha512-v5l/aFXZQeai4awLbOpSoHecE9UiMrnfx75tEXLjNonXVARxQ5mOeipTjROUchszUNCqnE+hqAMujRsRHsut2Q==}++ resolution: {integrity: sha512-CHOUy7mu3lbD6o6LJLfllpjkzhHXSBlX8B9+qPddUsIfeF5S/UZ5q0kmCsnRqT1UHFQZchNFDDzMbQsuesHWlw==}+ engines: {node: '>=12.7.0'}+ peerDependencies:+ '@types/react': '>=16.8'+ immer: '>=9.0.6'+ react: '>=16.8'+ peerDependenciesMeta:+ '@types/react':+ optional: true+ immer:+ optional: true+ react:+ optional: true++ resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==}++snapshots:++ '@asamuzakjp/[email protected]':+ dependencies:+ '@csstools/css-calc': 2.1.4(@csstools/[email protected](@csstools/[email protected]))(@csstools/[email protected])+ '@csstools/css-color-parser': 3.1.0(@csstools/[email protected](@csstools/[email protected]))(@csstools/[email protected])+ '@csstools/css-parser-algorithms': 3.0.5(@csstools/[email protected])+ '@csstools/css-tokenizer': 3.0.4+ lru-cache: 10.4.3++ '@babel/[email protected]':+ dependencies:+ '@babel/helper-validator-identifier': 7.29.7+ js-tokens: 4.0.0+ picocolors: 1.1.1++ '@babel/[email protected]': {}++ '@babel/[email protected]':+ dependencies:+ '@babel/code-frame': 7.29.7+ '@babel/generator': 7.29.8+ '@babel/helper-compilation-targets': 7.29.7+ '@babel/helper-module-transforms': 7.29.7(@babel/[email protected])+ '@babel/helpers': 7.29.7+ '@babel/parser': 7.29.9+ '@babel/template': 7.29.7+ '@babel/traverse': 7.29.8+ '@babel/types': 7.29.8+ '@jridgewell/remapping': 2.3.5+ convert-source-map: 2.0.0+ debug: 4.4.3+ gensync: 1.0.0-beta.2+ json5: 2.2.3+ semver: 6.3.1+ transitivePeerDependencies:+ - supports-color++ '@babel/[email protected]':+ dependencies:+ '@babel/parser': 7.29.9+ '@babel/types': 7.29.8+ '@jridgewell/gen-mapping': 0.3.13+ '@jridgewell/trace-mapping': 0.3.31+ jsesc: 3.1.0++ '@babel/[email protected]':+ dependencies:+ '@babel/compat-data': 7.29.7+ '@babel/helper-validator-option': 7.29.7+ browserslist: 4.29.3+ lru-cache: 5.1.1+ semver: 6.3.1++ '@babel/[email protected]': {}++ '@babel/[email protected]':+ dependencies:+ '@babel/traverse': 7.29.8+ '@babel/types': 7.29.8+ transitivePeerDependencies:+ - supports-color++ '@babel/[email protected](@babel/[email protected])':+ dependencies:+ '@babel/core': 7.29.7+ '@babel/helper-module-imports': 7.29.7+ '@babel/helper-validator-identifier': 7.29.7+ '@babel/traverse': 7.29.8+ transitivePeerDependencies:+ - supports-color++ '@babel/[email protected]': {}++ '@babel/[email protected]': {}++ '@babel/[email protected]': {}++ '@babel/[email protected]': {}++ '@babel/[email protected]':+ dependencies:+ '@babel/template': 7.29.7+ '@babel/types': 7.29.8++ '@babel/[email protected]':+ dependencies:+ '@babel/types': 7.29.8++ '@babel/[email protected](@babel/[email protected])':+ dependencies:+ '@babel/core': 7.29.7+ '@babel/helper-plugin-utils': 7.29.7++ '@babel/[email protected](@babel/[email protected])':+ dependencies:+ '@babel/core': 7.29.7+ '@babel/helper-plugin-utils': 7.29.7++ '@babel/[email protected]': {}++ '@babel/[email protected]':+ dependencies:+ '@babel/code-frame': 7.29.7+ '@babel/parser': 7.29.9+ '@babel/types': 7.29.8++ '@babel/[email protected]':+ dependencies:+ '@babel/code-frame': 7.29.7+ '@babel/generator': 7.29.8+ '@babel/helper-globals': 7.29.7+ '@babel/parser': 7.29.9+ '@babel/template': 7.29.7+ '@babel/types': 7.29.8+ debug: 4.4.3+ transitivePeerDependencies:+ - supports-color++ '@babel/[email protected]':+ dependencies:+ '@babel/helper-string-parser': 7.29.7+ '@babel/helper-validator-identifier': 7.29.7++ '@cacheable/[email protected]':+ dependencies:+ '@cacheable/utils': 2.5.0+ '@keyv/bigmap': 1.3.1([email protected])+ hookified: 1.15.1+ keyv: 5.6.0++ '@cacheable/[email protected]':+ dependencies:+ hashery: 1.5.1+ keyv: 5.6.0++ '@csstools/[email protected]': {}++ '@csstools/[email protected](@csstools/[email protected](@csstools/[email protected]))(@csstools/[email protected])':+ dependencies:+ '@csstools/css-parser-algorithms': 3.0.5(@csstools/[email protected])+ '@csstools/css-tokenizer': 3.0.4++ '@csstools/[email protected](@csstools/[email protected](@csstools/[email protected]))(@csstools/[email protected])':+ dependencies:+ '@csstools/color-helpers': 5.1.0+ '@csstools/css-calc': 2.1.4(@csstools/[email protected](@csstools/[email protected]))(@csstools/[email protected])+ '@csstools/css-parser-algorithms': 3.0.5(@csstools/[email protected])+ '@csstools/css-tokenizer': 3.0.4++ '@csstools/[email protected](@csstools/[email protected])':+ dependencies:+ '@csstools/css-tokenizer': 3.0.4++ '@csstools/[email protected]': {}++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ '@esbuild/[email protected]':+ optional: true++ dependencies:+ eslint: 10.11.0([email protected])+ eslint-visitor-keys: 3.4.3++ '@eslint-community/[email protected]': {}++ '@eslint/[email protected]':+ dependencies:+ '@eslint/object-schema': 3.0.5+ debug: 4.4.3+ minimatch: 10.2.6+ transitivePeerDependencies:+ - supports-color++ '@eslint/[email protected]':+ dependencies:+ '@eslint/core': 1.2.1++ '@eslint/[email protected]':+ dependencies:+ '@types/json-schema': 7.0.15++ optionalDependencies:+ eslint: 10.11.0([email protected])++ '@eslint/[email protected]': {}++ '@eslint/[email protected]':+ dependencies:+ '@eslint/core': 1.2.1+ levn: 0.4.1++ '@floating-ui/[email protected]':+ dependencies:+ '@floating-ui/utils': 0.2.12++ '@floating-ui/[email protected]':+ dependencies:+ '@floating-ui/core': 1.8.0+ '@floating-ui/utils': 0.2.12++ dependencies:+ '@floating-ui/dom': 1.8.0+ react: 18.3.1+ react-dom: 18.3.1([email protected])++ dependencies:+ '@floating-ui/utils': 0.2.12+ react: 18.3.1+ react-dom: 18.3.1([email protected])+ tabbable: 6.5.0++ '@floating-ui/[email protected]': {}++ dependencies:+ react: 18.3.1+ react-dom: 18.3.1([email protected])+ use-sync-external-store: 1.7.0([email protected])++ '@humanfs/[email protected]':+ dependencies:+ '@humanfs/types': 0.15.0++ '@humanfs/[email protected]':+ dependencies:+ '@humanfs/core': 0.19.2+ '@humanfs/types': 0.15.0+ '@humanwhocodes/retry': 0.4.3++ '@humanfs/[email protected]': {}++ '@humanwhocodes/[email protected]': {}++ '@humanwhocodes/[email protected]': {}++ '@internationalized/[email protected]':+ dependencies:+ '@swc/helpers': 0.5.23++ '@internationalized/[email protected]':+ dependencies:+ '@swc/helpers': 0.5.23++ '@internationalized/[email protected]':+ dependencies:+ '@swc/helpers': 0.5.23++ '@jridgewell/[email protected]':+ dependencies:+ '@jridgewell/sourcemap-codec': 1.6.0+ '@jridgewell/trace-mapping': 0.3.31++ '@jridgewell/[email protected]':+ dependencies:+ '@jridgewell/gen-mapping': 0.3.13+ '@jridgewell/trace-mapping': 0.3.31++ '@jridgewell/[email protected]': {}++ '@jridgewell/[email protected]': {}++ '@jridgewell/[email protected]':+ dependencies:+ '@jridgewell/resolve-uri': 3.1.2+ '@jridgewell/sourcemap-codec': 1.6.0++ '@keyv/[email protected]([email protected])':+ dependencies:+ hashery: 1.5.1+ hookified: 1.15.1+ keyv: 5.6.0++ '@keyv/[email protected]': {}++ '@napi-rs/[email protected]':+ optional: true++ dependencies:+ '@swc/helpers': 0.5.23+ react: 18.3.1+ react-dom: 18.3.1([email protected])++ dependencies:+ '@react-types/shared': 3.36.1([email protected])+ '@swc/helpers': 0.5.23+ react: 18.3.1+ react-dom: 18.3.1([email protected])++ '@react-types/[email protected]([email protected])':+ dependencies:+ react: 18.3.1++ '@rive-app/[email protected]': {}++ '@rive-app/[email protected]([email protected])':+ dependencies:+ '@rive-app/canvas': 2.44.0+ react: 18.3.1++ '@rolldown/[email protected]': {}++ '@rollup/[email protected]':+ optional: true++ '@rollup/[email protected]':+ optional: true++ '@rollup/[email protected]':+ optional: true++ '@rollup/[email protected]':+ optional: true++ '@rollup/[email protected]':+ optional: true++ '@rollup/[email protected]':+ optional: true++ '@rollup/[email protected]':+ optional: true++ '@rollup/[email protected]':+ optional: true++ '@rollup/[email protected]':+ optional: true++ '@rollup/[email protected]':+ optional: true++ '@rollup/[email protected]':+ optional: true++ '@rollup/[email protected]':+ optional: true++ '@rollup/[email protected]':+ optional: true++ '@rollup/[email protected]':+ optional: true++ '@rollup/[email protected]':+ optional: true++ '@rollup/[email protected]':+ optional: true++ '@rollup/[email protected]':+ optional: true++ '@rollup/[email protected]':+ optional: true++ '@rollup/[email protected]':+ optional: true++ '@rollup/[email protected]':+ optional: true++ '@rollup/[email protected]':+ optional: true++ '@rollup/[email protected]':+ optional: true++ '@rollup/[email protected]':+ optional: true++ '@rollup/[email protected]':+ optional: true++ '@rollup/[email protected]':+ optional: true++ '@shikijs/[email protected]':+ dependencies:+ '@shikijs/types': 3.23.0+ '@shikijs/vscode-textmate': 10.0.2+ '@types/hast': 3.0.5+ hast-util-to-html: 9.0.5++ '@shikijs/[email protected]':+ dependencies:+ '@shikijs/types': 3.23.0+ '@shikijs/vscode-textmate': 10.0.2+ oniguruma-to-es: 4.3.6++ '@shikijs/[email protected]':+ dependencies:+ '@shikijs/types': 3.23.0+ '@shikijs/vscode-textmate': 10.0.2++ '@shikijs/[email protected]':+ dependencies:+ '@shikijs/types': 3.23.0++ '@shikijs/[email protected]':+ dependencies:+ '@shikijs/types': 3.23.0++ '@shikijs/[email protected]':+ dependencies:+ '@shikijs/vscode-textmate': 10.0.2+ '@types/hast': 3.0.5++ '@shikijs/[email protected]': {}++ '@streamdown/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])':+ dependencies:+ mdast-util-gfm-autolink-literal: 2.0.1+ react: 18.3.1+ remark-cjk-friendly: 2.3.1(@types/[email protected])([email protected])([email protected])([email protected])+ remark-cjk-friendly-gfm-strikethrough: 2.3.1(@types/[email protected])([email protected])([email protected])([email protected])+ unist-util-visit: 5.1.0+ transitivePeerDependencies:+ - '@types/mdast'+ - micromark+ - micromark-util-types+ - supports-color+ - unified++ '@streamdown/[email protected]([email protected])':+ dependencies:+ react: 18.3.1+ shiki: 3.23.0++ '@streamdown/[email protected]([email protected])':+ dependencies:+ katex: 0.16.47+ react: 18.3.1+ rehype-katex: 7.0.1+ remark-math: 6.0.0+ transitivePeerDependencies:+ - supports-color++ '@swc/[email protected]':+ dependencies:+ tslib: 2.8.1++ '@tailwindcss/[email protected]':+ dependencies:+ '@jridgewell/remapping': 2.3.5+ enhanced-resolve: 5.26.0+ jiti: 2.7.0+ lightningcss: 1.32.0+ magic-string: 0.30.21+ source-map-js: 1.2.2+ tailwindcss: 4.3.3++ '@tailwindcss/[email protected]':+ optional: true++ '@tailwindcss/[email protected]':+ optional: true++ '@tailwindcss/[email protected]':+ optional: true++ '@tailwindcss/[email protected]':+ optional: true++ '@tailwindcss/[email protected]':+ optional: true++ '@tailwindcss/[email protected]':+ optional: true++ '@tailwindcss/[email protected]':+ optional: true++ '@tailwindcss/[email protected]':+ optional: true++ '@tailwindcss/[email protected]':+ optional: true++ '@tailwindcss/[email protected]':+ optional: true++ '@tailwindcss/[email protected]':+ optional: true++ '@tailwindcss/[email protected]':+ optional: true++ '@tailwindcss/[email protected]':+ optionalDependencies:+ '@tailwindcss/oxide-android-arm64': 4.3.3+ '@tailwindcss/oxide-darwin-arm64': 4.3.3+ '@tailwindcss/oxide-darwin-x64': 4.3.3+ '@tailwindcss/oxide-freebsd-x64': 4.3.3+ '@tailwindcss/oxide-linux-arm-gnueabihf': 4.3.3+ '@tailwindcss/oxide-linux-arm64-gnu': 4.3.3+ '@tailwindcss/oxide-linux-arm64-musl': 4.3.3+ '@tailwindcss/oxide-linux-x64-gnu': 4.3.3+ '@tailwindcss/oxide-linux-x64-musl': 4.3.3+ '@tailwindcss/oxide-wasm32-wasi': 4.3.3+ '@tailwindcss/oxide-win32-arm64-msvc': 4.3.3+ '@tailwindcss/oxide-win32-x64-msvc': 4.3.3++ dependencies:+ '@tailwindcss/node': 4.3.3+ '@tailwindcss/oxide': 4.3.3+ tailwindcss: 4.3.3+ vite: 5.4.21(@types/[email protected])([email protected])++ '@tanstack/[email protected]': {}++ dependencies:+ '@tanstack/history': 1.162.4+ '@tanstack/router-core': 1.171.34+ isbot: 5.2.2+ react: 18.3.1+ react-dom: 18.3.1([email protected])++ dependencies:+ '@tanstack/store': 0.11.2+ react: 18.3.1+ react-dom: 18.3.1([email protected])+ use-sync-external-store: 1.7.0([email protected])++ dependencies:+ '@tanstack/virtual-core': 3.17.11+ react: 18.3.1+ react-dom: 18.3.1([email protected])++ '@tanstack/[email protected]':+ dependencies:+ '@tanstack/history': 1.162.4+ cookie-es: 3.1.1+ seroval: 1.6.8+ seroval-plugins: 1.6.8([email protected])++ '@tanstack/[email protected]':+ dependencies:+ '@babel/types': 7.29.8+ '@tanstack/router-core': 1.171.34+ '@tanstack/router-utils': 1.162.3+ '@tanstack/virtual-file-routes': 1.162.0+ jiti: 2.7.0+ magic-string: 0.30.21+ prettier: 3.9.9+ zod: 4.6.5+ transitivePeerDependencies:+ - supports-color++ '@tanstack/[email protected](@tanstack/[email protected]([email protected]([email protected]))([email protected]))([email protected])([email protected])([email protected](@types/[email protected])([email protected]))':+ dependencies:+ '@babel/core': 7.29.7+ '@babel/template': 7.29.7+ '@babel/types': 7.29.8+ '@tanstack/router-core': 1.171.34+ '@tanstack/router-generator': 1.167.40+ '@tanstack/router-utils': 1.162.3+ chokidar: 5.0.0+ unplugin: 3.4.0([email protected])([email protected])([email protected](@types/[email protected])([email protected]))+ zod: 4.6.5+ optionalDependencies:+ vite: 5.4.21(@types/[email protected])([email protected])+ transitivePeerDependencies:+ - '@farmfe/core'+ - '@rspack/core'+ - bun-types-no-globals+ - esbuild+ - rolldown+ - rollup+ - supports-color+ - unloader++ '@tanstack/[email protected]':+ dependencies:+ '@babel/generator': 7.29.8+ '@babel/parser': 7.29.9+ '@babel/types': 7.29.8+ ansis: 4.4.0+ babel-dead-code-elimination: 1.0.12+ diff: 8.0.4+ pathe: 2.0.3+ tinyglobby: 0.2.17+ transitivePeerDependencies:+ - supports-color++ '@tanstack/[email protected]': {}++ '@tanstack/[email protected]': {}++ '@tanstack/[email protected]': {}++ '@tauri-apps/[email protected]': {}++ '@tauri-apps/[email protected]':+ optional: true++ '@tauri-apps/[email protected]':+ optional: true++ '@tauri-apps/[email protected]':+ optional: true++ '@tauri-apps/[email protected]':+ optional: true++ '@tauri-apps/[email protected]':+ optional: true++ '@tauri-apps/[email protected]':+ optional: true++ '@tauri-apps/[email protected]':+ optional: true++ '@tauri-apps/[email protected]':+ optional: true++ '@tauri-apps/[email protected]':+ optional: true++ '@tauri-apps/[email protected]':+ optional: true++ '@tauri-apps/[email protected]':+ optional: true++ '@tauri-apps/[email protected]':+ optionalDependencies:+ '@tauri-apps/cli-darwin-arm64': 2.12.0+ '@tauri-apps/cli-darwin-x64': 2.12.0+ '@tauri-apps/cli-linux-arm-gnueabihf': 2.12.0+ '@tauri-apps/cli-linux-arm64-gnu': 2.12.0+ '@tauri-apps/cli-linux-arm64-musl': 2.12.0+ '@tauri-apps/cli-linux-riscv64-gnu': 2.12.0+ '@tauri-apps/cli-linux-x64-gnu': 2.12.0+ '@tauri-apps/cli-linux-x64-musl': 2.12.0+ '@tauri-apps/cli-win32-arm64-msvc': 2.12.0+ '@tauri-apps/cli-win32-ia32-msvc': 2.12.0+ '@tauri-apps/cli-win32-x64-msvc': 2.12.0++ '@tauri-apps/[email protected]':+ dependencies:+ '@tauri-apps/api': 2.12.0++ '@testing-library/[email protected]':+ dependencies:+ '@babel/code-frame': 7.29.7+ '@babel/runtime': 7.29.7+ '@types/aria-query': 5.0.4+ aria-query: 5.3.0+ dom-accessibility-api: 0.5.16+ lz-string: 1.5.0+ picocolors: 1.1.1+ pretty-format: 27.5.1++ '@testing-library/[email protected](@testing-library/[email protected])(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])':+ dependencies:+ '@babel/runtime': 7.29.7+ '@testing-library/dom': 10.4.2+ react: 18.3.1+ react-dom: 18.3.1([email protected])+ optionalDependencies:+ '@types/react': 18.3.31+ '@types/react-dom': 18.3.7(@types/[email protected])++ '@types/[email protected]': {}++ '@types/[email protected]':+ dependencies:+ '@babel/parser': 7.29.9+ '@babel/types': 7.29.8+ '@types/babel__generator': 7.27.0+ '@types/babel__template': 7.4.4+ '@types/babel__traverse': 7.28.0++ '@types/[email protected]':+ dependencies:+ '@babel/types': 7.29.8++ '@types/[email protected]':+ dependencies:+ '@babel/parser': 7.29.9+ '@babel/types': 7.29.8++ '@types/[email protected]':+ dependencies:+ '@babel/types': 7.29.8++ '@types/[email protected]':+ dependencies:+ '@types/deep-eql': 4.0.2+ assertion-error: 2.0.1++ '@types/[email protected]':+ dependencies:+ '@types/ms': 2.1.0++ '@types/[email protected]': {}++ '@types/[email protected]': {}++ '@types/[email protected]':+ dependencies:+ '@types/estree': 1.0.9++ '@types/[email protected]': {}++ '@types/[email protected]':+ dependencies:+ '@types/unist': 3.0.3++ '@types/[email protected]': {}++ '@types/[email protected]': {}++ '@types/[email protected]':+ dependencies:+ '@types/unist': 3.0.3++ '@types/[email protected]': {}++ '@types/[email protected]':+ dependencies:+ undici-types: 6.21.0++ '@types/[email protected]': {}++ '@types/[email protected](@types/[email protected])':+ dependencies:+ '@types/react': 18.3.31++ '@types/[email protected]':+ dependencies:+ '@types/prop-types': 15.7.15+ csstype: 3.2.3++ '@types/[email protected]': {}++ '@types/[email protected]': {}++ '@typescript-eslint/[email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])':+ dependencies:+ '@eslint-community/regexpp': 4.12.2+ '@typescript-eslint/scope-manager': 8.71.0+ '@typescript-eslint/visitor-keys': 8.71.0+ eslint: 10.11.0([email protected])+ ignore: 7.0.11+ natural-compare: 1.4.0+ ts-api-utils: 2.5.0([email protected])+ typescript: 5.9.3+ transitivePeerDependencies:+ - supports-color++ dependencies:+ '@typescript-eslint/scope-manager': 8.71.0+ '@typescript-eslint/types': 8.71.0+ '@typescript-eslint/typescript-estree': 8.71.0([email protected])+ '@typescript-eslint/visitor-keys': 8.71.0+ debug: 4.4.3+ eslint: 10.11.0([email protected])+ typescript: 5.9.3+ transitivePeerDependencies:+ - supports-color++ '@typescript-eslint/[email protected]([email protected])':+ dependencies:+ '@typescript-eslint/tsconfig-utils': 8.71.0([email protected])+ '@typescript-eslint/types': 8.71.0+ debug: 4.4.3+ typescript: 5.9.3+ transitivePeerDependencies:+ - supports-color++ '@typescript-eslint/[email protected]':+ dependencies:+ '@typescript-eslint/types': 8.71.0+ '@typescript-eslint/visitor-keys': 8.71.0++ '@typescript-eslint/[email protected]([email protected])':+ dependencies:+ typescript: 5.9.3++ dependencies:+ '@typescript-eslint/types': 8.71.0+ '@typescript-eslint/typescript-estree': 8.71.0([email protected])+ debug: 4.4.3+ eslint: 10.11.0([email protected])+ ts-api-utils: 2.5.0([email protected])+ typescript: 5.9.3+ transitivePeerDependencies:+ - supports-color++ '@typescript-eslint/[email protected]': {}++ '@typescript-eslint/[email protected]([email protected])':+ dependencies:+ '@typescript-eslint/project-service': 8.71.0([email protected])+ '@typescript-eslint/tsconfig-utils': 8.71.0([email protected])+ '@typescript-eslint/types': 8.71.0+ '@typescript-eslint/visitor-keys': 8.71.0+ debug: 4.4.3+ minimatch: 10.2.6+ semver: 7.8.5+ tinyglobby: 0.2.17+ ts-api-utils: 2.5.0([email protected])+ typescript: 5.9.3+ transitivePeerDependencies:+ - supports-color++ dependencies:+ '@eslint-community/eslint-utils': 4.10.1([email protected]([email protected]))+ '@typescript-eslint/scope-manager': 8.71.0+ '@typescript-eslint/types': 8.71.0+ '@typescript-eslint/typescript-estree': 8.71.0([email protected])+ eslint: 10.11.0([email protected])+ typescript: 5.9.3+ transitivePeerDependencies:+ - supports-color++ '@typescript-eslint/[email protected]':+ dependencies:+ '@typescript-eslint/types': 8.71.0+ eslint-visitor-keys: 5.0.1++ '@ungap/[email protected]': {}++ dependencies:+ '@babel/core': 7.29.7+ '@babel/plugin-transform-react-jsx-self': 7.29.7(@babel/[email protected])+ '@babel/plugin-transform-react-jsx-source': 7.29.7(@babel/[email protected])+ '@rolldown/pluginutils': 1.0.0-beta.27+ '@types/babel__core': 7.20.5+ react-refresh: 0.17.0+ vite: 5.4.21(@types/[email protected])([email protected])+ transitivePeerDependencies:+ - supports-color++ '@vitest/[email protected]':+ dependencies:+ '@types/chai': 5.2.3+ '@vitest/spy': 3.2.7+ '@vitest/utils': 3.2.7+ chai: 5.3.3+ tinyrainbow: 2.0.0++ dependencies:+ '@vitest/spy': 3.2.7+ estree-walker: 3.0.3+ magic-string: 0.30.21+ optionalDependencies:+ vite: 5.4.21(@types/[email protected])([email protected])++ '@vitest/[email protected]':+ dependencies:+ tinyrainbow: 2.0.0++ '@vitest/[email protected]':+ dependencies:+ '@vitest/utils': 3.2.7+ pathe: 2.0.3+ strip-literal: 3.1.0++ '@vitest/[email protected]':+ dependencies:+ '@vitest/pretty-format': 3.2.7+ magic-string: 0.30.21+ pathe: 2.0.3++ '@vitest/[email protected]':+ dependencies:+ tinyspy: 4.0.6++ '@vitest/[email protected]':+ dependencies:+ '@vitest/pretty-format': 3.2.7+ loupe: 3.2.1+ tinyrainbow: 2.0.0++ dependencies:+ acorn: 8.18.0++ [email protected]: {}++ [email protected]: {}++ dependencies:+ fast-deep-equal: 3.1.3+ fast-json-stable-stringify: 2.1.0+ json-schema-traverse: 0.4.1+ uri-js: 4.4.1++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ dependencies:+ tslib: 2.8.1++ dependencies:+ dequal: 2.0.3++ [email protected]: {}++ dependencies:+ '@babel/core': 7.29.7+ '@babel/parser': 7.29.9+ '@babel/traverse': 7.29.8+ '@babel/types': 7.29.8+ transitivePeerDependencies:+ - supports-color++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ dependencies:+ balanced-match: 4.0.4++ dependencies:+ baseline-browser-mapping: 2.11.26+ caniuse-lite: 1.0.30001814+ electron-to-chromium: 1.5.443+ node-releases: 2.0.57+ update-browserslist-db: 1.3.3([email protected])++ [email protected]: {}++ dependencies:+ '@cacheable/memory': 2.2.0+ '@cacheable/utils': 2.5.0+ hookified: 1.15.1+ keyv: 5.6.0+ qified: 0.10.1++ [email protected]: {}++ [email protected]: {}++ dependencies:+ assertion-error: 2.0.1+ check-error: 2.1.3+ deep-eql: 5.0.2+ loupe: 3.2.1+ pathval: 2.0.1++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ dependencies:+ readdirp: 5.1.1++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ dependencies:+ path-key: 3.1.1+ shebang-command: 2.0.0+ which: 2.0.2++ dependencies:+ '@asamuzakjp/css-color': 3.2.0+ rrweb-cssom: 0.8.0++ [email protected]: {}++ dependencies:+ whatwg-mimetype: 4.0.0+ whatwg-url: 14.2.0++ [email protected]: {}++ dependencies:+ ms: 2.1.3++ [email protected]: {}++ dependencies:+ character-entities: 2.0.2++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ dependencies:+ dequal: 2.0.3++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ dependencies:+ graceful-fs: 4.2.11+ tapable: 2.3.3++ [email protected]: {}++ [email protected]: {}++ optionalDependencies:+ '@esbuild/aix-ppc64': 0.21.5+ '@esbuild/android-arm': 0.21.5+ '@esbuild/android-arm64': 0.21.5+ '@esbuild/android-x64': 0.21.5+ '@esbuild/darwin-arm64': 0.21.5+ '@esbuild/darwin-x64': 0.21.5+ '@esbuild/freebsd-arm64': 0.21.5+ '@esbuild/freebsd-x64': 0.21.5+ '@esbuild/linux-arm': 0.21.5+ '@esbuild/linux-arm64': 0.21.5+ '@esbuild/linux-ia32': 0.21.5+ '@esbuild/linux-loong64': 0.21.5+ '@esbuild/linux-mips64el': 0.21.5+ '@esbuild/linux-ppc64': 0.21.5+ '@esbuild/linux-riscv64': 0.21.5+ '@esbuild/linux-s390x': 0.21.5+ '@esbuild/linux-x64': 0.21.5+ '@esbuild/netbsd-x64': 0.21.5+ '@esbuild/openbsd-x64': 0.21.5+ '@esbuild/sunos-x64': 0.21.5+ '@esbuild/win32-arm64': 0.21.5+ '@esbuild/win32-ia32': 0.21.5+ '@esbuild/win32-x64': 0.21.5++ optionalDependencies:+ '@esbuild/aix-ppc64': 0.25.9+ '@esbuild/android-arm': 0.25.9+ '@esbuild/android-arm64': 0.25.9+ '@esbuild/android-x64': 0.25.9+ '@esbuild/darwin-arm64': 0.25.9+ '@esbuild/darwin-x64': 0.25.9+ '@esbuild/freebsd-arm64': 0.25.9+ '@esbuild/freebsd-x64': 0.25.9+ '@esbuild/linux-arm': 0.25.9+ '@esbuild/linux-arm64': 0.25.9+ '@esbuild/linux-ia32': 0.25.9+ '@esbuild/linux-loong64': 0.25.9+ '@esbuild/linux-mips64el': 0.25.9+ '@esbuild/linux-ppc64': 0.25.9+ '@esbuild/linux-riscv64': 0.25.9+ '@esbuild/linux-s390x': 0.25.9+ '@esbuild/linux-x64': 0.25.9+ '@esbuild/netbsd-arm64': 0.25.9+ '@esbuild/netbsd-x64': 0.25.9+ '@esbuild/openbsd-arm64': 0.25.9+ '@esbuild/openbsd-x64': 0.25.9+ '@esbuild/openharmony-arm64': 0.25.9+ '@esbuild/sunos-x64': 0.25.9+ '@esbuild/win32-arm64': 0.25.9+ '@esbuild/win32-ia32': 0.25.9+ '@esbuild/win32-x64': 0.25.9+ optional: true++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ dependencies:+ '@babel/core': 7.29.7+ '@babel/parser': 7.29.9+ eslint: 10.11.0([email protected])+ hermes-parser: 0.25.1+ zod: 4.6.5+ zod-validation-error: 4.0.2([email protected])+ transitivePeerDependencies:+ - supports-color++ dependencies:+ '@types/esrecurse': 4.3.1+ '@types/estree': 1.0.9+ esrecurse: 4.3.0+ estraverse: 5.3.0++ [email protected]: {}++ [email protected]: {}++ dependencies:+ '@eslint-community/eslint-utils': 4.10.1([email protected]([email protected]))+ '@eslint-community/regexpp': 4.12.2+ '@eslint/config-array': 0.23.5+ '@eslint/config-helpers': 0.7.0+ '@eslint/core': 1.2.1+ '@eslint/plugin-kit': 0.7.3+ '@humanfs/node': 0.16.8+ '@humanwhocodes/module-importer': 1.0.1+ '@humanwhocodes/retry': 0.4.3+ '@types/estree': 1.0.9+ ajv: 6.15.0+ cross-spawn: 7.0.6+ debug: 4.4.3+ escape-string-regexp: 4.0.0+ eslint-scope: 9.1.2+ eslint-visitor-keys: 5.0.1+ espree: 11.2.0+ esquery: 1.7.0+ esutils: 2.0.3+ fast-deep-equal: 3.1.3+ file-entry-cache: 11.1.5+ find-up: 5.0.0+ glob-parent: 6.0.2+ ignore: 5.3.2+ imurmurhash: 0.1.4+ is-glob: 4.0.3+ json-stable-stringify-without-jsonify: 1.0.1+ minimatch: 10.2.6+ natural-compare: 1.4.0+ optionator: 0.9.4+ optionalDependencies:+ jiti: 2.7.0+ transitivePeerDependencies:+ - supports-color++ dependencies:+ acorn: 8.18.0+ acorn-jsx: 5.3.2([email protected])+ eslint-visitor-keys: 5.0.1++ dependencies:+ estraverse: 5.3.0++ dependencies:+ estraverse: 5.3.0++ [email protected]: {}++ [email protected]: {}++ dependencies:+ '@types/estree': 1.0.9++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ optionalDependencies:+ picomatch: 4.0.7++ dependencies:+ flat-cache: 6.1.23++ dependencies:+ locate-path: 6.0.0+ path-exists: 4.0.0++ dependencies:+ cacheable: 2.5.0+ flatted: 3.4.4+ hookified: 1.15.1++ [email protected]: {}++ dependencies:+ motion-dom: 12.43.0+ motion-utils: 12.39.0+ tslib: 2.8.1+ optionalDependencies:+ react: 18.3.1+ react-dom: 18.3.1([email protected])++ optional: true++ [email protected]: {}++ [email protected]: {}++ dependencies:+ is-glob: 4.0.3++ dependencies:+ csstype: 3.2.3++ [email protected]: {}++ dependencies:+ hookified: 1.15.1++ dependencies:+ '@types/hast': 3.0.5+ hastscript: 9.0.1+ web-namespaces: 2.0.1++ dependencies:+ '@types/hast': 3.0.5+ hast-util-from-dom: 5.0.1+ hast-util-from-html: 2.0.3+ unist-util-remove-position: 5.0.0++ dependencies:+ '@types/hast': 3.0.5+ devlop: 1.1.0+ hast-util-from-parse5: 8.0.3+ parse5: 7.3.0+ vfile: 6.0.3+ vfile-message: 4.0.3++ dependencies:+ '@types/hast': 3.0.5+ '@types/unist': 3.0.3+ devlop: 1.1.0+ hastscript: 9.0.1+ property-information: 7.2.0+ vfile: 6.0.3+ vfile-location: 5.0.3+ web-namespaces: 2.0.1++ dependencies:+ '@types/hast': 3.0.5++ dependencies:+ '@types/hast': 3.0.5++ dependencies:+ '@types/hast': 3.0.5+ '@types/unist': 3.0.3+ '@ungap/structured-clone': 1.4.0+ hast-util-from-parse5: 8.0.3+ hast-util-to-parse5: 8.0.1+ html-void-elements: 3.0.0+ mdast-util-to-hast: 13.2.1+ parse5: 7.3.0+ unist-util-position: 5.0.0+ unist-util-visit: 5.1.0+ vfile: 6.0.3+ web-namespaces: 2.0.1+ zwitch: 2.0.4++ dependencies:+ '@types/hast': 3.0.5+ '@ungap/structured-clone': 1.4.0+ unist-util-position: 5.0.0++ dependencies:+ '@types/hast': 3.0.5+ '@types/unist': 3.0.3+ ccount: 2.0.1+ comma-separated-tokens: 2.0.3+ hast-util-whitespace: 3.0.0+ html-void-elements: 3.0.0+ mdast-util-to-hast: 13.2.1+ property-information: 7.2.0+ space-separated-tokens: 2.0.2+ stringify-entities: 4.0.4+ zwitch: 2.0.4++ dependencies:+ '@types/estree': 1.0.9+ '@types/hast': 3.0.5+ '@types/unist': 3.0.3+ comma-separated-tokens: 2.0.3+ devlop: 1.1.0+ estree-util-is-identifier-name: 3.0.0+ hast-util-whitespace: 3.0.0+ mdast-util-mdx-expression: 2.0.1+ mdast-util-mdx-jsx: 3.2.0+ mdast-util-mdxjs-esm: 2.0.1+ property-information: 7.2.0+ space-separated-tokens: 2.0.2+ style-to-js: 1.1.21+ unist-util-position: 5.0.0+ vfile-message: 4.0.3+ transitivePeerDependencies:+ - supports-color++ dependencies:+ '@types/hast': 3.0.5+ comma-separated-tokens: 2.0.3+ devlop: 1.1.0+ property-information: 7.2.0+ space-separated-tokens: 2.0.2+ web-namespaces: 2.0.1+ zwitch: 2.0.4++ dependencies:+ '@types/hast': 3.0.5+ '@types/unist': 3.0.3+ hast-util-is-element: 3.0.0+ unist-util-find-after: 5.0.0++ dependencies:+ '@types/hast': 3.0.5++ dependencies:+ '@types/hast': 3.0.5+ comma-separated-tokens: 2.0.3+ hast-util-parse-selector: 4.0.0+ property-information: 7.2.0+ space-separated-tokens: 2.0.2++ [email protected]: {}++ dependencies:+ hermes-estree: 0.25.1++ [email protected]: {}++ [email protected]: {}++ dependencies:+ whatwg-encoding: 3.1.1++ [email protected]: {}++ [email protected]: {}++ dependencies:+ agent-base: 7.1.4+ debug: 4.4.3+ transitivePeerDependencies:+ - supports-color++ dependencies:+ agent-base: 7.1.4+ debug: 4.4.3+ transitivePeerDependencies:+ - supports-color++ dependencies:+ safer-buffer: 2.1.2++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ dependencies:+ is-alphabetical: 2.0.1+ is-decimal: 2.0.1++ [email protected]: {}++ [email protected]: {}++ dependencies:+ is-extglob: 2.1.1++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ dependencies:+ cssstyle: 4.6.0+ data-urls: 5.0.0+ decimal.js: 10.6.0+ html-encoding-sniffer: 4.0.0+ http-proxy-agent: 7.0.2+ https-proxy-agent: 7.0.6+ is-potential-custom-element-name: 1.0.1+ nwsapi: 2.2.28+ parse5: 7.3.0+ rrweb-cssom: 0.8.0+ saxes: 6.0.0+ symbol-tree: 3.2.4+ tough-cookie: 5.1.2+ w3c-xmlserializer: 5.0.0+ webidl-conversions: 7.0.0+ whatwg-encoding: 3.1.1+ whatwg-mimetype: 4.0.0+ whatwg-url: 14.2.0+ ws: 8.22.0+ xml-name-validator: 5.0.0+ transitivePeerDependencies:+ - bufferutil+ - supports-color+ - utf-8-validate++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ dependencies:+ lie: 3.3.0+ pako: 1.0.11+ readable-stream: 2.3.8+ setimmediate: 1.0.5++ dependencies:+ commander: 8.3.0++ dependencies:+ '@keyv/serialize': 1.1.1++ dependencies:+ prelude-ls: 1.2.1+ type-check: 0.4.0++ dependencies:+ immediate: 3.0.6++ optional: true++ optional: true++ optional: true++ optional: true++ optional: true++ optional: true++ optional: true++ optional: true++ optional: true++ optional: true++ optional: true++ dependencies:+ detect-libc: 2.1.2+ optionalDependencies:+ lightningcss-android-arm64: 1.32.0+ lightningcss-darwin-arm64: 1.32.0+ lightningcss-darwin-x64: 1.32.0+ lightningcss-freebsd-x64: 1.32.0+ lightningcss-linux-arm-gnueabihf: 1.32.0+ lightningcss-linux-arm64-gnu: 1.32.0+ lightningcss-linux-arm64-musl: 1.32.0+ lightningcss-linux-x64-gnu: 1.32.0+ lightningcss-linux-x64-musl: 1.32.0+ lightningcss-win32-arm64-msvc: 1.32.0+ lightningcss-win32-x64-msvc: 1.32.0++ dependencies:+ p-locate: 5.0.0++ [email protected]: {}++ dependencies:+ js-tokens: 4.0.0++ [email protected]: {}++ [email protected]: {}++ dependencies:+ yallist: 3.1.1++ dependencies:+ react: 18.3.1++ [email protected]: {}++ dependencies:+ '@jridgewell/sourcemap-codec': 1.6.0++ [email protected]: {}++ [email protected]: {}++ dependencies:+ '@types/mdast': 4.0.4+ escape-string-regexp: 5.0.0+ unist-util-is: 6.0.1+ unist-util-visit-parents: 6.0.2++ dependencies:+ '@types/mdast': 4.0.4+ '@types/unist': 3.0.3+ decode-named-character-reference: 1.3.0+ devlop: 1.1.0+ mdast-util-to-string: 4.0.0+ micromark: 4.0.3+ micromark-util-decode-numeric-character-reference: 2.0.2+ micromark-util-decode-string: 2.0.1+ micromark-util-normalize-identifier: 2.0.1+ micromark-util-symbol: 2.0.1+ micromark-util-types: 2.0.3+ unist-util-stringify-position: 4.0.0+ transitivePeerDependencies:+ - supports-color++ dependencies:+ '@types/mdast': 4.0.4+ ccount: 2.0.1+ devlop: 1.1.0+ mdast-util-find-and-replace: 3.0.2+ micromark-util-character: 2.1.1++ dependencies:+ '@types/mdast': 4.0.4+ devlop: 1.1.0+ mdast-util-from-markdown: 2.0.3+ mdast-util-to-markdown: 2.1.3+ micromark-util-normalize-identifier: 2.0.1+ transitivePeerDependencies:+ - supports-color++ dependencies:+ '@types/mdast': 4.0.4+ mdast-util-from-markdown: 2.0.3+ mdast-util-to-markdown: 2.1.3+ transitivePeerDependencies:+ - supports-color++ dependencies:+ '@types/mdast': 4.0.4+ devlop: 1.1.0+ markdown-table: 3.0.4+ mdast-util-from-markdown: 2.0.3+ mdast-util-to-markdown: 2.1.3+ transitivePeerDependencies:+ - supports-color++ dependencies:+ '@types/mdast': 4.0.4+ devlop: 1.1.0+ mdast-util-from-markdown: 2.0.3+ mdast-util-to-markdown: 2.1.3+ transitivePeerDependencies:+ - supports-color++ dependencies:+ mdast-util-from-markdown: 2.0.3+ mdast-util-gfm-autolink-literal: 2.0.1+ mdast-util-gfm-footnote: 2.1.0+ mdast-util-gfm-strikethrough: 2.0.1+ mdast-util-gfm-table: 2.0.0+ mdast-util-gfm-task-list-item: 2.0.0+ mdast-util-to-markdown: 2.1.3+ transitivePeerDependencies:+ - supports-color++ dependencies:+ '@types/hast': 3.0.5+ '@types/mdast': 4.0.4+ devlop: 1.1.0+ longest-streak: 3.1.0+ mdast-util-from-markdown: 2.0.3+ mdast-util-to-markdown: 2.1.3+ unist-util-remove-position: 5.0.0+ transitivePeerDependencies:+ - supports-color++ dependencies:+ '@types/estree-jsx': 1.0.5+ '@types/hast': 3.0.5+ '@types/mdast': 4.0.4+ devlop: 1.1.0+ mdast-util-from-markdown: 2.0.3+ mdast-util-to-markdown: 2.1.3+ transitivePeerDependencies:+ - supports-color++ dependencies:+ '@types/estree-jsx': 1.0.5+ '@types/hast': 3.0.5+ '@types/mdast': 4.0.4+ '@types/unist': 3.0.3+ ccount: 2.0.1+ devlop: 1.1.0+ mdast-util-from-markdown: 2.0.3+ mdast-util-to-markdown: 2.1.3+ parse-entities: 4.0.2+ stringify-entities: 4.0.4+ unist-util-stringify-position: 4.0.0+ vfile-message: 4.0.3+ transitivePeerDependencies:+ - supports-color++ dependencies:+ '@types/estree-jsx': 1.0.5+ '@types/hast': 3.0.5+ '@types/mdast': 4.0.4+ devlop: 1.1.0+ mdast-util-from-markdown: 2.0.3+ mdast-util-to-markdown: 2.1.3+ transitivePeerDependencies:+ - supports-color++ dependencies:+ '@types/mdast': 4.0.4+ unist-util-is: 6.0.1++ dependencies:+ '@types/hast': 3.0.5+ '@types/mdast': 4.0.4+ '@ungap/structured-clone': 1.4.0+ devlop: 1.1.0+ micromark-util-sanitize-uri: 2.0.1+ trim-lines: 3.0.1+ unist-util-position: 5.0.0+ unist-util-visit: 5.1.0+ vfile: 6.0.3++ dependencies:+ mdast-util-gfm-strikethrough: 2.0.1+ mdast-util-to-markdown: 2.1.3+ micromark-extension-cjk-friendly-util: 3.0.1([email protected])+ micromark-util-symbol: 2.0.1+ optionalDependencies:+ '@types/mdast': 4.0.4+ transitivePeerDependencies:+ - micromark-util-types+ - supports-color++ dependencies:+ mdast-util-to-markdown: 2.1.3+ micromark-extension-cjk-friendly-util: 3.0.1([email protected])+ micromark-util-symbol: 2.0.1+ optionalDependencies:+ '@types/mdast': 4.0.4+ transitivePeerDependencies:+ - micromark-util-types++ dependencies:+ '@types/mdast': 4.0.4+ '@types/unist': 3.0.3+ longest-streak: 3.1.0+ mdast-util-phrasing: 4.1.0+ mdast-util-to-string: 4.0.0+ micromark-util-character: 2.1.1+ micromark-util-classify-character: 2.0.1+ micromark-util-decode-string: 2.0.1+ micromark-util-html-tag-name: 2.0.1+ unist-util-visit: 5.1.0+ zwitch: 2.0.4++ dependencies:+ '@types/mdast': 4.0.4++ dependencies:+ decode-named-character-reference: 1.3.0+ devlop: 1.1.0+ micromark-factory-destination: 2.0.1+ micromark-factory-label: 2.0.1+ micromark-factory-space: 2.1.0+ micromark-factory-title: 2.0.1+ micromark-factory-whitespace: 2.0.1+ micromark-util-character: 2.1.1+ micromark-util-chunked: 2.0.1+ micromark-util-classify-character: 2.0.1+ micromark-util-edit-map: 1.0.0+ micromark-util-html-tag-name: 2.0.1+ micromark-util-normalize-identifier: 2.0.1+ micromark-util-resolve-all: 2.0.1+ micromark-util-subtokenize: 2.1.0+ micromark-util-symbol: 2.0.1+ micromark-util-types: 2.0.3++ dependencies:+ devlop: 1.1.0+ get-east-asian-width: 1.7.0+ micromark: 4.0.3+ micromark-extension-cjk-friendly-util: 3.0.1([email protected])+ micromark-util-character: 2.1.1+ micromark-util-chunked: 2.0.1+ micromark-util-resolve-all: 2.0.1+ micromark-util-symbol: 2.0.1+ optionalDependencies:+ micromark-util-types: 2.0.3++ dependencies:+ get-east-asian-width: 1.7.0+ micromark-util-character: 2.1.1+ micromark-util-symbol: 2.0.1+ optionalDependencies:+ micromark-util-types: 2.0.3++ dependencies:+ devlop: 1.1.0+ micromark: 4.0.3+ micromark-extension-cjk-friendly-util: 3.0.1([email protected])+ micromark-util-chunked: 2.0.1+ micromark-util-resolve-all: 2.0.1+ micromark-util-symbol: 2.0.1+ optionalDependencies:+ micromark-util-types: 2.0.3++ dependencies:+ micromark-util-character: 2.1.1+ micromark-util-sanitize-uri: 2.0.1+ micromark-util-symbol: 2.0.1+ micromark-util-types: 2.0.3++ dependencies:+ devlop: 1.1.0+ micromark-core-commonmark: 2.0.4+ micromark-factory-space: 2.1.0+ micromark-util-character: 2.1.1+ micromark-util-normalize-identifier: 2.0.1+ micromark-util-sanitize-uri: 2.0.1+ micromark-util-symbol: 2.0.1+ micromark-util-types: 2.0.3++ dependencies:+ devlop: 1.1.0+ micromark-util-chunked: 2.0.1+ micromark-util-classify-character: 2.0.1+ micromark-util-resolve-all: 2.0.1+ micromark-util-symbol: 2.0.1+ micromark-util-types: 2.0.3++ dependencies:+ devlop: 1.1.0+ micromark-factory-space: 2.1.0+ micromark-util-character: 2.1.1+ micromark-util-symbol: 2.0.1+ micromark-util-types: 2.0.3++ dependencies:+ micromark-util-types: 2.0.3++ dependencies:+ devlop: 1.1.0+ micromark-factory-space: 2.1.0+ micromark-util-character: 2.1.1+ micromark-util-symbol: 2.0.1+ micromark-util-types: 2.0.3++ dependencies:+ micromark-extension-gfm-autolink-literal: 2.1.0+ micromark-extension-gfm-footnote: 2.1.0+ micromark-extension-gfm-strikethrough: 2.1.0+ micromark-extension-gfm-table: 2.1.2+ micromark-extension-gfm-tagfilter: 2.0.0+ micromark-extension-gfm-task-list-item: 2.1.0+ micromark-util-combine-extensions: 2.0.1+ micromark-util-types: 2.0.3++ dependencies:+ '@types/katex': 0.16.8+ devlop: 1.1.0+ katex: 0.16.47+ micromark-factory-space: 2.1.0+ micromark-util-character: 2.1.1+ micromark-util-symbol: 2.0.1+ micromark-util-types: 2.0.3++ dependencies:+ micromark-util-character: 2.1.1+ micromark-util-symbol: 2.0.1+ micromark-util-types: 2.0.3++ dependencies:+ devlop: 1.1.0+ micromark-util-character: 2.1.1+ micromark-util-symbol: 2.0.1+ micromark-util-types: 2.0.3++ dependencies:+ micromark-util-character: 2.1.1+ micromark-util-types: 2.0.3++ dependencies:+ micromark-factory-space: 2.1.0+ micromark-util-character: 2.1.1+ micromark-util-symbol: 2.0.1+ micromark-util-types: 2.0.3++ dependencies:+ micromark-factory-space: 2.1.0+ micromark-util-character: 2.1.1+ micromark-util-symbol: 2.0.1+ micromark-util-types: 2.0.3++ dependencies:+ micromark-util-symbol: 2.0.1+ micromark-util-types: 2.0.3++ dependencies:+ micromark-util-symbol: 2.0.1++ dependencies:+ micromark-util-character: 2.1.1+ micromark-util-symbol: 2.0.1+ micromark-util-types: 2.0.3++ dependencies:+ micromark-util-chunked: 2.0.1+ micromark-util-types: 2.0.3++ dependencies:+ micromark-util-symbol: 2.0.1++ dependencies:+ decode-named-character-reference: 1.3.0+ micromark-util-character: 2.1.1+ micromark-util-decode-numeric-character-reference: 2.0.2+ micromark-util-symbol: 2.0.1++ dependencies:+ micromark-util-types: 2.0.3++ [email protected]: {}++ [email protected]: {}++ dependencies:+ micromark-util-symbol: 2.0.1++ dependencies:+ micromark-util-types: 2.0.3++ dependencies:+ micromark-util-character: 2.1.1+ micromark-util-encode: 2.0.1+ micromark-util-symbol: 2.0.1++ dependencies:+ devlop: 1.1.0+ micromark-util-chunked: 2.0.1+ micromark-util-symbol: 2.0.1+ micromark-util-types: 2.0.3++ [email protected]: {}++ [email protected]: {}++ dependencies:+ '@types/debug': 4.1.13+ debug: 4.4.3+ decode-named-character-reference: 1.3.0+ devlop: 1.1.0+ micromark-core-commonmark: 2.0.4+ micromark-factory-space: 2.1.0+ micromark-util-character: 2.1.1+ micromark-util-chunked: 2.0.1+ micromark-util-combine-extensions: 2.0.1+ micromark-util-decode-numeric-character-reference: 2.0.2+ micromark-util-edit-map: 1.0.0+ micromark-util-encode: 2.0.1+ micromark-util-normalize-identifier: 2.0.1+ micromark-util-resolve-all: 2.0.1+ micromark-util-sanitize-uri: 2.0.1+ micromark-util-subtokenize: 2.1.0+ micromark-util-symbol: 2.0.1+ micromark-util-types: 2.0.3+ transitivePeerDependencies:+ - supports-color++ dependencies:+ brace-expansion: 5.0.12++ dependencies:+ motion-utils: 12.39.0++ [email protected]: {}++ dependencies:+ tslib: 2.8.1+ optionalDependencies:+ react: 18.3.1+ react-dom: 18.3.1([email protected])++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ dependencies:+ oniguruma-parser: 0.12.2+ regex: 6.1.0+ regex-recursion: 6.0.2++ dependencies:+ deep-is: 0.1.4+ fast-levenshtein: 2.0.6+ levn: 0.4.1+ prelude-ls: 1.2.1+ type-check: 0.4.0+ word-wrap: 1.2.5++ dependencies:+ yocto-queue: 0.1.0++ dependencies:+ p-limit: 3.1.0++ [email protected]: {}++ dependencies:+ '@types/unist': 2.0.11+ character-entities-legacy: 3.0.0+ character-reference-invalid: 2.0.1+ decode-named-character-reference: 1.3.0+ is-alphanumerical: 2.0.1+ is-decimal: 2.0.1+ is-hexadecimal: 2.0.1++ dependencies:+ entities: 6.0.1++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ dependencies:+ nanoid: 3.3.19+ picocolors: 1.1.1+ source-map-js: 1.2.2++ [email protected]: {}++ [email protected]: {}++ dependencies:+ ansi-regex: 5.0.1+ ansi-styles: 5.2.0+ react-is: 17.0.2++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ dependencies:+ hookified: 2.2.0++ dependencies:+ '@internationalized/date': 3.12.4+ '@internationalized/number': 3.6.8+ '@internationalized/string': 3.2.10+ '@react-types/shared': 3.36.1([email protected])+ '@swc/helpers': 0.5.23+ aria-hidden: 1.2.6+ clsx: 2.1.1+ react: 18.3.1+ react-dom: 18.3.1([email protected])+ react-stately: 3.50.0([email protected])+ use-sync-external-store: 1.7.0([email protected])++ dependencies:+ loose-envify: 1.4.0+ react: 18.3.1+ scheduler: 0.23.2++ [email protected](@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected]):+ dependencies:+ csstype: 3.2.3+ goober: 2.1.19([email protected])+ react: 18.3.1+ react-dom: 18.3.1([email protected])+ optionalDependencies:+ '@types/react': 18.3.31+ '@types/react-dom': 18.3.7(@types/[email protected])++ [email protected]: {}++ [email protected]: {}++ dependencies:+ '@internationalized/date': 3.12.4+ '@internationalized/number': 3.6.8+ '@internationalized/string': 3.2.10+ '@react-types/shared': 3.36.1([email protected])+ '@swc/helpers': 0.5.23+ react: 18.3.1+ use-sync-external-store: 1.7.0([email protected])++ dependencies:+ loose-envify: 1.4.0++ dependencies:+ core-util-is: 1.0.3+ inherits: 2.0.4+ isarray: 1.0.0+ process-nextick-args: 2.0.1+ safe-buffer: 5.1.2+ string_decoder: 1.1.1+ util-deprecate: 1.0.2++ [email protected]: {}++ dependencies:+ regex-utilities: 2.3.0++ [email protected]: {}++ dependencies:+ regex-utilities: 2.3.0++ dependencies:+ unist-util-visit: 5.1.0++ dependencies:+ '@types/hast': 3.0.5+ '@types/katex': 0.16.8+ hast-util-from-html-isomorphic: 2.0.0+ hast-util-to-text: 4.0.2+ katex: 0.16.47+ unist-util-visit-parents: 6.0.2+ vfile: 6.0.3++ dependencies:+ '@types/hast': 3.0.5+ hast-util-raw: 9.1.0+ vfile: 6.0.3++ dependencies:+ '@types/hast': 3.0.5+ hast-util-sanitize: 5.0.2++ [email protected](@types/[email protected])([email protected])([email protected])([email protected]):+ dependencies:+ mdast-util-to-markdown-cjk-friendly-gfm-strikethrough: 1.0.0(@types/[email protected])([email protected])+ micromark-extension-cjk-friendly-gfm-strikethrough: 2.0.1([email protected])([email protected])+ unified: 11.0.5+ optionalDependencies:+ '@types/mdast': 4.0.4+ transitivePeerDependencies:+ - micromark+ - micromark-util-types+ - supports-color++ [email protected](@types/[email protected])([email protected])([email protected])([email protected]):+ dependencies:+ mdast-util-to-markdown-cjk-friendly: 1.0.0(@types/[email protected])([email protected])+ micromark-extension-cjk-friendly: 2.0.1([email protected])([email protected])+ unified: 11.0.5+ optionalDependencies:+ '@types/mdast': 4.0.4+ transitivePeerDependencies:+ - micromark+ - micromark-util-types++ dependencies:+ '@types/mdast': 4.0.4+ mdast-util-gfm: 3.1.0+ micromark-extension-gfm: 3.0.0+ remark-parse: 11.0.0+ remark-stringify: 11.0.0+ unified: 11.0.5+ transitivePeerDependencies:+ - supports-color++ dependencies:+ '@types/mdast': 4.0.4+ mdast-util-math: 3.0.0+ micromark-extension-math: 3.1.0+ unified: 11.0.5+ transitivePeerDependencies:+ - supports-color++ dependencies:+ '@types/mdast': 4.0.4+ mdast-util-from-markdown: 2.0.3+ micromark-util-types: 2.0.3+ unified: 11.0.5+ transitivePeerDependencies:+ - supports-color++ dependencies:+ '@types/hast': 3.0.5+ '@types/mdast': 4.0.4+ mdast-util-to-hast: 13.2.1+ unified: 11.0.5+ vfile: 6.0.3++ dependencies:+ '@types/mdast': 4.0.4+ mdast-util-to-markdown: 2.1.3+ unified: 11.0.5++ [email protected]: {}++ dependencies:+ '@types/estree': 1.0.9+ optionalDependencies:+ '@napi-rs/lzma-linux-x64-gnu': 1.5.1+ '@rollup/rollup-android-arm-eabi': 4.63.5+ '@rollup/rollup-android-arm64': 4.63.5+ '@rollup/rollup-darwin-arm64': 4.63.5+ '@rollup/rollup-darwin-x64': 4.63.5+ '@rollup/rollup-freebsd-arm64': 4.63.5+ '@rollup/rollup-freebsd-x64': 4.63.5+ '@rollup/rollup-linux-arm-gnueabihf': 4.63.5+ '@rollup/rollup-linux-arm-musleabihf': 4.63.5+ '@rollup/rollup-linux-arm64-gnu': 4.63.5+ '@rollup/rollup-linux-arm64-musl': 4.63.5+ '@rollup/rollup-linux-loong64-gnu': 4.63.5+ '@rollup/rollup-linux-loong64-musl': 4.63.5+ '@rollup/rollup-linux-ppc64-gnu': 4.63.5+ '@rollup/rollup-linux-ppc64-musl': 4.63.5+ '@rollup/rollup-linux-riscv64-gnu': 4.63.5+ '@rollup/rollup-linux-riscv64-musl': 4.63.5+ '@rollup/rollup-linux-s390x-gnu': 4.63.5+ '@rollup/rollup-linux-x64-gnu': 4.63.5+ '@rollup/rollup-linux-x64-musl': 4.63.5+ '@rollup/rollup-openbsd-x64': 4.63.5+ '@rollup/rollup-openharmony-arm64': 4.63.5+ '@rollup/rollup-win32-arm64-msvc': 4.63.5+ '@rollup/rollup-win32-ia32-msvc': 4.63.5+ '@rollup/rollup-win32-x64-gnu': 4.63.5+ '@rollup/rollup-win32-x64-msvc': 4.63.5+ fsevents: 2.3.3++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ dependencies:+ xmlchars: 2.2.0++ dependencies:+ loose-envify: 1.4.0++ [email protected]: {}++ [email protected]: {}++ dependencies:+ seroval: 1.6.8++ [email protected]: {}++ [email protected]: {}++ dependencies:+ shebang-regex: 3.0.0++ [email protected]: {}++ dependencies:+ '@shikijs/core': 3.23.0+ '@shikijs/engine-javascript': 3.23.0+ '@shikijs/engine-oniguruma': 3.23.0+ '@shikijs/langs': 3.23.0+ '@shikijs/themes': 3.23.0+ '@shikijs/types': 3.23.0+ '@shikijs/vscode-textmate': 10.0.2+ '@types/hast': 3.0.5++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ dependencies:+ clsx: 2.1.1+ hast-util-to-jsx-runtime: 2.3.6+ html-url-attributes: 3.0.1+ marked: 18.0.14+ react: 18.3.1+ react-dom: 18.3.1([email protected])+ rehype-harden: 1.1.8+ rehype-raw: 7.0.0+ rehype-sanitize: 6.0.0+ remark-gfm: 4.0.1+ remark-parse: 11.0.0+ remark-rehype: 11.1.2+ remend: 1.4.0+ tailwind-merge: 3.7.0+ unified: 11.0.5+ unist-util-visit: 5.1.0+ unist-util-visit-parents: 6.0.2+ transitivePeerDependencies:+ - supports-color++ dependencies:+ safe-buffer: 5.1.2++ dependencies:+ character-entities-html4: 2.1.0+ character-entities-legacy: 3.0.0++ dependencies:+ js-tokens: 9.0.1++ dependencies:+ style-to-object: 1.0.14++ dependencies:+ inline-style-parser: 0.2.7++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ dependencies:+ fdir: 6.5.0([email protected])+ picomatch: 4.0.7++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ dependencies:+ tldts-core: 6.1.86++ dependencies:+ tldts: 6.1.86++ dependencies:+ punycode: 2.3.1++ [email protected]: {}++ [email protected]: {}++ dependencies:+ typescript: 5.9.3++ [email protected]: {}++ dependencies:+ prelude-ls: 1.2.1++ dependencies:+ '@typescript-eslint/eslint-plugin': 8.71.0(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])+ '@typescript-eslint/typescript-estree': 8.71.0([email protected])+ eslint: 10.11.0([email protected])+ typescript: 5.9.3+ transitivePeerDependencies:+ - supports-color++ [email protected]: {}++ [email protected]: {}++ dependencies:+ '@types/unist': 3.0.3+ bail: 2.0.2+ devlop: 1.1.0+ extend: 3.0.2+ is-plain-obj: 4.1.0+ trough: 2.2.0+ vfile: 6.0.3++ dependencies:+ '@types/unist': 3.0.3+ unist-util-is: 6.0.1++ dependencies:+ '@types/unist': 3.0.3++ dependencies:+ '@types/unist': 3.0.3++ dependencies:+ '@types/unist': 3.0.3+ unist-util-visit: 5.1.0++ dependencies:+ '@types/unist': 3.0.3++ dependencies:+ '@types/unist': 3.0.3+ unist-util-is: 6.0.1++ dependencies:+ '@types/unist': 3.0.3+ unist-util-is: 6.0.1+ unist-util-visit-parents: 6.0.2++ [email protected]([email protected])([email protected])([email protected](@types/[email protected])([email protected])):+ dependencies:+ '@jridgewell/remapping': 2.3.5+ picomatch: 4.0.7+ webpack-virtual-modules: 0.6.2+ optionalDependencies:+ esbuild: 0.25.9+ rollup: 4.63.5+ vite: 5.4.21(@types/[email protected])([email protected])++ dependencies:+ browserslist: 4.29.3+ escalade: 3.2.0+ picocolors: 1.1.1++ dependencies:+ punycode: 2.3.1++ dependencies:+ react: 18.3.1++ [email protected]: {}++ [email protected]: {}++ dependencies:+ '@types/unist': 3.0.3+ vfile: 6.0.3++ dependencies:+ '@types/unist': 3.0.3+ unist-util-stringify-position: 4.0.0++ dependencies:+ '@types/unist': 3.0.3+ vfile-message: 4.0.3++ dependencies:+ cac: 6.7.14+ debug: 4.4.3+ es-module-lexer: 1.7.0+ pathe: 2.0.3+ vite: 5.4.21(@types/[email protected])([email protected])+ transitivePeerDependencies:+ - '@types/node'+ - less+ - lightningcss+ - sass+ - sass-embedded+ - stylus+ - sugarss+ - supports-color+ - terser++ dependencies:+ esbuild: 0.21.5+ postcss: 8.5.28+ rollup: 4.63.5+ optionalDependencies:+ '@types/node': 20.19.43+ fsevents: 2.3.3+ lightningcss: 1.32.0++ [email protected](@types/[email protected])(@types/[email protected])([email protected])([email protected]):+ dependencies:+ '@types/chai': 5.2.3+ '@vitest/expect': 3.2.7+ '@vitest/pretty-format': 3.2.7+ '@vitest/runner': 3.2.7+ '@vitest/snapshot': 3.2.7+ '@vitest/spy': 3.2.7+ '@vitest/utils': 3.2.7+ chai: 5.3.3+ debug: 4.4.3+ expect-type: 1.4.0+ magic-string: 0.30.21+ pathe: 2.0.3+ picomatch: 4.0.7+ std-env: 3.10.0+ tinybench: 2.9.0+ tinyexec: 0.3.2+ tinyglobby: 0.2.17+ tinypool: 1.1.1+ tinyrainbow: 2.0.0+ vite: 5.4.21(@types/[email protected])([email protected])+ vite-node: 3.2.4(@types/[email protected])([email protected])+ why-is-node-running: 2.3.0+ optionalDependencies:+ '@types/debug': 4.1.13+ '@types/node': 20.19.43+ jsdom: 26.1.0+ transitivePeerDependencies:+ - less+ - lightningcss+ - msw+ - sass+ - sass-embedded+ - stylus+ - sugarss+ - supports-color+ - terser++ dependencies:+ xml-name-validator: 5.0.0++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ dependencies:+ iconv-lite: 0.6.3++ [email protected]: {}++ dependencies:+ tr46: 5.1.1+ webidl-conversions: 7.0.0++ dependencies:+ isexe: 2.0.0++ dependencies:+ siginfo: 2.0.0+ stackback: 0.0.2++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ dependencies:+ zod: 4.6.5++ [email protected]: {}++ dependencies:+ use-sync-external-store: 1.7.0([email protected])+ optionalDependencies:+ '@types/react': 18.3.31+ react: 18.3.1++ [email protected]: {}diff --git a/apps/mirai-gui/vite.config.ts b/apps/mirai-gui/vite.config.tsnew file mode 100644index 000000000..2de275305--- /dev/null+++ b/apps/mirai-gui/vite.config.ts@@ -0,0 +1,40 @@+import tailwindcss from "@tailwindcss/vite";+import { tanstackRouter } from "@tanstack/router-plugin/vite";+import react from "@vitejs/plugin-react";+import path from "path";+import { defineConfig } from "vitest/config";++// `--mode web` builds the browser variant; vitest runs with mode "test".+export default defineConfig(({ mode }) => {+ const platform = mode === "web" || mode === "test" ? "web" : "tauri";+ return {+ plugins: [+ react(),+ tailwindcss(),+ ...(mode === "test"+ ? []+ : [+ tanstackRouter({+ routesDirectory: path.join(__dirname, "client/src/routes"),+ generatedRouteTree: path.join(__dirname, "client/src/route-tree.gen.ts"),+ routeFileIgnorePattern: "\\.test\\..*$",+ }),+ ]),+ ],+ root: path.join(__dirname, "client"),+ build: {+ outDir: path.join(__dirname, `client/dist-${platform}`),+ emptyOutDir: true,+ },+ server: { port: platform === "web" ? 3001 : 3002, strictPort: true },+ resolve: { alias: { "@": path.resolve(__dirname, "client/src") } },+ define: { __PLATFORM__: JSON.stringify(platform) },+ optimizeDeps: { include: ["shiki"] },+ assetsInclude: ["**/*.wasm"],+ test: {+ environment: "jsdom",+ include: ["src/**/*.test.{ts,tsx}"],+ css: false,+ },+ };+});diff --git a/crates/legacy/cli-tools/src/release/mirai_gui.rs b/crates/legacy/cli-tools/src/release/mirai_gui.rsnew file mode 100644index 000000000..036f46c31--- /dev/null+++ b/crates/legacy/cli-tools/src/release/mirai_gui.rs@@ -0,0 +1,10 @@+use anyhow::Result;++use crate::{configs::Paths, types::Command};++pub fn update_lock(paths: &Paths) -> Result<()> {+ Command::new("cargo")+ .with_arguments(["update", "--workspace", "--manifest-path"].map(String::from).to_vec())+ .with_argument(&paths.root_path.join("apps/mirai-gui/desktop/Cargo.toml").to_string_lossy())+ .run()+}diff --git a/crates/legacy/cli-tools/src/release/mod.rs b/crates/legacy/cli-tools/src/release/mod.rsindex 3bf2950f0..b0a14f13b 100644--- a/crates/legacy/cli-tools/src/release/mod.rs+++ b/crates/legacy/cli-tools/src/release/mod.rs@@ -1,4 +1,5 @@mod binaries;+mod mirai_gui;mod platform;mod version;@@ -24,6 +25,7 @@ pub fn run_release(bump_workspace_version(version)?;run_sync(false)?;+ mirai_gui::update_lock(&paths)?;let platforms = PlatformsConfig::load()?;let workspace = WorkspaceManifest::load()?;diff --git a/crates/legacy/cli-tools/src/sync/mirai_gui.rs b/crates/legacy/cli-tools/src/sync/mirai_gui.rsnew file mode 100644index 000000000..4f2b1d7ea--- /dev/null+++ b/crates/legacy/cli-tools/src/sync/mirai_gui.rs@@ -0,0 +1,50 @@+use anyhow::{Context, Result};+use regex::Regex;+use toml_edit::{DocumentMut, value};++use crate::{+ configs::{PlatformsConfig, WorkspaceManifest},+ sync::SyncTask,+};++pub enum MiraiGuiSyncTask {+ PackageJson,+ CargoToml,+ TauriConf,+}++impl SyncTask for MiraiGuiSyncTask {+ fn process(+ &self,+ platforms: &PlatformsConfig,+ workspace: &WorkspaceManifest,+ input: &str,+ ) -> Result<String> {+ let version = &workspace.workspace.package.version;+ match self {+ Self::PackageJson => replace_string_field(input, "version", version),+ Self::CargoToml => {+ let mut document: DocumentMut = input.parse()?;+ document["package"]["version"] = value(version);+ Ok(document.to_string())+ },+ Self::TauriConf => {+ let target = platforms+ .envs+ .get("MACOSX_DEPLOYMENT_TARGET")+ .context("Missing MACOSX_DEPLOYMENT_TARGET in platforms.toml [envs]")?;+ replace_string_field(input, "minimumSystemVersion", target)+ },+ }+ }+}++fn replace_string_field(+ input: &str,+ key: &str,+ value: &str,+) -> Result<String> {+ let regex = Regex::new(&format!(r#"("{key}"\s*:\s*)"[^"]*""#))?;+ let literal = serde_json::to_string(value)?;+ Ok(regex.replace(input, format!("$1{literal}").as_str()).into_owned())+}diff --git a/crates/legacy/cli-tools/src/sync/mod.rs b/crates/legacy/cli-tools/src/sync/mod.rsindex 294f973a1..02bec92cf 100644--- a/crates/legacy/cli-tools/src/sync/mod.rs+++ b/crates/legacy/cli-tools/src/sync/mod.rs@@ -3,6 +3,7 @@ use std::path::Path;mod docs;mod jsr;mod license;+mod mirai_gui;mod package_json;mod playground;mod pyproject;@@ -13,6 +14,7 @@ mod toolchains;use anyhow::{Ok, Result, anyhow};pub use jsr::JsrSyncTask;pub use license::LicenseSyncTask;+pub use mirai_gui::MiraiGuiSyncTask;pub use package_json::PackageJsonSyncTask;pub use playground::PlaygroundSyncTask;pub use pyproject::PyprojectSyncTask;@@ -100,6 +102,11 @@ pub fn run_sync(check: bool) -> Result<()> {PlaygroundSyncTask.run(&platforms, &workspace, &root_path.join("apps/playground/Project.swift"), check)?;+ let mirai_gui_path = root_path.join("apps/mirai-gui");+ MiraiGuiSyncTask::PackageJson.run(&platforms, &workspace, &mirai_gui_path.join("package.json"), check)?;+ MiraiGuiSyncTask::CargoToml.run(&platforms, &workspace, &mirai_gui_path.join("desktop/Cargo.toml"), check)?;+ MiraiGuiSyncTask::TauriConf.run(&platforms, &workspace, &mirai_gui_path.join("desktop/tauri.conf.json"), check)?;+docs::sync_docs(&platforms, root_path, check)?;Ok(())