diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..06c0d8f --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,5 @@ +[target.x86_64-pc-windows-msvc] +rustflags = ["-C", "target-feature=+crt-static"] + +[target.aarch64-pc-windows-msvc] +rustflags = ["-C", "target-feature=+crt-static"] \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9110d3c..7b94b3d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,8 +6,12 @@ on: pull_request: jobs: - windows: - runs-on: windows-latest + check: + strategy: + fail-fast: false + matrix: + os: [windows-latest, ubuntu-latest, macos-latest] + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable @@ -17,6 +21,52 @@ jobs: - run: cargo build --workspace --locked - run: cargo clippy --workspace --all-targets --locked -- -D warnings - run: cargo test --workspace --locked + + install: + strategy: + fail-fast: false + matrix: + include: + - os: windows-latest + target: x86_64-pc-windows-msvc + - os: ubuntu-latest + target: x86_64-unknown-linux-musl + - os: macos-latest + target: aarch64-apple-darwin + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.target }} + - uses: Swatinem/rust-cache@v2 + with: + key: ${{ matrix.target }} + - if: contains(matrix.target, 'musl') + run: sudo apt-get update && sudo apt-get install -y musl-tools + - run: cargo build -p quill-code --locked --target ${{ matrix.target }} + - shell: bash + run: | + binary="target/${{ matrix.target }}/debug/quill" + if [ "$RUNNER_OS" = Windows ]; then binary="$binary.exe"; fi + sh scripts/package.sh ${{ matrix.target }} "$binary" dist + cat dist/*.sha256 > dist/SHA256SUMS + - if: runner.os != 'Windows' + run: | + QUILL_DOWNLOAD_URL="$PWD/dist" sh install.sh + "$HOME/.local/bin/quill" --version + - if: runner.os == 'Windows' + shell: powershell + run: | + $env:QUILL_DOWNLOAD_URL = Join-Path $PWD 'dist' + Get-Content -Raw install.ps1 | Invoke-Expression + quill --version + if ($LASTEXITCODE -ne 0) { throw 'quill did not start from the PATH' } + + deny: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 - uses: EmbarkStudios/cargo-deny-action@v2 with: command: check licenses bans sources \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..4310713 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,124 @@ +name: Release + +on: + push: + branches: [main] + workflow_dispatch: + +concurrency: + group: release + cancel-in-progress: false + +permissions: + contents: write + +jobs: + prepare: + runs-on: ubuntu-latest + outputs: + version: ${{ steps.version.outputs.version }} + release: ${{ steps.version.outputs.release }} + notes: ${{ steps.changelog.outputs.notes }} + steps: + - uses: actions/checkout@v4 + - id: version + env: + GH_TOKEN: ${{ github.token }} + run: | + version=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.name == "quill-code") | .version') + echo "version=$version" >> "$GITHUB_OUTPUT" + state=$(gh release list --limit 1000 --json tagName,isDraft --jq ".[] | select(.tagName == \"v$version\") | if .isDraft then \"draft\" else \"published\" end") + if [ "$state" = "published" ]; then + echo "v$version is already published. Bump the version in Cargo.toml to make a new release." + echo "release=false" >> "$GITHUB_OUTPUT" + else + echo "release=true" >> "$GITHUB_OUTPUT" + fi + - id: changelog + if: steps.version.outputs.release == 'true' + env: + VERSION: ${{ steps.version.outputs.version }} + run: | + if ! awk -v v="[$VERSION]" '$1 == "##" && $2 == v && $3 == "-" && $4 ~ /^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$/ { found = 1 } END { exit !found }' CHANGELOG.md; then + echo "::error file=CHANGELOG.md::No '## [$VERSION] - YYYY-MM-DD' section in CHANGELOG.md" + exit 1 + fi + { + echo "notes<> "$GITHUB_OUTPUT" + + build: + needs: prepare + if: needs.prepare.outputs.release == 'true' + strategy: + fail-fast: true + matrix: + include: + - os: windows-latest + target: x86_64-pc-windows-msvc + - os: ubuntu-latest + target: x86_64-unknown-linux-musl + - os: ubuntu-24.04-arm + target: aarch64-unknown-linux-musl + - os: macos-latest + target: aarch64-apple-darwin + - os: macos-latest + target: x86_64-apple-darwin + cross: true + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.target }} + - uses: Swatinem/rust-cache@v2 + with: + key: ${{ matrix.target }} + - if: contains(matrix.target, 'musl') + run: sudo apt-get update && sudo apt-get install -y musl-tools + - run: cargo build -p quill-code --release --locked --target ${{ matrix.target }} + - shell: bash + run: | + binary="target/${{ matrix.target }}/release/quill" + if [ "$RUNNER_OS" = Windows ]; then binary="$binary.exe"; fi + if [ "${{ matrix.cross }}" != "true" ]; then "$binary" --version; fi + sh scripts/package.sh ${{ matrix.target }} "$binary" dist + - uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.target }} + path: dist/* + if-no-files-found: error + + release: + needs: [prepare, build] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + path: dist + merge-multiple: true + - env: + GH_TOKEN: ${{ github.token }} + TAG: v${{ needs.prepare.outputs.version }} + NOTES: ${{ needs.prepare.outputs.notes }} + run: | + cp install.sh install.ps1 dist/ + cd dist + cat *.sha256 > SHA256SUMS + rm *.sha256 + sha256sum install.sh install.ps1 >> SHA256SUMS + { + printf '%s\n\n' "$NOTES" + printf '## Install\n\n' + printf 'macOS and Linux:\n\n```\ncurl -fsSL https://github.com/%s/releases/latest/download/install.sh | sh\n```\n\n' "$GITHUB_REPOSITORY" + printf 'Windows (PowerShell):\n\n```\nirm https://github.com/%s/releases/latest/download/install.ps1 | iex\n```\n\n' "$GITHUB_REPOSITORY" + printf 'Already installed? Run `quill update`, or `quill update ` to switch to another release.\n' + } > ../notes.md + for id in $(gh api "repos/$GITHUB_REPOSITORY/releases" --paginate --jq ".[] | select(.draft and .tag_name == \"$TAG\") | .id"); do + echo "Replacing the earlier draft of $TAG" + gh api -X DELETE "repos/$GITHUB_REPOSITORY/releases/$id" + done + gh release create "$TAG" * --repo "$GITHUB_REPOSITORY" --target "$GITHUB_SHA" --title "Quill Code $TAG" --notes-file ../notes.md --draft \ No newline at end of file diff --git a/.github/workflows/verify-release.yml b/.github/workflows/verify-release.yml new file mode 100644 index 0000000..349b5bb --- /dev/null +++ b/.github/workflows/verify-release.yml @@ -0,0 +1,40 @@ +name: Verify release + +on: + release: + types: [published] + workflow_dispatch: + inputs: + version: + description: Version to check, for example 1.0.1 + required: true + +jobs: + install: + strategy: + fail-fast: false + matrix: + os: [windows-latest, ubuntu-latest, ubuntu-24.04-arm, macos-latest] + runs-on: ${{ matrix.os }} + env: + TAG: ${{ github.event.release.tag_name || inputs.version }} + steps: + - if: runner.os != 'Windows' + run: | + version="${TAG#v}" + curl -fsSL "https://github.com/$GITHUB_REPOSITORY/releases/download/v$version/install.sh" | QUILL_VERSION="$version" sh + "$HOME/.local/bin/quill" --version | grep -Fx "quill $version" + "$HOME/.local/bin/quill" update | grep -F "is the latest version" + "$HOME/.local/bin/quill" versions | grep -E "^$version +.*installed" + - if: runner.os == 'Windows' + shell: powershell + run: | + $version = $env:TAG.TrimStart('v') + $env:QUILL_VERSION = $version + irm "https://github.com/$env:GITHUB_REPOSITORY/releases/download/v$version/install.ps1" | iex + $installed = quill --version + if ($installed -ne "quill $version") { throw "Installed $installed, expected quill $version" } + $update = quill update + if ($update -notmatch "is the latest version") { throw "quill update said: $update" } + $listed = quill versions | Where-Object { $_ -match "^$([regex]::Escape($version)) +.*installed" } + if (-not $listed) { throw "quill versions does not list $version as installed" } \ No newline at end of file diff --git a/.gitignore b/.gitignore index c41cc9e..3cd9f2a 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -/target \ No newline at end of file +/target +docs/demo/tour.gif \ No newline at end of file diff --git a/AGENTS.md b/AGENTS.md index c9021ff..3e384f5 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,92 +1,139 @@ ## quill-code -A native desktop control surface for coding agents on local models. The assistant is always Quill; the model picker only chooses which model powers it. The workflow follows the shape the general app agents app (projects, threads, a composer with model, reasoning and access chips, approvals, step-by-step tool rows, a diff panel and a files panel), Rust, GPUI through `gpui-kit`, Windows first. MIT licensed. +A terminal coding agent for local models. The binary is `quill`; the assistant is always Quill, and the model picker only chooses which model powers it. It is a full-screen terminal program: the conversation scrolls inside Quill above a live area that holds the activity line, the prompt, approvals, pickers and a status line, and the session is printed into the terminal's scrollback on exit. Rust and crossterm, for Windows, Linux and macOS. MIT licensed. ## Commands | Command | Does | | --- | --- | -| `cargo run -p quill-code` | Build and start the app | +| `cargo run -p quill-code` | Build and start `quill` in the current folder | +| `cargo run -p quill-code -- exec ""` | One headless turn: text to stdout, progress to stderr, `--json` for the event stream | | `cargo test --workspace` | Every unit test | | `cargo clippy --workspace --all-targets` | Lints, must be clean | | `cargo fmt --all` | Formatting (`rustfmt.toml`); strip the trailing newline it adds | | `cargo deny check` | Licence and banned-crate policy (`deny.toml`) | -| `cargo run -p quill-agent --example probe -- ""` | Run one agent turn headless in `%TEMP%\quill-probe` | +| `cargo run -p quill-core --example probe -- ""` | Run one agent turn against a raw server address in `%TEMP%\quill-probe` | +| `vhs docs/demo/demo.tape` | Record the README's demo GIF again (`tour.tape` for its screenshots); needs VHS, ttyd and a running model | -CI (`.github/workflows/ci.yml`, Windows) runs build, clippy, test and `cargo deny check`. All must stay green. +CI (`.github/workflows/ci.yml`) builds, lints with `-D warnings` and tests on Windows, Linux and macOS, packs and installs a debug build with both install scripts, and runs `cargo deny check` once. All must stay green. + +Releases (`.github/workflows/release.yml`) run on every push to `main` whose workspace version has no published release. The version needs a `## [] - ` section in `CHANGELOG.md`, whose body becomes the release notes. Windows (x64), Linux (x64 and ARM, static musl) and both macOS targets are built, packed by `scripts/package.sh` as `quill--` with a checksum, and attached with `SHA256SUMS`, `install.sh` and `install.ps1` to a draft release `Quill Code v` tagged `v`. Merging again with the same version rebuilds and replaces the draft. It is published by hand, which runs `verify-release.yml`: it installs the release on every system and checks `quill --version`, `quill update` and `quill versions`. Keep the archive names and `SHA256SUMS` as they are, because `quill update ` installs old releases with the newest installer. ## Rules that do not bend -- **No telemetry.** No analytics, crash reporting or update pings. The app talks only to the model server the user configured, to git remotes through the user's own `git`, and to the GitHub API for what the user asked for: creating a repository, opening a pull request, and reading pull request status for branches whose origin is on GitHub. `deny.toml` bans the usual telemetry crates; do not add network calls anywhere else. -- **Permissive licences only.** The project is MIT. Dependencies must pass `cargo deny check`; the only exceptions are build-time `option-ext` (MPL-2.0) and the `webpki-root-certs` data crate (CDLA-Permissive-2.0) that ureq's `native-tls` feature pulls in. Never depend on or copy from Zed's GPL crates (anything in the Zed repository other than `gpui`). Nothing GPL is bundled: Git features use the user's installed `git` and say "Needs Git" without it. -- **GitHub sign-in is Git's.** The app never stores a token. `github.rs` asks `git credential fill` for one, so Git Credential Manager signs the user in the first time they publish. Background checks pass `GCM_INTERACTIVE=never` so they can never pop a sign-in window. -- **Models are detected, not configured.** `/v1/models` gives the list, status, vision and the window size (llama.cpp `meta.n_ctx` or `--ctx-size`, vLLM `max_model_len`, LM Studio `loaded_context_length`, then `context_length`). `/props?model=` gives llama.cpp's template capabilities; reading it for an unloaded model loads it, so it is only read for the selected model. +- **No telemetry.** No analytics, crash reporting or update pings. quill talks only to the model servers the user configured, to git remotes through the user's own `git`, and to GitHub for what the user asked for: creating a repository, opening a pull request, reading pull request status for branches whose origin is on GitHub, and listing or downloading releases for `quill update`, `quill versions` and `/version`. `deny.toml` bans the usual telemetry crates; do not add network calls anywhere else. +- **Permissive licences only.** The project is MIT. Dependencies must pass `cargo deny check` for every release target; the exceptions are the `webpki-roots` certificate data (CDLA-Permissive-2.0) that ureq's rustls pulls in, and `clipboard-win` and `error-code` (BSL-1.0) that arboard's Windows clipboard pulls in. Unmaintained-crate advisories are checked for direct dependencies only (`unmaintained = "workspace"`). Nothing GPL is bundled: Git features use the user's installed `git` and say so when it is missing. +- **GitHub sign-in is Git's.** quill never stores a token. `github.rs` asks `git credential fill` for one, so Git Credential Manager signs the user in the first time they publish. Background checks pass `GCM_INTERACTIVE=never` so they can never pop a sign-in window, and `GIT_TERMINAL_PROMPT=0` keeps Git from prompting inside the screen. +- **Models are detected, not configured.** Each server kind is read in its own way: OpenAI-compatible `/v1/models` gives the list, status and vision, and the window from llama.cpp's `meta.n_ctx` or `--ctx-size`, vLLM's `max_model_len`, then `loaded_context_length` or `context_length`; LM Studio's `/api/v1/models` gives loaded instances, their context and vision; Ollama's `/api/tags` and `/api/show` give capabilities and context length, and models without `completion` are left out. llama.cpp's `/props?model=` gives the template's tool and vision support; reading it for an unloaded model loads it, so it is only read for the selected model once it is loaded or used. How a model controls its reasoning comes from `quill_providers::profiles` and the user's `models.profiles`. Settings (`models.overrides`) only fill in what a server does not report. +- **Keys stay with the server they belong to.** A server that needs a key gets one during setup or `/connect` (every kind except Ollama and GPT4All asks); it is saved as the provider's `key` in `settings.json` and sent only to that provider's address as a Bearer token. ## Layout ``` crates/ - quill-llama/ OpenAI-compatible client tuned for llama.cpp: models, props, streaming chat with tool-call deltas and usage - quill-agent/ the agent engine, no UI - lib.rs agent loop (stream, collect tool calls, approve, execute, repeat), Access, Approval, Publisher - prompt.rs Quill's system prompt: identity, workspace, tools, native shell guidance, workflow, git, reply - tools.rs list/read/search/write/edit/run plus commit_changes and open_pull_request, path guard, aliases, shell runner + quill-providers/ model access, no UI: the Provider trait, Model, Props, ChatRequest, streaming events with tool-call + deltas, Tokens, stop reasons + openai.rs OpenAI-compatible chat completions for llama.cpp, vLLM, Jan, GPT4All and the rest; /props + lmstudio.rs LM Studio's model list on top of the OpenAI-compatible chat + ollama.rs Ollama's native API: tags, show, chat + profiles.rs model families and how they control reasoning (effort, a toggle kwarg, or none), Tuning per request + message.rs chat messages with images, tool calls and reasoning (sent as reasoning_content, kept in the saved history) + quill-core/ the agent engine, no UI + protocol.rs Event (serde, tagged) and the shared types: ToolView, Approval, Decision, PlanStep, Question, Outcome + session.rs one thread per session: Op queue (Turn, Steer, Decide, Answer, Compact, Shutdown), inbox, history, + TurnContext + turn.rs the turn loop: stream, collect calls, admit (prepare, policy, approval), run read-only batches in parallel + policy.rs Access presets, Effect, Rule and verdicts, read-only command detection, discards_work + context.rs token estimate, auto-compaction (summary under fixed headings, recent files read back), trimming old tool output + options.rs Limits, Toolsets and Shell, with their defaults + prompt.rs Quill's system prompt, built from the enabled tools + tools/ the Tool trait and registry: find_files, grep, read_file, write_file, edit_file, shell, update_plan, + ask_user, commit_changes, open_pull_request; aliases, lenient arguments, path guard, .editorconfig diff.rs line diffs grouped into hunks - instructions.rs AGENTS.md, CLAUDE.md (with @imports), GEMINI.md, copilot instructions + instructions.rs the project's instruction files (AGENTS.md, CLAUDE.md with @imports, GEMINI.md, copilot instructions) examples/probe.rs headless agent run against a real server + quill-git/ the user's git: status snapshot, commit, branch, push, worktrees, remote parsing; github.rs for the GitHub API + quill-config/ typed settings in layers (defaults, settings.json in the settings folder, a project's .quill/settings.json), + limits and rules for the engine, paths per system; models.rs (server kinds, providers, model references, + role models, overrides) quill-weave/ the weave mark's maths - quill-code/ the desktop app - main.rs startup: fonts, assets, config, palette, window - shell.rs window: title bar, sidebar timeline, layout, menus, toasts, repo and pull request caches - workspace.rs model: threads, runs (several at once), approvals, isolated copies, persistence hooks - thread.rs Thread, Turn and Item data, summaries, history repair (serde, tested) - thread_view.rs transcript: bubbles with image previews, step rows, final answer, changes card - composer.rs prompt box: chips, slash commands, @ mentions, attachments, context ring, approval card, workspace strip - context_ring.rs context gauge and its label - commit_dialog.rs commit, new branch, push, pull request page, publish to GitHub - publish.rs the app's Publisher: what commit_changes and open_pull_request do - git.rs status snapshot, commit, branch, push, worktrees, remote parsing - github.rs repository and pull request API through Git's stored credential - terminal.rs PowerShell drawer - panel.rs right panel: Review and Files tabs - add_project.rs Add project sheet: start fresh (first branch, optional GitHub repo), open a folder, clone - settings.rs Settings: General, Models, Instructions, Projects, Version - backend.rs model server connection, selected model, detected thinking + quill-code/ the `quill` binary + main.rs the command line (clap): the screen, exec, models, usage, update, versions, config; Msg, the one message + type every background thread reports through + app.rs the screen: keys, pastes, scrolling, session events and probes in one state machine; slash commands, + pickers, the trust prompt, approval and question cards, status line, the event loop + term.rs raw mode, the alternate screen, Layout::frame (transcript plus live area, row by row, scroll offset), + the input thread with paste detection, suspending the screen for an editor + history.rs turns as styled lines: prompt, tool rows with timings, grouped reads, searches and commands, diffs, command + output, plan, questions, reasoning, the ending; Progress adds each piece once it settles + markdown.rs markdown to wrapped lines: headings, lists, quotes, code blocks, tables, links + text.rs styled spans and lines, word and character wrapping, truncation, cleaning terminal noise from output + composer.rs the prompt editor: multi-line editing, word moves, prompt history, pasted paths as attachments + picker.rs a list picker with filtering, used by /model, /effort, /mode, /resume, /branch, /version, the trust prompt + and the commit flow + setup.rs the first run and /connect: which app runs the models, servers already running, address and key, models + commit.rs /commit: files, branch, message (the model writes it when empty), commit, push, pull request page, publish + exec.rs quill exec: one headless turn; approvals declined, questions answered "decide for yourself", Ctrl+C stops + update.rs quill update, quill versions and /version: GitHub releases, running the release's install script + commands.rs quill models, usage and config + workspace.rs threads, one session at a time, the run, approvals, questions, steering, isolated copies + backend.rs every server's connection and models, the selected model, its reasoning control (toggle or effort), + one-shot writers for a model, local server scan, props + thread.rs Thread, Turn and Item data (tools, plans, questions, steers, notes), history repair, older formats + usage.rs usage log (usage.jsonl, one line per finished turn, seeded from existing threads) and the /usage report mentions.rs slash commands, @ file index and ranking attachments.rs images as data URLs, text files as fenced blocks - project.rs badges, create, clone, open in VS Code or Explorer - store.rs threads in %APPDATA%\quill-code\threads, sent images in ...\images\ - config.rs settings in %APPDATA%\quill-code\config.json; projects in ~/.quill-code/projects, isolated copies in ~/.quill-code/worktrees - icons.rs the Icon enum; every SVG is embedded - version.rs, weave.rs, palette.rs, assets.rs, ui.rs -assets/ brand/ (weave icons), icons/ (interface icons), fonts/ (Open Sans, OFL) + clipboard.rs the clipboard's image as a PNG file, for Alt+V + store.rs threads in the settings folder's threads/, sent images in images/ + config.rs the settings: load, save on every change, reload when the file changes, refuse to save over a broken file + project.rs, weave.rs (the weave drawn in braille) +brand/ app icons and favicons (the weave mark) +docs/ images/ for the README; demo/ with the VHS tapes, setup.ps1 and the sample project they record +scripts/ package.sh packs a release archive +install.sh, install.ps1 the one-line installers ``` ## How a turn runs -`Workspace::send` builds a `quill_agent::Task`: Quill's system prompt, the full history, the access mode and, when the workdir is a Git repository, a `Publisher` that gives the agent `commit_changes` and `open_pull_request`. It runs `quill_agent::run` on the background executor. Events come back through an unbounded channel and `Workspace::apply` turns them into `Item`s on the turn; `Usage` sets the thread's `context_used`, which the context ring shows against the model's window. Every run is keyed by thread and turn index, so a stopped run can never write into a newer turn. Anything the access mode does not allow waits on an `mpsc` reply that the approval card answers. Stop sets the run's `AtomicBool`; `repair_history` answers any tool call left without a result, because llama.cpp templates reject dangling tool calls. Threads are saved when a turn starts and finishes; a turn still running at shutdown is marked Stopped on load. +Each thread gets a `quill_core` session the first time it sends, started with the thread's history; the screen keeps one session at a time and shuts it down when another thread is opened. `Workspace::send` builds a `TurnContext` (provider, model, summariser, tuning, context window, workdir, access, toolsets, personal and project instructions, limits, rules) and sends `Op::Turn` with a fresh cancel flag. A prompt sent while the selected server is still being probed, or while a stopped turn is still winding down, is queued and sent once it can be. The session owns the history: it pushes every message itself and reports it with `Event::Message`, which the workspace mirrors into the thread for saving. Events come back through the `Msg` channel and `Workspace::apply` turns them into `Item`s; every turn event carries its turn index, so a stopped run can never write into a newer turn. `history::Progress` then adds each item to the transcript once it settles: a tool when it ends, text paragraph by paragraph (never inside an open code fence), a run of reads, searches and commands when it is over, and finally the outcome, the changed files and a footer. Whatever has not settled is drawn in the live area. + +Messages typed while a run is going become `Op::Steer` and are added before the next step. A tool is prepared first (so edits have their diff), then the policy decides; anything that needs the user emits `ApprovalRequested` and waits for `Op::Decide`, and `ask_user` waits for `Op::Answer`. Stop (Esc, or Ctrl+C) sets the cancel flag; a running command is killed with everything it started, and the engine answers every open tool call, because llama.cpp templates reject dangling tool calls. When the window fills past the compaction threshold, old tool output is trimmed and then earlier turns are summarised, keeping the request and its latest steps word for word and reading the most recent files back from disk; a turn compacts at most three times. `/compact` does it on demand and says why when there is nothing to compact (`Event::CompactFailed`). Threads are saved when a turn starts and finishes; a turn still running at shutdown is marked Stopped on load. + +Access modes: Ask first runs read-only commands on its own (`permissions.safe_commands`, with no redirection or substitution) and asks before edits, other commands, commits and pull requests; Trust edits also makes edits on its own; Autopilot never asks. Commands that throw work away (`git checkout -- `, `git restore`, `git reset --hard`, `git clean`, dropping stashes, a forced push, recursive deletes; `policy::discards_work`) ask in every mode unless a rule allows them. Rules (allow, ask or deny a tool, optionally for a command prefix) override the preset, the last matching one winning; the approval card's "Always allow" choices add rules for the session, and "Allow everything in this thread" raises the session to Autopilot. `quill exec --access` overrides the mode for one run, project settings included. + +## Settings + +Everything that can be tuned is a typed field in `quill_config::Settings` (`general`, `appearance`, `models`, `agent`, `tools`, `permissions`), saved as `settings.json` in the settings folder (`%APPDATA%\quill-code` on Windows, `~/Library/Application Support/quill-code` on macOS, `$XDG_CONFIG_HOME/quill-code` or `~/.config/quill-code` on Linux); nothing tunable is hard-coded elsewhere. Saving keeps keys this version does not know, so going back and forward between versions loses nothing. Personal instructions live in `~/.quill-code/AGENTS.md` and isolated copies in `~/.quill-code/worktrees` unless `general.worktrees_dir` says otherwise. The screen changes the common settings itself (`/model` and its pins, `/effort`, `/mode`, `/connect`, the trust prompt), and `quill config edit` opens the file in `VISUAL`, `EDITOR` or the system's editor. A turn uses the user's settings with the project's `.quill/settings.json` merged on top (objects merge, values and lists replace), so a project can set its own rules, tools or limits. `Settings::limits()` turns them into the engine's `Limits`. A new setting needs a field with a default in `quill-config`; give it a slash command too if people will change it often. + +## Usage -Access modes: Ask first asks before edits, commits, commands and pull requests; Trust edits asks only before commands and pull requests; Autopilot never asks. "Allow everything in this thread" raises the mode inside the running agent only. +Every model call reports `Tokens` (prompt, completion, cache read), summed on the turn and shown in its footer. Each finished or stopped turn is appended to `usage.jsonl` in the settings folder, so overall totals survive deleting threads; `/usage` and `quill usage` print them for today, 7 days, 30 days and all time. -## Sidebar +## Status line -Threads are grouped into In motion (running or waiting on the user), Past day, Past week and Older. Each row shows the project badge, title and age; the project and branch; then the current commit, uncommitted file count, unpushed commit count, pull request number and state, and a live weave mark seeded from the thread's model. Repo state comes from one `git status --porcelain=v2 --branch` per workdir, cached until a run ends or the window is activated; pull request state is fetched in the background with the same invalidation. +The last line of the screen shows the access mode, the model, its reasoning setting (thinking or direct, or the effort level), the project (and "(isolated)" for a worktree) with its branch, uncommitted (●) and unpushed (↑) counts, the pull request number and state, the share of the context window used with "compacts soon" when it is close, and key hints when there is room. Repo state comes from one `git status --porcelain=v2 --branch` on a background thread, refreshed when the screen starts, when a run ends, and after commits, branch changes and opening a thread; pull request state is fetched after it with the same refresh. -## GPUI notes +## Terminal notes -- Any notified view redraws the whole window unless a view is embedded with `.cached(StyleRefinement::default().size_full())`. The live weave marks animate every frame, so heavy views (`ThreadView`, `Panel`, `Settings`) are cached and observe the `Workspace` model instead of being rebuilt by the shell. -- The title bar's row is a Windows drag area. Interactive elements inside it need `.occlude()` or clicks become window drags. -- Keystroke interceptors run before key bindings and are used for popup navigation, Escape, Ctrl+1 to 9 and terminal history. Calling `stop_propagation` there keeps the key from the text field. -- Rust 2024 captures every lifetime in `impl Trait` returns; helper methods that build elements return `impl IntoElement + use<>`. +- The screen uses the alternate screen with mouse capture and bracketed paste. `term::Layout::frame` keeps the whole transcript, picks the rows that fit above the live area for the current scroll offset, and repaints only the rows that changed, inside synchronized updates. While scrolled up, the last row says how many lines are below. `Screen::finish` prints the transcript into the normal scrollback on exit, and `Screen::suspend` leaves the screen while an editor runs. +- Keep every line narrower than the terminal (wrap to `Layout::room()`); `frame` truncates anything longer, which cuts text off. +- crossterm on Windows reports a resize as the console buffer size plus one, so the size is read again with `terminal::size()`. Windows also reports key releases; they are dropped in `term::translate`. +- Windows consoles deliver a paste as a burst of key events, so `term::translate` turns a burst of typed keys into one paste, where Enter is a new line rather than a send. +- crossterm drops colours when `NO_COLOR` is set; unset it when recording the demo or checking colours. +- Child processes run with stdin closed and their output piped (and `CREATE_NO_WINDOW` on Windows), so they never read the keyboard or draw over the screen. Commands run in the shell from `tools.shell` (Windows PowerShell, pwsh, cmd, bash, which is Git Bash on Windows, or sh). Stopping a command kills its whole tree: `taskkill /T` on Windows, the command's own process group on Unix. +- Every line is built by pure functions (`history`, `markdown`, `composer`, `picker`, `setup`), so they are tested without a terminal, and `term.rs` checks its frames against a small virtual terminal. +- Rust 2024 captures every lifetime in `impl Trait` returns; keep helpers returning owned lines. ## Look and feel -- One theme: the dark palette and its light counterpart, following the Windows setting live. Every colour lives in `palette.rs`; components read `palette(cx)`. -- Open Sans everywhere (`palette::FONT`), Consolas for code (`ui::MONO`). -- The weave is drawn live, never as an image, and stays monochrome; `quill-weave` is pinned by tests to exact reference frames. Model marks are the same weave seeded from the model's name. -- Interface icons are our own, drawn in one style (24 viewBox, 1.5 stroke), all in `assets/icons` and listed in `icons.rs`. Draw a new icon in that style rather than borrowing another product's. +- Colours come from the terminal's own palette, so the screen follows any light or dark theme: `text::accent`, `good`, `bad` and `warn` are the dark ANSI cyan, green, red and yellow, plus `dim` and `bold`; diff lines are shaded with 256-colour backgrounds. Never hard-code RGB. +- Prompts start with `›`. Tool rows look like Claude Code's: a `●` (green when done, red when failed, a braille spinner while running) before `Name(target)` with the whole target wrapped, and the result hangs under `└`. A run of finished reads, searches and shell commands collapses into one dim summary line. List selections are marked `▸` and the current choice `✓`. Diffs show one line number with additions in green and removals in red. Notices start with `·`, problems with `!`. +- A dim rule separates the conversation from the prompt; the status line sits at the bottom. +- The weave is drawn live from `quill-weave` as braille on the welcome banner and stays monochrome; `quill-weave` is pinned by tests to exact reference frames. +- Keys: Enter sends (and steers while Quill works), Shift+Enter, Alt+Enter or Ctrl+J add a line, Shift+Tab switches the access mode, Ctrl+O shows thoughts in full or as a summary, Page Up, Page Down and the mouse wheel scroll (Ctrl+Home and Ctrl+End jump), Esc stops or closes, Ctrl+C clears, stops, or quits when pressed twice, Ctrl+D quits on an empty prompt, ↑ and ↓ recall earlier prompts, Tab takes a suggestion, Alt+V attaches an image from the clipboard. ## Conventions - Match the surrounding code. Keep functions short and readable, avoid clever abstractions. -- Keep `cargo build` and clippy warning-free. \ No newline at end of file +- Keep `cargo build` and clippy warning-free on every platform. +- Work on `dev`; `main` only receives merges for releases. Add user-facing changes to `## [Unreleased]` in `CHANGELOG.md`. \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..25262a3 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,66 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [1.0.0] - 2026-10-19 + +### Added + +- `quill`, a command-line program for Windows, Linux and macOS, with a one-line install (`curl ... | sh`, or `irm ... | iex` on Windows) that checks the download against the release's checksums and needs no admin rights and no Rust. +- Self-contained builds: one static Linux binary for every distribution on x64 and ARM, Windows without the Visual C++ runtime, and macOS for Apple silicon and Intel. TLS is pure Rust (rustls) and uses the system's certificates. +- Support for llama.cpp, LM Studio, Ollama, vLLM, Jan, GPT4All and any other OpenAI-compatible server you run. +- A first run that asks which app runs your models, finds the servers already running and lists their models, or says what to set up. /connect adds another server at any time. +- A trust prompt the first time Quill Code opens a folder. +- Model profiles: how each model family controls its reasoning lives in one table, and settings.json can add or override profiles without a rebuild. gpt-oss gets low, medium and high reasoning effort through /effort. +- Auto-compaction near the end of the context window: old command output is trimmed first, then the conversation is summarised and the task carries on where it stopped, with the request and its latest steps kept word for word. The summary follows fixed headings, and Quill adds the list of files read or changed and the latest plan, telling the model to read a file again before editing it; the five files worked on most recently are read back from disk into the new context. If the server still reports a full context, Quill compacts once and tries again. A turn compacts at most three times, then says the task needs a bigger window. +- /instructions (or /memory) opens your personal AGENTS.md, which every session reads, in your editor. +- Quill can ask up to four questions at once: pick an answer with the arrow keys, press Enter again to confirm, or type your own on the "Something else" row. ← and → switch between questions, and the answers go back together once all are in. +- `tools.final_newline`: files keep their final newline, or their lack of one, unless an edit changes it, and new files follow `.editorconfig`. Set it to `add` to end every file with a newline, or to `remove` to end files right after their last character, except patches, diffs, crontabs and files `.editorconfig` asks to keep one. Diffs say "No newline at end of file" when an edit changes only that. +- `/version`, `quill versions` and `quill update ` switch to any published release, and the one-line install takes `QUILL_VERSION` to install a particular one. `/version` reinstalls and reopens Quill Code on the thread you were in. +- `quill exec` runs one task headless for scripts and CI, with `--json` for the event stream; `quill models`, `quill usage` and `quill config` replace the settings pages. +- Slash commands: /new, /clear, /resume, /model with pins, /effort, /mode, /init, /compact, /retry, /diff, /usage, /commit, /branch, /rename, /version and /help, plus @ file mentions and attachments by pasting a path. +- A full-screen view: the conversation scrolls inside Quill with the mouse wheel, Page Up and Page Down while the prompt stays fixed at the bottom, and the session is printed into the terminal's scrollback on exit. +- Thoughts show as a short summary made of whole sentences that refreshes every few seconds; ctrl+o shows them in full. + +### Changed + +- Quill Code is a command-line program instead of a desktop window, so nothing needs a GPU, Vulkan, Xcode's Metal tools or bundled fonts any more. +- Quill Code runs on local models only. +- Fewer, clearer tools, shaped like Claude Code's, and Quill is told to use the system's own commands rather than scripts. +- read_file marks each line with → and says when a file ends with a newline, so small models copy indentation exactly and can see the newline to remove it. +- Shell commands that edit files with a script (python -c, sed -i, Set-Content, echo into a file and the like) are refused, and the model is told to use edit_file or write_file so every change shows as a diff. +- Tool rows in the style of Claude Code: details hang off a ⎿, a running command shows its full text with its time and line count, and edits show a summary and a diff with shaded added and removed lines. The activity line says Processing, not Thinking, while the model reads tool results. +- Every turn prints as it settles: tool rows with timings, grouped exploring, diffs, command output, plans, questions, reasoning and the answer as rendered markdown, with tables and code blocks. +- The prompt sits at the bottom of the window between two rules, with a status line below it that shows the model, access mode, branch, uncommitted and unpushed work, pull request and context. The access mode leads it in its own colour (green Ask first, yellow Trust edits, blue Autopilot), and Shift+Tab switches it. +- Your messages and answers stand out on a shaded background, Quill's replies start with ●, reasoning shows live as it streams, and tool rows are marked ✓ or ✗. +- Quill Code opens on a clear screen with an animated weave, the activity line carries a small weave that moves one way while Quill thinks and another while it writes, and the cursor stays steady while the screen redraws. +- Settings live in the platform's own folder on each system and are written atomically. Settings and threads keep the fields an older version does not know, so moving between versions loses nothing. + +### Removed + +- The desktop window. +- Claude Code, the Anthropic and OpenAI APIs, and cost tracking; /usage counts tokens. +- The list_dir and apply_patch tools: find_files and shell cover listing, and edit_file and write_file cover changes. + +### Fixed + +- Small models that get indentation wrong in an edit no longer break the file: the replacement keeps the file's own indentation. +- Small models no longer commit or open pull requests on their own: those tools only run when your message asks for a commit, a push or a pull request. +- Stopping a command ends everything it started, not only the shell. + +## [0.1.0] - 2026-10-14 + +### Added + +- Projects and threads, with several agents running at once and a sidebar that shows each thread's branch, commit, uncommitted work, unpushed commits, pull request and model. +- A tool-calling agent that lists, reads, searches, writes and edits files, runs commands, commits and opens pull requests, under Ask first, Trust edits and Autopilot access modes. +- Isolated copies (git worktrees) so parallel threads never collide. +- A commit dialog that can push, open a pull request page or publish a new GitHub repository, and new projects that can start on GitHub with a first branch of your choosing. +- Slash commands, @ file mentions, image and file attachments with previews, pinned models with Ctrl+1 to 9, a context ring, a PowerShell drawer and saved history. +- Models, context windows, vision and thinking controls detected from the server. + +[unreleased]: https://github.com/Smoffyy/quill-code/compare/v1.0.0...HEAD +[1.0.0]: https://github.com/Smoffyy/quill-code/releases/tag/v1.0.0 \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 767b5ff..eccafe2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3,1769 +3,1485 @@ version = 4 [[package]] -name = "accesskit" -version = "0.24.1" +name = "adler2" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3b7f7f85a7e5f68090000ed7622545829afd484d210358702ae4cb97dd0c320" -dependencies = [ - "enumn", - "uuid", -] +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" [[package]] -name = "accesskit_atspi_common" -version = "0.19.1" +name = "aho-corasick" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "023da0e5097f46df7092d5280b02efb9bbf8d93298daeced42652463e357d636" +checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba" dependencies = [ - "accesskit", - "accesskit_consumer", - "atspi-common", - "phf 0.13.1", - "serde", - "zvariant", + "memchr", ] [[package]] -name = "accesskit_consumer" -version = "0.38.0" +name = "anstream" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d10a236f96f87d70732e44520046785431ef01d5bcd6b041317bfadd2f88245" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" dependencies = [ - "accesskit", - "hashbrown 0.16.1", + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", ] [[package]] -name = "accesskit_macos" -version = "0.26.3" +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 = "ce02dc63b43f0c9296af9ac946312a2dc8814427d7a64d2d600971dac55b6076" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" dependencies = [ - "accesskit", - "accesskit_consumer", - "hashbrown 0.16.1", - "objc2 0.5.3", - "objc2-app-kit 0.2.2", - "objc2-foundation 0.2.2", + "utf8parse", ] [[package]] -name = "accesskit_unix" -version = "0.22.1" +name = "anstyle-query" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03e156ed3802e35eefe894ef2671bc6c889303d8a7e110b5e1b48f504b91362f" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" dependencies = [ - "accesskit", - "accesskit_atspi_common", - "async-channel", - "async-executor", - "async-task", - "atspi", - "futures-lite", - "futures-util", - "serde", - "zbus", + "windows-sys 0.61.2", ] [[package]] -name = "accesskit_windows" -version = "0.34.0" +name = "anstyle-wincon" +version = "3.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "106c2b961215864d1c2e703ee63269c25c4e80a577ffb2c1017b9c17dcdf83a1" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" dependencies = [ - "accesskit", - "accesskit_consumer", - "hashbrown 0.16.1", - "static_assertions", - "windows 0.62.2", - "windows-core 0.62.2", + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", ] [[package]] -name = "addr2line" -version = "0.25.1" +name = "arboard" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" +checksum = "aeb9553e62312c8756a5979254fc6d7da8bbeb5986a1e17037fab932f7037917" dependencies = [ - "gimli", + "clipboard-win", + "image", + "log", + "objc2", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation", + "parking_lot", + "percent-encoding", + "windows-sys 0.61.2", + "x11rb", ] [[package]] -name = "adler2" -version = "2.0.1" +name = "autocfg" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" [[package]] -name = "aes" -version = "0.8.4" +name = "base64" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" -dependencies = [ - "cfg-if", - "cipher", - "cpufeatures 0.2.17", - "zeroize", -] +checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" [[package]] -name = "ahash" -version = "0.8.12" +name = "bitflags" +version = "2.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" -dependencies = [ - "cfg-if", - "const-random", - "once_cell", - "version_check", - "zerocopy", -] +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" [[package]] -name = "aho-corasick" -version = "1.1.5" +name = "block2" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba" +checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" dependencies = [ - "memchr", + "objc2", ] [[package]] -name = "aligned" -version = "0.4.3" +name = "bstr" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee4508988c62edf04abd8d92897fca0c2995d907ce1dfeaf369dac3716a40685" +checksum = "6bb31b46c14244e20ee9984b11bf5c992b91fb6939fea616e3512c8baecdbe5f" dependencies = [ - "as-slice", + "memchr", + "serde_core", ] [[package]] -name = "aligned-vec" -version = "0.6.4" +name = "bytemuck" +version = "1.25.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc890384c8602f339876ded803c97ad529f3842aba97f6392b3dba0dd171769b" -dependencies = [ - "equator", -] +checksum = "95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797" [[package]] -name = "allocator-api2" -version = "0.2.21" +name = "byteorder-lite" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" +checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" [[package]] -name = "android_system_properties" -version = "0.1.6" +name = "bytes" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc" -dependencies = [ - "libc", -] +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" [[package]] -name = "annotate-snippets" -version = "0.12.16" +name = "cc" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f211a51805bc641f3ad5b7664c77d2547af685cc33b4cd8d31964027a46f13f1" +checksum = "6651c9ed80effdc7db0ff72512157f901af5e3549e341e24b1dd4887d836d838" dependencies = [ - "anstyle", - "memchr", - "unicode-width", + "find-msvc-tools", + "shlex", ] [[package]] -name = "anstyle" -version = "1.0.14" +name = "cfg-if" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" [[package]] -name = "anyhow" -version = "1.0.104" +name = "cfg_aliases" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" +checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" [[package]] -name = "arbitrary" -version = "1.5.0" +name = "clap" +version = "4.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bc62ac97cc33321f50863d514c3bc38a453947a8f9e781137e47c7401020aed" +checksum = "aa8876b300ab35ba921adea3dfd70157a46249b33f95c9084ae5709785478946" +dependencies = [ + "clap_builder", + "clap_derive", +] [[package]] -name = "arc-swap" -version = "1.9.2" +name = "clap_builder" +version = "4.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c049c0be4daef0b145cb3555416b3b8ef5b7888a38aea1a3a155801fe7b0810b" +checksum = "ec0797fb7aeb1406c84efac526901f7ec3ead2124f946b494e72879d4b54704d" dependencies = [ - "rustversion", + "anstream", + "anstyle", + "clap_lex", + "strsim", ] [[package]] -name = "arg_enum_proc_macro" -version = "0.3.4" +name = "clap_derive" +version = "4.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea" +checksum = "f9c751b79415d4e559e3d1fcf128e09e720eb673a06d26cf6f392d37d75b66e0" dependencies = [ + "heck", "proc-macro2", "quote", - "syn 2.0.119", + "syn 3.0.9", ] [[package]] -name = "arraydeque" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d902e3d592a523def97af8f317b08ce16b7ab854c1985a0c671e6f15cebc236" - -[[package]] -name = "arrayref" -version = "0.3.9" +name = "clap_lex" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" +checksum = "1c133bc6a41be0d194c306b5506d15e6feeea7b1d6604bd3f8310dfb2ca96486" [[package]] -name = "arrayvec" -version = "0.7.8" +name = "clipboard-win" +version = "5.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56" +checksum = "bde03770d3df201d4fb868f2c9c59e66a3e4e2bd06692a0fe701e7103c7e84d4" +dependencies = [ + "error-code", +] [[package]] -name = "as-raw-xcb-connection" -version = "1.0.1" +name = "colorchoice" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b" +checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" [[package]] -name = "as-slice" -version = "0.2.1" +name = "combine" +version = "4.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516" +checksum = "4356eba6976435498d05a311ee9fc486da3bc81c200d3f0d7dd9703b41913f92" dependencies = [ - "stable_deref_trait", + "bytes", + "memchr", ] [[package]] -name = "ash" -version = "0.38.0+1.3.281" +name = "cookie" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f" +checksum = "1a373e3602691c3cdea496d2f0ee5935151e6168fe87739483c463db1b2f2f87" dependencies = [ - "libloading", + "percent-encoding", + "time", + "version_check", ] [[package]] -name = "ashpd" -version = "0.13.13" +name = "cookie_store" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb8421aaa9644a5faf26735f258b669b15f063313ef8f8e2bdb28912a1a6f111" +checksum = "15b2c103cf610ec6cae3da84a766285b42fd16aad564758459e6ecf128c75206" dependencies = [ - "enumflags2", - "futures-channel", - "futures-util", - "getrandom 0.4.3", + "cookie", + "document-features", + "idna", + "indexmap", + "log", "serde", - "serde_repr", - "wayland-backend", - "wayland-client", - "wayland-protocols", - "zbus", + "serde_derive", + "serde_json", + "time", + "url", ] [[package]] -name = "async-broadcast" -version = "0.7.2" +name = "core-foundation" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" dependencies = [ - "event-listener", - "event-listener-strategy", - "futures-core", - "pin-project-lite", + "core-foundation-sys", + "libc", ] [[package]] -name = "async-channel" -version = "2.5.0" +name = "core-foundation-sys" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2" -dependencies = [ - "concurrent-queue", - "event-listener-strategy", - "futures-core", - "pin-project-lite", -] +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] -name = "async-executor" -version = "1.14.0" +name = "crc32fast" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c96bf972d85afc50bf5ab8fe2d54d1586b4e0b46c97c50a0c9e71e2f7bcd812a" +checksum = "01a7799fd6b852db0e61728dde9a204c423b44d689dbd432522543614b490e78" dependencies = [ - "async-task", - "concurrent-queue", - "fastrand", - "futures-lite", - "pin-project-lite", - "slab", + "cfg-if", ] [[package]] -name = "async-fs" -version = "2.2.0" +name = "crossbeam-deque" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8034a681df4aed8b8edbd7fbe472401ecf009251c8b40556b304567052e294c5" +checksum = "622f3fc73690be383c7214310406f28a90e6edeadc3cea882f9d71e495b9711a" dependencies = [ - "async-lock", - "blocking", - "futures-lite", + "crossbeam-epoch", + "crossbeam-utils", ] [[package]] -name = "async-io" -version = "2.6.0" +name = "crossbeam-epoch" +version = "0.9.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc" +checksum = "dc74980687109a3b14c72fd458107bf0baa1da1a1a805e178d15501ba9b86d9d" dependencies = [ - "autocfg", - "cfg-if", - "concurrent-queue", - "futures-io", - "futures-lite", - "parking", - "polling", - "rustix", - "slab", - "windows-sys 0.61.2", + "crossbeam-utils", ] [[package]] -name = "async-lock" -version = "3.4.2" +name = "crossbeam-utils" +version = "0.8.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f7f2596bd5b78a9fec8088ccd89180d7f9f55b94b0576823bbbdc72ee8311" -dependencies = [ - "event-listener", - "event-listener-strategy", - "pin-project-lite", -] +checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" [[package]] -name = "async-net" -version = "2.0.0" +name = "crossterm" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b948000fad4873c1c9339d60f2623323a0cfd3816e5181033c6a5cb68b2accf7" +checksum = "d8b9f2e4c67f833b660cdb0a3523065869fb35570177239812ed4c905aeff87b" dependencies = [ - "async-io", - "blocking", - "futures-lite", + "bitflags", + "crossterm_winapi", + "document-features", + "mio", + "parking_lot", + "rustix", + "signal-hook", + "signal-hook-mio", + "winapi", ] [[package]] -name = "async-process" -version = "2.5.0" +name = "crossterm_winapi" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc50921ec0055cdd8a16de48773bfeec5c972598674347252c0399676be7da75" +checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" dependencies = [ - "async-channel", - "async-io", - "async-lock", - "async-signal", - "async-task", - "blocking", - "cfg-if", - "event-listener", - "futures-lite", - "rustix", + "winapi", ] [[package]] -name = "async-recursion" -version = "1.2.0" +name = "crunchy" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f8abc12baad266b1c8cec146854c195b5864b4221d4b2ca7296a7ae82d9e451" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", -] +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" [[package]] -name = "async-signal" -version = "0.2.14" +name = "ctrlc" +version = "3.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52b5aaafa020cf5053a01f2a60e8ff5dccf550f0f77ec54a4e47285ac2bab485" +checksum = "e0b1fab2ae45819af2d0731d60f2afe17227ebb1a1538a236da84c93e9a60162" dependencies = [ - "async-io", - "async-lock", - "atomic-waker", - "cfg-if", - "futures-core", - "futures-io", - "rustix", - "signal-hook-registry", - "slab", + "dispatch2", + "nix", "windows-sys 0.61.2", ] [[package]] -name = "async-task" -version = "4.7.1" +name = "deranged" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" +checksum = "9e9de72ce2ad1f90dc62fa25f0f430ef85eb4b0d8fa0be4f30373bc40a21d28e" [[package]] -name = "async-trait" -version = "0.1.92" +name = "dispatch2" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667" +checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38" dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", + "bitflags", + "block2", + "libc", + "objc2", ] [[package]] -name = "atomic-waker" -version = "1.1.2" +name = "displaydoc" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" +checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] [[package]] -name = "atspi" -version = "0.29.0" +name = "document-features" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c77886257be21c9cd89a4ae7e64860c6f0eefca799bb79127913052bd0eefb3d" +checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61" dependencies = [ - "atspi-common", - "atspi-proxies", + "litrs", ] [[package]] -name = "atspi-common" -version = "0.13.0" +name = "equivalent" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20c5617155740c98003016429ad13fe43ce7a77b007479350a9f8bf95a29f63d" -dependencies = [ - "enumflags2", - "serde", - "static_assertions", - "zbus", - "zbus-lockstep", - "zbus-lockstep-macros", - "zbus_names", - "zvariant", -] +checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826" [[package]] -name = "atspi-proxies" -version = "0.13.0" +name = "errno" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2230e48787ed3eb4088996eab66a32ca20c0b67bbd4fd6cdfe79f04f1f04c9fc" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ - "atspi-common", - "serde", - "zbus", + "libc", + "windows-sys 0.61.2", ] [[package]] -name = "autocfg" -version = "1.5.1" +name = "error-code" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" +checksum = "0b5343afd4a8365a643ac588dab4cf234a190c7f6c88c9f6dd6ffe00837661b7" [[package]] -name = "av-scenechange" -version = "0.14.1" +name = "fax" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f321d77c20e19b92c39e7471cf986812cbb46659d2af674adc4331ef3f18394" -dependencies = [ - "aligned", - "anyhow", - "arg_enum_proc_macro", - "arrayvec", - "log", - "num-rational", - "num-traits", - "pastey", - "rayon", - "thiserror 2.0.21", - "v_frame", - "y4m", -] +checksum = "caf1079563223d5d59d83c85886a56e586cfd5c1a26292e971a0fa266531ac5a" [[package]] -name = "av1-grain" -version = "0.2.5" +name = "fdeflate" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cfddb07216410377231960af4fcab838eaa12e013417781b78bd95ee22077f8" +checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" dependencies = [ - "anyhow", - "arrayvec", - "log", - "nom", - "num-rational", - "v_frame", + "simd-adler32", ] [[package]] -name = "avif-serialize" -version = "0.8.9" +name = "find-msvc-tools" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7178fe5f7d460b13895ebb9dcb28a3a6216d2df2574a0806cb51b555d297f38" -dependencies = [ - "arrayvec", -] +checksum = "aedcfb3409746eddb02b9e19ebda1c3394f759a152e48ee875a0844d1b955484" [[package]] -name = "backtrace" -version = "0.3.76" +name = "flate2" +version = "1.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" +checksum = "6e634e2e0ebac1ee034020da1ca582e17ffe4e0f5e985823721e168928136dcb" dependencies = [ - "addr2line", - "cfg-if", - "libc", - "miniz_oxide 0.8.9", - "object", - "rustc-demangle", - "windows-link 0.2.1", + "crc32fast", + "miniz_oxide 0.9.1", + "zlib-rs", ] [[package]] -name = "base62" -version = "2.2.6" +name = "form_urlencoded" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3a647dce9631f152a99ec16cfc09267ae55fe280d5dc288964027d458076323" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] [[package]] -name = "base64" -version = "0.22.1" +name = "gethostname" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" +checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8" +dependencies = [ + "rustix", + "windows-link", +] [[package]] -name = "base64" -version = "0.23.1" +name = "getrandom" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] [[package]] -name = "base64ct" -version = "1.8.3" +name = "globset" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06" +checksum = "07c34a9410465b45bd9787443bc7370f37735bad04b0f0cd57ff1a3186c98988" +dependencies = [ + "aho-corasick", + "bstr", + "log", + "regex-automata", + "regex-syntax", +] [[package]] -name = "bit-set" -version = "0.9.1" +name = "half" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34ddef2995421ab6a5c779542c81ee77c115206f4ad9d5a8e05f4ff49716a3dd" +checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" dependencies = [ - "bit-vec", + "cfg-if", + "crunchy", + "zerocopy", ] [[package]] -name = "bit-vec" -version = "0.9.1" +name = "hashbrown" +version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b71798fca2c1fe1086445a7258a4bc81e6e49dcd24c8d0dd9a1e57395b603f51" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" [[package]] -name = "bit_field" -version = "0.10.3" +name = "heck" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e4b40c7323adcfc0a41c4b88143ed58346ff65a288fc144329c5c45e05d70c6" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] -name = "bitflags" -version = "1.3.2" +name = "http" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0" +dependencies = [ + "bytes", + "itoa", +] [[package]] -name = "bitflags" -version = "2.13.2" +name = "httparse" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" [[package]] -name = "bitstream-io" -version = "4.10.0" +name = "icu_collections" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eff00be299a18769011411c9def0d827e8f2d7bf0c3dbf53633147a8867fd1f" +checksum = "fa68d21081c4a05d5a901a1c62add574c77048b6a1c67be3b50ce0b60d4ca513" dependencies = [ - "no_std_io2", + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", ] [[package]] -name = "block" -version = "0.1.6" +name = "icu_locale_core" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" +checksum = "d56e28588da92eee5c3201a6eff33fabdd49b62269c8938d4ff050ce4d900deb" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] [[package]] -name = "block-buffer" -version = "0.10.4" +name = "icu_normalizer" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +checksum = "12f9cf5f235641ed274641dd81c3f28d870e276763d0797aeeab72317b1c646f" dependencies = [ - "generic-array", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", ] [[package]] -name = "block-buffer" -version = "0.12.1" +name = "icu_normalizer_data" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2f6c7dbe95a6ed67ad9f18e57daf93a2f034c524b99fd2b76d18fdfeb6660aa" -dependencies = [ - "hybrid-array", -] +checksum = "1563da1ed3e0b3bf3d74c9b85917ac9c56464d2f57242270c09c9e752f8021a0" [[package]] -name = "block-padding" -version = "0.3.3" +name = "icu_properties" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93" +checksum = "7e7ca276ad3145661a65914e6daf131ca5120cd3dcee8f8f3214b8875184a148" dependencies = [ - "generic-array", + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", ] [[package]] -name = "block2" -version = "0.5.1" +name = "icu_properties_data" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e590f038c1464a96894fd6d10127e90a8be4509f56ff7ecef851b15cee0b7caa" + +[[package]] +name = "icu_provider" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f" +checksum = "d27bbb9d3abbefac45d55f647c9de1d44aafcd1186eb91879afef17c396c3e73" dependencies = [ - "objc2 0.5.3", + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", ] [[package]] -name = "block2" -version = "0.6.2" +name = "idna" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" dependencies = [ - "objc2 0.6.5", + "idna_adapter", + "smallvec", + "utf8_iter", ] [[package]] -name = "blocking" -version = "1.7.0" +name = "idna_adapter" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a70e4329df6cb94385eed412ec92375c3cdd8a6e502493d1229b6414e4036dfa" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" dependencies = [ - "async-channel", - "async-task", - "futures-io", - "futures-lite", - "piper", + "icu_normalizer", + "icu_properties", ] [[package]] -name = "bstr" -version = "1.13.1" +name = "ignore" +version = "0.4.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bb31b46c14244e20ee9984b11bf5c992b91fb6939fea616e3512c8baecdbe5f" +checksum = "00b69833ed729dc5aa7d19541d96d6cf8e9137194207a04916d658e43168402f" dependencies = [ + "crossbeam-deque", + "globset", + "log", "memchr", "regex-automata", - "serde_core", + "same-file", + "walkdir", + "winapi-util", ] [[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.2" +name = "image" +version = "0.25.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797" +checksum = "85ab80394333c02fe689eaf900ab500fbd0c2213da414687ebf995a65d5a6104" dependencies = [ - "bytemuck_derive", + "bytemuck", + "byteorder-lite", + "moxcms", + "num-traits", + "png", + "tiff", ] [[package]] -name = "bytemuck_derive" -version = "1.12.1" +name = "indexmap" +version = "2.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a1f896587b6f2c069c73d2f0913e2d590c3990285cd2f0b6aa02b786b4c679c" +checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", + "equivalent", + "hashbrown", ] [[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" +name = "is_terminal_polyfill" +version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" [[package]] -name = "bytes" -version = "1.12.1" +name = "itoa" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" [[package]] -name = "calloop" -version = "0.14.5" +name = "jni" +version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43b32313e937c8721c9d17ee9bf60699a6402b4b7c2cb6ac1bee0ffcaa4b4e5e" +checksum = "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498" dependencies = [ - "bitflags 2.13.2", - "polling", - "rustix", - "tracing", + "cfg-if", + "combine", + "jni-macros", + "jni-sys", + "log", + "simd_cesu8", + "thiserror", + "walkdir", + "windows-link", ] [[package]] -name = "calloop-wayland-source" -version = "0.4.1" +name = "jni-macros" +version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138efcf0940a02ebf0cc8d1eff41a1682a46b431630f4c52450d6265876021fa" +checksum = "a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3" dependencies = [ - "calloop", - "rustix", - "wayland-backend", - "wayland-client", + "proc-macro2", + "quote", + "rustc_version", + "simd_cesu8", + "syn 2.0.119", ] [[package]] -name = "cbc" -version = "0.1.2" +name = "jni-sys" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6" +checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2" dependencies = [ - "cipher", + "jni-sys-macros", ] [[package]] -name = "cbindgen" -version = "0.28.0" +name = "jni-sys-macros" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eadd868a2ce9ca38de7eeafdcec9c7065ef89b42b32f0839278d55f35c54d1ff" +checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" dependencies = [ - "heck 0.4.1", - "indexmap", - "log", - "proc-macro2", "quote", - "serde", - "serde_json", "syn 2.0.119", - "tempfile", - "toml 0.8.23", ] [[package]] -name = "cc" -version = "1.8.0" +name = "libc" +version = "0.2.190" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6651c9ed80effdc7db0ff72512157f901af5e3549e341e24b1dd4887d836d838" -dependencies = [ - "find-msvc-tools", - "jobserver", - "libc", - "shlex", -] +checksum = "ce5d3ddc6d3fa000eb1536d85e147bfe31aacaba692ed6a876f95cb7c855be78" [[package]] -name = "cfg-if" -version = "1.0.5" +name = "linux-raw-sys" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" [[package]] -name = "cfg_aliases" -version = "0.2.2" +name = "litemap" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" [[package]] -name = "chacha20" -version = "0.10.2" +name = "litrs" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" -dependencies = [ - "cfg-if", - "cpufeatures 0.3.1", - "rand_core 0.10.1", -] +checksum = "4744e383959f0db86ede514b809b1c53251889093803c05267acc7d4e7030d70" [[package]] -name = "chrono" -version = "0.4.45" +name = "lock_api" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" dependencies = [ - "iana-time-zone", - "js-sys", - "num-traits", - "serde", - "wasm-bindgen", - "windows-link 0.2.1", + "scopeguard", ] [[package]] -name = "cipher" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" -dependencies = [ - "crypto-common 0.1.7", - "inout", - "zeroize", -] +name = "log" +version = "0.4.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" [[package]] -name = "cocoa" -version = "0.25.0" +name = "miniz_oxide" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6140449f97a6e97f9511815c5632d84c8aacf8ac271ad77c559218161a1373c" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" dependencies = [ - "bitflags 1.3.2", - "block", - "cocoa-foundation 0.1.2", - "core-foundation 0.9.4", - "core-graphics 0.23.2", - "foreign-types 0.5.0", - "libc", - "objc", + "adler2", + "simd-adler32", ] [[package]] -name = "cocoa" -version = "0.26.1" +name = "miniz_oxide" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad36507aeb7e16159dfe68db81ccc27571c3ccd4b76fb2fb72fc59e7a4b1b64c" +checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c" dependencies = [ - "bitflags 2.13.2", - "block", - "cocoa-foundation 0.2.1", - "core-foundation 0.10.1", - "core-graphics 0.24.0", - "foreign-types 0.5.0", - "libc", - "objc", + "adler2", + "simd-adler32", ] [[package]] -name = "cocoa-foundation" -version = "0.1.2" +name = "mio" +version = "1.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c6234cbb2e4c785b456c0644748b1ac416dd045799740356f8363dfe00c93f7" +checksum = "1788edb87fdc09c7e26304471e2f5be8cdefb1b6930d6e3985fc02ff53bf86ee" dependencies = [ - "bitflags 1.3.2", - "block", - "core-foundation 0.9.4", - "core-graphics-types 0.1.3", "libc", - "objc", + "log", + "wasi", + "windows-sys 0.61.2", ] [[package]] -name = "cocoa-foundation" -version = "0.2.1" +name = "moxcms" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81411967c50ee9a1fc11365f8c585f863a22a9697c89239c452292c40ba79b0d" +checksum = "bb85c154ba489f01b25c0d36ae69a87e4a1c73a72631fc6c0eb6dde34a73e44b" dependencies = [ - "bitflags 2.13.2", - "block", - "core-foundation 0.10.1", - "core-graphics-types 0.2.0", - "objc", + "num-traits", + "pxfm", ] [[package]] -name = "codespan-reporting" -version = "0.13.1" +name = "nix" +version = "0.31.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af491d569909a7e4dee0ad7db7f5341fef5c614d5b8ec8cf765732aba3cff681" +checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d" dependencies = [ - "serde", - "termcolor", - "unicode-width", + "bitflags", + "cfg-if", + "cfg_aliases", + "libc", ] [[package]] -name = "color_quant" -version = "1.1.0" +name = "num-conv" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" +checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" [[package]] -name = "concurrent-queue" -version = "2.5.0" +name = "num-traits" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ - "crossbeam-utils", + "autocfg", ] [[package]] -name = "console_error_panic_hook" -version = "0.1.7" +name = "objc2" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" +checksum = "08849bbd4767dfae9457696856ae1c84fe4e0281bbe4a7abff2d0e06fb7981f8" dependencies = [ - "cfg-if", - "wasm-bindgen", + "objc2-encode", ] [[package]] -name = "const-oid" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6ef517f0926dd24a1582492c791b6a4818a4d94e789a334894aa15b0d12f55c" - -[[package]] -name = "const-random" -version = "0.1.18" +name = "objc2-app-kit" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87e00182fe74b066627d63b85fd550ac2998d4b0bd86bfed477a0ae4c7c71359" +checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c" dependencies = [ - "const-random-macro", + "bitflags", + "objc2", + "objc2-core-graphics", + "objc2-foundation", ] [[package]] -name = "const-random-macro" -version = "0.1.16" +name = "objc2-core-foundation" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" dependencies = [ - "getrandom 0.2.17", - "once_cell", - "tiny-keccak", + "bitflags", + "dispatch2", + "objc2", ] [[package]] -name = "convert_case" -version = "0.10.0" +name = "objc2-core-graphics" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "633458d4ef8c78b72454de2d54fd6ab2e60f9e02be22f3c6104cdc8a4e0fceb9" +checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" dependencies = [ - "unicode-segmentation", + "bitflags", + "dispatch2", + "objc2", + "objc2-core-foundation", + "objc2-io-surface", ] [[package]] -name = "cookie" -version = "0.18.2" +name = "objc2-encode" +version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a373e3602691c3cdea496d2f0ee5935151e6168fe87739483c463db1b2f2f87" -dependencies = [ - "percent-encoding", - "time", - "version_check", -] +checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" [[package]] -name = "cookie_store" -version = "0.22.1" +name = "objc2-foundation" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15b2c103cf610ec6cae3da84a766285b42fd16aad564758459e6ecf128c75206" +checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" dependencies = [ - "cookie", - "document-features", - "idna", - "indexmap", - "log", - "serde", - "serde_derive", - "serde_json", - "time", - "url", + "bitflags", + "objc2", + "objc2-core-foundation", ] [[package]] -name = "core-foundation" -version = "0.9.4" +name = "objc2-io-surface" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d" dependencies = [ - "core-foundation-sys", - "libc", + "bitflags", + "objc2", + "objc2-core-foundation", ] [[package]] -name = "core-foundation" -version = "0.10.1" +name = "once_cell" +version = "1.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" -dependencies = [ - "core-foundation-sys", - "libc", -] +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" [[package]] -name = "core-foundation-sys" -version = "0.8.7" +name = "once_cell_polyfill" +version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" [[package]] -name = "core-graphics" -version = "0.23.2" +name = "openssl-probe" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081" -dependencies = [ - "bitflags 1.3.2", - "core-foundation 0.9.4", - "core-graphics-types 0.1.3", - "foreign-types 0.5.0", - "libc", -] +checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" [[package]] -name = "core-graphics" -version = "0.24.0" +name = "parking_lot" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa95a34622365fa5bbf40b20b75dba8dfa8c94c734aea8ac9a5ca38af14316f1" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" dependencies = [ - "bitflags 2.13.2", - "core-foundation 0.10.1", - "core-graphics-types 0.2.0", - "foreign-types 0.5.0", - "libc", + "lock_api", + "parking_lot_core", ] [[package]] -name = "core-graphics-helmer-fork" -version = "0.24.0" +name = "parking_lot_core" +version = "0.9.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32eb7c354ae9f6d437a6039099ce7ecd049337a8109b23d73e48e8ffba8e9cd5" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" dependencies = [ - "bitflags 2.13.2", - "core-foundation 0.9.4", - "core-graphics-types 0.1.3", - "foreign-types 0.5.0", + "cfg-if", "libc", + "redox_syscall", + "smallvec", + "windows-link", ] [[package]] -name = "core-graphics-types" -version = "0.1.3" +name = "percent-encoding" +version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" -dependencies = [ - "bitflags 1.3.2", - "core-foundation 0.9.4", - "libc", -] +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] -name = "core-graphics-types" -version = "0.2.0" +name = "png" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb" +checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61" dependencies = [ - "bitflags 2.13.2", - "core-foundation 0.10.1", - "libc", + "bitflags", + "crc32fast", + "fdeflate", + "flate2", + "miniz_oxide 0.8.9", ] [[package]] -name = "core-text" -version = "21.0.0" +name = "potential_utf" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a593227b66cbd4007b2a050dfdd9e1d1318311409c8d600dc82ba1b15ca9c130" +checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" dependencies = [ - "core-foundation 0.10.1", - "core-graphics 0.24.0", - "foreign-types 0.5.0", - "libc", + "zerovec", ] [[package]] -name = "core_detect" -version = "1.0.0" +name = "powerfmt" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f8f80099a98041a3d1622845c271458a2d73e688351bf3cb999266764b81d48" +checksum = "4a6394b9e965e73d0a289ee54f589087e2c676aedf60885baf52c76b771e4958" [[package]] -name = "core_maths" -version = "0.1.1" +name = "proc-macro2" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77745e017f5edba1a9c1d854f6f3a52dac8a12dd5af5d2f54aecf61e43d80d30" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" dependencies = [ - "libm", + "unicode-ident", ] [[package]] -name = "cosmic-text" -version = "0.19.0" +name = "pulldown-cmark" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be17b688510d934ce13f48a2beba700e11583e281e0fda99c22bb256a14eda73" +checksum = "e9f068eba8e7071c5f9511831b44f32c740d5adf574e990f946ddb53db2f314e" dependencies = [ - "bitflags 2.13.2", - "fontdb", - "harfrust", - "linebender_resource_handle", - "log", - "rangemap", - "rustc-hash 2.1.3", - "self_cell", - "skrifa 0.40.0", - "smol_str", - "swash", - "sys-locale", - "unicode-bidi", - "unicode-linebreak", - "unicode-script", - "unicode-segmentation", + "bitflags", + "memchr", + "unicase", ] [[package]] -name = "cpufeatures" -version = "0.2.17" +name = "pxfm" +version = "0.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" -dependencies = [ - "libc", -] +checksum = "d55d956fa96f5ec02be2e13af0e20391a5aa83d6a074e3ad368959d0fab299ea" [[package]] -name = "cpufeatures" -version = "0.3.1" +name = "quick-error" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" +checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" + +[[package]] +name = "quill-code" +version = "1.0.0" dependencies = [ - "libc", + "arboard", + "base64", + "clap", + "crossterm", + "ctrlc", + "png", + "pulldown-cmark", + "quill-config", + "quill-core", + "quill-git", + "quill-providers", + "quill-weave", + "serde", + "serde_json", + "unicode-width", ] [[package]] -name = "crc32fast" -version = "1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01a7799fd6b852db0e61728dde9a204c423b44d689dbd432522543614b490e78" +name = "quill-config" +version = "1.0.0" dependencies = [ - "cfg-if", + "quill-core", + "quill-providers", + "serde", + "serde_json", ] [[package]] -name = "crossbeam-deque" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622f3fc73690be383c7214310406f28a90e6edeadc3cea882f9d71e495b9711a" +name = "quill-core" +version = "1.0.0" dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", + "globset", + "ignore", + "quill-git", + "quill-providers", + "regex", + "serde", + "serde_json", + "similar", ] [[package]] -name = "crossbeam-epoch" -version = "0.9.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc74980687109a3b14c72fd458107bf0baa1da1a1a805e178d15501ba9b86d9d" +name = "quill-git" +version = "1.0.0" dependencies = [ - "crossbeam-utils", + "serde_json", + "ureq", ] [[package]] -name = "crossbeam-utils" -version = "0.8.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" +name = "quill-providers" +version = "1.0.0" +dependencies = [ + "serde", + "serde_json", + "ureq", +] [[package]] -name = "crunchy" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" +name = "quill-weave" +version = "1.0.0" [[package]] -name = "crypto-common" -version = "0.1.7" +name = "quote" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" dependencies = [ - "generic-array", - "typenum", + "proc-macro2", ] [[package]] -name = "crypto-common" -version = "0.2.2" +name = "redox_syscall" +version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" dependencies = [ - "hybrid-array", + "bitflags", ] [[package]] -name = "ctor" -version = "1.0.13" +name = "regex" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "914a755b7c2d4af2bdcff7ce1739e2db9a1b81a9b07123d8015786ae03c0980d" +checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d" dependencies = [ - "link-section", - "linktime-proc-macro", + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", ] [[package]] -name = "data-url" -version = "0.3.2" +name = "regex-automata" +version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be1e0bca6c3637f992fc1cc7cbc52a78c1ef6db076dbf1059c4323d6a2048376" - -[[package]] -name = "der" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a878c850e9e421b20262e9b41f9c860e4785fa07541c266b62ff9d1ef998a80a" +checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2" dependencies = [ - "pem-rfc7468", - "zeroize", + "aho-corasick", + "memchr", + "regex-syntax", ] [[package]] -name = "deranged" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e9de72ce2ad1f90dc62fa25f0f430ef85eb4b0d8fa0be4f30373bc40a21d28e" - -[[package]] -name = "derive_more" -version = "2.1.1" +name = "regex-syntax" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" -dependencies = [ - "derive_more-impl", -] +checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" [[package]] -name = "derive_more-impl" -version = "2.1.1" +name = "ring" +version = "0.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" dependencies = [ - "convert_case", - "proc-macro2", - "quote", - "rustc_version", - "syn 2.0.119", + "cc", + "cfg-if", + "getrandom", + "libc", + "untrusted", + "windows-sys 0.52.0", ] [[package]] -name = "digest" -version = "0.10.7" +name = "rustc_version" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ - "block-buffer 0.10.4", - "crypto-common 0.1.7", - "subtle", + "semver", ] [[package]] -name = "digest" -version = "0.11.3" +name = "rustix" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2" +checksum = "891efababe418670775f199f0d233d84843c227a0949a883ce15b37c78d6629d" dependencies = [ - "block-buffer 0.12.1", - "const-oid", - "crypto-common 0.2.2", + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.61.2", ] [[package]] -name = "dirs" -version = "5.0.1" +name = "rustls" +version = "0.23.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" +checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf" dependencies = [ - "dirs-sys 0.4.1", + "log", + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", ] [[package]] -name = "dirs" -version = "6.0.0" +name = "rustls-native-certs" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e" +checksum = "4a073f5dc7469f984c52ad2752b63b0807745133b6de880b7b64c1ac4c48aec4" dependencies = [ - "dirs-sys 0.5.0", + "openssl-probe", + "rustls-pki-types", + "schannel", + "security-framework", ] [[package]] -name = "dirs-sys" -version = "0.4.1" +name = "rustls-pki-types" +version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" +checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96" dependencies = [ - "libc", - "option-ext", - "redox_users 0.4.6", - "windows-sys 0.48.0", + "zeroize", ] [[package]] -name = "dirs-sys" -version = "0.5.0" +name = "rustls-platform-verifier" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" +checksum = "1167586491e2b18b8bfbb293e8180ec17c201c4f076d7cb3070ca964e7598f98" dependencies = [ - "libc", - "option-ext", - "redox_users 0.5.3", + "core-foundation", + "core-foundation-sys", + "jni", + "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 = "dispatch" +name = "rustls-platform-verifier-android" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" - -[[package]] -name = "dispatch2" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38" -dependencies = [ - "bitflags 2.13.2", - "block2 0.6.2", - "objc2 0.6.5", -] +checksum = "eec689c0bc40ff2458a5977b6619cb718087084a18e02a131c599b62d05e1a5f" [[package]] -name = "displaydoc" -version = "0.2.7" +name = "rustls-webpki" +version = "0.103.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" +checksum = "f3c3cf1d8b1e7d4927e2d154c3fcb02979afb9939629c62cd9048d4f07b60ac2" dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", + "ring", + "rustls-pki-types", + "untrusted", ] [[package]] -name = "dlib" -version = "0.5.3" +name = "same-file" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" dependencies = [ - "libloading", + "winapi-util", ] [[package]] -name = "document-features" -version = "0.2.12" +name = "schannel" +version = "0.1.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61" +checksum = "91c1b7e4904c873ef0710c1f407dde2e6287de2bebc1bbbf7d430bb7cbffd939" dependencies = [ - "litrs", + "windows-sys 0.61.2", ] [[package]] -name = "downcast-rs" -version = "1.2.1" +name = "scopeguard" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] -name = "dunce" -version = "1.0.5" +name = "security-framework" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" +checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] [[package]] -name = "dwrote" -version = "0.11.5" +name = "security-framework-sys" +version = "2.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b35532432acc8b19ceed096e35dfa088d3ea037fe4f3c085f1f97f33b4d02" +checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3" dependencies = [ - "lazy_static", + "core-foundation-sys", "libc", - "winapi", - "wio", ] [[package]] -name = "dyn-clone" -version = "1.0.20" +name = "semver" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" [[package]] -name = "either" -version = "1.19.0" +name = "serde" +version = "1.0.229" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] [[package]] -name = "embed-resource" -version = "3.0.12" +name = "serde_core" +version = "1.0.229" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6168487b5e7eb2673e6efe1200b1848016e436a6ca0b8031bf04bd9d493a249f" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" dependencies = [ - "cc", - "memchr", - "rustc_version", - "toml 1.1.8+spec-1.1.0", - "vswhom", - "winreg", + "serde_derive", ] [[package]] -name = "encoding_rs" -version = "0.8.42" +name = "serde_derive" +version = "1.0.229" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e985e0451871ad22fb8d2b6b076e2028a502a0d3950998c2c5c0a4f9b5d9679" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" dependencies = [ - "cfg-if", - "core_detect", - "multiversion_no_op", - "rustversion", - "scopeguard", - "simdutf8", + "proc-macro2", + "quote", + "syn 3.0.9", ] [[package]] -name = "encoding_rs_io" -version = "0.1.8" +name = "serde_json" +version = "1.0.154" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fba3fe847045ecff794b9c138293a80db914678c453ad63fbf0c6a9eb6e00b22" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" dependencies = [ - "encoding_rs", + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", ] [[package]] -name = "endi" -version = "1.1.1" +name = "shlex" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66b7e2430c6dff6a955451e2cfc438f09cea1965a9d6f87f7e3b90decc014099" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" [[package]] -name = "enum-iterator" -version = "2.3.0" +name = "signal-hook" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4549325971814bda7a44061bf3fe7e487d447cba01e4220a4b454d630d7a016" +checksum = "d881a16cf4426aa584979d30bd82cb33429027e42122b169753d6ef1085ed6e2" dependencies = [ - "enum-iterator-derive", + "libc", + "signal-hook-registry", ] [[package]] -name = "enum-iterator-derive" -version = "1.5.0" +name = "signal-hook-mio" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "685adfa4d6f3d765a26bc5dbc936577de9abf756c1feeb3089b01dd395034842" +checksum = "b75a19a7a740b25bc7944bdee6172368f988763b744e3d4dfe753f6b4ece40cc" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", + "libc", + "mio", + "signal-hook", ] [[package]] -name = "enumflags2" -version = "0.7.12" +name = "signal-hook-registry" +version = "1.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1027f7680c853e056ebcec683615fb6fbbc07dbaa13b4d5d9442b146ded4ecef" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" dependencies = [ - "enumflags2_derive", - "serde", + "errno", + "libc", ] [[package]] -name = "enumflags2_derive" -version = "0.7.12" +name = "simd-adler32" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67c78a4d8fdf9953a5c9d458f9efe940fd97a0cab0941c075a813ac594733827" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] +checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea" [[package]] -name = "enumn" -version = "0.1.14" +name = "simd_cesu8" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f9ed6b3789237c8a0c1c505af1c7eb2c560df6186f01b098c3a1064ea532f38" +checksum = "11031e251abf8611c80f460e19dbdeb54a66db918e49c65a7065b46ac7aec520" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", + "rustc_version", + "simdutf8", ] [[package]] -name = "equator" -version = "0.4.2" +name = "simdutf8" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4711b213838dfee0117e3be6ac926007d7f433d7bbe33595975d4190cb07e6fc" -dependencies = [ - "equator-macro", -] +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" [[package]] -name = "equator-macro" -version = "0.4.2" +name = "similar" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44f23cf4b44bfce11a86ace86f8a73ffdec849c9fd00a386a53d278bd9e81fb3" +checksum = "4f66ca1f7aca2474dc10c942eb22feffc897735f54cd1db90138c2fddb490987" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", + "bstr", ] [[package]] -name = "equivalent" -version = "1.0.3" +name = "smallvec" +version = "1.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826" +checksum = "5b3dc8af474f516a851ff4bd12db780f948b9250ad37211e4eec0bccea54e01b" [[package]] -name = "errno" -version = "0.3.14" +name = "stable_deref_trait" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" -dependencies = [ - "libc", - "windows-sys 0.61.2", -] +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] -name = "etagere" -version = "0.2.15" +name = "strsim" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc89bf99e5dc15954a60f707c1e09d7540e5cd9af85fa75caa0b510bc08c5342" -dependencies = [ - "euclid", - "svg_fmt", -] +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] -name = "euclid" -version = "0.22.14" +name = "subtle" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1a05365e3b1c6d1650318537c7460c6923f1abdd272ad6842baa2b509957a06" -dependencies = [ - "num-traits", -] +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] -name = "event-listener" -version = "5.4.2" +name = "syn" +version = "2.0.119" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a23add41df1562121a9393cb065eab5146a1242410f23a644851e90cfd669d2" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" dependencies = [ - "parking", - "pin-project-lite", + "proc-macro2", + "quote", + "unicode-ident", ] [[package]] -name = "event-listener-strategy" -version = "0.5.4" +name = "syn" +version = "3.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" +checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b" dependencies = [ - "event-listener", - "pin-project-lite", + "proc-macro2", + "quote", + "unicode-ident", ] [[package]] -name = "exr" -version = "1.74.2" +name = "synstructure" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711fe42c9964295e01ee3fba3f9fe0e1d24b98886950d68efe81b1c76e21adf3" +checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" dependencies = [ - "bit_field", - "half", - "lebe", - "miniz_oxide 0.8.9", - "num-complex", - "pulp", - "rayon-core", - "smallvec", - "zune-inflate", + "proc-macro2", + "quote", + "syn 3.0.9", ] [[package]] -name = "fastrand" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" - -[[package]] -name = "fax" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caf1079563223d5d59d83c85886a56e586cfd5c1a26292e971a0fa266531ac5a" - -[[package]] -name = "fdeflate" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" -dependencies = [ - "simd-adler32", -] - -[[package]] -name = "filedescriptor" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e40758ed24c9b2eeb76c35fb0aebc66c626084edd827e07e1552279814c6682d" -dependencies = [ - "libc", - "thiserror 1.0.69", - "winapi", -] - -[[package]] -name = "find-msvc-tools" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aedcfb3409746eddb02b9e19ebda1c3394f759a152e48ee875a0844d1b955484" - -[[package]] -name = "flate2" -version = "1.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e634e2e0ebac1ee034020da1ca582e17ffe4e0f5e985823721e168928136dcb" -dependencies = [ - "crc32fast", - "miniz_oxide 0.9.1", - "zlib-rs", -] - -[[package]] -name = "float-cmp" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4" - -[[package]] -name = "float-ord" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce81f49ae8a0482e4c55ea62ebbd7e5a686af544c00b9d090bba3ff9be97b3d" - -[[package]] -name = "float_next_after" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bf7cc16383c4b8d58b9905a8509f02926ce3058053c056376248d958c9df1e8" - -[[package]] -name = "fluent-uri" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17c704e9dbe1ddd863da1e6ff3567795087b1eb201ce80d8fa81162e1516500d" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "flume" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e139bc46ca777eb5efaf62df0ab8cc5fd400866427e56c68b22e414e53bd3be" -dependencies = [ - "futures-core", - "futures-sink", - "spin 0.9.9", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "foldhash" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" - -[[package]] -name = "foldhash" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" - -[[package]] -name = "font-types" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b38ad915f6dadd993ced50848a8291a543bd41ca62bc10740d5e64e2ab4cfd7" -dependencies = [ - "bytemuck", -] - -[[package]] -name = "font-types" -version = "0.12.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c92d9081c7ab3bd83ef1eecdfad090f3d966e3ce74106779664114cfe1a6274" -dependencies = [ - "bytemuck", -] - -[[package]] -name = "fontconfig-parser" -version = "0.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbc773e24e02d4ddd8395fd30dc147524273a83e54e0f312d986ea30de5f5646" -dependencies = [ - "roxmltree 0.20.0", -] - -[[package]] -name = "fontdb" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "457e789b3d1202543297a350643cf459f836cade38934e7a4cf6a39e7cde2905" -dependencies = [ - "fontconfig-parser", - "log", - "memmap2", - "slotmap", - "tinyvec", - "ttf-parser", -] - -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared 0.1.1", -] - -[[package]] -name = "foreign-types" -version = "0.5.0" +name = "thiserror" +version = "2.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" +checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" dependencies = [ - "foreign-types-macros", - "foreign-types-shared 0.3.1", + "thiserror-impl", ] [[package]] -name = "foreign-types-macros" -version = "0.2.4" +name = "thiserror-impl" +version = "2.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea5190182e6915eb873ddbc16e23b711b6eb1f9c00a0d0a3a91b5f6228475225" +checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" dependencies = [ "proc-macro2", "quote", @@ -1773,6679 +1489,355 @@ dependencies = [ ] [[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - -[[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 = "freetype-sys" -version = "0.20.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e7edc5b9669349acfda99533e9e0bcf26a51862ab43b08ee7745c55d28eb134" -dependencies = [ - "cc", - "libc", - "pkg-config", -] - -[[package]] -name = "fsevent-sys" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76ee7a02da4d231650c7cea31349b889be2f45ddb3ef3032d2ec8185f6313fd2" -dependencies = [ - "libc", -] - -[[package]] -name = "futf" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df420e2e84819663797d1ec6544b13c5be84629e7bb00dc960d6917db2987843" -dependencies = [ - "mac", - "new_debug_unreachable", -] - -[[package]] -name = "futures" -version = "0.3.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a31d2a3fbaaeb2af2368bbdd904aa8e812d3c04a1ee10d3171f52d556e5d0a3" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.34" +name = "tiff" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4" +checksum = "b63feaf3343d35b6ca4d50483f94843803b0f51634937cc2ec519fc32232bc52" dependencies = [ - "futures-core", - "futures-sink", + "fax", + "flate2", + "half", + "quick-error", + "weezl", + "zune-jpeg", ] [[package]] -name = "futures-core" -version = "0.3.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" - -[[package]] -name = "futures-executor" -version = "0.3.34" +name = "time" +version = "0.3.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "031b47cf1a3c6cc8bc2fc76cd437f521619387907d469316e7c0bc278f1f5432" +checksum = "cdb87b95ec50ddfa440816d227a17b2ccbdda963a316a727fda0fc4334f7d134" dependencies = [ - "futures-core", - "futures-task", - "futures-util", + "deranged", + "num-conv", + "powerfmt", + "serde_core", + "time-core", + "time-macros", ] [[package]] -name = "futures-io" -version = "0.3.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed" - -[[package]] -name = "futures-lite" -version = "2.6.1" +name = "time-core" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad" -dependencies = [ - "fastrand", - "futures-core", - "futures-io", - "parking", - "pin-project-lite", -] +checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109" [[package]] -name = "futures-macro" -version = "0.3.34" +name = "time-macros" +version = "0.2.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44" +checksum = "7e689342a48d2ea927c87ea50cabf8594854bf940e9310208848d680d668ed85" dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", + "num-conv", + "time-core", ] [[package]] -name = "futures-sink" -version = "0.3.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d" - -[[package]] -name = "futures-task" -version = "0.3.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" - -[[package]] -name = "futures-util" -version = "0.3.34" +name = "tinystr" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" +checksum = "b1e27c91459209c2986af3dcf603a5a74a4368754ce37414f59acc971167f643" dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "slab", + "displaydoc", + "zerovec", ] [[package]] -name = "generic-array" -version = "0.14.7" +name = "unicase" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", -] +checksum = "357cc3acc6a036009fd6c973ed009037c732d60d0b4f6c673e9041497482a28f" [[package]] -name = "gethostname" -version = "1.1.0" +name = "unicode-ident" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8" -dependencies = [ - "rustix", - "windows-link 0.2.1", -] +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" [[package]] -name = "getrandom" -version = "0.2.17" +name = "unicode-width" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" -dependencies = [ - "cfg-if", - "js-sys", - "libc", - "wasi", - "wasm-bindgen", -] +checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" [[package]] -name = "getrandom" -version = "0.3.4" +name = "untrusted" +version = "0.9.0" 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", -] +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] -name = "getrandom" -version = "0.4.3" +name = "ureq" +version = "3.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +checksum = "9a7ac20be9b7726e0bbdbf974c059676d9acb1cd414961f570a4e8231cacd7fc" dependencies = [ - "cfg-if", - "js-sys", - "libc", - "r-efi 6.0.0", - "rand_core 0.10.1", - "wasm-bindgen", + "base64", + "cookie_store", + "log", + "percent-encoding", + "rustls", + "rustls-pki-types", + "rustls-platform-verifier", + "serde", + "serde_json", + "ureq-proto", + "utf8-zero", + "webpki-roots", ] [[package]] -name = "gif" -version = "0.13.3" +name = "ureq-proto" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ae047235e33e2829703574b54fdec96bfbad892062d97fed2f76022287de61b" +checksum = "f86fd172ccca569e458f61b6bdd6220965a9ef36e672a6852953b51a0e1583be" dependencies = [ - "color_quant", - "weezl", -] - -[[package]] -name = "gif" -version = "0.14.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee8cfcc411d9adbbaba82fb72661cc1bcca13e8bba98b364e62b2dba8f960159" -dependencies = [ - "color_quant", - "weezl", -] - -[[package]] -name = "gimli" -version = "0.32.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" - -[[package]] -name = "gl_generator" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d" -dependencies = [ - "khronos_api", - "log", - "xml-rs", -] - -[[package]] -name = "glob" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b" - -[[package]] -name = "globset" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07c34a9410465b45bd9787443bc7370f37735bad04b0f0cd57ff1a3186c98988" -dependencies = [ - "aho-corasick", - "bstr", - "log", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "globwalk" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93e3af942408868f6934a7b85134a3230832b9977cf66125df2f9edcfce4ddcc" -dependencies = [ - "bitflags 1.3.2", - "ignore", - "walkdir", -] - -[[package]] -name = "glow" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29038e1c483364cc6bb3cf78feee1816002e127c331a1eec55a4d202b9e1adb5" -dependencies = [ - "js-sys", - "slotmap", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "glutin_wgl_sys" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c4ee00b289aba7a9e5306d57c2d05499b2e5dc427f84ac708bd2c090212cf3e" -dependencies = [ - "gl_generator", -] - -[[package]] -name = "gpu-allocator" -version = "0.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51255ea7cfaadb6c5f1528d43e92a82acb2b96c43365989a28b2d44ee38f8795" -dependencies = [ - "ash", - "hashbrown 0.16.1", - "log", - "presser", - "thiserror 2.0.21", - "windows 0.62.2", -] - -[[package]] -name = "gpu-descriptor" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b89c83349105e3732062a895becfc71a8f921bb71ecbbdd8ff99263e3b53a0ca" -dependencies = [ - "bitflags 2.13.2", - "gpu-descriptor-types", - "hashbrown 0.15.5", -] - -[[package]] -name = "gpu-descriptor-types" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdf242682df893b86f33a73828fb09ca4b2d3bb6cc95249707fc684d27484b91" -dependencies = [ - "bitflags 2.13.2", -] - -[[package]] -name = "gpui-base" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9955b6f4b048fd50ca15fc8e225d80bb00ba9ebc8fecdddde5ad26dbef9270" -dependencies = [ - "aho-corasick", - "anyhow", - "ashpd", - "async-channel", - "chrono", - "data-url", - "futures", - "gpui-pre", - "gpui-pre-macros", - "gpui-pre-sum-tree", - "html5ever", - "instant", - "itertools 0.13.0", - "lsp-types", - "markdown", - "markup5ever_rcdom", - "num-traits", - "objc2 0.6.5", - "objc2-app-kit 0.3.2", - "objc2-foundation 0.3.2", - "raw-window-handle", - "regex", - "ropey", - "schemars", - "serde", - "serde_json", - "smallvec", - "smol", - "tracing", - "unicode-linebreak", - "unicode-segmentation", - "web-time", - "windows 0.58.0", -] - -[[package]] -name = "gpui-component" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "465a363235cd4062ef5f0953fc096fc764ed6f53dfbd9f409f669f93ea3b1ff9" -dependencies = [ - "anyhow", - "chrono", - "core-text", - "enum-iterator", - "gpui-base", - "gpui-component-macros", - "gpui-kit-assets", - "gpui-pre", - "gpui-pre-macros", - "gpui-pre-sum-tree", - "instant", - "itertools 0.13.0", - "log", - "lsp-types", - "markdown", - "notify", - "num-traits", - "objc2 0.6.5", - "objc2-app-kit 0.3.2", - "objc2-foundation 0.3.2", - "once_cell", - "paste", - "raw-window-handle", - "regex", - "resvg 0.45.1", - "ropey", - "rust-i18n", - "schemars", - "serde", - "serde_json", - "serde_repr", - "similar", - "smallvec", - "smol", - "tracing", - "unicode-segmentation", - "unicode-width", - "uuid", - "windows 0.58.0", -] - -[[package]] -name = "gpui-component-macros" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c0c9398aaf99e595d450e38eb44ff0c500df8c332b4783d5b72022e69525359" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "gpui-kit" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac401f6b149bf33794da0942510240afd29b7b18556574e4cf17196b647066" -dependencies = [ - "gpui-base", - "gpui-component", - "gpui-kit-assets", - "gpui-pre", - "gpui-pre-macros", - "gpui-pre-platform", - "gpui-pre-web", -] - -[[package]] -name = "gpui-kit-assets" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7abc281dcbfe51c16a7e73189521a3a771168c31e3ab0db99e21e481d1b1b9a" -dependencies = [ - "anyhow", - "gpui-pre", - "gpui-pre-reqwest", - "log", - "rust-embed", - "wasm-bindgen", - "wasm-bindgen-futures", -] - -[[package]] -name = "gpui-pre" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34f61c1cfd36fc9c436af09308c963822ae27a45a84feb21a77ba5c9e051f1c0" -dependencies = [ - "accesskit", - "anyhow", - "async-channel", - "async-task", - "backtrace", - "bitflags 2.13.2", - "chrono", - "ctor", - "derive_more", - "embed-resource", - "etagere", - "futures", - "getrandom 0.3.4", - "gpui-pre-collections", - "gpui-pre-http-client", - "gpui-pre-macros", - "gpui-pre-refineable", - "gpui-pre-scheduler", - "gpui-pre-shared-string", - "gpui-pre-sum-tree", - "gpui-pre-util", - "heapless", - "image", - "inventory", - "itertools 0.14.0", - "libc", - "log", - "lyon", - "num_cpus", - "objc2-core-foundation", - "objc2-core-video", - "parking", - "parking_lot", - "pin-project", - "pollster", - "profiling", - "rand 0.9.5", - "raw-window-handle", - "regex", - "resvg 0.46.0", - "schemars", - "seahash", - "serde", - "serde_json", - "slotmap", - "smallvec", - "spin 0.10.1", - "strum", - "taffy", - "thiserror 2.0.21", - "ttf-parser", - "url", - "usvg 0.46.0", - "uuid", - "waker-fn", - "windows 0.62.2", - "zed-scap", -] - -[[package]] -name = "gpui-pre-apple" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b52f58893fe1a0836464428dfad2b5eaf42c9c303a9638f4c2aced5a69072a15" -dependencies = [ - "anyhow", - "async-task", - "block2 0.6.2", - "cbindgen", - "core-foundation 0.10.1", - "core-foundation-sys", - "core-graphics 0.24.0", - "core-text", - "derive_more", - "dispatch2", - "etagere", - "foreign-types 0.5.0", - "futures", - "gpui-pre", - "gpui-pre-collections", - "gpui-pre-util", - "image", - "libc", - "log", - "mach2", - "metal", - "objc2 0.6.5", - "objc2-core-foundation", - "objc2-core-text", - "objc2-core-video", - "objc2-foundation 0.3.2", - "objc2-metal 0.3.2", - "objc2-quartz-core 0.3.2", - "objc2-security", - "parking_lot", - "pathfinder_geometry", - "smallvec", - "thiserror 2.0.21", - "zed-font-kit", -] - -[[package]] -name = "gpui-pre-collections" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "920c2f5b2f1a7813114d89f4841f26f6060d9c35d7c8a852a4205d1a767a7ce0" -dependencies = [ - "gpui-pre-util", - "indexmap", - "rustc-hash 2.1.3", -] - -[[package]] -name = "gpui-pre-derive-refineable" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "947395f26228296c0c79fb889d3687b205e552c25bbcdece216fb2394ea9bcd1" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "gpui-pre-http-client" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c56cdaa3f1a271162b7fede1d4557879eedb056e293cedbb82743600650b755e" -dependencies = [ - "anyhow", - "bytes", - "futures", - "http", - "http-body", - "log", - "parking_lot", - "serde", - "serde_json", - "serde_urlencoded", - "url", -] - -[[package]] -name = "gpui-pre-linux" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28213c3fde6f13e91ba0b74b90cbaadec9373e36a031eda98561d31059870f3" -dependencies = [ - "accesskit", - "accesskit_unix", - "anyhow", - "as-raw-xcb-connection", - "ashpd", - "bytemuck", - "calloop", - "calloop-wayland-source", - "filedescriptor", - "futures", - "gpui-pre", - "gpui-pre-collections", - "gpui-pre-http-client", - "gpui-pre-util", - "gpui-pre-wgpu", - "libc", - "log", - "notify-rust", - "oo7", - "open", - "parking_lot", - "raw-window-handle", - "smallvec", - "smol", - "strum", - "url", - "uuid", - "wayland-backend", - "wayland-client", - "wayland-cursor", - "wayland-protocols", - "wayland-protocols-plasma", - "wayland-protocols-wlr", - "x11rb", - "xkbcommon", - "zed-scap", - "zed-xim", -] - -[[package]] -name = "gpui-pre-macos" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7c988b7e49775cc8542dbe48d5a10e073d8e898a023ef3ff3d24f33363e9863" -dependencies = [ - "accesskit", - "accesskit_macos", - "anyhow", - "block2 0.6.2", - "cocoa 0.26.1", - "core-foundation 0.10.1", - "core-foundation-sys", - "core-graphics 0.24.0", - "ctor", - "dispatch2", - "foreign-types 0.5.0", - "futures", - "gpui-pre", - "gpui-pre-apple", - "gpui-pre-collections", - "gpui-pre-scheduler", - "gpui-pre-util", - "image", - "itertools 0.14.0", - "log", - "objc", - "objc2 0.6.5", - "objc2-app-kit 0.3.2", - "objc2-core-video", - "objc2-foundation 0.3.2", - "objc2-user-notifications", - "parking_lot", - "raw-window-handle", - "semver", - "smallvec", - "strum", - "uuid", -] - -[[package]] -name = "gpui-pre-macros" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bb80dac5e1f6b8cde1d2740389e77dfc0071bfcc81fba5526d5dc90f68171cc" -dependencies = [ - "heck 0.5.0", - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "gpui-pre-platform" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbdbdac421178313fed8929fe95b42634a266a735079fcf03ff231bc2ccb2c5e" -dependencies = [ - "anyhow", - "console_error_panic_hook", - "gpui-pre", - "gpui-pre-linux", - "gpui-pre-macos", - "gpui-pre-web", - "gpui-pre-windows", -] - -[[package]] -name = "gpui-pre-refineable" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "237703b3b219d11adb50dd33bb0fcca3d34fc001623b3143e72cb051d0fb3777" -dependencies = [ - "gpui-pre-derive-refineable", -] - -[[package]] -name = "gpui-pre-reqwest" -version = "0.12.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05be23908e707966824f8c51a609904b7f30739e8d915e120a53c1b995ba964c" -dependencies = [ - "base64 0.22.1", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "h2", + "base64", "http", - "http-body", - "http-body-util", - "hyper", - "hyper-rustls", - "hyper-util", - "ipnet", - "js-sys", - "log", - "mime", - "mime_guess", - "once_cell", - "percent-encoding", - "pin-project-lite", - "quinn", - "rustls", - "rustls-native-certs", - "rustls-pemfile", - "rustls-pki-types", - "serde", - "serde_json", - "serde_urlencoded", - "sync_wrapper", - "system-configuration", - "tokio", - "tokio-rustls", - "tokio-socks", - "tokio-util", - "tower", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "wasm-streams", - "web-sys", - "windows-registry 0.4.0", -] - -[[package]] -name = "gpui-pre-scheduler" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83f342555282a59ed8dd58dd7e0a920524fa8ef6aa8c8f30e2edb7019a8f72cb" -dependencies = [ - "async-task", - "backtrace", - "chrono", - "flume", - "futures", - "parking_lot", - "rand 0.9.5", - "wasm_thread", - "web-time", -] - -[[package]] -name = "gpui-pre-shared-string" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71f488bf4780735f6b2dad24f8db1e3d9e2593de0ec298e3574c788f571b81c4" -dependencies = [ - "schemars", - "serde", - "smol_str", -] - -[[package]] -name = "gpui-pre-sum-tree" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aadb3bd3da22617e2158b1842f5a9c29c1626c926ad0686163ced1a009963ff3" -dependencies = [ - "gpui-pre-ztracing", - "heapless", - "rayon", - "tracing", -] - -[[package]] -name = "gpui-pre-util" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a04ec9abd7a87ac05a221f4629403831c44c17123bc33cb5d271a6303259b340" -dependencies = [ - "anyhow", - "log", - "which", -] - -[[package]] -name = "gpui-pre-web" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aedd55b99dc77e28df8202b0ea868aa5c90fda4aefff539ea21087d7c2ff4bfb" -dependencies = [ - "anyhow", - "async-channel", - "console_error_panic_hook", - "futures", - "gpui-pre", - "gpui-pre-http-client", - "gpui-pre-scheduler", - "gpui-pre-wgpu", - "js-sys", - "log", - "parking_lot", - "raw-window-handle", - "smallvec", - "unicode-properties", - "unicode-script", - "unicode-segmentation", - "uuid", - "wasm-bindgen", - "wasm-bindgen-futures", - "wasm_thread", - "web-sys", - "web-time", -] - -[[package]] -name = "gpui-pre-wgpu" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b1cdb26c1503bf9662ee8fbc5ab0b44b2deeee4b5c12dc67491ba6fb5fc544b" -dependencies = [ - "anyhow", - "bytemuck", - "cosmic-text", - "etagere", - "gpui-pre", - "gpui-pre-collections", - "gpui-pre-util", - "itertools 0.14.0", - "log", - "parking_lot", - "profiling", - "raw-window-handle", - "smallvec", - "swash", - "unicode-bidi", - "unicode-segmentation", - "web-sys", - "wgpu", - "zed-font-kit", -] - -[[package]] -name = "gpui-pre-windows" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "513d4f0fc7d596d3bdef2a73a524ffb83dabc95bf484f2855a698e7f431290a9" -dependencies = [ - "accesskit", - "accesskit_windows", - "anyhow", - "dunce", - "etagere", - "futures", - "gpui-pre", - "gpui-pre-collections", - "gpui-pre-scheduler", - "gpui-pre-util", - "image", - "itertools 0.14.0", - "log", - "parking_lot", - "rand 0.9.5", - "raw-window-handle", - "smallvec", - "uuid", - "windows 0.62.2", - "windows-core 0.62.2", - "windows-numerics 0.3.1", - "windows-registry 0.6.1", -] - -[[package]] -name = "gpui-pre-ztracing" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f17bfd6bd1f77ba5c58181fa6f82fc7a63015a1c58bef94a76e5acb9f8e42572" -dependencies = [ - "gpui-pre-ztracing-macro", - "tracing", -] - -[[package]] -name = "gpui-pre-ztracing-macro" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b0d73e1bc02eef886a5947f41b8512708792e9e5d3053d181843311a487f96f" - -[[package]] -name = "granit-parser" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e20f99e46474f56bd905c56e817ebddcf377a611f94c53ac4649e4d3fa3c0cd0" -dependencies = [ - "arraydeque", - "smallvec", -] - -[[package]] -name = "h2" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d29020232d6aa3fb1daca64c1127cf662cf97f254ae16c18c05b8ab635fc118" -dependencies = [ - "atomic-waker", - "bytes", - "fnv", - "futures-core", - "futures-sink", - "http", - "indexmap", - "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 = [ - "cfg-if", - "crunchy", - "num-traits", - "zerocopy", -] - -[[package]] -name = "harfrust" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9da2e5ae821f6e96664977bf974d6d6a2d6682f9ccee23e62ec1d134246845f9" -dependencies = [ - "bitflags 2.13.2", - "bytemuck", - "core_maths", - "read-fonts 0.37.0", - "smallvec", -] - -[[package]] -name = "hash32" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606" -dependencies = [ - "byteorder", -] - -[[package]] -name = "hashbrown" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" - -[[package]] -name = "hashbrown" -version = "0.15.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" -dependencies = [ - "foldhash 0.1.5", -] - -[[package]] -name = "hashbrown" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" -dependencies = [ - "allocator-api2", - "equivalent", - "foldhash 0.2.0", -] - -[[package]] -name = "hashbrown" -version = "0.17.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" - -[[package]] -name = "heapless" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25ba4bd83f9415b58b4ed8dc5714c76e626a105be4646c02630ad730ad3b5aa4" -dependencies = [ - "hash32", - "stable_deref_trait", -] - -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - -[[package]] -name = "hermit-abi" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e17592d60ebacc7d5e169f4663c5f84f9161cc90328abcfe8456f41e4dfcb284" - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "hexf-parse" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" - -[[package]] -name = "hkdf" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" -dependencies = [ - "hmac", -] - -[[package]] -name = "hmac" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" -dependencies = [ - "digest 0.10.7", -] - -[[package]] -name = "html5ever" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c13771afe0e6e846f1e67d038d4cb29998a6779f93c809212e4e9c32efd244d4" -dependencies = [ - "log", - "mac", - "markup5ever", - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "http" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0" -dependencies = [ - "bytes", - "itoa", -] - -[[package]] -name = "http-body" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c" -dependencies = [ - "bytes", - "http", -] - -[[package]] -name = "http-body-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c" -dependencies = [ - "bytes", - "futures-core", - "http", - "http-body", - "pin-project-lite", -] - -[[package]] -name = "httparse" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" - -[[package]] -name = "hybrid-array" -version = "0.4.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27f864f10dfb56725ce5ce5472bc52252c8f93a4ab86327122cebf62c5f59a17" -dependencies = [ - "typenum", -] - -[[package]] -name = "hyper" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c3e324da4c95177d6291d4c8730197c0d1822f8a9766814a4a44fa5ab797c9c" -dependencies = [ - "atomic-waker", - "bytes", - "futures-channel", - "futures-core", - "h2", - "http", - "http-body", - "httparse", - "itoa", - "pin-project-lite", - "smallvec", - "tokio", - "want", -] - -[[package]] -name = "hyper-rustls" -version = "0.27.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfa8e654703247911e29c23fbeaa261834bd9bb74efba2f9acddc37bfb127f53" -dependencies = [ - "http", - "hyper", - "hyper-util", - "rustls", - "rustls-native-certs", - "tokio", - "tokio-rustls", - "tower-service", -] - -[[package]] -name = "hyper-util" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddc03d96684f9226b8a787cdb71488417b53ab5ea8fdb1dac946cb9431cc8bff" -dependencies = [ - "bytes", - "futures-channel", - "futures-util", - "http", - "http-body", "httparse", - "hyper", - "libc", - "pin-project-lite", - "socket2", - "tokio", - "tower-service", - "tracing", -] - -[[package]] -name = "iana-time-zone" -version = "0.1.65" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "log", - "wasm-bindgen", - "windows-core 0.62.2", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - -[[package]] -name = "icu_collections" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa68d21081c4a05d5a901a1c62add574c77048b6a1c67be3b50ce0b60d4ca513" -dependencies = [ - "displaydoc", - "potential_utf", - "utf8_iter", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_locale_core" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d56e28588da92eee5c3201a6eff33fabdd49b62269c8938d4ff050ce4d900deb" -dependencies = [ - "displaydoc", - "litemap", - "tinystr", - "writeable", - "zerovec", -] - -[[package]] -name = "icu_normalizer" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12f9cf5f235641ed274641dd81c3f28d870e276763d0797aeeab72317b1c646f" -dependencies = [ - "icu_collections", - "icu_normalizer_data", - "icu_properties", - "icu_provider", - "smallvec", - "zerovec", -] - -[[package]] -name = "icu_normalizer_data" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1563da1ed3e0b3bf3d74c9b85917ac9c56464d2f57242270c09c9e752f8021a0" - -[[package]] -name = "icu_properties" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e7ca276ad3145661a65914e6daf131ca5120cd3dcee8f8f3214b8875184a148" -dependencies = [ - "displaydoc", - "icu_collections", - "icu_locale_core", - "icu_properties_data", - "icu_provider", - "zerotrie", - "zerovec", -] - -[[package]] -name = "icu_properties_data" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e590f038c1464a96894fd6d10127e90a8be4509f56ff7ecef851b15cee0b7caa" - -[[package]] -name = "icu_provider" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d27bbb9d3abbefac45d55f647c9de1d44aafcd1186eb91879afef17c396c3e73" -dependencies = [ - "displaydoc", - "icu_locale_core", - "writeable", - "yoke", - "zerofrom", - "zerotrie", - "zerovec", -] - -[[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 = "ignore" -version = "0.4.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b69833ed729dc5aa7d19541d96d6cf8e9137194207a04916d658e43168402f" -dependencies = [ - "crossbeam-deque", - "globset", - "log", - "memchr", - "regex-automata", - "same-file", - "walkdir", - "winapi-util", -] - -[[package]] -name = "image" -version = "0.25.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85ab80394333c02fe689eaf900ab500fbd0c2213da414687ebf995a65d5a6104" -dependencies = [ - "bytemuck", - "byteorder-lite", - "color_quant", - "exr", - "gif 0.14.2", - "image-webp", - "moxcms", - "num-traits", - "png 0.18.1", - "qoi", - "ravif", - "rayon", - "tiff", - "zune-core 0.5.3", - "zune-jpeg 0.5.15", -] - -[[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 = "imagesize" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edcd27d72f2f071c64249075f42e205ff93c9a4c5f6c6da53e79ed9f9832c285" - -[[package]] -name = "imagesize" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09e54e57b4c48b40f7aec75635392b12b3421fa26fe8b4332e63138ed278459c" - -[[package]] -name = "imgref" -version = "1.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e44b0a4eaa4c82f441d50a963f2d5f05a787240aeee097597033e72accfd22f" - -[[package]] -name = "indexmap" -version = "2.14.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" -dependencies = [ - "equivalent", - "hashbrown 0.17.1", - "serde", - "serde_core", -] - -[[package]] -name = "inotify" -version = "0.11.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cc00ea907cab49550b7da656f80ebb97be1b997d931fbcd28d39734e17ce592" -dependencies = [ - "bitflags 2.13.2", - "inotify-sys", - "libc", -] - -[[package]] -name = "inotify-sys" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c033f80b2c113cdf91ab7a33faa9cbc014726dcad99880c8609af2a370edf37d" -dependencies = [ - "libc", -] - -[[package]] -name = "inout" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" -dependencies = [ - "block-padding", - "generic-array", -] - -[[package]] -name = "instant" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - -[[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.119", -] - -[[package]] -name = "inventory" -version = "0.3.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6928282826c822ad91bf1c9a1cb90a30ba1c26770749929b4656cd6be829cd7c" -dependencies = [ - "rustversion", -] - -[[package]] -name = "ipnet" -version = "2.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "791930b43c0d5973160d90a8f3894509f2b273430f5c5c73b668636d0287c5c0" - -[[package]] -name = "is-docker" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "928bae27f42bc99b60d9ac7334e3a21d10ad8f1835a4e12ec3ec0464765ed1b3" -dependencies = [ - "once_cell", -] - -[[package]] -name = "is-wsl" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "173609498df190136aa7dea1a91db051746d339e18476eed5ca40521f02d7aa5" -dependencies = [ - "is-docker", - "once_cell", -] - -[[package]] -name = "itertools" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" -dependencies = [ - "either", -] - -[[package]] -name = "itertools" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" -dependencies = [ - "either", -] - -[[package]] -name = "itertools" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" - -[[package]] -name = "jni-sys" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258" -dependencies = [ - "jni-sys 0.4.1", -] - -[[package]] -name = "jni-sys" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2" -dependencies = [ - "jni-sys-macros", -] - -[[package]] -name = "jni-sys-macros" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" -dependencies = [ - "quote", - "syn 2.0.119", -] - -[[package]] -name = "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.106" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7883d941dae510fb2d978fc3fe018c71c9e2892fd38854de3e8b92c2e5ad9cc5" -dependencies = [ - "cfg-if", - "futures-util", - "wasm-bindgen", -] - -[[package]] -name = "khronos-egl" -version = "6.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76" -dependencies = [ - "libc", - "libloading", - "pkg-config", -] - -[[package]] -name = "khronos_api" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" - -[[package]] -name = "kqueue" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d763e5b24120b4ddf50de6c92308156765aabfbbccebf401da7cff2d70a41ea" -dependencies = [ - "kqueue-sys", - "libc", -] - -[[package]] -name = "kqueue-sys" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07293a4e297ac234359b510362495713f75ea345d5307140414f20c69ffeb087" -dependencies = [ - "bitflags 2.13.2", - "libc", -] - -[[package]] -name = "kurbo" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62026ae44756f8a599ba21140f350303d4f08dcdcc71b5ad9c9bb8128c13c62" -dependencies = [ - "arrayvec", - "euclid", - "smallvec", -] - -[[package]] -name = "kurbo" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b60dfc32f652b926df6192e55525b16d186c69d47876c3ead4da5cc9f8450e2" -dependencies = [ - "arrayvec", - "euclid", - "polycool", - "smallvec", -] - -[[package]] -name = "lazy_static" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb" - -[[package]] -name = "lebe" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a79a3332a6609480d7d0c9eab957bca6b455b91bb84e66d19f5ff66294b85b8" - -[[package]] -name = "libc" -version = "0.2.190" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce5d3ddc6d3fa000eb1536d85e147bfe31aacaba692ed6a876f95cb7c855be78" - -[[package]] -name = "libfuzzer-sys" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9fd2f41a1cba099f79a0b6b6c35656cf7c03351a7bae8ff0f28f25270f929d2" -dependencies = [ - "arbitrary", - "cc", -] - -[[package]] -name = "libloading" -version = "0.8.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" -dependencies = [ - "cfg-if", - "windows-link 0.2.1", -] - -[[package]] -name = "libm" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" - -[[package]] -name = "libredox" -version = "0.1.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61ff90caf6077a803a240f62fdbe88645a890bbca49ef8174c3cb0404362171d" -dependencies = [ - "libc", -] - -[[package]] -name = "linebender_resource_handle" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" - -[[package]] -name = "link-section" -version = "0.19.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39c29a617ce3df32c08497bdc1ab6e2376e0b17948ac166a2fbe5977c5954cd9" - -[[package]] -name = "linktime-proc-macro" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e57c38c1e860fd37c604281cdfb1dd2216977fd76a50f85ba2f388ef3219616" - -[[package]] -name = "linux-raw-sys" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" - -[[package]] -name = "litemap" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" - -[[package]] -name = "litrs" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4744e383959f0db86ede514b809b1c53251889093803c05267acc7d4e7030d70" - -[[package]] -name = "lock_api" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" -dependencies = [ - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" -dependencies = [ - "serde_core", -] - -[[package]] -name = "loop9" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fae87c125b03c1d2c0150c90365d7d6bcc53fb73a9acaef207d2d065860f062" -dependencies = [ - "imgref", -] - -[[package]] -name = "lru-slab" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4050469837a6ff301cd14c1f8f24f88549e6d548f24f64e2148eb0f72cebc51f" - -[[package]] -name = "lsp-types" -version = "0.97.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53353550a17c04ac46c585feb189c2db82154fc84b79c7a66c96c2c644f66071" -dependencies = [ - "bitflags 1.3.2", - "fluent-uri", - "serde", - "serde_json", - "serde_repr", -] - -[[package]] -name = "lyon" -version = "1.0.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd0578bdecb7d6d88987b8b2b1e3a4e2f81df9d0ece1078623324a567904e7b7" -dependencies = [ - "lyon_algorithms", - "lyon_tessellation", -] - -[[package]] -name = "lyon_algorithms" -version = "1.0.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdfa8785f95e57914ddb35e3b59994aeba6f5e79e9cfd03da1c269f010f36009" -dependencies = [ - "lyon_path", - "num-traits", -] - -[[package]] -name = "lyon_geom" -version = "1.0.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4336502e29e32af93cf2dad2214ed6003c17ceb5bd499df77b1de663b9042b92" -dependencies = [ - "arrayvec", - "euclid", - "num-traits", -] - -[[package]] -name = "lyon_path" -version = "1.0.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c463f9c428b7fc5ec885dcd39ce4aa61e29111d0e33483f6f98c74e89d8621e" -dependencies = [ - "lyon_geom", - "num-traits", -] - -[[package]] -name = "lyon_tessellation" -version = "1.0.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43b8dcf906637ecef61b3c0740c7a4e7f27caeb31257cfac0cc579ce15be6005" -dependencies = [ - "float_next_after", - "lyon_path", - "num-traits", -] - -[[package]] -name = "mac" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" - -[[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 0.6.5", - "objc2-foundation 0.3.2", - "time", - "uuid", -] - -[[package]] -name = "mach2" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dae608c151f68243f2b000364e1f7b186d9c29845f7d2d85bd31b9ad77ad552b" - -[[package]] -name = "malloc_buf" -version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" -dependencies = [ - "libc", -] - -[[package]] -name = "markdown" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5cab8f2cadc416a82d2e783a1946388b31654d391d1c7d92cc1f03e295b1deb" -dependencies = [ - "serde", - "unicode-id", -] - -[[package]] -name = "markup5ever" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16ce3abbeba692c8b8441d036ef91aea6df8da2c6b6e21c7e14d3c18e526be45" -dependencies = [ - "log", - "phf 0.11.3", - "phf_codegen", - "string_cache", - "string_cache_codegen", - "tendril", -] - -[[package]] -name = "markup5ever_rcdom" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edaa21ab3701bfee5099ade5f7e1f84553fd19228cf332f13cd6e964bf59be18" -dependencies = [ - "html5ever", - "markup5ever", - "tendril", - "xml5ever", -] - -[[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 = "md-5" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" -dependencies = [ - "cfg-if", - "digest 0.10.7", -] - -[[package]] -name = "memchr" -version = "2.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" - -[[package]] -name = "memmap2" -version = "0.9.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1219ed1b7f229ee7104d281dd01d6802fe28bb6e95d292942c4daacdeb798c0" -dependencies = [ - "libc", -] - -[[package]] -name = "memoffset" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" -dependencies = [ - "autocfg", -] - -[[package]] -name = "metal" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7047791b5bc903b8cd963014b355f71dc9864a9a0b727057676c1dcae5cbc15" -dependencies = [ - "bitflags 2.13.2", - "block", - "core-graphics-types 0.2.0", - "foreign-types 0.5.0", - "log", - "objc", - "paste", -] - -[[package]] -name = "mime" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" - -[[package]] -name = "mime_guess" -version = "2.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" -dependencies = [ - "mime", - "unicase", -] - -[[package]] -name = "miniz_oxide" -version = "0.8.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" -dependencies = [ - "adler2", - "simd-adler32", -] - -[[package]] -name = "miniz_oxide" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c" -dependencies = [ - "adler2", - "simd-adler32", -] - -[[package]] -name = "mio" -version = "1.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1788edb87fdc09c7e26304471e2f5be8cdefb1b6930d6e3985fc02ff53bf86ee" -dependencies = [ - "libc", - "log", - "wasi", - "windows-sys 0.61.2", -] - -[[package]] -name = "moxcms" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb85c154ba489f01b25c0d36ae69a87e4a1c73a72631fc6c0eb6dde34a73e44b" -dependencies = [ - "num-traits", - "pxfm", -] - -[[package]] -name = "multiversion_no_op" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "743fb55ba31b18fb1ecef6bdc9aa2743314978ac084044301a7eee33fb99a20d" - -[[package]] -name = "naga" -version = "29.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2bf919621e7975acb27d881bae2fb993e0d45c8e0446e85e6272971e00dc8df" -dependencies = [ - "arrayvec", - "bit-set", - "bitflags 2.13.2", - "cfg-if", - "cfg_aliases", - "codespan-reporting", - "half", - "hashbrown 0.16.1", - "hexf-parse", - "indexmap", - "libm", - "log", - "num-traits", - "once_cell", - "rustc-hash 1.1.0", - "spirv", - "thiserror 2.0.21", - "unicode-ident", -] - -[[package]] -name = "native-tls" -version = "0.2.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "465500e14ea162429d264d44189adc38b199b62b1c21eea9f69e4b73cb03bbf2" -dependencies = [ - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - -[[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 = "nohash-hasher" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" - -[[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 = "normpath" -version = "1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b11ce00d2594068e8a27c9146fdc5cf9f3ac38eb42c7cd34d05fea618873ac9f" -dependencies = [ - "windows-sys 0.61.2", -] - -[[package]] -name = "notify" -version = "8.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d3d07927151ff8575b7087f245456e549fea62edf0ec4e565a5ee50c8402bc3" -dependencies = [ - "bitflags 2.13.2", - "fsevent-sys", - "inotify", - "kqueue", - "libc", - "log", - "mio", - "notify-types", - "walkdir", - "windows-sys 0.60.2", -] - -[[package]] -name = "notify-rust" -version = "4.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4587364a9a0074333429b3df75a30a205340c56a536ca3eb6ca0e59b87bbf8af" -dependencies = [ - "futures-lite", - "log", - "mac-notification-sys", - "serde", - "tauri-winrt-notification", - "zbus", -] - -[[package]] -name = "notify-types" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42b8cfee0e339a0337359f3c88165702ac6e600dc01c0cc9579a92d62b08477a" -dependencies = [ - "bitflags 2.13.2", -] - -[[package]] -name = "ntapi" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3b335231dfd352ffb0f8017f3b6027a4917f7df785ea2143d8af2adc66980ae" -dependencies = [ - "winapi", -] - -[[package]] -name = "num" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" -dependencies = [ - "num-bigint", - "num-complex", - "num-integer", - "num-iter", - "num-rational", - "num-traits", -] - -[[package]] -name = "num-bigint" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367" -dependencies = [ - "num-integer", - "num-traits", -] - -[[package]] -name = "num-bigint-dig" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7f9a86e097b0d187ad0e65667c2f58b9254671e86e7dbb78036b16692eae099" -dependencies = [ - "libm", - "num-integer", - "num-iter", - "num-traits", - "once_cell", - "rand 0.9.5", - "serde", - "smallvec", - "zeroize", -] - -[[package]] -name = "num-complex" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" -dependencies = [ - "bytemuck", - "num-traits", -] - -[[package]] -name = "num-conv" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" - -[[package]] -name = "num-derive" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "num-integer" -version = "0.1.47" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-iter" -version = "0.1.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c92800bd69a1eac91786bcfe9da64a897eb72911b8dc3095decbd07429e8048b" -dependencies = [ - "num-integer", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" -dependencies = [ - "num-bigint", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", - "libm", -] - -[[package]] -name = "num_cpus" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "objc" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" -dependencies = [ - "malloc_buf", - "objc_exception", -] - -[[package]] -name = "objc-foundation" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9" -dependencies = [ - "block", - "objc", - "objc_id", -] - -[[package]] -name = "objc-sys" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310" - -[[package]] -name = "objc2" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19d5490aaf8f1d7cf7688dfa9b0ce07900e168852c45cd2c03f534dfd27cfd0b" -dependencies = [ - "objc-sys", - "objc2-encode", -] - -[[package]] -name = "objc2" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08849bbd4767dfae9457696856ae1c84fe4e0281bbe4a7abff2d0e06fb7981f8" -dependencies = [ - "objc2-encode", -] - -[[package]] -name = "objc2-app-kit" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff" -dependencies = [ - "bitflags 2.13.2", - "block2 0.5.1", - "libc", - "objc2 0.5.3", - "objc2-core-data 0.2.2", - "objc2-core-image 0.2.2", - "objc2-foundation 0.2.2", - "objc2-quartz-core 0.2.2", -] - -[[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.2", - "block2 0.6.2", - "libc", - "objc2 0.6.5", - "objc2-cloud-kit", - "objc2-core-data 0.3.2", - "objc2-core-foundation", - "objc2-core-graphics", - "objc2-core-image 0.3.2", - "objc2-core-text", - "objc2-core-video", - "objc2-foundation 0.3.2", - "objc2-quartz-core 0.3.2", -] - -[[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.2", - "objc2 0.6.5", - "objc2-foundation 0.3.2", -] - -[[package]] -name = "objc2-core-data" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef" -dependencies = [ - "bitflags 2.13.2", - "block2 0.5.1", - "objc2 0.5.3", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "objc2-core-data" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b402a653efbb5e82ce4df10683b6b28027616a2715e90009947d50b8dd298fa" -dependencies = [ - "bitflags 2.13.2", - "objc2 0.6.5", - "objc2-foundation 0.3.2", -] - -[[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.2", - "dispatch2", - "objc2 0.6.5", -] - -[[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.2", - "dispatch2", - "objc2 0.6.5", - "objc2-core-foundation", - "objc2-io-surface", -] - -[[package]] -name = "objc2-core-image" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80" -dependencies = [ - "block2 0.5.1", - "objc2 0.5.3", - "objc2-foundation 0.2.2", - "objc2-metal 0.2.2", -] - -[[package]] -name = "objc2-core-image" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d563b38d2b97209f8e861173de434bd0214cf020e3423a52624cd1d989f006" -dependencies = [ - "objc2 0.6.5", - "objc2-foundation 0.3.2", -] - -[[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.2", - "objc2 0.6.5", - "objc2-core-foundation", - "objc2-core-graphics", -] - -[[package]] -name = "objc2-core-video" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d425caf1df73233f29fd8a5c3e5edbc30d2d4307870f802d18f00d83dc5141a6" -dependencies = [ - "bitflags 2.13.2", - "objc2 0.6.5", - "objc2-core-foundation", - "objc2-core-graphics", - "objc2-io-surface", - "objc2-metal 0.3.2", -] - -[[package]] -name = "objc2-encode" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" - -[[package]] -name = "objc2-foundation" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8" -dependencies = [ - "bitflags 2.13.2", - "block2 0.5.1", - "libc", - "objc2 0.5.3", -] - -[[package]] -name = "objc2-foundation" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" -dependencies = [ - "bitflags 2.13.2", - "block2 0.6.2", - "libc", - "objc2 0.6.5", - "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.2", - "objc2 0.6.5", - "objc2-core-foundation", -] - -[[package]] -name = "objc2-metal" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6" -dependencies = [ - "bitflags 2.13.2", - "block2 0.5.1", - "objc2 0.5.3", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "objc2-metal" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0125f776a10d00af4152d74616409f0d4a2053a6f57fa5b7d6aa2854ac04794" -dependencies = [ - "bitflags 2.13.2", - "block2 0.6.2", - "objc2 0.6.5", - "objc2-foundation 0.3.2", -] - -[[package]] -name = "objc2-quartz-core" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a" -dependencies = [ - "bitflags 2.13.2", - "block2 0.5.1", - "objc2 0.5.3", - "objc2-foundation 0.2.2", - "objc2-metal 0.2.2", -] - -[[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.2", - "objc2 0.6.5", - "objc2-core-foundation", - "objc2-foundation 0.3.2", - "objc2-metal 0.3.2", -] - -[[package]] -name = "objc2-security" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "709fe137109bd1e8b5a99390f77a7d8b2961dafc1a1c5db8f2e60329ad6d895a" -dependencies = [ - "objc2-core-foundation", -] - -[[package]] -name = "objc2-user-notifications" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9df9128cbbfef73cda168416ccf7f837b62737d748333bfe9ab71c245d76613e" -dependencies = [ - "bitflags 2.13.2", - "block2 0.6.2", - "objc2 0.6.5", - "objc2-foundation 0.3.2", -] - -[[package]] -name = "objc_exception" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad970fb455818ad6cba4c122ad012fae53ae8b4795f86378bce65e4f6bab2ca4" -dependencies = [ - "cc", -] - -[[package]] -name = "objc_id" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b" -dependencies = [ - "objc", -] - -[[package]] -name = "object" -version = "0.37.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" -dependencies = [ - "memchr", -] - -[[package]] -name = "once_cell" -version = "1.21.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" - -[[package]] -name = "oo7" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78f2bfed90f1618b4b48dcad9307f25e14ae894e2949642c87c351601d62cebd" -dependencies = [ - "aes", - "ashpd", - "async-fs", - "async-io", - "async-lock", - "blocking", - "cbc", - "cipher", - "digest 0.10.7", - "endi", - "futures-lite", - "futures-util", - "getrandom 0.4.3", - "hkdf", - "hmac", - "md-5", - "num", - "num-bigint-dig", - "pbkdf2", - "serde", - "serde_bytes", - "sha2 0.10.9", - "subtle", - "zbus", - "zbus_macros", - "zeroize", - "zvariant", -] - -[[package]] -name = "open" -version = "5.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa576c76302b7b808eecc68061e67336c47833ef9d22caa74dda10fa9675eebc" -dependencies = [ - "is-wsl", - "libc", -] - -[[package]] -name = "openssl" -version = "0.10.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77823a27f0babb03091cb9ed9ef80af3b39dbc82f97e8fa530374b7dafd87a45" -dependencies = [ - "bitflags 2.13.2", - "cfg-if", - "foreign-types 0.3.2", - "libc", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "openssl-probe" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" - -[[package]] -name = "openssl-sys" -version = "0.9.117" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b47e7e6bb2c38cd930d25a23b40fa52e068c10e85f3e03a7f5ba5aaca5713695" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "option-ext" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" - -[[package]] -name = "ordered-float" -version = "5.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c7c9e0d9b23589f26070720bac724174bfec1083e82f7854cdd0267518343c0" -dependencies = [ - "num-traits", -] - -[[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 = "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 = "pathfinder_geometry" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b7e7b4ea703700ce73ebf128e1450eb69c3a8329199ffbfb9b2a0418e5ad3" -dependencies = [ - "log", - "pathfinder_simd", -] - -[[package]] -name = "pathfinder_simd" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4500030c302e4af1d423f36f3b958d1aecb6c04184356ed5a833bf6b60435777" -dependencies = [ - "rustc_version", -] - -[[package]] -name = "pbkdf2" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" -dependencies = [ - "digest 0.10.7", - "hmac", -] - -[[package]] -name = "pem-rfc7468" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6305423e0e7738146434843d1694d621cce767262b2a86910beab705e4493d9" -dependencies = [ - "base64ct", -] - -[[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.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" -dependencies = [ - "phf_shared 0.11.3", -] - -[[package]] -name = "phf" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf" -dependencies = [ - "phf_macros", - "phf_shared 0.13.1", - "serde", -] - -[[package]] -name = "phf_codegen" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aef8048c789fa5e851558d709946d6d79a8ff88c0440c587967f8e94bfb1216a" -dependencies = [ - "phf_generator 0.11.3", - "phf_shared 0.11.3", -] - -[[package]] -name = "phf_generator" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" -dependencies = [ - "phf_shared 0.11.3", - "rand 0.8.8", -] - -[[package]] -name = "phf_generator" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737" -dependencies = [ - "fastrand", - "phf_shared 0.13.1", -] - -[[package]] -name = "phf_macros" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "812f032b54b1e759ccd5f8b6677695d5268c588701effba24601f6932f8269ef" -dependencies = [ - "phf_generator 0.13.1", - "phf_shared 0.13.1", - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "phf_shared" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" -dependencies = [ - "siphasher", -] - -[[package]] -name = "phf_shared" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266" -dependencies = [ - "siphasher", -] - -[[package]] -name = "pico-args" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315" - -[[package]] -name = "pin-project" -version = "1.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2466b2336ed02bcdca6b294417127b90ec92038d1d5c4fbeac971a922e0e0924" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c96395f0a926bc13b1c17622aaddda1ecb55d49c8f1bf9777e4d877800a43f8b" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[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.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548" - -[[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 0.8.9", -] - -[[package]] -name = "png" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61" -dependencies = [ - "bitflags 2.13.2", - "crc32fast", - "fdeflate", - "flate2", - "miniz_oxide 0.8.9", -] - -[[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 = "pollster" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f3a9f18d041e6d0e102a0a46750538147e5e8992d3b4873aaafee2520b00ce3" - -[[package]] -name = "polycool" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50596ddc09eb5ad5f75cacd40209568e66df71baf86e1499a0e99c4cff12a5a6" -dependencies = [ - "arrayvec", -] - -[[package]] -name = "portable-atomic" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85" - -[[package]] -name = "portable-atomic-util" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715" -dependencies = [ - "portable-atomic", -] - -[[package]] -name = "potential_utf" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" -dependencies = [ - "zerovec", -] - -[[package]] -name = "powerfmt" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a6394b9e965e73d0a289ee54f589087e2c676aedf60885baf52c76b771e4958" - -[[package]] -name = "ppv-lite86" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" -dependencies = [ - "zerocopy", -] - -[[package]] -name = "precomputed-hash" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" - -[[package]] -name = "presser" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa" - -[[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.17+spec-1.1.0", -] - -[[package]] -name = "proc-macro2" -version = "1.0.107" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "profiling" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d595e54a326bc53c1c197b32d295e14b169e3cfeaa8dc82b529f947fba6bcf5" -dependencies = [ - "profiling-procmacros", -] - -[[package]] -name = "profiling-procmacros" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4488a4a36b9a4ba6b9334a32a39971f77c1436ec82c38707bce707699cc3bbcb" -dependencies = [ - "quote", - "syn 2.0.119", -] - -[[package]] -name = "pulp" -version = "0.22.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046aa45b989642ec2e4717c8e72d677b13edd831a4d3b6cf37d9a3e54912496a" -dependencies = [ - "bytemuck", - "cfg-if", - "libm", - "num-complex", - "paste", - "pulp-wasm-simd-flag", - "raw-cpuid", - "reborrow", - "version_check", -] - -[[package]] -name = "pulp-wasm-simd-flag" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d8f70e07b9c3962945a74e59ca1c511bba65b6419468acc217c457d93f3c740" - -[[package]] -name = "pxfm" -version = "0.1.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d55d956fa96f5ec02be2e13af0e20391a5aa83d6a074e3ad368959d0fab299ea" - -[[package]] -name = "qoi" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f6d64c71eb498fe9eae14ce4ec935c555749aef511cca85b5568910d6e48001" -dependencies = [ - "bytemuck", -] - -[[package]] -name = "quick-error" -version = "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 = "quill-agent" -version = "0.1.0" -dependencies = [ - "quill-llama", - "serde", - "serde_json", - "similar", -] - -[[package]] -name = "quill-code" -version = "0.1.0" -dependencies = [ - "base64 0.22.1", - "futures", - "gpui-kit", - "quill-agent", - "quill-llama", - "quill-weave", - "serde", - "serde_json", - "ureq", - "winres", -] - -[[package]] -name = "quill-llama" -version = "0.1.0" -dependencies = [ - "serde", - "serde_json", - "ureq", -] - -[[package]] -name = "quill-weave" -version = "0.1.0" - -[[package]] -name = "quinn" -version = "0.11.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4051e23e9185c255a7e33ef59cdbca87a22d359052eecd22fc6b901fb37d9d11" -dependencies = [ - "bytes", - "cfg_aliases", - "pin-project-lite", - "quinn-proto", - "quinn-udp", - "rustc-hash 2.1.3", - "rustls", - "socket2", - "thiserror 2.0.21", - "tokio", - "tracing", - "web-time", -] - -[[package]] -name = "quinn-proto" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e750cca55fe4f0439a15d0bb529da9651e79993e8e72c61a899a36d462befbe" -dependencies = [ - "bytes", - "getrandom 0.4.3", - "lru-slab", - "rand 0.10.3", - "rand_pcg", - "ring", - "rustc-hash 2.1.3", - "rustls", - "rustls-pki-types", - "slab", - "thiserror 2.0.21", - "tinyvec", - "tracing", - "web-time", -] - -[[package]] -name = "quinn-udp" -version = "0.5.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af66907df18639dcf4db56ca65490cabc4b27a97dbadd96f2926cca73298f016" -dependencies = [ - "cfg_aliases", - "libc", - "once_cell", - "socket2", - "tracing", - "windows-sys 0.61.2", -] - -[[package]] -name = "quote" -version = "1.0.47" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "r-efi" -version = "5.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" - -[[package]] -name = "r-efi" -version = "6.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" - -[[package]] -name = "rand" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c" -dependencies = [ - "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.4", -] - -[[package]] -name = "rand" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41" -dependencies = [ - "rand_chacha 0.9.0", - "rand_core 0.9.5", -] - -[[package]] -name = "rand" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65c9fb96cbc91e3478eaae79a69fcd3f1ae4ad052e471fe6732fff548984b4af" -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 = "range-alloc" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca45419789ae5a7899559e9512e58ca889e41f04f1f2445e9f4b290ceccd1d08" - -[[package]] -name = "rangemap" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a611d15b50743feb4c76b7d03edcb0e64f399c26961e4efe6975bc398be6aa3d" - -[[package]] -name = "rav1e" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43b6dd56e85d9483277cde964fd1bdb0428de4fec5ebba7540995639a21cb32b" -dependencies = [ - "aligned-vec", - "arbitrary", - "arg_enum_proc_macro", - "arrayvec", - "av-scenechange", - "av1-grain", - "bitstream-io", - "built", - "cfg-if", - "interpolate_name", - "itertools 0.14.0", - "libc", - "libfuzzer-sys", - "log", - "maybe-rayon", - "new_debug_unreachable", - "noop_proc_macro", - "num-derive", - "num-traits", - "paste", - "profiling", - "rand 0.9.5", - "rand_chacha 0.9.0", - "simd_helpers", - "thiserror 2.0.21", - "v_frame", - "wasm-bindgen", -] - -[[package]] -name = "ravif" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e52310197d971b0f5be7fe6b57530dcd27beb35c1b013f29d66c1ad73fbbcc45" -dependencies = [ - "avif-serialize", - "imgref", - "loop9", - "quick-error", - "rav1e", - "rayon", - "rgb", -] - -[[package]] -name = "raw-cpuid" -version = "11.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "498cd0dc59d73224351ee52a95fee0f1a617a2eae0e7d9d720cc622c73a54186" -dependencies = [ - "bitflags 2.13.2", -] - -[[package]] -name = "raw-window-handle" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" - -[[package]] -name = "raw-window-metal" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40d213455a5f1dc59214213c7330e074ddf8114c9a42411eb890c767357ce135" -dependencies = [ - "objc2 0.6.5", - "objc2-core-foundation", - "objc2-foundation 0.3.2", - "objc2-quartz-core 0.3.2", -] - -[[package]] -name = "rayon" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d" -dependencies = [ - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" -dependencies = [ - "crossbeam-deque", - "crossbeam-utils", -] - -[[package]] -name = "read-fonts" -version = "0.37.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b634fabf032fab15307ffd272149b622260f55974d9fad689292a5d33df02e5" -dependencies = [ - "bytemuck", - "core_maths", - "font-types 0.11.3", -] - -[[package]] -name = "read-fonts" -version = "0.41.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046a7d674daf459825b32f5062056d6882db0d2f5a479fbd76ccfc870ac18709" -dependencies = [ - "bytemuck", - "font-types 0.12.6", - "once_cell", -] - -[[package]] -name = "reborrow" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03251193000f4bd3b042892be858ee50e8b3719f2b08e5833ac4353724632430" - -[[package]] -name = "redox_syscall" -version = "0.5.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" -dependencies = [ - "bitflags 2.13.2", -] - -[[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.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60dc65c0ff1a7ae1294b0c67b9f14baf70b644404010370171787bfac1038fc0" -dependencies = [ - "libredox", - "thiserror 2.0.21", -] - -[[package]] -name = "ref-cast" -version = "1.0.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e440fb4e4b4147295338efb76001ab9e4efc0e5839df2c47fc5ac2381d365c3" -dependencies = [ - "ref-cast-impl", -] - -[[package]] -name = "ref-cast-impl" -version = "1.0.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92ecd8964f8453721699a1ed72037b0db49ce2f5a5138486ee89bed6f67cdf3a" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "regex" -version = "1.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2" -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 = "renderdoc-sys" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832" - -[[package]] -name = "resvg" -version = "0.45.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8928798c0a55e03c9ca6c4c6846f76377427d2c1e1f7e6de3c06ae57942df43" -dependencies = [ - "gif 0.13.3", - "image-webp", - "log", - "pico-args", - "rgb", - "svgtypes 0.15.3", - "tiny-skia", - "usvg 0.45.1", - "zune-jpeg 0.4.21", -] - -[[package]] -name = "resvg" -version = "0.46.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b563218631706d614e23059436526d005b50ab5f2d506b55a17eb65c5eb83419" -dependencies = [ - "gif 0.14.2", - "image-webp", - "log", - "pico-args", - "rgb", - "svgtypes 0.16.1", - "tiny-skia", - "usvg 0.46.0", - "zune-jpeg 0.5.15", -] - -[[package]] -name = "rgb" -version = "0.8.53" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47b34b781b31e5d73e9fbc8689c70551fd1ade9a19e3e28cfec8580a79290cc4" -dependencies = [ - "bytemuck", -] - -[[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 = "ropey" -version = "2.0.0-beta.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4045a00dc327d084a2bbf126976e14125b54f23bd30511d45b842eba76c52d74" -dependencies = [ - "str_indices", -] - -[[package]] -name = "roxmltree" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c20b6793b5c2fa6553b250154b78d6d0db37e72700ae35fad9387a46f487c97" - -[[package]] -name = "roxmltree" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1964b10c76125c36f8afe190065a4bf9a87bf324842c05701330bba9f1cacbb" -dependencies = [ - "memchr", -] - -[[package]] -name = "rust-embed" -version = "8.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19afa5b4b6a611de00bd1bdae6ae6f39084c9399f0679c3f52d8469cf335cc23" -dependencies = [ - "rust-embed-impl", - "rust-embed-utils", - "walkdir", -] - -[[package]] -name = "rust-embed-impl" -version = "8.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0d8afda6374eac59e066abee06d265247ebbaf3006cf878e2879e8356e34053" -dependencies = [ - "mime_guess", - "proc-macro2", - "quote", - "rust-embed-utils", - "shellexpand", - "syn 2.0.119", - "walkdir", -] - -[[package]] -name = "rust-embed-utils" -version = "8.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d84e8ba78bd384263e5922f084cbe1b081c3b7e69add59c8fb097b879ba968a" -dependencies = [ - "globset", - "sha2 0.11.1", - "walkdir", -] - -[[package]] -name = "rust-i18n" -version = "4.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8502e73e6461c738659455c5d2cf95bc132760a6f203c717e66ee72b78906d7f" -dependencies = [ - "globwalk", - "regex", - "rust-i18n-macro", - "rust-i18n-support", - "smallvec", -] - -[[package]] -name = "rust-i18n-macro" -version = "4.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54a28dd9d46108d56b9f0c85b220908844233e561c03087890325104f90f2c6" -dependencies = [ - "glob", - "proc-macro2", - "quote", - "rust-i18n-support", - "serde", - "serde_json", - "syn 2.0.119", -] - -[[package]] -name = "rust-i18n-support" -version = "4.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e806c2a9701cbd6043992cd935c30cb1fdb128fa15e7b506f3b46f97045737c0" -dependencies = [ - "arc-swap", - "base62", - "foldhash 0.2.0", - "globwalk", - "itertools 0.11.0", - "normpath", - "serde", - "serde-saphyr", - "serde_json", - "siphasher", - "toml 0.8.23", - "triomphe", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b74b56ffa8bb2830709a538c2cbcae9aa062db0d2a42563bfb09bdaae44020eb" - -[[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.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "891efababe418670775f199f0d233d84843c227a0949a883ce15b37c78d6629d" -dependencies = [ - "bitflags 2.13.2", - "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 = [ - "once_cell", - "ring", - "rustls-pki-types", - "rustls-webpki", - "subtle", - "zeroize", -] - -[[package]] -name = "rustls-native-certs" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a073f5dc7469f984c52ad2752b63b0807745133b6de880b7b64c1ac4c48aec4" -dependencies = [ - "openssl-probe", - "rustls-pki-types", - "schannel", - "security-framework", -] - -[[package]] -name = "rustls-pemfile" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" -dependencies = [ - "rustls-pki-types", -] - -[[package]] -name = "rustls-pki-types" -version = "1.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96" -dependencies = [ - "web-time", - "zeroize", -] - -[[package]] -name = "rustls-webpki" -version = "0.103.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3c3cf1d8b1e7d4927e2d154c3fcb02979afb9939629c62cd9048d4f07b60ac2" -dependencies = [ - "ring", - "rustls-pki-types", - "untrusted", -] - -[[package]] -name = "rustversion" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" - -[[package]] -name = "rustybuzz" -version = "0.20.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd3c7c96f8a08ee34eff8857b11b49b07d71d1c3f4e88f8a88d4c9e9f90b1702" -dependencies = [ - "bitflags 2.13.2", - "bytemuck", - "core_maths", - "log", - "smallvec", - "ttf-parser", - "unicode-bidi-mirroring", - "unicode-ccc", - "unicode-properties", - "unicode-script", -] - -[[package]] -name = "ryu" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" - -[[package]] -name = "same-file" -version = "1.0.6" -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 = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab508826f74a77ca9d5aba6ff19b522583ee3eaf28a19384ff3d0e5835fadf6e" -dependencies = [ - "dyn-clone", - "indexmap", - "ref-cast", - "schemars_derive", - "serde", - "serde_json", -] - -[[package]] -name = "schemars_derive" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1c3a92094fa7d61aa124645844facb6b554dfc797136d0f5fd1f890e2bffc69" -dependencies = [ - "proc-macro2", - "quote", - "serde_derive_internals", - "syn 3.0.9", -] - -[[package]] -name = "scoped-tls" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "screencapturekit" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a5eeeb57ac94960cfe5ff4c402be6585ae4c8d29a2cf41b276048c2e849d64e" -dependencies = [ - "screencapturekit-sys", -] - -[[package]] -name = "screencapturekit-sys" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22411b57f7d49e7fe08025198813ee6fd65e1ee5eff4ebc7880c12c82bde4c60" -dependencies = [ - "block", - "dispatch", - "objc", - "objc-foundation", - "objc_id", - "once_cell", -] - -[[package]] -name = "seahash" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" - -[[package]] -name = "security-framework" -version = "3.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" -dependencies = [ - "bitflags 2.13.2", - "core-foundation 0.10.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 = "self_cell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ab42ca02749e120097e328d91d415325bdf43b1c72c4c8badf37375fe40a813" - -[[package]] -name = "semver" -version = "1.0.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" -dependencies = [ - "serde", - "serde_core", -] - -[[package]] -name = "serde" -version = "1.0.229" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" -dependencies = [ - "serde_core", - "serde_derive", -] - -[[package]] -name = "serde-saphyr" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8050abb251097357e24aff63ba2c52a6309ecb7d23a5474023df960a02694d8" -dependencies = [ - "annotate-snippets", - "base64 0.23.1", - "encoding_rs_io", - "granit-parser", - "nohash-hasher", - "num-traits", - "serde_core", - "smallvec", - "zmij", -] - -[[package]] -name = "serde_bytes" -version = "0.11.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" -dependencies = [ - "serde", - "serde_core", -] - -[[package]] -name = "serde_core" -version = "1.0.229" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.229" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "serde_derive_internals" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f852137cce035d6a4df67ccce505ff6b3e9fd3a10e3e52b24dc71e650bb1a9bd" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "serde_json" -version = "1.0.154" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" -dependencies = [ - "foldhash 0.2.0", - "indexmap", - "itoa", - "memchr", - "serde", - "serde_core", - "zmij", -] - -[[package]] -name = "serde_repr" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d3b1629de253c70a0508c3899572da79ca359fdab27c7920ff00406df418906" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[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.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e7523beb55eece201a2356bee0bbca0d1ab466c14c07703b2e0ee6d42cb0c2c" -dependencies = [ - "serde_core", -] - -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "sha1_smol" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbfa15b3dddfee50a0fff136974b3e1bde555604ba463834a7eb7deb6417705d" - -[[package]] -name = "sha2" -version = "0.10.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", - "digest 0.10.7", -] - -[[package]] -name = "sha2" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47d7069beb7d6ac7b9acd1039986e73443f24234f41074da099d6f994ac9ad19" -dependencies = [ - "cfg-if", - "cpufeatures 0.3.1", - "digest 0.11.3", -] - -[[package]] -name = "shellexpand" -version = "3.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32824fab5e16e6c4d86dc1ba84489390419a39f97699852b66480bb87d297ed8" -dependencies = [ - "dirs 6.0.0", -] - -[[package]] -name = "shlex" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" - -[[package]] -name = "signal-hook-registry" -version = "1.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" -dependencies = [ - "errno", - "libc", -] - -[[package]] -name = "simd-adler32" -version = "0.3.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea" - -[[package]] -name = "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 = "similar" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbbb5d9659141646ae647b42fe094daf6c6192d1620870b449d9557f748b2daa" -dependencies = [ - "bstr", - "unicode-segmentation", -] - -[[package]] -name = "simplecss" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a9c6883ca9c3c7c90e888de77b7a5c849c779d25d74a1269b0218b14e8b136c" -dependencies = [ - "log", -] - -[[package]] -name = "siphasher" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33f4fe9184a62d842c9ef383018f3306d8ba224fd9d836f56d7288308847c256" - -[[package]] -name = "skrifa" -version = "0.40.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fbdfe3d2475fbd7ddd1f3e5cf8288a30eb3e5f95832829570cd88115a7434ac" -dependencies = [ - "bytemuck", - "read-fonts 0.37.0", -] - -[[package]] -name = "skrifa" -version = "0.44.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819ab7d62b1d3e72d9d9dea5650bac30424f9111364bb94928dbf5ecad1baa68" -dependencies = [ - "bytemuck", - "read-fonts 0.41.0", -] - -[[package]] -name = "slab" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" - -[[package]] -name = "slotmap" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdd58c3c93c3d278ca835519292445cb4b0d4dc59ccfdf7ceadaab3f8aeb4038" -dependencies = [ - "version_check", -] - -[[package]] -name = "smallvec" -version = "1.16.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b3dc8af474f516a851ff4bd12db780f948b9250ad37211e4eec0bccea54e01b" - -[[package]] -name = "smol" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a33bd3e260892199c3ccfc487c88b2da2265080acb316cd920da72fdfd7c599f" -dependencies = [ - "async-channel", - "async-executor", - "async-fs", - "async-io", - "async-lock", - "async-net", - "async-process", - "blocking", - "futures-lite", -] - -[[package]] -name = "smol_str" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4aaa7368fcf4852a4c2dd92df0cace6a71f2091ca0a23391ce7f3a31833f1523" -dependencies = [ - "serde_core", -] - -[[package]] -name = "socket2" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" -dependencies = [ - "libc", - "windows-sys 0.61.2", -] - -[[package]] -name = "spin" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3763264f6b73151db08c50ff20d7d8a0b8796e021cdea7ceedad07b80155fa0e" -dependencies = [ - "lock_api", -] - -[[package]] -name = "spin" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "023a211cb3138dbc438680b32560ad89f699977624c9f8dbb95a47d5b4c07dd3" -dependencies = [ - "lock_api", -] - -[[package]] -name = "spirv" -version = "0.4.0+sdk-1.4.341.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9571ea910ebd84c86af4b3ed27f9dbdc6ad06f17c5f96146b2b671e2976744f" -dependencies = [ - "bitflags 2.13.2", -] - -[[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 = "str_indices" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d08889ec5408683408db66ad89e0e1f93dff55c73a4ccc71c427d5b277ee47e6" - -[[package]] -name = "strict-num" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731" -dependencies = [ - "float-cmp", -] - -[[package]] -name = "string_cache" -version = "0.8.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf776ba3fa74f83bf4b63c3dcbbf82173db2632ed8452cb2d891d33f459de70f" -dependencies = [ - "new_debug_unreachable", - "parking_lot", - "phf_shared 0.11.3", - "precomputed-hash", - "serde", -] - -[[package]] -name = "string_cache_codegen" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c711928715f1fe0fe509c53b43e993a9a557babc2d0a3567d0a3006f1ac931a0" -dependencies = [ - "phf_generator 0.11.3", - "phf_shared 0.11.3", - "proc-macro2", - "quote", -] - -[[package]] -name = "strum" -version = "0.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9628de9b8791db39ceda2b119bbe13134770b56c138ec1d3af810d045c04f9bd" -dependencies = [ - "strum_macros", -] - -[[package]] -name = "strum_macros" -version = "0.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab85eea0270ee17587ed4156089e10b9e6880ee688791d45a905f5b1ca36f664" -dependencies = [ - "heck 0.5.0", - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "subtle" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" - -[[package]] -name = "svg_fmt" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0193cc4331cfd2f3d2011ef287590868599a2f33c3e69bc22c1a3d3acf9e02fb" - -[[package]] -name = "svgtypes" -version = "0.15.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68c7541fff44b35860c1a7a47a7cadf3e4a304c457b58f9870d9706ece028afc" -dependencies = [ - "kurbo 0.11.3", - "siphasher", -] - -[[package]] -name = "svgtypes" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "695b5790b3131dafa99b3bbfd25a216edb3d216dad9ca208d4657bfb8f2abc3d" -dependencies = [ - "kurbo 0.13.1", - "siphasher", -] - -[[package]] -name = "swash" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c2499c2d826531388872b2268718aed907a39bd785ab0dcfe57fab26283f92e" -dependencies = [ - "skrifa 0.44.0", - "yazi", - "zeno", -] - -[[package]] -name = "syn" -version = "2.0.119" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "3.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "sync_wrapper" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" -dependencies = [ - "futures-core", -] - -[[package]] -name = "synstructure" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[package]] -name = "sys-locale" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eab9a99a024a169fe8a903cf9d4a3b3601109bcc13bd9e3c6fff259138626c4" -dependencies = [ - "libc", -] - -[[package]] -name = "sysinfo" -version = "0.31.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "355dbe4f8799b304b05e1b0f05fc59b2a18d36645cf169607da45bde2f69a1be" -dependencies = [ - "core-foundation-sys", - "libc", - "memchr", - "ntapi", - "rayon", - "windows 0.57.0", -] - -[[package]] -name = "system-configuration" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" -dependencies = [ - "bitflags 2.13.2", - "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 = "taffy" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c034e05f6ee85a12daa63863c2245797715075c70649947aa0da54f3f2ab1d0f" -dependencies = [ - "arrayvec", - "serde", - "slotmap", - "smallvec", -] - -[[package]] -name = "tao-core-video-sys" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271450eb289cb4d8d0720c6ce70c72c8c858c93dd61fc625881616752e6b98f6" -dependencies = [ - "cfg-if", - "core-foundation-sys", - "libc", - "objc", -] - -[[package]] -name = "tauri-winrt-notification" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f37a6c354fd28fc9e322ed9bd47e3959576dad28c9d58ea1cf888cce1c7ccb36" -dependencies = [ - "thiserror 2.0.21", - "windows 0.62.2", - "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.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d24a120c5fc464a3458240ee02c299ebcb9d67b5249c8848b09d639dca8d7bb0" -dependencies = [ - "futf", - "mac", - "utf-8", -] - -[[package]] -name = "termcolor" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "thiserror" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" -dependencies = [ - "thiserror-impl 1.0.69", -] - -[[package]] -name = "thiserror" -version = "2.0.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" -dependencies = [ - "thiserror-impl 2.0.21", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "thiserror-impl" -version = "2.0.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", -] - -[[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 0.5.15", -] - -[[package]] -name = "time" -version = "0.3.55" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb87b95ec50ddfa440816d227a17b2ccbdda963a316a727fda0fc4334f7d134" -dependencies = [ - "deranged", - "num-conv", - "powerfmt", - "serde_core", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109" - -[[package]] -name = "time-macros" -version = "0.2.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e689342a48d2ea927c87ea50cabf8594854bf940e9310208848d680d668ed85" -dependencies = [ - "num-conv", - "time-core", -] - -[[package]] -name = "tiny-keccak" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" -dependencies = [ - "crunchy", -] - -[[package]] -name = "tiny-skia" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83d13394d44dae3207b52a326c0c85a8bf87f1541f23b0d143811088497b09ab" -dependencies = [ - "arrayref", - "arrayvec", - "bytemuck", - "cfg-if", - "log", - "png 0.17.16", - "tiny-skia-path", -] - -[[package]] -name = "tiny-skia-path" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c9e7fc0c2e86a30b117d0462aa261b72b7a99b7ebd7deb3a14ceda95c5bdc93" -dependencies = [ - "arrayref", - "bytemuck", - "strict-num", -] - -[[package]] -name = "tinystr" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1e27c91459209c2986af3dcf603a5a74a4368754ce37414f59acc971167f643" -dependencies = [ - "displaydoc", - "zerovec", -] - -[[package]] -name = "tinyvec" -version = "1.13.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee" - -[[package]] -name = "tokio" -version = "1.53.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce3335fa71841cda333a58d7615b03901380ecf09d59b3296d21f8bbac0dde4e" -dependencies = [ - "bytes", - "libc", - "mio", - "pin-project-lite", - "socket2", - "windows-sys 0.61.2", -] - -[[package]] -name = "tokio-rustls" -version = "0.26.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9cc2678c2cdd569ef8215e2afd7954ada2ae20b4fdd2c5fe6139a3b02d105db" -dependencies = [ - "rustls", - "tokio", -] - -[[package]] -name = "tokio-socks" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7e2948f60dbe26b35f2c7fb74ac2854c1fddded0fe9d7548fcc674a246f7615" -dependencies = [ - "either", - "futures-util", - "thiserror 1.0.69", - "tokio", -] - -[[package]] -name = "tokio-util" -version = "0.7.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e464cf451ba96ebfc6f9b6542f17ee8b8956e33f1e40d9690624e59d7a7f8a4b" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "libc", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "toml" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" -dependencies = [ - "serde", -] - -[[package]] -name = "toml" -version = "0.8.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" -dependencies = [ - "serde", - "serde_spanned 0.6.9", - "toml_datetime 0.6.11", - "toml_edit 0.22.27", -] - -[[package]] -name = "toml" -version = "1.1.8+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20489e00e4d8741d6be680764cc12e270655e375a20d1011e844a9c3379e678d" -dependencies = [ - "indexmap", - "serde_core", - "serde_spanned 1.1.2", - "toml_datetime 1.1.2+spec-1.1.0", - "toml_parser", - "toml_writer", - "winnow 1.0.4", -] - -[[package]] -name = "toml_datetime" -version = "0.6.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_datetime" -version = "1.1.2+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b86d767906c6c42421dcba507eb9d203e779497710a47782a224bb871653053" -dependencies = [ - "serde_core", -] - -[[package]] -name = "toml_edit" -version = "0.22.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" -dependencies = [ - "indexmap", - "serde", - "serde_spanned 0.6.9", - "toml_datetime 0.6.11", - "toml_write", - "winnow 0.7.15", -] - -[[package]] -name = "toml_edit" -version = "0.25.17+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3641d5bbb5349a79e1020a242d251efbc546ad8048d133958323ce9c40a9c9c" -dependencies = [ - "indexmap", - "toml_datetime 1.1.2+spec-1.1.0", - "toml_parser", - "winnow 1.0.4", -] - -[[package]] -name = "toml_parser" -version = "1.1.5+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baa693a8032d7e1cada7d0041e96126df243179ff061456783ac7f12bda4744c" -dependencies = [ - "winnow 1.0.4", -] - -[[package]] -name = "toml_write" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" - -[[package]] -name = "toml_writer" -version = "1.1.3+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06bdbd8cfc056b8d2e2e85f29b56a3bdbecb527cef81eb39e3e7b98af4652770" - -[[package]] -name = "tower" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" -dependencies = [ - "futures-core", - "futures-util", - "pin-project-lite", - "sync_wrapper", - "tokio", - "tower-layer", - "tower-service", -] - -[[package]] -name = "tower-layer" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" - -[[package]] -name = "tower-service" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" - -[[package]] -name = "tracing" -version = "0.1.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" -dependencies = [ - "log", - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "tracing-core" -version = "0.1.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" -dependencies = [ - "once_cell", -] - -[[package]] -name = "triomphe" -version = "0.1.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d15f4f5898bcfc5d8a8e45ed30b2f108d710c1a2e5489dbf80e078f707181bc" -dependencies = [ - "arc-swap", - "serde", - "stable_deref_trait", -] - -[[package]] -name = "try-lock" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" - -[[package]] -name = "ttf-parser" -version = "0.25.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31" -dependencies = [ - "core_maths", -] - -[[package]] -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.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "357cc3acc6a036009fd6c973ed009037c732d60d0b4f6c673e9041497482a28f" - -[[package]] -name = "unicode-bidi" -version = "0.3.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" - -[[package]] -name = "unicode-bidi-mirroring" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfa6e8c60bb66d49db113e0125ee8711b7647b5579dc7f5f19c42357ed039fe" - -[[package]] -name = "unicode-ccc" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce61d488bcdc9bc8b5d1772c404828b17fc481c0a582b5581e95fb233aef503e" - -[[package]] -name = "unicode-id" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65dd75ab2d9d379dbe86d4059e91d8b5a6e7054865eaba1ddbfc7a817ff96392" - -[[package]] -name = "unicode-ident" -version = "1.0.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" - -[[package]] -name = "unicode-linebreak" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" - -[[package]] -name = "unicode-properties" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7df058c713841ad818f1dc5d3fd88063241cc61f49f5fbea4b951e8cf5a8d71d" - -[[package]] -name = "unicode-script" -version = "0.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "383ad40bb927465ec0ce7720e033cb4ca06912855fc35db31b5755d0de75b1ee" - -[[package]] -name = "unicode-segmentation" -version = "1.13.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" - -[[package]] -name = "unicode-vo" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d386ff53b415b7fe27b50bb44679e2cc4660272694b7b6f3326d8480823a94" - -[[package]] -name = "unicode-width" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" - -[[package]] -name = "untrusted" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" - -[[package]] -name = "ureq" -version = "3.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a7ac20be9b7726e0bbdbf974c059676d9acb1cd414961f570a4e8231cacd7fc" -dependencies = [ - "base64 0.23.1", - "cookie_store", - "der", - "log", - "native-tls", - "percent-encoding", - "rustls-pki-types", - "serde", - "serde_json", - "ureq-proto", - "utf8-zero", - "webpki-root-certs", -] - -[[package]] -name = "ureq-proto" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f86fd172ccca569e458f61b6bdd6220965a9ef36e672a6852953b51a0e1583be" -dependencies = [ - "base64 0.23.1", - "http", - "httparse", - "log", -] - -[[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", -] - -[[package]] -name = "usvg" -version = "0.45.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80be9b06fbae3b8b303400ab20778c80bbaf338f563afe567cf3c9eea17b47ef" -dependencies = [ - "base64 0.22.1", - "data-url", - "flate2", - "fontdb", - "imagesize 0.13.0", - "kurbo 0.11.3", - "log", - "pico-args", - "roxmltree 0.20.0", - "rustybuzz", - "simplecss", - "siphasher", - "strict-num", - "svgtypes 0.15.3", - "tiny-skia-path", - "unicode-bidi", - "unicode-script", - "unicode-vo", - "xmlwriter", -] - -[[package]] -name = "usvg" -version = "0.46.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e419dff010bb12512b0ae9e3d2f318dfbdf0167fde7eb05465134d4e8756076f" -dependencies = [ - "base64 0.22.1", - "data-url", - "flate2", - "fontdb", - "imagesize 0.14.0", - "kurbo 0.13.1", - "log", - "pico-args", - "roxmltree 0.21.1", - "rustybuzz", - "simplecss", - "siphasher", - "strict-num", - "svgtypes 0.16.1", - "tiny-skia-path", - "unicode-bidi", - "unicode-script", - "unicode-vo", - "xmlwriter", -] - -[[package]] -name = "utf-8" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" - -[[package]] -name = "utf8-zero" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8c0a043c9540bae7c578c88f91dda8bd82e59ae27c21baca69c8b191aaf5a6e" - -[[package]] -name = "utf8_iter" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" - -[[package]] -name = "uuid" -version = "1.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cc1186384beb7dd8eedea376413fd654937285ea6c9cfbb928dc3043ea4b606" -dependencies = [ - "getrandom 0.4.3", - "js-sys", - "serde_core", - "sha1_smol", - "wasm-bindgen", -] - -[[package]] -name = "v_frame" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "666b7727c8875d6ab5db9533418d7c764233ac9c0cff1d469aec8fa127597be2" -dependencies = [ - "aligned-vec", - "num-traits", - "wasm-bindgen", -] - -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - -[[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 = "waker-fn" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317211a0dc0ceedd78fb2ca9a44aed3d7b9b26f81870d485c07122b4350673b7" - -[[package]] -name = "walkdir" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" -dependencies = [ - "same-file", - "winapi-util", -] - -[[package]] -name = "want" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec4cdd0dd910afe868b7ef477227d8d538b46b3075031afee8a9f2acb0a2ed0b" -dependencies = [ - "try-lock", -] - -[[package]] -name = "wasi" -version = "0.11.1+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" - -[[package]] -name = "wasip2" -version = "1.0.4+wasi-0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" -dependencies = [ - "wit-bindgen", -] - -[[package]] -name = "wasm-bindgen" -version = "0.2.129" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb54f33acc68fd454578d9820b0bde1a1a3d17aa17bb7b6595806d02886d409" -dependencies = [ - "cfg-if", - "once_cell", - "rustversion", - "wasm-bindgen-macro", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cbab34de2d982e9b48e18d216d04c4a6f641066ff19ffb699980f591ee3610e" -dependencies = [ - "js-sys", - "tokio", - "wasm-bindgen", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.129" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e29d0c35b16e224a7eeb5cd2d25e3e1968fbd65604117b44d3b789d00ee8535" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.129" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f501a8bc3719dba86ef8ae4728879c08001bea749eb1333ac5b91e040e2a6b7" -dependencies = [ - "bumpalo", - "proc-macro2", - "quote", - "syn 3.0.9", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.129" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23f0c9c52aa7cd7d77769a4cfe2a9adb1b331f489a41d912ce14513d5ab995c6" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "wasm-streams" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15053d8d85c7eccdbefef60f06769760a563c7f0a9d6902a13d35c7800b0ad65" -dependencies = [ - "futures-util", - "js-sys", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - -[[package]] -name = "wasm_thread" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7516db7f32decdadb1c3b8deb1b7d78b9df7606c5cc2f6241737c2ab3a0258e" -dependencies = [ - "futures", - "js-sys", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "wayland-backend" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38a91b4eaddff87b1cd1074985e3713da4af2c49742d1b356b2c01670a67a078" -dependencies = [ - "cc", - "downcast-rs", - "log", - "rustix", - "scoped-tls", - "smallvec", - "wayland-sys", -] - -[[package]] -name = "wayland-client" -version = "0.31.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3c36a0f861ad76d0901f2800b46321410d9f73f2ea88aac0650d86c32688073" -dependencies = [ - "bitflags 2.13.2", - "rustix", - "wayland-backend", - "wayland-scanner", -] - -[[package]] -name = "wayland-cursor" -version = "0.31.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a52d18780be9b1314328a3de5f930b73d2200112e3849ca6cb11822793fb34d" -dependencies = [ - "rustix", - "wayland-client", - "xcursor", -] - -[[package]] -name = "wayland-protocols" -version = "0.32.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d0c813de3daa2ed6520af85a3bd49b0e722a3078506899aa9686fea58dc4b6" -dependencies = [ - "bitflags 2.13.2", - "wayland-backend", - "wayland-client", - "wayland-scanner", -] - -[[package]] -name = "wayland-protocols-plasma" -version = "0.3.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b6d8cf1eb2c1c31ed1f5643c88a6e53538129d4af80030c8cabd1f9fa884d91" -dependencies = [ - "bitflags 2.13.2", - "wayland-backend", - "wayland-client", - "wayland-protocols", - "wayland-scanner", -] - -[[package]] -name = "wayland-protocols-wlr" -version = "0.3.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb04e52f7836d7c7976c78ca0250d61e33873c34156a2a1fc9474828ec268234" -dependencies = [ - "bitflags 2.13.2", - "wayland-backend", - "wayland-client", - "wayland-protocols", - "wayland-scanner", -] - -[[package]] -name = "wayland-scanner" -version = "0.31.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "338e30461b3a2b67d70eb30a6d89f8e0c93a833e07d2ae89085cd070c4a00ac0" -dependencies = [ - "proc-macro2", - "quick-xml", - "quote", -] - -[[package]] -name = "wayland-sys" -version = "0.31.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8eab23fefc9e41f8e841df4a9c707e8a8c4ed26e944ef69297184de2785e3be" -dependencies = [ - "dlib", - "log", - "once_cell", - "pkg-config", -] - -[[package]] -name = "web-sys" -version = "0.3.106" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88261b9deccee56594c11a3460c462c41f58d148598fe70ad77070126a68aba4" -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 = "webpki-root-certs" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b96554aa2acc8ccdb7e1c9a58a7a68dd5d13bccc69cd124cb09406db612a1c9b" -dependencies = [ - "rustls-pki-types", -] - -[[package]] -name = "weezl" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88" - -[[package]] -name = "wgpu" -version = "29.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76e8840e1ba2881d4cbb18d2147627a56af426ff064c0401eb0c8410c6325d07" -dependencies = [ - "arrayvec", - "bitflags 2.13.2", - "bytemuck", - "cfg-if", - "cfg_aliases", - "document-features", - "hashbrown 0.16.1", - "js-sys", - "log", - "naga", - "parking_lot", - "portable-atomic", - "profiling", - "raw-window-handle", - "smallvec", - "static_assertions", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "wgpu-core", - "wgpu-hal", - "wgpu-types", -] - -[[package]] -name = "wgpu-core" -version = "29.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f519832254e56965a9940c4af57dcb75f702b6f6fa4a0b172f685395843a4d7" -dependencies = [ - "arrayvec", - "bit-set", - "bit-vec", - "bitflags 2.13.2", - "bytemuck", - "cfg_aliases", - "document-features", - "hashbrown 0.16.1", - "indexmap", - "log", - "naga", - "once_cell", - "parking_lot", - "portable-atomic", - "profiling", - "raw-window-handle", - "rustc-hash 1.1.0", - "smallvec", - "thiserror 2.0.21", - "wgpu-core-deps-apple", - "wgpu-core-deps-emscripten", - "wgpu-core-deps-wasm", - "wgpu-core-deps-windows-linux-android", - "wgpu-hal", - "wgpu-naga-bridge", - "wgpu-types", -] - -[[package]] -name = "wgpu-core-deps-apple" -version = "29.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5e39e26c4c0e07589e67d18546cf79ff45383659fc72fca4dd293358a0347f3" -dependencies = [ - "wgpu-hal", -] - -[[package]] -name = "wgpu-core-deps-emscripten" -version = "29.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01e09be551dc939498bdd5f6b2c66e55ab275dad25825267a08605a80fc9f0af" -dependencies = [ - "wgpu-hal", -] - -[[package]] -name = "wgpu-core-deps-wasm" -version = "29.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af1fb1798be2a912497d4c224f72d39bb0cb34af50e8bcc29865bc339c943059" -dependencies = [ - "wgpu-hal", -] - -[[package]] -name = "wgpu-core-deps-windows-linux-android" -version = "29.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e592c1bbef6ad047647ae6e666ebd8cee7a32bb4544d9700ec96cbf73230257" -dependencies = [ - "wgpu-hal", -] - -[[package]] -name = "wgpu-hal" -version = "29.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97ace1c17727311c22a46e4e3faf56ea6de81af99dcc839bdfb54857b94d448d" -dependencies = [ - "android_system_properties", - "arrayvec", - "ash", - "bit-set", - "bitflags 2.13.2", - "block2 0.6.2", - "bytemuck", - "cfg-if", - "cfg_aliases", - "glow", - "glutin_wgl_sys", - "gpu-allocator", - "gpu-descriptor", - "hashbrown 0.16.1", - "js-sys", - "khronos-egl", - "libc", - "libloading", - "log", - "naga", - "ndk-sys", - "objc2 0.6.5", - "objc2-core-foundation", - "objc2-foundation 0.3.2", - "objc2-metal 0.3.2", - "objc2-quartz-core 0.3.2", - "once_cell", - "ordered-float", - "parking_lot", - "portable-atomic", - "portable-atomic-util", - "profiling", - "range-alloc", - "raw-window-handle", - "raw-window-metal", - "renderdoc-sys", - "smallvec", - "thiserror 2.0.21", - "wasm-bindgen", - "wayland-sys", - "web-sys", - "wgpu-naga-bridge", - "wgpu-types", - "windows 0.62.2", - "windows-core 0.62.2", - "windows-result 0.4.1", -] - -[[package]] -name = "wgpu-naga-bridge" -version = "29.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95226013f547544b223281cd16a4fb549aa9dcb562adbda0faae4c73ffbbc161" -dependencies = [ - "naga", - "wgpu-types", -] - -[[package]] -name = "wgpu-types" -version = "29.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84bf84cd9ca8ca45e2b223a3868f1adf9bfc0c66aeac212e76ee7e40fdadf8f5" -dependencies = [ - "bitflags 2.13.2", - "bytemuck", - "js-sys", - "log", - "raw-window-handle", - "web-sys", -] - -[[package]] -name = "which" -version = "8.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bae2f2b2b816647a1cab1acc91f5bd20812d53cb344382635ec2181940c8034f" -dependencies = [ - "libc", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.11" -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 = "windows" -version = "0.57.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12342cb4d8e3b046f3d80effd474a7a02447231330ef77d71daa6fbc40681143" -dependencies = [ - "windows-core 0.57.0", - "windows-targets 0.52.6", -] - -[[package]] -name = "windows" -version = "0.58.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6" -dependencies = [ - "windows-core 0.58.0", - "windows-targets 0.52.6", -] - -[[package]] -name = "windows" -version = "0.61.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893" -dependencies = [ - "windows-collections 0.2.0", - "windows-core 0.61.2", - "windows-future 0.2.1", - "windows-link 0.1.3", - "windows-numerics 0.2.0", -] - -[[package]] -name = "windows" -version = "0.62.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" -dependencies = [ - "windows-collections 0.3.2", - "windows-core 0.62.2", - "windows-future 0.3.2", - "windows-numerics 0.3.1", -] - -[[package]] -name = "windows-capture" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a4df73e95feddb9ec1a7e9c2ca6323b8c97d5eeeff78d28f1eccdf19c882b24" -dependencies = [ - "parking_lot", - "rayon", - "thiserror 2.0.21", - "windows 0.61.3", - "windows-future 0.2.1", -] - -[[package]] -name = "windows-collections" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" -dependencies = [ - "windows-core 0.61.2", -] - -[[package]] -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.57.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d" -dependencies = [ - "windows-implement 0.57.0", - "windows-interface 0.57.0", - "windows-result 0.1.2", - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-core" -version = "0.58.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99" -dependencies = [ - "windows-implement 0.58.0", - "windows-interface 0.58.0", - "windows-result 0.2.0", - "windows-strings 0.1.0", - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-core" -version = "0.61.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" -dependencies = [ - "windows-implement 0.60.2", - "windows-interface 0.59.3", - "windows-link 0.1.3", - "windows-result 0.3.4", - "windows-strings 0.4.2", -] - -[[package]] -name = "windows-core" -version = "0.62.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" -dependencies = [ - "windows-implement 0.60.2", - "windows-interface 0.59.3", - "windows-link 0.2.1", - "windows-result 0.4.1", - "windows-strings 0.5.1", -] - -[[package]] -name = "windows-future" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" -dependencies = [ - "windows-core 0.61.2", - "windows-link 0.1.3", - "windows-threading 0.1.0", -] - -[[package]] -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.57.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "windows-implement" -version = "0.58.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "windows-implement" -version = "0.60.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "windows-interface" -version = "0.57.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "windows-interface" -version = "0.58.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "windows-interface" -version = "0.59.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "windows-link" -version = "0.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.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4286ad90ddb45071efd1a66dfa43eb02dd0dfbae1545ad6cc3c51cf34d7e8ba3" -dependencies = [ - "windows-result 0.3.4", - "windows-strings 0.3.1", - "windows-targets 0.53.5", -] - -[[package]] -name = "windows-registry" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720" -dependencies = [ - "windows-link 0.2.1", - "windows-result 0.4.1", - "windows-strings 0.5.1", -] - -[[package]] -name = "windows-result" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-result" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-result" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" -dependencies = [ - "windows-link 0.1.3", -] - -[[package]] -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.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" -dependencies = [ - "windows-result 0.2.0", - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-strings" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87fa48cc5d406560701792be122a10132491cff9d0aeb23583cc2dcafc847319" -dependencies = [ - "windows-link 0.1.3", -] - -[[package]] -name = "windows-strings" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" -dependencies = [ - "windows-link 0.1.3", -] - -[[package]] -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.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.5", -] - -[[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.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.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", -] - -[[package]] -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.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnu" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_i686_msvc" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -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.7.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" -dependencies = [ - "memchr", -] - -[[package]] -name = "winnow" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81" -dependencies = [ - "memchr", -] - -[[package]] -name = "winreg" -version = "0.56.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d6f32a0ff4a9f6f01231eb2059cc85479330739333e0e58cadf03b6af2cca10" -dependencies = [ - "cfg-if", - "windows-sys 0.61.2", -] - -[[package]] -name = "winres" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b68db261ef59e9e52806f688020631e987592bd83619edccda9c47d42cde4f6c" -dependencies = [ - "toml 0.5.11", + "log", ] [[package]] -name = "wio" -version = "0.2.2" +name = "url" +version = "2.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d129932f4644ac2396cb456385cbf9e63b5b30c6e8dc4820bdca4eb082037a5" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" dependencies = [ - "winapi", + "form_urlencoded", + "idna", + "percent-encoding", + "serde", ] [[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.4" +name = "utf8-zero" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" +checksum = "b8c0a043c9540bae7c578c88f91dda8bd82e59ae27c21baca69c8b191aaf5a6e" [[package]] -name = "x11" -version = "2.21.0" +name = "utf8_iter" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "502da5464ccd04011667b11c435cb992822c2c0dbde1770c988480d312a0db2e" -dependencies = [ - "libc", - "pkg-config", -] +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" [[package]] -name = "x11rb" -version = "0.13.2" +name = "utf8parse" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9993aa5be5a26815fe2c3eacfc1fde061fc1a1f094bf1ad2a18bf9c495dd7414" -dependencies = [ - "as-raw-xcb-connection", - "gethostname", - "libc", - "rustix", - "x11rb-protocol", - "xcursor", -] +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] -name = "x11rb-protocol" -version = "0.13.2" +name = "version_check" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] -name = "xcb" -version = "1.7.1" +name = "walkdir" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6c2ad15e0e922856ee89afe862b8992334bbe7953adad56cd1199358cb30566" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" dependencies = [ - "bitflags 2.13.2", - "libc", - "quick-xml", - "x11", + "same-file", + "winapi-util", ] [[package]] -name = "xcursor" -version = "0.3.11" +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "163b33ed8786455e2fa5d72f554057ce3f3182425434f756cd39c99839d88e23" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" [[package]] -name = "xim-ctext" -version = "0.3.0" +name = "webpki-root-certs" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ac61a7062c40f3c37b6e82eeeef835d5cc7824b632a72784a89b3963c33284c" +checksum = "b96554aa2acc8ccdb7e1c9a58a7a68dd5d13bccc69cd124cb09406db612a1c9b" dependencies = [ - "encoding_rs", + "rustls-pki-types", ] [[package]] -name = "xim-parser" -version = "0.2.2" +name = "webpki-roots" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dcee45f89572d5a65180af3a84e7ddb24f5ea690a6d3aa9de231281544dd7b7" +checksum = "7dcd9d09a39985f5344844e66b0c530a33843579125f23e21e9f0f220850f22a" dependencies = [ - "bitflags 2.13.2", + "rustls-pki-types", ] [[package]] -name = "xkbcommon" -version = "0.8.0" +name = "weezl" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d66ca9352cbd4eecbbc40871d8a11b4ac8107cfc528a6e14d7c19c69d0e1ac9" -dependencies = [ - "as-raw-xcb-connection", - "libc", - "memmap2", - "xkeysym", -] +checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88" [[package]] -name = "xkeysym" -version = "0.2.1" +name = "winapi" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] [[package]] -name = "xml-rs" -version = "0.8.29" +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e450f9b2ed1dff33c94c12589a87338689467b9c4f5d8a5710bd09a847d2c8a7" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] -name = "xml5ever" -version = "0.18.1" +name = "winapi-util" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bbb26405d8e919bc1547a5aa9abc95cbfa438f04844f5fdd9dc7596b748bf69" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "log", - "mac", - "markup5ever", + "windows-sys 0.61.2", ] [[package]] -name = "xmlwriter" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9" - -[[package]] -name = "y4m" -version = "0.8.0" +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5a4b21e1a62b67a2970e6831bc091d7b87e119e7f9791aef9702e3bef04448" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] -name = "yazi" +name = "windows-link" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e01738255b5a16e78bbb83e7fbba0a1e7dd506905cfc53f4622d89015a03fbb5" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" [[package]] -name = "yeslogic-fontconfig-sys" -version = "6.0.1" +name = "windows-sys" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d8b8abf912b9a29ff112e1671c97c33636903d13a69712037190e6805af4f76" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "dlib", - "once_cell", - "pkg-config", + "windows-targets", ] [[package]] -name = "yoke" -version = "0.8.3" +name = "windows-sys" +version = "0.61.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" dependencies = [ - "stable_deref_trait", - "yoke-derive", - "zerofrom", + "windows-link", ] [[package]] -name = "yoke-derive" -version = "0.8.4" +name = "windows-targets" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.9", - "synstructure", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] [[package]] -name = "zbus" -version = "5.19.0" +name = "windows_aarch64_gnullvm" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5db4be7c075cb421e4b7ee645541604239bd243ba7c357511f4ff3a74b555907" -dependencies = [ - "async-broadcast", - "async-executor", - "async-io", - "async-lock", - "async-process", - "async-recursion", - "async-task", - "async-trait", - "blocking", - "enumflags2", - "event-listener", - "futures-core", - "futures-lite", - "hex", - "libc", - "ordered-stream", - "rustix", - "serde", - "serde_repr", - "tracing", - "uds_windows", - "uuid", - "windows-sys 0.61.2", - "winnow 1.0.4", - "zbus_macros", - "zbus_names", - "zvariant", -] +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] -name = "zbus-lockstep" -version = "0.5.2" +name = "windows_aarch64_msvc" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6998de05217a084b7578728a9443d04ea4cd80f2a0839b8d78770b76ccd45863" -dependencies = [ - "zbus_xml", - "zvariant", -] +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] -name = "zbus-lockstep-macros" -version = "0.5.2" +name = "windows_i686_gnullvm" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10da05367f3a7b7553c8cdf8fa91aee6b64afebe32b51c95177957efc47ca3a0" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", - "zbus-lockstep", - "zbus_xml", - "zvariant", -] +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] -name = "zbus_macros" -version = "5.19.0" +name = "windows_i686_msvc" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2990635d09ade6df1868f72f8cac69a876a90981e8bd3c40b1be413f8dc88f40" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 3.0.9", - "zbus_names", - "zvariant", - "zvariant_utils", -] +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] -name = "zbus_names" -version = "4.3.4" +name = "windows_x86_64_gnu" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8bf88b4a3ff53e883001e0e0115b297a9d53c31b9c1edd2bfdd853e3428624e" -dependencies = [ - "serde", - "winnow 1.0.4", - "zvariant", -] +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] -name = "zbus_xml" -version = "5.2.1" +name = "windows_x86_64_gnullvm" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1586c021a01ca0a9216dcd874e546382e156a5cbab5fab6cb5f10087e22682a" -dependencies = [ - "serde", - "winnow 1.0.4", - "zbus_names", - "zvariant", -] +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] -name = "zcheapstr" -version = "1.1.0" +name = "windows_x86_64_msvc" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1afec51604565183aeb5c54c20aeab286120d4e4460f7f76e3e8bb8c0d99473" -dependencies = [ - "serde", -] +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] -name = "zed-font-kit" -version = "0.14.1-zed" +name = "writeable" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3898e450f36f852edda72e3f985c34426042c4951790b23b107f93394f9bff5" -dependencies = [ - "bitflags 2.13.2", - "byteorder", - "core-foundation 0.10.1", - "core-graphics 0.24.0", - "core-text", - "dirs 5.0.1", - "dwrote", - "float-ord", - "freetype-sys", - "lazy_static", - "libc", - "log", - "pathfinder_geometry", - "pathfinder_simd", - "walkdir", - "winapi", - "yeslogic-fontconfig-sys", -] +checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" [[package]] -name = "zed-scap" -version = "0.0.8-zed" +name = "x11rb" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6b338d705ae33a43ca00287c11129303a7a0aa57b101b72a1c08c863f698ac8" +checksum = "9993aa5be5a26815fe2c3eacfc1fde061fc1a1f094bf1ad2a18bf9c495dd7414" dependencies = [ - "anyhow", - "cocoa 0.25.0", - "core-graphics-helmer-fork", - "log", - "objc", - "rand 0.8.8", - "screencapturekit", - "screencapturekit-sys", - "sysinfo", - "tao-core-video-sys", - "windows 0.61.3", - "windows-capture", - "x11", - "xcb", + "gethostname", + "rustix", + "x11rb-protocol", ] [[package]] -name = "zed-xim" -version = "0.4.0-zed" +name = "x11rb-protocol" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd" + +[[package]] +name = "yoke" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c0b46ed118eba34d9ba53d94ddc0b665e0e06a2cf874cfa2dd5dec278148642" +checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5" dependencies = [ - "ahash", - "hashbrown 0.14.5", - "log", - "x11rb", - "xim-ctext", - "xim-parser", + "stable_deref_trait", + "yoke-derive", + "zerofrom", ] [[package]] -name = "zeno" -version = "0.3.3" +name = "yoke-derive" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6df3dc4292935e51816d896edcd52aa30bc297907c26167fec31e2b0c6a32524" +checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", + "synstructure", +] [[package]] name = "zerocopy" @@ -8493,20 +1885,6 @@ name = "zeroize" version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e13084392c5e4bc371903e2935a5eaeed24905a7511356b883835e18a78f6879" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c50655cbb0fe3fc43170059e702f1ce5e19b84cec58dc87b037a09935c2f328" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] [[package]] name = "zerotrie" @@ -8553,83 +1931,17 @@ version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" -[[package]] -name = "zune-core" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f423a2c17029964870cfaabb1f13dfab7d092a62a29a89264f4d36990ca414a" - [[package]] name = "zune-core" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d56377fd46368984a170bc5aac5567e52ca5da874caa60bea39fcbca78fb658b" -[[package]] -name = "zune-inflate" -version = "0.2.54" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02" -dependencies = [ - "simd-adler32", -] - -[[package]] -name = "zune-jpeg" -version = "0.4.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29ce2c8a9384ad323cf564b67da86e21d3cfdff87908bc1223ed5c99bc792713" -dependencies = [ - "zune-core 0.4.12", -] - [[package]] name = "zune-jpeg" version = "0.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27bc9d5b815bc103f142aa054f561d9187d191692ec7c2d1e2b4737f8dbd7296" dependencies = [ - "zune-core 0.5.3", -] - -[[package]] -name = "zvariant" -version = "5.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1d34c27cc6cdd1f458427519dd6b8612f7b7e3f7b9a0b2355d041dda9869147" -dependencies = [ - "endi", - "enumflags2", - "serde", - "serde_bytes", - "winnow 1.0.4", - "zcheapstr", - "zvariant_derive", - "zvariant_utils", -] - -[[package]] -name = "zvariant_derive" -version = "5.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "864155e69b4352db0c7f374917bf45d1e0c8d17659c8b3dbf9795f3673f8c497" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 3.0.9", - "zvariant_utils", -] - -[[package]] -name = "zvariant_utils" -version = "4.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bad0294361a320b694a328460dc73add56c306150f5cb6bfafc44446120008a3" -dependencies = [ - "proc-macro2", - "quote", - "serde", - "syn 3.0.9", - "winnow 1.0.4", + "zune-core", ] diff --git a/Cargo.toml b/Cargo.toml index 50500f9..d747573 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,17 +3,19 @@ resolver = "3" members = ["crates/*"] [workspace.package] -version = "0.1.0" +version = "1.0.0" edition = "2024" license = "MIT" authors = ["Smoffyy"] +repository = "https://github.com/Smoffyy/quill-code" publish = false [workspace.dependencies] -quill-agent = { path = "crates/quill-agent" } -quill-llama = { path = "crates/quill-llama" } +quill-config = { path = "crates/quill-config" } +quill-core = { path = "crates/quill-core" } +quill-git = { path = "crates/quill-git" } +quill-providers = { path = "crates/quill-providers" } quill-weave = { path = "crates/quill-weave" } -gpui-kit = "0.7.3" [profile.dev.package."*"] opt-level = 2 diff --git a/README.md b/README.md index 4353557..15660ff 100644 --- a/README.md +++ b/README.md @@ -1,81 +1,308 @@ -# quill-code +
-A native desktop home for Quill, a coding agent that runs on your own models. Point it at a llama.cpp server (or another OpenAI-compatible one), pick the model that powers Quill, and hand it work: it reads and edits your projects, runs commands in your system's own shell, shows every diff, and takes the git side all the way to a pull request. +

+ +

-## Principles +

Quill Code

-- **Native.** Rust and GPUI, drawn on the GPU. No browser engine renders the interface. -- **No telemetry, ever.** The app talks only to the model servers you configure, to your git remotes, and to GitHub when you publish a repository or open a pull request. -- **MIT licensed,** with permissively licensed dependencies only. -- **Built for local models.** Tool calls, context windows and thinking controls are detected from the server rather than configured by hand. +

+ A coding agent for your terminal that runs on your own models. Point it at llama.cpp, LM Studio, Ollama or vLLM, hand it work, and watch every step. +

-## Status +

+ Latest release + CI + MIT license + Last commit +

-Early development, Windows first. Working today: +
-- Projects and threads, with several agents running at once and a sidebar that shows each thread's branch, commit, uncommitted work, unpushed commits, pull request and model. -- A tool-calling agent that lists, reads, searches, writes and edits files, runs commands, commits and opens pull requests, under Ask first, Trust edits and Autopilot access modes. -- Isolated copies (git worktrees) so parallel threads never collide, a commit dialog that can push, open a pull request page or publish a new GitHub repository, and new projects that can start on GitHub with a first branch of your choosing. -- Slash commands, @ file mentions, image and file attachments with previews, pinned models with Ctrl+1 to 9, a context ring, a PowerShell drawer and saved history. +

+ Quill Code running npm test, editing src/slug.js, running the tests again and finishing with every test passing +

-GitHub sign-in goes through Git Credential Manager, so quill-code never stores a token. +

A real session at real speed: qwen3.5-35b-a3b on llama.cpp, fixing a failing test.

-## Building +
-Every platform needs: +## Up and running -- **Rust 1.88 or newer**, installed with [rustup](https://rustup.rs). The default stable toolchain is enough. -- **Git** on the PATH, for cloning, commits, branches and isolated copies. -- **A model server** to talk to, such as llama.cpp's `llama-server`, or any server with an OpenAI-compatible `/v1` API. +macOS and Linux: -Then, from the repository folder: +```bash +curl -fsSL https://github.com/Smoffyy/quill-code/releases/latest/download/install.sh | sh +``` + +Windows (PowerShell): +```powershell +irm https://github.com/Smoffyy/quill-code/releases/latest/download/install.ps1 | iex ``` -cargo run -p quill-code --release + +Then open a terminal in any project and run **`quill`**. That is the whole setup. + +The script downloads the right build for your system, checks it against the release's checksums, puts `quill` in `~/.local/bin` (or `%LOCALAPPDATA%\Programs\quill` on Windows) and adds that folder to your PATH. No admin rights, no Rust, nothing else to install. The first time, Quill asks which app runs your models, finds the ones already running and lists their models. + +
+ +## A quick tour + + + + + + + + + + + + + + +
An approval card showing the diff of a rename in src/slug.js, with Allow, Always allow, Allow everything, Deny and tell Quill what to do instead + +### It asks before it acts + +Every edit and command shows up as a card with its full diff before anything happens. Allow it once, always, or for the whole thread, or tell Quill what to do instead. **Shift+Tab** moves between Ask first, Trust edits and Autopilot, and commands that throw work away, like `git reset --hard` or a forced push, ask in every mode. + +
+ +### It finds your models + +Tool calls, context windows, vision and thinking controls are read from the server, not typed into a config file. `/model` lists everything your servers offer with what is loaded, `/effort` turns thinking on or off or picks a level, and the status line keeps an eye on how full the context is. + +The model picker listing three Qwen models on llama.cpp with their status, context size and vision support
quill exec running the tests headless, fixing src/slug.js and reporting that all tests now pass + +### It works without you + +`quill exec` runs one task headless for scripts and CI: the model's text on standard output, progress on standard error, `--json` for the event stream, and an exit code that says how it went. Or hand it to another agent and let your local model take the mechanical work. + +
+ +
+ +## Works with + +**Model servers:** llama.cpp · LM Studio · Ollama · vLLM · Jan · GPT4All · any OpenAI-compatible server + +**Systems:** Windows (x64) · Linux (x64 and ARM, one static binary for every distribution) · macOS (Apple silicon and Intel) + +**Git:** your own `git` for commits, branches and isolated copies, and Git Credential Manager for GitHub, so Quill never stores a token. + +
+ +## Questions people ask + +
+Does it come with a model? +
+ +No. Quill is the agent, the model runs in an app you choose. The easiest start is [LM Studio](https://lmstudio.ai) or [Ollama](https://ollama.com); [llama.cpp](https://github.com/ggml-org/llama.cpp)'s `llama-server` gives the most control. Pick a model that supports tool calls. Connect another server any time with `/connect`. + +
+ +
+Is anything sent anywhere? +
+ +Only what you set up. There is no telemetry, no analytics and no update check running on its own. Quill talks to the model servers you configure, to your git remotes, and to GitHub when you publish a repository, open a pull request, look at a branch's pull request, run `quill update` or open `/version`. + +
+ +
+How much may it do on its own? +
+ +That is the access mode. **Ask first** runs read-only commands by itself and asks before edits, other commands, commits and pull requests. **Trust edits** also makes edits on its own. **Autopilot** never asks. In every mode, commands that throw work away ask first unless a rule allows them. The first time you run Quill in a folder, it asks whether you trust the files there. + +
+ +
+What happens when the context window fills up? +
+ +Quill trims old command output first and, if that is not enough, summarises the conversation and carries on where it stopped, keeping your request and its latest steps word for word. The status line says "compacts soon" when it is close, `/compact` does it on demand, and `agent.auto_compact` turns it off. + +
+ +
+How do I update or go back to an older version? +
+ +`quill update` installs the newest release. `/version` lists every published release, installs the one you pick and reopens Quill on the thread you were in; `quill versions` and `quill update 1.0.0` do the same from the command line. Settings and threads keep what newer versions saved in them, so going back and forward loses nothing. + +To install a particular release from scratch, set `QUILL_VERSION` for the one-liner. `QUILL_INSTALL_DIR` picks another folder and `QUILL_NO_MODIFY_PATH=1` leaves your PATH alone. + +```bash +curl -fsSL https://github.com/Smoffyy/quill-code/releases/latest/download/install.sh | QUILL_VERSION=1.0.0 sh ``` -### Windows +```powershell +$env:QUILL_VERSION = '1.0.0'; irm https://github.com/Smoffyy/quill-code/releases/latest/download/install.ps1 | iex +``` -Windows is the platform quill-code is developed and tested on. +
-1. Install the [Visual Studio Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/) with the **Desktop development with C++** workload, which brings the MSVC compiler and the Windows SDK. -2. Install Rust with `rustup-init.exe`, keeping the default `x86_64-pc-windows-msvc` toolchain. -3. Install [Git for Windows](https://git-scm.com/download/win). It includes Git Credential Manager, which handles GitHub sign-in. +
+How do I uninstall it? +
-### macOS +Delete `~/.local/bin/quill`, or the `%LOCALAPPDATA%\Programs\quill` folder on Windows. Your settings and threads stay in the settings folder that `quill config` shows. -1. Install **Xcode** from the App Store, not only the Command Line Tools: the interface's Metal shaders are compiled at build time with Xcode's `metal` tool. Open Xcode once to accept its licence, then run `sudo xcode-select -s /Applications/Xcode.app`. If the build says the `metal` tool is missing, run `xcodebuild -downloadComponent MetalToolchain`. -2. Install Rust with rustup. -3. Git comes with Xcode. For GitHub sign-in, install [Git Credential Manager](https://github.com/git-ecosystem/git-credential-manager) or any credential helper that stores a GitHub token. +
-### Linux +
-Debian and Ubuntu: +## Using it ``` -sudo apt install build-essential pkg-config git libssl-dev libfontconfig-dev libxkbcommon-dev libxkbcommon-x11-dev libwayland-dev libvulkan1 mesa-vulkan-drivers +quill start in this folder +quill "fix the failing test" start with a prompt +quill -c continue the latest thread in this folder +quill -w work in an isolated copy (a git worktree) so parallel runs never collide +quill -C path/to/project work in another folder ``` -Fedora: +While Quill works, the live area shows what it is doing. Type to steer it, press **Esc** to stop it. The conversation scrolls inside Quill with the mouse wheel and Page Up and Page Down, and when you quit, the session is printed into your terminal's scrollback. Hold **Shift** while dragging to select text. + +
+Keys +
+ +| Key | Does | +| --- | --- | +| Enter | Send, or steer the reply while Quill works | +| Shift+Enter, Alt+Enter, Ctrl+J | New line | +| Shift+Tab | Switch between Ask first, Trust edits and Autopilot | +| Ctrl+O | Show thoughts in full, or as a short summary | +| Page Up, Page Down, mouse wheel | Scroll the conversation (Ctrl+Home and Ctrl+End jump to the top and bottom) | +| Esc | Stop the reply, close a menu | +| Ctrl+C | Clear the prompt or stop; press twice to quit | +| Ctrl+D | Quit when the prompt is empty | +| ↑ ↓ | Earlier prompts | +| Tab | Take the highlighted suggestion | +| Alt+V | Attach an image from the clipboard | +| `@path` | Bring a file into the prompt; images go to models that can see them | + +Paste or drag a file path into the prompt to attach the file. + +
+ +
+Slash commands +
+ +| Command | Does | +| --- | --- | +| `/new` | Start a fresh thread in this project | +| `/clear` | Clear the screen and start a fresh thread | +| `/resume` | Go back to an earlier thread (Ctrl+D deletes one) | +| `/model` | Pick the model that powers Quill (Ctrl+P pins it to the top) | +| `/effort` | Turn thinking on or off, or pick the effort level for models like gpt-oss | +| `/connect` | Connect another model server | +| `/mode` | Ask first, Trust edits or Autopilot (Shift+Tab switches too) | +| `/init` | Have Quill write an AGENTS.md for the project | +| `/instructions` | Edit your personal AGENTS.md, which every session reads (`/memory` works too) | +| `/compact` | Summarise the conversation to free up context | +| `/retry` | Send the last prompt again | +| `/diff` | Show everything the last reply changed | +| `/usage` | Tokens used by this thread and overall | +| `/version` | Switch to another released version | +| `/commit` | Commit, then push, open a pull request page or publish to GitHub | +| `/branch` | Switch to a branch or create one | +| `/rename ` | Rename the thread | +| `/help`, `/quit` | Help, and leave | + +</details> + +<details> +<summary><b>Scripts and CI</b></summary> +<br/> ``` -sudo dnf install gcc gcc-c++ pkgconf-pkg-config git openssl-devel fontconfig-devel libxkbcommon-devel libxkbcommon-x11-devel wayland-devel vulkan-loader mesa-vulkan-drivers +quill exec "add a test for the parser" +echo "summarise the README" | quill exec - +quill exec --json "list the TODOs" one JSON event per line +quill exec --access auto "run the tests and fix what fails" +quill exec --model local/qwen3.5-9b "explain src/main.rs" ``` -The interface draws with Vulkan, so the machine needs a working Vulkan driver; the Mesa drivers above cover most GPUs. For GitHub sign-in, install [Git Credential Manager](https://github.com/git-ecosystem/git-credential-manager) or any credential helper that stores a GitHub token. +Nobody is there to approve, so anything the access mode would ask about is declined; `--access auto` allows it. The exit code is 0 when the task finished, 1 when it failed and 130 when it was stopped. -macOS and Linux builds go through the same code but have not been tested yet. +</details> -### Checks +<details> +<summary><b>Models, settings and profiles</b></summary> +<br/> ``` -cargo test --workspace -cargo clippy --workspace --all-targets -cargo deny check +quill models model servers, their status and models +quill models --scan look for model servers on this machine and add them +quill usage tokens used today, in 7 and 30 days, and all time +quill versions every published release; quill update <version> switches to one +quill config where the settings live; config edit, config instructions, config reset +``` + +Settings are kept in `settings.json` in `%APPDATA%\quill-code` on Windows, `~/Library/Application Support/quill-code` on macOS and `~/.config/quill-code` on Linux. A project can override any of them in `.quill/settings.json` at its root. + +Edits keep each file's final newline, or its lack of one. New files follow the project's `.editorconfig`. Set `tools.final_newline` to `add` or `remove` to change that for every file Quill writes, except patches, diffs, crontabs and files the `.editorconfig` asks to keep one. + +Models control their reasoning in different ways. gpt-oss takes a `reasoning_effort` of low, medium or high; Qwen3, GLM 4.5 to 4.7 and Hunyuan turn thinking on or off with `enable_thinking`; DeepSeek V3.1 and V3.2 use `thinking`. For anything else Quill reads what the server reports. To teach it a new model, add a profile to `models.profiles`; the first one whose `match` appears in the model's name wins: + +```json +"profiles": [ + { "match": "my-reasoner", "reasoning": "effort", "levels": ["low", "medium", "high"] }, + { "match": "my-thinker", "except": ["instruct"], "reasoning": "toggle", "kwarg": "enable_thinking" }, + { "match": "my-coder", "reasoning": "none", "kwargs": { "my_template_variable": true } } +] ``` -`cargo deny` is installed with `cargo install cargo-deny`. +`reasoning` is `effort`, `toggle` or `none`, and `kwargs` are extra chat template variables sent with every request. + +</details> + +<br/> + +## Under the hood + +For anyone who wants to read or change the code. Rust 2024 and crossterm, no GPU and no browser engine. + +| Crate | | +| --- | --- | +| **quill-code** | The `quill` binary: the screen, slash commands, pickers, approvals, `exec` | +| **quill-core** | The agent engine: the turn loop, tools, access policy, compaction, the system prompt | +| **quill-providers** | Model access: OpenAI-compatible chat, LM Studio and Ollama, model profiles, streaming tool calls | +| **quill-config** | Typed settings in layers, paths per system | +| **quill-git** | Your `git`: status, commits, branches, worktrees, and the GitHub API | +| **quill-weave** | The maths of the weave mark on the welcome banner | + +You need Rust 1.88 or newer from [rustup](https://rustup.rs) and a C compiler: the [Visual Studio Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/) with **Desktop development with C++** on Windows, `xcode-select --install` on macOS, `build-essential` or `gcc` on Linux. + +| Command | | +| --- | --- | +| `cargo run -p quill-code --release` | Build and start `quill` in place | +| `cargo install --path crates/quill-code` | Install your build | +| `cargo test --workspace` | Every unit test | +| `cargo clippy --workspace --all-targets` | Lints, kept clean | +| `cargo deny check` | Licence and banned-crate policy (`cargo install cargo-deny`) | +| `vhs docs/demo/demo.tape` | Record the demo above again (needs [VHS](https://github.com/charmbracelet/vhs) and a running model) | + +Releases come from `main`: bump `version` in `Cargo.toml`, add its section to `CHANGELOG.md`, and merge `dev` into `main`. CI builds every target into a draft release, which is published by hand once it has been tried. The architecture and conventions are in [AGENTS.md](AGENTS.md). + +<br/> + +## Get involved + +- **Report a bug** in [Issues](https://github.com/Smoffyy/quill-code/issues), with the output of `quill --version` and the model you used +- **Send a PR** against `dev`, never `main`, with clippy and the tests passing + +Quill Code is meant for people who would rather run their own models than rent someone else's. It will stay free and MIT licensed. -## Licence +<br/> -MIT, see [LICENSE](LICENSE). Bundled Open Sans is under the SIL Open Font License, see [assets/fonts/OFL.txt](assets/fonts/OFL.txt). The llama.cpp mark is from the llama.cpp project (MIT, Copyright (c) 2023-2026 The ggml authors). \ No newline at end of file +<p align="center"> + <a href="CHANGELOG.md">Changelog</a> · <a href="AGENTS.md">Architecture</a> · <a href="LICENSE">MIT License</a> +</p> \ No newline at end of file diff --git a/assets/brand/app.ico b/assets/brand/app.ico deleted file mode 100644 index 31086ed..0000000 Binary files a/assets/brand/app.ico and /dev/null differ diff --git a/assets/brand/mark-small-on-dark.svg b/assets/brand/mark-small-on-dark.svg deleted file mode 100644 index 24ebaa0..0000000 --- a/assets/brand/mark-small-on-dark.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" width="1000" height="1000" viewBox="0 0 1000 1000"><g fill="#f2f1ec"><circle cx="374.31" cy="431.99" r="27" fill-opacity="0.38"/><circle cx="494.25" cy="626.89" r="27.39" fill-opacity="0.38"/><circle cx="487.8" cy="639.48" r="28.88" fill-opacity="0.38"/><circle cx="430.12" cy="497.98" r="34.94" fill-opacity="0.38"/><circle cx="607.4" cy="453.1" r="30.29" fill-opacity="0.38"/><circle cx="670.53" cy="624.15" r="36.47" fill-opacity="0.38"/><circle cx="709.4" cy="464.84" r="30.62" fill-opacity="0.38"/><circle cx="611.24" cy="563.8" r="30.69" fill-opacity="0.38"/><circle cx="744.45" cy="473.93" r="31.3" fill-opacity="0.38"/><circle cx="721.95" cy="473.71" r="32.27" fill-opacity="0.38"/><circle cx="212" cy="320.67" r="42.26" fill-opacity="0.393"/><circle cx="277.39" cy="575.67" r="31.93" fill-opacity="0.38"/><circle cx="350.22" cy="240.18" r="32.41" fill-opacity="0.38"/><circle cx="639.18" cy="479.71" r="32.5" fill-opacity="0.38"/><circle cx="836.71" cy="564.81" r="32.75" fill-opacity="0.38"/><circle cx="114.39" cy="548.38" r="47.05" fill-opacity="0.472"/><circle cx="564.29" cy="171.13" r="47.47" fill-opacity="0.479"/><circle cx="219.79" cy="653.86" r="33.71" fill-opacity="0.38"/><circle cx="415.62" cy="788.75" r="33.79" fill-opacity="0.38"/><circle cx="590.89" cy="695.6" r="34.82" fill-opacity="0.38"/><circle cx="446.89" cy="166.06" r="34.28" fill-opacity="0.38"/><circle cx="552.83" cy="718.38" r="51.94" fill-opacity="0.547"/><circle cx="134.53" cy="250.46" r="35.08" fill-opacity="0.38"/><circle cx="519.81" cy="714.83" r="52.88" fill-opacity="0.561"/><circle cx="348.64" cy="700.57" r="35.59" fill-opacity="0.38"/><circle cx="559.08" cy="775.51" r="35.67" fill-opacity="0.38"/><circle cx="765.14" cy="254.17" r="36.15" fill-opacity="0.38"/><circle cx="605.5" cy="284.53" r="39.07" fill-opacity="0.38"/><circle cx="711.51" cy="711.4" r="35.86" fill-opacity="0.38"/><circle cx="179.21" cy="518.4" r="37.24" fill-opacity="0.38"/><circle cx="771.35" cy="549.09" r="36.45" fill-opacity="0.38"/><circle cx="176.86" cy="713.71" r="36.8" fill-opacity="0.38"/><circle cx="201.22" cy="327.82" r="37.84" fill-opacity="0.38"/><circle cx="884.47" cy="255.56" r="40.33" fill-opacity="0.38"/><circle cx="257.09" cy="300.67" r="37.59" fill-opacity="0.38"/><circle cx="376.31" cy="734.44" r="38.54" fill-opacity="0.38"/><circle cx="662.31" cy="231.02" r="37.94" fill-opacity="0.38"/><circle cx="639.42" cy="763.95" r="41.63" fill-opacity="0.38"/><circle cx="765" cy="587.74" r="46.27" fill-opacity="0.444"/><circle cx="407.56" cy="512.84" r="39.27" fill-opacity="0.38"/><circle cx="541.48" cy="659.14" r="39.23" fill-opacity="0.38"/><circle cx="381.15" cy="607.29" r="39.57" fill-opacity="0.38"/><circle cx="662.92" cy="892.89" r="39.7" fill-opacity="0.38"/><circle cx="248.23" cy="313.45" r="39.92" fill-opacity="0.38"/><circle cx="576.81" cy="129.12" r="61.72" fill-opacity="0.696"/><circle cx="155.05" cy="591.69" r="40.13" fill-opacity="0.38"/><circle cx="593.01" cy="850.6" r="40.16" fill-opacity="0.38"/><circle cx="481.61" cy="574.01" r="40.19" fill-opacity="0.38"/><circle cx="191.51" cy="558.26" r="40.26" fill-opacity="0.38"/><circle cx="192.56" cy="702.25" r="40.47" fill-opacity="0.38"/><circle cx="457.92" cy="789.64" r="40.69" fill-opacity="0.38"/><circle cx="123.4" cy="356.55" r="40.93" fill-opacity="0.38"/><circle cx="625.43" cy="722.79" r="41.12" fill-opacity="0.38"/><circle cx="558.31" cy="732.2" r="44.2" fill-opacity="0.39"/><circle cx="503.12" cy="740.15" r="55.31" fill-opacity="0.598"/><circle cx="336.48" cy="482.59" r="42.52" fill-opacity="0.38"/><circle cx="632.37" cy="606.77" r="41.37" fill-opacity="0.38"/><circle cx="332.11" cy="479.56" r="41.43" fill-opacity="0.38"/><circle cx="234.28" cy="168.39" r="41.48" fill-opacity="0.38"/><circle cx="423.96" cy="209.81" r="41.87" fill-opacity="0.38"/><circle cx="215.64" cy="226.73" r="42.55" fill-opacity="0.38"/><circle cx="847.57" cy="778.53" r="42.18" fill-opacity="0.38"/><circle cx="686.24" cy="311.78" r="42.44" fill-opacity="0.38"/><circle cx="242.76" cy="749.43" r="45.01" fill-opacity="0.395"/><circle cx="400.29" cy="468.29" r="42.9" fill-opacity="0.38"/><circle cx="73.12" cy="410.29" r="43.12" fill-opacity="0.38"/><circle cx="370.74" cy="254.86" r="65.69" fill-opacity="0.763"/><circle cx="497.6" cy="884.23" r="43.47" fill-opacity="0.38"/><circle cx="641.21" cy="864.79" r="49.84" fill-opacity="0.506"/><circle cx="610.26" cy="491.15" r="49.84" fill-opacity="0.506"/><circle cx="336.84" cy="482.97" r="43.66" fill-opacity="0.38"/><circle cx="383" cy="456.4" r="43.73" fill-opacity="0.38"/><circle cx="878.42" cy="501.67" r="43.85" fill-opacity="0.38"/><circle cx="667.52" cy="283.04" r="43.96" fill-opacity="0.38"/><circle cx="572.34" cy="140.55" r="45.31" fill-opacity="0.38"/><circle cx="804.16" cy="364.75" r="44.4" fill-opacity="0.38"/><circle cx="627.26" cy="475.86" r="45.93" fill-opacity="0.382"/><circle cx="558" cy="484.84" r="44.86" fill-opacity="0.38"/><circle cx="785.6" cy="419.4" r="44.96" fill-opacity="0.38"/><circle cx="207.51" cy="438.55" r="45.17" fill-opacity="0.38"/><circle cx="549.44" cy="479.05" r="75.14" fill-opacity="0.906"/><circle cx="456.38" cy="741.14" r="65.37" fill-opacity="0.769"/><circle cx="788.98" cy="764.62" r="46.5" fill-opacity="0.38"/><circle cx="702.44" cy="312.15" r="53.73" fill-opacity="0.58"/><circle cx="809.7" cy="425.58" r="47.63" fill-opacity="0.38"/><circle cx="529.66" cy="357.07" r="47.66" fill-opacity="0.38"/><circle cx="890.21" cy="510.11" r="79.79" fill-opacity="0.985"/><circle cx="403.12" cy="576.12" r="49.01" fill-opacity="0.38"/><circle cx="377.51" cy="515.9" r="49.97" fill-opacity="0.42"/><circle cx="381.66" cy="557.54" r="56.35" fill-opacity="0.632"/></g></svg> \ No newline at end of file diff --git a/assets/brand/mark-small-on-light.svg b/assets/brand/mark-small-on-light.svg deleted file mode 100644 index eec3e37..0000000 --- a/assets/brand/mark-small-on-light.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" width="1000" height="1000" viewBox="0 0 1000 1000"><g fill="#1c1b19"><circle cx="374.31" cy="431.99" r="27" fill-opacity="0.38"/><circle cx="494.25" cy="626.89" r="27.39" fill-opacity="0.38"/><circle cx="487.8" cy="639.48" r="28.88" fill-opacity="0.38"/><circle cx="430.12" cy="497.98" r="34.94" fill-opacity="0.38"/><circle cx="607.4" cy="453.1" r="30.29" fill-opacity="0.38"/><circle cx="670.53" cy="624.15" r="36.47" fill-opacity="0.38"/><circle cx="709.4" cy="464.84" r="30.62" fill-opacity="0.38"/><circle cx="611.24" cy="563.8" r="30.69" fill-opacity="0.38"/><circle cx="744.45" cy="473.93" r="31.3" fill-opacity="0.38"/><circle cx="721.95" cy="473.71" r="32.27" fill-opacity="0.38"/><circle cx="212" cy="320.67" r="42.26" fill-opacity="0.393"/><circle cx="277.39" cy="575.67" r="31.93" fill-opacity="0.38"/><circle cx="350.22" cy="240.18" r="32.41" fill-opacity="0.38"/><circle cx="639.18" cy="479.71" r="32.5" fill-opacity="0.38"/><circle cx="836.71" cy="564.81" r="32.75" fill-opacity="0.38"/><circle cx="114.39" cy="548.38" r="47.05" fill-opacity="0.472"/><circle cx="564.29" cy="171.13" r="47.47" fill-opacity="0.479"/><circle cx="219.79" cy="653.86" r="33.71" fill-opacity="0.38"/><circle cx="415.62" cy="788.75" r="33.79" fill-opacity="0.38"/><circle cx="590.89" cy="695.6" r="34.82" fill-opacity="0.38"/><circle cx="446.89" cy="166.06" r="34.28" fill-opacity="0.38"/><circle cx="552.83" cy="718.38" r="51.94" fill-opacity="0.547"/><circle cx="134.53" cy="250.46" r="35.08" fill-opacity="0.38"/><circle cx="519.81" cy="714.83" r="52.88" fill-opacity="0.561"/><circle cx="348.64" cy="700.57" r="35.59" fill-opacity="0.38"/><circle cx="559.08" cy="775.51" r="35.67" fill-opacity="0.38"/><circle cx="765.14" cy="254.17" r="36.15" fill-opacity="0.38"/><circle cx="605.5" cy="284.53" r="39.07" fill-opacity="0.38"/><circle cx="711.51" cy="711.4" r="35.86" fill-opacity="0.38"/><circle cx="179.21" cy="518.4" r="37.24" fill-opacity="0.38"/><circle cx="771.35" cy="549.09" r="36.45" fill-opacity="0.38"/><circle cx="176.86" cy="713.71" r="36.8" fill-opacity="0.38"/><circle cx="201.22" cy="327.82" r="37.84" fill-opacity="0.38"/><circle cx="884.47" cy="255.56" r="40.33" fill-opacity="0.38"/><circle cx="257.09" cy="300.67" r="37.59" fill-opacity="0.38"/><circle cx="376.31" cy="734.44" r="38.54" fill-opacity="0.38"/><circle cx="662.31" cy="231.02" r="37.94" fill-opacity="0.38"/><circle cx="639.42" cy="763.95" r="41.63" fill-opacity="0.38"/><circle cx="765" cy="587.74" r="46.27" fill-opacity="0.444"/><circle cx="407.56" cy="512.84" r="39.27" fill-opacity="0.38"/><circle cx="541.48" cy="659.14" r="39.23" fill-opacity="0.38"/><circle cx="381.15" cy="607.29" r="39.57" fill-opacity="0.38"/><circle cx="662.92" cy="892.89" r="39.7" fill-opacity="0.38"/><circle cx="248.23" cy="313.45" r="39.92" fill-opacity="0.38"/><circle cx="576.81" cy="129.12" r="61.72" fill-opacity="0.696"/><circle cx="155.05" cy="591.69" r="40.13" fill-opacity="0.38"/><circle cx="593.01" cy="850.6" r="40.16" fill-opacity="0.38"/><circle cx="481.61" cy="574.01" r="40.19" fill-opacity="0.38"/><circle cx="191.51" cy="558.26" r="40.26" fill-opacity="0.38"/><circle cx="192.56" cy="702.25" r="40.47" fill-opacity="0.38"/><circle cx="457.92" cy="789.64" r="40.69" fill-opacity="0.38"/><circle cx="123.4" cy="356.55" r="40.93" fill-opacity="0.38"/><circle cx="625.43" cy="722.79" r="41.12" fill-opacity="0.38"/><circle cx="558.31" cy="732.2" r="44.2" fill-opacity="0.39"/><circle cx="503.12" cy="740.15" r="55.31" fill-opacity="0.598"/><circle cx="336.48" cy="482.59" r="42.52" fill-opacity="0.38"/><circle cx="632.37" cy="606.77" r="41.37" fill-opacity="0.38"/><circle cx="332.11" cy="479.56" r="41.43" fill-opacity="0.38"/><circle cx="234.28" cy="168.39" r="41.48" fill-opacity="0.38"/><circle cx="423.96" cy="209.81" r="41.87" fill-opacity="0.38"/><circle cx="215.64" cy="226.73" r="42.55" fill-opacity="0.38"/><circle cx="847.57" cy="778.53" r="42.18" fill-opacity="0.38"/><circle cx="686.24" cy="311.78" r="42.44" fill-opacity="0.38"/><circle cx="242.76" cy="749.43" r="45.01" fill-opacity="0.395"/><circle cx="400.29" cy="468.29" r="42.9" fill-opacity="0.38"/><circle cx="73.12" cy="410.29" r="43.12" fill-opacity="0.38"/><circle cx="370.74" cy="254.86" r="65.69" fill-opacity="0.763"/><circle cx="497.6" cy="884.23" r="43.47" fill-opacity="0.38"/><circle cx="641.21" cy="864.79" r="49.84" fill-opacity="0.506"/><circle cx="610.26" cy="491.15" r="49.84" fill-opacity="0.506"/><circle cx="336.84" cy="482.97" r="43.66" fill-opacity="0.38"/><circle cx="383" cy="456.4" r="43.73" fill-opacity="0.38"/><circle cx="878.42" cy="501.67" r="43.85" fill-opacity="0.38"/><circle cx="667.52" cy="283.04" r="43.96" fill-opacity="0.38"/><circle cx="572.34" cy="140.55" r="45.31" fill-opacity="0.38"/><circle cx="804.16" cy="364.75" r="44.4" fill-opacity="0.38"/><circle cx="627.26" cy="475.86" r="45.93" fill-opacity="0.382"/><circle cx="558" cy="484.84" r="44.86" fill-opacity="0.38"/><circle cx="785.6" cy="419.4" r="44.96" fill-opacity="0.38"/><circle cx="207.51" cy="438.55" r="45.17" fill-opacity="0.38"/><circle cx="549.44" cy="479.05" r="75.14" fill-opacity="0.906"/><circle cx="456.38" cy="741.14" r="65.37" fill-opacity="0.769"/><circle cx="788.98" cy="764.62" r="46.5" fill-opacity="0.38"/><circle cx="702.44" cy="312.15" r="53.73" fill-opacity="0.58"/><circle cx="809.7" cy="425.58" r="47.63" fill-opacity="0.38"/><circle cx="529.66" cy="357.07" r="47.66" fill-opacity="0.38"/><circle cx="890.21" cy="510.11" r="79.79" fill-opacity="0.985"/><circle cx="403.12" cy="576.12" r="49.01" fill-opacity="0.38"/><circle cx="377.51" cy="515.9" r="49.97" fill-opacity="0.42"/><circle cx="381.66" cy="557.54" r="56.35" fill-opacity="0.632"/></g></svg> \ No newline at end of file diff --git a/assets/fonts/OFL.txt b/assets/fonts/OFL.txt deleted file mode 100644 index d762c3c..0000000 --- a/assets/fonts/OFL.txt +++ /dev/null @@ -1,92 +0,0 @@ -Copyright 2020 The Open Sans Project Authors (https://github.com/googlefonts/opensans) - -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://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 & 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/assets/fonts/OpenSans-Light.ttf b/assets/fonts/OpenSans-Light.ttf deleted file mode 100644 index a0ba204..0000000 Binary files a/assets/fonts/OpenSans-Light.ttf and /dev/null differ diff --git a/assets/fonts/OpenSans-Regular.ttf b/assets/fonts/OpenSans-Regular.ttf deleted file mode 100644 index 8529c43..0000000 Binary files a/assets/fonts/OpenSans-Regular.ttf and /dev/null differ diff --git a/assets/fonts/OpenSans-SemiBold.ttf b/assets/fonts/OpenSans-SemiBold.ttf deleted file mode 100644 index f210dd9..0000000 Binary files a/assets/fonts/OpenSans-SemiBold.ttf and /dev/null differ diff --git a/assets/icons/arrow-left.svg b/assets/icons/arrow-left.svg deleted file mode 100644 index 9e366b7..0000000 --- a/assets/icons/arrow-left.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M19 12H5M11 6l-6 6 6 6" /></svg> \ No newline at end of file diff --git a/assets/icons/arrow-out.svg b/assets/icons/arrow-out.svg deleted file mode 100644 index 8d7e8d9..0000000 --- a/assets/icons/arrow-out.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m6.5 17.5 11-11M10.5 6.5h7v7" /></svg> \ No newline at end of file diff --git a/assets/icons/artifact.svg b/assets/icons/artifact.svg deleted file mode 100644 index 0c4807f..0000000 --- a/assets/icons/artifact.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="7.5" cy="15.9" r="4" /><g transform="translate(10.25 9.15) rotate(-15)"><path d="M-5 0a5 5 0 0 1 10 0z" /></g><rect x="13" y="10.4" width="7.5" height="9.5" rx="2" /></svg> \ No newline at end of file diff --git a/assets/icons/box.svg b/assets/icons/box.svg deleted file mode 100644 index 61fa265..0000000 --- a/assets/icons/box.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M6.5 3h11" /><path d="M5 6.5h14M3.5 10h17l-1.6 9.3a2 2 0 0 1-2 1.7H7.1a2 2 0 0 1-2-1.7z" /></svg> \ No newline at end of file diff --git a/assets/icons/brain.svg b/assets/icons/brain.svg deleted file mode 100644 index 8cfc519..0000000 --- a/assets/icons/brain.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 5A2.6 2.6 0 0 0 7.5 6 2.6 2.6 0 0 0 4.5 10 2.6 2.6 0 0 0 4.5 14 2.6 2.6 0 0 0 7.5 18 2.6 2.6 0 0 0 12 19M12 5a2.6 2.6 0 0 1 4.5 1 2.6 2.6 0 0 1 3 4 2.6 2.6 0 0 1 0 4 2.6 2.6 0 0 1-3 4 2.6 2.6 0 0 1-4.5 1M12 5v14" /></svg> \ No newline at end of file diff --git a/assets/icons/briefcase.svg b/assets/icons/briefcase.svg deleted file mode 100644 index 1064fa1..0000000 --- a/assets/icons/briefcase.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><g><rect x="3" y="7.5" width="18" height="12.5" rx="3" /><path d="M7.5 13h3M13.5 13h3" /></g><path d="M9 7.5V5.8A1.8 1.8 0 0 1 10.8 4h2.4A1.8 1.8 0 0 1 15 5.8v1.7" /></svg> \ No newline at end of file diff --git a/assets/icons/bulb.svg b/assets/icons/bulb.svg deleted file mode 100644 index c2de155..0000000 --- a/assets/icons/bulb.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M9.5 16c0-1.2-.6-2-1.6-2.8A5.9 5.9 0 1 1 16.1 13.2c-1 .8-1.6 1.6-1.6 2.8zM9.5 18.5h5M10.5 21h3" /></svg> \ No newline at end of file diff --git a/assets/icons/calculator.svg b/assets/icons/calculator.svg deleted file mode 100644 index 6097544..0000000 --- a/assets/icons/calculator.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="5" y="3" width="14" height="18" rx="2.5" /><path d="M8.5 7h7M8.5 11h.01M12 11h.01M15.5 11h.01M8.5 14.5h.01M12 14.5h.01M15.5 14.5v3M8.5 17.5h.01M12 17.5h.01" /></svg> \ No newline at end of file diff --git a/assets/icons/calendar.svg b/assets/icons/calendar.svg deleted file mode 100644 index 073af70..0000000 --- a/assets/icons/calendar.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="5.5" width="18" height="15" rx="3" /><path d="M8 3.5v4M16 3.5v4M3 10.5h18" /></svg> \ No newline at end of file diff --git a/assets/icons/chat.svg b/assets/icons/chat.svg deleted file mode 100644 index 1f3744e..0000000 --- a/assets/icons/chat.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><g transform="translate(0 .6)"><path d="M3.5 11a6.5 6.5 0 1 1 3.4 5.7L3.5 17.5l.9-3.2A6.5 6.5 0 0 1 3.5 11z" /><path d="M13.96 5.59A6 6 0 0 1 20.2 14.5L21 18.3l-3.95-1.16A6 6 0 0 1 12.46 16.94" /></g></svg> \ No newline at end of file diff --git a/assets/icons/check-circle.svg b/assets/icons/check-circle.svg deleted file mode 100644 index 8d43d79..0000000 --- a/assets/icons/check-circle.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="9" /><path d="m8.25 12.25 2.5 2.5 5-5" /></svg> \ No newline at end of file diff --git a/assets/icons/check.svg b/assets/icons/check.svg deleted file mode 100644 index 13d0f57..0000000 --- a/assets/icons/check.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m4.5 12.75 4.5 4.5 10.5-10.5" /></svg> \ No newline at end of file diff --git a/assets/icons/chev-down.svg b/assets/icons/chev-down.svg deleted file mode 100644 index 0486764..0000000 --- a/assets/icons/chev-down.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6" /></svg> \ No newline at end of file diff --git a/assets/icons/chevron.svg b/assets/icons/chevron.svg deleted file mode 100644 index 2244708..0000000 --- a/assets/icons/chevron.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m9 6 6 6-6 6" /></svg> \ No newline at end of file diff --git a/assets/icons/circle-alert.svg b/assets/icons/circle-alert.svg deleted file mode 100644 index 50322b0..0000000 --- a/assets/icons/circle-alert.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="9" /><path d="M12 7.5v5.5" /><circle cx="12" cy="16.25" r="1" fill="currentColor" stroke="none" /></svg> \ No newline at end of file diff --git a/assets/icons/circle-stop.svg b/assets/icons/circle-stop.svg deleted file mode 100644 index e426cae..0000000 --- a/assets/icons/circle-stop.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="9" /><rect x="9" y="9" width="6" height="6" rx="1.5" /></svg> \ No newline at end of file diff --git a/assets/icons/circle-x.svg b/assets/icons/circle-x.svg deleted file mode 100644 index 7a84f60..0000000 --- a/assets/icons/circle-x.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="9" /><path d="m9.25 9.25 5.5 5.5M14.75 9.25l-5.5 5.5" /></svg> \ No newline at end of file diff --git a/assets/icons/clock.svg b/assets/icons/clock.svg deleted file mode 100644 index f3476b7..0000000 --- a/assets/icons/clock.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="9" /><line x1="12" y1="12" x2="15" y2="13.75" /><line x1="12" y1="12" x2="12" y2="7" /></svg> \ No newline at end of file diff --git a/assets/icons/code-tag.svg b/assets/icons/code-tag.svg deleted file mode 100644 index f5f1769..0000000 --- a/assets/icons/code-tag.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M8.5 7.5 4 12l4.5 4.5" /><path d="M15.5 7.5 20 12l-4.5 4.5" /><path d="m13.5 5.5-3 13" /></svg> \ No newline at end of file diff --git a/assets/icons/code.svg b/assets/icons/code.svg deleted file mode 100644 index 22fe5f2..0000000 --- a/assets/icons/code.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M8.5 7l-5 5 5 5M15.5 7l5 5-5 5" /></svg> \ No newline at end of file diff --git a/assets/icons/coffee.svg b/assets/icons/coffee.svg deleted file mode 100644 index 2c9ceaf..0000000 --- a/assets/icons/coffee.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M4.5 9.5h11V15a4.5 4.5 0 0 1-4.5 4.5H9A4.5 4.5 0 0 1 4.5 15zM15.5 11h1.25a2.75 2.75 0 0 1 0 5.5H15.5M7.5 4.5v2M10.5 4.5v2M13.5 4.5v2" /></svg> \ No newline at end of file diff --git a/assets/icons/collapse.svg b/assets/icons/collapse.svg deleted file mode 100644 index a7b022d..0000000 --- a/assets/icons/collapse.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M4 9.5h5.5V4M9.5 9.5l-6-6M20 14.5h-5.5V20M14.5 14.5l6 6" /></svg> \ No newline at end of file diff --git a/assets/icons/columns.svg b/assets/icons/columns.svg deleted file mode 100644 index a162bd4..0000000 --- a/assets/icons/columns.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="3.5" y="4" width="7" height="16" rx="2" /><rect x="13.5" y="4" width="7" height="16" rx="2" /></svg> \ No newline at end of file diff --git a/assets/icons/compact.svg b/assets/icons/compact.svg deleted file mode 100644 index b364af3..0000000 --- a/assets/icons/compact.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M4 6.5h16M7 12h10M10 17.5h4" /></svg> \ No newline at end of file diff --git a/assets/icons/compose.svg b/assets/icons/compose.svg deleted file mode 100644 index 3116897..0000000 --- a/assets/icons/compose.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 4.5H7A2.5 2.5 0 0 0 4.5 7v10A2.5 2.5 0 0 0 7 19.5h10a2.5 2.5 0 0 0 2.5-2.5v-5" /><path d="M10 14v-2.4l7.3-7.3a1.7 1.7 0 0 1 2.4 2.4L12.4 14z" /></svg> \ No newline at end of file diff --git a/assets/icons/copy.svg b/assets/icons/copy.svg deleted file mode 100644 index 7b92e15..0000000 --- a/assets/icons/copy.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="8.5" y="8.5" width="12" height="12" rx="2.5" /><path d="M15.5 8.5V6A2.5 2.5 0 0 0 13 3.5H6A2.5 2.5 0 0 0 3.5 6v7A2.5 2.5 0 0 0 6 15.5h2.5" /></svg> \ No newline at end of file diff --git a/assets/icons/cube.svg b/assets/icons/cube.svg deleted file mode 100644 index bfb1b76..0000000 --- a/assets/icons/cube.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3.25l7.5 4.2v9.1L12 20.75l-7.5-4.2v-9.1zM4.5 7.45l7.5 4.2 7.5-4.2M12 11.65v9.1" /></svg> \ No newline at end of file diff --git a/assets/icons/dots-v.svg b/assets/icons/dots-v.svg deleted file mode 100644 index c666ffc..0000000 --- a/assets/icons/dots-v.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><circle cx="12" cy="5" r="1.5" /><circle cx="12" cy="12" r="1.5" /><circle cx="12" cy="19" r="1.5" /></svg> \ No newline at end of file diff --git a/assets/icons/dots.svg b/assets/icons/dots.svg deleted file mode 100644 index 7ad0abf..0000000 --- a/assets/icons/dots.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><circle cx="5" cy="12" r="1.5" /><circle cx="12" cy="12" r="1.5" /><circle cx="19" cy="12" r="1.5" /></svg> \ No newline at end of file diff --git a/assets/icons/down.svg b/assets/icons/down.svg deleted file mode 100644 index c486ac6..0000000 --- a/assets/icons/down.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 5v14M6 13l6 6 6-6" /></svg> \ No newline at end of file diff --git a/assets/icons/download.svg b/assets/icons/download.svg deleted file mode 100644 index a66b934..0000000 --- a/assets/icons/download.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3.5V15M7.5 10.5 12 15l4.5-4.5M5 20.5h14" /></svg> \ No newline at end of file diff --git a/assets/icons/enter.svg b/assets/icons/enter.svg deleted file mode 100644 index db98fef..0000000 --- a/assets/icons/enter.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M19.5 5.5v5a3.5 3.5 0 0 1-3.5 3.5H4.5M9 9.5 4.5 14 9 18.5" /></svg> \ No newline at end of file diff --git a/assets/icons/eraser.svg b/assets/icons/eraser.svg deleted file mode 100644 index 69c39af..0000000 --- a/assets/icons/eraser.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M9 20.5h11M5.1 14.6l9.3-9.3a2 2 0 0 1 2.8 0l2.5 2.5a2 2 0 0 1 0 2.8l-8.6 8.6a2.4 2.4 0 0 1-1.7.7H8.6a2.4 2.4 0 0 1-1.7-.7l-1.8-1.8a2 2 0 0 1 0-2.8zM9.5 10.2l5.3 5.3" /></svg> \ No newline at end of file diff --git a/assets/icons/expand.svg b/assets/icons/expand.svg deleted file mode 100644 index ba441da..0000000 --- a/assets/icons/expand.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M9.5 3.5h-6v6M3.5 3.5 10 10M14.5 20.5h6v-6M20.5 20.5 14 14" /></svg> \ No newline at end of file diff --git a/assets/icons/eye-off.svg b/assets/icons/eye-off.svg deleted file mode 100644 index fcbb583..0000000 --- a/assets/icons/eye-off.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m4 4 16 16M10.2 5.7A9 9 0 0 1 12 5.5c5.6 0 9 6.5 9 6.5a16 16 0 0 1-2.8 3.7M6.6 6.7A15 15 0 0 0 3 12s3.4 6.5 9 6.5c1.3 0 2.5-.3 3.6-.8M10 10.1a2.75 2.75 0 0 0 3.9 3.9" /></svg> \ No newline at end of file diff --git a/assets/icons/eye.svg b/assets/icons/eye.svg deleted file mode 100644 index 1400f41..0000000 --- a/assets/icons/eye.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12s3.4-6.5 9-6.5 9 6.5 9 6.5-3.4 6.5-9 6.5S3 12 3 12z" /><circle cx="12" cy="12" r="2.75" /></svg> \ No newline at end of file diff --git a/assets/icons/file-code.svg b/assets/icons/file-code.svg deleted file mode 100644 index 8d0527a..0000000 --- a/assets/icons/file-code.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M14 3H7.5A2.5 2.5 0 0 0 5 5.5v13A2.5 2.5 0 0 0 7.5 21h9a2.5 2.5 0 0 0 2.5-2.5V8zM14 3v3.5A1.5 1.5 0 0 0 15.5 8H19" /><path d="m10 12.5-2 2 2 2M14 12.5l2 2-2 2" /></svg> \ No newline at end of file diff --git a/assets/icons/file-diff.svg b/assets/icons/file-diff.svg deleted file mode 100644 index 3fa8bcc..0000000 --- a/assets/icons/file-diff.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M14 3H7.5A2.5 2.5 0 0 0 5 5.5v13A2.5 2.5 0 0 0 7.5 21h9a2.5 2.5 0 0 0 2.5-2.5V8zM14 3v3.5A1.5 1.5 0 0 0 15.5 8H19" /><path d="M12 10.5v5M9.5 13h5M9.5 17.5h5" /></svg> \ No newline at end of file diff --git a/assets/icons/file-pen.svg b/assets/icons/file-pen.svg deleted file mode 100644 index 4b7d083..0000000 --- a/assets/icons/file-pen.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M14 3H7.5A2.5 2.5 0 0 0 5 5.5v13A2.5 2.5 0 0 0 7.5 21h9a2.5 2.5 0 0 0 2.5-2.5V8zM14 3v3.5A1.5 1.5 0 0 0 15.5 8H19" /><path d="M9 17.5v-1.7l3.8-3.8a1.2 1.2 0 0 1 1.7 1.7l-3.8 3.8z" /></svg> \ No newline at end of file diff --git a/assets/icons/file-plus.svg b/assets/icons/file-plus.svg deleted file mode 100644 index 7c10cee..0000000 --- a/assets/icons/file-plus.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M14 3H7.5A2.5 2.5 0 0 0 5 5.5v13A2.5 2.5 0 0 0 7.5 21h9a2.5 2.5 0 0 0 2.5-2.5V8zM14 3v3.5A1.5 1.5 0 0 0 15.5 8H19" /><path d="M12 11.5v6M9 14.5h6" /></svg> \ No newline at end of file diff --git a/assets/icons/file-text.svg b/assets/icons/file-text.svg deleted file mode 100644 index 73ff61a..0000000 --- a/assets/icons/file-text.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M14 3H7.5A2.5 2.5 0 0 0 5 5.5v13A2.5 2.5 0 0 0 7.5 21h9a2.5 2.5 0 0 0 2.5-2.5V8zM14 3v3.5A1.5 1.5 0 0 0 15.5 8H19" /><path d="M9 12.5h6M9 16h4" /></svg> \ No newline at end of file diff --git a/assets/icons/files.svg b/assets/icons/files.svg deleted file mode 100644 index b12df89..0000000 --- a/assets/icons/files.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M15 6.5V5a1.5 1.5 0 0 0-1.5-1.5h-7A2.5 2.5 0 0 0 4 6v10.5A1.5 1.5 0 0 0 5.5 18H7.5" /><path d="M10 6.5h5.5L20 11v7.5a2.5 2.5 0 0 1-2.5 2.5H10a2.5 2.5 0 0 1-2.5-2.5V9A2.5 2.5 0 0 1 10 6.5zM15.5 6.5V10a1 1 0 0 0 1 1H20" /></svg> \ No newline at end of file diff --git a/assets/icons/flask.svg b/assets/icons/flask.svg deleted file mode 100644 index 77f9873..0000000 --- a/assets/icons/flask.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M9.5 3h5M10.5 3v6.2l-5.3 9A1.9 1.9 0 0 0 6.8 21h10.4a1.9 1.9 0 0 0 1.6-2.8l-5.3-9V3M7.6 15h8.8" /></svg> \ No newline at end of file diff --git a/assets/icons/folder-open.svg b/assets/icons/folder-open.svg deleted file mode 100644 index 7f35a10..0000000 --- a/assets/icons/folder-open.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3.5 17V7A2.5 2.5 0 0 1 6 4.5h3.2a2 2 0 0 1 1.4.6L12 6.5h5.5A2.5 2.5 0 0 1 20 9v1" /><path d="m3.5 17 2.1-5.6A2.2 2.2 0 0 1 7.7 10h12.8a1.1 1.1 0 0 1 1 1.5l-2.2 6.3a2.5 2.5 0 0 1-2.3 1.7H6A2.5 2.5 0 0 1 3.5 17z" /></svg> \ No newline at end of file diff --git a/assets/icons/folder-plus.svg b/assets/icons/folder-plus.svg deleted file mode 100644 index fc5619d..0000000 --- a/assets/icons/folder-plus.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3.5 7A2.5 2.5 0 0 1 6 4.5h3.2a2 2 0 0 1 1.4.6L12 6.5h6A2.5 2.5 0 0 1 20.5 9v8a2.5 2.5 0 0 1-2.5 2.5H6A2.5 2.5 0 0 1 3.5 17z" /><path d="M12 10.5v6M9 13.5h6" /></svg> \ No newline at end of file diff --git a/assets/icons/folder-tree.svg b/assets/icons/folder-tree.svg deleted file mode 100644 index 1f93c90..0000000 --- a/assets/icons/folder-tree.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="3.5" y="3.5" width="7" height="5" rx="1.5" /><rect x="13.5" y="10" width="7" height="4.5" rx="1.5" /><rect x="13.5" y="16.5" width="7" height="4.5" rx="1.5" /><path d="M7 8.5v10.25c0 .4.35.75.75.75h5.75M7 12.25h6.5" /></svg> \ No newline at end of file diff --git a/assets/icons/folder.svg b/assets/icons/folder.svg deleted file mode 100644 index fe22f71..0000000 --- a/assets/icons/folder.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3.5 7A2.5 2.5 0 0 1 6 4.5h3.2a2 2 0 0 1 1.4.6L12 6.5h6A2.5 2.5 0 0 1 20.5 9v8a2.5 2.5 0 0 1-2.5 2.5H6A2.5 2.5 0 0 1 3.5 17z" /></svg> \ No newline at end of file diff --git a/assets/icons/fork.svg b/assets/icons/fork.svg deleted file mode 100644 index f781c3e..0000000 --- a/assets/icons/fork.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="6.5" cy="5.5" r="2" /><circle cx="6.5" cy="18.5" r="2" /><circle cx="17.5" cy="7" r="2" /><path d="M6.5 7.5v9M17.5 9v1a3.5 3.5 0 0 1-3.5 3.5h-4a3.5 3.5 0 0 0-3.5 3" /></svg> \ No newline at end of file diff --git a/assets/icons/gauge.svg b/assets/icons/gauge.svg deleted file mode 100644 index 41bdca7..0000000 --- a/assets/icons/gauge.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M4.6 19a9 9 0 1 1 14.8 0M12 13.9l3.5-3.5" /><circle cx="12" cy="13.9" r="1.3" /></svg> \ No newline at end of file diff --git a/assets/icons/gear.svg b/assets/icons/gear.svg deleted file mode 100644 index 674bd94..0000000 --- a/assets/icons/gear.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M19.016 10.38 20.889 10.592A9 9 0 0 1 20.889 13.408L19.016 13.62A7.2 7.2 0 0 1 18.106 15.815L19.281 17.29A9 9 0 0 1 17.29 19.281L15.815 18.106A7.2 7.2 0 0 1 13.62 19.016L13.408 20.889A9 9 0 0 1 10.592 20.889L10.38 19.016A7.2 7.2 0 0 1 8.185 18.106L6.71 19.281A9 9 0 0 1 4.719 17.29L5.894 15.815A7.2 7.2 0 0 1 4.984 13.62L3.111 13.408A9 9 0 0 1 3.111 10.592L4.984 10.38A7.2 7.2 0 0 1 5.894 8.185L4.719 6.71A9 9 0 0 1 6.71 4.719L8.185 5.894A7.2 7.2 0 0 1 10.38 4.984L10.592 3.111A9 9 0 0 1 13.408 3.111L13.62 4.984A7.2 7.2 0 0 1 15.815 5.894L17.29 4.719A9 9 0 0 1 19.281 6.71L18.106 8.185A7.2 7.2 0 0 1 19.016 10.38Z" /><circle cx="12" cy="12" r="3" /></svg> \ No newline at end of file diff --git a/assets/icons/ghost.svg b/assets/icons/ghost.svg deleted file mode 100644 index de5e27c..0000000 --- a/assets/icons/ghost.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M5 20V10.5a7 7 0 0 1 14 0V20l-2.3-1.6-2.4 1.6-2.3-1.6-2.3 1.6-2.4-1.6z" /><circle cx="9.5" cy="10.5" r="1" fill="currentColor" stroke="none" /><circle cx="14.5" cy="10.5" r="1" fill="currentColor" stroke="none" /></svg> \ No newline at end of file diff --git a/assets/icons/git-commit.svg b/assets/icons/git-commit.svg deleted file mode 100644 index 0bdb3a6..0000000 --- a/assets/icons/git-commit.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3.5" /><path d="M3 12h5.5M15.5 12H21" /></svg> \ No newline at end of file diff --git a/assets/icons/globe.svg b/assets/icons/globe.svg deleted file mode 100644 index 5269155..0000000 --- a/assets/icons/globe.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="9" /><path d="M3 12h18M12 3c2.5 2.6 3.8 5.6 3.8 9s-1.3 6.4-3.8 9c-2.5-2.6-3.8-5.6-3.8-9S9.5 5.6 12 3z" /></svg> \ No newline at end of file diff --git a/assets/icons/graduation.svg b/assets/icons/graduation.svg deleted file mode 100644 index a435b7e..0000000 --- a/assets/icons/graduation.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 5.25 21 9.5l-9 4.25L3 9.5zM6.5 11.15V16c0 1.4 2.5 3 5.5 3s5.5-1.6 5.5-3v-4.85M21 9.5v5" /></svg> \ No newline at end of file diff --git a/assets/icons/heart.svg b/assets/icons/heart.svg deleted file mode 100644 index 543b0cb..0000000 --- a/assets/icons/heart.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 19.75C7 16.55 3.5 13.45 3.5 9.05 3.5 6.35 5.6 4.25 8.2 4.25c1.6 0 2.9.8 3.8 2 .9-1.2 2.2-2 3.8-2 2.6 0 4.7 2.1 4.7 4.8 0 4.4-3.5 7.5-8.5 10.7z" /></svg> \ No newline at end of file diff --git a/assets/icons/image-icon.svg b/assets/icons/image-icon.svg deleted file mode 100644 index f10040c..0000000 --- a/assets/icons/image-icon.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4.5" width="18" height="15" rx="3" /><circle cx="8.5" cy="9.5" r="1.5" /><path d="m21 15.5-4.2-4.2a1.5 1.5 0 0 0-2.1 0L5.5 19.5" /></svg> \ No newline at end of file diff --git a/assets/icons/info.svg b/assets/icons/info.svg deleted file mode 100644 index 3f9c8c8..0000000 --- a/assets/icons/info.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="9" /><path d="M12 11v5.5" /><circle cx="12" cy="7.75" r="1" fill="currentColor" stroke="none" /></svg> \ No newline at end of file diff --git a/assets/icons/isolated.svg b/assets/icons/isolated.svg deleted file mode 100644 index e311032..0000000 --- a/assets/icons/isolated.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M7.5 7.5V6A2 2 0 0 1 9.5 4h2.4l1.4 1.4h5.2a2 2 0 0 1 2 2V14a2 2 0 0 1-2 2H17" /><path d="M3.5 10.5a2 2 0 0 1 2-2h2.4l1.4 1.4h5.2a2 2 0 0 1 2 2V18a2 2 0 0 1-2 2h-9a2 2 0 0 1-2-2z" /></svg> \ No newline at end of file diff --git a/assets/icons/keyboard.svg b/assets/icons/keyboard.svg deleted file mode 100644 index 72ec14f..0000000 --- a/assets/icons/keyboard.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="5" width="18" height="14" rx="3" /><path d="M7 9h.01M9.5 9h.01M12 9h.01M14.5 9h.01M17 9h.01M7 12h.01M9.5 12h.01M12 12h.01M14.5 12h.01M17 12h.01M8.5 15h7" /></svg> \ No newline at end of file diff --git a/assets/icons/laptop.svg b/assets/icons/laptop.svg deleted file mode 100644 index 77af17a..0000000 --- a/assets/icons/laptop.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="5" y="5.5" width="14" height="10" rx="2.5" /><path d="M3 18.5h18" /></svg> \ No newline at end of file diff --git a/assets/icons/link.svg b/assets/icons/link.svg deleted file mode 100644 index a666a5e..0000000 --- a/assets/icons/link.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1.2 1.2M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1.2-1.2" /></svg> \ No newline at end of file diff --git a/assets/icons/list-checks.svg b/assets/icons/list-checks.svg deleted file mode 100644 index c801356..0000000 --- a/assets/icons/list-checks.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m3.5 7 1.75 1.75L8.5 5.5M3.5 17l1.75 1.75 3.25-3.25M12 7h8.5M12 12h8.5M12 17h8.5" /></svg> \ No newline at end of file diff --git a/assets/icons/llama-cpp.svg b/assets/icons/llama-cpp.svg deleted file mode 100644 index d036b22..0000000 --- a/assets/icons/llama-cpp.svg +++ /dev/null @@ -1,7 +0,0 @@ -<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg"> - <path d="M244.95 8C215.233 8 187.774 23.8591 172.923 49.5999L95.6009 183.625C60.2162 244.959 104.481 321.6 175.29 321.6H208L316.977 132.708C348.959 77.2719 308.95 8 244.95 8ZM208 321.6H351.947C415.982 321.6 456.013 390.91 424.013 446.377C409.155 472.132 381.681 488 351.947 488H271.29C200.481 488 156.216 411.359 191.601 350.026L208 321.6Z" fill="currentColor"/> - <path d="M208 321.6H16L106.462 164.8L208 321.6Z" fill="currentColor"/> - <path d="M388.923 8L208 321.6L253.6 8H388.923Z" fill="currentColor"/> - <path d="M304 488H112L202.462 331.2L304 488Z" fill="currentColor"/> - <path d="M496 321.6H208L419.399 454.4L496 321.6Z" fill="currentColor"/> -</svg> \ No newline at end of file diff --git a/assets/icons/loader.svg b/assets/icons/loader.svg deleted file mode 100644 index c8c4c9c..0000000 --- a/assets/icons/loader.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3.5a8.5 8.5 0 1 0 8.5 8.5" /></svg> \ No newline at end of file diff --git a/assets/icons/logout.svg b/assets/icons/logout.svg deleted file mode 100644 index 3e254b3..0000000 --- a/assets/icons/logout.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M9.5 20.5H6A2.5 2.5 0 0 1 3.5 18V6A2.5 2.5 0 0 1 6 3.5h3.5M16 16.5l4.5-4.5L16 7.5M20.5 12H10" /></svg> \ No newline at end of file diff --git a/assets/icons/menu.svg b/assets/icons/menu.svg deleted file mode 100644 index 2844960..0000000 --- a/assets/icons/menu.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M4 6.5h16M4 12h11M4 17.5h16" /></svg> \ No newline at end of file diff --git a/assets/icons/mic.svg b/assets/icons/mic.svg deleted file mode 100644 index bf88196..0000000 --- a/assets/icons/mic.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="3" width="6" height="11" rx="3" /><path d="M5.5 11a6.5 6.5 0 0 0 13 0M12 17.5V21" /></svg> \ No newline at end of file diff --git a/assets/icons/minus.svg b/assets/icons/minus.svg deleted file mode 100644 index 92341d3..0000000 --- a/assets/icons/minus.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14" /></svg> \ No newline at end of file diff --git a/assets/icons/model-docs.svg b/assets/icons/model-docs.svg deleted file mode 100644 index 4e74a63..0000000 --- a/assets/icons/model-docs.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 6c-1.5-1.3-3.4-2-5.7-2-1.1 0-2 .1-2.8.4v14.4c.8-.3 1.7-.4 2.8-.4 2.3 0 4.2.7 5.7 2" /><path d="M12 6c1.5-1.3 3.4-2 5.7-2 1.1 0 2 .1 2.8.4v14.4c-.8-.3-1.7-.4-2.8-.4-2.3 0-4.2.7-5.7 2" /><path d="M12 6v14.4" /></svg> \ No newline at end of file diff --git a/assets/icons/palette.svg b/assets/icons/palette.svg deleted file mode 100644 index 38f276f..0000000 --- a/assets/icons/palette.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3.5a8.5 8.5 0 1 0 0 17c1.1 0 1.8-.8 1.8-1.7 0-.4-.2-.8-.4-1.1a1.6 1.6 0 0 1 1.2-2.7h2a3.9 3.9 0 0 0 3.9-3.9C20.5 7 16.7 3.5 12 3.5z" /><circle cx="7.75" cy="11.5" r="1" fill="currentColor" stroke="none" /><circle cx="10.5" cy="7.75" r="1" fill="currentColor" stroke="none" /><circle cx="15" cy="7.75" r="1" fill="currentColor" stroke="none" /></svg> \ No newline at end of file diff --git a/assets/icons/panel-right.svg b/assets/icons/panel-right.svg deleted file mode 100644 index fa00bbb..0000000 --- a/assets/icons/panel-right.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4.5" width="18" height="15" rx="3" /><path d="M14.5 4.5v15" /></svg> \ No newline at end of file diff --git a/assets/icons/panel.svg b/assets/icons/panel.svg deleted file mode 100644 index 4e78779..0000000 --- a/assets/icons/panel.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4.5" width="18" height="15" rx="3" /><path d="M9.5 4.5v15" /></svg> \ No newline at end of file diff --git a/assets/icons/paper.svg b/assets/icons/paper.svg deleted file mode 100644 index 90d65d9..0000000 --- a/assets/icons/paper.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M14 3H7.5A2.5 2.5 0 0 0 5 5.5v13A2.5 2.5 0 0 0 7.5 21h9a2.5 2.5 0 0 0 2.5-2.5V8zM14 3v3.5A1.5 1.5 0 0 0 15.5 8H19" /></svg> \ No newline at end of file diff --git a/assets/icons/paperclip.svg b/assets/icons/paperclip.svg deleted file mode 100644 index d3b603c..0000000 --- a/assets/icons/paperclip.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m19.5 11.5-7.6 7.6a4.6 4.6 0 0 1-6.5-6.5l8-8a3.1 3.1 0 0 1 4.4 4.4l-8 8a1.5 1.5 0 0 1-2.2-2.2l7.4-7.4" /></svg> \ No newline at end of file diff --git a/assets/icons/pencil.svg b/assets/icons/pencil.svg deleted file mode 100644 index eeb799a..0000000 --- a/assets/icons/pencil.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M4 20v-3.5L15.6 4.9a2 2 0 0 1 2.8 0l.7.7a2 2 0 0 1 0 2.8L7.5 20zM13.5 7l3.5 3.5" /></svg> \ No newline at end of file diff --git a/assets/icons/pin-off.svg b/assets/icons/pin-off.svg deleted file mode 100644 index b0b4b12..0000000 --- a/assets/icons/pin-off.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M9 3.5h6M10 3.5v5.2l-3 3.3v1.5h10V12l-3-3.3V3.5M12 13.5v7" /><path d="m4 4 16 16" /></svg> \ No newline at end of file diff --git a/assets/icons/pin.svg b/assets/icons/pin.svg deleted file mode 100644 index 0dd66af..0000000 --- a/assets/icons/pin.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M9 3.5h6M10 3.5v5.2l-3 3.3v1.5h10V12l-3-3.3V3.5M12 13.5v7" /></svg> \ No newline at end of file diff --git a/assets/icons/plug.svg b/assets/icons/plug.svg deleted file mode 100644 index 7714af8..0000000 --- a/assets/icons/plug.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M9 3.5V8M15 3.5V8M6.5 8h11v3a5.5 5.5 0 0 1-11 0zM12 16.5v4" /></svg> \ No newline at end of file diff --git a/assets/icons/plus.svg b/assets/icons/plus.svg deleted file mode 100644 index b906ac0..0000000 --- a/assets/icons/plus.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 5v14M5 12h14" /></svg> \ No newline at end of file diff --git a/assets/icons/pull-request.svg b/assets/icons/pull-request.svg deleted file mode 100644 index 3fab037..0000000 --- a/assets/icons/pull-request.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="6.5" cy="5.5" r="2" /><circle cx="6.5" cy="18.5" r="2" /><circle cx="17.5" cy="18.5" r="2" /><path d="M6.5 7.5v9M17.5 16.5v-7a3 3 0 0 0-3-3H11M13 4.5l-2 2 2 2" /></svg> \ No newline at end of file diff --git a/assets/icons/quick-task.svg b/assets/icons/quick-task.svg deleted file mode 100644 index cc535d2..0000000 --- a/assets/icons/quick-task.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M13 3 5.5 13.5H12l-1 7.5 7.5-10.5H12z" /></svg> \ No newline at end of file diff --git a/assets/icons/refresh.svg b/assets/icons/refresh.svg deleted file mode 100644 index 859f1aa..0000000 --- a/assets/icons/refresh.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3.5 12a8.5 8.5 0 0 1 14.9-5.6l2.1 2.1M20.5 4v4.5H16M20.5 12a8.5 8.5 0 0 1-14.9 5.6l-2.1-2.1M3.5 20v-4.5H8" /></svg> \ No newline at end of file diff --git a/assets/icons/retry.svg b/assets/icons/retry.svg deleted file mode 100644 index 29d027a..0000000 --- a/assets/icons/retry.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M20.5 12a8.5 8.5 0 1 1-2.6-6.1l2.6 2.6M20.5 4v4.5H16" /></svg> \ No newline at end of file diff --git a/assets/icons/screenshot.svg b/assets/icons/screenshot.svg deleted file mode 100644 index 2de5439..0000000 --- a/assets/icons/screenshot.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="6.25" width="18" height="13.5" rx="3" /><path d="m8.5 6.25 1.2-2h4.6l1.2 2" /><circle cx="12" cy="13" r="3.25" /></svg> \ No newline at end of file diff --git a/assets/icons/search.svg b/assets/icons/search.svg deleted file mode 100644 index 7982e14..0000000 --- a/assets/icons/search.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="10.25" cy="10.25" r="6.5" /><path d="m14.85 14.85 5.4 5.4" /></svg> \ No newline at end of file diff --git a/assets/icons/send.svg b/assets/icons/send.svg deleted file mode 100644 index 9acce17..0000000 --- a/assets/icons/send.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M20.5 3.5 10.5 13.5M20.5 3.5l-6 17-4-7-7-4z" /></svg> \ No newline at end of file diff --git a/assets/icons/server.svg b/assets/icons/server.svg deleted file mode 100644 index 128b035..0000000 --- a/assets/icons/server.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="3.5" y="4" width="17" height="7" rx="2.5" /><rect x="3.5" y="13" width="17" height="7" rx="2.5" /><path d="M7.5 7.5h.01M7.5 16.5h.01M12 7.5h4.5M12 16.5h4.5" /></svg> \ No newline at end of file diff --git a/assets/icons/shield.svg b/assets/icons/shield.svg deleted file mode 100644 index 17e69b8..0000000 --- a/assets/icons/shield.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3l7 2.8v5.7c0 4.6-2.9 8-7 9.5-4.1-1.5-7-4.9-7-9.5V5.8z" /></svg> \ No newline at end of file diff --git a/assets/icons/skill-icon.svg b/assets/icons/skill-icon.svg deleted file mode 100644 index 9f28544..0000000 --- a/assets/icons/skill-icon.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4.5" width="18" height="15" rx="3" /><path d="M7 9h7" /><path d="M7 12h10" /><path d="M7 15h5" /></svg> \ No newline at end of file diff --git a/assets/icons/slash.svg b/assets/icons/slash.svg deleted file mode 100644 index 3da8691..0000000 --- a/assets/icons/slash.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M15 4 9 20" /></svg> \ No newline at end of file diff --git a/assets/icons/sliders.svg b/assets/icons/sliders.svg deleted file mode 100644 index eb3d496..0000000 --- a/assets/icons/sliders.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M4 7.5h9M17 7.5h3M4 16.5h3M11 16.5h9" /><circle cx="15" cy="7.5" r="2" /><circle cx="9" cy="16.5" r="2" /></svg> \ No newline at end of file diff --git a/assets/icons/sparkles.svg b/assets/icons/sparkles.svg deleted file mode 100644 index 5b8ca44..0000000 --- a/assets/icons/sparkles.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M11 4l1.7 4.6a2 2 0 0 0 1.2 1.2l4.6 1.7-4.6 1.7a2 2 0 0 0-1.2 1.2L11 19l-1.7-4.6a2 2 0 0 0-1.2-1.2L3.5 11.5l4.6-1.7a2 2 0 0 0 1.2-1.2zM18.5 16l.6 1.4 1.4.6-1.4.6-.6 1.4-.6-1.4-1.4-.6 1.4-.6z" /></svg> \ No newline at end of file diff --git a/assets/icons/speaker-off.svg b/assets/icons/speaker-off.svg deleted file mode 100644 index 33744e7..0000000 --- a/assets/icons/speaker-off.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M11 5.5 7 9H4a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1h3l4 3.5z" /><path d="m16 9.5 5 5M21 9.5l-5 5" /></svg> \ No newline at end of file diff --git a/assets/icons/speaker.svg b/assets/icons/speaker.svg deleted file mode 100644 index dd1ade9..0000000 --- a/assets/icons/speaker.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M11 5.5 7 9H4a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1h3l4 3.5z" /><path d="M15.5 9a4.2 4.2 0 0 1 0 6M18.5 6.5a7.8 7.8 0 0 1 0 11" /></svg> \ No newline at end of file diff --git a/assets/icons/star.svg b/assets/icons/star.svg deleted file mode 100644 index fb59770..0000000 --- a/assets/icons/star.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3.9l2.6 5.3 5.9.9-4.25 4.1 1 5.85L12 17.3l-5.25 2.75 1-5.85L3.5 10.1l5.9-.9z" /></svg> \ No newline at end of file diff --git a/assets/icons/steer.svg b/assets/icons/steer.svg deleted file mode 100644 index 4f2e61d..0000000 --- a/assets/icons/steer.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3" /><path d="M12 3.5v5M12 15.5v5M3.5 12h5M15.5 12h5" /></svg> \ No newline at end of file diff --git a/assets/icons/stop.svg b/assets/icons/stop.svg deleted file mode 100644 index 47da2ec..0000000 --- a/assets/icons/stop.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><rect x="6.5" y="6.5" width="11" height="11" rx="2.5" /></svg> \ No newline at end of file diff --git a/assets/icons/sun.svg b/assets/icons/sun.svg deleted file mode 100644 index 992a3e1..0000000 --- a/assets/icons/sun.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3.8" /><path d="M18.5 12h2M16.6 16.6l1.41 1.41M12 18.5v2M7.4 16.6l-1.41 1.41M5.5 12h-2M7.4 7.4 5.99 5.99M12 5.5v-2M16.6 7.4l1.41-1.41" /></svg> \ No newline at end of file diff --git a/assets/icons/telescope.svg b/assets/icons/telescope.svg deleted file mode 100644 index 0540c4a..0000000 --- a/assets/icons/telescope.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="10.25" cy="10.25" r="6.5" /><path d="m14.85 14.85 5.4 5.4M6.96 9.05A3.5 3.5 0 0 1 9.05 6.96" /></svg> \ No newline at end of file diff --git a/assets/icons/terminal.svg b/assets/icons/terminal.svg deleted file mode 100644 index b3cc749..0000000 --- a/assets/icons/terminal.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4.5" width="18" height="15" rx="3" /><path d="m7.5 9.5 2.5 2.5-2.5 2.5M12.5 14.5h4" /></svg> \ No newline at end of file diff --git a/assets/icons/text-icon.svg b/assets/icons/text-icon.svg deleted file mode 100644 index 81b0e66..0000000 --- a/assets/icons/text-icon.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M5 7V5h14v2M12 5v14M9.5 19h5" /></svg> \ No newline at end of file diff --git a/assets/icons/thumb-down.svg b/assets/icons/thumb-down.svg deleted file mode 100644 index cc1cab4..0000000 --- a/assets/icons/thumb-down.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M7 10.5v10H4.5A1.5 1.5 0 0 1 3 19v-7a1.5 1.5 0 0 1 1.5-1.5zM7 10.5l3.6-6.8a1.6 1.6 0 0 1 2.9.9V9h5.2a2 2 0 0 1 2 2.4l-1.4 7.2a2.4 2.4 0 0 1-2.4 1.9H7" transform="rotate(180 12 12)" /></svg> \ No newline at end of file diff --git a/assets/icons/thumb-up.svg b/assets/icons/thumb-up.svg deleted file mode 100644 index 05bc87a..0000000 --- a/assets/icons/thumb-up.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M7 10.5v10H4.5A1.5 1.5 0 0 1 3 19v-7a1.5 1.5 0 0 1 1.5-1.5zM7 10.5l3.6-6.8a1.6 1.6 0 0 1 2.9.9V9h5.2a2 2 0 0 1 2 2.4l-1.4 7.2a2.4 2.4 0 0 1-2.4 1.9H7" /></svg> \ No newline at end of file diff --git a/assets/icons/trash.svg b/assets/icons/trash.svg deleted file mode 100644 index 99426e6..0000000 --- a/assets/icons/trash.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M4 6.5h16M9.5 6.5V4.8c0-.7.6-1.3 1.3-1.3h2.4c.7 0 1.3.6 1.3 1.3v1.7M18 6.5l-.8 12.3A2.2 2.2 0 0 1 15 21H9a2.2 2.2 0 0 1-2.2-2.2L6 6.5M10 10.5v6M14 10.5v6" /></svg> \ No newline at end of file diff --git a/assets/icons/unlink.svg b/assets/icons/unlink.svg deleted file mode 100644 index 089c1d3..0000000 --- a/assets/icons/unlink.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M16.6 13.1l2.1-2.1a4 4 0 0 0-5.7-5.7l-1.2 1.2M7.4 10.9l-2.1 2.1a4 4 0 0 0 5.7 5.7l1.2-1.2M4 4l16 16" /></svg> \ No newline at end of file diff --git a/assets/icons/up.svg b/assets/icons/up.svg deleted file mode 100644 index d838eaa..0000000 --- a/assets/icons/up.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 19V5M6 11l6-6 6 6" /></svg> \ No newline at end of file diff --git a/assets/icons/upload.svg b/assets/icons/upload.svg deleted file mode 100644 index 133109b..0000000 --- a/assets/icons/upload.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20.5V9M7.5 13.5 12 9l4.5 4.5M5 3.5h14" /></svg> \ No newline at end of file diff --git a/assets/icons/users.svg b/assets/icons/users.svg deleted file mode 100644 index a2cec93..0000000 --- a/assets/icons/users.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="9" cy="7.75" r="3.5" /><path d="M3 19.75v-.8a4.7 4.7 0 0 1 4.7-4.7h2.6a4.7 4.7 0 0 1 4.7 4.7v.8M15.5 4.45a3.5 3.5 0 0 1 0 6.6M17.5 14.35a4.7 4.7 0 0 1 3.5 4.6v.8" /></svg> \ No newline at end of file diff --git a/assets/icons/wand.svg b/assets/icons/wand.svg deleted file mode 100644 index 5fdceb6..0000000 --- a/assets/icons/wand.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3.75 20.25 14 10M10.5 3.75v2.5M9.25 5h2.5M18 4.5v3M16.5 6h3M19 12.25v2.5M17.75 13.5h2.5" /></svg> \ No newline at end of file diff --git a/assets/icons/wave.svg b/assets/icons/wave.svg deleted file mode 100644 index f91459e..0000000 --- a/assets/icons/wave.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><rect x="3.1" y="9" width="1.8" height="6" rx=".9" /><rect x="7.1" y="6" width="1.8" height="12" rx=".9" /><rect x="11.1" y="4" width="1.8" height="16" rx=".9" /><rect x="15.1" y="7" width="1.8" height="10" rx=".9" /><rect x="19.1" y="10" width="1.8" height="4" rx=".9" /></svg> \ No newline at end of file diff --git a/assets/icons/wrench.svg b/assets/icons/wrench.svg deleted file mode 100644 index dbb2858..0000000 --- a/assets/icons/wrench.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path transform="rotate(45 12 12)" d="M10.25 19.25v-8A4.5 4.5 0 0 1 10.5 2.85V6h3V2.85a4.5 4.5 0 0 1 .25 8.4v8a1.75 1.75 0 0 1-3.5 0z" /></svg> \ No newline at end of file diff --git a/assets/icons/x.svg b/assets/icons/x.svg deleted file mode 100644 index f0df416..0000000 --- a/assets/icons/x.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M6 6l12 12M18 6 6 18" /></svg> \ No newline at end of file diff --git a/assets/brand/app-icon.svg b/brand/app-icon.svg similarity index 99% rename from assets/brand/app-icon.svg rename to brand/app-icon.svg index 2030015..47732e2 100644 --- a/assets/brand/app-icon.svg +++ b/brand/app-icon.svg @@ -1 +1 @@ -<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 1024 1024"><defs><linearGradient id="idarksquircle-g" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#232220"/><stop offset="1" stop-color="#111110"/></linearGradient></defs><path d="M1024 512L1023.94 628.21L1023.75 665.32L1023.44 692.28L1023.01 714.2L1022.46 733L1021.78 749.62L1020.97 764.6L1020.04 778.3L1018.99 790.95L1017.81 802.74L1016.5 813.78L1015.06 824.18L1013.5 834.01L1011.81 843.33L1009.99 852.2L1008.04 860.66L1005.96 868.74L1003.74 876.47L1001.39 883.88L998.9 890.99L996.28 897.81L993.52 904.36L990.61 910.67L987.56 916.73L984.37 922.56L981.03 928.18L977.54 933.59L973.9 938.79L970.1 943.8L966.14 948.62L962.01 953.26L957.72 957.72L953.26 962.01L948.62 966.14L943.8 970.1L938.79 973.9L933.59 977.54L928.18 981.03L922.56 984.37L916.73 987.56L910.67 990.61L904.36 993.52L897.81 996.28L890.99 998.9L883.88 1001.39L876.47 1003.74L868.74 1005.96L860.66 1008.04L852.2 1009.99L843.33 1011.81L834.01 1013.5L824.18 1015.06L813.78 1016.5L802.74 1017.81L790.95 1018.99L778.3 1020.04L764.6 1020.97L749.62 1021.78L733 1022.46L714.2 1023.01L692.28 1023.44L665.32 1023.75L628.21 1023.94L512 1024L395.79 1023.94L358.68 1023.75L331.72 1023.44L309.8 1023.01L291 1022.46L274.38 1021.78L259.4 1020.97L245.7 1020.04L233.05 1018.99L221.26 1017.81L210.22 1016.5L199.82 1015.06L189.99 1013.5L180.67 1011.81L171.8 1009.99L163.34 1008.04L155.26 1005.96L147.53 1003.74L140.12 1001.39L133.01 998.9L126.19 996.28L119.64 993.52L113.33 990.61L107.27 987.56L101.44 984.37L95.82 981.03L90.41 977.54L85.21 973.9L80.2 970.1L75.38 966.14L70.74 962.01L66.28 957.72L61.99 953.26L57.86 948.62L53.9 943.8L50.1 938.79L46.46 933.59L42.97 928.18L39.63 922.56L36.44 916.73L33.39 910.67L30.48 904.36L27.72 897.81L25.1 890.99L22.61 883.88L20.26 876.47L18.04 868.74L15.96 860.66L14.01 852.2L12.19 843.33L10.5 834.01L8.94 824.18L7.5 813.78L6.19 802.74L5.01 790.95L3.96 778.3L3.03 764.6L2.22 749.62L1.54 733L0.99 714.2L0.56 692.28L0.25 665.32L0.06 628.21L0 512L0.06 395.79L0.25 358.68L0.56 331.72L0.99 309.8L1.54 291L2.22 274.38L3.03 259.4L3.96 245.7L5.01 233.05L6.19 221.26L7.5 210.22L8.94 199.82L10.5 189.99L12.19 180.67L14.01 171.8L15.96 163.34L18.04 155.26L20.26 147.53L22.61 140.12L25.1 133.01L27.72 126.19L30.48 119.64L33.39 113.33L36.44 107.27L39.63 101.44L42.97 95.82L46.46 90.41L50.1 85.21L53.9 80.2L57.86 75.38L61.99 70.74L66.28 66.28L70.74 61.99L75.38 57.86L80.2 53.9L85.21 50.1L90.41 46.46L95.82 42.97L101.44 39.63L107.27 36.44L113.33 33.39L119.64 30.48L126.19 27.72L133.01 25.1L140.12 22.61L147.53 20.26L155.26 18.04L163.34 15.96L171.8 14.01L180.67 12.19L189.99 10.5L199.82 8.94L210.22 7.5L221.26 6.19L233.05 5.01L245.7 3.96L259.4 3.03L274.38 2.22L291 1.54L309.8 0.99L331.72 0.56L358.68 0.25L395.79 0.06L512 0L628.21 0.06L665.32 0.25L692.28 0.56L714.2 0.99L733 1.54L749.62 2.22L764.6 3.03L778.3 3.96L790.95 5.01L802.74 6.19L813.78 7.5L824.18 8.94L834.01 10.5L843.33 12.19L852.2 14.01L860.66 15.96L868.74 18.04L876.47 20.26L883.88 22.61L890.99 25.1L897.81 27.72L904.36 30.48L910.67 33.39L916.73 36.44L922.56 39.63L928.18 42.97L933.59 46.46L938.79 50.1L943.8 53.9L948.62 57.86L953.26 61.99L957.72 66.28L962.01 70.74L966.14 75.38L970.1 80.2L973.9 85.21L977.54 90.41L981.03 95.82L984.37 101.44L987.56 107.27L990.61 113.33L993.52 119.64L996.28 126.19L998.9 133.01L1001.39 140.12L1003.74 147.53L1005.96 155.26L1008.04 163.34L1009.99 171.8L1011.81 180.67L1013.5 189.99L1015.06 199.82L1016.5 210.22L1017.81 221.26L1018.99 233.05L1020.04 245.7L1020.97 259.4L1021.78 274.38L1022.46 291L1023.01 309.8L1023.44 331.72L1023.75 358.68L1023.94 395.79Z" fill="url(#idarksquircle-g)"/><path d="M1022.5 512L1022.44 627.87L1022.25 664.87L1021.95 691.75L1021.52 713.61L1020.96 732.36L1020.28 748.92L1019.48 763.86L1018.55 777.52L1017.5 790.13L1016.32 801.88L1015.02 812.89L1013.59 823.26L1012.03 833.06L1010.35 842.36L1008.53 851.21L1006.59 859.64L1004.51 867.7L1002.3 875.41L999.96 882.79L997.48 889.88L994.86 896.68L992.1 903.22L989.21 909.5L986.17 915.54L982.99 921.36L979.66 926.96L976.18 932.35L972.54 937.54L968.75 942.53L964.81 947.34L960.69 951.97L956.42 956.42L951.97 960.69L947.34 964.81L942.53 968.75L937.54 972.54L932.35 976.18L926.96 979.66L921.36 982.99L915.54 986.17L909.5 989.21L903.22 992.1L896.68 994.86L889.88 997.48L882.79 999.96L875.41 1002.3L867.7 1004.51L859.64 1006.59L851.21 1008.53L842.36 1010.35L833.06 1012.03L823.26 1013.59L812.89 1015.02L801.88 1016.32L790.13 1017.5L777.52 1018.55L763.86 1019.48L748.92 1020.28L732.36 1020.96L713.61 1021.52L691.75 1021.95L664.87 1022.25L627.87 1022.44L512 1022.5L396.13 1022.44L359.13 1022.25L332.25 1021.95L310.39 1021.52L291.64 1020.96L275.08 1020.28L260.14 1019.48L246.48 1018.55L233.87 1017.5L222.12 1016.32L211.11 1015.02L200.74 1013.59L190.94 1012.03L181.64 1010.35L172.79 1008.53L164.36 1006.59L156.3 1004.51L148.59 1002.3L141.21 999.96L134.12 997.48L127.32 994.86L120.78 992.1L114.5 989.21L108.46 986.17L102.64 982.99L97.04 979.66L91.65 976.18L86.46 972.54L81.47 968.75L76.66 964.81L72.03 960.69L67.58 956.42L63.31 951.97L59.19 947.34L55.25 942.53L51.46 937.54L47.82 932.35L44.34 926.96L41.01 921.36L37.83 915.54L34.79 909.5L31.9 903.22L29.14 896.68L26.52 889.88L24.04 882.79L21.7 875.41L19.49 867.7L17.41 859.64L15.47 851.21L13.65 842.36L11.97 833.06L10.41 823.26L8.98 812.89L7.68 801.88L6.5 790.13L5.45 777.52L4.52 763.86L3.72 748.92L3.04 732.36L2.48 713.61L2.05 691.75L1.75 664.87L1.56 627.87L1.5 512L1.56 396.13L1.75 359.13L2.05 332.25L2.48 310.39L3.04 291.64L3.72 275.08L4.52 260.14L5.45 246.48L6.5 233.87L7.68 222.12L8.98 211.11L10.41 200.74L11.97 190.94L13.65 181.64L15.47 172.79L17.41 164.36L19.49 156.3L21.7 148.59L24.04 141.21L26.52 134.12L29.14 127.32L31.9 120.78L34.79 114.5L37.83 108.46L41.01 102.64L44.34 97.04L47.82 91.65L51.46 86.46L55.25 81.47L59.19 76.66L63.31 72.03L67.58 67.58L72.03 63.31L76.66 59.19L81.47 55.25L86.46 51.46L91.65 47.82L97.04 44.34L102.64 41.01L108.46 37.83L114.5 34.79L120.78 31.9L127.32 29.14L134.12 26.52L141.21 24.04L148.59 21.7L156.3 19.49L164.36 17.41L172.79 15.47L181.64 13.65L190.94 11.97L200.74 10.41L211.11 8.98L222.12 7.68L233.87 6.5L246.48 5.45L260.14 4.52L275.08 3.72L291.64 3.04L310.39 2.48L332.25 2.05L359.13 1.75L396.13 1.56L512 1.5L627.87 1.56L664.87 1.75L691.75 2.05L713.61 2.48L732.36 3.04L748.92 3.72L763.86 4.52L777.52 5.45L790.13 6.5L801.88 7.68L812.89 8.98L823.26 10.41L833.06 11.97L842.36 13.65L851.21 15.47L859.64 17.41L867.7 19.49L875.41 21.7L882.79 24.04L889.88 26.52L896.68 29.14L903.22 31.9L909.5 34.79L915.54 37.83L921.36 41.01L926.96 44.34L932.35 47.82L937.54 51.46L942.53 55.25L947.34 59.19L951.97 63.31L956.42 67.58L960.69 72.03L964.81 76.66L968.75 81.47L972.54 86.46L976.18 91.65L979.66 97.04L982.99 102.64L986.17 108.46L989.21 114.5L992.1 120.78L994.86 127.32L997.48 134.12L999.96 141.21L1002.3 148.59L1004.51 156.3L1006.59 164.36L1008.53 172.79L1010.35 181.64L1012.03 190.94L1013.59 200.74L1015.02 211.11L1016.32 222.12L1017.5 233.87L1018.55 246.48L1019.48 260.14L1020.28 275.08L1020.96 291.64L1021.52 310.39L1021.95 332.25L1022.25 359.13L1022.44 396.13Z" fill="none" stroke="rgba(255,255,255,0.07)" stroke-width="3"/><g fill="#f2f1ec"><circle cx="423.37" cy="460.06" r="10.83" fill-opacity="0.062"/><circle cx="508.62" cy="598.58" r="10.98" fill-opacity="0.052"/><circle cx="366.38" cy="589.34" r="11.48" fill-opacity="0.135"/><circle cx="695.11" cy="580.03" r="11.43" fill-opacity="0.057"/><circle cx="407.04" cy="611.77" r="11.57" fill-opacity="0.06"/><circle cx="504.03" cy="607.53" r="11.58" fill-opacity="0.083"/><circle cx="552" cy="538.89" r="13.67" fill-opacity="0.255"/><circle cx="463.04" cy="506.95" r="14.01" fill-opacity="0.27"/><circle cx="505.48" cy="452.91" r="12.01" fill-opacity="0.064"/><circle cx="589.05" cy="475.06" r="12.14" fill-opacity="0.13"/><circle cx="492.8" cy="572.55" r="12.19" fill-opacity="0.069"/><circle cx="479.49" cy="425.99" r="15.14" fill-opacity="0.319"/><circle cx="633.91" cy="596.63" r="14.62" fill-opacity="0.295"/><circle cx="735.26" cy="566.25" r="12.26" fill-opacity="0.076"/><circle cx="661.55" cy="483.4" r="12.28" fill-opacity="0.068"/><circle cx="591.77" cy="553.74" r="12.31" fill-opacity="0.068"/><circle cx="574.61" cy="459.6" r="12.33" fill-opacity="0.079"/><circle cx="431.16" cy="593.73" r="13.13" fill-opacity="0.209"/><circle cx="653.75" cy="650.36" r="12.42" fill-opacity="0.069"/><circle cx="388.04" cy="653.71" r="12.46" fill-opacity="0.075"/><circle cx="376.77" cy="577.51" r="17.71" fill-opacity="0.433"/><circle cx="686.46" cy="489.86" r="12.55" fill-opacity="0.101"/><circle cx="670.46" cy="489.71" r="12.94" fill-opacity="0.185"/><circle cx="717.09" cy="581.79" r="13.99" fill-opacity="0.254"/><circle cx="308" cy="380.93" r="16.94" fill-opacity="0.393"/><circle cx="354.48" cy="562.18" r="12.8" fill-opacity="0.077"/><circle cx="498.3" cy="485.94" r="12.82" fill-opacity="0.074"/><circle cx="474.65" cy="338.71" r="12.91" fill-opacity="0.076"/><circle cx="667.23" cy="645.41" r="14.3" fill-opacity="0.263"/><circle cx="406.24" cy="323.72" r="13" fill-opacity="0.082"/><circle cx="643.77" cy="647.39" r="13.02" fill-opacity="0.078"/><circle cx="611.63" cy="493.97" r="13.03" fill-opacity="0.077"/><circle cx="319.67" cy="533.46" r="13.05" fill-opacity="0.077"/><circle cx="511.37" cy="299.66" r="13.11" fill-opacity="0.109"/><circle cx="752.03" cy="554.46" r="13.13" fill-opacity="0.079"/><circle cx="238.62" cy="542.78" r="18.86" fill-opacity="0.472"/><circle cx="359.41" cy="609.75" r="13.9" fill-opacity="0.232"/><circle cx="641.66" cy="361.15" r="13.2" fill-opacity="0.081"/><circle cx="558.4" cy="274.64" r="19.03" fill-opacity="0.479"/><circle cx="559.15" cy="652" r="13.33" fill-opacity="0.083"/><circle cx="461.77" cy="586.56" r="13.36" fill-opacity="0.082"/><circle cx="605.22" cy="554.43" r="13.69" fill-opacity="0.195"/><circle cx="313.54" cy="617.75" r="13.52" fill-opacity="0.084"/><circle cx="389.35" cy="517.26" r="13.52" fill-opacity="0.087"/><circle cx="452.73" cy="713.63" r="13.55" fill-opacity="0.085"/><circle cx="281.69" cy="599.49" r="13.55" fill-opacity="0.085"/><circle cx="416.04" cy="513.91" r="13.56" fill-opacity="0.093"/><circle cx="391.48" cy="683.91" r="13.62" fill-opacity="0.146"/><circle cx="577.31" cy="647.42" r="13.96" fill-opacity="0.215"/><circle cx="474.96" cy="271.03" r="13.75" fill-opacity="0.088"/><circle cx="557.22" cy="712.25" r="14.52" fill-opacity="0.255"/><circle cx="327.71" cy="626.39" r="13.77" fill-opacity="0.1"/><circle cx="558.53" cy="334.79" r="13.8" fill-opacity="0.139"/><circle cx="642.43" cy="310.23" r="13.79" fill-opacity="0.088"/><circle cx="301.03" cy="676.91" r="13.83" fill-opacity="0.096"/><circle cx="421.56" cy="578.57" r="13.86" fill-opacity="0.089"/><circle cx="415.13" cy="340.46" r="16.98" fill-opacity="0.382"/><circle cx="550.25" cy="663.61" r="20.83" fill-opacity="0.547"/><circle cx="616.73" cy="318.25" r="14.37" fill-opacity="0.232"/><circle cx="550.64" cy="649" r="17.94" fill-opacity="0.424"/><circle cx="655.59" cy="305.88" r="14.04" fill-opacity="0.112"/><circle cx="252.94" cy="331.03" r="14.07" fill-opacity="0.102"/><circle cx="554.52" cy="674.14" r="14.18" fill-opacity="0.183"/><circle cx="526.79" cy="661.09" r="21.2" fill-opacity="0.561"/><circle cx="607.85" cy="656.08" r="14.16" fill-opacity="0.094"/><circle cx="471.92" cy="597.64" r="14.2" fill-opacity="0.141"/><circle cx="402.12" cy="607.95" r="18.02" fill-opacity="0.426"/><circle cx="654.15" cy="319.64" r="14.26" fill-opacity="0.096"/><circle cx="405.12" cy="650.96" r="14.27" fill-opacity="0.095"/><circle cx="554.7" cy="704.22" r="14.3" fill-opacity="0.097"/><circle cx="430.44" cy="272.47" r="14.33" fill-opacity="0.096"/><circle cx="584.88" cy="261.03" r="17.62" fill-opacity="0.408"/><circle cx="701.16" cy="333.67" r="14.49" fill-opacity="0.209"/><circle cx="587.69" cy="355.24" r="15.67" fill-opacity="0.311"/><circle cx="663.04" cy="658.65" r="14.38" fill-opacity="0.111"/><circle cx="680.41" cy="717.18" r="14.39" fill-opacity="0.099"/><circle cx="746.5" cy="472.31" r="16.97" fill-opacity="0.378"/><circle cx="524.19" cy="303.11" r="14.73" fill-opacity="0.237"/><circle cx="543.21" cy="589.85" r="14.41" fill-opacity="0.132"/><circle cx="371.07" cy="563.03" r="14.41" fill-opacity="0.098"/><circle cx="347.28" cy="717.93" r="20.41" fill-opacity="0.526"/><circle cx="238.7" cy="538.66" r="14.45" fill-opacity="0.098"/><circle cx="367.75" cy="335.11" r="21.52" fill-opacity="0.571"/><circle cx="284.7" cy="521.47" r="14.93" fill-opacity="0.253"/><circle cx="288.1" cy="573.05" r="14.53" fill-opacity="0.101"/><circle cx="317.3" cy="638.25" r="14.53" fill-opacity="0.105"/><circle cx="705.57" cy="543.29" r="14.62" fill-opacity="0.193"/><circle cx="386.06" cy="584.61" r="14.67" fill-opacity="0.115"/><circle cx="647.58" cy="514.15" r="14.67" fill-opacity="0.115"/><circle cx="493.19" cy="320.37" r="14.72" fill-opacity="0.108"/><circle cx="283.02" cy="660.3" r="14.76" fill-opacity="0.107"/><circle cx="300.34" cy="386.01" r="15.17" fill-opacity="0.258"/><circle cx="279.84" cy="538.54" r="14.83" fill-opacity="0.114"/><circle cx="278.55" cy="432.69" r="15.3" fill-opacity="0.267"/><circle cx="712.14" cy="320.03" r="18.3" fill-opacity="0.435"/><circle cx="362.45" cy="739.72" r="19.32" fill-opacity="0.479"/><circle cx="306.57" cy="377.14" r="14.97" fill-opacity="0.128"/><circle cx="785.98" cy="334.65" r="16.17" fill-opacity="0.326"/><circle cx="340.05" cy="366.72" r="15.07" fill-opacity="0.199"/><circle cx="534.54" cy="666.64" r="15.13" fill-opacity="0.109"/><circle cx="528.51" cy="296.06" r="22.5" fill-opacity="0.608"/><circle cx="424.79" cy="675.03" r="15.45" fill-opacity="0.258"/><circle cx="628.07" cy="317.21" r="15.21" fill-opacity="0.153"/><circle cx="681.9" cy="702.4" r="15.21" fill-opacity="0.112"/><circle cx="563.59" cy="422.21" r="20.26" fill-opacity="0.518"/><circle cx="576.95" cy="683.75" r="15.27" fill-opacity="0.117"/><circle cx="567.76" cy="606.63" r="15.69" fill-opacity="0.273"/><circle cx="617.28" cy="370.42" r="15.34" fill-opacity="0.113"/><circle cx="416.57" cy="673.16" r="15.36" fill-opacity="0.114"/><circle cx="396.21" cy="393.8" r="15.5" fill-opacity="0.233"/><circle cx="737.48" cy="436" r="15.38" fill-opacity="0.113"/><circle cx="647.13" cy="237.38" r="15.69" fill-opacity="0.267"/><circle cx="286.27" cy="703.92" r="15.38" fill-opacity="0.113"/><circle cx="611.8" cy="696.01" r="16.69" fill-opacity="0.348"/><circle cx="536.56" cy="330.1" r="15.76" fill-opacity="0.265"/><circle cx="701.06" cy="570.76" r="18.55" fill-opacity="0.444"/><circle cx="615.93" cy="779.88" r="24.09" fill-opacity="0.67"/><circle cx="341.52" cy="573.86" r="15.58" fill-opacity="0.131"/><circle cx="260.26" cy="598.11" r="15.6" fill-opacity="0.117"/><circle cx="466.08" cy="760.31" r="15.79" fill-opacity="0.256"/><circle cx="278.25" cy="374.7" r="15.67" fill-opacity="0.127"/><circle cx="297.21" cy="384.84" r="16.12" fill-opacity="0.293"/><circle cx="447" cy="517.52" r="15.75" fill-opacity="0.219"/><circle cx="254.23" cy="306.97" r="15.72" fill-opacity="0.119"/><circle cx="542.19" cy="621.5" r="15.73" fill-opacity="0.119"/><circle cx="366.03" cy="760.46" r="15.74" fill-opacity="0.13"/><circle cx="538.78" cy="744.56" r="23.06" fill-opacity="0.63"/><circle cx="599.61" cy="609.58" r="15.79" fill-opacity="0.177"/><circle cx="392.58" cy="745.55" r="15.97" fill-opacity="0.254"/><circle cx="428.23" cy="584.65" r="15.86" fill-opacity="0.133"/><circle cx="309.06" cy="267.45" r="15.9" fill-opacity="0.124"/><circle cx="628.51" cy="787.65" r="15.92" fill-opacity="0.123"/><circle cx="308.22" cy="353.35" r="15.92" fill-opacity="0.127"/><circle cx="332" cy="343.85" r="15.93" fill-opacity="0.134"/><circle cx="660.03" cy="634.96" r="15.94" fill-opacity="0.124"/><circle cx="627.01" cy="454.64" r="25" fill-opacity="0.705"/><circle cx="704.28" cy="283.76" r="20.38" fill-opacity="0.523"/><circle cx="446.26" cy="518.64" r="16" fill-opacity="0.124"/><circle cx="450.26" cy="677.96" r="16.01" fill-opacity="0.189"/><circle cx="333.75" cy="375.8" r="16" fill-opacity="0.124"/><circle cx="567.3" cy="244.78" r="24.74" fill-opacity="0.696"/><circle cx="603.43" cy="339.68" r="16.09" fill-opacity="0.126"/><circle cx="267.52" cy="573.57" r="16.09" fill-opacity="0.136"/><circle cx="578.82" cy="757.59" r="16.1" fill-opacity="0.154"/><circle cx="374.79" cy="387.37" r="20.48" fill-opacity="0.528"/><circle cx="499.64" cy="561" r="16.12" fill-opacity="0.127"/><circle cx="293.44" cy="549.8" r="16.14" fill-opacity="0.127"/><circle cx="322.04" cy="410.23" r="16.19" fill-opacity="0.169"/><circle cx="365.12" cy="766.77" r="16.19" fill-opacity="0.127"/><circle cx="678.25" cy="626" r="16.2" fill-opacity="0.166"/><circle cx="294.18" cy="652.15" r="16.23" fill-opacity="0.128"/><circle cx="386.23" cy="435.45" r="17.37" fill-opacity="0.372"/><circle cx="616.59" cy="426.87" r="16.31" fill-opacity="0.156"/><circle cx="482.79" cy="714.26" r="16.32" fill-opacity="0.138"/><circle cx="544.18" cy="677.29" r="16.37" fill-opacity="0.13"/><circle cx="268.3" cy="451.45" r="16.56" fill-opacity="0.277"/><circle cx="584.64" cy="629.9" r="16.39" fill-opacity="0.131"/><circle cx="245.03" cy="406.43" r="16.41" fill-opacity="0.132"/><circle cx="643.86" cy="710.27" r="18" fill-opacity="0.409"/><circle cx="601.86" cy="666.75" r="16.49" fill-opacity="0.227"/><circle cx="728.8" cy="341.1" r="17.89" fill-opacity="0.401"/><circle cx="666.94" cy="586.39" r="20.62" fill-opacity="0.535"/><circle cx="554.15" cy="673.43" r="17.72" fill-opacity="0.39"/><circle cx="514.93" cy="679.09" r="22.18" fill-opacity="0.598"/><circle cx="511.67" cy="647.96" r="16.54" fill-opacity="0.234"/><circle cx="645.25" cy="398.26" r="16.54" fill-opacity="0.23"/><circle cx="396.48" cy="496.02" r="17.05" fill-opacity="0.332"/><circle cx="606.79" cy="584.28" r="16.59" fill-opacity="0.153"/><circle cx="393.37" cy="493.87" r="16.61" fill-opacity="0.141"/><circle cx="573.52" cy="494.5" r="17.63" fill-opacity="0.38"/><circle cx="323.84" cy="272.69" r="16.63" fill-opacity="0.203"/><circle cx="608.28" cy="477.6" r="16.73" fill-opacity="0.219"/><circle cx="588.34" cy="481.35" r="16.71" fill-opacity="0.137"/><circle cx="735.54" cy="759.01" r="16.75" fill-opacity="0.149"/><circle cx="464.19" cy="290.23" r="16.76" fill-opacity="0.138"/><circle cx="249.43" cy="396.79" r="16.76" fill-opacity="0.152"/><circle cx="300.52" cy="665.98" r="26.76" fill-opacity="0.774"/><circle cx="599.59" cy="706.09" r="16.78" fill-opacity="0.139"/><circle cx="382.69" cy="353.23" r="16.79" fill-opacity="0.171"/><circle cx="245.1" cy="411.15" r="17.32" fill-opacity="0.344"/><circle cx="458.66" cy="302.13" r="16.79" fill-opacity="0.139"/><circle cx="780.3" cy="393.95" r="23.11" fill-opacity="0.637"/><circle cx="409.66" cy="242.43" r="16.81" fill-opacity="0.138"/><circle cx="493.73" cy="647.56" r="16.83" fill-opacity="0.139"/><circle cx="293.37" cy="511.8" r="18.36" fill-opacity="0.423"/><circle cx="654.63" cy="599.81" r="20.9" fill-opacity="0.548"/><circle cx="763.06" cy="366.49" r="25.67" fill-opacity="0.734"/><circle cx="691.28" cy="478.03" r="16.88" fill-opacity="0.193"/><circle cx="310.59" cy="314.16" r="17.06" fill-opacity="0.289"/><circle cx="759.75" cy="706.37" r="16.91" fill-opacity="0.141"/><circle cx="674.19" cy="521.69" r="19.68" fill-opacity="0.493"/><circle cx="488.18" cy="347.08" r="16.95" fill-opacity="0.191"/><circle cx="420.41" cy="784.21" r="17.44" fill-opacity="0.345"/><circle cx="582.54" cy="426.2" r="16.96" fill-opacity="0.153"/><circle cx="293.11" cy="420.43" r="16.99" fill-opacity="0.156"/><circle cx="645.08" cy="374.61" r="17.02" fill-opacity="0.142"/><circle cx="584.57" cy="422.08" r="26.28" fill-opacity="0.758"/><circle cx="329.86" cy="685.68" r="18.05" fill-opacity="0.395"/><circle cx="544.46" cy="622.26" r="17.1" fill-opacity="0.153"/><circle cx="719.19" cy="653.32" r="17.2" fill-opacity="0.27"/><circle cx="452.92" cy="274.33" r="24.88" fill-opacity="0.707"/><circle cx="400.45" cy="554.24" r="17.17" fill-opacity="0.151"/><circle cx="441.83" cy="485.86" r="17.2" fill-opacity="0.168"/><circle cx="766.3" cy="375.23" r="17.26" fill-opacity="0.253"/><circle cx="209.29" cy="444.63" r="17.29" fill-opacity="0.148"/><circle cx="469.94" cy="454.65" r="17.33" fill-opacity="0.198"/><circle cx="483.01" cy="444.33" r="22.57" fill-opacity="0.619"/><circle cx="659.55" cy="328.63" r="18.22" fill-opacity="0.398"/><circle cx="433.71" cy="485.83" r="17.98" fill-opacity="0.373"/><circle cx="631.41" cy="493.92" r="17.4" fill-opacity="0.152"/><circle cx="217.2" cy="442.56" r="17.43" fill-opacity="0.238"/><circle cx="420.83" cy="334.16" r="26.34" fill-opacity="0.763"/><circle cx="511" cy="781.49" r="17.43" fill-opacity="0.176"/><circle cx="614.09" cy="582.13" r="18.08" fill-opacity="0.381"/><circle cx="776.47" cy="672.79" r="17.44" fill-opacity="0.16"/><circle cx="672.4" cy="454.3" r="17.51" fill-opacity="0.279"/><circle cx="613.08" cy="767.68" r="19.98" fill-opacity="0.506"/><circle cx="591.08" cy="502.11" r="19.98" fill-opacity="0.506"/><circle cx="558.98" cy="311.4" r="17.48" fill-opacity="0.151"/><circle cx="626.13" cy="456.01" r="17.5" fill-opacity="0.152"/><circle cx="396.74" cy="496.29" r="17.51" fill-opacity="0.195"/><circle cx="429.55" cy="477.4" r="17.54" fill-opacity="0.153"/><circle cx="781.68" cy="509.58" r="17.58" fill-opacity="0.153"/><circle cx="631.78" cy="354.18" r="17.63" fill-opacity="0.155"/><circle cx="393.69" cy="463.13" r="17.65" fill-opacity="0.154"/><circle cx="473.44" cy="415.27" r="21.02" fill-opacity="0.555"/><circle cx="564.12" cy="252.91" r="18.17" fill-opacity="0.37"/><circle cx="653.44" cy="736.48" r="17.72" fill-opacity="0.156"/><circle cx="575.37" cy="570.24" r="17.77" fill-opacity="0.156"/><circle cx="478.22" cy="554.38" r="17.78" fill-opacity="0.157"/><circle cx="728.9" cy="412.26" r="17.8" fill-opacity="0.207"/><circle cx="623.68" cy="344.07" r="26.67" fill-opacity="0.779"/><circle cx="390.4" cy="478.4" r="17.87" fill-opacity="0.159"/><circle cx="603.16" cy="491.24" r="18.42" fill-opacity="0.382"/><circle cx="553.93" cy="497.62" r="17.98" fill-opacity="0.161"/><circle cx="632.07" cy="501.94" r="17.99" fill-opacity="0.161"/><circle cx="715.7" cy="451.11" r="18.03" fill-opacity="0.161"/><circle cx="540.98" cy="496.73" r="28.98" fill-opacity="0.864"/><circle cx="479.74" cy="360.99" r="18.58" fill-opacity="0.392"/><circle cx="475.65" cy="768.84" r="18.07" fill-opacity="0.177"/><circle cx="304.81" cy="464.72" r="18.11" fill-opacity="0.166"/><circle cx="521.12" cy="488.87" r="29.91" fill-opacity="0.898"/><circle cx="575.85" cy="469.47" r="18.17" fill-opacity="0.262"/><circle cx="813.39" cy="541.89" r="18.61" fill-opacity="0.385"/><circle cx="561.54" cy="473.04" r="18.2" fill-opacity="0.165"/><circle cx="523.21" cy="680.46" r="18.22" fill-opacity="0.209"/><circle cx="811.92" cy="449.29" r="18.51" fill-opacity="0.36"/><circle cx="547.85" cy="493.5" r="30.13" fill-opacity="0.906"/><circle cx="298.37" cy="470.21" r="18.3" fill-opacity="0.23"/><circle cx="481.7" cy="679.79" r="26.21" fill-opacity="0.769"/><circle cx="765.33" cy="664.66" r="29.78" fill-opacity="0.898"/><circle cx="661.41" cy="746.46" r="18.54" fill-opacity="0.173"/><circle cx="740.3" cy="418.46" r="18.64" fill-opacity="0.195"/><circle cx="718.1" cy="696.48" r="18.65" fill-opacity="0.174"/><circle cx="381.39" cy="392.18" r="18.88" fill-opacity="0.178"/><circle cx="656.6" cy="374.87" r="21.54" fill-opacity="0.58"/><circle cx="722.86" cy="413.27" r="22.25" fill-opacity="0.615"/><circle cx="785.35" cy="498.76" r="19.02" fill-opacity="0.242"/><circle cx="685.71" cy="416.54" r="19.16" fill-opacity="0.338"/><circle cx="732.84" cy="455.49" r="19.1" fill-opacity="0.183"/><circle cx="533.79" cy="406.8" r="19.11" fill-opacity="0.183"/><circle cx="790.06" cy="515.58" r="31.99" fill-opacity="0.985"/><circle cx="584.73" cy="494.59" r="19.42" fill-opacity="0.212"/><circle cx="660.56" cy="464.41" r="19.61" fill-opacity="0.193"/><circle cx="741.6" cy="587.16" r="19.61" fill-opacity="0.193"/><circle cx="550.67" cy="447.27" r="19.64" fill-opacity="0.194"/><circle cx="443.85" cy="562.5" r="19.65" fill-opacity="0.194"/><circle cx="425.64" cy="519.69" r="20.03" fill-opacity="0.42"/><circle cx="428.59" cy="549.29" r="22.6" fill-opacity="0.632"/><circle cx="619.95" cy="485.89" r="19.96" fill-opacity="0.268"/></g></svg> \ No newline at end of file +<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 1024 1024"><defs><linearGradient id="idarksquircle-g" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#232220"/><stop offset="1" stop-color="#111110"/></linearGradient></defs><path d="M1024 512L1023.94 628.21L1023.75 665.32L1023.44 692.28L1023.01 714.2L1022.46 733L1021.78 749.62L1020.97 764.6L1020.04 778.3L1018.99 790.95L1017.81 802.74L1016.5 813.78L1015.06 824.18L1013.5 834.01L1011.81 843.33L1009.99 852.2L1008.04 860.66L1005.96 868.74L1003.74 876.47L1001.39 883.88L998.9 890.99L996.28 897.81L993.52 904.36L990.61 910.67L987.56 916.73L984.37 922.56L981.03 928.18L977.54 933.59L973.9 938.79L970.1 943.8L966.14 948.62L962.01 953.26L957.72 957.72L953.26 962.01L948.62 966.14L943.8 970.1L938.79 973.9L933.59 977.54L928.18 981.03L922.56 984.37L916.73 987.56L910.67 990.61L904.36 993.52L897.81 996.28L890.99 998.9L883.88 1001.39L876.47 1003.74L868.74 1005.96L860.66 1008.04L852.2 1009.99L843.33 1011.81L834.01 1013.5L824.18 1015.06L813.78 1016.5L802.74 1017.81L790.95 1018.99L778.3 1020.04L764.6 1020.97L749.62 1021.78L733 1022.46L714.2 1023.01L692.28 1023.44L665.32 1023.75L628.21 1023.94L512 1024L395.79 1023.94L358.68 1023.75L331.72 1023.44L309.8 1023.01L291 1022.46L274.38 1021.78L259.4 1020.97L245.7 1020.04L233.05 1018.99L221.26 1017.81L210.22 1016.5L199.82 1015.06L189.99 1013.5L180.67 1011.81L171.8 1009.99L163.34 1008.04L155.26 1005.96L147.53 1003.74L140.12 1001.39L133.01 998.9L126.19 996.28L119.64 993.52L113.33 990.61L107.27 987.56L101.44 984.37L95.82 981.03L90.41 977.54L85.21 973.9L80.2 970.1L75.38 966.14L70.74 962.01L66.28 957.72L61.99 953.26L57.86 948.62L53.9 943.8L50.1 938.79L46.46 933.59L42.97 928.18L39.63 922.56L36.44 916.73L33.39 910.67L30.48 904.36L27.72 897.81L25.1 890.99L22.61 883.88L20.26 876.47L18.04 868.74L15.96 860.66L14.01 852.2L12.19 843.33L10.5 834.01L8.94 824.18L7.5 813.78L6.19 802.74L5.01 790.95L3.96 778.3L3.03 764.6L2.22 749.62L1.54 733L0.99 714.2L0.56 692.28L0.25 665.32L0.06 628.21L0 512L0.06 395.79L0.25 358.68L0.56 331.72L0.99 309.8L1.54 291L2.22 274.38L3.03 259.4L3.96 245.7L5.01 233.05L6.19 221.26L7.5 210.22L8.94 199.82L10.5 189.99L12.19 180.67L14.01 171.8L15.96 163.34L18.04 155.26L20.26 147.53L22.61 140.12L25.1 133.01L27.72 126.19L30.48 119.64L33.39 113.33L36.44 107.27L39.63 101.44L42.97 95.82L46.46 90.41L50.1 85.21L53.9 80.2L57.86 75.38L61.99 70.74L66.28 66.28L70.74 61.99L75.38 57.86L80.2 53.9L85.21 50.1L90.41 46.46L95.82 42.97L101.44 39.63L107.27 36.44L113.33 33.39L119.64 30.48L126.19 27.72L133.01 25.1L140.12 22.61L147.53 20.26L155.26 18.04L163.34 15.96L171.8 14.01L180.67 12.19L189.99 10.5L199.82 8.94L210.22 7.5L221.26 6.19L233.05 5.01L245.7 3.96L259.4 3.03L274.38 2.22L291 1.54L309.8 0.99L331.72 0.56L358.68 0.25L395.79 0.06L512 0L628.21 0.06L665.32 0.25L692.28 0.56L714.2 0.99L733 1.54L749.62 2.22L764.6 3.03L778.3 3.96L790.95 5.01L802.74 6.19L813.78 7.5L824.18 8.94L834.01 10.5L843.33 12.19L852.2 14.01L860.66 15.96L868.74 18.04L876.47 20.26L883.88 22.61L890.99 25.1L897.81 27.72L904.36 30.48L910.67 33.39L916.73 36.44L922.56 39.63L928.18 42.97L933.59 46.46L938.79 50.1L943.8 53.9L948.62 57.86L953.26 61.99L957.72 66.28L962.01 70.74L966.14 75.38L970.1 80.2L973.9 85.21L977.54 90.41L981.03 95.82L984.37 101.44L987.56 107.27L990.61 113.33L993.52 119.64L996.28 126.19L998.9 133.01L1001.39 140.12L1003.74 147.53L1005.96 155.26L1008.04 163.34L1009.99 171.8L1011.81 180.67L1013.5 189.99L1015.06 199.82L1016.5 210.22L1017.81 221.26L1018.99 233.05L1020.04 245.7L1020.97 259.4L1021.78 274.38L1022.46 291L1023.01 309.8L1023.44 331.72L1023.75 358.68L1023.94 395.79Z" fill="url(#idarksquircle-g)"/><path d="M1022.5 512L1022.44 627.87L1022.25 664.87L1021.95 691.75L1021.52 713.61L1020.96 732.36L1020.28 748.92L1019.48 763.86L1018.55 777.52L1017.5 790.13L1016.32 801.88L1015.02 812.89L1013.59 823.26L1012.03 833.06L1010.35 842.36L1008.53 851.21L1006.59 859.64L1004.51 867.7L1002.3 875.41L999.96 882.79L997.48 889.88L994.86 896.68L992.1 903.22L989.21 909.5L986.17 915.54L982.99 921.36L979.66 926.96L976.18 932.35L972.54 937.54L968.75 942.53L964.81 947.34L960.69 951.97L956.42 956.42L951.97 960.69L947.34 964.81L942.53 968.75L937.54 972.54L932.35 976.18L926.96 979.66L921.36 982.99L915.54 986.17L909.5 989.21L903.22 992.1L896.68 994.86L889.88 997.48L882.79 999.96L875.41 1002.3L867.7 1004.51L859.64 1006.59L851.21 1008.53L842.36 1010.35L833.06 1012.03L823.26 1013.59L812.89 1015.02L801.88 1016.32L790.13 1017.5L777.52 1018.55L763.86 1019.48L748.92 1020.28L732.36 1020.96L713.61 1021.52L691.75 1021.95L664.87 1022.25L627.87 1022.44L512 1022.5L396.13 1022.44L359.13 1022.25L332.25 1021.95L310.39 1021.52L291.64 1020.96L275.08 1020.28L260.14 1019.48L246.48 1018.55L233.87 1017.5L222.12 1016.32L211.11 1015.02L200.74 1013.59L190.94 1012.03L181.64 1010.35L172.79 1008.53L164.36 1006.59L156.3 1004.51L148.59 1002.3L141.21 999.96L134.12 997.48L127.32 994.86L120.78 992.1L114.5 989.21L108.46 986.17L102.64 982.99L97.04 979.66L91.65 976.18L86.46 972.54L81.47 968.75L76.66 964.81L72.03 960.69L67.58 956.42L63.31 951.97L59.19 947.34L55.25 942.53L51.46 937.54L47.82 932.35L44.34 926.96L41.01 921.36L37.83 915.54L34.79 909.5L31.9 903.22L29.14 896.68L26.52 889.88L24.04 882.79L21.7 875.41L19.49 867.7L17.41 859.64L15.47 851.21L13.65 842.36L11.97 833.06L10.41 823.26L8.98 812.89L7.68 801.88L6.5 790.13L5.45 777.52L4.52 763.86L3.72 748.92L3.04 732.36L2.48 713.61L2.05 691.75L1.75 664.87L1.56 627.87L1.5 512L1.56 396.13L1.75 359.13L2.05 332.25L2.48 310.39L3.04 291.64L3.72 275.08L4.52 260.14L5.45 246.48L6.5 233.87L7.68 222.12L8.98 211.11L10.41 200.74L11.97 190.94L13.65 181.64L15.47 172.79L17.41 164.36L19.49 156.3L21.7 148.59L24.04 141.21L26.52 134.12L29.14 127.32L31.9 120.78L34.79 114.5L37.83 108.46L41.01 102.64L44.34 97.04L47.82 91.65L51.46 86.46L55.25 81.47L59.19 76.66L63.31 72.03L67.58 67.58L72.03 63.31L76.66 59.19L81.47 55.25L86.46 51.46L91.65 47.82L97.04 44.34L102.64 41.01L108.46 37.83L114.5 34.79L120.78 31.9L127.32 29.14L134.12 26.52L141.21 24.04L148.59 21.7L156.3 19.49L164.36 17.41L172.79 15.47L181.64 13.65L190.94 11.97L200.74 10.41L211.11 8.98L222.12 7.68L233.87 6.5L246.48 5.45L260.14 4.52L275.08 3.72L291.64 3.04L310.39 2.48L332.25 2.05L359.13 1.75L396.13 1.56L512 1.5L627.87 1.56L664.87 1.75L691.75 2.05L713.61 2.48L732.36 3.04L748.92 3.72L763.86 4.52L777.52 5.45L790.13 6.5L801.88 7.68L812.89 8.98L823.26 10.41L833.06 11.97L842.36 13.65L851.21 15.47L859.64 17.41L867.7 19.49L875.41 21.7L882.79 24.04L889.88 26.52L896.68 29.14L903.22 31.9L909.5 34.79L915.54 37.83L921.36 41.01L926.96 44.34L932.35 47.82L937.54 51.46L942.53 55.25L947.34 59.19L951.97 63.31L956.42 67.58L960.69 72.03L964.81 76.66L968.75 81.47L972.54 86.46L976.18 91.65L979.66 97.04L982.99 102.64L986.17 108.46L989.21 114.5L992.1 120.78L994.86 127.32L997.48 134.12L999.96 141.21L1002.3 148.59L1004.51 156.3L1006.59 164.36L1008.53 172.79L1010.35 181.64L1012.03 190.94L1013.59 200.74L1015.02 211.11L1016.32 222.12L1017.5 233.87L1018.55 246.48L1019.48 260.14L1020.28 275.08L1020.96 291.64L1021.52 310.39L1021.95 332.25L1022.25 359.13L1022.44 396.13Z" fill="none" stroke="rgba(255,255,255,0.07)" stroke-width="3"/><g fill="#f2f1ec"><circle cx="423.37" cy="460.06" r="10.83" fill-opacity="0.062"/><circle cx="508.62" cy="598.58" r="10.98" fill-opacity="0.052"/><circle cx="366.38" cy="589.34" r="11.48" fill-opacity="0.135"/><circle cx="695.11" cy="580.03" r="11.43" fill-opacity="0.057"/><circle cx="407.04" cy="611.77" r="11.57" fill-opacity="0.06"/><circle cx="504.03" cy="607.53" r="11.58" fill-opacity="0.083"/><circle cx="552" cy="538.89" r="13.67" fill-opacity="0.255"/><circle cx="463.04" cy="506.95" r="14.01" fill-opacity="0.27"/><circle cx="505.48" cy="452.91" r="12.01" fill-opacity="0.064"/><circle cx="589.05" cy="475.06" r="12.14" fill-opacity="0.13"/><circle cx="492.8" cy="572.55" r="12.19" fill-opacity="0.069"/><circle cx="479.49" cy="425.99" r="15.14" fill-opacity="0.319"/><circle cx="633.91" cy="596.63" r="14.62" fill-opacity="0.295"/><circle cx="735.26" cy="566.25" r="12.26" fill-opacity="0.076"/><circle cx="661.55" cy="483.4" r="12.28" fill-opacity="0.068"/><circle cx="591.77" cy="553.74" r="12.31" fill-opacity="0.068"/><circle cx="574.61" cy="459.6" r="12.33" fill-opacity="0.079"/><circle cx="431.16" cy="593.73" r="13.13" fill-opacity="0.209"/><circle cx="653.75" cy="650.36" r="12.42" fill-opacity="0.069"/><circle cx="388.04" cy="653.71" r="12.46" fill-opacity="0.075"/><circle cx="376.77" cy="577.51" r="17.71" fill-opacity="0.433"/><circle cx="686.46" cy="489.86" r="12.55" fill-opacity="0.101"/><circle cx="670.46" cy="489.71" r="12.94" fill-opacity="0.185"/><circle cx="717.09" cy="581.79" r="13.99" fill-opacity="0.254"/><circle cx="308" cy="380.93" r="16.94" fill-opacity="0.393"/><circle cx="354.48" cy="562.18" r="12.8" fill-opacity="0.077"/><circle cx="498.3" cy="485.94" r="12.82" fill-opacity="0.074"/><circle cx="474.65" cy="338.71" r="12.91" fill-opacity="0.076"/><circle cx="667.23" cy="645.41" r="14.3" fill-opacity="0.263"/><circle cx="406.24" cy="323.72" r="13" fill-opacity="0.082"/><circle cx="643.77" cy="647.39" r="13.02" fill-opacity="0.078"/><circle cx="611.63" cy="493.97" r="13.03" fill-opacity="0.077"/><circle cx="319.67" cy="533.46" r="13.05" fill-opacity="0.077"/><circle cx="511.37" cy="299.66" r="13.11" fill-opacity="0.109"/><circle cx="752.03" cy="554.46" r="13.13" fill-opacity="0.079"/><circle cx="238.62" cy="542.78" r="18.86" fill-opacity="0.472"/><circle cx="359.41" cy="609.75" r="13.9" fill-opacity="0.232"/><circle cx="641.66" cy="361.15" r="13.2" fill-opacity="0.081"/><circle cx="558.4" cy="274.64" r="19.03" fill-opacity="0.479"/><circle cx="559.15" cy="652" r="13.33" fill-opacity="0.083"/><circle cx="461.77" cy="586.56" r="13.36" fill-opacity="0.082"/><circle cx="605.22" cy="554.43" r="13.69" fill-opacity="0.195"/><circle cx="313.54" cy="617.75" r="13.52" fill-opacity="0.084"/><circle cx="389.35" cy="517.26" r="13.52" fill-opacity="0.087"/><circle cx="452.73" cy="713.63" r="13.55" fill-opacity="0.085"/><circle cx="281.69" cy="599.49" r="13.55" fill-opacity="0.085"/><circle cx="416.04" cy="513.91" r="13.56" fill-opacity="0.093"/><circle cx="391.48" cy="683.91" r="13.62" fill-opacity="0.146"/><circle cx="577.31" cy="647.42" r="13.96" fill-opacity="0.215"/><circle cx="474.96" cy="271.03" r="13.75" fill-opacity="0.088"/><circle cx="557.22" cy="712.25" r="14.52" fill-opacity="0.255"/><circle cx="327.71" cy="626.39" r="13.77" fill-opacity="0.1"/><circle cx="558.53" cy="334.79" r="13.8" fill-opacity="0.139"/><circle cx="642.43" cy="310.23" r="13.79" fill-opacity="0.088"/><circle cx="301.03" cy="676.91" r="13.83" fill-opacity="0.096"/><circle cx="421.56" cy="578.57" r="13.86" fill-opacity="0.089"/><circle cx="415.13" cy="340.46" r="16.98" fill-opacity="0.382"/><circle cx="550.25" cy="663.61" r="20.83" fill-opacity="0.547"/><circle cx="616.73" cy="318.25" r="14.37" fill-opacity="0.232"/><circle cx="550.64" cy="649" r="17.94" fill-opacity="0.424"/><circle cx="655.59" cy="305.88" r="14.04" fill-opacity="0.112"/><circle cx="252.94" cy="331.03" r="14.07" fill-opacity="0.102"/><circle cx="554.52" cy="674.14" r="14.18" fill-opacity="0.183"/><circle cx="526.79" cy="661.09" r="21.2" fill-opacity="0.561"/><circle cx="607.85" cy="656.08" r="14.16" fill-opacity="0.094"/><circle cx="471.92" cy="597.64" r="14.2" fill-opacity="0.141"/><circle cx="402.12" cy="607.95" r="18.02" fill-opacity="0.426"/><circle cx="654.15" cy="319.64" r="14.26" fill-opacity="0.096"/><circle cx="405.12" cy="650.96" r="14.27" fill-opacity="0.095"/><circle cx="554.7" cy="704.22" r="14.3" fill-opacity="0.097"/><circle cx="430.44" cy="272.47" r="14.33" fill-opacity="0.096"/><circle cx="584.88" cy="261.03" r="17.62" fill-opacity="0.408"/><circle cx="701.16" cy="333.67" r="14.49" fill-opacity="0.209"/><circle cx="587.69" cy="355.24" r="15.67" fill-opacity="0.311"/><circle cx="663.04" cy="658.65" r="14.38" fill-opacity="0.111"/><circle cx="680.41" cy="717.18" r="14.39" fill-opacity="0.099"/><circle cx="746.5" cy="472.31" r="16.97" fill-opacity="0.378"/><circle cx="524.19" cy="303.11" r="14.73" fill-opacity="0.237"/><circle cx="543.21" cy="589.85" r="14.41" fill-opacity="0.132"/><circle cx="371.07" cy="563.03" r="14.41" fill-opacity="0.098"/><circle cx="347.28" cy="717.93" r="20.41" fill-opacity="0.526"/><circle cx="238.7" cy="538.66" r="14.45" fill-opacity="0.098"/><circle cx="367.75" cy="335.11" r="21.52" fill-opacity="0.571"/><circle cx="284.7" cy="521.47" r="14.93" fill-opacity="0.253"/><circle cx="288.1" cy="573.05" r="14.53" fill-opacity="0.101"/><circle cx="317.3" cy="638.25" r="14.53" fill-opacity="0.105"/><circle cx="705.57" cy="543.29" r="14.62" fill-opacity="0.193"/><circle cx="386.06" cy="584.61" r="14.67" fill-opacity="0.115"/><circle cx="647.58" cy="514.15" r="14.67" fill-opacity="0.115"/><circle cx="493.19" cy="320.37" r="14.72" fill-opacity="0.108"/><circle cx="283.02" cy="660.3" r="14.76" fill-opacity="0.107"/><circle cx="300.34" cy="386.01" r="15.17" fill-opacity="0.258"/><circle cx="279.84" cy="538.54" r="14.83" fill-opacity="0.114"/><circle cx="278.55" cy="432.69" r="15.3" fill-opacity="0.267"/><circle cx="712.14" cy="320.03" r="18.3" fill-opacity="0.435"/><circle cx="362.45" cy="739.72" r="19.32" fill-opacity="0.479"/><circle cx="306.57" cy="377.14" r="14.97" fill-opacity="0.128"/><circle cx="785.98" cy="334.65" r="16.17" fill-opacity="0.326"/><circle cx="340.05" cy="366.72" r="15.07" fill-opacity="0.199"/><circle cx="534.54" cy="666.64" r="15.13" fill-opacity="0.109"/><circle cx="528.51" cy="296.06" r="22.5" fill-opacity="0.608"/><circle cx="424.79" cy="675.03" r="15.45" fill-opacity="0.258"/><circle cx="628.07" cy="317.21" r="15.21" fill-opacity="0.153"/><circle cx="681.9" cy="702.4" r="15.21" fill-opacity="0.112"/><circle cx="563.59" cy="422.21" r="20.26" fill-opacity="0.518"/><circle cx="576.95" cy="683.75" r="15.27" fill-opacity="0.117"/><circle cx="567.76" cy="606.63" r="15.69" fill-opacity="0.273"/><circle cx="617.28" cy="370.42" r="15.34" fill-opacity="0.113"/><circle cx="416.57" cy="673.16" r="15.36" fill-opacity="0.114"/><circle cx="396.21" cy="393.8" r="15.5" fill-opacity="0.233"/><circle cx="737.48" cy="436" r="15.38" fill-opacity="0.113"/><circle cx="647.13" cy="237.38" r="15.69" fill-opacity="0.267"/><circle cx="286.27" cy="703.92" r="15.38" fill-opacity="0.113"/><circle cx="611.8" cy="696.01" r="16.69" fill-opacity="0.348"/><circle cx="536.56" cy="330.1" r="15.76" fill-opacity="0.265"/><circle cx="701.06" cy="570.76" r="18.55" fill-opacity="0.444"/><circle cx="615.93" cy="779.88" r="24.09" fill-opacity="0.67"/><circle cx="341.52" cy="573.86" r="15.58" fill-opacity="0.131"/><circle cx="260.26" cy="598.11" r="15.6" fill-opacity="0.117"/><circle cx="466.08" cy="760.31" r="15.79" fill-opacity="0.256"/><circle cx="278.25" cy="374.7" r="15.67" fill-opacity="0.127"/><circle cx="297.21" cy="384.84" r="16.12" fill-opacity="0.293"/><circle cx="447" cy="517.52" r="15.75" fill-opacity="0.219"/><circle cx="254.23" cy="306.97" r="15.72" fill-opacity="0.119"/><circle cx="542.19" cy="621.5" r="15.73" fill-opacity="0.119"/><circle cx="366.03" cy="760.46" r="15.74" fill-opacity="0.13"/><circle cx="538.78" cy="744.56" r="23.06" fill-opacity="0.63"/><circle cx="599.61" cy="609.58" r="15.79" fill-opacity="0.177"/><circle cx="392.58" cy="745.55" r="15.97" fill-opacity="0.254"/><circle cx="428.23" cy="584.65" r="15.86" fill-opacity="0.133"/><circle cx="309.06" cy="267.45" r="15.9" fill-opacity="0.124"/><circle cx="628.51" cy="787.65" r="15.92" fill-opacity="0.123"/><circle cx="308.22" cy="353.35" r="15.92" fill-opacity="0.127"/><circle cx="332" cy="343.85" r="15.93" fill-opacity="0.134"/><circle cx="660.03" cy="634.96" r="15.94" fill-opacity="0.124"/><circle cx="627.01" cy="454.64" r="25" fill-opacity="0.705"/><circle cx="704.28" cy="283.76" r="20.38" fill-opacity="0.523"/><circle cx="446.26" cy="518.64" r="16" fill-opacity="0.124"/><circle cx="450.26" cy="677.96" r="16.01" fill-opacity="0.189"/><circle cx="333.75" cy="375.8" r="16" fill-opacity="0.124"/><circle cx="567.3" cy="244.78" r="24.74" fill-opacity="0.696"/><circle cx="603.43" cy="339.68" r="16.09" fill-opacity="0.126"/><circle cx="267.52" cy="573.57" r="16.09" fill-opacity="0.136"/><circle cx="578.82" cy="757.59" r="16.1" fill-opacity="0.154"/><circle cx="374.79" cy="387.37" r="20.48" fill-opacity="0.528"/><circle cx="499.64" cy="561" r="16.12" fill-opacity="0.127"/><circle cx="293.44" cy="549.8" r="16.14" fill-opacity="0.127"/><circle cx="322.04" cy="410.23" r="16.19" fill-opacity="0.169"/><circle cx="365.12" cy="766.77" r="16.19" fill-opacity="0.127"/><circle cx="678.25" cy="626" r="16.2" fill-opacity="0.166"/><circle cx="294.18" cy="652.15" r="16.23" fill-opacity="0.128"/><circle cx="386.23" cy="435.45" r="17.37" fill-opacity="0.372"/><circle cx="616.59" cy="426.87" r="16.31" fill-opacity="0.156"/><circle cx="482.79" cy="714.26" r="16.32" fill-opacity="0.138"/><circle cx="544.18" cy="677.29" r="16.37" fill-opacity="0.13"/><circle cx="268.3" cy="451.45" r="16.56" fill-opacity="0.277"/><circle cx="584.64" cy="629.9" r="16.39" fill-opacity="0.131"/><circle cx="245.03" cy="406.43" r="16.41" fill-opacity="0.132"/><circle cx="643.86" cy="710.27" r="18" fill-opacity="0.409"/><circle cx="601.86" cy="666.75" r="16.49" fill-opacity="0.227"/><circle cx="728.8" cy="341.1" r="17.89" fill-opacity="0.401"/><circle cx="666.94" cy="586.39" r="20.62" fill-opacity="0.535"/><circle cx="554.15" cy="673.43" r="17.72" fill-opacity="0.39"/><circle cx="514.93" cy="679.09" r="22.18" fill-opacity="0.598"/><circle cx="511.67" cy="647.96" r="16.54" fill-opacity="0.234"/><circle cx="645.25" cy="398.26" r="16.54" fill-opacity="0.23"/><circle cx="396.48" cy="496.02" r="17.05" fill-opacity="0.332"/><circle cx="606.79" cy="584.28" r="16.59" fill-opacity="0.153"/><circle cx="393.37" cy="493.87" r="16.61" fill-opacity="0.141"/><circle cx="573.52" cy="494.5" r="17.63" fill-opacity="0.38"/><circle cx="323.84" cy="272.69" r="16.63" fill-opacity="0.203"/><circle cx="608.28" cy="477.6" r="16.73" fill-opacity="0.219"/><circle cx="588.34" cy="481.35" r="16.71" fill-opacity="0.137"/><circle cx="735.54" cy="759.01" r="16.75" fill-opacity="0.149"/><circle cx="464.19" cy="290.23" r="16.76" fill-opacity="0.138"/><circle cx="249.43" cy="396.79" r="16.76" fill-opacity="0.152"/><circle cx="300.52" cy="665.98" r="26.76" fill-opacity="0.774"/><circle cx="599.59" cy="706.09" r="16.78" fill-opacity="0.139"/><circle cx="382.69" cy="353.23" r="16.79" fill-opacity="0.171"/><circle cx="245.1" cy="411.15" r="17.32" fill-opacity="0.344"/><circle cx="458.66" cy="302.13" r="16.79" fill-opacity="0.139"/><circle cx="780.3" cy="393.95" r="23.11" fill-opacity="0.637"/><circle cx="409.66" cy="242.43" r="16.81" fill-opacity="0.138"/><circle cx="493.73" cy="647.56" r="16.83" fill-opacity="0.139"/><circle cx="293.37" cy="511.8" r="18.36" fill-opacity="0.423"/><circle cx="654.63" cy="599.81" r="20.9" fill-opacity="0.548"/><circle cx="763.06" cy="366.49" r="25.67" fill-opacity="0.734"/><circle cx="691.28" cy="478.03" r="16.88" fill-opacity="0.193"/><circle cx="310.59" cy="314.16" r="17.06" fill-opacity="0.289"/><circle cx="759.75" cy="706.37" r="16.91" fill-opacity="0.141"/><circle cx="674.19" cy="521.69" r="19.68" fill-opacity="0.493"/><circle cx="488.18" cy="347.08" r="16.95" fill-opacity="0.191"/><circle cx="420.41" cy="784.21" r="17.44" fill-opacity="0.345"/><circle cx="582.54" cy="426.2" r="16.96" fill-opacity="0.153"/><circle cx="293.11" cy="420.43" r="16.99" fill-opacity="0.156"/><circle cx="645.08" cy="374.61" r="17.02" fill-opacity="0.142"/><circle cx="584.57" cy="422.08" r="26.28" fill-opacity="0.758"/><circle cx="329.86" cy="685.68" r="18.05" fill-opacity="0.395"/><circle cx="544.46" cy="622.26" r="17.1" fill-opacity="0.153"/><circle cx="719.19" cy="653.32" r="17.2" fill-opacity="0.27"/><circle cx="452.92" cy="274.33" r="24.88" fill-opacity="0.707"/><circle cx="400.45" cy="554.24" r="17.17" fill-opacity="0.151"/><circle cx="441.83" cy="485.86" r="17.2" fill-opacity="0.168"/><circle cx="766.3" cy="375.23" r="17.26" fill-opacity="0.253"/><circle cx="209.29" cy="444.63" r="17.29" fill-opacity="0.148"/><circle cx="469.94" cy="454.65" r="17.33" fill-opacity="0.198"/><circle cx="483.01" cy="444.33" r="22.57" fill-opacity="0.619"/><circle cx="659.55" cy="328.63" r="18.22" fill-opacity="0.398"/><circle cx="433.71" cy="485.83" r="17.98" fill-opacity="0.373"/><circle cx="631.41" cy="493.92" r="17.4" fill-opacity="0.152"/><circle cx="217.2" cy="442.56" r="17.43" fill-opacity="0.238"/><circle cx="420.83" cy="334.16" r="26.34" fill-opacity="0.763"/><circle cx="511" cy="781.49" r="17.43" fill-opacity="0.176"/><circle cx="614.09" cy="582.13" r="18.08" fill-opacity="0.381"/><circle cx="776.47" cy="672.79" r="17.44" fill-opacity="0.16"/><circle cx="672.4" cy="454.3" r="17.51" fill-opacity="0.279"/><circle cx="613.08" cy="767.68" r="19.98" fill-opacity="0.506"/><circle cx="591.08" cy="502.11" r="19.98" fill-opacity="0.506"/><circle cx="558.98" cy="311.4" r="17.48" fill-opacity="0.151"/><circle cx="626.13" cy="456.01" r="17.5" fill-opacity="0.152"/><circle cx="396.74" cy="496.29" r="17.51" fill-opacity="0.195"/><circle cx="429.55" cy="477.4" r="17.54" fill-opacity="0.153"/><circle cx="781.68" cy="509.58" r="17.58" fill-opacity="0.153"/><circle cx="631.78" cy="354.18" r="17.63" fill-opacity="0.155"/><circle cx="393.69" cy="463.13" r="17.65" fill-opacity="0.154"/><circle cx="473.44" cy="415.27" r="21.02" fill-opacity="0.555"/><circle cx="564.12" cy="252.91" r="18.17" fill-opacity="0.37"/><circle cx="653.44" cy="736.48" r="17.72" fill-opacity="0.156"/><circle cx="575.37" cy="570.24" r="17.77" fill-opacity="0.156"/><circle cx="478.22" cy="554.38" r="17.78" fill-opacity="0.157"/><circle cx="728.9" cy="412.26" r="17.8" fill-opacity="0.207"/><circle cx="623.68" cy="344.07" r="26.67" fill-opacity="0.779"/><circle cx="390.4" cy="478.4" r="17.87" fill-opacity="0.159"/><circle cx="603.16" cy="491.24" r="18.42" fill-opacity="0.382"/><circle cx="553.93" cy="497.62" r="17.98" fill-opacity="0.161"/><circle cx="632.07" cy="501.94" r="17.99" fill-opacity="0.161"/><circle cx="715.7" cy="451.11" r="18.03" fill-opacity="0.161"/><circle cx="540.98" cy="496.73" r="28.98" fill-opacity="0.864"/><circle cx="479.74" cy="360.99" r="18.58" fill-opacity="0.392"/><circle cx="475.65" cy="768.84" r="18.07" fill-opacity="0.177"/><circle cx="304.81" cy="464.72" r="18.11" fill-opacity="0.166"/><circle cx="521.12" cy="488.87" r="29.91" fill-opacity="0.898"/><circle cx="575.85" cy="469.47" r="18.17" fill-opacity="0.262"/><circle cx="813.39" cy="541.89" r="18.61" fill-opacity="0.385"/><circle cx="561.54" cy="473.04" r="18.2" fill-opacity="0.165"/><circle cx="523.21" cy="680.46" r="18.22" fill-opacity="0.209"/><circle cx="811.92" cy="449.29" r="18.51" fill-opacity="0.36"/><circle cx="547.85" cy="493.5" r="30.13" fill-opacity="0.906"/><circle cx="298.37" cy="470.21" r="18.3" fill-opacity="0.23"/><circle cx="481.7" cy="679.79" r="26.21" fill-opacity="0.769"/><circle cx="765.33" cy="664.66" r="29.78" fill-opacity="0.898"/><circle cx="661.41" cy="746.46" r="18.54" fill-opacity="0.173"/><circle cx="740.3" cy="418.46" r="18.64" fill-opacity="0.195"/><circle cx="718.1" cy="696.48" r="18.65" fill-opacity="0.174"/><circle cx="381.39" cy="392.18" r="18.88" fill-opacity="0.178"/><circle cx="656.6" cy="374.87" r="21.54" fill-opacity="0.58"/><circle cx="722.86" cy="413.27" r="22.25" fill-opacity="0.615"/><circle cx="785.35" cy="498.76" r="19.02" fill-opacity="0.242"/><circle cx="685.71" cy="416.54" r="19.16" fill-opacity="0.338"/><circle cx="732.84" cy="455.49" r="19.1" fill-opacity="0.183"/><circle cx="533.79" cy="406.8" r="19.11" fill-opacity="0.183"/><circle cx="790.06" cy="515.58" r="31.99" fill-opacity="0.985"/><circle cx="584.73" cy="494.59" r="19.42" fill-opacity="0.212"/><circle cx="660.56" cy="464.41" r="19.61" fill-opacity="0.193"/><circle cx="741.6" cy="587.16" r="19.61" fill-opacity="0.193"/><circle cx="550.67" cy="447.27" r="19.64" fill-opacity="0.194"/><circle cx="443.85" cy="562.5" r="19.65" fill-opacity="0.194"/><circle cx="425.64" cy="519.69" r="20.03" fill-opacity="0.42"/><circle cx="428.59" cy="549.29" r="22.6" fill-opacity="0.632"/><circle cx="619.95" cy="485.89" r="19.96" fill-opacity="0.268"/></g></svg> diff --git a/assets/brand/favicon-dark.svg b/brand/favicon-dark.svg similarity index 99% rename from assets/brand/favicon-dark.svg rename to brand/favicon-dark.svg index 745e2f2..3ed70a1 100644 --- a/assets/brand/favicon-dark.svg +++ b/brand/favicon-dark.svg @@ -1 +1 @@ -<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 1024 1024"><defs><linearGradient id="idarkssquircle-g" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#232220"/><stop offset="1" stop-color="#111110"/></linearGradient></defs><path d="M1024 512L1023.94 628.21L1023.75 665.32L1023.44 692.28L1023.01 714.2L1022.46 733L1021.78 749.62L1020.97 764.6L1020.04 778.3L1018.99 790.95L1017.81 802.74L1016.5 813.78L1015.06 824.18L1013.5 834.01L1011.81 843.33L1009.99 852.2L1008.04 860.66L1005.96 868.74L1003.74 876.47L1001.39 883.88L998.9 890.99L996.28 897.81L993.52 904.36L990.61 910.67L987.56 916.73L984.37 922.56L981.03 928.18L977.54 933.59L973.9 938.79L970.1 943.8L966.14 948.62L962.01 953.26L957.72 957.72L953.26 962.01L948.62 966.14L943.8 970.1L938.79 973.9L933.59 977.54L928.18 981.03L922.56 984.37L916.73 987.56L910.67 990.61L904.36 993.52L897.81 996.28L890.99 998.9L883.88 1001.39L876.47 1003.74L868.74 1005.96L860.66 1008.04L852.2 1009.99L843.33 1011.81L834.01 1013.5L824.18 1015.06L813.78 1016.5L802.74 1017.81L790.95 1018.99L778.3 1020.04L764.6 1020.97L749.62 1021.78L733 1022.46L714.2 1023.01L692.28 1023.44L665.32 1023.75L628.21 1023.94L512 1024L395.79 1023.94L358.68 1023.75L331.72 1023.44L309.8 1023.01L291 1022.46L274.38 1021.78L259.4 1020.97L245.7 1020.04L233.05 1018.99L221.26 1017.81L210.22 1016.5L199.82 1015.06L189.99 1013.5L180.67 1011.81L171.8 1009.99L163.34 1008.04L155.26 1005.96L147.53 1003.74L140.12 1001.39L133.01 998.9L126.19 996.28L119.64 993.52L113.33 990.61L107.27 987.56L101.44 984.37L95.82 981.03L90.41 977.54L85.21 973.9L80.2 970.1L75.38 966.14L70.74 962.01L66.28 957.72L61.99 953.26L57.86 948.62L53.9 943.8L50.1 938.79L46.46 933.59L42.97 928.18L39.63 922.56L36.44 916.73L33.39 910.67L30.48 904.36L27.72 897.81L25.1 890.99L22.61 883.88L20.26 876.47L18.04 868.74L15.96 860.66L14.01 852.2L12.19 843.33L10.5 834.01L8.94 824.18L7.5 813.78L6.19 802.74L5.01 790.95L3.96 778.3L3.03 764.6L2.22 749.62L1.54 733L0.99 714.2L0.56 692.28L0.25 665.32L0.06 628.21L0 512L0.06 395.79L0.25 358.68L0.56 331.72L0.99 309.8L1.54 291L2.22 274.38L3.03 259.4L3.96 245.7L5.01 233.05L6.19 221.26L7.5 210.22L8.94 199.82L10.5 189.99L12.19 180.67L14.01 171.8L15.96 163.34L18.04 155.26L20.26 147.53L22.61 140.12L25.1 133.01L27.72 126.19L30.48 119.64L33.39 113.33L36.44 107.27L39.63 101.44L42.97 95.82L46.46 90.41L50.1 85.21L53.9 80.2L57.86 75.38L61.99 70.74L66.28 66.28L70.74 61.99L75.38 57.86L80.2 53.9L85.21 50.1L90.41 46.46L95.82 42.97L101.44 39.63L107.27 36.44L113.33 33.39L119.64 30.48L126.19 27.72L133.01 25.1L140.12 22.61L147.53 20.26L155.26 18.04L163.34 15.96L171.8 14.01L180.67 12.19L189.99 10.5L199.82 8.94L210.22 7.5L221.26 6.19L233.05 5.01L245.7 3.96L259.4 3.03L274.38 2.22L291 1.54L309.8 0.99L331.72 0.56L358.68 0.25L395.79 0.06L512 0L628.21 0.06L665.32 0.25L692.28 0.56L714.2 0.99L733 1.54L749.62 2.22L764.6 3.03L778.3 3.96L790.95 5.01L802.74 6.19L813.78 7.5L824.18 8.94L834.01 10.5L843.33 12.19L852.2 14.01L860.66 15.96L868.74 18.04L876.47 20.26L883.88 22.61L890.99 25.1L897.81 27.72L904.36 30.48L910.67 33.39L916.73 36.44L922.56 39.63L928.18 42.97L933.59 46.46L938.79 50.1L943.8 53.9L948.62 57.86L953.26 61.99L957.72 66.28L962.01 70.74L966.14 75.38L970.1 80.2L973.9 85.21L977.54 90.41L981.03 95.82L984.37 101.44L987.56 107.27L990.61 113.33L993.52 119.64L996.28 126.19L998.9 133.01L1001.39 140.12L1003.74 147.53L1005.96 155.26L1008.04 163.34L1009.99 171.8L1011.81 180.67L1013.5 189.99L1015.06 199.82L1016.5 210.22L1017.81 221.26L1018.99 233.05L1020.04 245.7L1020.97 259.4L1021.78 274.38L1022.46 291L1023.01 309.8L1023.44 331.72L1023.75 358.68L1023.94 395.79Z" fill="url(#idarkssquircle-g)"/><path d="M1022.5 512L1022.44 627.87L1022.25 664.87L1021.95 691.75L1021.52 713.61L1020.96 732.36L1020.28 748.92L1019.48 763.86L1018.55 777.52L1017.5 790.13L1016.32 801.88L1015.02 812.89L1013.59 823.26L1012.03 833.06L1010.35 842.36L1008.53 851.21L1006.59 859.64L1004.51 867.7L1002.3 875.41L999.96 882.79L997.48 889.88L994.86 896.68L992.1 903.22L989.21 909.5L986.17 915.54L982.99 921.36L979.66 926.96L976.18 932.35L972.54 937.54L968.75 942.53L964.81 947.34L960.69 951.97L956.42 956.42L951.97 960.69L947.34 964.81L942.53 968.75L937.54 972.54L932.35 976.18L926.96 979.66L921.36 982.99L915.54 986.17L909.5 989.21L903.22 992.1L896.68 994.86L889.88 997.48L882.79 999.96L875.41 1002.3L867.7 1004.51L859.64 1006.59L851.21 1008.53L842.36 1010.35L833.06 1012.03L823.26 1013.59L812.89 1015.02L801.88 1016.32L790.13 1017.5L777.52 1018.55L763.86 1019.48L748.92 1020.28L732.36 1020.96L713.61 1021.52L691.75 1021.95L664.87 1022.25L627.87 1022.44L512 1022.5L396.13 1022.44L359.13 1022.25L332.25 1021.95L310.39 1021.52L291.64 1020.96L275.08 1020.28L260.14 1019.48L246.48 1018.55L233.87 1017.5L222.12 1016.32L211.11 1015.02L200.74 1013.59L190.94 1012.03L181.64 1010.35L172.79 1008.53L164.36 1006.59L156.3 1004.51L148.59 1002.3L141.21 999.96L134.12 997.48L127.32 994.86L120.78 992.1L114.5 989.21L108.46 986.17L102.64 982.99L97.04 979.66L91.65 976.18L86.46 972.54L81.47 968.75L76.66 964.81L72.03 960.69L67.58 956.42L63.31 951.97L59.19 947.34L55.25 942.53L51.46 937.54L47.82 932.35L44.34 926.96L41.01 921.36L37.83 915.54L34.79 909.5L31.9 903.22L29.14 896.68L26.52 889.88L24.04 882.79L21.7 875.41L19.49 867.7L17.41 859.64L15.47 851.21L13.65 842.36L11.97 833.06L10.41 823.26L8.98 812.89L7.68 801.88L6.5 790.13L5.45 777.52L4.52 763.86L3.72 748.92L3.04 732.36L2.48 713.61L2.05 691.75L1.75 664.87L1.56 627.87L1.5 512L1.56 396.13L1.75 359.13L2.05 332.25L2.48 310.39L3.04 291.64L3.72 275.08L4.52 260.14L5.45 246.48L6.5 233.87L7.68 222.12L8.98 211.11L10.41 200.74L11.97 190.94L13.65 181.64L15.47 172.79L17.41 164.36L19.49 156.3L21.7 148.59L24.04 141.21L26.52 134.12L29.14 127.32L31.9 120.78L34.79 114.5L37.83 108.46L41.01 102.64L44.34 97.04L47.82 91.65L51.46 86.46L55.25 81.47L59.19 76.66L63.31 72.03L67.58 67.58L72.03 63.31L76.66 59.19L81.47 55.25L86.46 51.46L91.65 47.82L97.04 44.34L102.64 41.01L108.46 37.83L114.5 34.79L120.78 31.9L127.32 29.14L134.12 26.52L141.21 24.04L148.59 21.7L156.3 19.49L164.36 17.41L172.79 15.47L181.64 13.65L190.94 11.97L200.74 10.41L211.11 8.98L222.12 7.68L233.87 6.5L246.48 5.45L260.14 4.52L275.08 3.72L291.64 3.04L310.39 2.48L332.25 2.05L359.13 1.75L396.13 1.56L512 1.5L627.87 1.56L664.87 1.75L691.75 2.05L713.61 2.48L732.36 3.04L748.92 3.72L763.86 4.52L777.52 5.45L790.13 6.5L801.88 7.68L812.89 8.98L823.26 10.41L833.06 11.97L842.36 13.65L851.21 15.47L859.64 17.41L867.7 19.49L875.41 21.7L882.79 24.04L889.88 26.52L896.68 29.14L903.22 31.9L909.5 34.79L915.54 37.83L921.36 41.01L926.96 44.34L932.35 47.82L937.54 51.46L942.53 55.25L947.34 59.19L951.97 63.31L956.42 67.58L960.69 72.03L964.81 76.66L968.75 81.47L972.54 86.46L976.18 91.65L979.66 97.04L982.99 102.64L986.17 108.46L989.21 114.5L992.1 120.78L994.86 127.32L997.48 134.12L999.96 141.21L1002.3 148.59L1004.51 156.3L1006.59 164.36L1008.53 172.79L1010.35 181.64L1012.03 190.94L1013.59 200.74L1015.02 211.11L1016.32 222.12L1017.5 233.87L1018.55 246.48L1019.48 260.14L1020.28 275.08L1020.96 291.64L1021.52 310.39L1021.95 332.25L1022.25 359.13L1022.44 396.13Z" fill="none" stroke="rgba(255,255,255,0.07)" stroke-width="3"/><g fill="#f2f1ec"><circle cx="409.31" cy="456.44" r="22.06" fill-opacity="0.38"/><circle cx="507.3" cy="615.67" r="22.38" fill-opacity="0.38"/><circle cx="502.03" cy="625.96" r="23.6" fill-opacity="0.38"/><circle cx="454.91" cy="510.35" r="28.55" fill-opacity="0.38"/><circle cx="599.75" cy="473.68" r="24.75" fill-opacity="0.38"/><circle cx="651.33" cy="613.43" r="29.8" fill-opacity="0.38"/><circle cx="683.09" cy="483.27" r="25.02" fill-opacity="0.38"/><circle cx="602.89" cy="564.13" r="25.08" fill-opacity="0.38"/><circle cx="711.72" cy="490.7" r="25.58" fill-opacity="0.38"/><circle cx="693.34" cy="490.52" r="26.37" fill-opacity="0.38"/><circle cx="276.7" cy="365.48" r="34.52" fill-opacity="0.393"/><circle cx="330.12" cy="573.82" r="26.09" fill-opacity="0.38"/><circle cx="389.62" cy="299.72" r="26.48" fill-opacity="0.38"/><circle cx="625.71" cy="495.42" r="26.55" fill-opacity="0.38"/><circle cx="787.1" cy="564.95" r="26.76" fill-opacity="0.38"/><circle cx="196.95" cy="551.53" r="38.44" fill-opacity="0.472"/><circle cx="564.53" cy="243.31" r="38.78" fill-opacity="0.479"/><circle cx="283.06" cy="637.7" r="27.54" fill-opacity="0.38"/><circle cx="443.06" cy="747.92" r="27.61" fill-opacity="0.38"/><circle cx="586.26" cy="671.81" r="28.45" fill-opacity="0.38"/><circle cx="468.61" cy="239.16" r="28.01" fill-opacity="0.38"/><circle cx="555.16" cy="690.42" r="42.44" fill-opacity="0.547"/><circle cx="213.4" cy="308.12" r="28.66" fill-opacity="0.38"/><circle cx="528.19" cy="687.52" r="43.2" fill-opacity="0.561"/><circle cx="388.33" cy="675.87" r="29.08" fill-opacity="0.38"/><circle cx="560.27" cy="737.09" r="29.14" fill-opacity="0.38"/><circle cx="728.62" cy="311.15" r="29.54" fill-opacity="0.38"/><circle cx="598.2" cy="335.96" r="31.92" fill-opacity="0.38"/><circle cx="684.81" cy="684.72" r="29.3" fill-opacity="0.38"/><circle cx="249.91" cy="527.03" r="30.43" fill-opacity="0.38"/><circle cx="733.7" cy="552.11" r="29.78" fill-opacity="0.38"/><circle cx="247.99" cy="686.61" r="30.07" fill-opacity="0.38"/><circle cx="267.89" cy="371.33" r="30.91" fill-opacity="0.38"/><circle cx="826.12" cy="312.28" r="32.95" fill-opacity="0.38"/><circle cx="313.54" cy="349.15" r="30.71" fill-opacity="0.38"/><circle cx="410.94" cy="703.54" r="31.49" fill-opacity="0.38"/><circle cx="644.61" cy="292.24" r="30.99" fill-opacity="0.38"/><circle cx="625.91" cy="727.66" r="34.01" fill-opacity="0.38"/><circle cx="728.51" cy="583.69" r="37.8" fill-opacity="0.444"/><circle cx="436.47" cy="522.49" r="32.09" fill-opacity="0.38"/><circle cx="545.89" cy="642.02" r="32.05" fill-opacity="0.38"/><circle cx="414.9" cy="599.65" r="32.33" fill-opacity="0.38"/><circle cx="645.11" cy="833" r="32.44" fill-opacity="0.38"/><circle cx="306.3" cy="359.58" r="32.61" fill-opacity="0.38"/><circle cx="574.75" cy="208.99" r="50.42" fill-opacity="0.696"/><circle cx="230.17" cy="586.91" r="32.79" fill-opacity="0.38"/><circle cx="587.99" cy="798.45" r="32.81" fill-opacity="0.38"/><circle cx="496.98" cy="572.46" r="32.84" fill-opacity="0.38"/><circle cx="259.96" cy="559.6" r="32.89" fill-opacity="0.38"/><circle cx="260.81" cy="677.24" r="33.07" fill-opacity="0.38"/><circle cx="477.62" cy="748.64" r="33.25" fill-opacity="0.38"/><circle cx="204.31" cy="394.8" r="33.44" fill-opacity="0.38"/><circle cx="614.48" cy="694.02" r="33.6" fill-opacity="0.38"/><circle cx="559.64" cy="701.71" r="36.11" fill-opacity="0.39"/><circle cx="514.55" cy="708.21" r="45.19" fill-opacity="0.598"/><circle cx="378.4" cy="497.78" r="34.74" fill-opacity="0.38"/><circle cx="620.15" cy="599.23" r="33.8" fill-opacity="0.38"/><circle cx="374.83" cy="495.3" r="33.85" fill-opacity="0.38"/><circle cx="294.9" cy="241.06" r="33.89" fill-opacity="0.38"/><circle cx="449.87" cy="274.9" r="34.21" fill-opacity="0.38"/><circle cx="279.68" cy="288.74" r="34.76" fill-opacity="0.38"/><circle cx="795.97" cy="739.57" r="34.46" fill-opacity="0.38"/><circle cx="664.16" cy="358.22" r="34.67" fill-opacity="0.38"/><circle cx="301.83" cy="715.79" r="36.78" fill-opacity="0.395"/><circle cx="430.53" cy="486.09" r="35.05" fill-opacity="0.38"/><circle cx="163.23" cy="438.71" r="35.23" fill-opacity="0.38"/><circle cx="406.39" cy="311.72" r="53.67" fill-opacity="0.763"/><circle cx="510.04" cy="825.92" r="35.51" fill-opacity="0.38"/><circle cx="627.37" cy="810.04" r="40.72" fill-opacity="0.506"/><circle cx="602.09" cy="504.77" r="40.72" fill-opacity="0.506"/><circle cx="378.7" cy="498.09" r="35.67" fill-opacity="0.38"/><circle cx="416.41" cy="476.38" r="35.73" fill-opacity="0.38"/><circle cx="821.18" cy="513.37" r="35.83" fill-opacity="0.38"/><circle cx="648.87" cy="334.74" r="35.92" fill-opacity="0.38"/><circle cx="571.1" cy="218.32" r="37.02" fill-opacity="0.38"/><circle cx="760.51" cy="401.5" r="36.28" fill-opacity="0.38"/><circle cx="615.98" cy="492.28" r="37.53" fill-opacity="0.382"/><circle cx="559.39" cy="499.62" r="36.65" fill-opacity="0.38"/><circle cx="745.34" cy="446.15" r="36.74" fill-opacity="0.38"/><circle cx="273.03" cy="461.79" r="36.91" fill-opacity="0.38"/><circle cx="552.4" cy="494.88" r="61.39" fill-opacity="0.906"/><circle cx="476.36" cy="709.01" r="53.41" fill-opacity="0.769"/><circle cx="748.1" cy="728.2" r="37.99" fill-opacity="0.38"/><circle cx="677.4" cy="358.52" r="43.9" fill-opacity="0.58"/><circle cx="765.03" cy="451.19" r="38.91" fill-opacity="0.38"/><circle cx="536.23" cy="395.23" r="38.94" fill-opacity="0.38"/><circle cx="830.81" cy="520.26" r="65.19" fill-opacity="0.985"/><circle cx="432.85" cy="574.19" r="40.04" fill-opacity="0.38"/><circle cx="411.92" cy="524.99" r="40.82" fill-opacity="0.42"/><circle cx="415.31" cy="559.01" r="46.04" fill-opacity="0.632"/></g></svg> \ No newline at end of file +<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 1024 1024"><defs><linearGradient id="idarkssquircle-g" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#232220"/><stop offset="1" stop-color="#111110"/></linearGradient></defs><path d="M1024 512L1023.94 628.21L1023.75 665.32L1023.44 692.28L1023.01 714.2L1022.46 733L1021.78 749.62L1020.97 764.6L1020.04 778.3L1018.99 790.95L1017.81 802.74L1016.5 813.78L1015.06 824.18L1013.5 834.01L1011.81 843.33L1009.99 852.2L1008.04 860.66L1005.96 868.74L1003.74 876.47L1001.39 883.88L998.9 890.99L996.28 897.81L993.52 904.36L990.61 910.67L987.56 916.73L984.37 922.56L981.03 928.18L977.54 933.59L973.9 938.79L970.1 943.8L966.14 948.62L962.01 953.26L957.72 957.72L953.26 962.01L948.62 966.14L943.8 970.1L938.79 973.9L933.59 977.54L928.18 981.03L922.56 984.37L916.73 987.56L910.67 990.61L904.36 993.52L897.81 996.28L890.99 998.9L883.88 1001.39L876.47 1003.74L868.74 1005.96L860.66 1008.04L852.2 1009.99L843.33 1011.81L834.01 1013.5L824.18 1015.06L813.78 1016.5L802.74 1017.81L790.95 1018.99L778.3 1020.04L764.6 1020.97L749.62 1021.78L733 1022.46L714.2 1023.01L692.28 1023.44L665.32 1023.75L628.21 1023.94L512 1024L395.79 1023.94L358.68 1023.75L331.72 1023.44L309.8 1023.01L291 1022.46L274.38 1021.78L259.4 1020.97L245.7 1020.04L233.05 1018.99L221.26 1017.81L210.22 1016.5L199.82 1015.06L189.99 1013.5L180.67 1011.81L171.8 1009.99L163.34 1008.04L155.26 1005.96L147.53 1003.74L140.12 1001.39L133.01 998.9L126.19 996.28L119.64 993.52L113.33 990.61L107.27 987.56L101.44 984.37L95.82 981.03L90.41 977.54L85.21 973.9L80.2 970.1L75.38 966.14L70.74 962.01L66.28 957.72L61.99 953.26L57.86 948.62L53.9 943.8L50.1 938.79L46.46 933.59L42.97 928.18L39.63 922.56L36.44 916.73L33.39 910.67L30.48 904.36L27.72 897.81L25.1 890.99L22.61 883.88L20.26 876.47L18.04 868.74L15.96 860.66L14.01 852.2L12.19 843.33L10.5 834.01L8.94 824.18L7.5 813.78L6.19 802.74L5.01 790.95L3.96 778.3L3.03 764.6L2.22 749.62L1.54 733L0.99 714.2L0.56 692.28L0.25 665.32L0.06 628.21L0 512L0.06 395.79L0.25 358.68L0.56 331.72L0.99 309.8L1.54 291L2.22 274.38L3.03 259.4L3.96 245.7L5.01 233.05L6.19 221.26L7.5 210.22L8.94 199.82L10.5 189.99L12.19 180.67L14.01 171.8L15.96 163.34L18.04 155.26L20.26 147.53L22.61 140.12L25.1 133.01L27.72 126.19L30.48 119.64L33.39 113.33L36.44 107.27L39.63 101.44L42.97 95.82L46.46 90.41L50.1 85.21L53.9 80.2L57.86 75.38L61.99 70.74L66.28 66.28L70.74 61.99L75.38 57.86L80.2 53.9L85.21 50.1L90.41 46.46L95.82 42.97L101.44 39.63L107.27 36.44L113.33 33.39L119.64 30.48L126.19 27.72L133.01 25.1L140.12 22.61L147.53 20.26L155.26 18.04L163.34 15.96L171.8 14.01L180.67 12.19L189.99 10.5L199.82 8.94L210.22 7.5L221.26 6.19L233.05 5.01L245.7 3.96L259.4 3.03L274.38 2.22L291 1.54L309.8 0.99L331.72 0.56L358.68 0.25L395.79 0.06L512 0L628.21 0.06L665.32 0.25L692.28 0.56L714.2 0.99L733 1.54L749.62 2.22L764.6 3.03L778.3 3.96L790.95 5.01L802.74 6.19L813.78 7.5L824.18 8.94L834.01 10.5L843.33 12.19L852.2 14.01L860.66 15.96L868.74 18.04L876.47 20.26L883.88 22.61L890.99 25.1L897.81 27.72L904.36 30.48L910.67 33.39L916.73 36.44L922.56 39.63L928.18 42.97L933.59 46.46L938.79 50.1L943.8 53.9L948.62 57.86L953.26 61.99L957.72 66.28L962.01 70.74L966.14 75.38L970.1 80.2L973.9 85.21L977.54 90.41L981.03 95.82L984.37 101.44L987.56 107.27L990.61 113.33L993.52 119.64L996.28 126.19L998.9 133.01L1001.39 140.12L1003.74 147.53L1005.96 155.26L1008.04 163.34L1009.99 171.8L1011.81 180.67L1013.5 189.99L1015.06 199.82L1016.5 210.22L1017.81 221.26L1018.99 233.05L1020.04 245.7L1020.97 259.4L1021.78 274.38L1022.46 291L1023.01 309.8L1023.44 331.72L1023.75 358.68L1023.94 395.79Z" fill="url(#idarkssquircle-g)"/><path d="M1022.5 512L1022.44 627.87L1022.25 664.87L1021.95 691.75L1021.52 713.61L1020.96 732.36L1020.28 748.92L1019.48 763.86L1018.55 777.52L1017.5 790.13L1016.32 801.88L1015.02 812.89L1013.59 823.26L1012.03 833.06L1010.35 842.36L1008.53 851.21L1006.59 859.64L1004.51 867.7L1002.3 875.41L999.96 882.79L997.48 889.88L994.86 896.68L992.1 903.22L989.21 909.5L986.17 915.54L982.99 921.36L979.66 926.96L976.18 932.35L972.54 937.54L968.75 942.53L964.81 947.34L960.69 951.97L956.42 956.42L951.97 960.69L947.34 964.81L942.53 968.75L937.54 972.54L932.35 976.18L926.96 979.66L921.36 982.99L915.54 986.17L909.5 989.21L903.22 992.1L896.68 994.86L889.88 997.48L882.79 999.96L875.41 1002.3L867.7 1004.51L859.64 1006.59L851.21 1008.53L842.36 1010.35L833.06 1012.03L823.26 1013.59L812.89 1015.02L801.88 1016.32L790.13 1017.5L777.52 1018.55L763.86 1019.48L748.92 1020.28L732.36 1020.96L713.61 1021.52L691.75 1021.95L664.87 1022.25L627.87 1022.44L512 1022.5L396.13 1022.44L359.13 1022.25L332.25 1021.95L310.39 1021.52L291.64 1020.96L275.08 1020.28L260.14 1019.48L246.48 1018.55L233.87 1017.5L222.12 1016.32L211.11 1015.02L200.74 1013.59L190.94 1012.03L181.64 1010.35L172.79 1008.53L164.36 1006.59L156.3 1004.51L148.59 1002.3L141.21 999.96L134.12 997.48L127.32 994.86L120.78 992.1L114.5 989.21L108.46 986.17L102.64 982.99L97.04 979.66L91.65 976.18L86.46 972.54L81.47 968.75L76.66 964.81L72.03 960.69L67.58 956.42L63.31 951.97L59.19 947.34L55.25 942.53L51.46 937.54L47.82 932.35L44.34 926.96L41.01 921.36L37.83 915.54L34.79 909.5L31.9 903.22L29.14 896.68L26.52 889.88L24.04 882.79L21.7 875.41L19.49 867.7L17.41 859.64L15.47 851.21L13.65 842.36L11.97 833.06L10.41 823.26L8.98 812.89L7.68 801.88L6.5 790.13L5.45 777.52L4.52 763.86L3.72 748.92L3.04 732.36L2.48 713.61L2.05 691.75L1.75 664.87L1.56 627.87L1.5 512L1.56 396.13L1.75 359.13L2.05 332.25L2.48 310.39L3.04 291.64L3.72 275.08L4.52 260.14L5.45 246.48L6.5 233.87L7.68 222.12L8.98 211.11L10.41 200.74L11.97 190.94L13.65 181.64L15.47 172.79L17.41 164.36L19.49 156.3L21.7 148.59L24.04 141.21L26.52 134.12L29.14 127.32L31.9 120.78L34.79 114.5L37.83 108.46L41.01 102.64L44.34 97.04L47.82 91.65L51.46 86.46L55.25 81.47L59.19 76.66L63.31 72.03L67.58 67.58L72.03 63.31L76.66 59.19L81.47 55.25L86.46 51.46L91.65 47.82L97.04 44.34L102.64 41.01L108.46 37.83L114.5 34.79L120.78 31.9L127.32 29.14L134.12 26.52L141.21 24.04L148.59 21.7L156.3 19.49L164.36 17.41L172.79 15.47L181.64 13.65L190.94 11.97L200.74 10.41L211.11 8.98L222.12 7.68L233.87 6.5L246.48 5.45L260.14 4.52L275.08 3.72L291.64 3.04L310.39 2.48L332.25 2.05L359.13 1.75L396.13 1.56L512 1.5L627.87 1.56L664.87 1.75L691.75 2.05L713.61 2.48L732.36 3.04L748.92 3.72L763.86 4.52L777.52 5.45L790.13 6.5L801.88 7.68L812.89 8.98L823.26 10.41L833.06 11.97L842.36 13.65L851.21 15.47L859.64 17.41L867.7 19.49L875.41 21.7L882.79 24.04L889.88 26.52L896.68 29.14L903.22 31.9L909.5 34.79L915.54 37.83L921.36 41.01L926.96 44.34L932.35 47.82L937.54 51.46L942.53 55.25L947.34 59.19L951.97 63.31L956.42 67.58L960.69 72.03L964.81 76.66L968.75 81.47L972.54 86.46L976.18 91.65L979.66 97.04L982.99 102.64L986.17 108.46L989.21 114.5L992.1 120.78L994.86 127.32L997.48 134.12L999.96 141.21L1002.3 148.59L1004.51 156.3L1006.59 164.36L1008.53 172.79L1010.35 181.64L1012.03 190.94L1013.59 200.74L1015.02 211.11L1016.32 222.12L1017.5 233.87L1018.55 246.48L1019.48 260.14L1020.28 275.08L1020.96 291.64L1021.52 310.39L1021.95 332.25L1022.25 359.13L1022.44 396.13Z" fill="none" stroke="rgba(255,255,255,0.07)" stroke-width="3"/><g fill="#f2f1ec"><circle cx="409.31" cy="456.44" r="22.06" fill-opacity="0.38"/><circle cx="507.3" cy="615.67" r="22.38" fill-opacity="0.38"/><circle cx="502.03" cy="625.96" r="23.6" fill-opacity="0.38"/><circle cx="454.91" cy="510.35" r="28.55" fill-opacity="0.38"/><circle cx="599.75" cy="473.68" r="24.75" fill-opacity="0.38"/><circle cx="651.33" cy="613.43" r="29.8" fill-opacity="0.38"/><circle cx="683.09" cy="483.27" r="25.02" fill-opacity="0.38"/><circle cx="602.89" cy="564.13" r="25.08" fill-opacity="0.38"/><circle cx="711.72" cy="490.7" r="25.58" fill-opacity="0.38"/><circle cx="693.34" cy="490.52" r="26.37" fill-opacity="0.38"/><circle cx="276.7" cy="365.48" r="34.52" fill-opacity="0.393"/><circle cx="330.12" cy="573.82" r="26.09" fill-opacity="0.38"/><circle cx="389.62" cy="299.72" r="26.48" fill-opacity="0.38"/><circle cx="625.71" cy="495.42" r="26.55" fill-opacity="0.38"/><circle cx="787.1" cy="564.95" r="26.76" fill-opacity="0.38"/><circle cx="196.95" cy="551.53" r="38.44" fill-opacity="0.472"/><circle cx="564.53" cy="243.31" r="38.78" fill-opacity="0.479"/><circle cx="283.06" cy="637.7" r="27.54" fill-opacity="0.38"/><circle cx="443.06" cy="747.92" r="27.61" fill-opacity="0.38"/><circle cx="586.26" cy="671.81" r="28.45" fill-opacity="0.38"/><circle cx="468.61" cy="239.16" r="28.01" fill-opacity="0.38"/><circle cx="555.16" cy="690.42" r="42.44" fill-opacity="0.547"/><circle cx="213.4" cy="308.12" r="28.66" fill-opacity="0.38"/><circle cx="528.19" cy="687.52" r="43.2" fill-opacity="0.561"/><circle cx="388.33" cy="675.87" r="29.08" fill-opacity="0.38"/><circle cx="560.27" cy="737.09" r="29.14" fill-opacity="0.38"/><circle cx="728.62" cy="311.15" r="29.54" fill-opacity="0.38"/><circle cx="598.2" cy="335.96" r="31.92" fill-opacity="0.38"/><circle cx="684.81" cy="684.72" r="29.3" fill-opacity="0.38"/><circle cx="249.91" cy="527.03" r="30.43" fill-opacity="0.38"/><circle cx="733.7" cy="552.11" r="29.78" fill-opacity="0.38"/><circle cx="247.99" cy="686.61" r="30.07" fill-opacity="0.38"/><circle cx="267.89" cy="371.33" r="30.91" fill-opacity="0.38"/><circle cx="826.12" cy="312.28" r="32.95" fill-opacity="0.38"/><circle cx="313.54" cy="349.15" r="30.71" fill-opacity="0.38"/><circle cx="410.94" cy="703.54" r="31.49" fill-opacity="0.38"/><circle cx="644.61" cy="292.24" r="30.99" fill-opacity="0.38"/><circle cx="625.91" cy="727.66" r="34.01" fill-opacity="0.38"/><circle cx="728.51" cy="583.69" r="37.8" fill-opacity="0.444"/><circle cx="436.47" cy="522.49" r="32.09" fill-opacity="0.38"/><circle cx="545.89" cy="642.02" r="32.05" fill-opacity="0.38"/><circle cx="414.9" cy="599.65" r="32.33" fill-opacity="0.38"/><circle cx="645.11" cy="833" r="32.44" fill-opacity="0.38"/><circle cx="306.3" cy="359.58" r="32.61" fill-opacity="0.38"/><circle cx="574.75" cy="208.99" r="50.42" fill-opacity="0.696"/><circle cx="230.17" cy="586.91" r="32.79" fill-opacity="0.38"/><circle cx="587.99" cy="798.45" r="32.81" fill-opacity="0.38"/><circle cx="496.98" cy="572.46" r="32.84" fill-opacity="0.38"/><circle cx="259.96" cy="559.6" r="32.89" fill-opacity="0.38"/><circle cx="260.81" cy="677.24" r="33.07" fill-opacity="0.38"/><circle cx="477.62" cy="748.64" r="33.25" fill-opacity="0.38"/><circle cx="204.31" cy="394.8" r="33.44" fill-opacity="0.38"/><circle cx="614.48" cy="694.02" r="33.6" fill-opacity="0.38"/><circle cx="559.64" cy="701.71" r="36.11" fill-opacity="0.39"/><circle cx="514.55" cy="708.21" r="45.19" fill-opacity="0.598"/><circle cx="378.4" cy="497.78" r="34.74" fill-opacity="0.38"/><circle cx="620.15" cy="599.23" r="33.8" fill-opacity="0.38"/><circle cx="374.83" cy="495.3" r="33.85" fill-opacity="0.38"/><circle cx="294.9" cy="241.06" r="33.89" fill-opacity="0.38"/><circle cx="449.87" cy="274.9" r="34.21" fill-opacity="0.38"/><circle cx="279.68" cy="288.74" r="34.76" fill-opacity="0.38"/><circle cx="795.97" cy="739.57" r="34.46" fill-opacity="0.38"/><circle cx="664.16" cy="358.22" r="34.67" fill-opacity="0.38"/><circle cx="301.83" cy="715.79" r="36.78" fill-opacity="0.395"/><circle cx="430.53" cy="486.09" r="35.05" fill-opacity="0.38"/><circle cx="163.23" cy="438.71" r="35.23" fill-opacity="0.38"/><circle cx="406.39" cy="311.72" r="53.67" fill-opacity="0.763"/><circle cx="510.04" cy="825.92" r="35.51" fill-opacity="0.38"/><circle cx="627.37" cy="810.04" r="40.72" fill-opacity="0.506"/><circle cx="602.09" cy="504.77" r="40.72" fill-opacity="0.506"/><circle cx="378.7" cy="498.09" r="35.67" fill-opacity="0.38"/><circle cx="416.41" cy="476.38" r="35.73" fill-opacity="0.38"/><circle cx="821.18" cy="513.37" r="35.83" fill-opacity="0.38"/><circle cx="648.87" cy="334.74" r="35.92" fill-opacity="0.38"/><circle cx="571.1" cy="218.32" r="37.02" fill-opacity="0.38"/><circle cx="760.51" cy="401.5" r="36.28" fill-opacity="0.38"/><circle cx="615.98" cy="492.28" r="37.53" fill-opacity="0.382"/><circle cx="559.39" cy="499.62" r="36.65" fill-opacity="0.38"/><circle cx="745.34" cy="446.15" r="36.74" fill-opacity="0.38"/><circle cx="273.03" cy="461.79" r="36.91" fill-opacity="0.38"/><circle cx="552.4" cy="494.88" r="61.39" fill-opacity="0.906"/><circle cx="476.36" cy="709.01" r="53.41" fill-opacity="0.769"/><circle cx="748.1" cy="728.2" r="37.99" fill-opacity="0.38"/><circle cx="677.4" cy="358.52" r="43.9" fill-opacity="0.58"/><circle cx="765.03" cy="451.19" r="38.91" fill-opacity="0.38"/><circle cx="536.23" cy="395.23" r="38.94" fill-opacity="0.38"/><circle cx="830.81" cy="520.26" r="65.19" fill-opacity="0.985"/><circle cx="432.85" cy="574.19" r="40.04" fill-opacity="0.38"/><circle cx="411.92" cy="524.99" r="40.82" fill-opacity="0.42"/><circle cx="415.31" cy="559.01" r="46.04" fill-opacity="0.632"/></g></svg> diff --git a/assets/brand/favicon-light.svg b/brand/favicon-light.svg similarity index 99% rename from assets/brand/favicon-light.svg rename to brand/favicon-light.svg index 81c3bf3..ec850fc 100644 --- a/assets/brand/favicon-light.svg +++ b/brand/favicon-light.svg @@ -1 +1 @@ -<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 1024 1024"><defs><linearGradient id="ilightssquircle-g" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#fbf9f4"/><stop offset="1" stop-color="#e9e2d6"/></linearGradient></defs><path d="M1024 512L1023.94 628.21L1023.75 665.32L1023.44 692.28L1023.01 714.2L1022.46 733L1021.78 749.62L1020.97 764.6L1020.04 778.3L1018.99 790.95L1017.81 802.74L1016.5 813.78L1015.06 824.18L1013.5 834.01L1011.81 843.33L1009.99 852.2L1008.04 860.66L1005.96 868.74L1003.74 876.47L1001.39 883.88L998.9 890.99L996.28 897.81L993.52 904.36L990.61 910.67L987.56 916.73L984.37 922.56L981.03 928.18L977.54 933.59L973.9 938.79L970.1 943.8L966.14 948.62L962.01 953.26L957.72 957.72L953.26 962.01L948.62 966.14L943.8 970.1L938.79 973.9L933.59 977.54L928.18 981.03L922.56 984.37L916.73 987.56L910.67 990.61L904.36 993.52L897.81 996.28L890.99 998.9L883.88 1001.39L876.47 1003.74L868.74 1005.96L860.66 1008.04L852.2 1009.99L843.33 1011.81L834.01 1013.5L824.18 1015.06L813.78 1016.5L802.74 1017.81L790.95 1018.99L778.3 1020.04L764.6 1020.97L749.62 1021.78L733 1022.46L714.2 1023.01L692.28 1023.44L665.32 1023.75L628.21 1023.94L512 1024L395.79 1023.94L358.68 1023.75L331.72 1023.44L309.8 1023.01L291 1022.46L274.38 1021.78L259.4 1020.97L245.7 1020.04L233.05 1018.99L221.26 1017.81L210.22 1016.5L199.82 1015.06L189.99 1013.5L180.67 1011.81L171.8 1009.99L163.34 1008.04L155.26 1005.96L147.53 1003.74L140.12 1001.39L133.01 998.9L126.19 996.28L119.64 993.52L113.33 990.61L107.27 987.56L101.44 984.37L95.82 981.03L90.41 977.54L85.21 973.9L80.2 970.1L75.38 966.14L70.74 962.01L66.28 957.72L61.99 953.26L57.86 948.62L53.9 943.8L50.1 938.79L46.46 933.59L42.97 928.18L39.63 922.56L36.44 916.73L33.39 910.67L30.48 904.36L27.72 897.81L25.1 890.99L22.61 883.88L20.26 876.47L18.04 868.74L15.96 860.66L14.01 852.2L12.19 843.33L10.5 834.01L8.94 824.18L7.5 813.78L6.19 802.74L5.01 790.95L3.96 778.3L3.03 764.6L2.22 749.62L1.54 733L0.99 714.2L0.56 692.28L0.25 665.32L0.06 628.21L0 512L0.06 395.79L0.25 358.68L0.56 331.72L0.99 309.8L1.54 291L2.22 274.38L3.03 259.4L3.96 245.7L5.01 233.05L6.19 221.26L7.5 210.22L8.94 199.82L10.5 189.99L12.19 180.67L14.01 171.8L15.96 163.34L18.04 155.26L20.26 147.53L22.61 140.12L25.1 133.01L27.72 126.19L30.48 119.64L33.39 113.33L36.44 107.27L39.63 101.44L42.97 95.82L46.46 90.41L50.1 85.21L53.9 80.2L57.86 75.38L61.99 70.74L66.28 66.28L70.74 61.99L75.38 57.86L80.2 53.9L85.21 50.1L90.41 46.46L95.82 42.97L101.44 39.63L107.27 36.44L113.33 33.39L119.64 30.48L126.19 27.72L133.01 25.1L140.12 22.61L147.53 20.26L155.26 18.04L163.34 15.96L171.8 14.01L180.67 12.19L189.99 10.5L199.82 8.94L210.22 7.5L221.26 6.19L233.05 5.01L245.7 3.96L259.4 3.03L274.38 2.22L291 1.54L309.8 0.99L331.72 0.56L358.68 0.25L395.79 0.06L512 0L628.21 0.06L665.32 0.25L692.28 0.56L714.2 0.99L733 1.54L749.62 2.22L764.6 3.03L778.3 3.96L790.95 5.01L802.74 6.19L813.78 7.5L824.18 8.94L834.01 10.5L843.33 12.19L852.2 14.01L860.66 15.96L868.74 18.04L876.47 20.26L883.88 22.61L890.99 25.1L897.81 27.72L904.36 30.48L910.67 33.39L916.73 36.44L922.56 39.63L928.18 42.97L933.59 46.46L938.79 50.1L943.8 53.9L948.62 57.86L953.26 61.99L957.72 66.28L962.01 70.74L966.14 75.38L970.1 80.2L973.9 85.21L977.54 90.41L981.03 95.82L984.37 101.44L987.56 107.27L990.61 113.33L993.52 119.64L996.28 126.19L998.9 133.01L1001.39 140.12L1003.74 147.53L1005.96 155.26L1008.04 163.34L1009.99 171.8L1011.81 180.67L1013.5 189.99L1015.06 199.82L1016.5 210.22L1017.81 221.26L1018.99 233.05L1020.04 245.7L1020.97 259.4L1021.78 274.38L1022.46 291L1023.01 309.8L1023.44 331.72L1023.75 358.68L1023.94 395.79Z" fill="url(#ilightssquircle-g)"/><path d="M1022.5 512L1022.44 627.87L1022.25 664.87L1021.95 691.75L1021.52 713.61L1020.96 732.36L1020.28 748.92L1019.48 763.86L1018.55 777.52L1017.5 790.13L1016.32 801.88L1015.02 812.89L1013.59 823.26L1012.03 833.06L1010.35 842.36L1008.53 851.21L1006.59 859.64L1004.51 867.7L1002.3 875.41L999.96 882.79L997.48 889.88L994.86 896.68L992.1 903.22L989.21 909.5L986.17 915.54L982.99 921.36L979.66 926.96L976.18 932.35L972.54 937.54L968.75 942.53L964.81 947.34L960.69 951.97L956.42 956.42L951.97 960.69L947.34 964.81L942.53 968.75L937.54 972.54L932.35 976.18L926.96 979.66L921.36 982.99L915.54 986.17L909.5 989.21L903.22 992.1L896.68 994.86L889.88 997.48L882.79 999.96L875.41 1002.3L867.7 1004.51L859.64 1006.59L851.21 1008.53L842.36 1010.35L833.06 1012.03L823.26 1013.59L812.89 1015.02L801.88 1016.32L790.13 1017.5L777.52 1018.55L763.86 1019.48L748.92 1020.28L732.36 1020.96L713.61 1021.52L691.75 1021.95L664.87 1022.25L627.87 1022.44L512 1022.5L396.13 1022.44L359.13 1022.25L332.25 1021.95L310.39 1021.52L291.64 1020.96L275.08 1020.28L260.14 1019.48L246.48 1018.55L233.87 1017.5L222.12 1016.32L211.11 1015.02L200.74 1013.59L190.94 1012.03L181.64 1010.35L172.79 1008.53L164.36 1006.59L156.3 1004.51L148.59 1002.3L141.21 999.96L134.12 997.48L127.32 994.86L120.78 992.1L114.5 989.21L108.46 986.17L102.64 982.99L97.04 979.66L91.65 976.18L86.46 972.54L81.47 968.75L76.66 964.81L72.03 960.69L67.58 956.42L63.31 951.97L59.19 947.34L55.25 942.53L51.46 937.54L47.82 932.35L44.34 926.96L41.01 921.36L37.83 915.54L34.79 909.5L31.9 903.22L29.14 896.68L26.52 889.88L24.04 882.79L21.7 875.41L19.49 867.7L17.41 859.64L15.47 851.21L13.65 842.36L11.97 833.06L10.41 823.26L8.98 812.89L7.68 801.88L6.5 790.13L5.45 777.52L4.52 763.86L3.72 748.92L3.04 732.36L2.48 713.61L2.05 691.75L1.75 664.87L1.56 627.87L1.5 512L1.56 396.13L1.75 359.13L2.05 332.25L2.48 310.39L3.04 291.64L3.72 275.08L4.52 260.14L5.45 246.48L6.5 233.87L7.68 222.12L8.98 211.11L10.41 200.74L11.97 190.94L13.65 181.64L15.47 172.79L17.41 164.36L19.49 156.3L21.7 148.59L24.04 141.21L26.52 134.12L29.14 127.32L31.9 120.78L34.79 114.5L37.83 108.46L41.01 102.64L44.34 97.04L47.82 91.65L51.46 86.46L55.25 81.47L59.19 76.66L63.31 72.03L67.58 67.58L72.03 63.31L76.66 59.19L81.47 55.25L86.46 51.46L91.65 47.82L97.04 44.34L102.64 41.01L108.46 37.83L114.5 34.79L120.78 31.9L127.32 29.14L134.12 26.52L141.21 24.04L148.59 21.7L156.3 19.49L164.36 17.41L172.79 15.47L181.64 13.65L190.94 11.97L200.74 10.41L211.11 8.98L222.12 7.68L233.87 6.5L246.48 5.45L260.14 4.52L275.08 3.72L291.64 3.04L310.39 2.48L332.25 2.05L359.13 1.75L396.13 1.56L512 1.5L627.87 1.56L664.87 1.75L691.75 2.05L713.61 2.48L732.36 3.04L748.92 3.72L763.86 4.52L777.52 5.45L790.13 6.5L801.88 7.68L812.89 8.98L823.26 10.41L833.06 11.97L842.36 13.65L851.21 15.47L859.64 17.41L867.7 19.49L875.41 21.7L882.79 24.04L889.88 26.52L896.68 29.14L903.22 31.9L909.5 34.79L915.54 37.83L921.36 41.01L926.96 44.34L932.35 47.82L937.54 51.46L942.53 55.25L947.34 59.19L951.97 63.31L956.42 67.58L960.69 72.03L964.81 76.66L968.75 81.47L972.54 86.46L976.18 91.65L979.66 97.04L982.99 102.64L986.17 108.46L989.21 114.5L992.1 120.78L994.86 127.32L997.48 134.12L999.96 141.21L1002.3 148.59L1004.51 156.3L1006.59 164.36L1008.53 172.79L1010.35 181.64L1012.03 190.94L1013.59 200.74L1015.02 211.11L1016.32 222.12L1017.5 233.87L1018.55 246.48L1019.48 260.14L1020.28 275.08L1020.96 291.64L1021.52 310.39L1021.95 332.25L1022.25 359.13L1022.44 396.13Z" fill="none" stroke="rgba(0,0,0,0.06)" stroke-width="3"/><g fill="#1c1b19"><circle cx="409.31" cy="456.44" r="22.06" fill-opacity="0.38"/><circle cx="507.3" cy="615.67" r="22.38" fill-opacity="0.38"/><circle cx="502.03" cy="625.96" r="23.6" fill-opacity="0.38"/><circle cx="454.91" cy="510.35" r="28.55" fill-opacity="0.38"/><circle cx="599.75" cy="473.68" r="24.75" fill-opacity="0.38"/><circle cx="651.33" cy="613.43" r="29.8" fill-opacity="0.38"/><circle cx="683.09" cy="483.27" r="25.02" fill-opacity="0.38"/><circle cx="602.89" cy="564.13" r="25.08" fill-opacity="0.38"/><circle cx="711.72" cy="490.7" r="25.58" fill-opacity="0.38"/><circle cx="693.34" cy="490.52" r="26.37" fill-opacity="0.38"/><circle cx="276.7" cy="365.48" r="34.52" fill-opacity="0.393"/><circle cx="330.12" cy="573.82" r="26.09" fill-opacity="0.38"/><circle cx="389.62" cy="299.72" r="26.48" fill-opacity="0.38"/><circle cx="625.71" cy="495.42" r="26.55" fill-opacity="0.38"/><circle cx="787.1" cy="564.95" r="26.76" fill-opacity="0.38"/><circle cx="196.95" cy="551.53" r="38.44" fill-opacity="0.472"/><circle cx="564.53" cy="243.31" r="38.78" fill-opacity="0.479"/><circle cx="283.06" cy="637.7" r="27.54" fill-opacity="0.38"/><circle cx="443.06" cy="747.92" r="27.61" fill-opacity="0.38"/><circle cx="586.26" cy="671.81" r="28.45" fill-opacity="0.38"/><circle cx="468.61" cy="239.16" r="28.01" fill-opacity="0.38"/><circle cx="555.16" cy="690.42" r="42.44" fill-opacity="0.547"/><circle cx="213.4" cy="308.12" r="28.66" fill-opacity="0.38"/><circle cx="528.19" cy="687.52" r="43.2" fill-opacity="0.561"/><circle cx="388.33" cy="675.87" r="29.08" fill-opacity="0.38"/><circle cx="560.27" cy="737.09" r="29.14" fill-opacity="0.38"/><circle cx="728.62" cy="311.15" r="29.54" fill-opacity="0.38"/><circle cx="598.2" cy="335.96" r="31.92" fill-opacity="0.38"/><circle cx="684.81" cy="684.72" r="29.3" fill-opacity="0.38"/><circle cx="249.91" cy="527.03" r="30.43" fill-opacity="0.38"/><circle cx="733.7" cy="552.11" r="29.78" fill-opacity="0.38"/><circle cx="247.99" cy="686.61" r="30.07" fill-opacity="0.38"/><circle cx="267.89" cy="371.33" r="30.91" fill-opacity="0.38"/><circle cx="826.12" cy="312.28" r="32.95" fill-opacity="0.38"/><circle cx="313.54" cy="349.15" r="30.71" fill-opacity="0.38"/><circle cx="410.94" cy="703.54" r="31.49" fill-opacity="0.38"/><circle cx="644.61" cy="292.24" r="30.99" fill-opacity="0.38"/><circle cx="625.91" cy="727.66" r="34.01" fill-opacity="0.38"/><circle cx="728.51" cy="583.69" r="37.8" fill-opacity="0.444"/><circle cx="436.47" cy="522.49" r="32.09" fill-opacity="0.38"/><circle cx="545.89" cy="642.02" r="32.05" fill-opacity="0.38"/><circle cx="414.9" cy="599.65" r="32.33" fill-opacity="0.38"/><circle cx="645.11" cy="833" r="32.44" fill-opacity="0.38"/><circle cx="306.3" cy="359.58" r="32.61" fill-opacity="0.38"/><circle cx="574.75" cy="208.99" r="50.42" fill-opacity="0.696"/><circle cx="230.17" cy="586.91" r="32.79" fill-opacity="0.38"/><circle cx="587.99" cy="798.45" r="32.81" fill-opacity="0.38"/><circle cx="496.98" cy="572.46" r="32.84" fill-opacity="0.38"/><circle cx="259.96" cy="559.6" r="32.89" fill-opacity="0.38"/><circle cx="260.81" cy="677.24" r="33.07" fill-opacity="0.38"/><circle cx="477.62" cy="748.64" r="33.25" fill-opacity="0.38"/><circle cx="204.31" cy="394.8" r="33.44" fill-opacity="0.38"/><circle cx="614.48" cy="694.02" r="33.6" fill-opacity="0.38"/><circle cx="559.64" cy="701.71" r="36.11" fill-opacity="0.39"/><circle cx="514.55" cy="708.21" r="45.19" fill-opacity="0.598"/><circle cx="378.4" cy="497.78" r="34.74" fill-opacity="0.38"/><circle cx="620.15" cy="599.23" r="33.8" fill-opacity="0.38"/><circle cx="374.83" cy="495.3" r="33.85" fill-opacity="0.38"/><circle cx="294.9" cy="241.06" r="33.89" fill-opacity="0.38"/><circle cx="449.87" cy="274.9" r="34.21" fill-opacity="0.38"/><circle cx="279.68" cy="288.74" r="34.76" fill-opacity="0.38"/><circle cx="795.97" cy="739.57" r="34.46" fill-opacity="0.38"/><circle cx="664.16" cy="358.22" r="34.67" fill-opacity="0.38"/><circle cx="301.83" cy="715.79" r="36.78" fill-opacity="0.395"/><circle cx="430.53" cy="486.09" r="35.05" fill-opacity="0.38"/><circle cx="163.23" cy="438.71" r="35.23" fill-opacity="0.38"/><circle cx="406.39" cy="311.72" r="53.67" fill-opacity="0.763"/><circle cx="510.04" cy="825.92" r="35.51" fill-opacity="0.38"/><circle cx="627.37" cy="810.04" r="40.72" fill-opacity="0.506"/><circle cx="602.09" cy="504.77" r="40.72" fill-opacity="0.506"/><circle cx="378.7" cy="498.09" r="35.67" fill-opacity="0.38"/><circle cx="416.41" cy="476.38" r="35.73" fill-opacity="0.38"/><circle cx="821.18" cy="513.37" r="35.83" fill-opacity="0.38"/><circle cx="648.87" cy="334.74" r="35.92" fill-opacity="0.38"/><circle cx="571.1" cy="218.32" r="37.02" fill-opacity="0.38"/><circle cx="760.51" cy="401.5" r="36.28" fill-opacity="0.38"/><circle cx="615.98" cy="492.28" r="37.53" fill-opacity="0.382"/><circle cx="559.39" cy="499.62" r="36.65" fill-opacity="0.38"/><circle cx="745.34" cy="446.15" r="36.74" fill-opacity="0.38"/><circle cx="273.03" cy="461.79" r="36.91" fill-opacity="0.38"/><circle cx="552.4" cy="494.88" r="61.39" fill-opacity="0.906"/><circle cx="476.36" cy="709.01" r="53.41" fill-opacity="0.769"/><circle cx="748.1" cy="728.2" r="37.99" fill-opacity="0.38"/><circle cx="677.4" cy="358.52" r="43.9" fill-opacity="0.58"/><circle cx="765.03" cy="451.19" r="38.91" fill-opacity="0.38"/><circle cx="536.23" cy="395.23" r="38.94" fill-opacity="0.38"/><circle cx="830.81" cy="520.26" r="65.19" fill-opacity="0.985"/><circle cx="432.85" cy="574.19" r="40.04" fill-opacity="0.38"/><circle cx="411.92" cy="524.99" r="40.82" fill-opacity="0.42"/><circle cx="415.31" cy="559.01" r="46.04" fill-opacity="0.632"/></g></svg> \ No newline at end of file +<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 1024 1024"><defs><linearGradient id="ilightssquircle-g" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#fbf9f4"/><stop offset="1" stop-color="#e9e2d6"/></linearGradient></defs><path d="M1024 512L1023.94 628.21L1023.75 665.32L1023.44 692.28L1023.01 714.2L1022.46 733L1021.78 749.62L1020.97 764.6L1020.04 778.3L1018.99 790.95L1017.81 802.74L1016.5 813.78L1015.06 824.18L1013.5 834.01L1011.81 843.33L1009.99 852.2L1008.04 860.66L1005.96 868.74L1003.74 876.47L1001.39 883.88L998.9 890.99L996.28 897.81L993.52 904.36L990.61 910.67L987.56 916.73L984.37 922.56L981.03 928.18L977.54 933.59L973.9 938.79L970.1 943.8L966.14 948.62L962.01 953.26L957.72 957.72L953.26 962.01L948.62 966.14L943.8 970.1L938.79 973.9L933.59 977.54L928.18 981.03L922.56 984.37L916.73 987.56L910.67 990.61L904.36 993.52L897.81 996.28L890.99 998.9L883.88 1001.39L876.47 1003.74L868.74 1005.96L860.66 1008.04L852.2 1009.99L843.33 1011.81L834.01 1013.5L824.18 1015.06L813.78 1016.5L802.74 1017.81L790.95 1018.99L778.3 1020.04L764.6 1020.97L749.62 1021.78L733 1022.46L714.2 1023.01L692.28 1023.44L665.32 1023.75L628.21 1023.94L512 1024L395.79 1023.94L358.68 1023.75L331.72 1023.44L309.8 1023.01L291 1022.46L274.38 1021.78L259.4 1020.97L245.7 1020.04L233.05 1018.99L221.26 1017.81L210.22 1016.5L199.82 1015.06L189.99 1013.5L180.67 1011.81L171.8 1009.99L163.34 1008.04L155.26 1005.96L147.53 1003.74L140.12 1001.39L133.01 998.9L126.19 996.28L119.64 993.52L113.33 990.61L107.27 987.56L101.44 984.37L95.82 981.03L90.41 977.54L85.21 973.9L80.2 970.1L75.38 966.14L70.74 962.01L66.28 957.72L61.99 953.26L57.86 948.62L53.9 943.8L50.1 938.79L46.46 933.59L42.97 928.18L39.63 922.56L36.44 916.73L33.39 910.67L30.48 904.36L27.72 897.81L25.1 890.99L22.61 883.88L20.26 876.47L18.04 868.74L15.96 860.66L14.01 852.2L12.19 843.33L10.5 834.01L8.94 824.18L7.5 813.78L6.19 802.74L5.01 790.95L3.96 778.3L3.03 764.6L2.22 749.62L1.54 733L0.99 714.2L0.56 692.28L0.25 665.32L0.06 628.21L0 512L0.06 395.79L0.25 358.68L0.56 331.72L0.99 309.8L1.54 291L2.22 274.38L3.03 259.4L3.96 245.7L5.01 233.05L6.19 221.26L7.5 210.22L8.94 199.82L10.5 189.99L12.19 180.67L14.01 171.8L15.96 163.34L18.04 155.26L20.26 147.53L22.61 140.12L25.1 133.01L27.72 126.19L30.48 119.64L33.39 113.33L36.44 107.27L39.63 101.44L42.97 95.82L46.46 90.41L50.1 85.21L53.9 80.2L57.86 75.38L61.99 70.74L66.28 66.28L70.74 61.99L75.38 57.86L80.2 53.9L85.21 50.1L90.41 46.46L95.82 42.97L101.44 39.63L107.27 36.44L113.33 33.39L119.64 30.48L126.19 27.72L133.01 25.1L140.12 22.61L147.53 20.26L155.26 18.04L163.34 15.96L171.8 14.01L180.67 12.19L189.99 10.5L199.82 8.94L210.22 7.5L221.26 6.19L233.05 5.01L245.7 3.96L259.4 3.03L274.38 2.22L291 1.54L309.8 0.99L331.72 0.56L358.68 0.25L395.79 0.06L512 0L628.21 0.06L665.32 0.25L692.28 0.56L714.2 0.99L733 1.54L749.62 2.22L764.6 3.03L778.3 3.96L790.95 5.01L802.74 6.19L813.78 7.5L824.18 8.94L834.01 10.5L843.33 12.19L852.2 14.01L860.66 15.96L868.74 18.04L876.47 20.26L883.88 22.61L890.99 25.1L897.81 27.72L904.36 30.48L910.67 33.39L916.73 36.44L922.56 39.63L928.18 42.97L933.59 46.46L938.79 50.1L943.8 53.9L948.62 57.86L953.26 61.99L957.72 66.28L962.01 70.74L966.14 75.38L970.1 80.2L973.9 85.21L977.54 90.41L981.03 95.82L984.37 101.44L987.56 107.27L990.61 113.33L993.52 119.64L996.28 126.19L998.9 133.01L1001.39 140.12L1003.74 147.53L1005.96 155.26L1008.04 163.34L1009.99 171.8L1011.81 180.67L1013.5 189.99L1015.06 199.82L1016.5 210.22L1017.81 221.26L1018.99 233.05L1020.04 245.7L1020.97 259.4L1021.78 274.38L1022.46 291L1023.01 309.8L1023.44 331.72L1023.75 358.68L1023.94 395.79Z" fill="url(#ilightssquircle-g)"/><path d="M1022.5 512L1022.44 627.87L1022.25 664.87L1021.95 691.75L1021.52 713.61L1020.96 732.36L1020.28 748.92L1019.48 763.86L1018.55 777.52L1017.5 790.13L1016.32 801.88L1015.02 812.89L1013.59 823.26L1012.03 833.06L1010.35 842.36L1008.53 851.21L1006.59 859.64L1004.51 867.7L1002.3 875.41L999.96 882.79L997.48 889.88L994.86 896.68L992.1 903.22L989.21 909.5L986.17 915.54L982.99 921.36L979.66 926.96L976.18 932.35L972.54 937.54L968.75 942.53L964.81 947.34L960.69 951.97L956.42 956.42L951.97 960.69L947.34 964.81L942.53 968.75L937.54 972.54L932.35 976.18L926.96 979.66L921.36 982.99L915.54 986.17L909.5 989.21L903.22 992.1L896.68 994.86L889.88 997.48L882.79 999.96L875.41 1002.3L867.7 1004.51L859.64 1006.59L851.21 1008.53L842.36 1010.35L833.06 1012.03L823.26 1013.59L812.89 1015.02L801.88 1016.32L790.13 1017.5L777.52 1018.55L763.86 1019.48L748.92 1020.28L732.36 1020.96L713.61 1021.52L691.75 1021.95L664.87 1022.25L627.87 1022.44L512 1022.5L396.13 1022.44L359.13 1022.25L332.25 1021.95L310.39 1021.52L291.64 1020.96L275.08 1020.28L260.14 1019.48L246.48 1018.55L233.87 1017.5L222.12 1016.32L211.11 1015.02L200.74 1013.59L190.94 1012.03L181.64 1010.35L172.79 1008.53L164.36 1006.59L156.3 1004.51L148.59 1002.3L141.21 999.96L134.12 997.48L127.32 994.86L120.78 992.1L114.5 989.21L108.46 986.17L102.64 982.99L97.04 979.66L91.65 976.18L86.46 972.54L81.47 968.75L76.66 964.81L72.03 960.69L67.58 956.42L63.31 951.97L59.19 947.34L55.25 942.53L51.46 937.54L47.82 932.35L44.34 926.96L41.01 921.36L37.83 915.54L34.79 909.5L31.9 903.22L29.14 896.68L26.52 889.88L24.04 882.79L21.7 875.41L19.49 867.7L17.41 859.64L15.47 851.21L13.65 842.36L11.97 833.06L10.41 823.26L8.98 812.89L7.68 801.88L6.5 790.13L5.45 777.52L4.52 763.86L3.72 748.92L3.04 732.36L2.48 713.61L2.05 691.75L1.75 664.87L1.56 627.87L1.5 512L1.56 396.13L1.75 359.13L2.05 332.25L2.48 310.39L3.04 291.64L3.72 275.08L4.52 260.14L5.45 246.48L6.5 233.87L7.68 222.12L8.98 211.11L10.41 200.74L11.97 190.94L13.65 181.64L15.47 172.79L17.41 164.36L19.49 156.3L21.7 148.59L24.04 141.21L26.52 134.12L29.14 127.32L31.9 120.78L34.79 114.5L37.83 108.46L41.01 102.64L44.34 97.04L47.82 91.65L51.46 86.46L55.25 81.47L59.19 76.66L63.31 72.03L67.58 67.58L72.03 63.31L76.66 59.19L81.47 55.25L86.46 51.46L91.65 47.82L97.04 44.34L102.64 41.01L108.46 37.83L114.5 34.79L120.78 31.9L127.32 29.14L134.12 26.52L141.21 24.04L148.59 21.7L156.3 19.49L164.36 17.41L172.79 15.47L181.64 13.65L190.94 11.97L200.74 10.41L211.11 8.98L222.12 7.68L233.87 6.5L246.48 5.45L260.14 4.52L275.08 3.72L291.64 3.04L310.39 2.48L332.25 2.05L359.13 1.75L396.13 1.56L512 1.5L627.87 1.56L664.87 1.75L691.75 2.05L713.61 2.48L732.36 3.04L748.92 3.72L763.86 4.52L777.52 5.45L790.13 6.5L801.88 7.68L812.89 8.98L823.26 10.41L833.06 11.97L842.36 13.65L851.21 15.47L859.64 17.41L867.7 19.49L875.41 21.7L882.79 24.04L889.88 26.52L896.68 29.14L903.22 31.9L909.5 34.79L915.54 37.83L921.36 41.01L926.96 44.34L932.35 47.82L937.54 51.46L942.53 55.25L947.34 59.19L951.97 63.31L956.42 67.58L960.69 72.03L964.81 76.66L968.75 81.47L972.54 86.46L976.18 91.65L979.66 97.04L982.99 102.64L986.17 108.46L989.21 114.5L992.1 120.78L994.86 127.32L997.48 134.12L999.96 141.21L1002.3 148.59L1004.51 156.3L1006.59 164.36L1008.53 172.79L1010.35 181.64L1012.03 190.94L1013.59 200.74L1015.02 211.11L1016.32 222.12L1017.5 233.87L1018.55 246.48L1019.48 260.14L1020.28 275.08L1020.96 291.64L1021.52 310.39L1021.95 332.25L1022.25 359.13L1022.44 396.13Z" fill="none" stroke="rgba(0,0,0,0.06)" stroke-width="3"/><g fill="#1c1b19"><circle cx="409.31" cy="456.44" r="22.06" fill-opacity="0.38"/><circle cx="507.3" cy="615.67" r="22.38" fill-opacity="0.38"/><circle cx="502.03" cy="625.96" r="23.6" fill-opacity="0.38"/><circle cx="454.91" cy="510.35" r="28.55" fill-opacity="0.38"/><circle cx="599.75" cy="473.68" r="24.75" fill-opacity="0.38"/><circle cx="651.33" cy="613.43" r="29.8" fill-opacity="0.38"/><circle cx="683.09" cy="483.27" r="25.02" fill-opacity="0.38"/><circle cx="602.89" cy="564.13" r="25.08" fill-opacity="0.38"/><circle cx="711.72" cy="490.7" r="25.58" fill-opacity="0.38"/><circle cx="693.34" cy="490.52" r="26.37" fill-opacity="0.38"/><circle cx="276.7" cy="365.48" r="34.52" fill-opacity="0.393"/><circle cx="330.12" cy="573.82" r="26.09" fill-opacity="0.38"/><circle cx="389.62" cy="299.72" r="26.48" fill-opacity="0.38"/><circle cx="625.71" cy="495.42" r="26.55" fill-opacity="0.38"/><circle cx="787.1" cy="564.95" r="26.76" fill-opacity="0.38"/><circle cx="196.95" cy="551.53" r="38.44" fill-opacity="0.472"/><circle cx="564.53" cy="243.31" r="38.78" fill-opacity="0.479"/><circle cx="283.06" cy="637.7" r="27.54" fill-opacity="0.38"/><circle cx="443.06" cy="747.92" r="27.61" fill-opacity="0.38"/><circle cx="586.26" cy="671.81" r="28.45" fill-opacity="0.38"/><circle cx="468.61" cy="239.16" r="28.01" fill-opacity="0.38"/><circle cx="555.16" cy="690.42" r="42.44" fill-opacity="0.547"/><circle cx="213.4" cy="308.12" r="28.66" fill-opacity="0.38"/><circle cx="528.19" cy="687.52" r="43.2" fill-opacity="0.561"/><circle cx="388.33" cy="675.87" r="29.08" fill-opacity="0.38"/><circle cx="560.27" cy="737.09" r="29.14" fill-opacity="0.38"/><circle cx="728.62" cy="311.15" r="29.54" fill-opacity="0.38"/><circle cx="598.2" cy="335.96" r="31.92" fill-opacity="0.38"/><circle cx="684.81" cy="684.72" r="29.3" fill-opacity="0.38"/><circle cx="249.91" cy="527.03" r="30.43" fill-opacity="0.38"/><circle cx="733.7" cy="552.11" r="29.78" fill-opacity="0.38"/><circle cx="247.99" cy="686.61" r="30.07" fill-opacity="0.38"/><circle cx="267.89" cy="371.33" r="30.91" fill-opacity="0.38"/><circle cx="826.12" cy="312.28" r="32.95" fill-opacity="0.38"/><circle cx="313.54" cy="349.15" r="30.71" fill-opacity="0.38"/><circle cx="410.94" cy="703.54" r="31.49" fill-opacity="0.38"/><circle cx="644.61" cy="292.24" r="30.99" fill-opacity="0.38"/><circle cx="625.91" cy="727.66" r="34.01" fill-opacity="0.38"/><circle cx="728.51" cy="583.69" r="37.8" fill-opacity="0.444"/><circle cx="436.47" cy="522.49" r="32.09" fill-opacity="0.38"/><circle cx="545.89" cy="642.02" r="32.05" fill-opacity="0.38"/><circle cx="414.9" cy="599.65" r="32.33" fill-opacity="0.38"/><circle cx="645.11" cy="833" r="32.44" fill-opacity="0.38"/><circle cx="306.3" cy="359.58" r="32.61" fill-opacity="0.38"/><circle cx="574.75" cy="208.99" r="50.42" fill-opacity="0.696"/><circle cx="230.17" cy="586.91" r="32.79" fill-opacity="0.38"/><circle cx="587.99" cy="798.45" r="32.81" fill-opacity="0.38"/><circle cx="496.98" cy="572.46" r="32.84" fill-opacity="0.38"/><circle cx="259.96" cy="559.6" r="32.89" fill-opacity="0.38"/><circle cx="260.81" cy="677.24" r="33.07" fill-opacity="0.38"/><circle cx="477.62" cy="748.64" r="33.25" fill-opacity="0.38"/><circle cx="204.31" cy="394.8" r="33.44" fill-opacity="0.38"/><circle cx="614.48" cy="694.02" r="33.6" fill-opacity="0.38"/><circle cx="559.64" cy="701.71" r="36.11" fill-opacity="0.39"/><circle cx="514.55" cy="708.21" r="45.19" fill-opacity="0.598"/><circle cx="378.4" cy="497.78" r="34.74" fill-opacity="0.38"/><circle cx="620.15" cy="599.23" r="33.8" fill-opacity="0.38"/><circle cx="374.83" cy="495.3" r="33.85" fill-opacity="0.38"/><circle cx="294.9" cy="241.06" r="33.89" fill-opacity="0.38"/><circle cx="449.87" cy="274.9" r="34.21" fill-opacity="0.38"/><circle cx="279.68" cy="288.74" r="34.76" fill-opacity="0.38"/><circle cx="795.97" cy="739.57" r="34.46" fill-opacity="0.38"/><circle cx="664.16" cy="358.22" r="34.67" fill-opacity="0.38"/><circle cx="301.83" cy="715.79" r="36.78" fill-opacity="0.395"/><circle cx="430.53" cy="486.09" r="35.05" fill-opacity="0.38"/><circle cx="163.23" cy="438.71" r="35.23" fill-opacity="0.38"/><circle cx="406.39" cy="311.72" r="53.67" fill-opacity="0.763"/><circle cx="510.04" cy="825.92" r="35.51" fill-opacity="0.38"/><circle cx="627.37" cy="810.04" r="40.72" fill-opacity="0.506"/><circle cx="602.09" cy="504.77" r="40.72" fill-opacity="0.506"/><circle cx="378.7" cy="498.09" r="35.67" fill-opacity="0.38"/><circle cx="416.41" cy="476.38" r="35.73" fill-opacity="0.38"/><circle cx="821.18" cy="513.37" r="35.83" fill-opacity="0.38"/><circle cx="648.87" cy="334.74" r="35.92" fill-opacity="0.38"/><circle cx="571.1" cy="218.32" r="37.02" fill-opacity="0.38"/><circle cx="760.51" cy="401.5" r="36.28" fill-opacity="0.38"/><circle cx="615.98" cy="492.28" r="37.53" fill-opacity="0.382"/><circle cx="559.39" cy="499.62" r="36.65" fill-opacity="0.38"/><circle cx="745.34" cy="446.15" r="36.74" fill-opacity="0.38"/><circle cx="273.03" cy="461.79" r="36.91" fill-opacity="0.38"/><circle cx="552.4" cy="494.88" r="61.39" fill-opacity="0.906"/><circle cx="476.36" cy="709.01" r="53.41" fill-opacity="0.769"/><circle cx="748.1" cy="728.2" r="37.99" fill-opacity="0.38"/><circle cx="677.4" cy="358.52" r="43.9" fill-opacity="0.58"/><circle cx="765.03" cy="451.19" r="38.91" fill-opacity="0.38"/><circle cx="536.23" cy="395.23" r="38.94" fill-opacity="0.38"/><circle cx="830.81" cy="520.26" r="65.19" fill-opacity="0.985"/><circle cx="432.85" cy="574.19" r="40.04" fill-opacity="0.38"/><circle cx="411.92" cy="524.99" r="40.82" fill-opacity="0.42"/><circle cx="415.31" cy="559.01" r="46.04" fill-opacity="0.632"/></g></svg> diff --git a/assets/brand/favicon.ico b/brand/favicon.ico similarity index 100% rename from assets/brand/favicon.ico rename to brand/favicon.ico diff --git a/assets/brand/favicon.svg b/brand/favicon.svg similarity index 99% rename from assets/brand/favicon.svg rename to brand/favicon.svg index f83eefa..9b0f330 100644 --- a/assets/brand/favicon.svg +++ b/brand/favicon.svg @@ -1 +1 @@ -<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 1024 1024"><style>.oq-l{display:none}@media (prefers-color-scheme: light){.oq-d{display:none}.oq-l{display:inline}}</style><g class="oq-d"><defs><linearGradient id="idarkssquircle-g" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#232220"/><stop offset="1" stop-color="#111110"/></linearGradient></defs><path d="M1024 512L1023.94 628.21L1023.75 665.32L1023.44 692.28L1023.01 714.2L1022.46 733L1021.78 749.62L1020.97 764.6L1020.04 778.3L1018.99 790.95L1017.81 802.74L1016.5 813.78L1015.06 824.18L1013.5 834.01L1011.81 843.33L1009.99 852.2L1008.04 860.66L1005.96 868.74L1003.74 876.47L1001.39 883.88L998.9 890.99L996.28 897.81L993.52 904.36L990.61 910.67L987.56 916.73L984.37 922.56L981.03 928.18L977.54 933.59L973.9 938.79L970.1 943.8L966.14 948.62L962.01 953.26L957.72 957.72L953.26 962.01L948.62 966.14L943.8 970.1L938.79 973.9L933.59 977.54L928.18 981.03L922.56 984.37L916.73 987.56L910.67 990.61L904.36 993.52L897.81 996.28L890.99 998.9L883.88 1001.39L876.47 1003.74L868.74 1005.96L860.66 1008.04L852.2 1009.99L843.33 1011.81L834.01 1013.5L824.18 1015.06L813.78 1016.5L802.74 1017.81L790.95 1018.99L778.3 1020.04L764.6 1020.97L749.62 1021.78L733 1022.46L714.2 1023.01L692.28 1023.44L665.32 1023.75L628.21 1023.94L512 1024L395.79 1023.94L358.68 1023.75L331.72 1023.44L309.8 1023.01L291 1022.46L274.38 1021.78L259.4 1020.97L245.7 1020.04L233.05 1018.99L221.26 1017.81L210.22 1016.5L199.82 1015.06L189.99 1013.5L180.67 1011.81L171.8 1009.99L163.34 1008.04L155.26 1005.96L147.53 1003.74L140.12 1001.39L133.01 998.9L126.19 996.28L119.64 993.52L113.33 990.61L107.27 987.56L101.44 984.37L95.82 981.03L90.41 977.54L85.21 973.9L80.2 970.1L75.38 966.14L70.74 962.01L66.28 957.72L61.99 953.26L57.86 948.62L53.9 943.8L50.1 938.79L46.46 933.59L42.97 928.18L39.63 922.56L36.44 916.73L33.39 910.67L30.48 904.36L27.72 897.81L25.1 890.99L22.61 883.88L20.26 876.47L18.04 868.74L15.96 860.66L14.01 852.2L12.19 843.33L10.5 834.01L8.94 824.18L7.5 813.78L6.19 802.74L5.01 790.95L3.96 778.3L3.03 764.6L2.22 749.62L1.54 733L0.99 714.2L0.56 692.28L0.25 665.32L0.06 628.21L0 512L0.06 395.79L0.25 358.68L0.56 331.72L0.99 309.8L1.54 291L2.22 274.38L3.03 259.4L3.96 245.7L5.01 233.05L6.19 221.26L7.5 210.22L8.94 199.82L10.5 189.99L12.19 180.67L14.01 171.8L15.96 163.34L18.04 155.26L20.26 147.53L22.61 140.12L25.1 133.01L27.72 126.19L30.48 119.64L33.39 113.33L36.44 107.27L39.63 101.44L42.97 95.82L46.46 90.41L50.1 85.21L53.9 80.2L57.86 75.38L61.99 70.74L66.28 66.28L70.74 61.99L75.38 57.86L80.2 53.9L85.21 50.1L90.41 46.46L95.82 42.97L101.44 39.63L107.27 36.44L113.33 33.39L119.64 30.48L126.19 27.72L133.01 25.1L140.12 22.61L147.53 20.26L155.26 18.04L163.34 15.96L171.8 14.01L180.67 12.19L189.99 10.5L199.82 8.94L210.22 7.5L221.26 6.19L233.05 5.01L245.7 3.96L259.4 3.03L274.38 2.22L291 1.54L309.8 0.99L331.72 0.56L358.68 0.25L395.79 0.06L512 0L628.21 0.06L665.32 0.25L692.28 0.56L714.2 0.99L733 1.54L749.62 2.22L764.6 3.03L778.3 3.96L790.95 5.01L802.74 6.19L813.78 7.5L824.18 8.94L834.01 10.5L843.33 12.19L852.2 14.01L860.66 15.96L868.74 18.04L876.47 20.26L883.88 22.61L890.99 25.1L897.81 27.72L904.36 30.48L910.67 33.39L916.73 36.44L922.56 39.63L928.18 42.97L933.59 46.46L938.79 50.1L943.8 53.9L948.62 57.86L953.26 61.99L957.72 66.28L962.01 70.74L966.14 75.38L970.1 80.2L973.9 85.21L977.54 90.41L981.03 95.82L984.37 101.44L987.56 107.27L990.61 113.33L993.52 119.64L996.28 126.19L998.9 133.01L1001.39 140.12L1003.74 147.53L1005.96 155.26L1008.04 163.34L1009.99 171.8L1011.81 180.67L1013.5 189.99L1015.06 199.82L1016.5 210.22L1017.81 221.26L1018.99 233.05L1020.04 245.7L1020.97 259.4L1021.78 274.38L1022.46 291L1023.01 309.8L1023.44 331.72L1023.75 358.68L1023.94 395.79Z" fill="url(#idarkssquircle-g)"/><path d="M1022.5 512L1022.44 627.87L1022.25 664.87L1021.95 691.75L1021.52 713.61L1020.96 732.36L1020.28 748.92L1019.48 763.86L1018.55 777.52L1017.5 790.13L1016.32 801.88L1015.02 812.89L1013.59 823.26L1012.03 833.06L1010.35 842.36L1008.53 851.21L1006.59 859.64L1004.51 867.7L1002.3 875.41L999.96 882.79L997.48 889.88L994.86 896.68L992.1 903.22L989.21 909.5L986.17 915.54L982.99 921.36L979.66 926.96L976.18 932.35L972.54 937.54L968.75 942.53L964.81 947.34L960.69 951.97L956.42 956.42L951.97 960.69L947.34 964.81L942.53 968.75L937.54 972.54L932.35 976.18L926.96 979.66L921.36 982.99L915.54 986.17L909.5 989.21L903.22 992.1L896.68 994.86L889.88 997.48L882.79 999.96L875.41 1002.3L867.7 1004.51L859.64 1006.59L851.21 1008.53L842.36 1010.35L833.06 1012.03L823.26 1013.59L812.89 1015.02L801.88 1016.32L790.13 1017.5L777.52 1018.55L763.86 1019.48L748.92 1020.28L732.36 1020.96L713.61 1021.52L691.75 1021.95L664.87 1022.25L627.87 1022.44L512 1022.5L396.13 1022.44L359.13 1022.25L332.25 1021.95L310.39 1021.52L291.64 1020.96L275.08 1020.28L260.14 1019.48L246.48 1018.55L233.87 1017.5L222.12 1016.32L211.11 1015.02L200.74 1013.59L190.94 1012.03L181.64 1010.35L172.79 1008.53L164.36 1006.59L156.3 1004.51L148.59 1002.3L141.21 999.96L134.12 997.48L127.32 994.86L120.78 992.1L114.5 989.21L108.46 986.17L102.64 982.99L97.04 979.66L91.65 976.18L86.46 972.54L81.47 968.75L76.66 964.81L72.03 960.69L67.58 956.42L63.31 951.97L59.19 947.34L55.25 942.53L51.46 937.54L47.82 932.35L44.34 926.96L41.01 921.36L37.83 915.54L34.79 909.5L31.9 903.22L29.14 896.68L26.52 889.88L24.04 882.79L21.7 875.41L19.49 867.7L17.41 859.64L15.47 851.21L13.65 842.36L11.97 833.06L10.41 823.26L8.98 812.89L7.68 801.88L6.5 790.13L5.45 777.52L4.52 763.86L3.72 748.92L3.04 732.36L2.48 713.61L2.05 691.75L1.75 664.87L1.56 627.87L1.5 512L1.56 396.13L1.75 359.13L2.05 332.25L2.48 310.39L3.04 291.64L3.72 275.08L4.52 260.14L5.45 246.48L6.5 233.87L7.68 222.12L8.98 211.11L10.41 200.74L11.97 190.94L13.65 181.64L15.47 172.79L17.41 164.36L19.49 156.3L21.7 148.59L24.04 141.21L26.52 134.12L29.14 127.32L31.9 120.78L34.79 114.5L37.83 108.46L41.01 102.64L44.34 97.04L47.82 91.65L51.46 86.46L55.25 81.47L59.19 76.66L63.31 72.03L67.58 67.58L72.03 63.31L76.66 59.19L81.47 55.25L86.46 51.46L91.65 47.82L97.04 44.34L102.64 41.01L108.46 37.83L114.5 34.79L120.78 31.9L127.32 29.14L134.12 26.52L141.21 24.04L148.59 21.7L156.3 19.49L164.36 17.41L172.79 15.47L181.64 13.65L190.94 11.97L200.74 10.41L211.11 8.98L222.12 7.68L233.87 6.5L246.48 5.45L260.14 4.52L275.08 3.72L291.64 3.04L310.39 2.48L332.25 2.05L359.13 1.75L396.13 1.56L512 1.5L627.87 1.56L664.87 1.75L691.75 2.05L713.61 2.48L732.36 3.04L748.92 3.72L763.86 4.52L777.52 5.45L790.13 6.5L801.88 7.68L812.89 8.98L823.26 10.41L833.06 11.97L842.36 13.65L851.21 15.47L859.64 17.41L867.7 19.49L875.41 21.7L882.79 24.04L889.88 26.52L896.68 29.14L903.22 31.9L909.5 34.79L915.54 37.83L921.36 41.01L926.96 44.34L932.35 47.82L937.54 51.46L942.53 55.25L947.34 59.19L951.97 63.31L956.42 67.58L960.69 72.03L964.81 76.66L968.75 81.47L972.54 86.46L976.18 91.65L979.66 97.04L982.99 102.64L986.17 108.46L989.21 114.5L992.1 120.78L994.86 127.32L997.48 134.12L999.96 141.21L1002.3 148.59L1004.51 156.3L1006.59 164.36L1008.53 172.79L1010.35 181.64L1012.03 190.94L1013.59 200.74L1015.02 211.11L1016.32 222.12L1017.5 233.87L1018.55 246.48L1019.48 260.14L1020.28 275.08L1020.96 291.64L1021.52 310.39L1021.95 332.25L1022.25 359.13L1022.44 396.13Z" fill="none" stroke="rgba(255,255,255,0.07)" stroke-width="3"/><g fill="#f2f1ec"><circle cx="409.31" cy="456.44" r="22.06" fill-opacity="0.38"/><circle cx="507.3" cy="615.67" r="22.38" fill-opacity="0.38"/><circle cx="502.03" cy="625.96" r="23.6" fill-opacity="0.38"/><circle cx="454.91" cy="510.35" r="28.55" fill-opacity="0.38"/><circle cx="599.75" cy="473.68" r="24.75" fill-opacity="0.38"/><circle cx="651.33" cy="613.43" r="29.8" fill-opacity="0.38"/><circle cx="683.09" cy="483.27" r="25.02" fill-opacity="0.38"/><circle cx="602.89" cy="564.13" r="25.08" fill-opacity="0.38"/><circle cx="711.72" cy="490.7" r="25.58" fill-opacity="0.38"/><circle cx="693.34" cy="490.52" r="26.37" fill-opacity="0.38"/><circle cx="276.7" cy="365.48" r="34.52" fill-opacity="0.393"/><circle cx="330.12" cy="573.82" r="26.09" fill-opacity="0.38"/><circle cx="389.62" cy="299.72" r="26.48" fill-opacity="0.38"/><circle cx="625.71" cy="495.42" r="26.55" fill-opacity="0.38"/><circle cx="787.1" cy="564.95" r="26.76" fill-opacity="0.38"/><circle cx="196.95" cy="551.53" r="38.44" fill-opacity="0.472"/><circle cx="564.53" cy="243.31" r="38.78" fill-opacity="0.479"/><circle cx="283.06" cy="637.7" r="27.54" fill-opacity="0.38"/><circle cx="443.06" cy="747.92" r="27.61" fill-opacity="0.38"/><circle cx="586.26" cy="671.81" r="28.45" fill-opacity="0.38"/><circle cx="468.61" cy="239.16" r="28.01" fill-opacity="0.38"/><circle cx="555.16" cy="690.42" r="42.44" fill-opacity="0.547"/><circle cx="213.4" cy="308.12" r="28.66" fill-opacity="0.38"/><circle cx="528.19" cy="687.52" r="43.2" fill-opacity="0.561"/><circle cx="388.33" cy="675.87" r="29.08" fill-opacity="0.38"/><circle cx="560.27" cy="737.09" r="29.14" fill-opacity="0.38"/><circle cx="728.62" cy="311.15" r="29.54" fill-opacity="0.38"/><circle cx="598.2" cy="335.96" r="31.92" fill-opacity="0.38"/><circle cx="684.81" cy="684.72" r="29.3" fill-opacity="0.38"/><circle cx="249.91" cy="527.03" r="30.43" fill-opacity="0.38"/><circle cx="733.7" cy="552.11" r="29.78" fill-opacity="0.38"/><circle cx="247.99" cy="686.61" r="30.07" fill-opacity="0.38"/><circle cx="267.89" cy="371.33" r="30.91" fill-opacity="0.38"/><circle cx="826.12" cy="312.28" r="32.95" fill-opacity="0.38"/><circle cx="313.54" cy="349.15" r="30.71" fill-opacity="0.38"/><circle cx="410.94" cy="703.54" r="31.49" fill-opacity="0.38"/><circle cx="644.61" cy="292.24" r="30.99" fill-opacity="0.38"/><circle cx="625.91" cy="727.66" r="34.01" fill-opacity="0.38"/><circle cx="728.51" cy="583.69" r="37.8" fill-opacity="0.444"/><circle cx="436.47" cy="522.49" r="32.09" fill-opacity="0.38"/><circle cx="545.89" cy="642.02" r="32.05" fill-opacity="0.38"/><circle cx="414.9" cy="599.65" r="32.33" fill-opacity="0.38"/><circle cx="645.11" cy="833" r="32.44" fill-opacity="0.38"/><circle cx="306.3" cy="359.58" r="32.61" fill-opacity="0.38"/><circle cx="574.75" cy="208.99" r="50.42" fill-opacity="0.696"/><circle cx="230.17" cy="586.91" r="32.79" fill-opacity="0.38"/><circle cx="587.99" cy="798.45" r="32.81" fill-opacity="0.38"/><circle cx="496.98" cy="572.46" r="32.84" fill-opacity="0.38"/><circle cx="259.96" cy="559.6" r="32.89" fill-opacity="0.38"/><circle cx="260.81" cy="677.24" r="33.07" fill-opacity="0.38"/><circle cx="477.62" cy="748.64" r="33.25" fill-opacity="0.38"/><circle cx="204.31" cy="394.8" r="33.44" fill-opacity="0.38"/><circle cx="614.48" cy="694.02" r="33.6" fill-opacity="0.38"/><circle cx="559.64" cy="701.71" r="36.11" fill-opacity="0.39"/><circle cx="514.55" cy="708.21" r="45.19" fill-opacity="0.598"/><circle cx="378.4" cy="497.78" r="34.74" fill-opacity="0.38"/><circle cx="620.15" cy="599.23" r="33.8" fill-opacity="0.38"/><circle cx="374.83" cy="495.3" r="33.85" fill-opacity="0.38"/><circle cx="294.9" cy="241.06" r="33.89" fill-opacity="0.38"/><circle cx="449.87" cy="274.9" r="34.21" fill-opacity="0.38"/><circle cx="279.68" cy="288.74" r="34.76" fill-opacity="0.38"/><circle cx="795.97" cy="739.57" r="34.46" fill-opacity="0.38"/><circle cx="664.16" cy="358.22" r="34.67" fill-opacity="0.38"/><circle cx="301.83" cy="715.79" r="36.78" fill-opacity="0.395"/><circle cx="430.53" cy="486.09" r="35.05" fill-opacity="0.38"/><circle cx="163.23" cy="438.71" r="35.23" fill-opacity="0.38"/><circle cx="406.39" cy="311.72" r="53.67" fill-opacity="0.763"/><circle cx="510.04" cy="825.92" r="35.51" fill-opacity="0.38"/><circle cx="627.37" cy="810.04" r="40.72" fill-opacity="0.506"/><circle cx="602.09" cy="504.77" r="40.72" fill-opacity="0.506"/><circle cx="378.7" cy="498.09" r="35.67" fill-opacity="0.38"/><circle cx="416.41" cy="476.38" r="35.73" fill-opacity="0.38"/><circle cx="821.18" cy="513.37" r="35.83" fill-opacity="0.38"/><circle cx="648.87" cy="334.74" r="35.92" fill-opacity="0.38"/><circle cx="571.1" cy="218.32" r="37.02" fill-opacity="0.38"/><circle cx="760.51" cy="401.5" r="36.28" fill-opacity="0.38"/><circle cx="615.98" cy="492.28" r="37.53" fill-opacity="0.382"/><circle cx="559.39" cy="499.62" r="36.65" fill-opacity="0.38"/><circle cx="745.34" cy="446.15" r="36.74" fill-opacity="0.38"/><circle cx="273.03" cy="461.79" r="36.91" fill-opacity="0.38"/><circle cx="552.4" cy="494.88" r="61.39" fill-opacity="0.906"/><circle cx="476.36" cy="709.01" r="53.41" fill-opacity="0.769"/><circle cx="748.1" cy="728.2" r="37.99" fill-opacity="0.38"/><circle cx="677.4" cy="358.52" r="43.9" fill-opacity="0.58"/><circle cx="765.03" cy="451.19" r="38.91" fill-opacity="0.38"/><circle cx="536.23" cy="395.23" r="38.94" fill-opacity="0.38"/><circle cx="830.81" cy="520.26" r="65.19" fill-opacity="0.985"/><circle cx="432.85" cy="574.19" r="40.04" fill-opacity="0.38"/><circle cx="411.92" cy="524.99" r="40.82" fill-opacity="0.42"/><circle cx="415.31" cy="559.01" r="46.04" fill-opacity="0.632"/></g></g><g class="oq-l"><defs><linearGradient id="ilightssquircle-g" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#fbf9f4"/><stop offset="1" stop-color="#e9e2d6"/></linearGradient></defs><path d="M1024 512L1023.94 628.21L1023.75 665.32L1023.44 692.28L1023.01 714.2L1022.46 733L1021.78 749.62L1020.97 764.6L1020.04 778.3L1018.99 790.95L1017.81 802.74L1016.5 813.78L1015.06 824.18L1013.5 834.01L1011.81 843.33L1009.99 852.2L1008.04 860.66L1005.96 868.74L1003.74 876.47L1001.39 883.88L998.9 890.99L996.28 897.81L993.52 904.36L990.61 910.67L987.56 916.73L984.37 922.56L981.03 928.18L977.54 933.59L973.9 938.79L970.1 943.8L966.14 948.62L962.01 953.26L957.72 957.72L953.26 962.01L948.62 966.14L943.8 970.1L938.79 973.9L933.59 977.54L928.18 981.03L922.56 984.37L916.73 987.56L910.67 990.61L904.36 993.52L897.81 996.28L890.99 998.9L883.88 1001.39L876.47 1003.74L868.74 1005.96L860.66 1008.04L852.2 1009.99L843.33 1011.81L834.01 1013.5L824.18 1015.06L813.78 1016.5L802.74 1017.81L790.95 1018.99L778.3 1020.04L764.6 1020.97L749.62 1021.78L733 1022.46L714.2 1023.01L692.28 1023.44L665.32 1023.75L628.21 1023.94L512 1024L395.79 1023.94L358.68 1023.75L331.72 1023.44L309.8 1023.01L291 1022.46L274.38 1021.78L259.4 1020.97L245.7 1020.04L233.05 1018.99L221.26 1017.81L210.22 1016.5L199.82 1015.06L189.99 1013.5L180.67 1011.81L171.8 1009.99L163.34 1008.04L155.26 1005.96L147.53 1003.74L140.12 1001.39L133.01 998.9L126.19 996.28L119.64 993.52L113.33 990.61L107.27 987.56L101.44 984.37L95.82 981.03L90.41 977.54L85.21 973.9L80.2 970.1L75.38 966.14L70.74 962.01L66.28 957.72L61.99 953.26L57.86 948.62L53.9 943.8L50.1 938.79L46.46 933.59L42.97 928.18L39.63 922.56L36.44 916.73L33.39 910.67L30.48 904.36L27.72 897.81L25.1 890.99L22.61 883.88L20.26 876.47L18.04 868.74L15.96 860.66L14.01 852.2L12.19 843.33L10.5 834.01L8.94 824.18L7.5 813.78L6.19 802.74L5.01 790.95L3.96 778.3L3.03 764.6L2.22 749.62L1.54 733L0.99 714.2L0.56 692.28L0.25 665.32L0.06 628.21L0 512L0.06 395.79L0.25 358.68L0.56 331.72L0.99 309.8L1.54 291L2.22 274.38L3.03 259.4L3.96 245.7L5.01 233.05L6.19 221.26L7.5 210.22L8.94 199.82L10.5 189.99L12.19 180.67L14.01 171.8L15.96 163.34L18.04 155.26L20.26 147.53L22.61 140.12L25.1 133.01L27.72 126.19L30.48 119.64L33.39 113.33L36.44 107.27L39.63 101.44L42.97 95.82L46.46 90.41L50.1 85.21L53.9 80.2L57.86 75.38L61.99 70.74L66.28 66.28L70.74 61.99L75.38 57.86L80.2 53.9L85.21 50.1L90.41 46.46L95.82 42.97L101.44 39.63L107.27 36.44L113.33 33.39L119.64 30.48L126.19 27.72L133.01 25.1L140.12 22.61L147.53 20.26L155.26 18.04L163.34 15.96L171.8 14.01L180.67 12.19L189.99 10.5L199.82 8.94L210.22 7.5L221.26 6.19L233.05 5.01L245.7 3.96L259.4 3.03L274.38 2.22L291 1.54L309.8 0.99L331.72 0.56L358.68 0.25L395.79 0.06L512 0L628.21 0.06L665.32 0.25L692.28 0.56L714.2 0.99L733 1.54L749.62 2.22L764.6 3.03L778.3 3.96L790.95 5.01L802.74 6.19L813.78 7.5L824.18 8.94L834.01 10.5L843.33 12.19L852.2 14.01L860.66 15.96L868.74 18.04L876.47 20.26L883.88 22.61L890.99 25.1L897.81 27.72L904.36 30.48L910.67 33.39L916.73 36.44L922.56 39.63L928.18 42.97L933.59 46.46L938.79 50.1L943.8 53.9L948.62 57.86L953.26 61.99L957.72 66.28L962.01 70.74L966.14 75.38L970.1 80.2L973.9 85.21L977.54 90.41L981.03 95.82L984.37 101.44L987.56 107.27L990.61 113.33L993.52 119.64L996.28 126.19L998.9 133.01L1001.39 140.12L1003.74 147.53L1005.96 155.26L1008.04 163.34L1009.99 171.8L1011.81 180.67L1013.5 189.99L1015.06 199.82L1016.5 210.22L1017.81 221.26L1018.99 233.05L1020.04 245.7L1020.97 259.4L1021.78 274.38L1022.46 291L1023.01 309.8L1023.44 331.72L1023.75 358.68L1023.94 395.79Z" fill="url(#ilightssquircle-g)"/><path d="M1022.5 512L1022.44 627.87L1022.25 664.87L1021.95 691.75L1021.52 713.61L1020.96 732.36L1020.28 748.92L1019.48 763.86L1018.55 777.52L1017.5 790.13L1016.32 801.88L1015.02 812.89L1013.59 823.26L1012.03 833.06L1010.35 842.36L1008.53 851.21L1006.59 859.64L1004.51 867.7L1002.3 875.41L999.96 882.79L997.48 889.88L994.86 896.68L992.1 903.22L989.21 909.5L986.17 915.54L982.99 921.36L979.66 926.96L976.18 932.35L972.54 937.54L968.75 942.53L964.81 947.34L960.69 951.97L956.42 956.42L951.97 960.69L947.34 964.81L942.53 968.75L937.54 972.54L932.35 976.18L926.96 979.66L921.36 982.99L915.54 986.17L909.5 989.21L903.22 992.1L896.68 994.86L889.88 997.48L882.79 999.96L875.41 1002.3L867.7 1004.51L859.64 1006.59L851.21 1008.53L842.36 1010.35L833.06 1012.03L823.26 1013.59L812.89 1015.02L801.88 1016.32L790.13 1017.5L777.52 1018.55L763.86 1019.48L748.92 1020.28L732.36 1020.96L713.61 1021.52L691.75 1021.95L664.87 1022.25L627.87 1022.44L512 1022.5L396.13 1022.44L359.13 1022.25L332.25 1021.95L310.39 1021.52L291.64 1020.96L275.08 1020.28L260.14 1019.48L246.48 1018.55L233.87 1017.5L222.12 1016.32L211.11 1015.02L200.74 1013.59L190.94 1012.03L181.64 1010.35L172.79 1008.53L164.36 1006.59L156.3 1004.51L148.59 1002.3L141.21 999.96L134.12 997.48L127.32 994.86L120.78 992.1L114.5 989.21L108.46 986.17L102.64 982.99L97.04 979.66L91.65 976.18L86.46 972.54L81.47 968.75L76.66 964.81L72.03 960.69L67.58 956.42L63.31 951.97L59.19 947.34L55.25 942.53L51.46 937.54L47.82 932.35L44.34 926.96L41.01 921.36L37.83 915.54L34.79 909.5L31.9 903.22L29.14 896.68L26.52 889.88L24.04 882.79L21.7 875.41L19.49 867.7L17.41 859.64L15.47 851.21L13.65 842.36L11.97 833.06L10.41 823.26L8.98 812.89L7.68 801.88L6.5 790.13L5.45 777.52L4.52 763.86L3.72 748.92L3.04 732.36L2.48 713.61L2.05 691.75L1.75 664.87L1.56 627.87L1.5 512L1.56 396.13L1.75 359.13L2.05 332.25L2.48 310.39L3.04 291.64L3.72 275.08L4.52 260.14L5.45 246.48L6.5 233.87L7.68 222.12L8.98 211.11L10.41 200.74L11.97 190.94L13.65 181.64L15.47 172.79L17.41 164.36L19.49 156.3L21.7 148.59L24.04 141.21L26.52 134.12L29.14 127.32L31.9 120.78L34.79 114.5L37.83 108.46L41.01 102.64L44.34 97.04L47.82 91.65L51.46 86.46L55.25 81.47L59.19 76.66L63.31 72.03L67.58 67.58L72.03 63.31L76.66 59.19L81.47 55.25L86.46 51.46L91.65 47.82L97.04 44.34L102.64 41.01L108.46 37.83L114.5 34.79L120.78 31.9L127.32 29.14L134.12 26.52L141.21 24.04L148.59 21.7L156.3 19.49L164.36 17.41L172.79 15.47L181.64 13.65L190.94 11.97L200.74 10.41L211.11 8.98L222.12 7.68L233.87 6.5L246.48 5.45L260.14 4.52L275.08 3.72L291.64 3.04L310.39 2.48L332.25 2.05L359.13 1.75L396.13 1.56L512 1.5L627.87 1.56L664.87 1.75L691.75 2.05L713.61 2.48L732.36 3.04L748.92 3.72L763.86 4.52L777.52 5.45L790.13 6.5L801.88 7.68L812.89 8.98L823.26 10.41L833.06 11.97L842.36 13.65L851.21 15.47L859.64 17.41L867.7 19.49L875.41 21.7L882.79 24.04L889.88 26.52L896.68 29.14L903.22 31.9L909.5 34.79L915.54 37.83L921.36 41.01L926.96 44.34L932.35 47.82L937.54 51.46L942.53 55.25L947.34 59.19L951.97 63.31L956.42 67.58L960.69 72.03L964.81 76.66L968.75 81.47L972.54 86.46L976.18 91.65L979.66 97.04L982.99 102.64L986.17 108.46L989.21 114.5L992.1 120.78L994.86 127.32L997.48 134.12L999.96 141.21L1002.3 148.59L1004.51 156.3L1006.59 164.36L1008.53 172.79L1010.35 181.64L1012.03 190.94L1013.59 200.74L1015.02 211.11L1016.32 222.12L1017.5 233.87L1018.55 246.48L1019.48 260.14L1020.28 275.08L1020.96 291.64L1021.52 310.39L1021.95 332.25L1022.25 359.13L1022.44 396.13Z" fill="none" stroke="rgba(0,0,0,0.06)" stroke-width="3"/><g fill="#1c1b19"><circle cx="409.31" cy="456.44" r="22.06" fill-opacity="0.38"/><circle cx="507.3" cy="615.67" r="22.38" fill-opacity="0.38"/><circle cx="502.03" cy="625.96" r="23.6" fill-opacity="0.38"/><circle cx="454.91" cy="510.35" r="28.55" fill-opacity="0.38"/><circle cx="599.75" cy="473.68" r="24.75" fill-opacity="0.38"/><circle cx="651.33" cy="613.43" r="29.8" fill-opacity="0.38"/><circle cx="683.09" cy="483.27" r="25.02" fill-opacity="0.38"/><circle cx="602.89" cy="564.13" r="25.08" fill-opacity="0.38"/><circle cx="711.72" cy="490.7" r="25.58" fill-opacity="0.38"/><circle cx="693.34" cy="490.52" r="26.37" fill-opacity="0.38"/><circle cx="276.7" cy="365.48" r="34.52" fill-opacity="0.393"/><circle cx="330.12" cy="573.82" r="26.09" fill-opacity="0.38"/><circle cx="389.62" cy="299.72" r="26.48" fill-opacity="0.38"/><circle cx="625.71" cy="495.42" r="26.55" fill-opacity="0.38"/><circle cx="787.1" cy="564.95" r="26.76" fill-opacity="0.38"/><circle cx="196.95" cy="551.53" r="38.44" fill-opacity="0.472"/><circle cx="564.53" cy="243.31" r="38.78" fill-opacity="0.479"/><circle cx="283.06" cy="637.7" r="27.54" fill-opacity="0.38"/><circle cx="443.06" cy="747.92" r="27.61" fill-opacity="0.38"/><circle cx="586.26" cy="671.81" r="28.45" fill-opacity="0.38"/><circle cx="468.61" cy="239.16" r="28.01" fill-opacity="0.38"/><circle cx="555.16" cy="690.42" r="42.44" fill-opacity="0.547"/><circle cx="213.4" cy="308.12" r="28.66" fill-opacity="0.38"/><circle cx="528.19" cy="687.52" r="43.2" fill-opacity="0.561"/><circle cx="388.33" cy="675.87" r="29.08" fill-opacity="0.38"/><circle cx="560.27" cy="737.09" r="29.14" fill-opacity="0.38"/><circle cx="728.62" cy="311.15" r="29.54" fill-opacity="0.38"/><circle cx="598.2" cy="335.96" r="31.92" fill-opacity="0.38"/><circle cx="684.81" cy="684.72" r="29.3" fill-opacity="0.38"/><circle cx="249.91" cy="527.03" r="30.43" fill-opacity="0.38"/><circle cx="733.7" cy="552.11" r="29.78" fill-opacity="0.38"/><circle cx="247.99" cy="686.61" r="30.07" fill-opacity="0.38"/><circle cx="267.89" cy="371.33" r="30.91" fill-opacity="0.38"/><circle cx="826.12" cy="312.28" r="32.95" fill-opacity="0.38"/><circle cx="313.54" cy="349.15" r="30.71" fill-opacity="0.38"/><circle cx="410.94" cy="703.54" r="31.49" fill-opacity="0.38"/><circle cx="644.61" cy="292.24" r="30.99" fill-opacity="0.38"/><circle cx="625.91" cy="727.66" r="34.01" fill-opacity="0.38"/><circle cx="728.51" cy="583.69" r="37.8" fill-opacity="0.444"/><circle cx="436.47" cy="522.49" r="32.09" fill-opacity="0.38"/><circle cx="545.89" cy="642.02" r="32.05" fill-opacity="0.38"/><circle cx="414.9" cy="599.65" r="32.33" fill-opacity="0.38"/><circle cx="645.11" cy="833" r="32.44" fill-opacity="0.38"/><circle cx="306.3" cy="359.58" r="32.61" fill-opacity="0.38"/><circle cx="574.75" cy="208.99" r="50.42" fill-opacity="0.696"/><circle cx="230.17" cy="586.91" r="32.79" fill-opacity="0.38"/><circle cx="587.99" cy="798.45" r="32.81" fill-opacity="0.38"/><circle cx="496.98" cy="572.46" r="32.84" fill-opacity="0.38"/><circle cx="259.96" cy="559.6" r="32.89" fill-opacity="0.38"/><circle cx="260.81" cy="677.24" r="33.07" fill-opacity="0.38"/><circle cx="477.62" cy="748.64" r="33.25" fill-opacity="0.38"/><circle cx="204.31" cy="394.8" r="33.44" fill-opacity="0.38"/><circle cx="614.48" cy="694.02" r="33.6" fill-opacity="0.38"/><circle cx="559.64" cy="701.71" r="36.11" fill-opacity="0.39"/><circle cx="514.55" cy="708.21" r="45.19" fill-opacity="0.598"/><circle cx="378.4" cy="497.78" r="34.74" fill-opacity="0.38"/><circle cx="620.15" cy="599.23" r="33.8" fill-opacity="0.38"/><circle cx="374.83" cy="495.3" r="33.85" fill-opacity="0.38"/><circle cx="294.9" cy="241.06" r="33.89" fill-opacity="0.38"/><circle cx="449.87" cy="274.9" r="34.21" fill-opacity="0.38"/><circle cx="279.68" cy="288.74" r="34.76" fill-opacity="0.38"/><circle cx="795.97" cy="739.57" r="34.46" fill-opacity="0.38"/><circle cx="664.16" cy="358.22" r="34.67" fill-opacity="0.38"/><circle cx="301.83" cy="715.79" r="36.78" fill-opacity="0.395"/><circle cx="430.53" cy="486.09" r="35.05" fill-opacity="0.38"/><circle cx="163.23" cy="438.71" r="35.23" fill-opacity="0.38"/><circle cx="406.39" cy="311.72" r="53.67" fill-opacity="0.763"/><circle cx="510.04" cy="825.92" r="35.51" fill-opacity="0.38"/><circle cx="627.37" cy="810.04" r="40.72" fill-opacity="0.506"/><circle cx="602.09" cy="504.77" r="40.72" fill-opacity="0.506"/><circle cx="378.7" cy="498.09" r="35.67" fill-opacity="0.38"/><circle cx="416.41" cy="476.38" r="35.73" fill-opacity="0.38"/><circle cx="821.18" cy="513.37" r="35.83" fill-opacity="0.38"/><circle cx="648.87" cy="334.74" r="35.92" fill-opacity="0.38"/><circle cx="571.1" cy="218.32" r="37.02" fill-opacity="0.38"/><circle cx="760.51" cy="401.5" r="36.28" fill-opacity="0.38"/><circle cx="615.98" cy="492.28" r="37.53" fill-opacity="0.382"/><circle cx="559.39" cy="499.62" r="36.65" fill-opacity="0.38"/><circle cx="745.34" cy="446.15" r="36.74" fill-opacity="0.38"/><circle cx="273.03" cy="461.79" r="36.91" fill-opacity="0.38"/><circle cx="552.4" cy="494.88" r="61.39" fill-opacity="0.906"/><circle cx="476.36" cy="709.01" r="53.41" fill-opacity="0.769"/><circle cx="748.1" cy="728.2" r="37.99" fill-opacity="0.38"/><circle cx="677.4" cy="358.52" r="43.9" fill-opacity="0.58"/><circle cx="765.03" cy="451.19" r="38.91" fill-opacity="0.38"/><circle cx="536.23" cy="395.23" r="38.94" fill-opacity="0.38"/><circle cx="830.81" cy="520.26" r="65.19" fill-opacity="0.985"/><circle cx="432.85" cy="574.19" r="40.04" fill-opacity="0.38"/><circle cx="411.92" cy="524.99" r="40.82" fill-opacity="0.42"/><circle cx="415.31" cy="559.01" r="46.04" fill-opacity="0.632"/></g></g></svg> \ No newline at end of file +<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 1024 1024"><style>.oq-l{display:none}@media (prefers-color-scheme: light){.oq-d{display:none}.oq-l{display:inline}}</style><g class="oq-d"><defs><linearGradient id="idarkssquircle-g" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#232220"/><stop offset="1" stop-color="#111110"/></linearGradient></defs><path d="M1024 512L1023.94 628.21L1023.75 665.32L1023.44 692.28L1023.01 714.2L1022.46 733L1021.78 749.62L1020.97 764.6L1020.04 778.3L1018.99 790.95L1017.81 802.74L1016.5 813.78L1015.06 824.18L1013.5 834.01L1011.81 843.33L1009.99 852.2L1008.04 860.66L1005.96 868.74L1003.74 876.47L1001.39 883.88L998.9 890.99L996.28 897.81L993.52 904.36L990.61 910.67L987.56 916.73L984.37 922.56L981.03 928.18L977.54 933.59L973.9 938.79L970.1 943.8L966.14 948.62L962.01 953.26L957.72 957.72L953.26 962.01L948.62 966.14L943.8 970.1L938.79 973.9L933.59 977.54L928.18 981.03L922.56 984.37L916.73 987.56L910.67 990.61L904.36 993.52L897.81 996.28L890.99 998.9L883.88 1001.39L876.47 1003.74L868.74 1005.96L860.66 1008.04L852.2 1009.99L843.33 1011.81L834.01 1013.5L824.18 1015.06L813.78 1016.5L802.74 1017.81L790.95 1018.99L778.3 1020.04L764.6 1020.97L749.62 1021.78L733 1022.46L714.2 1023.01L692.28 1023.44L665.32 1023.75L628.21 1023.94L512 1024L395.79 1023.94L358.68 1023.75L331.72 1023.44L309.8 1023.01L291 1022.46L274.38 1021.78L259.4 1020.97L245.7 1020.04L233.05 1018.99L221.26 1017.81L210.22 1016.5L199.82 1015.06L189.99 1013.5L180.67 1011.81L171.8 1009.99L163.34 1008.04L155.26 1005.96L147.53 1003.74L140.12 1001.39L133.01 998.9L126.19 996.28L119.64 993.52L113.33 990.61L107.27 987.56L101.44 984.37L95.82 981.03L90.41 977.54L85.21 973.9L80.2 970.1L75.38 966.14L70.74 962.01L66.28 957.72L61.99 953.26L57.86 948.62L53.9 943.8L50.1 938.79L46.46 933.59L42.97 928.18L39.63 922.56L36.44 916.73L33.39 910.67L30.48 904.36L27.72 897.81L25.1 890.99L22.61 883.88L20.26 876.47L18.04 868.74L15.96 860.66L14.01 852.2L12.19 843.33L10.5 834.01L8.94 824.18L7.5 813.78L6.19 802.74L5.01 790.95L3.96 778.3L3.03 764.6L2.22 749.62L1.54 733L0.99 714.2L0.56 692.28L0.25 665.32L0.06 628.21L0 512L0.06 395.79L0.25 358.68L0.56 331.72L0.99 309.8L1.54 291L2.22 274.38L3.03 259.4L3.96 245.7L5.01 233.05L6.19 221.26L7.5 210.22L8.94 199.82L10.5 189.99L12.19 180.67L14.01 171.8L15.96 163.34L18.04 155.26L20.26 147.53L22.61 140.12L25.1 133.01L27.72 126.19L30.48 119.64L33.39 113.33L36.44 107.27L39.63 101.44L42.97 95.82L46.46 90.41L50.1 85.21L53.9 80.2L57.86 75.38L61.99 70.74L66.28 66.28L70.74 61.99L75.38 57.86L80.2 53.9L85.21 50.1L90.41 46.46L95.82 42.97L101.44 39.63L107.27 36.44L113.33 33.39L119.64 30.48L126.19 27.72L133.01 25.1L140.12 22.61L147.53 20.26L155.26 18.04L163.34 15.96L171.8 14.01L180.67 12.19L189.99 10.5L199.82 8.94L210.22 7.5L221.26 6.19L233.05 5.01L245.7 3.96L259.4 3.03L274.38 2.22L291 1.54L309.8 0.99L331.72 0.56L358.68 0.25L395.79 0.06L512 0L628.21 0.06L665.32 0.25L692.28 0.56L714.2 0.99L733 1.54L749.62 2.22L764.6 3.03L778.3 3.96L790.95 5.01L802.74 6.19L813.78 7.5L824.18 8.94L834.01 10.5L843.33 12.19L852.2 14.01L860.66 15.96L868.74 18.04L876.47 20.26L883.88 22.61L890.99 25.1L897.81 27.72L904.36 30.48L910.67 33.39L916.73 36.44L922.56 39.63L928.18 42.97L933.59 46.46L938.79 50.1L943.8 53.9L948.62 57.86L953.26 61.99L957.72 66.28L962.01 70.74L966.14 75.38L970.1 80.2L973.9 85.21L977.54 90.41L981.03 95.82L984.37 101.44L987.56 107.27L990.61 113.33L993.52 119.64L996.28 126.19L998.9 133.01L1001.39 140.12L1003.74 147.53L1005.96 155.26L1008.04 163.34L1009.99 171.8L1011.81 180.67L1013.5 189.99L1015.06 199.82L1016.5 210.22L1017.81 221.26L1018.99 233.05L1020.04 245.7L1020.97 259.4L1021.78 274.38L1022.46 291L1023.01 309.8L1023.44 331.72L1023.75 358.68L1023.94 395.79Z" fill="url(#idarkssquircle-g)"/><path d="M1022.5 512L1022.44 627.87L1022.25 664.87L1021.95 691.75L1021.52 713.61L1020.96 732.36L1020.28 748.92L1019.48 763.86L1018.55 777.52L1017.5 790.13L1016.32 801.88L1015.02 812.89L1013.59 823.26L1012.03 833.06L1010.35 842.36L1008.53 851.21L1006.59 859.64L1004.51 867.7L1002.3 875.41L999.96 882.79L997.48 889.88L994.86 896.68L992.1 903.22L989.21 909.5L986.17 915.54L982.99 921.36L979.66 926.96L976.18 932.35L972.54 937.54L968.75 942.53L964.81 947.34L960.69 951.97L956.42 956.42L951.97 960.69L947.34 964.81L942.53 968.75L937.54 972.54L932.35 976.18L926.96 979.66L921.36 982.99L915.54 986.17L909.5 989.21L903.22 992.1L896.68 994.86L889.88 997.48L882.79 999.96L875.41 1002.3L867.7 1004.51L859.64 1006.59L851.21 1008.53L842.36 1010.35L833.06 1012.03L823.26 1013.59L812.89 1015.02L801.88 1016.32L790.13 1017.5L777.52 1018.55L763.86 1019.48L748.92 1020.28L732.36 1020.96L713.61 1021.52L691.75 1021.95L664.87 1022.25L627.87 1022.44L512 1022.5L396.13 1022.44L359.13 1022.25L332.25 1021.95L310.39 1021.52L291.64 1020.96L275.08 1020.28L260.14 1019.48L246.48 1018.55L233.87 1017.5L222.12 1016.32L211.11 1015.02L200.74 1013.59L190.94 1012.03L181.64 1010.35L172.79 1008.53L164.36 1006.59L156.3 1004.51L148.59 1002.3L141.21 999.96L134.12 997.48L127.32 994.86L120.78 992.1L114.5 989.21L108.46 986.17L102.64 982.99L97.04 979.66L91.65 976.18L86.46 972.54L81.47 968.75L76.66 964.81L72.03 960.69L67.58 956.42L63.31 951.97L59.19 947.34L55.25 942.53L51.46 937.54L47.82 932.35L44.34 926.96L41.01 921.36L37.83 915.54L34.79 909.5L31.9 903.22L29.14 896.68L26.52 889.88L24.04 882.79L21.7 875.41L19.49 867.7L17.41 859.64L15.47 851.21L13.65 842.36L11.97 833.06L10.41 823.26L8.98 812.89L7.68 801.88L6.5 790.13L5.45 777.52L4.52 763.86L3.72 748.92L3.04 732.36L2.48 713.61L2.05 691.75L1.75 664.87L1.56 627.87L1.5 512L1.56 396.13L1.75 359.13L2.05 332.25L2.48 310.39L3.04 291.64L3.72 275.08L4.52 260.14L5.45 246.48L6.5 233.87L7.68 222.12L8.98 211.11L10.41 200.74L11.97 190.94L13.65 181.64L15.47 172.79L17.41 164.36L19.49 156.3L21.7 148.59L24.04 141.21L26.52 134.12L29.14 127.32L31.9 120.78L34.79 114.5L37.83 108.46L41.01 102.64L44.34 97.04L47.82 91.65L51.46 86.46L55.25 81.47L59.19 76.66L63.31 72.03L67.58 67.58L72.03 63.31L76.66 59.19L81.47 55.25L86.46 51.46L91.65 47.82L97.04 44.34L102.64 41.01L108.46 37.83L114.5 34.79L120.78 31.9L127.32 29.14L134.12 26.52L141.21 24.04L148.59 21.7L156.3 19.49L164.36 17.41L172.79 15.47L181.64 13.65L190.94 11.97L200.74 10.41L211.11 8.98L222.12 7.68L233.87 6.5L246.48 5.45L260.14 4.52L275.08 3.72L291.64 3.04L310.39 2.48L332.25 2.05L359.13 1.75L396.13 1.56L512 1.5L627.87 1.56L664.87 1.75L691.75 2.05L713.61 2.48L732.36 3.04L748.92 3.72L763.86 4.52L777.52 5.45L790.13 6.5L801.88 7.68L812.89 8.98L823.26 10.41L833.06 11.97L842.36 13.65L851.21 15.47L859.64 17.41L867.7 19.49L875.41 21.7L882.79 24.04L889.88 26.52L896.68 29.14L903.22 31.9L909.5 34.79L915.54 37.83L921.36 41.01L926.96 44.34L932.35 47.82L937.54 51.46L942.53 55.25L947.34 59.19L951.97 63.31L956.42 67.58L960.69 72.03L964.81 76.66L968.75 81.47L972.54 86.46L976.18 91.65L979.66 97.04L982.99 102.64L986.17 108.46L989.21 114.5L992.1 120.78L994.86 127.32L997.48 134.12L999.96 141.21L1002.3 148.59L1004.51 156.3L1006.59 164.36L1008.53 172.79L1010.35 181.64L1012.03 190.94L1013.59 200.74L1015.02 211.11L1016.32 222.12L1017.5 233.87L1018.55 246.48L1019.48 260.14L1020.28 275.08L1020.96 291.64L1021.52 310.39L1021.95 332.25L1022.25 359.13L1022.44 396.13Z" fill="none" stroke="rgba(255,255,255,0.07)" stroke-width="3"/><g fill="#f2f1ec"><circle cx="409.31" cy="456.44" r="22.06" fill-opacity="0.38"/><circle cx="507.3" cy="615.67" r="22.38" fill-opacity="0.38"/><circle cx="502.03" cy="625.96" r="23.6" fill-opacity="0.38"/><circle cx="454.91" cy="510.35" r="28.55" fill-opacity="0.38"/><circle cx="599.75" cy="473.68" r="24.75" fill-opacity="0.38"/><circle cx="651.33" cy="613.43" r="29.8" fill-opacity="0.38"/><circle cx="683.09" cy="483.27" r="25.02" fill-opacity="0.38"/><circle cx="602.89" cy="564.13" r="25.08" fill-opacity="0.38"/><circle cx="711.72" cy="490.7" r="25.58" fill-opacity="0.38"/><circle cx="693.34" cy="490.52" r="26.37" fill-opacity="0.38"/><circle cx="276.7" cy="365.48" r="34.52" fill-opacity="0.393"/><circle cx="330.12" cy="573.82" r="26.09" fill-opacity="0.38"/><circle cx="389.62" cy="299.72" r="26.48" fill-opacity="0.38"/><circle cx="625.71" cy="495.42" r="26.55" fill-opacity="0.38"/><circle cx="787.1" cy="564.95" r="26.76" fill-opacity="0.38"/><circle cx="196.95" cy="551.53" r="38.44" fill-opacity="0.472"/><circle cx="564.53" cy="243.31" r="38.78" fill-opacity="0.479"/><circle cx="283.06" cy="637.7" r="27.54" fill-opacity="0.38"/><circle cx="443.06" cy="747.92" r="27.61" fill-opacity="0.38"/><circle cx="586.26" cy="671.81" r="28.45" fill-opacity="0.38"/><circle cx="468.61" cy="239.16" r="28.01" fill-opacity="0.38"/><circle cx="555.16" cy="690.42" r="42.44" fill-opacity="0.547"/><circle cx="213.4" cy="308.12" r="28.66" fill-opacity="0.38"/><circle cx="528.19" cy="687.52" r="43.2" fill-opacity="0.561"/><circle cx="388.33" cy="675.87" r="29.08" fill-opacity="0.38"/><circle cx="560.27" cy="737.09" r="29.14" fill-opacity="0.38"/><circle cx="728.62" cy="311.15" r="29.54" fill-opacity="0.38"/><circle cx="598.2" cy="335.96" r="31.92" fill-opacity="0.38"/><circle cx="684.81" cy="684.72" r="29.3" fill-opacity="0.38"/><circle cx="249.91" cy="527.03" r="30.43" fill-opacity="0.38"/><circle cx="733.7" cy="552.11" r="29.78" fill-opacity="0.38"/><circle cx="247.99" cy="686.61" r="30.07" fill-opacity="0.38"/><circle cx="267.89" cy="371.33" r="30.91" fill-opacity="0.38"/><circle cx="826.12" cy="312.28" r="32.95" fill-opacity="0.38"/><circle cx="313.54" cy="349.15" r="30.71" fill-opacity="0.38"/><circle cx="410.94" cy="703.54" r="31.49" fill-opacity="0.38"/><circle cx="644.61" cy="292.24" r="30.99" fill-opacity="0.38"/><circle cx="625.91" cy="727.66" r="34.01" fill-opacity="0.38"/><circle cx="728.51" cy="583.69" r="37.8" fill-opacity="0.444"/><circle cx="436.47" cy="522.49" r="32.09" fill-opacity="0.38"/><circle cx="545.89" cy="642.02" r="32.05" fill-opacity="0.38"/><circle cx="414.9" cy="599.65" r="32.33" fill-opacity="0.38"/><circle cx="645.11" cy="833" r="32.44" fill-opacity="0.38"/><circle cx="306.3" cy="359.58" r="32.61" fill-opacity="0.38"/><circle cx="574.75" cy="208.99" r="50.42" fill-opacity="0.696"/><circle cx="230.17" cy="586.91" r="32.79" fill-opacity="0.38"/><circle cx="587.99" cy="798.45" r="32.81" fill-opacity="0.38"/><circle cx="496.98" cy="572.46" r="32.84" fill-opacity="0.38"/><circle cx="259.96" cy="559.6" r="32.89" fill-opacity="0.38"/><circle cx="260.81" cy="677.24" r="33.07" fill-opacity="0.38"/><circle cx="477.62" cy="748.64" r="33.25" fill-opacity="0.38"/><circle cx="204.31" cy="394.8" r="33.44" fill-opacity="0.38"/><circle cx="614.48" cy="694.02" r="33.6" fill-opacity="0.38"/><circle cx="559.64" cy="701.71" r="36.11" fill-opacity="0.39"/><circle cx="514.55" cy="708.21" r="45.19" fill-opacity="0.598"/><circle cx="378.4" cy="497.78" r="34.74" fill-opacity="0.38"/><circle cx="620.15" cy="599.23" r="33.8" fill-opacity="0.38"/><circle cx="374.83" cy="495.3" r="33.85" fill-opacity="0.38"/><circle cx="294.9" cy="241.06" r="33.89" fill-opacity="0.38"/><circle cx="449.87" cy="274.9" r="34.21" fill-opacity="0.38"/><circle cx="279.68" cy="288.74" r="34.76" fill-opacity="0.38"/><circle cx="795.97" cy="739.57" r="34.46" fill-opacity="0.38"/><circle cx="664.16" cy="358.22" r="34.67" fill-opacity="0.38"/><circle cx="301.83" cy="715.79" r="36.78" fill-opacity="0.395"/><circle cx="430.53" cy="486.09" r="35.05" fill-opacity="0.38"/><circle cx="163.23" cy="438.71" r="35.23" fill-opacity="0.38"/><circle cx="406.39" cy="311.72" r="53.67" fill-opacity="0.763"/><circle cx="510.04" cy="825.92" r="35.51" fill-opacity="0.38"/><circle cx="627.37" cy="810.04" r="40.72" fill-opacity="0.506"/><circle cx="602.09" cy="504.77" r="40.72" fill-opacity="0.506"/><circle cx="378.7" cy="498.09" r="35.67" fill-opacity="0.38"/><circle cx="416.41" cy="476.38" r="35.73" fill-opacity="0.38"/><circle cx="821.18" cy="513.37" r="35.83" fill-opacity="0.38"/><circle cx="648.87" cy="334.74" r="35.92" fill-opacity="0.38"/><circle cx="571.1" cy="218.32" r="37.02" fill-opacity="0.38"/><circle cx="760.51" cy="401.5" r="36.28" fill-opacity="0.38"/><circle cx="615.98" cy="492.28" r="37.53" fill-opacity="0.382"/><circle cx="559.39" cy="499.62" r="36.65" fill-opacity="0.38"/><circle cx="745.34" cy="446.15" r="36.74" fill-opacity="0.38"/><circle cx="273.03" cy="461.79" r="36.91" fill-opacity="0.38"/><circle cx="552.4" cy="494.88" r="61.39" fill-opacity="0.906"/><circle cx="476.36" cy="709.01" r="53.41" fill-opacity="0.769"/><circle cx="748.1" cy="728.2" r="37.99" fill-opacity="0.38"/><circle cx="677.4" cy="358.52" r="43.9" fill-opacity="0.58"/><circle cx="765.03" cy="451.19" r="38.91" fill-opacity="0.38"/><circle cx="536.23" cy="395.23" r="38.94" fill-opacity="0.38"/><circle cx="830.81" cy="520.26" r="65.19" fill-opacity="0.985"/><circle cx="432.85" cy="574.19" r="40.04" fill-opacity="0.38"/><circle cx="411.92" cy="524.99" r="40.82" fill-opacity="0.42"/><circle cx="415.31" cy="559.01" r="46.04" fill-opacity="0.632"/></g></g><g class="oq-l"><defs><linearGradient id="ilightssquircle-g" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#fbf9f4"/><stop offset="1" stop-color="#e9e2d6"/></linearGradient></defs><path d="M1024 512L1023.94 628.21L1023.75 665.32L1023.44 692.28L1023.01 714.2L1022.46 733L1021.78 749.62L1020.97 764.6L1020.04 778.3L1018.99 790.95L1017.81 802.74L1016.5 813.78L1015.06 824.18L1013.5 834.01L1011.81 843.33L1009.99 852.2L1008.04 860.66L1005.96 868.74L1003.74 876.47L1001.39 883.88L998.9 890.99L996.28 897.81L993.52 904.36L990.61 910.67L987.56 916.73L984.37 922.56L981.03 928.18L977.54 933.59L973.9 938.79L970.1 943.8L966.14 948.62L962.01 953.26L957.72 957.72L953.26 962.01L948.62 966.14L943.8 970.1L938.79 973.9L933.59 977.54L928.18 981.03L922.56 984.37L916.73 987.56L910.67 990.61L904.36 993.52L897.81 996.28L890.99 998.9L883.88 1001.39L876.47 1003.74L868.74 1005.96L860.66 1008.04L852.2 1009.99L843.33 1011.81L834.01 1013.5L824.18 1015.06L813.78 1016.5L802.74 1017.81L790.95 1018.99L778.3 1020.04L764.6 1020.97L749.62 1021.78L733 1022.46L714.2 1023.01L692.28 1023.44L665.32 1023.75L628.21 1023.94L512 1024L395.79 1023.94L358.68 1023.75L331.72 1023.44L309.8 1023.01L291 1022.46L274.38 1021.78L259.4 1020.97L245.7 1020.04L233.05 1018.99L221.26 1017.81L210.22 1016.5L199.82 1015.06L189.99 1013.5L180.67 1011.81L171.8 1009.99L163.34 1008.04L155.26 1005.96L147.53 1003.74L140.12 1001.39L133.01 998.9L126.19 996.28L119.64 993.52L113.33 990.61L107.27 987.56L101.44 984.37L95.82 981.03L90.41 977.54L85.21 973.9L80.2 970.1L75.38 966.14L70.74 962.01L66.28 957.72L61.99 953.26L57.86 948.62L53.9 943.8L50.1 938.79L46.46 933.59L42.97 928.18L39.63 922.56L36.44 916.73L33.39 910.67L30.48 904.36L27.72 897.81L25.1 890.99L22.61 883.88L20.26 876.47L18.04 868.74L15.96 860.66L14.01 852.2L12.19 843.33L10.5 834.01L8.94 824.18L7.5 813.78L6.19 802.74L5.01 790.95L3.96 778.3L3.03 764.6L2.22 749.62L1.54 733L0.99 714.2L0.56 692.28L0.25 665.32L0.06 628.21L0 512L0.06 395.79L0.25 358.68L0.56 331.72L0.99 309.8L1.54 291L2.22 274.38L3.03 259.4L3.96 245.7L5.01 233.05L6.19 221.26L7.5 210.22L8.94 199.82L10.5 189.99L12.19 180.67L14.01 171.8L15.96 163.34L18.04 155.26L20.26 147.53L22.61 140.12L25.1 133.01L27.72 126.19L30.48 119.64L33.39 113.33L36.44 107.27L39.63 101.44L42.97 95.82L46.46 90.41L50.1 85.21L53.9 80.2L57.86 75.38L61.99 70.74L66.28 66.28L70.74 61.99L75.38 57.86L80.2 53.9L85.21 50.1L90.41 46.46L95.82 42.97L101.44 39.63L107.27 36.44L113.33 33.39L119.64 30.48L126.19 27.72L133.01 25.1L140.12 22.61L147.53 20.26L155.26 18.04L163.34 15.96L171.8 14.01L180.67 12.19L189.99 10.5L199.82 8.94L210.22 7.5L221.26 6.19L233.05 5.01L245.7 3.96L259.4 3.03L274.38 2.22L291 1.54L309.8 0.99L331.72 0.56L358.68 0.25L395.79 0.06L512 0L628.21 0.06L665.32 0.25L692.28 0.56L714.2 0.99L733 1.54L749.62 2.22L764.6 3.03L778.3 3.96L790.95 5.01L802.74 6.19L813.78 7.5L824.18 8.94L834.01 10.5L843.33 12.19L852.2 14.01L860.66 15.96L868.74 18.04L876.47 20.26L883.88 22.61L890.99 25.1L897.81 27.72L904.36 30.48L910.67 33.39L916.73 36.44L922.56 39.63L928.18 42.97L933.59 46.46L938.79 50.1L943.8 53.9L948.62 57.86L953.26 61.99L957.72 66.28L962.01 70.74L966.14 75.38L970.1 80.2L973.9 85.21L977.54 90.41L981.03 95.82L984.37 101.44L987.56 107.27L990.61 113.33L993.52 119.64L996.28 126.19L998.9 133.01L1001.39 140.12L1003.74 147.53L1005.96 155.26L1008.04 163.34L1009.99 171.8L1011.81 180.67L1013.5 189.99L1015.06 199.82L1016.5 210.22L1017.81 221.26L1018.99 233.05L1020.04 245.7L1020.97 259.4L1021.78 274.38L1022.46 291L1023.01 309.8L1023.44 331.72L1023.75 358.68L1023.94 395.79Z" fill="url(#ilightssquircle-g)"/><path d="M1022.5 512L1022.44 627.87L1022.25 664.87L1021.95 691.75L1021.52 713.61L1020.96 732.36L1020.28 748.92L1019.48 763.86L1018.55 777.52L1017.5 790.13L1016.32 801.88L1015.02 812.89L1013.59 823.26L1012.03 833.06L1010.35 842.36L1008.53 851.21L1006.59 859.64L1004.51 867.7L1002.3 875.41L999.96 882.79L997.48 889.88L994.86 896.68L992.1 903.22L989.21 909.5L986.17 915.54L982.99 921.36L979.66 926.96L976.18 932.35L972.54 937.54L968.75 942.53L964.81 947.34L960.69 951.97L956.42 956.42L951.97 960.69L947.34 964.81L942.53 968.75L937.54 972.54L932.35 976.18L926.96 979.66L921.36 982.99L915.54 986.17L909.5 989.21L903.22 992.1L896.68 994.86L889.88 997.48L882.79 999.96L875.41 1002.3L867.7 1004.51L859.64 1006.59L851.21 1008.53L842.36 1010.35L833.06 1012.03L823.26 1013.59L812.89 1015.02L801.88 1016.32L790.13 1017.5L777.52 1018.55L763.86 1019.48L748.92 1020.28L732.36 1020.96L713.61 1021.52L691.75 1021.95L664.87 1022.25L627.87 1022.44L512 1022.5L396.13 1022.44L359.13 1022.25L332.25 1021.95L310.39 1021.52L291.64 1020.96L275.08 1020.28L260.14 1019.48L246.48 1018.55L233.87 1017.5L222.12 1016.32L211.11 1015.02L200.74 1013.59L190.94 1012.03L181.64 1010.35L172.79 1008.53L164.36 1006.59L156.3 1004.51L148.59 1002.3L141.21 999.96L134.12 997.48L127.32 994.86L120.78 992.1L114.5 989.21L108.46 986.17L102.64 982.99L97.04 979.66L91.65 976.18L86.46 972.54L81.47 968.75L76.66 964.81L72.03 960.69L67.58 956.42L63.31 951.97L59.19 947.34L55.25 942.53L51.46 937.54L47.82 932.35L44.34 926.96L41.01 921.36L37.83 915.54L34.79 909.5L31.9 903.22L29.14 896.68L26.52 889.88L24.04 882.79L21.7 875.41L19.49 867.7L17.41 859.64L15.47 851.21L13.65 842.36L11.97 833.06L10.41 823.26L8.98 812.89L7.68 801.88L6.5 790.13L5.45 777.52L4.52 763.86L3.72 748.92L3.04 732.36L2.48 713.61L2.05 691.75L1.75 664.87L1.56 627.87L1.5 512L1.56 396.13L1.75 359.13L2.05 332.25L2.48 310.39L3.04 291.64L3.72 275.08L4.52 260.14L5.45 246.48L6.5 233.87L7.68 222.12L8.98 211.11L10.41 200.74L11.97 190.94L13.65 181.64L15.47 172.79L17.41 164.36L19.49 156.3L21.7 148.59L24.04 141.21L26.52 134.12L29.14 127.32L31.9 120.78L34.79 114.5L37.83 108.46L41.01 102.64L44.34 97.04L47.82 91.65L51.46 86.46L55.25 81.47L59.19 76.66L63.31 72.03L67.58 67.58L72.03 63.31L76.66 59.19L81.47 55.25L86.46 51.46L91.65 47.82L97.04 44.34L102.64 41.01L108.46 37.83L114.5 34.79L120.78 31.9L127.32 29.14L134.12 26.52L141.21 24.04L148.59 21.7L156.3 19.49L164.36 17.41L172.79 15.47L181.64 13.65L190.94 11.97L200.74 10.41L211.11 8.98L222.12 7.68L233.87 6.5L246.48 5.45L260.14 4.52L275.08 3.72L291.64 3.04L310.39 2.48L332.25 2.05L359.13 1.75L396.13 1.56L512 1.5L627.87 1.56L664.87 1.75L691.75 2.05L713.61 2.48L732.36 3.04L748.92 3.72L763.86 4.52L777.52 5.45L790.13 6.5L801.88 7.68L812.89 8.98L823.26 10.41L833.06 11.97L842.36 13.65L851.21 15.47L859.64 17.41L867.7 19.49L875.41 21.7L882.79 24.04L889.88 26.52L896.68 29.14L903.22 31.9L909.5 34.79L915.54 37.83L921.36 41.01L926.96 44.34L932.35 47.82L937.54 51.46L942.53 55.25L947.34 59.19L951.97 63.31L956.42 67.58L960.69 72.03L964.81 76.66L968.75 81.47L972.54 86.46L976.18 91.65L979.66 97.04L982.99 102.64L986.17 108.46L989.21 114.5L992.1 120.78L994.86 127.32L997.48 134.12L999.96 141.21L1002.3 148.59L1004.51 156.3L1006.59 164.36L1008.53 172.79L1010.35 181.64L1012.03 190.94L1013.59 200.74L1015.02 211.11L1016.32 222.12L1017.5 233.87L1018.55 246.48L1019.48 260.14L1020.28 275.08L1020.96 291.64L1021.52 310.39L1021.95 332.25L1022.25 359.13L1022.44 396.13Z" fill="none" stroke="rgba(0,0,0,0.06)" stroke-width="3"/><g fill="#1c1b19"><circle cx="409.31" cy="456.44" r="22.06" fill-opacity="0.38"/><circle cx="507.3" cy="615.67" r="22.38" fill-opacity="0.38"/><circle cx="502.03" cy="625.96" r="23.6" fill-opacity="0.38"/><circle cx="454.91" cy="510.35" r="28.55" fill-opacity="0.38"/><circle cx="599.75" cy="473.68" r="24.75" fill-opacity="0.38"/><circle cx="651.33" cy="613.43" r="29.8" fill-opacity="0.38"/><circle cx="683.09" cy="483.27" r="25.02" fill-opacity="0.38"/><circle cx="602.89" cy="564.13" r="25.08" fill-opacity="0.38"/><circle cx="711.72" cy="490.7" r="25.58" fill-opacity="0.38"/><circle cx="693.34" cy="490.52" r="26.37" fill-opacity="0.38"/><circle cx="276.7" cy="365.48" r="34.52" fill-opacity="0.393"/><circle cx="330.12" cy="573.82" r="26.09" fill-opacity="0.38"/><circle cx="389.62" cy="299.72" r="26.48" fill-opacity="0.38"/><circle cx="625.71" cy="495.42" r="26.55" fill-opacity="0.38"/><circle cx="787.1" cy="564.95" r="26.76" fill-opacity="0.38"/><circle cx="196.95" cy="551.53" r="38.44" fill-opacity="0.472"/><circle cx="564.53" cy="243.31" r="38.78" fill-opacity="0.479"/><circle cx="283.06" cy="637.7" r="27.54" fill-opacity="0.38"/><circle cx="443.06" cy="747.92" r="27.61" fill-opacity="0.38"/><circle cx="586.26" cy="671.81" r="28.45" fill-opacity="0.38"/><circle cx="468.61" cy="239.16" r="28.01" fill-opacity="0.38"/><circle cx="555.16" cy="690.42" r="42.44" fill-opacity="0.547"/><circle cx="213.4" cy="308.12" r="28.66" fill-opacity="0.38"/><circle cx="528.19" cy="687.52" r="43.2" fill-opacity="0.561"/><circle cx="388.33" cy="675.87" r="29.08" fill-opacity="0.38"/><circle cx="560.27" cy="737.09" r="29.14" fill-opacity="0.38"/><circle cx="728.62" cy="311.15" r="29.54" fill-opacity="0.38"/><circle cx="598.2" cy="335.96" r="31.92" fill-opacity="0.38"/><circle cx="684.81" cy="684.72" r="29.3" fill-opacity="0.38"/><circle cx="249.91" cy="527.03" r="30.43" fill-opacity="0.38"/><circle cx="733.7" cy="552.11" r="29.78" fill-opacity="0.38"/><circle cx="247.99" cy="686.61" r="30.07" fill-opacity="0.38"/><circle cx="267.89" cy="371.33" r="30.91" fill-opacity="0.38"/><circle cx="826.12" cy="312.28" r="32.95" fill-opacity="0.38"/><circle cx="313.54" cy="349.15" r="30.71" fill-opacity="0.38"/><circle cx="410.94" cy="703.54" r="31.49" fill-opacity="0.38"/><circle cx="644.61" cy="292.24" r="30.99" fill-opacity="0.38"/><circle cx="625.91" cy="727.66" r="34.01" fill-opacity="0.38"/><circle cx="728.51" cy="583.69" r="37.8" fill-opacity="0.444"/><circle cx="436.47" cy="522.49" r="32.09" fill-opacity="0.38"/><circle cx="545.89" cy="642.02" r="32.05" fill-opacity="0.38"/><circle cx="414.9" cy="599.65" r="32.33" fill-opacity="0.38"/><circle cx="645.11" cy="833" r="32.44" fill-opacity="0.38"/><circle cx="306.3" cy="359.58" r="32.61" fill-opacity="0.38"/><circle cx="574.75" cy="208.99" r="50.42" fill-opacity="0.696"/><circle cx="230.17" cy="586.91" r="32.79" fill-opacity="0.38"/><circle cx="587.99" cy="798.45" r="32.81" fill-opacity="0.38"/><circle cx="496.98" cy="572.46" r="32.84" fill-opacity="0.38"/><circle cx="259.96" cy="559.6" r="32.89" fill-opacity="0.38"/><circle cx="260.81" cy="677.24" r="33.07" fill-opacity="0.38"/><circle cx="477.62" cy="748.64" r="33.25" fill-opacity="0.38"/><circle cx="204.31" cy="394.8" r="33.44" fill-opacity="0.38"/><circle cx="614.48" cy="694.02" r="33.6" fill-opacity="0.38"/><circle cx="559.64" cy="701.71" r="36.11" fill-opacity="0.39"/><circle cx="514.55" cy="708.21" r="45.19" fill-opacity="0.598"/><circle cx="378.4" cy="497.78" r="34.74" fill-opacity="0.38"/><circle cx="620.15" cy="599.23" r="33.8" fill-opacity="0.38"/><circle cx="374.83" cy="495.3" r="33.85" fill-opacity="0.38"/><circle cx="294.9" cy="241.06" r="33.89" fill-opacity="0.38"/><circle cx="449.87" cy="274.9" r="34.21" fill-opacity="0.38"/><circle cx="279.68" cy="288.74" r="34.76" fill-opacity="0.38"/><circle cx="795.97" cy="739.57" r="34.46" fill-opacity="0.38"/><circle cx="664.16" cy="358.22" r="34.67" fill-opacity="0.38"/><circle cx="301.83" cy="715.79" r="36.78" fill-opacity="0.395"/><circle cx="430.53" cy="486.09" r="35.05" fill-opacity="0.38"/><circle cx="163.23" cy="438.71" r="35.23" fill-opacity="0.38"/><circle cx="406.39" cy="311.72" r="53.67" fill-opacity="0.763"/><circle cx="510.04" cy="825.92" r="35.51" fill-opacity="0.38"/><circle cx="627.37" cy="810.04" r="40.72" fill-opacity="0.506"/><circle cx="602.09" cy="504.77" r="40.72" fill-opacity="0.506"/><circle cx="378.7" cy="498.09" r="35.67" fill-opacity="0.38"/><circle cx="416.41" cy="476.38" r="35.73" fill-opacity="0.38"/><circle cx="821.18" cy="513.37" r="35.83" fill-opacity="0.38"/><circle cx="648.87" cy="334.74" r="35.92" fill-opacity="0.38"/><circle cx="571.1" cy="218.32" r="37.02" fill-opacity="0.38"/><circle cx="760.51" cy="401.5" r="36.28" fill-opacity="0.38"/><circle cx="615.98" cy="492.28" r="37.53" fill-opacity="0.382"/><circle cx="559.39" cy="499.62" r="36.65" fill-opacity="0.38"/><circle cx="745.34" cy="446.15" r="36.74" fill-opacity="0.38"/><circle cx="273.03" cy="461.79" r="36.91" fill-opacity="0.38"/><circle cx="552.4" cy="494.88" r="61.39" fill-opacity="0.906"/><circle cx="476.36" cy="709.01" r="53.41" fill-opacity="0.769"/><circle cx="748.1" cy="728.2" r="37.99" fill-opacity="0.38"/><circle cx="677.4" cy="358.52" r="43.9" fill-opacity="0.58"/><circle cx="765.03" cy="451.19" r="38.91" fill-opacity="0.38"/><circle cx="536.23" cy="395.23" r="38.94" fill-opacity="0.38"/><circle cx="830.81" cy="520.26" r="65.19" fill-opacity="0.985"/><circle cx="432.85" cy="574.19" r="40.04" fill-opacity="0.38"/><circle cx="411.92" cy="524.99" r="40.82" fill-opacity="0.42"/><circle cx="415.31" cy="559.01" r="46.04" fill-opacity="0.632"/></g></g></svg> diff --git a/assets/brand/icon-180.png b/brand/icon-180.png similarity index 100% rename from assets/brand/icon-180.png rename to brand/icon-180.png diff --git a/assets/brand/icon-192.png b/brand/icon-192.png similarity index 100% rename from assets/brand/icon-192.png rename to brand/icon-192.png diff --git a/assets/brand/icon-512.png b/brand/icon-512.png similarity index 100% rename from assets/brand/icon-512.png rename to brand/icon-512.png diff --git a/assets/brand/icon-maskable-512.png b/brand/icon-maskable-512.png similarity index 100% rename from assets/brand/icon-maskable-512.png rename to brand/icon-maskable-512.png diff --git a/crates/quill-agent/examples/probe.rs b/crates/quill-agent/examples/probe.rs deleted file mode 100644 index bc4d809..0000000 --- a/crates/quill-agent/examples/probe.rs +++ /dev/null @@ -1,34 +0,0 @@ -use std::sync::atomic::AtomicBool; - -use quill_agent::{Access, AgentEvent, Task, run, system_prompt}; -use quill_llama::Message; - -fn main() { - let mut args = std::env::args().skip(1); - let url = args.next().unwrap_or_else(|| "http://127.0.0.1:9931".into()); - let model = args.next().unwrap_or_default(); - let prompt = args.next().unwrap_or_else(|| "Create hello.py that prints a greeting, then run it.".into()); - let root = std::env::temp_dir().join("quill-probe"); - std::fs::create_dir_all(&root).expect("probe folder"); - let task = Task { - server_url: url, - system: system_prompt(&model, Some(&root), false, ""), - model, - thinking: Some(false), - root: Some(root.clone()), - access: Access::Full, - history: vec![Message::user(prompt)], - publisher: None, - }; - println!("working in {}", root.display()); - let cancel = AtomicBool::new(false); - let result = run(task, &cancel, |event| match event { - AgentEvent::Text(text) => print!("{text}"), - AgentEvent::ToolStarted { kind, target, .. } => println!("\n[{}] {target}", kind.name()), - AgentEvent::ToolFinished { ok, output, .. } => { - println!(" -> {} {}", if ok { "ok" } else { "failed" }, output.lines().next().unwrap_or_default()) - } - _ => {} - }); - println!("\nresult: {result:?}"); -} \ No newline at end of file diff --git a/crates/quill-agent/src/lib.rs b/crates/quill-agent/src/lib.rs deleted file mode 100644 index 6ad1df1..0000000 --- a/crates/quill-agent/src/lib.rs +++ /dev/null @@ -1,331 +0,0 @@ -mod diff; -mod instructions; -mod prompt; -mod tools; - -use std::path::{Path, PathBuf}; -use std::sync::Arc; -use std::sync::atomic::{AtomicBool, Ordering}; -use std::sync::mpsc::{RecvTimeoutError, Sender, channel}; -use std::time::Duration; - -use quill_llama::{ChatRequest, Error, Event, Message, Server, ToolCall}; -use serde::{Deserialize, Serialize}; - -pub use diff::{DiffLine, FileDiff, LineKind, diff_text}; -pub use instructions::project_instructions; -pub use prompt::system_prompt; -pub use tools::ToolKind; - -const MAX_STEPS: usize = 50; - -#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize)] -#[serde(rename_all = "snake_case")] -pub enum Access { - #[serde(alias = "manual")] - Supervised, - AutoEdits, - #[default] - #[serde(alias = "auto")] - Full, -} - -impl Access { - pub const ALL: [Access; 3] = [Access::Supervised, Access::AutoEdits, Access::Full]; - - pub fn label(self) -> &'static str { - match self { - Access::Supervised => "Ask first", - Access::AutoEdits => "Trust edits", - Access::Full => "Autopilot", - } - } - - pub fn description(self) -> &'static str { - match self { - Access::Supervised => "Checks with you before every edit and command", - Access::AutoEdits => "Applies edits on its own, checks before running commands", - Access::Full => "Edits and runs commands without stopping to ask", - } - } - - fn asks_for_edits(self) -> bool { - self == Access::Supervised - } - - fn asks_for_commands(self) -> bool { - self != Access::Full - } -} - -#[derive(Debug, Clone, PartialEq)] -pub enum Approval { - FileChange(FileDiff), - Command(String), - Commit(String), - PullRequest(String), -} - -pub trait Publisher: Send + Sync { - fn commit(&self, root: &Path, message: &str, branch: Option<&str>) -> Result<String, String>; - fn open_pull_request(&self, root: &Path, title: &str, body: &str) -> Result<String, String>; -} - -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub enum Decision { - Approve, - Decline, - AlwaysAllow, -} - -#[derive(Debug)] -pub enum AgentEvent { - Reasoning(String), - Text(String), - StepDone, - ToolStarted { id: String, kind: ToolKind, target: String }, - ToolFinished { id: String, ok: bool, output: String, diff: Option<FileDiff> }, - NeedsApproval { id: String, approval: Approval, reply: Sender<Decision> }, - Message(Message), - Usage { prompt: u64, completion: u64 }, -} - -pub struct Task { - pub server_url: String, - pub model: String, - pub thinking: Option<bool>, - pub root: Option<PathBuf>, - pub access: Access, - pub system: String, - pub history: Vec<Message>, - pub publisher: Option<Arc<dyn Publisher>>, -} - -#[derive(Default)] -struct PendingCall { - id: Option<String>, - name: String, - arguments: String, -} - -pub fn run(task: Task, cancel: &AtomicBool, mut emit: impl FnMut(AgentEvent)) -> Result<(), Error> { - let server = Server::new(&task.server_url); - let tool_schemas = if task.root.is_some() { tools::schemas(task.publisher.is_some()) } else { Vec::new() }; - let mut messages = vec![Message::system(task.system.clone())]; - messages.extend(task.history.iter().cloned()); - let mut access = task.access; - for step in 0..MAX_STEPS { - let mut text = String::new(); - let mut pending: Vec<PendingCall> = Vec::new(); - let request = - ChatRequest { model: task.model.clone(), messages: messages.clone(), thinking: task.thinking, tools: tool_schemas.clone() }; - server.stream_chat(&request, cancel, |event| match event { - Event::Reasoning(chunk) => emit(AgentEvent::Reasoning(chunk)), - Event::Content(chunk) => { - text.push_str(&chunk); - emit(AgentEvent::Text(chunk)); - } - Event::ToolCall { index, id, name, arguments } => { - if pending.len() <= index { - pending.resize_with(index + 1, PendingCall::default); - } - let call = &mut pending[index]; - if id.is_some() { - call.id = id; - } - if let Some(name) = name { - call.name.push_str(&name); - } - call.arguments.push_str(&arguments); - } - Event::Usage { prompt, completion } => emit(AgentEvent::Usage { prompt, completion }), - })?; - if cancel.load(Ordering::Relaxed) { - return Ok(()); - } - emit(AgentEvent::StepDone); - let calls: Vec<ToolCall> = pending - .into_iter() - .enumerate() - .filter(|(_, call)| !call.name.is_empty()) - .map(|(index, call)| ToolCall::new(call.id.unwrap_or_else(|| format!("call_{step}_{index}")), call.name, call.arguments)) - .collect(); - let assistant = Message::assistant(text, calls.clone()); - messages.push(assistant.clone()); - emit(AgentEvent::Message(assistant)); - if calls.is_empty() { - return Ok(()); - } - for call in &calls { - if cancel.load(Ordering::Relaxed) { - return Ok(()); - } - let output = match task.root.as_deref() { - Some(root) => execute(root, task.publisher.as_deref(), call, &mut access, cancel, &mut emit), - None => "No project is open, so tools are unavailable. Answer directly.".into(), - }; - let result = Message::tool(call.id.clone(), output); - messages.push(result.clone()); - emit(AgentEvent::Message(result)); - } - } - Err(Error(format!("Stopped after {MAX_STEPS} steps. Send a follow-up to let the agent continue."))) -} - -fn ask(id: &str, approval: Approval, cancel: &AtomicBool, emit: &mut impl FnMut(AgentEvent)) -> Decision { - let (reply, answer) = channel(); - emit(AgentEvent::NeedsApproval { id: id.to_string(), approval, reply }); - loop { - match answer.recv_timeout(Duration::from_millis(200)) { - Ok(decision) => return decision, - Err(RecvTimeoutError::Timeout) if cancel.load(Ordering::Relaxed) => return Decision::Decline, - Err(RecvTimeoutError::Timeout) => {} - Err(RecvTimeoutError::Disconnected) => return Decision::Decline, - } - } -} - -fn execute( - root: &Path, - publisher: Option<&dyn Publisher>, - call: &ToolCall, - access: &mut Access, - cancel: &AtomicBool, - emit: &mut impl FnMut(AgentEvent), -) -> String { - let git = publisher.is_some(); - let Some(kind) = ToolKind::resolve(&call.function.name).filter(|kind| git || !matches!(kind, ToolKind::Commit | ToolKind::PullRequest)) - else { - let names: Vec<String> = tools::schemas(git).iter().filter_map(|t| t["function"]["name"].as_str().map(str::to_string)).collect(); - return format!("Error: there is no tool called \"{}\". The tools are {}.", call.function.name, names.join(", ")); - }; - let args = tools::parse_args(&call.function.arguments); - let id = call.id.clone(); - emit(AgentEvent::ToolStarted { id: id.clone(), kind, target: tools::describe(kind, &args) }); - let (ok, output, diff) = if let Some(raw) = args.get("__invalid").and_then(|v| v.as_str()) { - (false, format!("The arguments were not valid JSON: {raw}. Send a JSON object, for example {{\"path\": \"src/main.rs\"}}."), None) - } else { - match kind { - ToolKind::List => settle(tools::list(root, &args)), - ToolKind::Read => settle(tools::read(root, &args)), - ToolKind::Search => settle(tools::search(root, &args)), - ToolKind::Write | ToolKind::Edit => change(root, kind, &args, &id, access, cancel, emit), - ToolKind::Run => command(root, &args, &id, access, cancel, emit), - ToolKind::Commit | ToolKind::PullRequest => match publisher { - Some(publisher) => publish(root, publisher, kind, &args, &id, access, cancel, emit), - None => (false, "Git tools are not available here.".into(), None), - }, - } - }; - emit(AgentEvent::ToolFinished { id, ok, output: output.clone(), diff }); - if ok { output } else { format!("Error: {output}") } -} - -fn settle(result: Result<String, String>) -> (bool, String, Option<FileDiff>) { - match result { - Ok(output) => (true, output, None), - Err(error) => (false, error, None), - } -} - -fn change( - root: &Path, - kind: ToolKind, - args: &serde_json::Value, - id: &str, - access: &mut Access, - cancel: &AtomicBool, - emit: &mut impl FnMut(AgentEvent), -) -> (bool, String, Option<FileDiff>) { - let change = match tools::plan_change(root, kind, args) { - Ok(change) => change, - Err(error) => return (false, error, None), - }; - if access.asks_for_edits() { - match ask(id, Approval::FileChange(change.diff.clone()), cancel, emit) { - Decision::Decline => return (false, "The user declined this change. Ask what they would like instead.".into(), None), - Decision::AlwaysAllow => *access = Access::AutoEdits, - Decision::Approve => {} - } - } - if let Err(error) = tools::apply(&change) { - return (false, error, None); - } - let verb = if change.diff.created { "Created" } else { "Updated" }; - let summary = format!("{verb} {} (+{} -{})", change.diff.path, change.diff.added, change.diff.removed); - (true, summary, Some(change.diff)) -} - -fn command( - root: &Path, - args: &serde_json::Value, - id: &str, - access: &mut Access, - cancel: &AtomicBool, - emit: &mut impl FnMut(AgentEvent), -) -> (bool, String, Option<FileDiff>) { - let Some(command) = tools::arg(args, &tools::COMMAND_KEYS).map(str::trim).filter(|c| !c.is_empty()) else { - return (false, "run_command needs a \"command\".".into(), None); - }; - if access.asks_for_commands() { - match ask(id, Approval::Command(command.to_string()), cancel, emit) { - Decision::Decline => return (false, "The user declined running this command. Ask what they would like instead.".into(), None), - Decision::AlwaysAllow => *access = Access::Full, - Decision::Approve => {} - } - } - let (ok, output) = tools::run(root, command, tools::command_timeout(args), cancel); - (ok, output, None) -} - -#[allow(clippy::too_many_arguments)] -fn publish( - root: &Path, - publisher: &dyn Publisher, - kind: ToolKind, - args: &serde_json::Value, - id: &str, - access: &mut Access, - cancel: &AtomicBool, - emit: &mut impl FnMut(AgentEvent), -) -> (bool, String, Option<FileDiff>) { - let text = |keys: &[&str]| tools::arg(args, keys).map(str::trim).filter(|t| !t.is_empty()); - let branch = text(&tools::BRANCH_KEYS); - let (approval, asks, widened) = if kind == ToolKind::Commit { - let Some(message) = text(&tools::MESSAGE_KEYS) else { - return (false, "commit_changes needs a \"message\".".into(), None); - }; - let summary = branch.map_or_else(|| message.to_string(), |branch| format!("{message} (on {branch})")); - (Approval::Commit(summary), access.asks_for_edits(), Access::AutoEdits) - } else { - let Some(title) = text(&tools::TITLE_KEYS) else { - return (false, "open_pull_request needs a \"title\".".into(), None); - }; - (Approval::PullRequest(title.to_string()), access.asks_for_commands(), Access::Full) - }; - if asks { - match ask(id, approval, cancel, emit) { - Decision::Decline => return (false, "The user declined this. Ask what they would like instead.".into(), None), - Decision::AlwaysAllow => *access = widened, - Decision::Approve => {} - } - } - let result = match kind { - ToolKind::Commit => publisher.commit(root, text(&tools::MESSAGE_KEYS).unwrap_or_default(), branch), - _ => publisher.open_pull_request(root, text(&tools::TITLE_KEYS).unwrap_or_default(), text(&tools::BODY_KEYS).unwrap_or_default()), - }; - settle(result) -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn access_reads_old_settings() { - let auto: Access = serde_json::from_str("\"auto\"").unwrap(); - let manual: Access = serde_json::from_str("\"manual\"").unwrap(); - assert_eq!((auto, manual), (Access::Full, Access::Supervised)); - assert_eq!(serde_json::to_string(&Access::AutoEdits).unwrap(), "\"auto_edits\""); - } -} \ No newline at end of file diff --git a/crates/quill-agent/src/prompt.rs b/crates/quill-agent/src/prompt.rs deleted file mode 100644 index d15b672..0000000 --- a/crates/quill-agent/src/prompt.rs +++ /dev/null @@ -1,109 +0,0 @@ -use std::path::Path; - -use crate::instructions::project_instructions; -use crate::tools::{os_name, shell_name}; - -const TOOLS: &str = "# Your tools - -- list_files shows how the project is laid out. Start with it in a project you have not seen yet. -- read_file reads a file with line numbers. Read a file before you change it, and in a large file read only the lines you need. -- search finds text across the project, ignoring case. Use it to find where something is defined or used. -- write_file creates a new file or replaces a whole file. -- edit_file replaces an exact piece of text in a file. Copy old_text exactly from read_file output without the line numbers, and include enough surrounding lines to make it unique. -- run_command runs a shell command in the project folder and returns its output and exit code."; - -const GIT_TOOLS: &str = " -- commit_changes stages every change in the project and commits it, optionally on a new branch. -- open_pull_request pushes the current branch to GitHub and opens a pull request into the main branch."; - -const WINDOWS_SHELL: &str = "# Commands on Windows - -run_command uses Windows PowerShell, so write PowerShell, not bash or cmd: -- Use cmdlets such as Get-ChildItem, Get-Content, Select-String, New-Item, Copy-Item, Move-Item and Remove-Item. Do not use ls -la, grep, cat with flags, rm -rf, touch or export. -- Separate commands with a semicolon. Set environment variables with $env:NAME = 'value'. -- Paths use backslashes, and paths with spaces need quotes. -- Run programs installed on the computer, such as python, node, npm, cargo, dotnet or go, by name."; - -const UNIX_SHELL: &str = "# Commands - -run_command uses sh, so write POSIX shell. Combine commands with && and quote paths that contain spaces. Run programs installed on the computer, such as python3, node, npm, cargo or go, by name."; - -const COMMAND_RULES: &str = "Commands must finish on their own. Pass flags that skip prompts, such as -y, and do not start servers, watchers or anything else that waits forever; a command is stopped when its timeout runs out. To look at files, prefer list_files, read_file and search over shell commands."; - -const WORKFLOW: &str = "# How to work - -1. Understand the request. If it is unclear in a way that changes the result, ask one short question. Otherwise make a sensible choice and mention it. -2. Explore before changing anything: find the relevant files and read them. -3. Make focused changes that follow the project's existing style, naming and structure. Do not reformat or rewrite code the task does not touch. -4. Check your work: build, run or test the code with run_command when the project allows it, and fix whatever broke. -5. When a tool call fails, read the error and change your approach. Never repeat a call that failed in exactly the same way. -6. When the user declines a change or a command, do not try it again in another form. Ask what they would like instead. - -Keep going until the task is done. Do not stop between ordinary steps to ask for permission; the app asks the user when it needs to."; - -const GIT: &str = "# Git - -The project uses Git. To commit, push or open a pull request, use commit_changes and open_pull_request rather than running git yourself. Commit or open a pull request only when the user asks for it. Put work meant for a pull request on a new branch with a short, descriptive name such as fix-login. Write commit messages as one short summary line in the imperative mood, followed by details only when they help."; - -const REPLY: &str = "# Your reply - -When you finish, reply with a short summary of what you changed and how you checked it. The user sees every tool call and diff, so do not paste file contents back. Use Markdown, with fenced code blocks for code. Be direct and concise."; - -pub fn system_prompt(model: &str, root: Option<&Path>, git: bool, personal: &str) -> String { - let os = os_name(); - let mut sections = vec![format!( - "You are Quill, the coding agent built into quill-code. You run on the user's own {os} computer and are powered by the {model} model. If the user asks which model you are, say so." - )]; - match root { - Some(root) => { - sections.push(format!( - "# Your workspace\n\nYou work in the project folder {}. Paths you give to tools are relative to it, and you cannot reach files outside it. Use your tools to do the work rather than describing what you would do.", - root.display() - )); - sections.push(if git { format!("{TOOLS}{GIT_TOOLS}") } else { TOOLS.to_string() }); - let shell = if shell_name() == "PowerShell" { WINDOWS_SHELL } else { UNIX_SHELL }; - sections.push(format!("{shell}\n\n{COMMAND_RULES}")); - sections.push(WORKFLOW.to_string()); - if git { - sections.push(GIT.to_string()); - } - sections.push(REPLY.to_string()); - let project = project_instructions(root); - if !project.is_empty() { - sections.push(format!("# Project instructions\n\n{project}")); - } - } - None => sections.push( - "No project is open in this conversation, so you have no tools. Answer from what you know, and when the user wants you to work on their files, suggest opening a project in quill-code. Use Markdown, with fenced code blocks for code. Be direct and concise.".into(), - ), - } - let personal = personal.trim(); - if !personal.is_empty() { - sections.push(format!("# The user's instructions\n\n{personal}")); - } - sections.join("\n\n") -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn quill_is_the_assistant_whatever_the_model() { - let prompt = system_prompt("qwen", None, false, ""); - assert!(prompt.starts_with("You are Quill")); - assert!(prompt.contains("powered by the qwen model")); - assert!(prompt.contains("no tools")); - } - - #[test] - fn projects_get_tools_shell_and_workflow() { - let dir = std::env::temp_dir(); - let prompt = system_prompt("m", Some(&dir), false, ""); - assert!(prompt.contains("edit_file") && prompt.contains("# How to work")); - assert!(prompt.contains(if cfg!(windows) { "Windows PowerShell" } else { "POSIX shell" })); - assert!(!prompt.contains("open_pull_request")); - assert!(system_prompt("m", Some(&dir), true, "").contains("open_pull_request")); - assert!(system_prompt("m", None, false, "Use tabs.").ends_with("# The user's instructions\n\nUse tabs.")); - } -} \ No newline at end of file diff --git a/crates/quill-agent/src/tools.rs b/crates/quill-agent/src/tools.rs deleted file mode 100644 index 0369be8..0000000 --- a/crates/quill-agent/src/tools.rs +++ /dev/null @@ -1,616 +0,0 @@ -use std::fs; -use std::io::Read; -use std::path::{Component, Path, PathBuf}; -use std::process::{Command, Stdio}; -use std::sync::atomic::{AtomicBool, Ordering}; -use std::time::{Duration, Instant}; - -use serde::{Deserialize, Serialize}; -use serde_json::{Value, json}; - -use crate::diff::{FileDiff, diff_text}; - -const IGNORED: [&str; 12] = - [".git", "node_modules", "target", "dist", "build", ".venv", "venv", "__pycache__", ".next", ".idea", ".vs", "bin"]; -const MAX_LIST: usize = 400; -const MAX_READ_LINES: usize = 1500; -const MAX_MATCHES: usize = 100; -const MAX_OUTPUT: usize = 30_000; - -#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] -pub enum ToolKind { - List, - Read, - Search, - Write, - Edit, - Run, - Commit, - PullRequest, -} - -impl ToolKind { - pub fn resolve(name: &str) -> Option<ToolKind> { - let name = name.trim().to_ascii_lowercase().replace(['-', ' '], "_"); - match name.as_str() { - "list_files" | "list" | "ls" | "list_dir" | "list_directory" | "tree" => Some(ToolKind::List), - "read_file" | "read" | "view" | "cat" | "open_file" | "view_file" => Some(ToolKind::Read), - "search" | "search_files" | "grep" | "find_in_files" | "search_code" => Some(ToolKind::Search), - "write_file" | "write" | "create_file" | "save_file" => Some(ToolKind::Write), - "edit_file" | "edit" | "str_replace" | "replace_in_file" | "apply_edit" => Some(ToolKind::Edit), - "run_command" | "run" | "bash" | "shell" | "powershell" | "exec" | "execute_command" | "terminal" => Some(ToolKind::Run), - "commit_changes" | "commit" | "git_commit" | "create_commit" => Some(ToolKind::Commit), - "open_pull_request" | "pull_request" | "create_pull_request" | "open_pr" | "create_pr" => Some(ToolKind::PullRequest), - _ => None, - } - } - - pub fn name(self) -> &'static str { - match self { - ToolKind::List => "list_files", - ToolKind::Read => "read_file", - ToolKind::Search => "search", - ToolKind::Write => "write_file", - ToolKind::Edit => "edit_file", - ToolKind::Run => "run_command", - ToolKind::Commit => "commit_changes", - ToolKind::PullRequest => "open_pull_request", - } - } -} - -pub fn schemas(git: bool) -> Vec<Value> { - let tool = |name: &str, description: &str, properties: Value, required: &[&str]| { - json!({ - "type": "function", - "function": { - "name": name, - "description": description, - "parameters": { "type": "object", "properties": properties, "required": required } - } - }) - }; - let mut tools = vec![ - tool( - "list_files", - "List files and folders in the project, a few levels deep. Use it first to see how the project is laid out.", - json!({ "path": { "type": "string", "description": "Folder relative to the project root. Leave empty for the root." } }), - &[], - ), - tool( - "read_file", - "Read a text file with line numbers. Always read a file before editing it.", - json!({ - "path": { "type": "string", "description": "File path relative to the project root." }, - "start_line": { "type": "integer", "description": "First line to show, starting at 1." }, - "end_line": { "type": "integer", "description": "Last line to show." } - }), - &["path"], - ), - tool( - "search", - "Search every text file in the project for a piece of text, case-insensitive. Returns matching lines with their paths and line numbers.", - json!({ - "query": { "type": "string", "description": "Text to look for." }, - "path": { "type": "string", "description": "Optional folder to limit the search to." } - }), - &["query"], - ), - tool( - "write_file", - "Create a file or replace its whole content. Use it for new files; prefer edit_file for changes to existing files.", - json!({ - "path": { "type": "string", "description": "File path relative to the project root." }, - "content": { "type": "string", "description": "The complete content of the file." } - }), - &["path", "content"], - ), - tool( - "edit_file", - "Replace an exact piece of text in a file. old_text must match the file exactly, including spaces, and appear once unless replace_all is true.", - json!({ - "path": { "type": "string", "description": "File path relative to the project root." }, - "old_text": { "type": "string", "description": "Exact text to replace, copied from the file." }, - "new_text": { "type": "string", "description": "Replacement text. Use an empty string to delete." }, - "replace_all": { "type": "boolean", "description": "Replace every occurrence." } - }), - &["path", "old_text", "new_text"], - ), - tool( - "run_command", - &format!( - "Run a {} command in the project folder and return its output and exit code. Use it to build, test and run code.", - shell_name() - ), - json!({ - "command": { "type": "string", "description": format!("The {} command to run.", shell_name()) }, - "timeout_seconds": { "type": "integer", "description": "How long to wait before stopping it. Default 120, maximum 600." } - }), - &["command"], - ), - ]; - if git { - tools.push(tool( - "commit_changes", - "Stage every change in the project and commit it. Give a branch to commit on a new branch, which a pull request needs when you are on the main branch or not on a branch.", - json!({ - "message": { "type": "string", "description": "Commit message: a short summary line, optionally followed by a blank line and details." }, - "branch": { "type": "string", "description": "Optional branch to create or switch to before committing, for example fix-login." } - }), - &["message"], - )); - tools.push(tool( - "open_pull_request", - "Push the current branch to GitHub and open a pull request into the main branch. Commit your work with commit_changes first.", - json!({ - "title": { "type": "string", "description": "Pull request title." }, - "body": { "type": "string", "description": "What changed and why, in Markdown." } - }), - &["title"], - )); - } - tools -} - -pub fn parse_args(arguments: &str) -> Value { - let text = arguments.trim(); - if text.is_empty() { - return json!({}); - } - serde_json::from_str(text).unwrap_or_else(|_| json!({ "__invalid": text })) -} - -pub fn arg<'a>(args: &'a Value, keys: &[&str]) -> Option<&'a str> { - keys.iter().find_map(|key| args.get(*key).and_then(Value::as_str)) -} - -fn arg_number(args: &Value, keys: &[&str]) -> Option<u64> { - keys.iter().find_map(|key| { - let value = args.get(*key)?; - value.as_u64().or_else(|| value.as_str()?.trim().parse().ok()) - }) -} - -fn arg_bool(args: &Value, key: &str) -> bool { - args.get(key).is_some_and(|v| v.as_bool().unwrap_or_else(|| v.as_str() == Some("true"))) -} - -pub const PATH_KEYS: [&str; 5] = ["path", "file_path", "file", "filename", "filepath"]; -const CONTENT_KEYS: [&str; 6] = ["content", "contents", "text", "file_text", "code", "body"]; -const OLD_KEYS: [&str; 6] = ["old_text", "old_str", "old_string", "old", "search", "find"]; -const NEW_KEYS: [&str; 6] = ["new_text", "new_str", "new_string", "new", "replace", "replacement"]; -pub const COMMAND_KEYS: [&str; 3] = ["command", "cmd", "script"]; -pub const MESSAGE_KEYS: [&str; 3] = ["message", "commit_message", "msg"]; -pub const BRANCH_KEYS: [&str; 3] = ["branch", "branch_name", "new_branch"]; -pub const TITLE_KEYS: [&str; 2] = ["title", "pr_title"]; -pub const BODY_KEYS: [&str; 3] = ["body", "description", "pr_body"]; -const QUERY_KEYS: [&str; 4] = ["query", "pattern", "text", "q"]; - -pub fn describe(kind: ToolKind, args: &Value) -> String { - match kind { - ToolKind::Run => arg(args, &COMMAND_KEYS).unwrap_or_default().trim().to_string(), - ToolKind::Search => arg(args, &QUERY_KEYS).unwrap_or_default().to_string(), - ToolKind::Commit => arg(args, &MESSAGE_KEYS).unwrap_or_default().lines().next().unwrap_or_default().trim().to_string(), - ToolKind::PullRequest => arg(args, &TITLE_KEYS).unwrap_or_default().trim().to_string(), - _ => { - let path = arg(args, &PATH_KEYS).unwrap_or_default().trim().replace('\\', "/"); - if path.is_empty() && kind == ToolKind::List { ".".into() } else { path } - } - } -} - -fn same_or_inside(path: &Path, root: &Path) -> bool { - let path = path.to_string_lossy().to_lowercase().replace('/', "\\"); - let root = root.to_string_lossy().to_lowercase().replace('/', "\\"); - let root = root.trim_end_matches('\\'); - path == root || path.starts_with(&format!("{root}\\")) -} - -pub fn resolve_path(root: &Path, rel: &str) -> Result<PathBuf, String> { - let rel = rel.trim().trim_matches('"'); - let candidate = Path::new(rel); - let joined = if candidate.is_absolute() { candidate.to_path_buf() } else { root.join(candidate) }; - let mut out = PathBuf::new(); - for component in joined.components() { - match component { - Component::ParentDir => { - if !out.pop() { - return Err(outside()); - } - } - Component::CurDir => {} - other => out.push(other), - } - } - if same_or_inside(&out, root) { Ok(out) } else { Err(outside()) } -} - -fn outside() -> String { - "That path is outside the project. Use a path relative to the project root, such as \"src/main.rs\".".into() -} - -pub fn display(root: &Path, path: &Path) -> String { - path.strip_prefix(root).map(|rel| rel.to_string_lossy().replace('\\', "/")).unwrap_or_else(|_| path.to_string_lossy().into_owned()) -} - -fn ignored(name: &str) -> bool { - IGNORED.contains(&name) -} - -fn sorted_entries(dir: &Path) -> Vec<(String, PathBuf, bool)> { - let Ok(read) = fs::read_dir(dir) else { return Vec::new() }; - let mut entries: Vec<_> = read - .filter_map(Result::ok) - .map(|e| { - let is_dir = e.file_type().is_ok_and(|t| t.is_dir()); - (e.file_name().to_string_lossy().into_owned(), e.path(), is_dir) - }) - .collect(); - entries.sort_by(|a, b| b.2.cmp(&a.2).then_with(|| a.0.to_lowercase().cmp(&b.0.to_lowercase()))); - entries -} - -pub fn list(root: &Path, args: &Value) -> Result<String, String> { - let dir = resolve_path(root, arg(args, &PATH_KEYS).unwrap_or_default())?; - if !dir.is_dir() { - return Err(format!("{} is not a folder.", display(root, &dir))); - } - let mut lines = Vec::new(); - let mut more = 0; - walk_tree(&dir, 0, 3, &mut lines, &mut more); - if lines.is_empty() { - return Ok("The folder is empty.".into()); - } - if more > 0 { - lines.push(format!("... and {more} more entries. List a subfolder to see them.")); - } - Ok(lines.join("\n")) -} - -fn walk_tree(dir: &Path, depth: usize, max_depth: usize, lines: &mut Vec<String>, more: &mut usize) { - for (name, path, is_dir) in sorted_entries(dir) { - if lines.len() >= MAX_LIST { - *more += 1; - continue; - } - let indent = " ".repeat(depth); - if is_dir { - if ignored(&name) { - lines.push(format!("{indent}{name}/ (skipped)")); - continue; - } - lines.push(format!("{indent}{name}/")); - if depth + 1 < max_depth { - walk_tree(&path, depth + 1, max_depth, lines, more); - } - } else { - lines.push(format!("{indent}{name}")); - } - } -} - -fn read_text(path: &Path) -> Result<String, String> { - let bytes = fs::read(path).map_err(|e| e.to_string())?; - if bytes.iter().take(8192).any(|b| *b == 0) { - return Err("That is a binary file, so it cannot be shown as text.".into()); - } - Ok(String::from_utf8_lossy(&bytes).into_owned()) -} - -pub fn read(root: &Path, args: &Value) -> Result<String, String> { - let rel = arg(args, &PATH_KEYS).ok_or("read_file needs a \"path\".")?; - let path = resolve_path(root, rel)?; - if !path.is_file() { - return Err(format!("{} does not exist. Use list_files to see what is there.", display(root, &path))); - } - let text = read_text(&path)?; - let lines: Vec<&str> = text.lines().collect(); - if lines.is_empty() { - return Ok("The file is empty.".into()); - } - let start = arg_number(args, &["start_line", "start", "from"]).unwrap_or(1).max(1) as usize; - let end = - arg_number(args, &["end_line", "end", "to"]).map_or(lines.len(), |e| e as usize).min(lines.len()).min(start + MAX_READ_LINES - 1); - if start > lines.len() { - return Err(format!("The file only has {} lines.", lines.len())); - } - let mut out: Vec<String> = (start..=end).map(|n| format!("{n:>5} {}", lines[n - 1])).collect(); - if end < lines.len() || start > 1 { - out.push(format!("(showing lines {start}-{end} of {}; pass start_line to read more)", lines.len())); - } - Ok(out.join("\n")) -} - -fn walk_files(dir: &Path, files: &mut Vec<PathBuf>) { - for (name, path, is_dir) in sorted_entries(dir) { - if files.len() >= 5000 { - return; - } - if is_dir { - if !ignored(&name) { - walk_files(&path, files); - } - } else { - files.push(path); - } - } -} - -pub fn search(root: &Path, args: &Value) -> Result<String, String> { - let query = arg(args, &QUERY_KEYS).filter(|q| !q.trim().is_empty()).ok_or("search needs a \"query\".")?; - let dir = resolve_path(root, arg(args, &PATH_KEYS).unwrap_or_default())?; - let needle = query.to_lowercase(); - let mut files = Vec::new(); - walk_files(&dir, &mut files); - let mut matches = Vec::new(); - let mut extra = 0; - for file in files { - if fs::metadata(&file).map_or(true, |m| m.len() > 1_000_000) { - continue; - } - let Ok(text) = read_text(&file) else { continue }; - for (index, line) in text.lines().enumerate() { - if line.to_lowercase().contains(&needle) { - if matches.len() < MAX_MATCHES { - let shown: String = line.trim().chars().take(200).collect(); - matches.push(format!("{}:{}: {shown}", display(root, &file), index + 1)); - } else { - extra += 1; - } - } - } - } - if matches.is_empty() { - return Ok(format!("No matches for \"{query}\".")); - } - if extra > 0 { - matches.push(format!("... and {extra} more matches. Narrow the search with a longer query or a path.")); - } - Ok(matches.join("\n")) -} - -pub struct Change { - pub path: PathBuf, - pub after: String, - pub diff: FileDiff, -} - -pub fn plan_change(root: &Path, kind: ToolKind, args: &Value) -> Result<Change, String> { - let rel = arg(args, &PATH_KEYS).ok_or(format!("{} needs a \"path\".", kind.name()))?; - let path = resolve_path(root, rel)?; - if path.is_dir() { - return Err(format!("{} is a folder, not a file.", display(root, &path))); - } - let before = if path.is_file() { Some(read_text(&path)?) } else { None }; - let after = match kind { - ToolKind::Write => arg(args, &CONTENT_KEYS).ok_or("write_file needs \"content\": the complete text of the file.")?.to_string(), - _ => { - let current = before.as_deref().ok_or(format!("{} does not exist. Use write_file to create it.", display(root, &path)))?; - let old = arg(args, &OLD_KEYS).ok_or("edit_file needs \"old_text\", copied exactly from the file.")?; - let new = arg(args, &NEW_KEYS).ok_or("edit_file needs \"new_text\". Use an empty string to delete.")?; - replace(current, old, new, arg_bool(args, "replace_all"))? - } - }; - let diff = diff_text(&display(root, &path), before.as_deref(), &after); - Ok(Change { path, after, diff }) -} - -fn replace(current: &str, old: &str, new: &str, all: bool) -> Result<String, String> { - if old.is_empty() { - return Err("old_text is empty. Copy the exact text you want to replace from the file.".into()); - } - let crlf = current.contains("\r\n") && !old.contains("\r\n"); - let (old, new) = if crlf { (old.replace('\n', "\r\n"), new.replace('\n', "\r\n")) } else { (old.to_string(), new.to_string()) }; - match current.matches(old.as_str()).count() { - 0 => Err("old_text was not found in the file. Read the file again and copy the text exactly, including indentation.".into()), - 1 => Ok(current.replacen(old.as_str(), &new, 1)), - _ if all => Ok(current.replace(old.as_str(), &new)), - n => Err(format!("old_text appears {n} times. Include more surrounding lines so it is unique, or set replace_all.")), - } -} - -pub fn apply(change: &Change) -> Result<(), String> { - if let Some(dir) = change.path.parent() { - fs::create_dir_all(dir).map_err(|e| e.to_string())?; - } - fs::write(&change.path, &change.after).map_err(|e| e.to_string()) -} - -pub fn command_timeout(args: &Value) -> Duration { - Duration::from_secs(arg_number(args, &["timeout_seconds", "timeout"]).unwrap_or(120).clamp(1, 600)) -} - -pub fn shell_name() -> &'static str { - if cfg!(windows) { "PowerShell" } else { "sh" } -} - -pub fn os_name() -> &'static str { - match std::env::consts::OS { - "windows" => "Windows", - "macos" => "macOS", - "linux" => "Linux", - other => other, - } -} - -fn shell(command: &str) -> Command { - if cfg!(windows) { - let mut cmd = Command::new("powershell"); - cmd.args([ - "-NoLogo", - "-NoProfile", - "-NonInteractive", - "-ExecutionPolicy", - "Bypass", - "-Command", - &format!("[Console]::OutputEncoding=[Text.Encoding]::UTF8; $ProgressPreference='SilentlyContinue'; {command}"), - ]); - hide_window(&mut cmd); - cmd - } else { - let mut cmd = Command::new("sh"); - cmd.args(["-c", command]); - cmd - } -} - -#[cfg(windows)] -fn hide_window(cmd: &mut Command) { - use std::os::windows::process::CommandExt; - cmd.creation_flags(0x0800_0000); -} - -#[cfg(not(windows))] -fn hide_window(_: &mut Command) {} - -fn cap(text: String) -> String { - if text.len() <= MAX_OUTPUT { - return text; - } - let mut head = MAX_OUTPUT * 2 / 3; - while !text.is_char_boundary(head) { - head -= 1; - } - let mut tail = text.len() - MAX_OUTPUT / 3; - while !text.is_char_boundary(tail) { - tail += 1; - } - format!("{}\n... [output cut] ...\n{}", &text[..head], &text[tail..]) -} - -pub fn run(root: &Path, command: &str, timeout: Duration, cancel: &AtomicBool) -> (bool, String) { - let child = shell(command).current_dir(root).stdin(Stdio::null()).stdout(Stdio::piped()).stderr(Stdio::piped()).spawn(); - let mut child = match child { - Ok(child) => child, - Err(e) => return (false, format!("The command could not start: {e}")), - }; - let mut stdout = child.stdout.take(); - let mut stderr = child.stderr.take(); - let out = std::thread::spawn(move || { - let mut buf = Vec::new(); - if let Some(s) = stdout.as_mut() { - let _ = s.read_to_end(&mut buf); - } - buf - }); - let err = std::thread::spawn(move || { - let mut buf = Vec::new(); - if let Some(s) = stderr.as_mut() { - let _ = s.read_to_end(&mut buf); - } - buf - }); - let started = Instant::now(); - let (status, note) = loop { - match child.try_wait() { - Ok(Some(status)) => break (Some(status), None), - Ok(None) if cancel.load(Ordering::Relaxed) => { - let _ = child.kill(); - break (None, Some("Stopped by the user.".to_string())); - } - Ok(None) if started.elapsed() > timeout => { - let _ = child.kill(); - break (None, Some(format!("Stopped after {} seconds without finishing.", timeout.as_secs()))); - } - Ok(None) => std::thread::sleep(Duration::from_millis(50)), - Err(e) => break (None, Some(e.to_string())), - } - }; - let _ = child.wait(); - let mut text = String::from_utf8_lossy(&out.join().unwrap_or_default()).into_owned(); - let err_text = String::from_utf8_lossy(&err.join().unwrap_or_default()).into_owned(); - if !err_text.trim().is_empty() { - if !text.is_empty() && !text.ends_with('\n') { - text.push('\n'); - } - text.push_str(&err_text); - } - let text = text.trim_end().to_string(); - let ok = status.is_some_and(|s| s.success()); - let mut report = match (status.and_then(|s| s.code()), note) { - (_, Some(note)) => note, - (Some(code), None) => format!("Exit code {code}"), - (None, None) => "Exited".into(), - }; - if !text.is_empty() { - report.push('\n'); - report.push_str(&text); - } - (ok, cap(report)) -} - -#[cfg(test)] -mod tests { - use super::*; - - fn temp_root(name: &str) -> PathBuf { - let dir = std::env::temp_dir().join(format!("quill-tools-{name}-{}", std::process::id())); - let _ = fs::remove_dir_all(&dir); - fs::create_dir_all(&dir).unwrap(); - dir - } - - #[test] - fn aliases_resolve_to_tools() { - assert_eq!(ToolKind::resolve("bash"), Some(ToolKind::Run)); - assert_eq!(ToolKind::resolve("str_replace"), Some(ToolKind::Edit)); - assert_eq!(ToolKind::resolve("Read-File"), Some(ToolKind::Read)); - assert_eq!(ToolKind::resolve("teleport"), None); - } - - #[test] - fn paths_cannot_leave_the_project() { - let root = PathBuf::from(r"C:\work\proj"); - assert!(resolve_path(&root, "src/main.rs").is_ok()); - assert!(resolve_path(&root, "../other").is_err()); - assert!(resolve_path(&root, r"C:\Windows\System32").is_err()); - assert!(resolve_path(&root, r"c:\WORK\proj\a.txt").is_ok()); - assert!(resolve_path(&root, r"C:\work\project2\a.txt").is_err()); - } - - #[test] - fn edits_need_a_unique_match() { - assert_eq!(replace("a b a", "b", "c", false).unwrap(), "a c a"); - assert!(replace("a b a", "a", "c", false).unwrap_err().contains("2 times")); - assert_eq!(replace("a b a", "a", "c", true).unwrap(), "c b c"); - assert!(replace("x", "y", "z", false).is_err()); - assert_eq!(replace("one\r\ntwo\r\n", "one\ntwo", "1\n2", false).unwrap(), "1\r\n2\r\n"); - } - - #[test] - fn files_are_planned_then_written() { - let root = temp_root("write"); - let change = plan_change(&root, ToolKind::Write, &json!({ "path": "src/a.txt", "content": "hi\n" })).unwrap(); - assert!(change.diff.created); - apply(&change).unwrap(); - let edit = plan_change(&root, ToolKind::Edit, &json!({ "file_path": "src/a.txt", "old_str": "hi", "new_str": "hello" })).unwrap(); - assert_eq!((edit.diff.added, edit.diff.removed), (1, 1)); - apply(&edit).unwrap(); - assert_eq!(fs::read_to_string(root.join("src/a.txt")).unwrap(), "hello\n"); - let listing = list(&root, &json!({})).unwrap(); - assert!(listing.contains("src/") && listing.contains(" a.txt")); - assert!(read(&root, &json!({ "path": "src/a.txt" })).unwrap().contains(" 1 hello")); - assert!(search(&root, &json!({ "query": "HELLO" })).unwrap().contains("src/a.txt:1: hello")); - fs::remove_dir_all(&root).unwrap(); - } - - #[test] - fn commands_report_exit_codes() { - let root = temp_root("run"); - let cancel = AtomicBool::new(false); - let (ok, output) = run(&root, "echo quill", Duration::from_secs(60), &cancel); - assert!(ok, "{output}"); - assert!(output.starts_with("Exit code 0") && output.contains("quill")); - let (ok, output) = run(&root, "exit 3", Duration::from_secs(60), &cancel); - assert!(!ok); - assert!(output.starts_with("Exit code 3")); - fs::remove_dir_all(&root).unwrap(); - } - - #[test] - fn broken_arguments_are_kept_for_the_error() { - assert_eq!(parse_args("{\"path\": \"a\"}")["path"], "a"); - assert!(parse_args("{oops").get("__invalid").is_some()); - assert_eq!(parse_args(""), json!({})); - } -} \ No newline at end of file diff --git a/crates/quill-code/Cargo.toml b/crates/quill-code/Cargo.toml index 82441c8..275629e 100644 --- a/crates/quill-code/Cargo.toml +++ b/crates/quill-code/Cargo.toml @@ -4,18 +4,26 @@ version.workspace = true edition.workspace = true license.workspace = true authors.workspace = true +repository.workspace = true publish.workspace = true +[[bin]] +name = "quill" +path = "src/main.rs" + [dependencies] -base64 = "0.22" -quill-agent.workspace = true -quill-llama.workspace = true +arboard = "3.7.0" +base64 = "0.23" +clap = { version = "4.6.7", features = ["derive"] } +crossterm = { version = "0.29.0", default-features = false, features = ["bracketed-paste", "events", "windows"] } +ctrlc = "3.5.2" +png = "0.18.1" +pulldown-cmark = { version = "0.13.4", default-features = false } +quill-config.workspace = true +quill-core.workspace = true +quill-git.workspace = true +quill-providers.workspace = true quill-weave.workspace = true -futures = "0.3" -gpui-kit.workspace = true serde = { version = "1", features = ["derive"] } serde_json = "1" -ureq = { version = "3.4.2", default-features = false, features = ["json", "native-tls"] } - -[build-dependencies] -winres = "0.1" \ No newline at end of file +unicode-width = "0.2.2" \ No newline at end of file diff --git a/crates/quill-code/build.rs b/crates/quill-code/build.rs deleted file mode 100644 index e62760c..0000000 --- a/crates/quill-code/build.rs +++ /dev/null @@ -1,6 +0,0 @@ -fn main() { - println!("cargo:rerun-if-changed=../../assets/brand/app.ico"); - if std::env::var("CARGO_CFG_TARGET_OS").is_ok_and(|os| os == "windows") { - winres::WindowsResource::new().set_icon("../../assets/brand/app.ico").compile().expect("embed the app icon"); - } -} \ No newline at end of file diff --git a/crates/quill-code/src/add_project.rs b/crates/quill-code/src/add_project.rs deleted file mode 100644 index 6aa563b..0000000 --- a/crates/quill-code/src/add_project.rs +++ /dev/null @@ -1,473 +0,0 @@ -use std::path::PathBuf; - -use gpui_kit::component::input::{Input, InputEvent, InputState}; -use gpui_kit::{ - Context, Entity, EventEmitter, FontWeight, IntoElement, KeyDownEvent, MouseButton, ParentElement, PathPromptOptions, Render, - SharedString, Styled, Subscription, Window, div, prelude::*, px, -}; - -use crate::config::projects_dir; -use crate::git; -use crate::github::Visibility; -use crate::icons::Icon; -use crate::palette::{Palette, palette}; -use crate::project; -use crate::ui::{MONO, icon}; - -pub enum AddProjectEvent { - Added(PathBuf, Option<String>), - Close, -} - -#[derive(Clone, Copy, PartialEq, Eq)] -enum Step { - Sources, - NewProject, - GitUrl, -} - -#[derive(Clone, Copy, PartialEq, Eq)] -enum Source { - New, - Folder, - GitUrl, - GitHub, -} - -pub struct AddProject { - step: Step, - input: Entity<InputState>, - branch: Entity<InputState>, - visibility: Option<Visibility>, - git: bool, - busy: bool, - error: Option<String>, - _subscriptions: Vec<Subscription>, -} - -impl EventEmitter<AddProjectEvent> for AddProject {} - -impl AddProject { - pub fn new(git: bool, window: &mut Window, cx: &mut Context<Self>) -> Self { - let input = cx.new(|cx| InputState::new(window, cx).placeholder("Where is the project coming from?")); - let branch = cx.new(|cx| InputState::new(window, cx).default_value("main")); - let on_input = - |this: &mut Self, _: &Entity<InputState>, event: &InputEvent, window: &mut Window, cx: &mut Context<Self>| match event { - InputEvent::PressEnter { .. } => this.confirm(window, cx), - InputEvent::Change => { - this.error = None; - cx.notify(); - } - _ => {} - }; - let subscriptions = vec![cx.subscribe_in(&input, window, on_input), cx.subscribe_in(&branch, window, on_input)]; - input.update(cx, |input, cx| input.focus(window, cx)); - AddProject { step: Step::Sources, input, branch, visibility: None, git, busy: false, error: None, _subscriptions: subscriptions } - } - - fn value(&self, cx: &Context<Self>) -> String { - self.input.read(cx).value().trim().to_string() - } - - fn go(&mut self, step: Step, window: &mut Window, cx: &mut Context<Self>) { - self.step = step; - self.error = None; - let placeholder = match step { - Step::Sources => "Where is the project coming from?", - Step::NewProject => "Name the new project", - Step::GitUrl => "https://github.com/owner/repo.git", - }; - self.input.update(cx, |input, cx| { - input.set_value("", window, cx); - input.set_placeholder(placeholder, window, cx); - input.focus(window, cx); - }); - cx.notify(); - } - - fn sources(&self, cx: &Context<Self>) -> Vec<Source> { - let query = self.value(cx).to_lowercase(); - [Source::New, Source::Folder, Source::GitUrl, Source::GitHub] - .into_iter() - .filter(|source| query.is_empty() || source_title(*source).to_lowercase().contains(&query)) - .collect() - } - - fn pick(&mut self, source: Source, window: &mut Window, cx: &mut Context<Self>) { - match source { - Source::New => self.go(Step::NewProject, window, cx), - Source::GitUrl if self.git => self.go(Step::GitUrl, window, cx), - Source::Folder => { - let picked = cx.prompt_for_paths(PathPromptOptions { - files: false, - directories: true, - multiple: false, - prompt: Some("Add project".into()), - }); - cx.spawn(async move |this, cx| { - if let Ok(Ok(Some(mut paths))) = picked.await - && let Some(path) = paths.pop() - { - _ = this.update(cx, |_, cx| cx.emit(AddProjectEvent::Added(path, None))); - } - }) - .detach(); - } - _ => {} - } - } - - fn confirm(&mut self, window: &mut Window, cx: &mut Context<Self>) { - if self.busy { - return; - } - match self.step { - Step::Sources => { - if let Some(source) = self.sources(cx).first().copied() { - self.pick(source, window, cx); - } - } - Step::NewProject => { - let branch = self.branch.read(cx).value().trim().to_string(); - if self.git && !git::valid_branch(&branch) { - self.error = Some("Give the first branch a name Git accepts, such as main.".into()); - cx.notify(); - return; - } - let name = self.value(cx); - let git_branch = self.git.then_some(branch); - let visibility = self.visibility.filter(|_| self.git); - self.run(cx, move || project::create(&name, git_branch.as_deref(), visibility).map(|created| (created.path, created.note))); - } - Step::GitUrl => { - let url = self.value(cx); - if !url.is_empty() { - self.run(cx, move || project::clone(&url).map(|path| (path, None))); - } - } - } - } - - fn run(&mut self, cx: &mut Context<Self>, work: impl FnOnce() -> Result<(PathBuf, Option<String>), String> + Send + 'static) { - self.busy = true; - self.error = None; - cx.notify(); - let task = cx.background_executor().spawn(async move { work() }); - cx.spawn(async move |this, cx| { - let result = task.await; - _ = this.update(cx, |this, cx| { - this.busy = false; - match result { - Ok((path, note)) => cx.emit(AddProjectEvent::Added(path, note)), - Err(error) => this.error = Some(error), - } - cx.notify(); - }); - }) - .detach(); - } - - fn new_options(&self, p: Palette, cx: &mut Context<Self>) -> gpui_kit::Div { - let choices = [ - ("vis-local", None, "Only on this PC"), - ("vis-private", Some(Visibility::Private), "Private on GitHub"), - ("vis-public", Some(Visibility::Public), "Public on GitHub"), - ]; - let label = |text: &'static str| div().w(px(110.)).flex_shrink_0().text_size(px(13.)).text_color(p.text_muted).child(text); - div() - .flex() - .flex_col() - .gap(px(10.)) - .px(px(12.)) - .pt(px(10.)) - .pb(px(8.)) - .child( - div() - .flex() - .items_center() - .child(label("First branch")) - .child(div().w(px(220.)).font_family(MONO).text_size(px(13.)).child(Input::new(&self.branch))), - ) - .child(div().flex().items_center().child(label("Also on GitHub")).child(div().flex().gap(px(6.)).children(choices.map( - |(id, choice, text)| { - let on = self.visibility == choice; - div() - .id(id) - .px(px(10.)) - .py(px(4.)) - .rounded(px(7.)) - .border_1() - .border_color(if on { p.border } else { p.border_soft }) - .when(on, |chip| chip.bg(p.row_active)) - .text_size(px(12.5)) - .text_color(if on { p.text } else { p.text_muted }) - .cursor_pointer() - .hover(move |style| style.bg(p.row_hover)) - .child(text) - .on_click(cx.listener(move |this, _, _, cx| { - this.visibility = choice; - this.error = None; - cx.notify(); - })) - }, - )))) - } - - pub fn back(&mut self, window: &mut Window, cx: &mut Context<Self>) { - match self.step { - Step::Sources => cx.emit(AddProjectEvent::Close), - _ => self.go(Step::Sources, window, cx), - } - } -} - -fn row( - id: &'static str, - name: Icon, - title: impl Into<SharedString>, - detail: impl Into<SharedString>, - badge: Option<&'static str>, - first: bool, - p: Palette, -) -> gpui_kit::Stateful<gpui_kit::Div> { - let enabled = badge.is_none(); - div() - .id(id) - .flex() - .items_center() - .gap(px(12.)) - .px(px(12.)) - .py(px(9.)) - .rounded(px(10.)) - .when(first && enabled, |row| row.bg(p.row_hover)) - .when(enabled, |row| row.cursor_pointer().hover(move |style| style.bg(p.row_active))) - .child(icon(name, 18., if enabled { p.text_muted } else { p.text_faint })) - .child( - div() - .flex_1() - .min_w_0() - .flex() - .flex_col() - .child(div().text_size(px(14.)).text_color(if enabled { p.text } else { p.text_faint }).child(title.into())) - .child(div().text_size(px(12.5)).text_color(p.text_faint).child(detail.into())), - ) - .when_some(badge, |row, badge| { - row.child( - div() - .px(px(8.)) - .py(px(2.)) - .rounded(px(6.)) - .border_1() - .border_color(p.warning.opacity(0.5)) - .bg(p.warning.opacity(0.1)) - .text_size(px(11.5)) - .text_color(p.warning) - .child(badge), - ) - }) -} - -fn source_title(source: Source) -> &'static str { - match source { - Source::New => "Start fresh", - Source::Folder => "Open a folder", - Source::GitUrl => "Clone a repository", - Source::GitHub => "From GitHub", - } -} - -fn key_hint(key: &'static str, label: &'static str, p: Palette) -> impl IntoElement { - div() - .flex() - .items_center() - .gap(px(6.)) - .child( - div() - .px(px(6.)) - .py(px(1.)) - .rounded(px(5.)) - .bg(p.fill) - .border_1() - .border_color(p.border_soft) - .text_size(px(11.5)) - .font_weight(FontWeight::SEMIBOLD) - .text_color(p.text_muted) - .child(key), - ) - .child(label) -} - -impl Render for AddProject { - fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement { - let p = palette(cx); - let home = projects_dir().display().to_string(); - let body = match self.step { - Step::Sources => { - let sources = self.sources(cx); - div() - .flex() - .flex_col() - .gap(px(2.)) - .child(div().px(px(12.)).pt(px(4.)).pb(px(6.)).text_size(px(12.)).text_color(p.text_faint).child("Add a project from")) - .children(sources.iter().enumerate().map(|(index, source)| { - let source = *source; - let first = index == 0; - let row = match source { - Source::New => { - row("src-new", Icon::FolderPlus, "Start fresh", format!("An empty folder in {home}"), None, first, p) - } - Source::Folder => { - row("src-folder", Icon::FolderOpen, "Open a folder", "Something already on this PC", None, first, p) - } - Source::GitUrl => row( - "src-git", - Icon::Link, - "Clone a repository", - "Paste any Git URL", - (!self.git).then_some("Needs Git"), - first, - p, - ), - Source::GitHub => row( - "src-github", - Icon::Globe, - "From GitHub", - "Pick from your repositories once you sign in", - Some("Soon"), - first, - p, - ), - }; - row.on_click(cx.listener(move |this, _, window, cx| this.pick(source, window, cx))) - })) - } - Step::NewProject => { - let name = project::clean_name(&self.value(cx)); - let target = if name.is_empty() { format!("Lives in {home}") } else { format!("Will be {home}\\{name}") }; - let title = match (self.busy, self.visibility.filter(|_| self.git)) { - (true, None) => "Creating, hang on", - (true, Some(_)) => "Creating and publishing, hang on", - (false, None) => "Create it", - (false, Some(Visibility::Private)) => "Create it and publish it privately", - (false, Some(Visibility::Public)) => "Create it and publish it publicly", - }; - div() - .flex() - .flex_col() - .child( - row("create-project", Icon::FolderPlus, title, target, None, true, p) - .on_click(cx.listener(|this, _, window, cx| this.confirm(window, cx))), - ) - .when(self.git, |col| col.child(self.new_options(p, cx))) - } - Step::GitUrl => { - let name = project::repo_name(&self.value(cx)); - let target = if name.is_empty() { format!("Lands in {home}") } else { format!("Lands in {home}\\{name}") }; - let title = if self.busy { "Cloning, hang on" } else { "Clone it" }; - div().flex().flex_col().child( - row("clone-project", Icon::Download, title, target, None, true, p) - .on_click(cx.listener(|this, _, window, cx| this.confirm(window, cx))), - ) - } - }; - let viewport = window.viewport_size(); - div() - .absolute() - .top_0() - .left_0() - .w(viewport.width) - .h(viewport.height) - .occlude() - .bg(gpui_kit::black().opacity(0.55)) - .flex() - .items_start() - .justify_center() - .on_mouse_down(MouseButton::Left, cx.listener(|_, _, _, cx| cx.emit(AddProjectEvent::Close))) - .on_key_down(cx.listener(|this, event: &KeyDownEvent, window, cx| { - if event.keystroke.key == "escape" { - this.back(window, cx); - } - })) - .child( - div() - .id("add-project") - .mt(px(96.)) - .w(px(660.)) - .max_h(px(560.)) - .flex() - .flex_col() - .rounded(px(16.)) - .bg(p.menu_bg) - .border_1() - .border_color(p.border) - .shadow_lg() - .on_mouse_down(MouseButton::Left, |_, _, cx| cx.stop_propagation()) - .child( - div() - .flex() - .items_center() - .gap(px(10.)) - .px(px(14.)) - .py(px(12.)) - .border_b_1() - .border_color(p.border_soft) - .child( - div() - .id("sheet-back") - .size(px(26.)) - .flex() - .items_center() - .justify_center() - .rounded(px(7.)) - .cursor_pointer() - .hover(move |style| style.bg(p.row_hover)) - .child(icon(Icon::ArrowLeft, 15., p.text_muted)) - .on_click(cx.listener(|this, _, window, cx| this.back(window, cx))), - ) - .child(div().flex_1().text_size(px(15.)).child(Input::new(&self.input).appearance(false))) - .when(self.step != Step::Sources, |row| { - row.child( - div() - .px(px(8.)) - .py(px(3.)) - .rounded(px(7.)) - .bg(p.fill) - .text_size(px(12.)) - .text_color(p.text_muted) - .child(if self.step == Step::NewProject { "Enter to create" } else { "Enter to clone" }), - ) - }), - ) - .child(div().id("sheet-body").p(px(6.)).overflow_y_scroll().child(body)) - .when_some(self.error.clone(), |sheet, error| { - sheet.child( - div() - .mx(px(14.)) - .mb(px(8.)) - .px(px(12.)) - .py(px(8.)) - .rounded(px(8.)) - .bg(p.danger.opacity(0.1)) - .text_size(px(13.)) - .text_color(p.danger) - .font_family(if error.contains("fatal") { MONO } else { crate::palette::FONT }) - .child(error), - ) - }) - .child( - div() - .flex() - .items_center() - .gap(px(16.)) - .px(px(16.)) - .py(px(10.)) - .border_t_1() - .border_color(p.border_soft) - .text_size(px(12.5)) - .text_color(p.text_faint) - .child(key_hint("Enter", "Choose", p)) - .child(key_hint("Esc", "Go back", p)), - ), - ) - } -} \ No newline at end of file diff --git a/crates/quill-code/src/app.rs b/crates/quill-code/src/app.rs new file mode 100644 index 0000000..75997b8 --- /dev/null +++ b/crates/quill-code/src/app.rs @@ -0,0 +1,1840 @@ +use std::io::IsTerminal; +use std::path::PathBuf; +use std::sync::mpsc::{RecvTimeoutError, Sender, channel}; +use std::time::{Duration, Instant}; + +use crossterm::event::{KeyCode, KeyEvent, KeyModifiers}; +use crossterm::style::{ContentStyle, Stylize}; +use quill_config::{ModelRef, Provider, Reasoning}; +use quill_core::{Access, Decision, Event}; +use quill_git::github::{self, PullRequest, PullState}; +use quill_git::{self as git, Snapshot}; +use quill_providers::{Control, context_label, normalize_url}; +use quill_weave::State; + +use crate::Msg; +use crate::attachments::Attachment; +use crate::backend::{self, Backend, Connection}; +use crate::clipboard; +use crate::commit::{Flow, Update}; +use crate::composer::Composer; +use crate::config::{Config, personal_instructions_path}; +use crate::history::{self, Look, Progress}; +use crate::mentions::{self, Command, INIT_PROMPT, Trigger}; +use crate::picker::{Choice, Picked, Picker}; +use crate::project; +use crate::setup::{self, Setup}; +use crate::term::{self, Live, Screen, Scroll}; +use crate::text::{Line, accent, bad, blue, bold, caret, dim, good, indent, pad, plain, truncate, warn, wrap}; +use crate::thread::{Item, Turn, ago}; +use crate::update; +use crate::usage; +use crate::weave; +use crate::workspace::{Prompt, Workspace}; + +const SPINNER: [&str; 10] = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]; +const PLACEHOLDER: &str = "Ask Quill to do something"; +const HINTS: [&str; 2] = ["shift+tab mode · / commands · @ files", "shift+tab mode"]; +const SUGGESTIONS: usize = 8; +const THOUGHT_EVERY: Duration = Duration::from_millis(2500); +const INTRO_NOTES: usize = 6; + +type Frame = Live; + +#[derive(Clone, Default)] +pub struct Repo { + pub root: PathBuf, + pub snapshot: Option<Snapshot>, + pub remote: Option<String>, + pub pull: Option<PullRequest>, +} + +#[derive(Clone)] +enum Think { + Thinking(bool), + Effort(String), +} + +enum Overlay { + Model(Picker<Option<ModelRef>>), + Think(Picker<Think>), + Mode(Picker<Access>), + Resume(Picker<u64>, Option<u64>), + Branch(Picker<String>, PathBuf), + Commit(Box<Flow>), + Setup(Box<Setup>), + Trust(Picker<bool>), + Version(Picker<String>), +} + +enum Suggestions { + Commands(Vec<Command>), + Files { start: usize, paths: Vec<String> }, +} + +impl Suggestions { + fn len(&self) -> usize { + match self { + Suggestions::Commands(commands) => commands.len(), + Suggestions::Files { paths, .. } => paths.len(), + } + } +} + +struct View { + thread: u64, + turn: usize, + progress: Progress, +} + +pub struct App { + config: Config, + backend: Backend, + workspace: Workspace, + root: PathBuf, + isolate: bool, + composer: Composer, + overlay: Option<Overlay>, + suggestions: Option<Suggestions>, + highlighted: usize, + files: Option<(PathBuf, Vec<String>)>, + choice: usize, + instead: String, + view: Option<View>, + out: Vec<Line>, + queued: Option<Prompt>, + repo: Repo, + git: bool, + started: Instant, + width: usize, + height: usize, + quit_at: Option<Instant>, + quit: bool, + guided: bool, + thought: Option<(Instant, String)>, + intro: bool, + intro_notes: Vec<Line>, + clear: bool, + editing: Option<PathBuf>, + waiting: Option<(bool, String)>, + scroll: Option<Scroll>, + switching: Option<(String, bool)>, + tx: Sender<Msg>, +} + +fn rule(width: usize) -> Line { + Line::styled("─".repeat(width), dim()) +} + +fn typing_row(row: &mut Line, typed: &str, placeholder: &str, focused: bool, resting: ContentStyle) { + if !typed.is_empty() { + row.push(typed, bold()); + if focused { + row.push(" ", plain().reverse()); + } + return; + } + match placeholder.chars().next().filter(|_| focused) { + Some(first) => { + row.push(first.to_string(), dim().reverse()); + row.push(&placeholder[first.len_utf8()..], dim()); + } + None => row.push(placeholder, resting), + } +} + +fn mode_style(access: Access) -> ContentStyle { + let style = match access { + Access::Supervised => good(), + Access::AutoEdits => warn(), + Access::Full => blue(), + }; + style.bold() +} + +fn help() -> Vec<Line> { + let mut lines = vec![Line::styled("Commands", bold())]; + for command in Command::ALL { + lines.push(Line::plain(format!(" /{}", pad(command.name(), Command::widest() + 2))).with(command.description(), dim())); + } + lines.push(Line::default()); + lines.push(Line::styled("Keys", bold())); + let keys = [ + ("enter", "send, or steer the reply while Quill works"), + ("shift+enter", "new line (alt+enter and ctrl+j work too)"), + ("shift+tab", "switch between Ask first, Trust edits and Autopilot"), + ("ctrl+o", "show or hide the model's thoughts"), + ("page up/down", "scroll the conversation; the mouse wheel works too"), + ("esc", "stop the reply, close a menu"), + ("ctrl+c", "clear the prompt or stop; press twice to quit"), + ("↑ ↓", "move through earlier prompts"), + ("tab", "take the highlighted suggestion"), + ("alt+v", "attach an image from the clipboard"), + ("@path", "bring in a file; images go to models that can see them"), + ]; + for (key, action) in keys { + lines.push(Line::plain(format!(" {}", pad(key, Command::widest() + 3))).with(action, dim())); + } + lines.push(Line::default()); + lines.push(Line::styled("Paste or drag a file path into the prompt to attach the file.", dim())); + lines +} + +impl App { + fn new(root: PathBuf, isolate: bool, tx: Sender<Msg>, width: usize, height: usize) -> App { + let config = Config::load(); + let mut backend = Backend::new(tx.clone()); + backend.refresh(&config.settings); + let workspace = Workspace::new(tx.clone()); + let mut prompts: Vec<(u64, String)> = workspace + .threads_in(&root) + .iter() + .flat_map(|thread| thread.turns.iter().map(|turn| (turn.started, turn.prompt.clone()))) + .collect(); + prompts.sort_by_key(|(started, _)| *started); + let skip = prompts.len().saturating_sub(200); + let history = prompts.into_iter().skip(skip).map(|(_, prompt)| prompt).collect(); + App { + config, + backend, + workspace, + isolate, + composer: Composer::new(history), + overlay: None, + suggestions: None, + highlighted: 0, + files: None, + choice: 0, + instead: String::new(), + view: None, + out: Vec::new(), + queued: None, + repo: Repo { root: root.clone(), ..Repo::default() }, + git: project::git_available(), + started: Instant::now(), + width, + height, + quit_at: None, + quit: false, + guided: false, + thought: None, + intro: true, + intro_notes: Vec::new(), + clear: false, + editing: None, + waiting: None, + scroll: None, + switching: None, + tx, + root, + } + } + + fn look(&self) -> Look { + let appearance = &self.config.settings.appearance; + Look { width: self.width, reasoning: appearance.reasoning, group: appearance.group_exploration } + } + + fn spinner(&self) -> &'static str { + SPINNER[(self.started.elapsed().as_millis() / 80) as usize % SPINNER.len()] + } + + fn notice(&mut self, text: impl Into<String>) { + let lines = wrap(&Line::styled(text.into(), dim()), self.width.saturating_sub(2)); + self.out.push(Line::default()); + self.out.extend(indent(lines, Line::styled("· ", dim()), Line::plain(" "))); + } + + fn problem(&mut self, text: impl Into<String>) { + let lines = wrap(&Line::styled(text.into(), bad()), self.width.saturating_sub(2)); + self.out.push(Line::default()); + self.out.extend(indent(lines, Line::styled("! ", bad()), Line::plain(" "))); + } + + fn workdir(&self) -> PathBuf { + self.workspace.active_thread().and_then(|thread| thread.workdir()).filter(|path| path.is_dir()).unwrap_or_else(|| self.root.clone()) + } + + fn banner(&self) -> Vec<Line> { + let settings = &self.config.settings; + let model = settings.models.selected.as_ref().map_or("no model yet, pick one with /model".to_string(), |m| m.model.clone()); + let place = project::short_path(&self.root); + let access = settings.agent.access; + let text = [ + Line::styled("Quill Code", bold()).with(format!(" v{}", env!("CARGO_PKG_VERSION")), dim()), + Line::plain(model).with(" · ", dim()).with(access.label(), mode_style(access)), + Line::styled(place, dim()), + Line::styled("/help for commands · esc stops a reply", dim()), + ]; + let mark = weave::mark(8, 4, State::Idle, self.started.elapsed().as_secs_f64()); + let mut lines = vec![Line::default()]; + lines.extend(mark.into_iter().zip(text).map(|(mark, text)| Line::plain(format!(" {mark} ")).with_line(text))); + lines + } + + fn viewed_turn(&self) -> Option<&Turn> { + let view = self.view.as_ref()?; + self.workspace.threads.iter().find(|thread| thread.id == view.thread)?.turns.get(view.turn) + } + + fn refresh_thought(&mut self) { + let due = self.thought.as_ref().is_none_or(|(at, _)| at.elapsed() >= THOUGHT_EVERY); + let thinking = match self.viewed_turn().filter(|turn| turn.working()).and_then(|turn| turn.items.last()) { + Some(Item::Reasoning(text)) => Some(if due { history::summary(text) } else { None }), + _ => None, + }; + match thinking { + None => self.thought = None, + Some(Some(sentence)) if self.thought.as_ref().is_none_or(|(_, shown)| *shown != sentence) => { + self.thought = Some((Instant::now(), sentence)); + } + Some(_) => {} + } + } + + fn take_out(&mut self) -> Vec<Line> { + if self.intro { + self.intro_notes.append(&mut self.out); + if self.intro_notes.len() <= INTRO_NOTES { + return Vec::new(); + } + self.end_intro(); + } + std::mem::take(&mut self.out) + } + + fn end_intro(&mut self) { + if !self.intro { + return; + } + self.intro = false; + let mut lines = self.banner(); + lines.push(Line::default()); + lines.append(&mut self.intro_notes); + lines.append(&mut self.out); + self.out = lines; + } + + fn toggle_thoughts(&mut self) { + let expand = self.config.settings.appearance.reasoning != Reasoning::Expanded; + let next = if expand { Reasoning::Expanded } else { Reasoning::Hidden }; + self.config.update(|settings| settings.appearance.reasoning = next); + self.notice(if expand { + "Thoughts now show in full. ctrl+o hides them again." + } else { + "Thoughts are hidden. ctrl+o shows them in full." + }); + } + + fn open_instructions(&mut self) { + let path = personal_instructions_path(); + if !path.is_file() { + let made = path.parent().map_or(Ok(()), std::fs::create_dir_all).and_then(|_| std::fs::write(&path, "")); + if let Err(error) = made { + return self.problem(format!("{} could not be created: {error}", path.display())); + } + } + self.editing = Some(path); + } + + fn edited(&mut self, path: &std::path::Path, before: &str, result: Result<(), String>) { + if let Err(error) = result { + return self.problem(error); + } + let place = project::short_path(path); + if std::fs::read_to_string(path).unwrap_or_default() != before { + self.notice(format!("Saved your personal instructions in {place}. Every turn reads them.")); + } else { + self.notice(format!("Your personal instructions are in {place}. Every turn reads them once the file is saved.")); + } + } + + fn cycle_mode(&mut self) { + let current = self.config.settings.agent.access; + let index = Access::ALL.iter().position(|access| *access == current).unwrap_or(0); + let next = Access::ALL[(index + 1) % Access::ALL.len()]; + self.config.update(|settings| settings.agent.access = next); + } + + fn start(&mut self, resume: bool, prompt: String) { + if let Some(error) = self.config.error.clone() { + self.problem(format!("{error}. Using the defaults until it is fixed: quill config edit")); + } + if self.config.settings.general.trusted.iter().any(|folder| project::within(&self.root, folder)) { + return self.begin(resume, prompt); + } + let choices = vec![ + Choice::new("Yes, trust this folder", "Quill may read and edit files and run commands here", true), + Choice::new("No, leave", "Quill Code closes without touching anything", false), + ]; + let title = format!("Do you trust the files in {}?", project::short_path(&self.root)); + self.overlay = Some(Overlay::Trust(Picker::new(title, choices).hint("enter choose · esc leaves"))); + self.waiting = Some((resume, prompt)); + } + + fn trust(&mut self, trusted: bool) { + self.overlay = None; + if !trusted { + self.quit = true; + return; + } + let root = self.root.clone(); + self.config.update(|settings| settings.general.trusted.push(root)); + if let Some((resume, prompt)) = self.waiting.take() { + self.begin(resume, prompt); + } + } + + fn begin(&mut self, resume: bool, prompt: String) { + if resume { + match self.workspace.threads_in(&self.root).first().map(|thread| thread.id) { + Some(id) => self.open_thread(id), + None => self.notice("No earlier thread in this folder yet."), + } + } + self.refresh_repo(); + if self.config.settings.models.providers.is_empty() { + self.open_setup(true); + } + if !prompt.trim().is_empty() { + self.send(Prompt { text: prompt, attachments: Vec::new() }); + } + } + + fn resize(&mut self, width: usize, height: usize) { + self.width = width; + self.height = height; + } + + fn animating(&self) -> bool { + self.intro + || self.workspace.running() + || self.queued.is_some() + || matches!(&self.overlay, Some(Overlay::Commit(flow)) if flow.working()) + || matches!(&self.overlay, Some(Overlay::Setup(setup)) if setup.working()) + || self.quit_at.is_some_and(|at| at.elapsed() < Duration::from_secs(3)) + } + + fn refresh_repo(&mut self) { + if !self.git { + return; + } + let root = self.workdir(); + let tx = self.tx.clone(); + std::thread::spawn(move || { + let snapshot = git::snapshot(&root); + let remote = snapshot.as_ref().and_then(|_| git::remote_url(&root)); + let mut repo = Repo { root, snapshot, remote, pull: None }; + let _ = tx.send(Msg::Repo(repo.clone())); + let slug = repo.remote.as_deref().and_then(git::github_slug); + let branch = repo.snapshot.as_ref().filter(|snapshot| snapshot.upstream).and_then(|snapshot| snapshot.branch.clone()); + if let (Some(slug), Some(branch)) = (slug, branch) { + repo.pull = github::pull_request(&slug, &branch); + if repo.pull.is_some() { + let _ = tx.send(Msg::Repo(repo)); + } + } + }); + } + + fn handle(&mut self, msg: Msg) { + match msg { + Msg::Key(key) => self.key(key), + Msg::Paste(text) => self.paste(&text), + Msg::Resize | Msg::Interrupt => {} + Msg::Scroll(scroll) => self.scroll = Some(scroll), + Msg::Session(id, event) => self.session(id, event), + Msg::Probed { generation, id, found } => { + self.backend.probed(generation, &id, found, &self.config.settings); + if matches!(self.overlay, Some(Overlay::Model(_))) { + self.rebuild_models(); + } + self.try_queued(); + self.guide(); + } + Msg::Detected(found) => { + if let Some(Overlay::Setup(setup)) = &mut self.overlay { + setup.detected(found); + } + } + Msg::Connected(result) => { + if let Some(Overlay::Setup(setup)) = &mut self.overlay { + setup.connected(result); + } + } + Msg::Releases(result) => self.show_versions(result), + Msg::Props { model, props } => self.backend.got_props(model, props), + Msg::Repo(repo) => { + if project::same(&repo.root, &self.workdir()) { + self.repo = repo; + } + } + Msg::Job(job) => { + let Some(Overlay::Commit(flow)) = &mut self.overlay else { return }; + let mut lines = Vec::new(); + let update = flow.job(job, &mut lines); + if !lines.is_empty() { + self.out.push(Line::default()); + self.out.append(&mut lines); + } + if update == Update::Close { + self.overlay = None; + self.refresh_repo(); + } + } + } + } + + fn guide(&mut self) { + if self.guided || self.backend.sources.iter().any(|source| source.connection == Connection::Checking) { + return; + } + self.guided = true; + let selected = self.config.settings.models.selected.clone(); + if selected.as_ref().is_some_and(|model| self.backend.find(model).is_some()) { + return; + } + if self.backend.sources.iter().any(|source| !source.models.is_empty()) { + match &selected { + Some(model) => { + self.notice(format!("{} is not available right now. Pick another model, or start its server again.", model.model)) + } + None => self.notice("Pick the model that powers Quill to get started."), + } + if self.overlay.is_none() { + self.overlay = Some(Overlay::Model(self.model_picker())); + } + return; + } + let lines: Vec<String> = self + .backend + .sources + .iter() + .map(|source| format!("{} at {} is not answering: {}", source.config.name, source.config.url, source.status())) + .collect(); + for line in lines { + self.notice(line); + } + self.notice("Start it, or connect another server with /connect."); + } + + fn open_setup(&mut self, welcome: bool) { + self.overlay = Some(Overlay::Setup(Box::new(Setup::new(welcome, self.tx.clone())))); + let settings = self.config.settings.clone(); + let tx = self.tx.clone(); + std::thread::spawn(move || { + let _ = tx.send(Msg::Detected(backend::scan(&settings))); + }); + } + + fn connected(&mut self, provider: Provider, model: String) { + let models = &self.config.settings.models; + let same = |p: &Provider| p.kind == provider.kind && normalize_url(&p.url) == normalize_url(&provider.url); + let id = models.providers.iter().find(|p| same(p)).map_or_else(|| models.fresh_id(provider.kind), |p| p.id.clone()); + let chosen = ModelRef::new(id.clone(), model.clone()); + let (label, url) = (provider.kind.label(), provider.url.clone()); + self.config.update(|settings| { + settings.models.providers.retain(|p| p.id != id); + settings.models.providers.push(Provider { id, ..provider }); + settings.models.selected = Some(chosen.clone()); + }); + self.overlay = None; + self.backend.refresh(&self.config.settings); + self.backend.select(chosen); + self.guided = true; + self.notice(format!("Connected to {label} at {url}. Quill now runs on {model}.")); + } + + fn session(&mut self, id: u64, event: Event) { + let failed = match &event { + Event::CompactFailed { reason } => Some(reason.clone()), + _ => None, + }; + let compacted = matches!(event, Event::Compacted { .. }) && !self.workspace.running(); + let finished = self.workspace.apply(id, event); + if let Some(reason) = failed { + self.problem(reason); + } + if compacted { + self.notice("The conversation was summarised to free up the model's context."); + } + self.advance(); + if finished { + self.backend.refresh(&self.config.settings); + self.refresh_repo(); + } + } + + fn advance(&mut self) { + let look = self.look(); + let Some(view) = self.view.as_mut() else { return }; + let Some(turn) = self.workspace.threads.iter().find(|t| t.id == view.thread).and_then(|t| t.turns.get(view.turn)) else { + self.view = None; + return; + }; + self.out.extend(view.progress.advance(turn, look)); + if view.progress.done() { + self.view = None; + } + } + + fn try_queued(&mut self) { + let Some(selected) = self.config.settings.models.selected.clone() else { return }; + if !self.backend.checking(&selected.provider) + && let Some(prompt) = self.queued.take() + { + self.send(prompt); + } + } + + fn send(&mut self, prompt: Prompt) { + self.end_intro(); + self.scroll = Some(Scroll::Bottom); + self.config.reload(); + if let Some(selected) = &self.config.settings.models.selected + && self.backend.checking(&selected.provider) + { + self.queued = Some(prompt); + return; + } + let worktree = self.workspace.active_thread().and_then(|thread| thread.worktree.clone()); + let Some(index) = self.workspace.send(prompt, &self.root, self.isolate, &mut self.backend, &self.config.settings) else { return }; + self.isolate = false; + let look = self.look(); + let Some(thread) = self.workspace.active_thread() else { return }; + let Some(turn) = thread.turns.get(index) else { return }; + self.out.push(Line::default()); + self.out.extend(history::prompt_lines(turn, look)); + let isolated = thread.worktree.clone().filter(|path| Some(path) != worktree.as_ref()); + let id = thread.id; + if let Some(path) = isolated { + self.notice(format!("Working in an isolated copy at {}", path.display())); + self.refresh_repo(); + } + self.view = Some(View { thread: id, turn: index, progress: Progress::new() }); + self.choice = 0; + self.advance(); + } + + fn open_thread(&mut self, id: u64) { + self.end_intro(); + self.workspace.open(id); + self.view = None; + let look = self.look(); + let Some(thread) = self.workspace.active_thread() else { return }; + let mut lines = vec![Line::default(), Line::styled(format!("── {} ──", thread.title), dim())]; + let skip = thread.turns.len().saturating_sub(10); + if skip > 0 { + lines.push(Line::styled(format!("· {skip} earlier turns are not shown"), dim())); + } + for turn in thread.turns.iter().skip(skip) { + lines.extend(history::turn_lines(turn, look)); + } + self.out.extend(lines); + self.refresh_repo(); + } + + fn interrupt(&mut self) { + self.suggestions = None; + if matches!(self.overlay, Some(Overlay::Trust(_))) { + return self.trust(false); + } + if matches!(&self.overlay, Some(Overlay::Commit(flow)) if flow.working()) { + return; + } + if self.overlay.take().is_some() { + return; + } + if self.workspace.running() { + return self.stop(); + } + if self.queued.take().is_some() { + return; + } + if !self.composer.is_empty() { + self.composer.clear(); + return; + } + if self.quit_at.is_some_and(|at| at.elapsed() < Duration::from_secs(3)) { + self.quit = true; + return; + } + self.quit_at = Some(Instant::now()); + } + + fn stop(&mut self) { + self.workspace.stop(); + self.advance(); + } + + fn key(&mut self, key: KeyEvent) { + let control = key.modifiers.contains(KeyModifiers::CONTROL); + if control && key.code == KeyCode::Char('c') { + return self.interrupt(); + } + self.quit_at = None; + let scroll = match key.code { + KeyCode::PageUp => Some(Scroll::Pages(1)), + KeyCode::PageDown => Some(Scroll::Pages(-1)), + KeyCode::Home if control => Some(Scroll::Top), + KeyCode::End if control => Some(Scroll::Bottom), + _ => None, + }; + if scroll.is_some() { + self.scroll = scroll; + return; + } + if control && key.code == KeyCode::Char('d') && self.composer.is_empty() && self.overlay.is_none() && !self.workspace.running() { + self.quit = true; + return; + } + if control && key.code == KeyCode::Char('o') { + return self.toggle_thoughts(); + } + if self.overlay.is_some() { + return self.overlay_key(key); + } + if self.workspace.pending().is_some() { + return self.approval_key(key); + } + if key.code == KeyCode::BackTab { + return self.cycle_mode(); + } + if self.suggestions.is_some() && self.suggestion_key(key) { + return; + } + if self.workspace.asked().is_some() && self.question_key(key) { + return; + } + match key.code { + KeyCode::Esc => { + if self.workspace.running() { + self.stop(); + } else if self.queued.take().is_some() { + self.notice("Not sent."); + } + } + KeyCode::Enter if !key.modifiers.intersects(KeyModifiers::SHIFT | KeyModifiers::ALT) => self.submit(), + KeyCode::Char('v') if key.modifiers.contains(KeyModifiers::ALT) => self.paste_image(), + _ => { + if self.composer.key(key) { + self.refresh_suggestions(); + } + } + } + } + + fn paste(&mut self, text: &str) { + match &mut self.overlay { + Some(Overlay::Commit(flow)) => flow.paste(text), + Some(Overlay::Setup(setup)) => setup.paste(text), + Some(Overlay::Model(picker)) => picker.paste(text), + Some(Overlay::Resume(picker, _)) => picker.paste(text), + Some(Overlay::Branch(picker, _)) => picker.paste(text), + Some(Overlay::Version(picker)) => picker.paste(text), + Some(Overlay::Think(_) | Overlay::Mode(_) | Overlay::Trust(_)) => {} + None if self.workspace.pending().is_some() => { + self.instead.push_str(&text.replace(['\r', '\n'], " ")); + self.choice = self.approval_choices().len(); + } + None if self.workspace.asked().is_some() => { + if let Some(asked) = self.workspace.asked_mut() { + let current = asked.current; + asked.highlight[current] = asked.other_row(); + asked.typed[current].push_str(&text.replace(['\r', '\n'], " ")); + asked.picked[current] = None; + } + } + None => { + self.composer.paste(text); + self.refresh_suggestions(); + } + } + } + + fn paste_image(&mut self) { + match clipboard::save_image() { + Ok(Some(path)) => { + let name = format!("clipboard {}.png", self.composer.attachments.len() + 1); + self.composer.attachments.push(Attachment { path, name, image: true }); + } + Ok(None) => self.notice("No image on the clipboard."), + Err(error) => self.problem(format!("Could not read the clipboard: {error}")), + } + } + + fn approval_choices(&self) -> Vec<(String, Decision)> { + let Some(pending) = self.workspace.pending() else { return Vec::new() }; + let mut choices = vec![("Allow".to_string(), Decision::Approve)]; + if let Some(similar) = &pending.approval.similar { + choices.push((format!("Always allow commands starting with {similar}"), Decision::AllowSimilar)); + } + if !pending.tool.is_empty() { + choices.push((format!("Always allow {}", quill_core::tools::title(&pending.tool)), Decision::AllowTool)); + } + choices.push(("Allow everything in this thread".into(), Decision::AllowAll)); + choices.push(("Deny".into(), Decision::Decline)); + choices + } + + fn approval_key(&mut self, key: KeyEvent) { + let choices = self.approval_choices(); + let rows = choices.len() + 1; + let typing = self.choice == choices.len(); + let plain = !key.modifiers.intersects(KeyModifiers::CONTROL | KeyModifiers::ALT); + let decision = match key.code { + KeyCode::Up => { + self.choice = (self.choice + rows - 1) % rows; + None + } + KeyCode::Down | KeyCode::Tab => { + self.choice = (self.choice + 1) % rows; + None + } + KeyCode::Enter if typing => { + let text = self.instead.trim().to_string(); + if !text.is_empty() { + self.workspace.redirect(text); + self.settle_approval(); + } + None + } + KeyCode::Enter => choices.get(self.choice).map(|(_, decision)| *decision), + KeyCode::Esc => Some(Decision::Decline), + KeyCode::Backspace => { + self.instead.pop(); + self.choice = choices.len(); + None + } + KeyCode::Char(c) if self.instead.is_empty() && c.is_ascii_digit() => { + c.to_digit(10).and_then(|n| choices.get((n as usize).checked_sub(1)?)).map(|(_, decision)| *decision) + } + KeyCode::Char(c) if plain => { + self.instead.push(c); + self.choice = choices.len(); + None + } + _ => None, + }; + if let Some(decision) = decision { + self.workspace.decide(decision); + self.settle_approval(); + } + } + + fn settle_approval(&mut self) { + self.instead.clear(); + self.choice = 0; + self.advance(); + } + + fn question_key(&mut self, key: KeyEvent) -> bool { + let Some(asked) = self.workspace.asked_mut() else { return false }; + let questions = asked.questions.len(); + let current = asked.current; + let other = asked.other_row(); + let rows = other + 1; + let highlight = asked.highlight[current]; + let plain = !key.modifiers.intersects(KeyModifiers::CONTROL | KeyModifiers::ALT); + match key.code { + KeyCode::Left if questions > 1 => asked.current = (current + questions - 1) % questions, + KeyCode::Right if questions > 1 => asked.current = (current + 1) % questions, + KeyCode::Up => asked.highlight[current] = (highlight + rows - 1) % rows, + KeyCode::Down | KeyCode::Tab => asked.highlight[current] = (highlight + 1) % rows, + KeyCode::Enter => { + let typed = asked.typed[current].trim().to_string(); + if highlight == other && typed.is_empty() { + return true; + } + if asked.picked[current] != Some(highlight) { + asked.picked[current] = Some(highlight); + return true; + } + let answer = if highlight == other { typed } else { asked.question().options[highlight].clone() }; + self.record_answer(answer); + } + KeyCode::Backspace => { + asked.highlight[current] = other; + asked.typed[current].pop(); + asked.picked[current] = asked.picked[current].filter(|picked| *picked != other); + } + KeyCode::Char(c) if plain && asked.typed[current].is_empty() && c.is_ascii_digit() => { + if let Some(row) = c.to_digit(10).and_then(|n| (n as usize).checked_sub(1)).filter(|row| *row < other) { + asked.highlight[current] = row; + asked.picked[current] = Some(row); + } + } + KeyCode::Char(c) if plain => { + asked.highlight[current] = other; + asked.typed[current].push(c); + asked.picked[current] = asked.picked[current].filter(|picked| *picked != other); + } + _ => return false, + } + true + } + + fn record_answer(&mut self, text: String) { + let Some(asked) = self.workspace.asked_mut() else { return }; + asked.answers[asked.current] = Some(text); + if asked.finished() { + let answers = asked.answers.iter().flatten().cloned().collect(); + self.workspace.answer(answers); + return self.advance(); + } + let count = asked.questions.len(); + let next = (1..count).map(|step| (asked.current + step) % count).find(|index| asked.answers[*index].is_none()); + asked.current = next.unwrap_or(asked.current); + } + + fn refresh_suggestions(&mut self) { + let at_end = self.composer.cursor == self.composer.text.len(); + let next = match mentions::trigger(&self.composer.text).filter(|_| at_end) { + Some(Trigger::Slash(query)) => Some(Suggestions::Commands(Command::matching(&query))).filter(|s| s.len() > 0), + Some(Trigger::Mention { start, query }) => { + let root = self.workdir(); + if self.files.as_ref().is_none_or(|(indexed, _)| *indexed != root) { + self.files = Some((root.clone(), mentions::file_index(&root))); + } + let paths = self.files.as_ref().map(|(_, files)| mentions::rank(files, &query, SUGGESTIONS)).unwrap_or_default(); + Some(Suggestions::Files { start, paths }).filter(|s| s.len() > 0) + } + None => None, + }; + let count = next.as_ref().map_or(0, Suggestions::len); + self.highlighted = self.highlighted.min(count.saturating_sub(1)); + self.suggestions = next; + } + + fn suggestion_key(&mut self, key: KeyEvent) -> bool { + let count = self.suggestions.as_ref().map_or(0, Suggestions::len); + let plain_enter = key.code == KeyCode::Enter && key.modifiers.is_empty(); + match key.code { + KeyCode::Up => self.highlighted = (self.highlighted + count - 1) % count, + KeyCode::Down => self.highlighted = (self.highlighted + 1) % count, + KeyCode::Esc => self.suggestions = None, + KeyCode::Tab => self.accept(false), + KeyCode::Enter if plain_enter => self.accept(true), + _ => return false, + } + true + } + + fn accept(&mut self, run: bool) { + let Some(suggestions) = self.suggestions.take() else { return }; + match suggestions { + Suggestions::Commands(commands) => { + let Some(command) = commands.get(self.highlighted).copied() else { return }; + if run && command != Command::Rename { + self.composer.set(&format!("/{}", command.name())); + self.composer.take(); + self.run_command(command, String::new()); + } else { + self.composer.set(&format!("/{} ", command.name())); + } + } + Suggestions::Files { start, paths } => { + let Some(path) = paths.get(self.highlighted) else { return }; + let text = format!("{}@{path} ", &self.composer.text[..start.min(self.composer.text.len())]); + self.composer.set(&text); + } + } + self.highlighted = 0; + } + + fn submit(&mut self) { + if self.composer.is_empty() { + return; + } + self.scroll = Some(Scroll::Bottom); + let text = self.composer.text.trim().to_string(); + if self.composer.attachments.is_empty() && text.starts_with('/') { + match Command::parse(&text) { + Some((command, argument)) => { + self.composer.take(); + self.suggestions = None; + return self.run_command(command, argument); + } + None if !text.contains(char::is_whitespace) => { + self.composer.take(); + self.suggestions = None; + return self.problem(format!("There is no {text} command. /help lists them.")); + } + None => {} + } + } + if self.workspace.running() && !self.composer.attachments.is_empty() { + return self.problem("Wait for the reply to finish, or stop it with esc, before sending attachments."); + } + let prompt = self.composer.take(); + self.suggestions = None; + if self.workspace.asked().is_some() { + return self.record_answer(prompt.text); + } + if self.workspace.running() { + self.workspace.send(prompt, &self.root, false, &mut self.backend, &self.config.settings); + return self.advance(); + } + self.send(prompt); + } + + fn busy(&mut self) -> bool { + if self.workspace.running() { + self.problem("Wait for the reply to finish, or stop it with esc."); + } + self.workspace.running() + } + + fn run_command(&mut self, command: Command, argument: String) { + match command { + Command::New => { + if !self.busy() { + self.workspace.start_new(); + self.view = None; + self.out.push(Line::default()); + self.out.push(Line::styled("── New thread ──", dim())); + self.refresh_repo(); + } + } + Command::Connect => self.open_setup(false), + Command::Clear => { + if !self.busy() { + self.workspace.start_new(); + self.view = None; + self.out.clear(); + self.clear = true; + self.intro = true; + self.intro_notes.clear(); + self.refresh_repo(); + } + } + Command::Resume => { + if !self.busy() { + self.open_resume(); + } + } + Command::Model => { + self.config.reload(); + self.overlay = Some(Overlay::Model(self.model_picker())); + } + Command::Effort => self.open_think(), + Command::Mode => { + let current = self.config.settings.agent.access; + let choices = + Access::ALL.map(|access| Choice::new(access.label(), access.description(), access).current(access == current)); + self.overlay = Some(Overlay::Mode(Picker::new("How much may Quill do without asking?", choices.into()))); + } + Command::Instructions => self.open_instructions(), + Command::Init => { + if !self.busy() { + self.send(Prompt { text: INIT_PROMPT.into(), attachments: Vec::new() }); + } + } + Command::Compact => match self.workspace.compact(&self.backend, &self.config.settings) { + Ok(()) => self.notice("Compacting this thread…"), + Err(error) => self.problem(error), + }, + Command::Retry => { + if !self.busy() { + match self.workspace.last_prompt() { + Some(text) => self.send(Prompt { text, attachments: Vec::new() }), + None => self.problem("Nothing to retry yet."), + } + } + } + Command::Diff => self.print_diff(), + Command::Usage => { + let lines = usage::report(self.workspace.active_thread(), &self.workspace.usage, self.width); + self.out.push(Line::default()); + self.out.extend(lines); + } + Command::Version => self.open_versions(), + Command::Commit => self.open_commit(), + Command::Branch => { + if !self.busy() { + self.open_branch(); + } + } + Command::Rename => match self.workspace.active { + Some(_) if argument.is_empty() => self.problem("Give the new title: /rename Fix the login form"), + Some(id) => { + self.workspace.rename(id, argument.clone()); + self.notice(format!("Renamed to {argument}")); + } + None => self.problem("There is no thread to rename yet."), + }, + Command::Help => { + self.out.push(Line::default()); + self.out.extend(help()); + } + Command::Quit => self.quit = true, + } + } + + fn open_versions(&mut self) { + if self.busy() { + return; + } + if let Some(note) = update::source_note() { + return self.problem(note); + } + self.notice("Looking up the releases…"); + let tx = self.tx.clone(); + std::thread::spawn(move || { + let _ = tx.send(Msg::Releases(update::releases())); + }); + } + + fn show_versions(&mut self, result: Result<Vec<github::Release>, String>) { + let releases = match result { + Ok(releases) if releases.is_empty() => return self.notice("There is no published release yet."), + Ok(releases) => releases, + Err(error) => return self.problem(format!("Could not list the releases. {error}")), + }; + let choices = update::choices(&releases); + self.overlay = Some(Overlay::Version(Picker::new("Switch Quill Code to another release", choices))); + } + + fn switch_to(&mut self, version: String) { + if version == update::VERSION { + return self.notice(format!("Quill Code {version} is the one running.")); + } + if self.busy() { + return; + } + let resume = self.workspace.active_thread().is_some_and(|thread| !thread.turns.is_empty()); + if let Some(id) = self.workspace.active.filter(|_| resume) { + self.workspace.touch(id); + } + self.switching = Some((version, resume)); + self.quit = true; + } + + fn print_diff(&mut self) { + let look = self.look(); + let Some(thread) = self.workspace.active_thread() else { return self.problem("Nothing has changed in this thread yet.") }; + let Some((index, turn)) = thread.turns.iter().enumerate().rev().find(|(_, turn)| turn.diffs().next().is_some()) else { + return self.problem("Nothing has changed in this thread yet."); + }; + let mut lines = vec![Line::default(), Line::styled(format!("Changes from reply {}", index + 1), bold())]; + for diff in turn.diffs() { + lines.push(Line::default()); + let mut header = + Line::styled(&diff.path, accent()).with(format!(" +{}", diff.added), good()).with(format!(" -{}", diff.removed), bad()); + if diff.created { + header.push(" new", dim()); + } + lines.push(header); + lines.extend(history::diff_lines(diff, usize::MAX, look)); + } + self.out.extend(lines); + } + + fn model_picker(&self) -> Picker<Option<ModelRef>> { + let settings = &self.config.settings; + let selected = settings.models.selected.as_ref(); + let detail = |source: &crate::backend::Source, model: &quill_providers::Model| { + let mut parts = vec![source.config.name.clone(), model.status.label().to_string()]; + if let Some(context) = model.context { + parts.push(format!("{} context", context_label(context))); + } + if model.vision { + parts.push("vision".into()); + } + parts.join(" · ") + }; + let mut choices = Vec::new(); + for pinned in &settings.models.pinned { + if let Some((source, model)) = self.backend.find(pinned) { + let label = format!("{} *", model.label()); + choices.push(Choice::new(label, detail(source, model), Some(pinned.clone())).current(Some(pinned) == selected)); + } + } + let mut unavailable = Vec::new(); + for source in self.backend.sources.iter().filter(|source| source.connection != Connection::Off) { + for model in &source.models { + let target = ModelRef::new(source.config.id.clone(), model.id.clone()); + if settings.models.pinned.contains(&target) { + continue; + } + let current = Some(&target) == selected; + choices.push(Choice::new(model.label(), detail(source, model), Some(target)).current(current)); + } + if source.models.is_empty() { + unavailable.push(Choice::new(source.config.name.clone(), source.status(), None)); + } + } + choices.extend(unavailable); + Picker::new("Pick the model that powers Quill", choices) + .filtered(true) + .hint("type to filter · enter choose · ctrl+p pins it to the top · esc close") + } + + fn rebuild_models(&mut self) { + let Some(Overlay::Model(old)) = &self.overlay else { return }; + let query = old.query.clone(); + let wanted = old.highlighted().and_then(|index| old.choices[index].value.clone()); + let mut fresh = self.model_picker(); + fresh.query = query; + if let Some(index) = fresh.choices.iter().position(|choice| choice.value == wanted && wanted.is_some()) { + fresh.select(index); + } + self.overlay = Some(Overlay::Model(fresh)); + } + + fn open_think(&mut self) { + let settings = &self.config.settings; + let choices = match self.backend.selected_control(settings) { + Control::None => return self.problem("This model has no reasoning setting to change."), + Control::Toggle { .. } => { + let on = settings.models.thinking; + vec![ + Choice::new("Think it through", "Reason before replying, slower but sharper", Think::Thinking(true)).current(on), + Choice::new("Reply directly", "Skip the reasoning step", Think::Thinking(false)).current(!on), + ] + } + Control::Effort { levels } => { + let chosen = self.chosen_effort(); + levels + .iter() + .map(|level| { + let detail = match level.as_str() { + "low" => "Quick answers, least reasoning", + "medium" => "Balanced speed and depth", + "high" => "Reasons the longest, slowest", + _ => "", + }; + Choice::new(level.clone(), detail, Think::Effort(level.clone())).current(chosen.as_ref() == Some(level)) + }) + .collect() + } + }; + self.overlay = Some(Overlay::Think(Picker::new("Reasoning", choices))); + } + + fn chosen_effort(&self) -> Option<String> { + let settings = &self.config.settings; + let model = settings.models.selected.as_ref()?; + match self.backend.tuning(model, settings).reasoning { + Some(quill_providers::Reasoning::Effort(level)) => Some(level), + _ => None, + } + } + + fn open_resume(&mut self) { + let active = self.workspace.active; + let choices: Vec<Choice<u64>> = self + .workspace + .threads_in(&self.root) + .iter() + .map(|thread| { + let model = + thread.turns.iter().rev().find_map(|turn| turn.model.clone()).or_else(|| thread.model.clone()).unwrap_or_default(); + let turns = if thread.turns.len() == 1 { "1 turn".to_string() } else { format!("{} turns", thread.turns.len()) }; + let mut detail = format!("{} · {turns}", ago(thread.updated)); + if !model.is_empty() { + detail.push_str(&format!(" · {model}")); + } + if thread.worktree.is_some() { + detail.push_str(" · isolated"); + } + Choice::new(thread.title.clone(), detail, thread.id).current(Some(thread.id) == active) + }) + .collect(); + if choices.is_empty() { + return self.problem("There are no threads in this folder yet."); + } + let picker = + Picker::new("Go back to a thread", choices).filtered(true).hint("type to filter · enter open · ctrl+d delete · esc close"); + self.overlay = Some(Overlay::Resume(picker, None)); + } + + fn open_branch(&mut self) { + let root = self.workdir(); + if self.repo.snapshot.is_none() { + return self.problem(format!("{} is not a Git repository.", root.display())); + } + let branches = git::branches(&root); + let current = branches.current.clone(); + let mut choices: Vec<Choice<String>> = + branches.local.iter().map(|name| Choice::new(name.clone(), "", name.clone()).current(current.as_ref() == Some(name))).collect(); + choices.extend(branches.remote.iter().map(|name| Choice::new(name.clone(), "only on origin", name.clone()))); + let picker = + Picker::new("Switch branch", choices).filtered(true).hint("type to filter or name a new branch · enter switch · esc close"); + self.overlay = Some(Overlay::Branch(picker, root)); + } + + fn open_commit(&mut self) { + let root = self.workdir(); + if !self.git { + return self.problem("Commits need Git. Install Git and try again."); + } + if git::snapshot(&root).is_none() { + return self.problem(format!("{} is not a Git repository.", root.display())); + } + let settings = &self.config.settings; + let role = settings.models.roles.commit.clone().or_else(|| settings.models.selected.clone()); + let writer = match role { + Some(model) => self.backend.writer(&model, settings), + None => Err("Choose a model first, or type a commit message yourself.".into()), + }; + match Flow::new(root, writer, self.tx.clone()) { + Ok(flow) => self.overlay = Some(Overlay::Commit(Box::new(flow))), + Err(error) => self.problem(error), + } + } + + fn overlay_key(&mut self, key: KeyEvent) { + let control = key.modifiers.contains(KeyModifiers::CONTROL); + let Some(overlay) = self.overlay.as_mut() else { return }; + match overlay { + Overlay::Model(picker) => { + if control && key.code == KeyCode::Char('p') { + if let Some(Some(model)) = picker.highlighted().map(|index| picker.choices[index].value.clone()) { + self.config.update(|settings| { + if settings.models.pinned.contains(&model) { + settings.models.pinned.retain(|m| *m != model); + } else { + settings.models.pinned.push(model.clone()); + } + }); + self.rebuild_models(); + } + return; + } + match picker.key(key) { + Picked::Closed => self.overlay = None, + Picked::Chosen(index) => match picker.choices[index].value.clone() { + Some(model) => { + let label = picker.choices[index].label.trim_end_matches(" *").to_string(); + self.overlay = None; + self.config.update(|settings| settings.models.selected = Some(model.clone())); + self.backend.select(model); + self.notice(format!("Quill now runs on {label}")); + } + None => { + let status = picker.choices[index].detail.clone(); + picker.note = Some(Line::styled(format!(" {status}"), warn())); + } + }, + Picked::Nothing => {} + } + } + Overlay::Think(picker) => match picker.key(key) { + Picked::Closed => self.overlay = None, + Picked::Chosen(index) => { + let choice = picker.choices[index].value.clone(); + let label = picker.choices[index].label.clone(); + self.overlay = None; + self.config.update(|settings| match choice { + Think::Thinking(on) => settings.models.thinking = on, + Think::Effort(level) => settings.models.effort = level, + }); + self.notice(format!("Reasoning: {label}")); + } + Picked::Nothing => {} + }, + Overlay::Mode(picker) => match picker.key(key) { + Picked::Closed => self.overlay = None, + Picked::Chosen(index) => { + let access = picker.choices[index].value; + self.overlay = None; + self.config.update(|settings| settings.agent.access = access); + self.notice(format!("{}: {}", access.label(), access.description())); + } + Picked::Nothing => {} + }, + Overlay::Resume(picker, confirm) => { + if control && key.code == KeyCode::Char('d') { + let Some(id) = picker.highlighted().map(|index| picker.choices[index].value) else { return }; + if *confirm != Some(id) { + *confirm = Some(id); + picker.note = Some(Line::styled(" Press ctrl+d again to delete this thread", warn())); + return; + } + let worktree = self.workspace.threads.iter().find(|t| t.id == id).and_then(|t| t.worktree.clone()); + let viewing = self.view.as_ref().is_some_and(|view| view.thread == id); + self.workspace.delete(id); + if viewing { + self.view = None; + } + self.notice("Deleted the thread."); + if let Some(path) = worktree.filter(|path| path.exists()) { + self.notice(format!("Its isolated copy stays at {}. Remove it with: git worktree remove", path.display())); + } + self.overlay = None; + return self.open_resume_if_any(); + } + *confirm = None; + match picker.key(key) { + Picked::Closed => self.overlay = None, + Picked::Chosen(index) => { + let id = picker.choices[index].value; + self.overlay = None; + self.open_thread(id); + } + Picked::Nothing => picker.note = None, + } + } + Overlay::Branch(picker, root) => { + let root = root.clone(); + let typed = picker.query.trim().to_string(); + let exact = picker.choices.iter().any(|choice| choice.value == typed); + let create = key.code == KeyCode::Enter && !typed.is_empty() && !exact && picker.visible().is_empty(); + let picked = if create { None } else { Some(picker.key(key)) }; + let result = match picked { + None if !git::valid_branch(&typed) => Err(format!("\"{typed}\" is not a branch name Git accepts.")), + None => git::create_branch(&root, &typed).map(|()| format!("Created and switched to {typed}")), + Some(Picked::Closed) => { + self.overlay = None; + return; + } + Some(Picked::Chosen(index)) => { + let name = picker.choices[index].value.clone(); + if picker.choices[index].current { + self.overlay = None; + return; + } + git::switch_branch(&root, &name).map(|()| format!("Switched to {name}")) + } + Some(Picked::Nothing) => { + let query = picker.query.trim().to_string(); + picker.note = (!query.is_empty() && picker.visible().is_empty()) + .then(|| Line::styled(format!(" enter creates {query}"), dim())); + return; + } + }; + match result { + Ok(done) => { + self.overlay = None; + self.notice(done); + self.files = None; + self.refresh_repo(); + } + Err(error) => picker.note = Some(Line::styled(format!(" {error}"), bad())), + } + } + Overlay::Commit(flow) => { + if flow.key(key, &mut self.out) == Update::Close { + self.overlay = None; + self.refresh_repo(); + } + } + Overlay::Trust(picker) => match picker.key(key) { + Picked::Closed => self.trust(false), + Picked::Chosen(index) => { + let trusted = picker.choices[index].value; + self.trust(trusted); + } + Picked::Nothing => {} + }, + Overlay::Version(picker) => match picker.key(key) { + Picked::Closed => self.overlay = None, + Picked::Chosen(index) => { + let version = picker.choices[index].value.clone(); + self.overlay = None; + self.switch_to(version); + } + Picked::Nothing => {} + }, + Overlay::Setup(setup) => match setup.key(key) { + setup::Outcome::Stay => {} + setup::Outcome::Close => { + self.overlay = None; + if self.config.settings.models.providers.is_empty() { + self.notice("No model server yet. Start one, then connect it with /connect."); + } + } + setup::Outcome::Ready(provider, model) => self.connected(provider, model), + }, + } + } + + fn open_resume_if_any(&mut self) { + if !self.workspace.threads_in(&self.root).is_empty() { + self.open_resume(); + } + } + + fn status_line(&self) -> Line { + let settings = &self.config.settings; + let access = settings.agent.access; + let mut line = Line::plain(" ").with(access.label(), mode_style(access)).with(" · ", dim()); + match self.backend.selected(settings) { + Some((_, model)) => line.push(model.label(), plain()), + None => match &settings.models.selected { + Some(selected) if self.backend.checking(&selected.provider) => line.push(format!("{} connecting", selected.model), dim()), + Some(selected) => line.push(format!("{} unavailable, /model", selected.model), warn()), + None => line.push("no model, pick one with /model", warn()), + }, + } + match self.backend.selected_control(settings) { + Control::Toggle { .. } => line.push(if settings.models.thinking { " · thinking" } else { " · direct" }, dim()), + Control::Effort { .. } => line.push(format!(" · {} effort", self.chosen_effort().unwrap_or_default()), dim()), + Control::None => {} + } + let thread = self.workspace.active_thread(); + let mut place = project::name(&self.root); + if thread.is_some_and(|thread| thread.worktree.is_some()) { + place.push_str(" (isolated)"); + } + line.push(format!(" · {place}"), dim()); + if let Some(snapshot) = &self.repo.snapshot { + let branch = snapshot.branch.clone().or_else(|| snapshot.head.clone().map(|head| format!("at {head}"))); + if let Some(branch) = branch { + line.push(format!(" {branch}"), accent()); + } + if snapshot.changed > 0 { + line.push(format!(" ●{}", snapshot.changed), warn()); + } + if snapshot.ahead > 0 { + line.push(format!(" ↑{}", snapshot.ahead), dim()); + } + } + if let Some(pull) = &self.repo.pull { + let (state, style) = match pull.state { + PullState::Open => ("", good()), + PullState::Merged => (" merged", accent()), + PullState::Closed => (" closed", dim()), + }; + line.push(format!(" PR #{}{state}", pull.number), style); + } + if let Some(thread) = thread { + let window = + settings.models.selected.as_ref().and_then(|model| self.backend.effective(model, settings)).and_then(|m| m.context); + if let (Some(used), Some(window)) = (thread.context_used.filter(|n| *n > 0), window.filter(|n| *n > 0)) { + let percent = ((used * 100 + window / 2) / window).min(100); + let near = used * 100 >= quill_core::compact_limit(window) * 85; + line.push(format!(" · {percent}% of {}", context_label(window)), if near { warn() } else { dim() }); + if near && settings.agent.auto_compact { + line.push(" · compacts soon", warn()); + } + } + } + if let Some(hint) = HINTS.iter().find(|hint| line.width() + hint.chars().count() + 3 <= self.width) { + line.push(" ".repeat(self.width - 1 - line.width() - hint.chars().count()), plain()); + line.push(*hint, dim()); + } + truncate(&line, self.width) + } + + fn approval_card(&self, look: Look) -> Vec<Line> { + let Some(pending) = self.workspace.pending() else { return Vec::new() }; + let mut lines = + vec![Line::styled("─".repeat(self.width), accent()), Line::styled(format!(" {}", pending.approval.title), accent().bold())]; + for line in wrap(&Line::styled(pending.approval.subject.trim(), dim()), self.width.saturating_sub(2)).into_iter().take(4) { + lines.push(Line::plain(" ").with_line(line)); + } + let dashes = Line::styled("╌".repeat(self.width), dim()); + if !pending.approval.diffs.is_empty() { + lines.push(dashes.clone()); + } + let mut shown = 0; + for diff in &pending.approval.diffs { + if shown >= 14 { + break; + } + if pending.approval.diffs.len() > 1 { + lines.push(Line::styled(format!(" {}", diff.path), dim())); + } + let rows = history::diff_lines(diff, 14 - shown, look); + shown += rows.len(); + lines.extend(rows); + } + if !pending.approval.diffs.is_empty() { + lines.push(dashes); + } + let choices = self.approval_choices(); + for (index, (label, _)) in choices.iter().enumerate() { + let on = index == self.choice; + let mark = if on { Line::styled("▸ ", accent()) } else { Line::plain(" ") }; + lines.push(mark.with(format!("{}. ", index + 1), dim()).with(label, if on { bold() } else { plain() })); + } + let typing = self.choice == choices.len(); + let mut row = if typing { Line::styled("▸ ", accent()) } else { Line::plain(" ") }; + row.push(format!("{}. ", choices.len() + 1), dim()); + typing_row(&mut row, &self.instead, "No, and tell Quill what to do instead", typing, plain()); + lines.push(truncate(&row, self.width)); + lines.push(Line::styled(" enter choose · type to say what to do instead · esc deny", dim())); + lines + } + + fn question_card(&self) -> Vec<Line> { + let Some(asked) = self.workspace.asked() else { return Vec::new() }; + let mut lines = Vec::new(); + let count = asked.questions.len(); + if count > 1 { + let mut tabs = Line::styled("← ", dim()); + for index in 0..count { + let style = if index == asked.current { accent().bold() } else { dim() }; + tabs.push(format!(" Question {} ", index + 1), style); + if asked.answers[index].is_some() { + tabs.push("✓ ", good()); + } + } + tabs.push(" →", dim()); + lines.push(truncate(&tabs, self.width)); + } + let question = asked.question(); + let text = wrap(&Line::styled(question.question.trim(), bold()), self.width.saturating_sub(2)); + lines.extend(indent(text, Line::styled("? ", accent()), Line::plain(" "))); + let current = asked.current; + let answer = asked.answers[current].as_deref(); + let (highlight, picked, typed) = (asked.highlight[current], asked.picked[current], &asked.typed[current]); + let other = asked.other_row(); + for index in 0..=other { + let on = index == highlight; + let mut row = if on { Line::styled("▸ ", accent()) } else { Line::plain(" ") }; + row.push(format!("{}. ", index + 1), dim()); + let label = if index == other { typed.as_str() } else { question.options[index].as_str() }; + if index == other { + typing_row(&mut row, typed, "Something else", on, dim()); + } else { + row.push(label, if on { bold() } else { plain() }); + } + if picked == Some(index) { + row.push(" selected, enter again to confirm", good()); + } else if answer == Some(label) && !label.is_empty() { + row.push(" ✓", good()); + } + lines.push(truncate(&row, self.width)); + } + let mut hint = " ↑↓ or a number · enter selects · enter again confirms".to_string(); + if count > 1 { + hint.push_str(" · ←→ switch question"); + } + hint.push_str(" · esc cancels"); + lines.push(truncate(&Line::styled(hint, dim()), self.width)); + lines + } + + fn suggestion_lines(&self) -> Vec<Line> { + let Some(suggestions) = &self.suggestions else { return Vec::new() }; + let row = |index: usize, title: String, detail: &str| { + let on = index == self.highlighted; + let mark = if on { Line::styled("▸ ", accent()) } else { Line::plain(" ") }; + truncate(&mark.with(title, if on { bold() } else { plain() }).with(detail.to_string(), dim()), self.width) + }; + let start = self.highlighted.saturating_sub(SUGGESTIONS - 1); + match suggestions { + Suggestions::Commands(commands) => commands + .iter() + .enumerate() + .skip(start) + .take(SUGGESTIONS) + .map(|(index, command)| row(index, pad(&format!("/{}", command.name()), Command::widest() + 3), command.description())) + .collect(), + Suggestions::Files { paths, .. } => paths.iter().enumerate().map(|(index, path)| row(index, path.clone(), "")).collect(), + } + } + + fn live(&self) -> Frame { + let look = self.look(); + let spinner = self.spinner(); + let mut middle = Vec::new(); + let running = self.workspace.running_turn(); + let turn = self.view.as_ref().and_then(|view| { + self.workspace.threads.iter().find(|t| t.id == view.thread).and_then(|t| t.turns.get(view.turn)).map(|turn| (view, turn)) + }); + if let Some((_, turn)) = turn.filter(|_| running.is_some()) { + let waiting = self.workspace.pending().is_some(); + let asked = self.workspace.asked().is_some(); + let state = match (waiting || asked, history::writing(turn)) { + (true, _) => State::Idle, + (false, true) => State::Generating, + (false, false) => State::Thinking, + }; + let seconds = self.started.elapsed().as_secs_f64(); + let mark = weave::mark(2, 1, state, seconds).concat(); + let mut activity = Line::styled(format!("{mark} "), accent()); + let doing = if self.workspace.compacting() { + "Summarising the conversation to make room".to_string() + } else { + history::activity(turn, waiting, asked) + }; + activity.push(doing, if waiting || asked { warn() } else { plain() }); + activity.push(format!(" · {}", history::duration(turn.elapsed_secs())), dim()); + if let Some(tokens) = history::generated(turn) { + activity.push(format!(" · {tokens}"), dim()); + } + activity.push(" · esc to stop", dim()); + middle.push(Line::default()); + middle.push(activity); + middle.extend(history::plan_progress(turn, look)); + } else if self.queued.is_some() { + let provider = self.config.settings.models.selected.as_ref().and_then(|selected| self.backend.source(&selected.provider)); + let name = provider.map_or_else(|| "the model".to_string(), |source| source.config.name.clone()); + middle.push(Line::default()); + middle.push(Line::styled(format!("{spinner} Connecting to {name}"), accent()).with(" · esc to cancel", dim())); + } + let approval = self.approval_card(look); + let question = if approval.is_empty() { self.question_card() } else { Vec::new() }; + let asking = !question.is_empty(); + if !approval.is_empty() || !question.is_empty() { + middle.push(Line::default()); + } + middle.extend(approval.iter().cloned()); + middle.extend(question); + if !middle.is_empty() || !self.intro { + middle.push(Line::default()); + } + let mut panel = Vec::new(); + let mut cursor = None; + match &self.overlay { + Some(overlay) => { + panel.push(rule(self.width)); + let rows = self.height.saturating_sub(middle.len() + 8).clamp(3, 12); + let (lines, at) = match overlay { + Overlay::Model(picker) => (picker.render(self.width, rows), None), + Overlay::Think(picker) => (picker.render(self.width, rows), None), + Overlay::Trust(picker) => (picker.render(self.width, rows), None), + Overlay::Version(picker) => (picker.render(self.width, rows), None), + Overlay::Mode(picker) => (picker.render(self.width, rows), None), + Overlay::Resume(picker, _) => (picker.render(self.width, rows), None), + Overlay::Branch(picker, _) => (picker.render(self.width, rows), None), + Overlay::Commit(flow) => flow.render(self.width, rows, spinner), + Overlay::Setup(setup) => setup.render(self.width, rows, spinner), + }; + cursor = at.map(|(row, column)| (row + panel.len(), column)); + panel.extend(lines); + } + None if approval.is_empty() && !asking => { + panel.push(rule(self.width)); + let (lines, at) = self.composer.render(self.width, PLACEHOLDER); + cursor = Some((at.0 + panel.len(), at.1)); + panel.extend(lines); + panel.push(rule(self.width)); + panel.extend(self.suggestion_lines()); + } + None => panel.push(rule(self.width)), + } + if self.quit_at.is_some_and(|at| at.elapsed() < Duration::from_secs(3)) { + panel.push(Line::styled(" Press ctrl+c again to quit", warn())); + } else { + panel.push(self.status_line()); + } + let room = self.height.saturating_sub(middle.len() + panel.len()); + let mut preview = match turn { + Some((view, turn)) => view.progress.live(turn, look, spinner, self.thought.as_ref().map(|(_, thought)| thought.as_str())), + None => Vec::new(), + }; + if preview.len() > room { + preview.drain(..preview.len() - room); + } + let mut lines = Vec::new(); + if self.intro { + lines.extend(self.banner()); + lines.push(Line::default()); + lines.extend(self.intro_notes.iter().cloned()); + } + lines.extend(preview); + let top = lines.len(); + let offset = lines.len() + middle.len(); + lines.extend(middle); + lines.extend(panel); + let cursor = cursor.map(|(row, column)| (row + offset, column)); + if let Some((row, column)) = cursor + && let Some(line) = lines.get_mut(row) + { + *line = caret(line, column); + } + Live { lines, cursor, top } + } + + fn finish(&mut self) -> Vec<Line> { + if self.workspace.running() { + self.stop(); + } + self.workspace.shutdown(); + self.end_intro(); + let mut lines = std::mem::take(&mut self.out); + if self.workspace.active.is_some() { + lines.push(Line::default()); + lines.push(Line::styled("Continue this thread with: quill -c", dim())); + } + lines + } +} + +pub fn run(root: PathBuf, resume: bool, isolate: bool, prompt: String) -> u8 { + if !std::io::stdin().is_terminal() || !std::io::stdout().is_terminal() { + eprintln!("Quill Code needs an interactive terminal. For scripts, use: quill exec \"your task\""); + return 2; + } + let (tx, rx) = channel(); + let mut screen = match Screen::start() { + Ok(screen) => screen, + Err(error) => { + eprintln!("The terminal could not be set up: {error}"); + return 1; + } + }; + let mut app = App::new(root, isolate, tx.clone(), screen.layout.room(), screen.layout.rows()); + term::listen(tx); + app.start(resume, prompt); + let mut drawn: Option<Frame> = None; + loop { + if let Some(path) = app.editing.take() { + let out = app.take_out(); + let before = std::fs::read_to_string(&path).unwrap_or_default(); + match screen.suspend(&out, || project::edit(&path)) { + Ok(result) => app.edited(&path, &before, result), + Err(_) => break, + } + drawn = None; + } + if app.clear { + app.clear = false; + screen.clear(); + drawn = None; + } + if let Some(scroll) = app.scroll.take() { + screen.layout.scroll(scroll); + drawn = None; + } + app.refresh_thought(); + app.advance(); + let out = app.take_out(); + let frame = app.live(); + if !out.is_empty() || drawn.as_ref() != Some(&frame) { + if screen.draw(&out, &frame).is_err() { + break; + } + drawn = Some(frame); + } + if app.quit { + break; + } + let wait = if app.animating() { Duration::from_millis(80) } else { Duration::from_millis(1000) }; + let first = match rx.recv_timeout(wait) { + Ok(msg) => msg, + Err(RecvTimeoutError::Timeout) => continue, + Err(RecvTimeoutError::Disconnected) => break, + }; + let batch = Instant::now(); + let mut next = Some(first); + while let Some(msg) = next.take() { + match msg { + Msg::Resize => { + screen.resized(); + app.resize(screen.layout.room(), screen.layout.rows()); + drawn = None; + } + Msg::Scroll(scroll) => { + screen.layout.scroll(scroll); + drawn = None; + } + msg => app.handle(msg), + } + if batch.elapsed() < Duration::from_millis(25) { + next = rx.try_recv().ok(); + } + } + } + let goodbye = app.finish(); + let _ = screen.finish(&goodbye); + match app.switching.take() { + Some((version, resume)) => update::switch(&version, &app.root, resume), + None => 0, + } +} \ No newline at end of file diff --git a/crates/quill-code/src/assets.rs b/crates/quill-code/src/assets.rs deleted file mode 100644 index f9d222c..0000000 --- a/crates/quill-code/src/assets.rs +++ /dev/null @@ -1,18 +0,0 @@ -use std::borrow::Cow; - -use gpui_kit::{AssetSource, Result, SharedString}; - -pub struct Assets; - -impl AssetSource for Assets { - fn load(&self, path: &str) -> Result<Option<Cow<'static, [u8]>>> { - match crate::icons::load(path) { - Some(bytes) => Ok(Some(Cow::Borrowed(bytes))), - None => gpui_kit::assets::Assets.load(path), - } - } - - fn list(&self, path: &str) -> Result<Vec<SharedString>> { - gpui_kit::assets::Assets.list(path) - } -} \ No newline at end of file diff --git a/crates/quill-code/src/backend.rs b/crates/quill-code/src/backend.rs index 2a3bdcb..cae7e3c 100644 --- a/crates/quill-code/src/backend.rs +++ b/crates/quill-code/src/backend.rs @@ -1,127 +1,266 @@ -use gpui_kit::{App, Context, SharedString}; -use quill_llama::{Model, Props, Server, Thinking, guess_thinking, normalize_url}; +use std::sync::Arc; +use std::sync::atomic::AtomicBool; +use std::sync::mpsc::Sender; -use crate::config::Config; +use quill_config::{ModelRef, Provider as ProviderConfig, ServerKind, Settings}; +use quill_providers::{ + ChatRequest, Control, Event, LmStudio, Message, Model, Ollama, OpenAi, Props, Provider, Status, Tuning, normalize_url, profile_for, +}; -#[derive(Clone, PartialEq)] +use crate::Msg; + +#[derive(Clone, Debug, PartialEq)] pub enum Connection { Checking, Online, - Offline(SharedString), + Offline(String), + Off, } -pub struct Backend { +#[derive(Clone)] +pub struct Source { + pub config: ProviderConfig, pub connection: Connection, pub models: Vec<Model>, - props: Option<(String, Props)>, } -impl Backend { - pub fn new(cx: &mut Context<Self>) -> Self { - let mut backend = Backend { connection: Connection::Checking, models: Vec::new(), props: None }; - backend.refresh(cx); - backend - } - - pub fn url(cx: &App) -> String { - Config::get(cx).server_url.clone() - } - - pub fn selected_id(cx: &App) -> Option<String> { - Config::get(cx).model.clone() - } - - pub fn selected<'a>(&'a self, cx: &App) -> Option<&'a Model> { - let id = Self::selected_id(cx)?; - self.models.iter().find(|m| m.id == id) - } - - pub fn refresh(&mut self, cx: &mut Context<Self>) { - self.connection = Connection::Checking; - cx.notify(); - let url = Self::url(cx); - let task = cx.background_executor().spawn(async move { Server::new(&url).models() }); - cx.spawn(async move |this, cx| { - let result = task.await; - _ = this.update(cx, |this, cx| { - match result { - Ok(models) => { - this.models = models; - this.connection = Connection::Online; - if let Some(model) = this.selected(cx).filter(|m| m.status == quill_llama::Status::Loaded) { - let id = model.id.clone(); - this.fetch_props(id, cx); - } - } - Err(error) => { - this.models.clear(); - this.connection = Connection::Offline(error.to_string().into()); - } +impl Source { + pub fn status(&self) -> String { + match &self.connection { + Connection::Checking => "Connecting".into(), + Connection::Online => { + let count = self.models.len(); + format!("{count} {}", if count == 1 { "model" } else { "models" }) + } + Connection::Offline(error) => error.clone(), + Connection::Off => "Turned off".into(), + } + } +} + +#[derive(Clone)] +pub struct Writer { + provider: Arc<dyn Provider>, + model: String, + context: Option<u64>, + tuning: Tuning, +} + +impl Writer { + pub fn write(&self, system: &str, user: &str) -> Result<String, String> { + let request = ChatRequest { + model: self.model.clone(), + messages: vec![Message::system(system), Message::user(user)], + reasoning: self.tuning.quiet.clone(), + kwargs: self.tuning.kwargs.clone(), + context: self.context, + ..ChatRequest::default() + }; + let mut text = String::new(); + self.provider + .stream(&request, &AtomicBool::new(false), &mut |event| { + if let Event::Content(chunk) = event { + text.push_str(&chunk); } - cx.notify(); - }); + }) + .map_err(|e| e.to_string())?; + Ok(match text.rfind("</think>") { + Some(end) => text[end + 8..].trim().to_string(), + None => text.trim().to_string(), }) - .detach(); } +} - pub fn set_url(&mut self, url: &str, cx: &mut Context<Self>) { - let url = normalize_url(url); - Config::update(cx, |config| config.server_url = url); - self.props = None; - self.refresh(cx); +pub struct Found { + connection: Connection, + models: Vec<Model>, +} + +pub fn connect(config: &ProviderConfig) -> Arc<dyn Provider> { + let key = config.key.as_deref(); + match config.kind { + ServerKind::Ollama => Arc::new(Ollama::new(&config.url, key)), + ServerKind::LmStudio => Arc::new(LmStudio::new(&config.url, key)), + _ => Arc::new(OpenAi::new(&config.url).with_key(key)), } +} - pub fn select(&mut self, id: String, cx: &mut Context<Self>) { - Config::update(cx, |config| config.model = Some(id.clone())); - self.props = None; - self.fetch_props(id, cx); - cx.notify(); +pub fn list_models(config: &ProviderConfig) -> Result<Vec<Model>, String> { + connect(config).models().map_err(|error| error.to_string()) +} + +fn probe(config: &ProviderConfig) -> Found { + match list_models(config) { + Ok(models) => Found { connection: Connection::Online, models }, + Err(error) => Found { connection: Connection::Offline(error), models: Vec::new() }, + } +} + +pub fn scan(settings: &Settings) -> Vec<(ServerKind, String)> { + let known: Vec<String> = settings.models.providers.iter().map(|p| normalize_url(&p.url)).collect(); + let candidates: Vec<(ServerKind, String)> = + ServerKind::ALL.iter().map(|kind| (*kind, kind.default_url())).filter(|(_, url)| !url.is_empty() && !known.contains(url)).collect(); + std::thread::scope(|scope| { + let checks: Vec<_> = candidates.iter().map(|(_, url)| scope.spawn(move || OpenAi::new(url).reachable())).collect(); + candidates.iter().zip(checks).filter_map(|(found, check)| check.join().unwrap_or(false).then(|| found.clone())).collect() + }) +} + +pub fn add_servers(settings: &mut Settings, found: &[(ServerKind, String)]) { + for (kind, url) in found { + let id = settings.models.fresh_id(*kind); + settings.models.providers.push(ProviderConfig::new(&id, *kind, url)); + } +} + +pub struct Backend { + pub sources: Vec<Source>, + props: Option<(ModelRef, Props)>, + generation: usize, + tx: Sender<Msg>, +} + +impl Backend { + pub fn new(tx: Sender<Msg>) -> Backend { + Backend { sources: Vec::new(), props: None, generation: 0, tx } + } + + pub fn source(&self, id: &str) -> Option<&Source> { + self.sources.iter().find(|source| source.config.id == id) + } + + pub fn find(&self, model: &ModelRef) -> Option<(&Source, &Model)> { + let source = self.source(&model.provider)?; + source.models.iter().find(|m| m.id == model.model).map(|m| (source, m)) + } + + pub fn selected(&self, settings: &Settings) -> Option<(&Source, &Model)> { + self.find(settings.models.selected.as_ref()?) + } + + pub fn effective(&self, model: &ModelRef, settings: &Settings) -> Option<Model> { + let (_, found) = self.find(model)?; + let mut found = found.clone(); + if let Some(props) = self.props.as_ref().filter(|(r, _)| r == model).map(|(_, props)| props) { + found.context = props.context.or(found.context); + found.vision |= props.vision; + } + if let Some(over) = settings.models.override_for(model) { + found.context = over.context.or(found.context); + found.vision = over.vision.unwrap_or(found.vision); + } + Some(found) + } + + pub fn checking(&self, provider: &str) -> bool { + self.source(provider).is_some_and(|source| source.connection == Connection::Checking) + } + + pub fn refresh(&mut self, settings: &Settings) { + self.generation += 1; + let generation = self.generation; + let previous = std::mem::take(&mut self.sources); + self.sources = settings + .models + .providers + .iter() + .cloned() + .map(|config| { + let old = previous.iter().find(|s| s.config.id == config.id && s.config.url == config.url); + Source { + connection: if config.enabled { Connection::Checking } else { Connection::Off }, + models: old.filter(|_| config.enabled).map(|s| s.models.clone()).unwrap_or_default(), + config, + } + }) + .collect(); + for source in self.sources.iter().filter(|s| s.config.enabled) { + let config = source.config.clone(); + let tx = self.tx.clone(); + std::thread::spawn(move || { + let found = probe(&config); + let _ = tx.send(Msg::Probed { generation, id: config.id, found }); + }); + } + } + + pub fn probed(&mut self, generation: usize, id: &str, found: Found, settings: &Settings) { + if generation != self.generation { + return; + } + let Some(source) = self.sources.iter_mut().find(|s| s.config.id == id) else { return }; + source.connection = found.connection; + source.models = found.models; + if let Some(selected) = settings.models.selected.clone().filter(|r| r.provider == id) + && self.find(&selected).is_some_and(|(_, m)| m.status == Status::Loaded) + { + self.fetch_props(selected); + } } - pub fn set_thinking(&mut self, on: bool, cx: &mut Context<Self>) { - Config::update(cx, |config| config.thinking = on); - cx.notify(); + pub fn select(&mut self, model: ModelRef) { + self.props = None; + self.fetch_props(model); } - pub fn thinking(&self, cx: &App) -> Thinking { - let Some(id) = Self::selected_id(cx) else { return Thinking::None }; + pub fn control(&self, model: &ModelRef, settings: &Settings) -> Control { + if let Some(profile) = profile_for(&model.model, &settings.models.profiles) { + return profile.control; + } match &self.props { - Some((props_id, props)) if *props_id == id => props.thinking, - _ => guess_thinking(&id), + Some((r, props)) if r == model => props.control.clone(), + _ => self.find(model).and_then(|(_, found)| found.control.clone()).unwrap_or(Control::None), } } - pub fn request_thinking(&self, cx: &App) -> Option<bool> { - (self.thinking(cx) == Thinking::Toggle).then(|| Config::get(cx).thinking) + pub fn selected_control(&self, settings: &Settings) -> Control { + settings.models.selected.as_ref().map_or(Control::None, |model| self.control(model, settings)) + } + + pub fn tuning(&self, model: &ModelRef, settings: &Settings) -> Tuning { + let kwargs = profile_for(&model.model, &settings.models.profiles).map(|profile| profile.kwargs).unwrap_or_default(); + Tuning::new(&self.control(model, settings), settings.models.thinking, &settings.models.effort, kwargs) + } + + pub fn provider(&self, model: &ModelRef) -> Result<Arc<dyn Provider>, String> { + let source = self.source(&model.provider).ok_or("That model's server was removed. Pick another model with /model.")?; + Ok(connect(&source.config)) + } + + pub fn writer(&self, model: &ModelRef, settings: &Settings) -> Result<Writer, String> { + let context = self.effective(model, settings).and_then(|found| found.context); + Ok(Writer { provider: self.provider(model)?, model: model.model.clone(), context, tuning: self.tuning(model, settings) }) } - pub fn mark_used(&mut self, id: &str, cx: &mut Context<Self>) { - let needs_props = !matches!(&self.props, Some((props_id, _)) if props_id == id); - if let Some(model) = self.models.iter_mut().find(|m| m.id == id) { - model.status = quill_llama::Status::Loaded; + pub fn mark_used(&mut self, model: &ModelRef) { + if let Some(found) = self.model_mut(model) { + found.status = Status::Loaded; } - if needs_props { - self.fetch_props(id.to_string(), cx); + if !matches!(&self.props, Some((r, _)) if r == model) { + self.fetch_props(model.clone()); } - cx.notify(); - } - - fn fetch_props(&mut self, id: String, cx: &mut Context<Self>) { - let url = Self::url(cx); - let wanted = id.clone(); - let task = cx.background_executor().spawn(async move { Server::new(&url).props(&wanted) }); - cx.spawn(async move |this, cx| { - if let Ok(props) = task.await { - _ = this.update(cx, |this, cx| { - if let Some(model) = this.models.iter_mut().find(|m| m.id == id) { - model.status = quill_llama::Status::Loaded; - model.context = props.context.or(model.context); - } - this.props = Some((id, props)); - cx.notify(); - }); + } + + fn model_mut(&mut self, model: &ModelRef) -> Option<&mut Model> { + self.sources.iter_mut().find(|s| s.config.id == model.provider).and_then(|s| s.models.iter_mut().find(|m| m.id == model.model)) + } + + fn fetch_props(&mut self, model: ModelRef) { + let Some(config) = self.source(&model.provider).map(|s| s.config.clone()).filter(|c| c.kind == ServerKind::LlamaCpp) else { + return; + }; + let tx = self.tx.clone(); + std::thread::spawn(move || { + if let Ok(props) = OpenAi::new(&config.url).with_key(config.key.as_deref()).props(&model.model) { + let _ = tx.send(Msg::Props { model, props }); } - }) - .detach(); + }); + } + + pub fn got_props(&mut self, model: ModelRef, props: Props) { + if let Some(found) = self.model_mut(&model) { + found.status = Status::Loaded; + } + self.props = Some((model, props)); } } \ No newline at end of file diff --git a/crates/quill-code/src/clipboard.rs b/crates/quill-code/src/clipboard.rs new file mode 100644 index 0000000..7fc6aaa --- /dev/null +++ b/crates/quill-code/src/clipboard.rs @@ -0,0 +1,47 @@ +use std::fs; +use std::path::PathBuf; + +use arboard::{Clipboard, Error, ImageData}; + +use crate::thread::now_ms; + +pub fn save_image() -> Result<Option<PathBuf>, String> { + let image = match Clipboard::new().and_then(|mut clipboard| clipboard.get_image()) { + Ok(image) => image, + Err(Error::ContentNotAvailable) => return Ok(None), + Err(error) => return Err(error.to_string()), + }; + let bytes = encode(&image).map_err(|error| error.to_string())?; + let path = std::env::temp_dir().join(format!("quill-clipboard-{}.png", now_ms())); + fs::write(&path, bytes).map_err(|error| error.to_string())?; + Ok(Some(path)) +} + +fn encode(image: &ImageData) -> Result<Vec<u8>, png::EncodingError> { + let mut bytes = Vec::new(); + let mut encoder = png::Encoder::new(&mut bytes, image.width as u32, image.height as u32); + encoder.set_color(png::ColorType::Rgba); + encoder.set_depth(png::BitDepth::Eight); + encoder.write_header()?.write_image_data(&image.bytes)?; + Ok(bytes) +} + +#[cfg(test)] +mod tests { + use std::borrow::Cow; + use std::io::Cursor; + + use super::*; + + #[test] + fn clipboard_pixels_encode_as_png() { + let pixels = vec![255, 0, 0, 255, 0, 255, 0, 128]; + let image = ImageData { width: 2, height: 1, bytes: Cow::Owned(pixels.clone()) }; + let bytes = encode(&image).unwrap(); + let mut reader = png::Decoder::new(Cursor::new(bytes)).read_info().unwrap(); + let mut decoded = vec![0; reader.output_buffer_size().unwrap()]; + let info = reader.next_frame(&mut decoded).unwrap(); + assert_eq!((info.width, info.height), (2, 1)); + assert_eq!(decoded, pixels); + } +} \ No newline at end of file diff --git a/crates/quill-code/src/commands.rs b/crates/quill-code/src/commands.rs new file mode 100644 index 0000000..2a6062c --- /dev/null +++ b/crates/quill-code/src/commands.rs @@ -0,0 +1,180 @@ +use std::io::{BufRead, IsTerminal, Write}; +use std::sync::mpsc::channel; +use std::time::{Duration, Instant}; + +use quill_config::settings_path; +use quill_providers::context_label; + +use crate::backend::{self, Backend, Connection}; +use crate::config::{Config, app_dir, personal_instructions_path}; +use crate::text::{Line, accent, bad, bold, dim, good, pad, plain, warn}; +use crate::{Msg, project, store, usage}; + +fn print(line: &Line) { + if std::io::stdout().is_terminal() { + println!("{}", line.ansi()); + } else { + println!("{}", line.text()); + } +} + +fn ask(question: &str) -> bool { + if !std::io::stdin().is_terminal() { + return false; + } + eprint!("{question} [y/N] "); + let _ = std::io::stderr().flush(); + let mut answer = String::new(); + let _ = std::io::stdin().lock().read_line(&mut answer); + matches!(answer.trim().to_lowercase().as_str(), "y" | "yes") +} + +pub fn models(scan: bool) -> u8 { + let mut config = Config::load(); + if let Some(error) = &config.error { + eprintln!("{error}"); + } + if scan { + let found = backend::scan(&config.settings); + if found.is_empty() { + print(&Line::styled("No new model server answered on the usual ports.", dim())); + } else { + config.update(|settings| backend::add_servers(settings, &found)); + for (kind, url) in &found { + print(&Line::styled(format!("Added {} at {url}", kind.label()), good())); + } + } + } + if config.settings.models.providers.is_empty() { + print(&Line::styled("No model server is set up yet. Run quill to connect one, or quill models --scan.", dim())); + return 0; + } + let (tx, rx) = channel(); + let mut backend = Backend::new(tx); + backend.refresh(&config.settings); + let deadline = Instant::now() + Duration::from_secs(30); + while backend.sources.iter().any(|source| source.connection == Connection::Checking) && Instant::now() < deadline { + if let Ok(Msg::Probed { generation, id, found }) = rx.recv_timeout(Duration::from_millis(200)) { + backend.probed(generation, &id, found, &config.settings); + } + } + let selected = config.settings.models.selected.clone(); + for source in &backend.sources { + let tone = match source.connection { + Connection::Online => good(), + Connection::Off => dim(), + _ => warn(), + }; + print(&Line::styled(&source.config.name, bold()).with(format!(" ({}) ", source.config.id), dim()).with(source.status(), tone)); + let widest = source.models.iter().map(|model| model.label().chars().count()).max().unwrap_or(0); + for model in &source.models { + let target = quill_config::ModelRef::new(source.config.id.clone(), model.id.clone()); + let chosen = selected.as_ref() == Some(&target); + let mut line = if chosen { Line::styled(" ● ", accent()) } else { Line::plain(" ") }; + line.push(pad(model.label(), widest), if chosen { bold() } else { plain() }); + let mut detail = vec![format!("{}/{}", source.config.id, model.id), model.status.label().to_string()]; + if let Some(context) = model.context { + detail.push(format!("{} context", context_label(context))); + } + if model.vision { + detail.push("vision".into()); + } + if config.settings.models.pinned.contains(&target) { + detail.push("pinned".into()); + } + line.push(format!(" {}", detail.join(" · ")), dim()); + print(&line); + } + } + print(&Line::default()); + print(&Line::styled("Pick one with /model in Quill Code, or pass --model provider/model to quill exec.", dim())); + 0 +} + +pub fn usage() -> u8 { + let threads = store::load_threads(); + let records = usage::load(&threads); + let width = crossterm::terminal::size().map_or(100, |(columns, _)| columns as usize).clamp(40, 160) - 1; + for line in usage::report(None, &records, width) { + print(&line); + } + 0 +} + +pub fn show_config() -> u8 { + let config = Config::load(); + let path = settings_path(); + let status = match &config.error { + Some(error) => Line::styled(error.clone(), bad()), + None => Line::styled("ok", good()), + }; + print(&Line::plain(format!("Settings {} ", path.display())).with_line(status)); + let instructions = personal_instructions_path(); + let note = if instructions.is_file() { "" } else { " (not written yet)" }; + print(&Line::plain(format!("Instructions {}", instructions.display())).with(note, dim())); + let threads = store::load_threads(); + print(&Line::plain(format!("Threads {}", app_dir().join("threads").display())).with(format!(" ({})", threads.len()), dim())); + print(&Line::plain(format!("Worktrees {}", config.settings.worktrees_dir().display()))); + print(&Line::default()); + print(&Line::styled("A project can override any setting in .quill/settings.json at its root.", dim())); + print(&Line::styled("quill config edit opens the settings, quill config instructions your personal instructions.", dim())); + 0 +} + +pub fn edit_config() -> u8 { + let config = Config::load(); + if !settings_path().is_file() + && let Err(error) = quill_config::save(&config.settings) + { + eprintln!("The settings file could not be written: {error}"); + return 1; + } + if let Err(error) = project::edit(&settings_path()) { + eprintln!("{error}"); + return 1; + } + match Config::load().error { + Some(error) => { + eprintln!("{error}. Quill Code keeps using the defaults until it is fixed."); + 1 + } + None => 0, + } +} + +pub fn edit_instructions() -> u8 { + let path = personal_instructions_path(); + if !path.is_file() { + let made = path.parent().map_or(Ok(()), std::fs::create_dir_all).and_then(|_| std::fs::write(&path, "")); + if let Err(error) = made { + eprintln!("{} could not be created: {error}", path.display()); + return 1; + } + } + match project::edit(&path) { + Ok(()) => 0, + Err(error) => { + eprintln!("{error}"); + 1 + } + } +} + +pub fn reset_config() -> u8 { + let mut config = Config::load(); + if !ask("Reset every setting except your providers and models?") { + eprintln!("Nothing was changed."); + return 1; + } + let fresh = config.settings.reset(); + match config.replace(fresh) { + Ok(()) => { + print(&Line::styled("Settings reset. Your providers and models were kept.", good())); + 0 + } + Err(error) => { + eprintln!("The settings could not be saved: {error}"); + 1 + } + } +} \ No newline at end of file diff --git a/crates/quill-code/src/commit.rs b/crates/quill-code/src/commit.rs new file mode 100644 index 0000000..925210b --- /dev/null +++ b/crates/quill-code/src/commit.rs @@ -0,0 +1,407 @@ +use std::path::{Path, PathBuf}; +use std::sync::mpsc::Sender; + +use crossterm::event::{KeyCode, KeyEvent, KeyModifiers}; +use quill_git::github::{self, Visibility}; +use quill_git::{self as git, FileStatus}; + +use crate::Msg; +use crate::backend::Writer; +use crate::composer::Composer; +use crate::picker::{Choice, Picked, Picker}; +use crate::project; +use crate::text::{Line, accent, bad, bold, dim, good, pad, plain, truncate, warn}; + +const COMMIT_SYSTEM: &str = "You write git commit messages. Reply with the message only: one summary line in the imperative mood under 72 characters, then, only if it helps, a blank line and a few short bullet points."; + +pub enum Job { + Committed(Result<(String, String), String>), + Pushed(Result<(), String>), + Published(Result<String, String>), +} + +#[derive(Clone, Copy)] +enum Target { + Here, + NewBranch, +} + +#[derive(Clone, Copy)] +enum After { + Push, + Review, + Publish(Visibility), + Done, +} + +enum Step { + Files(usize), + Target(Picker<Target>), + Branch(Composer), + Message(Composer), + Working(&'static str), + After(Picker<After>), +} + +#[derive(Debug, PartialEq, Eq)] +pub enum Update { + Stay, + Close, +} + +pub struct Flow { + root: PathBuf, + branch: Option<String>, + default_branch: String, + remote: Option<String>, + has_commits: bool, + files: Vec<FileStatus>, + chosen: Vec<bool>, + new_branch: Option<String>, + message: String, + step: Step, + error: Option<String>, + writer: Result<Writer, String>, + tx: Sender<Msg>, +} + +fn write_message(root: &Path, writer: Result<Writer, String>) -> Result<String, String> { + let text = tidy(&writer?.write(COMMIT_SYSTEM, &git::staged_diff(root, 12_000))?); + if text.is_empty() { Err("The model returned an empty message. Type one yourself.".into()) } else { Ok(text) } +} + +fn tidy(text: &str) -> String { + let text = text.trim().trim_matches('`').trim(); + match text.split_once('\n') { + Some((subject, body)) if !body.trim().is_empty() => format!("{}\n\n{}", subject.trim(), body.trim_start_matches(['\r', '\n'])), + _ => text.to_string(), + } +} + +impl Flow { + pub fn new(root: PathBuf, writer: Result<Writer, String>, tx: Sender<Msg>) -> Result<Flow, String> { + let files = git::status(&root)?; + let mut flow = Flow { + branch: git::branch(&root), + default_branch: git::default_branch(&root), + remote: git::remote_url(&root), + has_commits: git::head(&root).is_some(), + chosen: vec![true; files.len()], + files, + new_branch: None, + message: String::new(), + step: Step::Files(0), + error: None, + writer, + tx, + root, + }; + if flow.files.is_empty() { + if !flow.can_publish() { + return Err("Nothing to commit. The working tree is clean.".into()); + } + flow.step = Step::After(flow.after_choices()); + } + Ok(flow) + } + + fn can_publish(&self) -> bool { + self.remote.is_none() && self.has_commits && self.branch.is_some() + } + + fn review_url(&self, branch: &str) -> Option<String> { + if branch == self.default_branch { + return None; + } + self.remote.as_deref().and_then(|remote| git::review_url(remote, &self.default_branch, branch)) + } + + fn after_choices(&self) -> Picker<After> { + let mut choices = Vec::new(); + if self.can_publish() { + let name = project::clean_name(&git::repo_name(&self.root)); + choices.push(Choice::new( + "Publish as private", + format!("Create {name} on GitHub and push"), + After::Publish(Visibility::Private), + )); + choices.push(Choice::new("Publish as public", format!("Create {name} on GitHub and push"), After::Publish(Visibility::Public))); + } else if self.remote.is_some() { + choices.push(Choice::new("Push", "Send the branch to origin", After::Push)); + if self.branch.as_deref().and_then(|branch| self.review_url(branch)).is_some() { + choices.push(Choice::new("Push and open a pull request", "Opens the review page in your browser", After::Review)); + } + } + choices.push(Choice::new("Done", "", After::Done)); + Picker::new("What next?", choices) + } + + fn start(&mut self, label: &'static str, work: impl FnOnce() -> Job + Send + 'static) { + self.error = None; + self.step = Step::Working(label); + let tx = self.tx.clone(); + std::thread::spawn(move || { + let _ = tx.send(Msg::Job(work())); + }); + } + + fn commit(&mut self, message: String) { + let files: Vec<String> = self.files.iter().zip(&self.chosen).filter(|(_, on)| **on).map(|(file, _)| file.path.clone()).collect(); + let (root, writer, branch) = (self.root.clone(), self.writer.clone(), self.new_branch.clone()); + self.message = message.clone(); + let label = if message.is_empty() { "Writing a commit message" } else { "Committing" }; + self.start(label, move || { + Job::Committed((|| { + if let Some(name) = &branch { + git::create_branch(&root, name)?; + } + git::stage(&root, &files)?; + let message = if message.is_empty() { write_message(&root, writer)? } else { message }; + let sha = git::commit(&root, &files, &message)?; + Ok((sha, git::branch(&root).unwrap_or_default())) + })()) + }); + } + + fn files_key(&mut self, key: KeyEvent, highlighted: usize) -> Update { + let count = self.files.len(); + match key.code { + KeyCode::Esc => return Update::Close, + KeyCode::Up if count > 0 => self.step = Step::Files(highlighted.checked_sub(1).unwrap_or(count - 1)), + KeyCode::Down if count > 0 => self.step = Step::Files((highlighted + 1) % count), + KeyCode::Char(' ') if count > 0 => self.chosen[highlighted] = !self.chosen[highlighted], + KeyCode::Char('a') => { + let all = self.chosen.iter().all(|on| *on); + self.chosen.iter_mut().for_each(|on| *on = !all); + } + KeyCode::Enter => { + if !self.chosen.iter().any(|on| *on) { + self.error = Some("Pick at least one file to commit.".into()); + return Update::Stay; + } + self.error = None; + self.step = match &self.branch { + Some(branch) => Step::Target(Picker::new( + "Where should the commit go?", + vec![ + Choice::new(format!("Commit to {branch}"), "", Target::Here), + Choice::new("Commit to a new branch", "Keeps your work apart, ready for a pull request", Target::NewBranch), + ], + )), + None => Step::Branch(Composer::default()), + }; + } + _ => {} + } + Update::Stay + } + + pub fn key(&mut self, key: KeyEvent, out: &mut Vec<Line>) -> Update { + let plain_enter = key.code == KeyCode::Enter && !key.modifiers.intersects(KeyModifiers::SHIFT | KeyModifiers::ALT); + match &mut self.step { + Step::Files(highlighted) => { + let highlighted = *highlighted; + return self.files_key(key, highlighted); + } + Step::Target(picker) => match picker.key(key) { + Picked::Closed => return Update::Close, + Picked::Chosen(index) => { + self.step = match picker.choices[index].value { + Target::Here => Step::Message(Composer::default()), + Target::NewBranch => Step::Branch(Composer::default()), + }; + } + Picked::Nothing => {} + }, + Step::Branch(input) => { + if key.code == KeyCode::Esc { + return Update::Close; + } + if plain_enter { + let name = input.text.trim().to_string(); + if !git::valid_branch(&name) { + self.error = Some("Give the new branch a name Git accepts, such as fix-login.".into()); + return Update::Stay; + } + self.error = None; + self.new_branch = Some(name); + self.step = Step::Message(Composer::default()); + } else { + input.key(key); + } + } + Step::Message(input) => { + if key.code == KeyCode::Esc { + return Update::Close; + } + if plain_enter { + let message = input.text.trim().to_string(); + self.commit(message); + } else { + input.key(key); + } + } + Step::Working(_) => {} + Step::After(picker) => match picker.key(key) { + Picked::Closed => return Update::Close, + Picked::Chosen(index) => { + let choice = picker.choices[index].value; + return self.after(choice, out); + } + Picked::Nothing => {} + }, + } + Update::Stay + } + + fn after(&mut self, choice: After, out: &mut Vec<Line>) -> Update { + let Some(branch) = self.branch.clone() else { return Update::Close }; + let root = self.root.clone(); + match choice { + After::Done => return Update::Close, + After::Push | After::Review => { + let review = (matches!(choice, After::Review)).then(|| self.review_url(&branch)).flatten(); + if let Some(url) = &review { + out.push(Line::styled(" Open the pull request page: ", dim()).with(url, accent())); + } + self.start("Pushing", move || { + let pushed = git::push(&root, &branch); + if pushed.is_ok() + && let Some(url) = review + { + project::open_url(&url); + } + Job::Pushed(pushed) + }); + } + After::Publish(visibility) => { + self.start("Publishing to GitHub", move || { + Job::Published((|| { + let repo = github::create_repo(&project::clean_name(&git::repo_name(&root)), visibility)?; + git::add_remote(&root, &repo.clone_url)?; + git::push(&root, &branch)?; + Ok(repo.html_url) + })()) + }); + } + } + Update::Stay + } + + pub fn job(&mut self, job: Job, out: &mut Vec<Line>) -> Update { + match job { + Job::Committed(Ok((sha, branch))) => { + out.push(Line::styled("· ", good()).with("Committed ", dim()).with(format!("{sha} to {branch}"), plain())); + self.has_commits = true; + self.branch = Some(branch); + let next = self.after_choices(); + if next.choices.len() == 1 { + return Update::Close; + } + self.step = Step::After(next); + } + Job::Committed(Err(error)) => { + self.error = Some(error); + let mut input = Composer::default(); + input.set(&self.message); + self.step = Step::Message(input); + } + Job::Pushed(Ok(())) => { + out.push( + Line::styled("· ", good()) + .with("Pushed ", dim()) + .with(format!("{} to origin", self.branch.clone().unwrap_or_default()), plain()), + ); + return Update::Close; + } + Job::Published(Ok(url)) => { + out.push(Line::styled("· ", good()).with("Published to ", dim()).with(url, accent())); + return Update::Close; + } + Job::Pushed(Err(error)) | Job::Published(Err(error)) => { + self.error = Some(error); + self.remote = git::remote_url(&self.root); + self.step = Step::After(self.after_choices()); + } + } + Update::Stay + } + + pub fn paste(&mut self, text: &str) { + if let Step::Branch(input) | Step::Message(input) = &mut self.step { + input.insert(&text.replace("\r\n", "\n")); + } + } + + pub fn working(&self) -> bool { + matches!(self.step, Step::Working(_)) + } + + pub fn render(&self, width: usize, rows: usize, spinner: &str) -> (Vec<Line>, Option<(usize, usize)>) { + let mut lines = Vec::new(); + let place = match &self.branch { + Some(branch) => format!("on {branch}"), + None => "not on a branch yet".into(), + }; + lines.push(Line::styled("Commit your work", bold()).with(format!(" · {place}"), dim())); + let on_default = self.remote.is_some() && self.branch.as_deref() == Some(self.default_branch.as_str()); + let mut cursor = None; + match &self.step { + Step::Files(highlighted) => { + if on_default { + lines.push(Line::styled(" This is your main branch. A new branch keeps it clean for a pull request.", warn())); + } + let count = self.chosen.iter().filter(|on| **on).count(); + lines.push(Line::styled(format!(" {count} of {} files", self.files.len()), dim())); + let rows = rows.saturating_sub(5).max(3); + let start = highlighted.saturating_sub(rows / 2).min(self.files.len().saturating_sub(rows)); + let widest = self.files.iter().map(|file| file.path.chars().count()).max().unwrap_or(0).min(width / 2); + for (index, file) in self.files.iter().enumerate().skip(start).take(rows) { + let mark = if index == *highlighted { Line::styled("▸ ", accent()) } else { Line::plain(" ") }; + let check = if self.chosen[index] { Line::styled("[x] ", good()) } else { Line::styled("[ ] ", dim()) }; + let mut line = mark; + line.append(check); + line.push(pad(&file.path, widest), if self.chosen[index] { plain() } else { dim() }); + line.push(format!(" {}", file.label()), dim()); + line.push(format!(" +{}", file.added), good()); + line.push(format!(" -{}", file.removed), bad()); + lines.push(truncate(&line, width)); + } + lines.push(Line::styled(" space toggles · a toggles all · enter continues · esc cancels", dim())); + } + Step::Target(picker) => lines.extend(picker.render(width, rows)), + Step::After(picker) => lines.extend(picker.render(width, rows)), + Step::Branch(input) => { + lines.push(Line::plain(" New branch name")); + let (text, at) = input.render(width, "for example fix-login"); + cursor = Some((lines.len() + at.0, at.1)); + lines.extend(text); + lines.push(Line::styled(" enter continues · esc cancels", dim())); + } + Step::Message(input) => { + lines.push(Line::plain(" Message")); + let (text, at) = input.render(width, "leave empty and the model writes it"); + cursor = Some((lines.len() + at.0, at.1)); + lines.extend(text); + lines.push(Line::styled(" enter commits · shift+enter adds a line · esc cancels", dim())); + } + Step::Working(label) => lines.push(Line::styled(format!("{spinner} {label}"), accent())), + } + if let Some(error) = &self.error { + lines.push(truncate(&Line::styled(format!(" {error}"), bad()), width)); + } + (lines, cursor) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn messages_get_a_blank_line_after_the_summary() { + assert_eq!(tidy("Add JSON output\n- Add a flag\n- Print totals"), "Add JSON output\n\n- Add a flag\n- Print totals"); + assert_eq!(tidy("```\nFix the parser\n\n- Handle tabs\n```"), "Fix the parser\n\n- Handle tabs"); + assert_eq!(tidy(" Fix the parser "), "Fix the parser"); + } +} \ No newline at end of file diff --git a/crates/quill-code/src/commit_dialog.rs b/crates/quill-code/src/commit_dialog.rs deleted file mode 100644 index 344fda6..0000000 --- a/crates/quill-code/src/commit_dialog.rs +++ /dev/null @@ -1,577 +0,0 @@ -use std::collections::HashSet; -use std::path::PathBuf; -use std::sync::atomic::AtomicBool; - -use gpui_kit::component::input::{Input, InputState, Textarea, TextareaState}; -use gpui_kit::{ - Context, Div, Entity, EventEmitter, FontWeight, IntoElement, MouseButton, ParentElement, Render, SharedString, Stateful, Styled, - Window, div, prelude::*, px, -}; -use quill_llama::{ChatRequest, Event, Message, Server}; - -use crate::git::{self, FileStatus}; -use crate::github::{self, Visibility}; -use crate::icons::Icon; -use crate::palette::{Palette, palette}; -use crate::project; -use crate::thread_view::file_icon; -use crate::ui::{MONO, icon}; - -pub enum CommitEvent { - Close, - Updated(String), -} - -#[derive(Clone, PartialEq)] -enum Stage { - Ready, - Working(&'static str), - Committed { sha: String, branch: String }, - Pushed { branch: String }, - Published { url: String }, -} - -pub struct CommitDialog { - root: PathBuf, - branch: Option<String>, - default_branch: String, - remote: Option<String>, - has_commits: bool, - files: Vec<FileStatus>, - selected: HashSet<String>, - message: Entity<TextareaState>, - new_branch: Option<Entity<InputState>>, - stage: Stage, - error: Option<String>, - server_url: String, - model: Option<String>, -} - -impl EventEmitter<CommitEvent> for CommitDialog {} - -impl CommitDialog { - pub fn new(root: PathBuf, server_url: String, model: Option<String>, window: &mut Window, cx: &mut Context<Self>) -> Self { - let message = cx.new(|cx| { - TextareaState::new(window, cx) - .placeholder("Describe the change, or leave this empty and the model will write it") - .auto_grow(3, 8) - }); - message.update(cx, |message, cx| message.focus(window, cx)); - let (files, error) = match git::status(&root) { - Ok(files) => (files, None), - Err(error) => (Vec::new(), Some(error)), - }; - let selected = files.iter().map(|f| f.path.clone()).collect(); - CommitDialog { - branch: git::branch(&root), - default_branch: git::default_branch(&root), - remote: git::remote_url(&root), - has_commits: git::head(&root).is_some(), - root, - files, - selected, - message, - new_branch: None, - stage: Stage::Ready, - error, - server_url, - model, - } - } - - fn toggle_file(&mut self, path: String, cx: &mut Context<Self>) { - if !self.selected.remove(&path) { - self.selected.insert(path); - } - cx.notify(); - } - - fn toggle_all(&mut self, cx: &mut Context<Self>) { - if self.selected.len() == self.files.len() { - self.selected.clear(); - } else { - self.selected = self.files.iter().map(|f| f.path.clone()).collect(); - } - cx.notify(); - } - - fn ask_branch(&mut self, window: &mut Window, cx: &mut Context<Self>) { - let input = cx.new(|cx| InputState::new(window, cx).placeholder("Branch name, for example fix-login")); - input.update(cx, |input, cx| input.focus(window, cx)); - self.new_branch = Some(input); - cx.notify(); - } - - fn commit(&mut self, cx: &mut Context<Self>) { - let files: Vec<String> = self.files.iter().filter(|f| self.selected.contains(&f.path)).map(|f| f.path.clone()).collect(); - if files.is_empty() { - self.error = Some("Pick at least one file to commit.".into()); - cx.notify(); - return; - } - let new_branch = self.new_branch.as_ref().map(|input| input.read(cx).value().trim().to_string()); - if new_branch.as_ref().is_some_and(|b| !git::valid_branch(b)) { - self.error = Some("Give the new branch a name Git accepts, such as fix-login.".into()); - cx.notify(); - return; - } - if new_branch.is_none() && self.branch.is_none() { - self.error = Some("This folder is not on a branch yet. Commit to a new branch instead.".into()); - cx.notify(); - return; - } - let message = self.message.read(cx).value().trim().to_string(); - let (root, url, model) = (self.root.clone(), self.server_url.clone(), self.model.clone()); - self.error = None; - self.stage = Stage::Working(if message.is_empty() { "Writing a commit message" } else { "Committing" }); - cx.notify(); - let task = cx.background_executor().spawn(async move { - if let Some(name) = &new_branch { - git::create_branch(&root, name)?; - } - git::stage(&root, &files)?; - let message = if message.is_empty() { write_message(&root, &url, model.as_deref())? } else { message }; - let sha = git::commit(&root, &files, &message)?; - Ok::<_, String>((sha, git::branch(&root).unwrap_or_default())) - }); - cx.spawn(async move |this, cx| { - let result = task.await; - _ = this.update(cx, |this, cx| { - match result { - Ok((sha, branch)) => { - cx.emit(CommitEvent::Updated(format!("Committed {sha} to {branch}"))); - this.has_commits = true; - this.branch = Some(branch.clone()); - this.stage = Stage::Committed { sha, branch }; - } - Err(error) => { - this.error = Some(error); - this.stage = Stage::Ready; - } - } - cx.notify(); - }); - }) - .detach(); - } - - fn push(&mut self, open_review: bool, cx: &mut Context<Self>) { - let Some(branch) = self.branch.clone() else { return }; - let root = self.root.clone(); - let review = self.review_url(&branch); - self.stage = Stage::Working("Pushing"); - self.error = None; - cx.notify(); - let pushing = branch.clone(); - let task = cx.background_executor().spawn(async move { git::push(&root, &pushing) }); - cx.spawn(async move |this, cx| { - let result = task.await; - _ = this.update(cx, |this, cx| { - match result { - Ok(()) => { - if open_review && let Some(url) = &review { - cx.open_url(url); - } - this.stage = Stage::Pushed { branch }; - } - Err(error) => { - this.error = Some(error); - this.stage = Stage::Committed { sha: git::head(&this.root).unwrap_or_default(), branch }; - } - } - cx.notify(); - }); - }) - .detach(); - } - - fn publish(&mut self, visibility: Visibility, cx: &mut Context<Self>) { - let Some(branch) = self.branch.clone().filter(|_| !matches!(self.stage, Stage::Working(_))) else { return }; - let root = self.root.clone(); - let fallback = self.stage.clone(); - self.stage = Stage::Working("Publishing to GitHub"); - self.error = None; - cx.notify(); - let task = cx.background_executor().spawn(async move { - let repo = github::create_repo(&project::clean_name(&git::repo_name(&root)), visibility)?; - git::add_remote(&root, &repo.clone_url)?; - git::push(&root, &branch)?; - Ok::<_, String>(repo.html_url) - }); - cx.spawn(async move |this, cx| { - let result = task.await; - _ = this.update(cx, |this, cx| { - this.remote = git::remote_url(&this.root); - match result { - Ok(url) => { - cx.emit(CommitEvent::Updated(format!("Published to {url}"))); - this.stage = Stage::Published { url }; - } - Err(error) => { - this.error = Some(error); - this.stage = fallback; - } - } - cx.notify(); - }); - }) - .detach(); - } - - fn can_publish(&self) -> bool { - self.remote.is_none() && self.has_commits && self.branch.is_some() - } - - fn review_url(&self, branch: &str) -> Option<String> { - if branch == self.default_branch { - return None; - } - self.remote.as_deref().and_then(|remote| git::review_url(remote, &self.default_branch, branch)) - } - - fn file_rows(&self, p: Palette, cx: &mut Context<Self>) -> Div { - div().flex().flex_col().children(self.files.iter().map(|file| { - let path = file.path.clone(); - let on = self.selected.contains(&file.path); - div() - .id(SharedString::from(format!("commit-file-{}", file.path))) - .flex() - .items_center() - .gap(px(10.)) - .px(px(12.)) - .py(px(6.)) - .cursor_pointer() - .hover(move |style| style.bg(p.row_hover)) - .child(check(on, p)) - .child(icon(file_icon(&file.path), 14., p.text_muted)) - .child( - div() - .flex_1() - .min_w_0() - .overflow_hidden() - .whitespace_nowrap() - .text_ellipsis() - .font_family(MONO) - .text_size(px(12.5)) - .text_color(if on { p.text } else { p.text_faint }) - .child(file.path.clone()), - ) - .child(div().text_size(px(11.5)).text_color(p.text_faint).child(file.label())) - .child(div().w(px(40.)).flex().justify_end().text_size(px(12.)).text_color(p.add).child(format!("+{}", file.added))) - .child(div().w(px(40.)).flex().justify_end().text_size(px(12.)).text_color(p.del).child(format!("-{}", file.removed))) - .on_click(cx.listener(move |this, _, _, cx| this.toggle_file(path.clone(), cx))) - })) - } -} - -fn write_message(root: &std::path::Path, url: &str, model: Option<&str>) -> Result<String, String> { - let model = model.ok_or("Choose a model first, or type a commit message yourself.")?; - let request = ChatRequest { - model: model.to_string(), - messages: vec![ - Message::system( - "You write git commit messages. Reply with the message only: one summary line in the imperative mood under 72 characters, then, only if it helps, a blank line and a few short bullet points.", - ), - Message::user(git::staged_diff(root, 12_000)), - ], - thinking: Some(false), - tools: Vec::new(), - }; - let mut text = String::new(); - Server::new(url) - .stream_chat(&request, &AtomicBool::new(false), |event| { - if let Event::Content(chunk) = event { - text.push_str(&chunk); - } - }) - .map_err(|e| e.to_string())?; - let text = match text.rfind("</think>") { - Some(end) => text[end + 8..].to_string(), - None => text, - }; - let text = text.trim().trim_matches('`').trim().to_string(); - if text.is_empty() { Err("The model returned an empty message. Type one yourself.".into()) } else { Ok(text) } -} - -fn check(on: bool, p: Palette) -> Div { - div() - .size(px(16.)) - .flex_shrink_0() - .flex() - .items_center() - .justify_center() - .rounded(px(4.)) - .border_1() - .border_color(if on { p.text } else { p.border }) - .when(on, |b| b.bg(p.text).child(icon(Icon::Check, 12., p.bg))) -} - -fn button(id: &'static str, label: impl Into<SharedString>, primary: bool, p: Palette) -> Stateful<Div> { - div() - .id(id) - .flex() - .items_center() - .gap(px(6.)) - .h(px(32.)) - .px(px(14.)) - .rounded(px(8.)) - .text_size(px(13.5)) - .cursor_pointer() - .map(|b| { - if primary { - b.bg(p.text).text_color(p.bg).font_weight(FontWeight::SEMIBOLD).hover(|s| s.opacity(0.9)) - } else { - b.border_1().border_color(p.border).text_color(p.text).hover(move |s| s.bg(p.row_hover)) - } - }) - .child(label.into()) -} - -impl Render for CommitDialog { - fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement { - let p = palette(cx); - let viewport = window.viewport_size(); - let working = matches!(self.stage, Stage::Working(_)); - let mut body = div().flex().flex_col().gap(px(14.)); - match self.stage.clone() { - Stage::Ready | Stage::Working(_) => { - let on_default = self.remote.is_some() && self.branch.as_deref() == Some(self.default_branch.as_str()); - let all = !self.files.is_empty() && self.selected.len() == self.files.len(); - body = body - .child( - div() - .flex() - .items_center() - .gap(px(8.)) - .text_size(px(13.)) - .text_color(p.text_muted) - .child(icon(Icon::Branch, 14., p.text_muted)) - .child(match &self.branch { - Some(branch) => format!("On {branch}"), - None => "Not on a branch yet".into(), - }) - .when(on_default, |row| { - row.child( - div() - .ml(px(4.)) - .px(px(8.)) - .py(px(1.)) - .rounded(px(6.)) - .bg(p.warning.opacity(0.12)) - .text_size(px(12.)) - .text_color(p.warning) - .child("Your main branch. A new branch keeps it clean for a pull request."), - ) - }), - ) - .child( - div() - .rounded(px(12.)) - .border_1() - .border_color(p.border_soft) - .overflow_hidden() - .child( - div() - .id("toggle-all") - .flex() - .items_center() - .gap(px(10.)) - .px(px(12.)) - .py(px(8.)) - .bg(p.fill) - .cursor_pointer() - .text_size(px(12.5)) - .text_color(p.text_muted) - .child(check(all, p)) - .child(format!("{} of {} files", self.selected.len(), self.files.len())) - .on_click(cx.listener(|this, _, _, cx| this.toggle_all(cx))), - ) - .child(div().id("commit-files").max_h(px(220.)).overflow_y_scroll().child(self.file_rows(p, cx))) - .when(self.files.is_empty(), |list| { - list.child( - div() - .p(px(16.)) - .text_size(px(13.)) - .text_color(p.text_faint) - .child("Nothing to commit. The working tree is clean."), - ) - }), - ) - .child(div().text_size(px(13.)).font_weight(FontWeight::SEMIBOLD).text_color(p.text).child("Message")) - .child(div().text_size(px(13.5)).child(Textarea::new(&self.message))) - .when_some(self.new_branch.clone(), |col, input| { - col.child(div().text_size(px(13.)).font_weight(FontWeight::SEMIBOLD).text_color(p.text).child("New branch")) - .child(div().font_family(MONO).text_size(px(13.)).child(Input::new(&input))) - }); - } - Stage::Committed { sha, branch } => { - body = body.child(done_note(format!("Committed {sha} to {branch}."), p)).when(self.remote.is_none(), |b| { - b.child(div().text_size(px(13.)).text_color(p.text_faint).child(format!( - "Not on GitHub yet. Publishing creates a repository named {} and pushes {branch} to it.", - project::clean_name(&git::repo_name(&self.root)) - ))) - }); - } - Stage::Pushed { branch } => { - body = body.child(done_note(format!("Pushed {branch} to origin."), p)); - } - Stage::Published { url } => { - body = body.child(done_note(format!("Published to {url}"), p)); - } - } - let footer = { - let mut row = div().flex().items_center().justify_end().gap(px(8.)); - if let Stage::Working(what) = self.stage { - row = row.child( - div() - .flex_1() - .flex() - .items_center() - .gap(px(8.)) - .text_size(px(13.)) - .text_color(p.text_faint) - .child(icon(Icon::Loader, 14., p.text_faint)) - .child(what), - ); - } - match self.stage.clone() { - Stage::Ready | Stage::Working(_) => { - let detached = self.branch.is_none(); - row = row.child( - button("commit-cancel", "Cancel", false, p).on_click(cx.listener(|_, _, _, cx| cx.emit(CommitEvent::Close))), - ); - row = if self.files.is_empty() && self.can_publish() { - publish_buttons(row, p, cx) - } else if self.new_branch.is_some() { - row.child(button("commit-confirm", "Create branch and commit", true, p).on_click(cx.listener( - move |this, _, _, cx| { - if !working { - this.commit(cx) - } - }, - ))) - } else { - row.child(button("commit-branch", "Commit to a new branch", detached, p).on_click(cx.listener( - move |this, _, window, cx| { - if !working { - this.ask_branch(window, cx) - } - }, - ))) - .when(!detached, |row| { - row.child(button("commit-confirm", "Commit", true, p).on_click(cx.listener(move |this, _, _, cx| { - if !working { - this.commit(cx) - } - }))) - }) - }; - } - Stage::Committed { branch, .. } => { - row = - row.child(button("commit-done", "Done", false, p).on_click(cx.listener(|_, _, _, cx| cx.emit(CommitEvent::Close)))); - if self.can_publish() { - row = publish_buttons(row, p, cx); - } else if self.remote.is_some() { - row = row.child( - button("commit-push", "Push", self.review_url(&branch).is_none(), p) - .on_click(cx.listener(|this, _, _, cx| this.push(false, cx))), - ); - if self.review_url(&branch).is_some() { - row = row.child( - button("commit-review", "Push and open a pull request", true, p) - .on_click(cx.listener(|this, _, _, cx| this.push(true, cx))), - ); - } - } - } - Stage::Pushed { .. } => { - row = - row.child(button("commit-done", "Done", true, p).on_click(cx.listener(|_, _, _, cx| cx.emit(CommitEvent::Close)))); - } - Stage::Published { url } => { - row = row - .child(button("commit-done", "Done", false, p).on_click(cx.listener(|_, _, _, cx| cx.emit(CommitEvent::Close)))) - .child(button("commit-open", "Open on GitHub", true, p).on_click(move |_, _, cx| cx.open_url(&url))); - } - } - row - }; - div() - .absolute() - .top_0() - .left_0() - .w(viewport.width) - .h(viewport.height) - .occlude() - .bg(gpui_kit::black().opacity(0.55)) - .flex() - .items_start() - .justify_center() - .on_mouse_down(MouseButton::Left, cx.listener(|_, _, _, cx| cx.emit(CommitEvent::Close))) - .child( - div() - .id("commit-dialog") - .mt(px(80.)) - .w(px(640.)) - .flex() - .flex_col() - .gap(px(16.)) - .p(px(22.)) - .rounded(px(16.)) - .bg(p.menu_bg) - .border_1() - .border_color(p.border) - .shadow_lg() - .on_mouse_down(MouseButton::Left, |_, _, cx| cx.stop_propagation()) - .child( - div() - .flex() - .items_center() - .gap(px(10.)) - .child(icon(Icon::Commit, 18., p.text)) - .child(div().text_size(px(18.)).font_weight(FontWeight::SEMIBOLD).text_color(p.text).child("Commit your work")), - ) - .child(body) - .when_some(self.error.clone(), |col, error| { - col.child( - div() - .px(px(12.)) - .py(px(8.)) - .rounded(px(8.)) - .bg(p.danger.opacity(0.1)) - .text_size(px(13.)) - .text_color(p.danger) - .child(error), - ) - }) - .child(footer), - ) - } -} - -fn publish_buttons(row: Div, p: Palette, cx: &mut Context<CommitDialog>) -> Div { - row.child( - button("publish-public", "Publish as public", false, p) - .on_click(cx.listener(|this, _, _, cx| this.publish(Visibility::Public, cx))), - ) - .child( - button("publish-private", "Publish as private", true, p) - .on_click(cx.listener(|this, _, _, cx| this.publish(Visibility::Private, cx))), - ) -} - -fn done_note(text: String, p: Palette) -> impl IntoElement { - div() - .flex() - .items_center() - .gap(px(10.)) - .px(px(14.)) - .py(px(12.)) - .rounded(px(10.)) - .bg(p.success.opacity(0.1)) - .text_size(px(14.)) - .text_color(p.text) - .child(icon(Icon::CheckCircle, 16., p.success)) - .child(text) -} \ No newline at end of file diff --git a/crates/quill-code/src/composer.rs b/crates/quill-code/src/composer.rs index 44e1ce2..9b53fbb 100644 --- a/crates/quill-code/src/composer.rs +++ b/crates/quill-code/src/composer.rs @@ -1,1335 +1,355 @@ use std::path::PathBuf; -use gpui_kit::component::input::{Input, InputEvent, InputState, Position, Textarea, TextareaState}; -use gpui_kit::{ - Anchor, App, Context, Div, Entity, EventEmitter, ExternalPaths, Focusable, FontWeight, IntoElement, KeystrokeEvent, ObjectFit, - ParentElement, PathPromptOptions, Render, SharedString, Stateful, Styled, Subscription, Window, div, img, prelude::*, px, svg, -}; -use quill_agent::{Access, Decision}; -use quill_llama::{Model, Status, Thinking, context_label}; -use quill_weave::State; +use crossterm::event::{KeyCode, KeyEvent, KeyModifiers}; use crate::attachments::Attachment; -use crate::backend::{Backend, Connection}; -use crate::config::Config; -use crate::context_ring; -use crate::git::{self, Branches}; -use crate::icons::Icon; -use crate::mentions::{self, Command, Trigger}; -use crate::palette::{Palette, palette}; -use crate::project; -use crate::ui::{MONO, icon, menu_item, menu_label, menu_panel, popup, separator}; -use crate::weave::{WeaveMark, model_mark}; +use crate::text::{Line, accent, char_width, dim, plain}; use crate::workspace::Prompt; -pub enum ComposerEvent { - Submit(Prompt), - Stop, - Decide(Decision), - OpenModelSettings, - Command(Command), - SetIsolated(bool), - SwitchProject(PathBuf), - AddProject, - RepoChanged, -} - -#[derive(Clone)] -pub struct ApprovalCard { - pub title: &'static str, - pub target: String, - pub stats: Option<(usize, usize)>, -} - -#[derive(Clone)] -pub struct Strip { - pub root: PathBuf, - pub project: PathBuf, - pub name: String, - pub branch: Option<String>, - pub isolated: bool, - pub can_isolate: bool, - pub locked: bool, +#[derive(Default)] +pub struct Composer { + pub text: String, + pub cursor: usize, + pub attachments: Vec<Attachment>, + history: Vec<String>, + recall: Option<usize>, + draft: String, } -#[derive(Clone, Copy, PartialEq, Eq)] -enum Menu { - Model, - Thinking, - Access, - Workspace, - Branch, - ApprovalMore, +fn word_start(text: &str, from: usize) -> usize { + let before = &text[..from]; + let trimmed = before.trim_end_matches(|c: char| !c.is_alphanumeric()); + trimmed.trim_end_matches(char::is_alphanumeric).len() } -#[derive(Clone, PartialEq)] -enum Suggestions { - Commands(Vec<Command>), - Files { start: usize, paths: Vec<String> }, +fn word_end(text: &str, from: usize) -> usize { + let after = &text[from..]; + let skipped = after.len() - after.trim_start_matches(|c: char| !c.is_alphanumeric()).len(); + let rest = &after[skipped..]; + from + skipped + (rest.len() - rest.trim_start_matches(char::is_alphanumeric).len()) } -impl Suggestions { - fn len(&self) -> usize { - match self { - Suggestions::Commands(commands) => commands.len(), - Suggestions::Files { paths, .. } => paths.len(), - } +fn pasted_path(text: &str) -> Option<PathBuf> { + let trimmed = text.trim().trim_matches(['"', '\'']); + if trimmed.is_empty() || trimmed.contains('\n') { + return None; } + let path = PathBuf::from(trimmed.strip_prefix("file://").unwrap_or(trimmed)); + path.is_file().then_some(path) } -pub struct Composer { - input: Entity<TextareaState>, - search: Entity<InputState>, - branch_input: Entity<InputState>, - branches: Branches, - deleting: Option<String>, - branch_error: Option<String>, - backend: Entity<Backend>, - mark: Entity<WeaveMark>, - menu: Option<Menu>, - busy: bool, - approval: Option<ApprovalCard>, - strip: Option<Strip>, - attachments: Vec<Attachment>, - context_used: Option<u64>, - suggestions: Option<Suggestions>, - highlighted: usize, - files: Option<(PathBuf, Vec<String>)>, - _subscriptions: Vec<Subscription>, -} - -impl EventEmitter<ComposerEvent> for Composer {} - impl Composer { - pub fn new(backend: Entity<Backend>, window: &mut Window, cx: &mut Context<Self>) -> Self { - let input = cx.new(|cx| { - TextareaState::new(window, cx) - .placeholder("Describe a task, type / for commands or @ to bring in a file") - .auto_grow(2, 14) - .submit_on_enter(true) - }); - let search = cx.new(|cx| InputState::new(window, cx).placeholder("Find a model")); - let branch_input = cx.new(|cx| InputState::new(window, cx).placeholder("Find or create a branch")); - let weak = cx.entity().downgrade(); - let subscriptions = vec![ - cx.subscribe_in(&input, window, |this, _, event: &InputEvent, window, cx| match event { - InputEvent::PressEnter { shift: false, .. } => this.submit(window, cx), - InputEvent::Change => this.refresh_suggestions(cx), - _ => {} - }), - cx.subscribe(&search, |_, _, event: &InputEvent, cx| { - if let InputEvent::Change = event { - cx.notify(); - } - }), - cx.subscribe(&branch_input, |this, _, event: &InputEvent, cx| match event { - InputEvent::PressEnter { .. } => this.branch_enter(cx), - InputEvent::Change => { - this.deleting = None; - this.branch_error = None; - cx.notify(); - } - _ => {} - }), - cx.observe(&backend, |_, _, cx| cx.notify()), - cx.intercept_keystrokes(move |event, window, cx| { - if let Some(this) = weak.upgrade() { - this.update(cx, |this, cx| this.intercept(event, window, cx)); - } - }), - ]; - Composer { - input, - search, - branch_input, - branches: Branches::default(), - deleting: None, - branch_error: None, - backend, - mark: cx.new(|_| WeaveMark::new(State::Idle)), - menu: None, - busy: false, - approval: None, - strip: None, - attachments: Vec::new(), - context_used: None, - suggestions: None, - highlighted: 0, - files: None, - _subscriptions: subscriptions, - } + pub fn new(history: Vec<String>) -> Composer { + Composer { history, ..Composer::default() } } - pub fn focus(&self, window: &mut Window, cx: &mut Context<Self>) { - self.input.update(cx, |input, cx| input.focus(window, cx)); + pub fn is_empty(&self) -> bool { + self.text.trim().is_empty() && self.attachments.is_empty() } - pub fn set_context( - &mut self, - busy: bool, - approval: Option<ApprovalCard>, - strip: Option<Strip>, - context_used: Option<u64>, - cx: &mut Context<Self>, - ) { - self.busy = busy; - self.context_used = context_used; - self.approval = approval; - if self.strip.as_ref().map(|s| &s.root) != strip.as_ref().map(|s| &s.root) { - self.files = None; - } - self.strip = strip; - if self.approval.is_none() && self.menu == Some(Menu::ApprovalMore) { - self.menu = None; - } - cx.notify(); + pub fn set(&mut self, text: &str) { + self.text = text.to_string(); + self.cursor = self.text.len(); } - fn intercept(&mut self, event: &KeystrokeEvent, window: &mut Window, cx: &mut Context<Self>) { - let key = event.keystroke.key.as_str(); - let modifiers = &event.keystroke.modifiers; - if modifiers.control - && !modifiers.alt - && !modifiers.shift - && let Some(index) = key.parse::<usize>().ok().filter(|n| (1..=9).contains(n)) - { - let pinned = Config::get(cx).pinned_models.clone(); - if let Some(id) = pinned.get(index - 1).cloned() { - self.backend.update(cx, |backend, cx| backend.select(id, cx)); - cx.stop_propagation(); - } - return; - } - if key == "escape" { - if self.menu.is_some() { - self.close(cx); - cx.stop_propagation(); - } else if self.suggestions.is_some() { - self.suggestions = None; - cx.notify(); - cx.stop_propagation(); - } - return; - } - let Some(count) = self.suggestions.as_ref().map(Suggestions::len) else { return }; - if !self.input.read(cx).focus_handle(cx).is_focused(window) || count == 0 { - return; - } - match key { - "up" => self.highlighted = self.highlighted.checked_sub(1).unwrap_or(count - 1), - "down" => self.highlighted = (self.highlighted + 1) % count, - "tab" => self.accept(self.highlighted, window, cx), - "enter" if !modifiers.shift => self.accept(self.highlighted, window, cx), - _ => return, - } - cx.notify(); - cx.stop_propagation(); + pub fn clear(&mut self) { + self.text.clear(); + self.cursor = 0; + self.attachments.clear(); + self.recall = None; } - fn refresh_suggestions(&mut self, cx: &mut Context<Self>) { - let text = self.input.read(cx).value().to_string(); - let next = match mentions::trigger(&text) { - Some(Trigger::Slash(query)) => { - let commands = Command::matching(&query); - (!commands.is_empty()).then_some(Suggestions::Commands(commands)) - } - Some(Trigger::Mention { start, query }) => self.strip.clone().and_then(|strip| { - if self.files.as_ref().is_none_or(|(root, _)| *root != strip.root) { - self.files = Some((strip.root.clone(), mentions::file_index(&strip.root))); - } - let paths = self.files.as_ref().map(|(_, files)| mentions::rank(files, &query, 8)).unwrap_or_default(); - (!paths.is_empty()).then_some(Suggestions::Files { start, paths }) - }), - None => None, - }; - if next != self.suggestions { - self.highlighted = 0; + pub fn take(&mut self) -> Prompt { + let text = self.text.trim().to_string(); + if !text.is_empty() && self.history.last() != Some(&text) { + self.history.push(text.clone()); } - self.suggestions = next; - cx.notify(); - } - - fn accept(&mut self, index: usize, window: &mut Window, cx: &mut Context<Self>) { - let Some(suggestions) = self.suggestions.take() else { return }; - match suggestions { - Suggestions::Commands(commands) => { - let Some(command) = commands.get(index).copied() else { return }; - self.input.update(cx, |input, cx| input.set_value("", window, cx)); - self.run_command(command, window, cx); - } - Suggestions::Files { start, paths } => { - let Some(path) = paths.get(index) else { return }; - let text = self.input.read(cx).value().to_string(); - let next = format!("{}@{path} ", &text[..start.min(text.len())]); - let line = next.matches('\n').count() as u32; - let column = next.rsplit('\n').next().unwrap_or_default().encode_utf16().count() as u32; - self.input.update(cx, |input, cx| { - input.set_value(next, window, cx); - input.set_cursor_position(Position::new(line, column), window, cx); - }); - } - } - cx.notify(); + let attachments = std::mem::take(&mut self.attachments); + self.clear(); + Prompt { text, attachments } } - fn run_command(&mut self, command: Command, window: &mut Window, cx: &mut Context<Self>) { - match command { - Command::Model => self.open(Menu::Model, window, cx), - Command::Mode => self.open(Menu::Access, window, cx), - Command::Reasoning => { - let on = !Config::get(cx).thinking; - self.backend.update(cx, |backend, cx| backend.set_thinking(on, cx)); - } - Command::Init if !self.busy => { - cx.emit(ComposerEvent::Submit(Prompt { text: mentions::INIT_PROMPT.into(), attachments: Vec::new() })); - } - other => cx.emit(ComposerEvent::Command(other)), - } + pub fn insert(&mut self, text: &str) { + self.text.insert_str(self.cursor, text); + self.cursor += text.len(); + self.recall = None; } - fn submit(&mut self, window: &mut Window, cx: &mut Context<Self>) { - if self.busy || self.suggestions.is_some() { - return; - } - let text = self.input.read(cx).value().trim().to_string(); - if text.is_empty() && self.attachments.is_empty() { - return; - } - let text = if text.is_empty() { "Take a look at the attached files.".to_string() } else { text }; - self.input.update(cx, |input, cx| input.set_value("", window, cx)); - let attachments = std::mem::take(&mut self.attachments); - cx.emit(ComposerEvent::Submit(Prompt { text, attachments })); - } - - fn add_files(&mut self, paths: impl IntoIterator<Item = PathBuf>, cx: &mut Context<Self>) { - for attachment in paths.into_iter().filter_map(Attachment::from_path) { + pub fn paste(&mut self, text: &str) { + if let Some(attachment) = pasted_path(text).and_then(Attachment::from_path) { if !self.attachments.iter().any(|a| a.path == attachment.path) { self.attachments.push(attachment); } + return; } - cx.notify(); + self.insert(&text.replace("\r\n", "\n").replace('\r', "\n")); } - fn pick_files(&mut self, cx: &mut Context<Self>) { - let picked = - cx.prompt_for_paths(PathPromptOptions { files: true, directories: false, multiple: true, prompt: Some("Attach".into()) }); - cx.spawn(async move |this, cx| { - if let Ok(Ok(Some(paths))) = picked.await { - _ = this.update(cx, |this, cx| this.add_files(paths, cx)); - } - }) - .detach(); + fn line_start(&self) -> usize { + self.text[..self.cursor].rfind('\n').map_or(0, |i| i + 1) } - fn open(&mut self, menu: Menu, window: &mut Window, cx: &mut Context<Self>) { - self.menu = Some(menu); - if menu == Menu::Branch - && let Some(strip) = &self.strip - { - self.branches = git::branches(&strip.root); - self.deleting = None; - self.branch_error = None; - self.branch_input.update(cx, |input, cx| { - input.set_value("", window, cx); - input.focus(window, cx); - }); - } - if menu == Menu::Model { - self.backend.update(cx, |backend, cx| backend.refresh(cx)); - self.search.update(cx, |search, cx| { - search.set_value("", window, cx); - search.focus(window, cx); - }); - } - cx.notify(); + fn line_end(&self) -> usize { + self.text[self.cursor..].find('\n').map_or(self.text.len(), |i| self.cursor + i) } - fn toggle(&mut self, menu: Menu, window: &mut Window, cx: &mut Context<Self>) { - if self.menu == Some(menu) { - self.close(cx); - } else { - self.open(menu, window, cx); - } + fn previous(&self) -> usize { + self.text[..self.cursor].char_indices().next_back().map_or(0, |(i, _)| i) } - fn close(&mut self, cx: &mut Context<Self>) { - self.menu = None; - cx.notify(); + fn next(&self) -> usize { + self.text[self.cursor..].chars().next().map_or(self.cursor, |c| self.cursor + c.len_utf8()) } - fn model_label(&self, cx: &App) -> (bool, SharedString) { - let backend = self.backend.read(cx); - if let Some(model) = backend.selected(cx) { - return (true, model.id.clone().into()); - } - match (&backend.connection, Backend::selected_id(cx)) { - (Connection::Checking, Some(id)) => (true, id.into()), - (Connection::Online, _) if !backend.models.is_empty() => (false, "Choose a model".into()), - (Connection::Checking, None) => (false, "Connecting".into()), - _ => (false, "No model connected".into()), - } + fn column(&self) -> usize { + self.text[self.line_start()..self.cursor].chars().count() } - fn model_row(&self, model: &Model, shortcut: Option<usize>, cx: &mut Context<Self>) -> Stateful<Div> { - let p = palette(cx); - let id = model.id.clone(); - let pin_id = model.id.clone(); - let selected = Backend::selected_id(cx).as_deref() == Some(model.id.as_str()); - let pinned = Config::get(cx).pinned_models.contains(&model.id); - let mut detail = vec![model.status.label().to_string()]; - if let Some(context) = model.context { - detail.push(format!("{} context", context_label(context))); - } - if model.vision { - detail.push("Vision".into()); - } - div() - .id(SharedString::from(format!("model-{id}"))) - .flex() - .items_center() - .gap(px(10.)) - .px(px(10.)) - .py(px(7.)) - .rounded(px(8.)) - .cursor_pointer() - .when(selected, |row| row.bg(p.row_active)) - .hover(move |style| style.bg(p.row_hover)) - .child( - div().relative().flex_shrink_0().child(model_mark(&model.id, 24., p.text)).child( - div() - .absolute() - .right_0() - .bottom_0() - .size(px(8.)) - .rounded_full() - .border_1() - .border_color(p.menu_bg) - .bg(if model.status == Status::Loaded { p.success } else { p.text_faint.opacity(0.5) }), - ), - ) - .child( - div() - .flex_1() - .min_w_0() - .flex() - .flex_col() - .child(div().text_size(px(13.5)).text_color(p.text).child(model.id.clone())) - .child(div().text_size(px(12.)).text_color(p.text_faint).child(detail.join(" · "))), - ) - .when_some(shortcut, |row, n| { - row.child( - div() - .px(px(5.)) - .rounded(px(5.)) - .border_1() - .border_color(p.border_soft) - .text_size(px(11.)) - .text_color(p.text_faint) - .child(format!("Ctrl+{n}")), - ) - }) - .child( - div() - .id(SharedString::from(format!("pin-{pin_id}"))) - .size(px(24.)) - .flex() - .flex_shrink_0() - .items_center() - .justify_center() - .rounded(px(6.)) - .hover(move |style| style.bg(p.row_active)) - .child(icon(Icon::Pin, 13., if pinned { p.accent } else { p.text_faint.opacity(0.6) })) - .on_click(cx.listener(move |_, _, _, cx| { - cx.stop_propagation(); - let id = pin_id.clone(); - Config::update(cx, |config| { - if config.pinned_models.contains(&id) { - config.pinned_models.retain(|m| *m != id); - } else { - config.pinned_models.push(id); - } - }); - cx.notify(); - })), - ) - .on_click(cx.listener(move |this, _, _, cx| { - let id = id.clone(); - this.backend.update(cx, |backend, cx| backend.select(id, cx)); - this.close(cx); - })) + fn at_column(&self, start: usize, column: usize) -> usize { + let line = &self.text[start..]; + let end = line.find('\n').unwrap_or(line.len()); + line[..end].char_indices().nth(column).map_or(start + end, |(i, _)| start + i) } - fn model_menu(&self, cx: &mut Context<Self>) -> impl IntoElement + use<> { - let p = palette(cx); - let backend = self.backend.read(cx); - let url = Backend::url(cx); - let query = self.search.read(cx).value().trim().to_lowercase(); - let pinned_ids = Config::get(cx).pinned_models.clone(); - let models = backend.models.clone(); - let connection = backend.connection.clone(); - let mut menu = menu_panel(p).w(px(360.)).child( - div() - .flex() - .items_center() - .gap(px(8.)) - .px(px(10.)) - .pt(px(6.)) - .pb(px(6.)) - .child(svg().path(Icon::LlamaCpp.path()).size(px(16.)).text_color(p.text)) - .child(div().flex_1().text_size(px(13.)).font_weight(FontWeight::SEMIBOLD).text_color(p.text).child("llama.cpp")) - .child( - div() - .id("refresh-models") - .flex() - .items_center() - .justify_center() - .size(px(24.)) - .rounded(px(6.)) - .cursor_pointer() - .hover(move |style| style.bg(p.row_hover)) - .child(icon(Icon::Refresh, 13., p.text_faint)) - .on_click(cx.listener(|this, _, _, cx| this.backend.update(cx, |b, cx| b.refresh(cx)))), - ), - ); - menu = menu.child(search_box(&self.search, p)); - match &connection { - Connection::Checking if models.is_empty() => menu = menu.child(note("Looking for models", p)), - Connection::Offline(error) => { - menu = menu - .child(note(format!("Can't reach llama.cpp at {url}"), p)) - .child(div().px(px(10.)).pb(px(6.)).text_size(px(12.)).text_color(p.text_faint).child(error.clone())); - } - _ if models.is_empty() => menu = menu.child(note("This server has no models", p)), - _ => {} - } - let mut body = div().id("model-list").max_h(px(380.)).overflow_y_scroll().flex().flex_col().gap(px(1.)); - if query.is_empty() { - let pinned: Vec<&Model> = pinned_ids.iter().filter_map(|id| models.iter().find(|m| m.id == *id)).collect(); - if !pinned.is_empty() { - body = body.child(menu_label("Pinned", p)); - for (n, model) in pinned.iter().enumerate() { - body = body.child(self.model_row(model, (n < 9).then_some(n + 1), cx)); - } - body = body.child(menu_label("Everything on this server", p)); - } - for model in models.iter().filter(|m| !pinned_ids.contains(&m.id)) { - body = body.child(self.model_row(model, None, cx)); + fn vertical(&mut self, up: bool) -> bool { + let column = self.column(); + let start = self.line_start(); + if up { + if start == 0 { + return false; } + let above = self.text[..start - 1].rfind('\n').map_or(0, |i| i + 1); + self.cursor = self.at_column(above, column); } else { - let found: Vec<&Model> = models.iter().filter(|m| m.id.to_lowercase().contains(&query)).collect(); - if found.is_empty() { - body = body.child(note("No model matches", p)); - } - for model in found { - body = body.child(self.model_row(model, None, cx)); + let end = self.line_end(); + if end == self.text.len() { + return false; } + self.cursor = self.at_column(end + 1, column); } - menu.child(body).child(separator(p)).child( - menu_item("server-settings", Some(Icon::Server), url, None, false, p) - .child(div().text_size(px(12.5)).text_color(p.text_muted).child("Change")) - .on_click(cx.listener(|this, _, _, cx| { - this.close(cx); - cx.emit(ComposerEvent::OpenModelSettings); - })), - ) - } - - fn thinking_menu(&self, cx: &mut Context<Self>) -> impl IntoElement + use<> { - let p = palette(cx); - let on = Config::get(cx).thinking; - menu_panel(p).w(px(240.)).child(menu_label("Reasoning", p)).children( - [ - (true, "Think it through", "Reason before replying, slower but sharper"), - (false, "Reply directly", "Skip the reasoning step"), - ] - .map(|(value, label, detail)| { - menu_item(label, None, label, Some(detail.into()), on == value, p).on_click(cx.listener(move |this, _, _, cx| { - this.backend.update(cx, |b, cx| b.set_thinking(value, cx)); - this.close(cx); - })) - }), - ) + true } - fn access_menu(&self, cx: &mut Context<Self>) -> impl IntoElement + use<> { - let p = palette(cx); - let current = Config::get(cx).access; - menu_panel(p).w(px(360.)).child(menu_label("What the agent may do on its own", p)).children(Access::ALL.map(|access| { - menu_item(access.label(), Some(access_icon(access)), access.label(), Some(access.description().into()), access == current, p) - .on_click(cx.listener(move |this, _, _, cx| { - Config::update(cx, |config| config.access = access); - this.close(cx); - })) - })) - } - - fn branch_query(&self, cx: &App) -> String { - self.branch_input.read(cx).value().trim().to_string() - } - - fn branch_matches(&self, query: &str) -> (Vec<String>, Vec<String>) { - let query = query.to_lowercase(); - let keep = |names: &[String]| names.iter().filter(|name| name.to_lowercase().contains(&query)).cloned().collect(); - (keep(&self.branches.local), keep(&self.branches.remote)) - } - - fn branch_enter(&mut self, cx: &mut Context<Self>) { - let query = self.branch_query(cx); - if query.is_empty() { - return; - } - let (local, remote) = self.branch_matches(&query); - match local.into_iter().chain(remote).next() { - Some(name) => self.change_branch(name, false, cx), - None => self.change_branch(query, true, cx), - } - } - - fn change_branch(&mut self, name: String, create: bool, cx: &mut Context<Self>) { - let Some(root) = self.strip.as_ref().map(|s| s.root.clone()) else { return }; - let result = if self.branches.current.as_deref() == Some(name.as_str()) { - Ok(()) - } else if !create { - git::switch_branch(&root, &name) - } else if git::valid_branch(&name) { - git::create_branch(&root, &name) - } else { - Err(format!("\"{name}\" is not a branch name Git accepts.")) + fn recall_history(&mut self, up: bool) { + let next = match (self.recall, up) { + (None, true) => self.history.len().checked_sub(1), + (Some(index), true) => Some(index.saturating_sub(1)), + (Some(index), false) => Some(index + 1), + (None, false) => return, }; - match result { - Ok(()) => { - self.close(cx); - cx.emit(ComposerEvent::RepoChanged); + match next { + Some(index) if index < self.history.len() => { + if self.recall.is_none() { + self.draft = std::mem::take(&mut self.text); + } + self.recall = Some(index); + self.text = self.history[index].clone(); } - Err(error) => { - self.branch_error = Some(error); - cx.notify(); + Some(_) => { + self.recall = None; + self.text = std::mem::take(&mut self.draft); } + None => return, } - } - - fn remove_branch(&mut self, name: String, cx: &mut Context<Self>) { - let Some(root) = self.strip.as_ref().map(|s| s.root.clone()) else { return }; - match git::delete_branch(&root, &name) { - Ok(()) => { - self.branches = git::branches(&root); - self.deleting = None; - self.branch_error = None; - cx.emit(ComposerEvent::RepoChanged); + self.cursor = self.text.len(); + } + + pub fn key(&mut self, key: KeyEvent) -> bool { + let control = key.modifiers.contains(KeyModifiers::CONTROL); + let alt = key.modifiers.contains(KeyModifiers::ALT); + let altgr = control && alt; + match key.code { + KeyCode::Char(c) if !control || altgr => self.insert(&c.to_string()), + KeyCode::Char('j') if control => self.insert("\n"), + KeyCode::Enter if key.modifiers.intersects(KeyModifiers::SHIFT | KeyModifiers::ALT) => self.insert("\n"), + KeyCode::Backspace if self.cursor == 0 => { + self.attachments.pop(); } - Err(error) => self.branch_error = Some(error), - } - cx.notify(); - } - - fn branch_row(&self, name: &str, remote: bool, cx: &mut Context<Self>) -> Stateful<Div> { - let p = palette(cx); - let current = self.branches.current.as_deref() == Some(name); - let confirming = self.deleting.as_deref() == Some(name); - let unmerged = self.branches.unmerged.iter().any(|b| b == name); - let base = self.branches.current.clone().unwrap_or_else(|| "this branch".into()); - let detail = if confirming && unmerged { - Some(format!("Has commits that are not in {base}. Deleting loses them.")) - } else if confirming { - Some(format!("Everything on it is already in {base}.")) - } else if remote { - Some("Only on origin. Switching sets up a local copy.".to_string()) - } else { - None - }; - let (target, doomed) = (name.to_string(), name.to_string()); - div() - .id(SharedString::from(format!("branch-{name}"))) - .flex() - .items_center() - .gap(px(10.)) - .px(px(10.)) - .py(px(6.)) - .rounded(px(8.)) - .cursor_pointer() - .when(confirming, |row| row.bg(p.danger.opacity(0.08))) - .hover(move |style| style.bg(p.row_hover)) - .child(icon(if remote { Icon::Globe } else { Icon::Branch }, 14., p.text_muted)) - .child( - div() - .flex_1() - .min_w_0() - .flex() - .flex_col() - .child( - div() - .overflow_hidden() - .whitespace_nowrap() - .text_ellipsis() - .font_family(MONO) - .text_size(px(13.)) - .text_color(p.text) - .child(name.to_string()), - ) - .when_some(detail, |col, detail| { - col.child( - div() - .text_size(px(11.5)) - .text_color(if confirming && unmerged { p.danger } else { p.text_faint }) - .child(detail), - ) - }), - ) - .when(current, |row| row.child(icon(Icon::Check, 14., p.text))) - .when(!remote && !current && !confirming, |row| { - row.child( - div() - .id(SharedString::from(format!("delete-branch-{name}"))) - .size(px(24.)) - .flex() - .items_center() - .justify_center() - .rounded(px(6.)) - .hover(move |style| style.bg(p.danger.opacity(0.12))) - .child(icon(Icon::Trash, 13., p.text_faint.opacity(0.7))) - .on_click(cx.listener(move |this, _, _, cx| { - cx.stop_propagation(); - this.deleting = Some(doomed.clone()); - cx.notify(); - })), - ) - }) - .when(confirming, |row| { - let doomed = name.to_string(); - row.child( - div() - .id(SharedString::from(format!("confirm-delete-{name}"))) - .px(px(10.)) - .h(px(26.)) - .flex() - .items_center() - .rounded(px(7.)) - .bg(p.danger) - .text_size(px(12.5)) - .font_weight(FontWeight::SEMIBOLD) - .text_color(gpui_kit::white()) - .hover(|style| style.opacity(0.9)) - .child("Delete") - .on_click(cx.listener(move |this, _, _, cx| { - cx.stop_propagation(); - this.remove_branch(doomed.clone(), cx); - })), - ) - }) - .on_click(cx.listener(move |this, _, _, cx| { - if this.deleting.is_some() { - this.deleting = None; - cx.notify(); - } else { - this.change_branch(target.clone(), false, cx); + KeyCode::Backspace if control || alt => { + let start = word_start(&self.text, self.cursor); + self.text.replace_range(start..self.cursor, ""); + self.cursor = start; + } + KeyCode::Char('w') if control => { + let start = word_start(&self.text, self.cursor); + self.text.replace_range(start..self.cursor, ""); + self.cursor = start; + } + KeyCode::Backspace => { + let start = self.previous(); + self.text.replace_range(start..self.cursor, ""); + self.cursor = start; + } + KeyCode::Delete => { + let end = self.next(); + self.text.replace_range(self.cursor..end, ""); + } + KeyCode::Left if control || alt => self.cursor = word_start(&self.text, self.cursor), + KeyCode::Right if control || alt => self.cursor = word_end(&self.text, self.cursor), + KeyCode::Left => self.cursor = self.previous(), + KeyCode::Right => self.cursor = self.next(), + KeyCode::Home => self.cursor = self.line_start(), + KeyCode::Char('a') if control => self.cursor = self.line_start(), + KeyCode::End => self.cursor = self.line_end(), + KeyCode::Char('e') if control => self.cursor = self.line_end(), + KeyCode::Char('u') if control => { + let start = self.line_start(); + self.text.replace_range(start..self.cursor, ""); + self.cursor = start; + } + KeyCode::Char('k') if control => { + let end = self.line_end(); + self.text.replace_range(self.cursor..end, ""); + } + KeyCode::Up => { + if !self.vertical(true) { + self.recall_history(true); } - })) - } - - fn branch_menu(&self, cx: &mut Context<Self>) -> impl IntoElement + use<> { - let p = palette(cx); - let query = self.branch_query(cx); - let (local, remote) = self.branch_matches(&query); - let exact = local.iter().chain(&remote).any(|name| *name == query); - let local_rows: Vec<Stateful<Div>> = local.iter().map(|name| self.branch_row(name, false, cx)).collect(); - let remote_rows: Vec<Stateful<Div>> = remote.iter().map(|name| self.branch_row(name, true, cx)).collect(); - let nothing = local_rows.is_empty() && remote_rows.is_empty() && query.is_empty(); - menu_panel(p) - .w(px(340.)) - .child(div().pt(px(4.)).child(search_box(&self.branch_input, p))) - .child( - div() - .id("branch-list") - .max_h(px(320.)) - .overflow_y_scroll() - .flex() - .flex_col() - .gap(px(1.)) - .when(!local_rows.is_empty(), |list| list.child(menu_label("Branches", p)).children(local_rows)) - .when(!remote_rows.is_empty(), |list| list.child(menu_label("Only on origin", p)).children(remote_rows)) - .when(nothing, |list| list.child(note("No branches yet. Type a name to create one.", p))), - ) - .when(!query.is_empty() && !exact, |panel| { - let name = query.clone(); - panel.child(separator(p)).child( - menu_item( - "create-branch", - Some(Icon::Plus), - format!("Create {query}"), - Some("A new branch from where you are now".into()), - false, - p, - ) - .on_click(cx.listener(move |this, _, _, cx| this.change_branch(name.clone(), true, cx))), - ) - }) - .when_some(self.branch_error.clone(), |panel, error| { - panel.child( - div() - .mx(px(6.)) - .my(px(4.)) - .px(px(10.)) - .py(px(6.)) - .rounded(px(8.)) - .bg(p.danger.opacity(0.1)) - .text_size(px(12.5)) - .text_color(p.danger) - .child(error), - ) - }) - } - - fn workspace_menu(&self, strip: &Strip, cx: &mut Context<Self>) -> impl IntoElement + use<> { - let p = palette(cx); - let isolated = strip.isolated; - let choosing = strip.can_isolate && !strip.locked; - let projects = Config::get(cx).projects.clone(); - let current = strip.project.clone(); - let locked = strip.locked; - let mut menu = menu_panel(p).w(px(360.)); - if choosing { - menu = menu - .child(menu_label("Where the agent works", p)) - .child( - menu_item( - "work-in-project", - Some(Icon::Folder), - "Project folder", - Some(format!("Edit the files in {} directly", strip.name).into()), - !isolated, - p, - ) - .on_click(cx.listener(|this, _, _, cx| { - cx.emit(ComposerEvent::SetIsolated(false)); - this.close(cx); - })), - ) - .child( - menu_item( - "work-isolated", - Some(Icon::Isolated), - "Isolated copy", - Some("A separate Git worktree, so parallel threads never collide".into()), - isolated, - p, - ) - .on_click(cx.listener(|this, _, _, cx| { - cx.emit(ComposerEvent::SetIsolated(true)); - this.close(cx); - })), - ) - .child(separator(p)); + } + KeyCode::Down => { + if !self.vertical(false) { + self.recall_history(false); + } + } + _ => return false, } - menu.child(menu_label(if locked { "Start a new thread in" } else { "Project" }, p)) - .children(projects.into_iter().enumerate().map(|(index, path)| { - let chosen = !locked && path == current; - menu_item( - ("strip-project", index), - Some(Icon::Folder), - project::name(&path), - Some(path.display().to_string().into()), - chosen, - p, - ) - .on_click(cx.listener(move |this, _, _, cx| { - this.close(cx); - cx.emit(ComposerEvent::SwitchProject(path.clone())); - })) - })) - .child(menu_item("strip-add-project", Some(Icon::FolderPlus), "Add a project", None, false, p).on_click(cx.listener( - |this, _, _, cx| { - this.close(cx); - cx.emit(ComposerEvent::AddProject); - }, - ))) - } - - fn chip(&self, id: &'static str, menu: Menu, cx: &mut Context<Self>) -> Stateful<Div> { - let p = palette(cx); - let open = self.menu == Some(menu); - div() - .id(id) - .flex() - .items_center() - .gap(px(6.)) - .h(px(30.)) - .px(px(8.)) - .min_w_0() - .rounded(px(8.)) - .text_size(px(13.5)) - .text_color(if open { p.text } else { p.text_muted }) - .cursor_pointer() - .when(open, |chip| chip.bg(p.row_active)) - .hover(move |style| style.bg(p.row_hover).text_color(p.text)) - .on_click(cx.listener(move |this, _, window, cx| this.toggle(menu, window, cx))) + true } - fn suggestion_list(&self, suggestions: &Suggestions, cx: &mut Context<Self>) -> impl IntoElement + use<> { - let p = palette(cx); - let highlighted = self.highlighted; - let row = |index: usize, name: Icon, title: String, detail: Option<String>, mono: bool| { - div() - .id(("suggestion", index)) - .flex() - .items_center() - .gap(px(10.)) - .px(px(10.)) - .py(px(6.)) - .rounded(px(8.)) - .cursor_pointer() - .when(index == highlighted, |r| r.bg(p.row_active)) - .hover(move |style| style.bg(p.row_hover)) - .child(icon(name, 15., p.text_muted)) - .child( - div() - .text_size(px(13.5)) - .text_color(p.text) - .flex_shrink_0() - .when(mono, |t| t.font_family(MONO).text_size(px(13.))) - .child(title), - ) - .when_some(detail, |r, detail| { - r.child( - div() - .min_w_0() - .overflow_hidden() - .whitespace_nowrap() - .text_ellipsis() - .text_size(px(12.5)) - .text_color(p.text_faint) - .child(detail), - ) - }) - }; - let (label, rows): (&str, Vec<Stateful<Div>>) = match suggestions { - Suggestions::Commands(commands) => ( - "Commands", - commands - .iter() - .enumerate() - .map(|(i, c)| row(i, Icon::Slash, format!("/{}", c.name()), Some(c.description().into()), false)) - .collect(), - ), - Suggestions::Files { paths, .. } => ( - "Bring a file into the conversation", - paths.iter().enumerate().map(|(i, path)| row(i, crate::thread_view::file_icon(path), path.clone(), None, true)).collect(), - ), - }; - menu_panel(p) - .w_full() - .child( - div() - .flex() - .justify_between() - .child(menu_label(label, p)) - .child(menu_label("↑↓ to move · Enter to pick · Esc to dismiss", p)), - ) - .children( - rows.into_iter().enumerate().map(|(i, r)| r.on_click(cx.listener(move |this, _, window, cx| this.accept(i, window, cx)))), - ) - } - - fn approval_card(&self, card: &ApprovalCard, window: &Window, cx: &mut Context<Self>) -> impl IntoElement + use<> { - let p = palette(cx); - let more_open = self.menu == Some(Menu::ApprovalMore); - let more = more_open.then(|| { - let menu = menu_panel(p) - .w(px(250.)) - .child(menu_item("allow-thread", Some(Icon::Bolt), "Allow everything in this thread", None, false, p).on_click( - cx.listener(|this, _, _, cx| { - this.close(cx); - cx.emit(ComposerEvent::Decide(Decision::AlwaysAllow)); - }), - )) - .child(menu_item("stop-run", Some(Icon::CircleStop), "Stop the agent", None, false, p).on_click(cx.listener( - |this, _, _, cx| { - this.close(cx); - cx.emit(ComposerEvent::Stop); - }, - ))); - popup(window, cx, Anchor::BottomRight, menu, |this, cx| this.close(cx)) - }); - div() - .flex() - .items_center() - .gap(px(12.)) - .px(px(16.)) - .py(px(10.)) - .rounded(px(14.)) - .border_1() - .border_color(p.warning.opacity(0.45)) - .bg(p.warning.opacity(0.08)) - .child(icon(Icon::Shield, 17., p.warning)) - .child( - div() - .flex_1() - .min_w_0() - .flex() - .flex_col() - .gap(px(2.)) - .child(div().text_size(px(12.5)).font_weight(FontWeight::SEMIBOLD).text_color(p.warning).child(card.title)) - .child( - div() - .flex() - .items_center() - .gap(px(8.)) - .child( - div() - .min_w_0() - .overflow_hidden() - .text_ellipsis() - .whitespace_nowrap() - .font_family(MONO) - .text_size(px(13.)) - .text_color(p.text) - .child(card.target.clone()), - ) - .when_some(card.stats, |row, (added, removed)| { - row.child(div().text_size(px(12.)).text_color(p.add).child(format!("+{added}"))) - .child(div().text_size(px(12.)).text_color(p.del).child(format!("-{removed}"))) - }), - ), - ) - .child( - div() - .id("deny") - .h(px(30.)) - .px(px(12.)) - .flex() - .items_center() - .rounded(px(8.)) - .border_1() - .border_color(p.border) - .text_size(px(13.)) - .text_color(p.text) - .cursor_pointer() - .hover(move |style| style.bg(p.row_hover)) - .child("Deny") - .on_click(cx.listener(|_, _, _, cx| cx.emit(ComposerEvent::Decide(Decision::Decline)))), - ) - .child( - div() - .id("allow") - .h(px(30.)) - .px(px(14.)) - .flex() - .items_center() - .rounded(px(8.)) - .bg(p.text) - .text_size(px(13.)) - .font_weight(FontWeight::SEMIBOLD) - .text_color(p.bg) - .cursor_pointer() - .hover(|style| style.opacity(0.9)) - .child("Allow") - .on_click(cx.listener(|_, _, _, cx| cx.emit(ComposerEvent::Decide(Decision::Approve)))), - ) - .child( - div() - .relative() - .child( - div() - .id("approval-more") - .size(px(30.)) - .flex() - .items_center() - .justify_center() - .rounded(px(8.)) - .border_1() - .border_color(p.border) - .cursor_pointer() - .when(more_open, |b| b.bg(p.row_active)) - .hover(move |style| style.bg(p.row_hover)) - .child(icon(Icon::Dots, 15., p.text_muted)) - .on_click(cx.listener(|this, _, window, cx| this.toggle(Menu::ApprovalMore, window, cx))), - ) - .children(more), - ) - } - - fn attachment_chips(&self, cx: &mut Context<Self>) -> impl IntoElement + use<> { - let p = palette(cx); - div().flex().flex_wrap().items_end().gap(px(6.)).px(px(4.)).children(self.attachments.iter().enumerate().map( - |(index, attachment)| { - let remove = div() - .id(("remove-attachment", index)) - .size(px(20.)) - .flex() - .items_center() - .justify_center() - .rounded(px(5.)) - .cursor_pointer() - .hover(move |style| style.bg(p.row_hover)) - .child(icon(Icon::X, 12., p.text_faint)) - .on_click(cx.listener(move |this, _, _, cx| { - if index < this.attachments.len() { - this.attachments.remove(index); - } - cx.notify(); - })); - if attachment.image { - return div() - .relative() - .size(px(64.)) - .rounded(px(10.)) - .overflow_hidden() - .border_1() - .border_color(p.border_soft) - .bg(p.fill) - .child(img(attachment.path.clone()).size_full().rounded(px(9.)).object_fit(ObjectFit::Cover)) - .child(div().absolute().top(px(3.)).right(px(3.)).rounded(px(5.)).bg(p.menu_bg.opacity(0.85)).child(remove)); + pub fn render(&self, width: usize, placeholder: &str) -> (Vec<Line>, (usize, usize)) { + let mut lines = Vec::new(); + if !self.attachments.is_empty() { + let names: Vec<String> = self.attachments.iter().map(|a| format!("+ {}", a.name)).collect(); + lines.push(Line::styled(format!(" {} ", names.join(" ")), dim()).with("backspace removes the last", dim())); + } + if self.text.is_empty() { + let cursor = (lines.len(), 2); + lines.push(Line::styled("› ", accent()).with(placeholder, dim())); + return (lines, cursor); + } + let room = width.saturating_sub(3).max(4); + let mut cursor = (lines.len(), 2); + let mut offset = 0; + for logical in self.text.split('\n') { + let mut rows: Vec<(usize, String)> = Vec::new(); + let mut start = offset; + let mut chunk = String::new(); + let mut used = 0; + for (index, c) in logical.char_indices() { + let w = char_width(c); + if used + w > room && !chunk.is_empty() { + rows.push((start, std::mem::take(&mut chunk))); + start = offset + index; + used = 0; } - div() - .flex() - .items_center() - .gap(px(6.)) - .h(px(28.)) - .pl(px(8.)) - .pr(px(4.)) - .rounded(px(8.)) - .bg(p.fill) - .border_1() - .border_color(p.border_soft) - .text_size(px(12.5)) - .text_color(p.text_muted) - .child(icon(Icon::FileText, 13., p.text_muted)) - .child(div().max_w(px(220.)).overflow_hidden().whitespace_nowrap().text_ellipsis().child(attachment.name.clone())) - .child(remove) - }, - )) - } -} - -fn search_box(input: &Entity<InputState>, p: Palette) -> Div { - div() - .mx(px(4.)) - .mb(px(4.)) - .px(px(8.)) - .h(px(32.)) - .flex() - .items_center() - .rounded(px(8.)) - .bg(p.fill) - .text_size(px(13.)) - .child(Input::new(input).appearance(false).prefix(icon(Icon::Search, 13., p.text_faint))) -} - -fn note(text: impl Into<SharedString>, p: Palette) -> impl IntoElement { - div().px(px(10.)).py(px(8.)).text_size(px(13.)).text_color(p.text_muted).child(text.into()) -} - -pub fn access_icon(access: Access) -> Icon { - match access { - Access::Supervised => Icon::Shield, - Access::AutoEdits => Icon::FilePen, - Access::Full => Icon::Bolt, + chunk.push(c); + used += w; + } + rows.push((start, chunk)); + let count = rows.len(); + for (index, (start, text)) in rows.into_iter().enumerate() { + let end = start + text.len(); + if self.cursor >= start && (self.cursor < end || (self.cursor == end && index + 1 == count)) { + let column = self.text[start..self.cursor].chars().map(char_width).sum::<usize>(); + cursor = (lines.len(), 2 + column); + } + let prefix = if offset == 0 && index == 0 { Line::styled("› ", accent()) } else { Line::plain(" ") }; + lines.push(prefix.with(text, plain())); + } + offset += logical.len() + 1; + } + (lines, cursor) } } -fn divider(p: Palette) -> impl IntoElement { - div().w(px(1.)).h(px(16.)).mx(px(2.)).bg(p.border) -} - -impl Render for Composer { - fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement { - let p = palette(cx); - let empty = self.input.read(cx).value().trim().is_empty() && self.attachments.is_empty(); - let busy = self.busy; - let access = Config::get(cx).access; - let thinking = self.backend.read(cx).thinking(cx) == Thinking::Toggle; - let thinking_on = Config::get(cx).thinking; - let (has_model, label) = self.model_label(cx); - let window_size = self.backend.read(cx).selected(cx).and_then(|m| m.context); - let menu = self.menu.filter(|m| *m != Menu::ApprovalMore); - let model_menu = (menu == Some(Menu::Model)).then(|| { - let content = self.model_menu(cx); - popup(window, cx, Anchor::BottomLeft, content, |this, cx| this.close(cx)) - }); - let thinking_menu = (menu == Some(Menu::Thinking)).then(|| { - let content = self.thinking_menu(cx); - popup(window, cx, Anchor::BottomLeft, content, |this, cx| this.close(cx)) - }); - let access_menu = (menu == Some(Menu::Access)).then(|| { - let content = self.access_menu(cx); - popup(window, cx, Anchor::BottomLeft, content, |this, cx| this.close(cx)) - }); - let workspace_menu = match (&self.strip, menu) { - (Some(strip), Some(Menu::Workspace)) => { - let content = self.workspace_menu(&strip.clone(), cx); - Some(popup(window, cx, Anchor::BottomLeft, content, |this, cx| this.close(cx))) - } - _ => None, - }; - let branch_menu = (self.strip.is_some() && menu == Some(Menu::Branch)).then(|| { - let content = self.branch_menu(cx); - popup(window, cx, Anchor::BottomRight, content, |this, cx| this.close(cx)) - }); - let suggestions = self.suggestions.clone().map(|s| self.suggestion_list(&s, cx)); - let approval = self.approval.clone().map(|card| self.approval_card(&card, window, cx)); - let chips = (!self.attachments.is_empty()).then(|| self.attachment_chips(cx)); - let model_chip = self - .chip("model-chip", Menu::Model, cx) - .when(has_model, |chip| chip.child(div().size(px(16.)).flex_shrink_0().child(self.mark.clone()))) - .when(!has_model, |chip| chip.child(svg().path(Icon::LlamaCpp.path()).size(px(14.)).text_color(p.text_faint))) - .child(div().min_w_0().overflow_hidden().whitespace_nowrap().text_ellipsis().child(label)) - .child(icon(Icon::ChevronDown, 13., p.text_faint)); - let thinking_chip = self - .chip("thinking-chip", Menu::Thinking, cx) - .child(icon(Icon::Bulb, 15., p.text_muted)) - .child(if thinking_on { "Thinking" } else { "Direct" }) - .child(icon(Icon::ChevronDown, 13., p.text_faint)); - let access_chip = self - .chip("access-chip", Menu::Access, cx) - .child(icon(access_icon(access), 15., p.text_muted)) - .child(access.label()) - .child(icon(Icon::ChevronDown, 13., p.text_faint)); - let attach = div() - .id("attach") - .size(px(30.)) - .flex() - .flex_shrink_0() - .items_center() - .justify_center() - .rounded(px(8.)) - .cursor_pointer() - .hover(move |style| style.bg(p.row_hover)) - .child(icon(Icon::Paperclip, 15., p.text_muted)) - .on_click(cx.listener(|this, _, _, cx| this.pick_files(cx))); - let send = div() - .id("send") - .flex() - .flex_shrink_0() - .items_center() - .justify_center() - .size(px(34.)) - .rounded_full() - .map(|send| { - if busy { - send.bg(p.danger).cursor_pointer().child(icon(Icon::Stop, 12., gpui_kit::white())) - } else if empty { - send.bg(p.fill).child(icon(Icon::ArrowUp, 16., p.text_faint)) - } else { - send.bg(p.text).cursor_pointer().hover(|s| s.opacity(0.9)).child(icon(Icon::ArrowUp, 16., p.bg)) - } - }) - .on_click(cx.listener(move |this, _, window, cx| { - if busy { - cx.emit(ComposerEvent::Stop); - } else { - this.submit(window, cx); - } - })); - let strip = self.strip.clone().map(|strip| { - let open = self.menu == Some(Menu::Workspace); - let branch_open = self.menu == Some(Menu::Branch); - let branch_clickable = !busy; - div() - .mx(px(18.)) - .mt(px(-8.)) - .px(px(10.)) - .pt(px(8.)) - .pb(px(4.)) - .rounded_b(px(12.)) - .bg(p.fill) - .flex() - .items_center() - .justify_between() - .text_size(px(12.5)) - .text_color(p.text_faint) - .child( - div() - .relative() - .child( - div() - .id("workspace-mode") - .flex() - .items_center() - .gap(px(6.)) - .h(px(24.)) - .px(px(6.)) - .rounded(px(6.)) - .when(open, |b| b.bg(p.row_active)) - .cursor_pointer() - .hover(move |s| s.bg(p.row_hover).text_color(p.text)) - .child(icon(if strip.isolated { Icon::Isolated } else { Icon::Folder }, 13., p.text_faint)) - .child(format!("{} · {}", if strip.isolated { "Isolated copy" } else { "Project folder" }, strip.name)) - .child(icon(Icon::ChevronDown, 12., p.text_faint)) - .on_click(cx.listener(|this, _, window, cx| this.toggle(Menu::Workspace, window, cx))), - ) - .children(workspace_menu), - ) - .when_some(strip.branch, |row, branch| { - row.child( - div() - .relative() - .child( - div() - .id("branch-chip") - .flex() - .items_center() - .gap(px(5.)) - .h(px(24.)) - .px(px(6.)) - .rounded(px(6.)) - .when(branch_open, |b| b.bg(p.row_active)) - .when(branch_clickable, |b| b.cursor_pointer().hover(move |s| s.bg(p.row_hover).text_color(p.text))) - .child(icon(Icon::Branch, 13., p.text_faint)) - .child(branch) - .when(branch_clickable, |b| b.child(icon(Icon::ChevronDown, 12., p.text_faint))) - .on_click(cx.listener(move |this, _, window, cx| { - if branch_clickable { - this.toggle(Menu::Branch, window, cx); - } - })), - ) - .children(branch_menu), - ) - }) - }); - div() - .w_full() - .max_w(px(760.)) - .flex() - .flex_col() - .gap(px(8.)) - .children(approval) - .children(suggestions) - .child( - div() - .id("composer-box") - .flex() - .flex_col() - .gap(px(6.)) - .pt(px(12.)) - .pb(px(8.)) - .px(px(10.)) - .rounded(px(18.)) - .bg(p.composer_bg) - .border_1() - .border_color(p.composer_ring) - .hover(move |style| style.border_color(p.composer_ring_hover)) - .drag_over::<ExternalPaths>(move |style, _, _, _| style.border_color(p.link).bg(p.link.opacity(0.06))) - .on_drop(cx.listener(|this, paths: &ExternalPaths, _, cx| this.add_files(paths.paths().to_vec(), cx))) - .children(chips) - .child(div().px(px(4.)).text_size(px(14.5)).line_height(px(22.)).child(Textarea::new(&self.input).appearance(false))) - .child( - div() - .flex() - .items_center() - .gap(px(2.)) - .min_w_0() - .child(div().relative().min_w_0().child(model_chip).children(model_menu)) - .when(thinking, |row| { - row.child(divider(p)).child(div().relative().child(thinking_chip).children(thinking_menu)) - }) - .child(divider(p)) - .child(div().relative().child(access_chip).children(access_menu)) - .child(div().flex_1()) - .when(has_model, |row| row.child(context_ring::ring(self.context_used, window_size, p))) - .child(attach) - .child(send), - ), - ) - .children(strip) +#[cfg(test)] +mod tests { + use super::*; + use crossterm::event::KeyModifiers; + + fn press(composer: &mut Composer, code: KeyCode, modifiers: KeyModifiers) { + composer.key(KeyEvent::new(code, modifiers)); + } + + fn typed(text: &str) -> Composer { + let mut composer = Composer::new(Vec::new()); + composer.insert(text); + composer + } + + #[test] + fn editing_moves_by_characters_and_words() { + let mut composer = typed("hello wörld"); + press(&mut composer, KeyCode::Left, KeyModifiers::NONE); + press(&mut composer, KeyCode::Backspace, KeyModifiers::NONE); + assert_eq!(composer.text, "hello wörd"); + press(&mut composer, KeyCode::Left, KeyModifiers::CONTROL); + assert_eq!(&composer.text[composer.cursor..], "wörd"); + press(&mut composer, KeyCode::Char('w'), KeyModifiers::CONTROL); + assert_eq!(composer.text, "wörd"); + press(&mut composer, KeyCode::End, KeyModifiers::NONE); + press(&mut composer, KeyCode::Char('u'), KeyModifiers::CONTROL); + assert_eq!(composer.text, ""); + } + + #[test] + fn new_lines_come_from_modified_enter_and_ctrl_j() { + let mut composer = typed("a"); + press(&mut composer, KeyCode::Enter, KeyModifiers::SHIFT); + press(&mut composer, KeyCode::Char('b'), KeyModifiers::NONE); + press(&mut composer, KeyCode::Char('j'), KeyModifiers::CONTROL); + press(&mut composer, KeyCode::Char('c'), KeyModifiers::NONE); + assert_eq!(composer.text, "a\nb\nc"); + press(&mut composer, KeyCode::Up, KeyModifiers::NONE); + assert_eq!(&composer.text[..composer.cursor], "a\nb"); + assert!(!composer.key(KeyEvent::new(KeyCode::Enter, KeyModifiers::NONE))); + } + + #[test] + fn history_comes_back_with_up_and_down() { + let mut composer = Composer::new(vec!["first".into(), "second".into()]); + composer.insert("draft"); + press(&mut composer, KeyCode::Up, KeyModifiers::NONE); + assert_eq!(composer.text, "second"); + press(&mut composer, KeyCode::Up, KeyModifiers::NONE); + assert_eq!(composer.text, "first"); + press(&mut composer, KeyCode::Down, KeyModifiers::NONE); + press(&mut composer, KeyCode::Down, KeyModifiers::NONE); + assert_eq!(composer.text, "draft"); + let prompt = composer.take(); + assert_eq!(prompt.text, "draft"); + press(&mut composer, KeyCode::Up, KeyModifiers::NONE); + assert_eq!(composer.text, "draft"); + } + + #[test] + fn long_text_wraps_and_the_cursor_follows() { + let composer = typed("abcdefgh\nxy"); + let (lines, cursor) = composer.render(8, ""); + let texts: Vec<String> = lines.iter().map(Line::text).collect(); + assert_eq!(texts, vec!["› abcde", " fgh", " xy"]); + assert_eq!(cursor, (2, 4)); + let mut start = typed("abcdefgh"); + start.cursor = 5; + assert_eq!(start.render(8, "").1, (1, 2)); + assert_eq!(Composer::new(Vec::new()).render(20, "Ask").0[0].text(), "› Ask"); + } + + #[test] + fn pasted_paths_become_attachments() { + let dir = std::env::temp_dir().join(format!("quill-paste-{}", std::process::id())); + std::fs::create_dir_all(&dir).unwrap(); + let file = dir.join("shot.png"); + std::fs::write(&file, [1u8]).unwrap(); + let mut composer = Composer::new(Vec::new()); + composer.paste(&format!("\"{}\"", file.display())); + assert_eq!(composer.attachments.len(), 1); + assert!(composer.text.is_empty()); + composer.paste("line one\r\nline two"); + assert_eq!(composer.text, "line one\nline two"); + composer.cursor = 0; + press(&mut composer, KeyCode::Backspace, KeyModifiers::NONE); + assert!(composer.attachments.is_empty()); + std::fs::remove_dir_all(&dir).unwrap(); } } \ No newline at end of file diff --git a/crates/quill-code/src/config.rs b/crates/quill-code/src/config.rs index 8f74765..b44ad64 100644 --- a/crates/quill-code/src/config.rs +++ b/crates/quill-code/src/config.rs @@ -1,91 +1,46 @@ -use std::fs; -use std::path::PathBuf; +use std::time::SystemTime; -use gpui_kit::{App, Global}; -use quill_agent::Access; -use serde::{Deserialize, Serialize}; +use quill_config::{Settings, settings_path}; -#[derive(Clone, Serialize, Deserialize)] -#[serde(default)] -pub struct Config { - pub server_url: String, - pub model: Option<String>, - pub thinking: bool, - #[serde(alias = "mode")] - pub access: Access, - pub projects: Vec<PathBuf>, - pub pinned_models: Vec<String>, -} - -impl Default for Config { - fn default() -> Self { - Config { - server_url: "http://127.0.0.1:9931".into(), - model: None, - thinking: true, - access: Access::Full, - projects: Vec::new(), - pinned_models: Vec::new(), - } - } -} - -impl Global for Config {} - -pub fn home_dir() -> PathBuf { - std::env::var_os("USERPROFILE").or_else(|| std::env::var_os("HOME")).map(PathBuf::from).unwrap_or_default() -} - -pub fn app_dir() -> PathBuf { - std::env::var_os("APPDATA").map(PathBuf::from).unwrap_or_else(home_dir).join("quill-code") -} - -pub fn projects_dir() -> PathBuf { - home_dir().join(".quill-code").join("projects") -} - -pub fn worktrees_dir() -> PathBuf { - home_dir().join(".quill-code").join("worktrees") -} +pub use quill_config::{app_dir, personal_instructions_path, read_personal_instructions}; -pub fn personal_instructions_path() -> PathBuf { - home_dir().join(".quill-code").join("AGENTS.md") +pub struct Config { + pub settings: Settings, + pub error: Option<String>, + read_at: Option<SystemTime>, } -pub fn read_personal_instructions() -> String { - fs::read_to_string(personal_instructions_path()).unwrap_or_default() -} - -pub fn write_personal_instructions(text: &str) -> std::io::Result<()> { - let path = personal_instructions_path(); - if let Some(dir) = path.parent() { - fs::create_dir_all(dir)?; - } - fs::write(path, text) +fn modified() -> Option<SystemTime> { + std::fs::metadata(settings_path()).and_then(|m| m.modified()).ok() } impl Config { pub fn load() -> Config { - fs::read_to_string(app_dir().join("config.json")).ok().and_then(|text| serde_json::from_str(&text).ok()).unwrap_or_default() + let loaded = quill_config::load(); + Config { settings: loaded.settings, error: loaded.error, read_at: modified() } } - pub fn get(cx: &App) -> &Config { - cx.global::<Config>() + pub fn update(&mut self, edit: impl FnOnce(&mut Settings)) { + self.reload(); + edit(&mut self.settings); + if self.error.is_none() && quill_config::save(&self.settings).is_ok() { + self.read_at = modified(); + } } - pub fn update(cx: &mut App, edit: impl FnOnce(&mut Config)) { - let config = cx.global_mut::<Config>(); - edit(config); - let dir = app_dir(); - if let Ok(text) = serde_json::to_string_pretty(config) { - let _ = fs::create_dir_all(&dir).and_then(|_| fs::write(dir.join("config.json"), text)); + pub fn reload(&mut self) -> bool { + if self.read_at == modified() { + return false; } + *self = Config::load(); + true } - pub fn add_project(cx: &mut App, path: PathBuf) { - Config::update(cx, |config| { - config.projects.retain(|p| p != &path); - config.projects.insert(0, path); - }); + pub fn replace(&mut self, settings: Settings) -> std::io::Result<()> { + self.settings = settings; + quill_config::save(&self.settings)?; + self.error = None; + self.read_at = modified(); + Ok(()) } } \ No newline at end of file diff --git a/crates/quill-code/src/context_ring.rs b/crates/quill-code/src/context_ring.rs deleted file mode 100644 index d12dac1..0000000 --- a/crates/quill-code/src/context_ring.rs +++ /dev/null @@ -1,94 +0,0 @@ -use std::f32::consts::{FRAC_PI_2, TAU}; - -use gpui_kit::component::tooltip::Tooltip; -use gpui_kit::{Bounds, Div, Hsla, ParentElement, PathBuilder, Pixels, Stateful, Styled, Window, canvas, div, point, prelude::*, px}; -use quill_llama::context_label; - -use crate::palette::Palette; - -pub fn label(used: Option<u64>, limit: Option<u64>) -> String { - match (used.filter(|n| *n > 0), limit.filter(|n| *n > 0)) { - (Some(used), Some(limit)) => { - let percent = ((used * 100 + limit / 2) / limit).min(100); - format!("Context: {} of {} tokens used ({percent}%)", context_label(used), context_label(limit)) - } - (Some(used), None) => format!("Context: {} tokens used", context_label(used)), - (None, Some(limit)) => format!("Context: {} tokens, nothing used yet", context_label(limit)), - (None, None) => "Context: nothing used yet".into(), - } -} - -fn share(used: Option<u64>, limit: Option<u64>) -> f32 { - match (used, limit) { - (Some(used), Some(limit)) if limit > 0 => (used as f32 / limit as f32).min(1.), - _ => 0., - } -} - -fn stroke(bounds: Bounds<Pixels>, from: f32, to: f32, color: Hsla, window: &mut Window) { - let center = bounds.center(); - let radius = bounds.size.width.min(bounds.size.height) / 2. - px(1.5); - let at = |turn: f32| { - let angle = turn * TAU - FRAC_PI_2; - point(center.x + radius * angle.cos(), center.y + radius * angle.sin()) - }; - let mut path = PathBuilder::stroke(px(2.)); - path.move_to(at(from)); - path.arc_to(point(radius, radius), px(0.), false, true, at(to)); - if let Ok(path) = path.build() { - window.paint_path(path, color); - } -} - -pub fn ring(used: Option<u64>, limit: Option<u64>, p: Palette) -> Stateful<Div> { - let share = share(used, limit); - let color = if share >= 0.9 { - p.danger - } else if share >= 0.75 { - p.warning - } else { - p.text_muted - }; - let track = p.text_faint.opacity(0.35); - let text = label(used, limit); - div() - .id("context-ring") - .size(px(28.)) - .flex() - .flex_shrink_0() - .items_center() - .justify_center() - .rounded(px(8.)) - .tooltip(move |window, cx| Tooltip::new(text.clone()).build(window, cx)) - .child( - canvas( - |_, _, _| (), - move |bounds, _, window, _| { - stroke(bounds, 0., 0.5, track, window); - stroke(bounds, 0.5, 1., track, window); - if share > 0.5 { - stroke(bounds, 0., 0.5, color, window); - stroke(bounds, 0.5, share, color, window); - } else if share > 0. { - stroke(bounds, 0., share, color, window); - } - }, - ) - .size(px(15.)), - ) -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn labels_say_how_much_is_used() { - assert_eq!(label(Some(13_107), Some(131_072)), "Context: 13K of 128K tokens used (10%)"); - assert_eq!(label(Some(2_500), None), "Context: 2K tokens used"); - assert_eq!(label(None, Some(65_536)), "Context: 64K tokens, nothing used yet"); - assert_eq!(label(Some(0), None), "Context: nothing used yet"); - assert_eq!(share(Some(200), Some(100)), 1.); - assert_eq!(share(Some(50), None), 0.); - } -} \ No newline at end of file diff --git a/crates/quill-code/src/exec.rs b/crates/quill-code/src/exec.rs new file mode 100644 index 0000000..58ab8a5 --- /dev/null +++ b/crates/quill-code/src/exec.rs @@ -0,0 +1,277 @@ +use std::io::{IsTerminal, Read, Write}; +use std::path::PathBuf; +use std::sync::mpsc::{Receiver, channel}; +use std::time::{Duration, Instant}; + +use quill_config::{ModelRef, Reasoning}; +use quill_core::{Access, Decision, Event}; + +use crate::Msg; +use crate::backend::{Backend, Connection}; +use crate::config::Config; +use crate::history::{self, Look}; +use crate::text::{Line, bad, dim, warn}; +use crate::thread::{Item, Turn, TurnState}; +use crate::workspace::{Prompt, Workspace}; + +pub struct Options { + pub prompt: String, + pub root: PathBuf, + pub model: Option<String>, + pub access: Option<Access>, + pub json: bool, + pub resume: bool, + pub isolate: bool, +} + +const NO_ONE: &str = "The user is not available to answer. Decide for yourself and carry on."; + +pub fn read_prompt(words: &[String]) -> Result<String, String> { + let joined = words.join(" "); + if !joined.trim().is_empty() && joined.trim() != "-" { + return Ok(joined); + } + let mut stdin = std::io::stdin(); + if stdin.is_terminal() { + return Err("Give quill exec a task, for example: quill exec \"add a test for the parser\"".into()); + } + let mut text = String::new(); + stdin.read_to_string(&mut text).map_err(|e| format!("Could not read the task from standard input: {e}"))?; + if text.trim().is_empty() { Err("The task on standard input was empty.".into()) } else { Ok(text) } +} + +pub fn parse_model(text: &str, providers: &[quill_config::Provider], selected: Option<&ModelRef>) -> ModelRef { + if let Some((provider, model)) = text.split_once('/') + && providers.iter().any(|p| p.id == provider) + { + return ModelRef::new(provider, model); + } + let provider = selected.map(|selected| selected.provider.as_str()).or(providers.first().map(|p| p.id.as_str())).unwrap_or_default(); + ModelRef::new(provider, text) +} + +pub fn wait_for(provider: &str, backend: &mut Backend, rx: &Receiver<Msg>, settings: &quill_config::Settings) { + let deadline = Instant::now() + Duration::from_secs(60); + while backend.checking(provider) && Instant::now() < deadline { + match rx.recv_timeout(Duration::from_millis(200)) { + Ok(Msg::Probed { generation, id, found }) => backend.probed(generation, &id, found, settings), + Ok(Msg::Props { model, props }) => backend.got_props(model, props), + _ => {} + } + } +} + +struct Printer { + item: usize, + printed: usize, + color: bool, + width: usize, + open_line: bool, +} + +impl Printer { + fn err(&self, line: &Line) { + let text = if self.color { line.ansi() } else { line.text() }; + eprintln!("{text}"); + } + + fn text(&mut self, text: &str) { + let mut out = std::io::stdout(); + let _ = out.write_all(text.as_bytes()); + let _ = out.flush(); + self.open_line = !text.ends_with('\n'); + } + + fn close_text(&mut self) { + if self.open_line { + self.text("\n"); + } + } + + fn look(&self) -> Look { + Look { width: self.width, reasoning: Reasoning::Hidden, group: false } + } + + fn advance(&mut self, turn: &Turn) { + let working = turn.working(); + while self.item < turn.items.len() { + let last = self.item + 1 == turn.items.len(); + match &turn.items[self.item] { + Item::Text(text) => { + if text.len() > self.printed { + self.text(&text[self.printed..]); + self.printed = text.len(); + } + if last && working { + return; + } + self.close_text(); + } + Item::Reasoning(_) if last && working => return, + Item::Reasoning(_) => {} + Item::Tool(tool) => { + if tool.working() { + return; + } + if !matches!(tool.category, quill_core::Category::Plan | quill_core::Category::Question) { + self.close_text(); + let mut lines = history::tool_rows(tool, self.look(), "•"); + lines.extend(history::tool_body(tool, self.look())); + for line in &lines { + self.err(line); + } + } + } + Item::Plan { steps, explanation } => { + self.close_text(); + for line in history::plan_lines(steps, explanation.as_deref(), self.look()) { + self.err(&line); + } + } + Item::Question { question, answer, .. } => { + if answer.is_none() && working { + return; + } + self.close_text(); + self.err(&Line::styled(format!("? {question}"), warn())); + self.err(&Line::styled(format!(" › {}", answer.as_deref().unwrap_or("not answered")), dim())); + } + Item::Steer(_) => {} + Item::Note(text) => self.err(&Line::styled(format!("· {text}"), dim())), + } + self.item += 1; + self.printed = 0; + } + } +} + +fn width() -> usize { + crossterm::terminal::size().map(|(columns, _)| columns as usize).unwrap_or(100).clamp(40, 160) - 1 +} + +pub fn run(options: Options) -> u8 { + let mut config = Config::load(); + if let Some(error) = &config.error { + eprintln!("{error}. Using the defaults for this run."); + } + let (tx, rx) = channel(); + let mut backend = Backend::new(tx.clone()); + let mut workspace = Workspace::new(tx.clone()); + workspace.access = options.access; + if let Some(text) = &options.model { + let model = parse_model(text, &config.settings.models.providers, config.settings.models.selected.as_ref()); + config.settings.models.selected = Some(model); + } + let Some(model) = config.settings.models.selected.clone() else { + eprintln!( + "No model is selected yet. Run quill and pick one with /model, or pass --model provider/model (quill models lists them)." + ); + return 2; + }; + let settings = config.settings.clone(); + if options.resume { + match workspace.threads_in(&options.root).first().map(|thread| thread.id) { + Some(id) => workspace.open(id), + None => eprintln!("No earlier thread in this folder, starting a new one."), + } + } + backend.refresh(&settings); + wait_for(&model.provider, &mut backend, &rx, &settings); + if let Some(source) = backend.source(&model.provider).filter(|source| source.connection != Connection::Online) { + eprintln!("{}: {}", source.config.name, source.status()); + return 1; + } + let interrupt = tx.clone(); + let _ = ctrlc::set_handler(move || { + let _ = interrupt.send(Msg::Interrupt); + }); + let prompt = Prompt { text: options.prompt, attachments: Vec::new() }; + let Some(index) = workspace.send(prompt, &options.root, options.isolate, &mut backend, &settings) else { return 1 }; + let Some(id) = workspace.active else { return 1 }; + let mut printer = Printer { item: 0, printed: 0, color: std::io::stderr().is_terminal(), width: width(), open_line: false }; + let mut stopping: Option<Instant> = None; + loop { + let turn_done = workspace.active_thread().and_then(|thread| thread.turns.get(index)).is_some_and(|turn| !turn.working()); + if turn_done && stopping.is_none() { + break; + } + let message = match rx.recv_timeout(Duration::from_millis(250)) { + Ok(message) => message, + Err(_) if stopping.is_some_and(|at| at.elapsed() > Duration::from_secs(5)) => break, + Err(_) => continue, + }; + match message { + Msg::Session(session, event) => { + if options.json + && let Ok(line) = serde_json::to_string(&event) + { + println!("{line}"); + } + if stopping.is_some() && matches!(event, Event::TurnFinished { .. }) { + break; + } + let approval = matches!(event, Event::ApprovalRequested { .. }); + let question = matches!(event, Event::QuestionAsked { .. }); + workspace.apply(session, event); + if approval && let Some(pending) = workspace.pending() { + let line = Line::styled(format!("! Declined: {} {}", pending.approval.title, pending.approval.subject), bad()); + if !options.json { + printer.err(&line); + printer.err(&Line::styled(" quill exec cannot ask you. Pass --access auto to allow it.", dim())); + } + workspace.decide(Decision::Decline); + } + if question { + let count = workspace.asked().map_or(0, |asked| asked.questions.len()); + workspace.answer(vec![NO_ONE.into(); count]); + } + } + Msg::Interrupt => { + if stopping.is_some() { + break; + } + workspace.stop(); + stopping = Some(Instant::now()); + } + Msg::Probed { generation, id, found } => backend.probed(generation, &id, found, &settings), + Msg::Props { model, props } => backend.got_props(model, props), + _ => {} + } + if !options.json + && let Some(turn) = workspace.threads.iter().find(|thread| thread.id == id).and_then(|thread| thread.turns.get(index)) + { + printer.advance(turn); + } + } + let Some(turn) = workspace.threads.iter().find(|thread| thread.id == id).and_then(|thread| thread.turns.get(index)) else { return 1 }; + if !options.json { + printer.advance(turn); + printer.close_text(); + let look = Look { width: printer.width, reasoning: Reasoning::Hidden, group: false }; + for line in history::ending_lines(turn, look) { + printer.err(&line); + } + } + let code = match turn.state { + TurnState::Done | TurnState::Working => 0, + TurnState::Stopped => 130, + TurnState::Failed(_) => 1, + }; + workspace.shutdown(); + code +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn models_name_their_provider() { + let kind = quill_config::ServerKind::Ollama; + let providers = vec![quill_config::Provider::new("ollama", kind, &kind.default_url())]; + let selected = ModelRef::new("ollama-2", "gemma"); + assert_eq!(parse_model("ollama/qwen3:8b", &providers, None), ModelRef::new("ollama", "qwen3:8b")); + assert_eq!(parse_model("qwen", &providers, Some(&selected)), ModelRef::new("ollama-2", "qwen")); + assert_eq!(parse_model("org/model", &providers, None), ModelRef::new("ollama", "org/model")); + } +} \ No newline at end of file diff --git a/crates/quill-code/src/history.rs b/crates/quill-code/src/history.rs new file mode 100644 index 0000000..3ff0d5f --- /dev/null +++ b/crates/quill-code/src/history.rs @@ -0,0 +1,1037 @@ +use crossterm::style::{Color, Stylize}; +use quill_config::Reasoning; +use quill_core::{Category, FileDiff, LineKind, PlanStep, StepStatus}; + +use crate::markdown; +use crate::text::{Line, accent, bad, bold, clean, dim, fill, good, indent, plain, shade, truncate, warn, wrap}; +use crate::thread::{Item, ToolItem, ToolStatus, Turn, TurnState, now_ms}; +use crate::usage::count; + +const DIFF_LINES: usize = 12; +const OUTPUT_LINES: usize = 3; +const FAILED_LINES: usize = 8; +const LIVE_OUTPUT: usize = 5; +const LIVE_TEXT: usize = 14; +const LIVE_TOOLS: usize = 4; +const HOLD_MS: u64 = 3000; + +#[derive(Clone, Copy, Debug)] +pub struct Look { + pub width: usize, + pub reasoning: Reasoning, + pub group: bool, +} + +impl Look { + fn inner(&self, used: usize) -> usize { + self.width.saturating_sub(used).max(10) + } +} + +fn block(out: &mut Vec<Line>, lines: Vec<Line>) { + if !lines.is_empty() { + out.push(Line::default()); + out.extend(lines); + } +} + +fn hidden_tool(tool: &ToolItem) -> bool { + matches!(tool.category, Category::Plan | Category::Question) +} + +fn blank(text: &str) -> bool { + text.trim().is_empty() +} + +pub fn plan(turn: &Turn) -> Option<(&[PlanStep], Option<&str>)> { + turn.items.iter().rev().find_map(|item| match item { + Item::Plan { steps, explanation } => Some((steps.as_slice(), explanation.as_deref())), + _ => None, + }) +} + +fn explored(tools: &[&ToolItem], working: bool) -> Line { + let mut kinds: Vec<(&str, usize)> = Vec::new(); + for tool in tools { + let kind = match tool.tool.as_str() { + "read_file" => "read", + "grep" | "find_files" => "search", + "list_dir" => "list", + _ if tool.category == Category::Command => "run", + _ => "lookup", + }; + match kinds.iter_mut().find(|(name, _)| *name == kind) { + Some((_, count)) => *count += 1, + None => kinds.push((kind, 1)), + } + } + let mut line = Line::default(); + for (index, (kind, count)) in kinds.iter().enumerate() { + let (done, active, word) = match *kind { + "read" => ("read", "reading", "file"), + "search" => ("searched for", "searching for", "pattern"), + "list" => ("listed", "listing", "folder"), + "run" => ("ran", "running", "shell command"), + _ => ("looked up", "looking up", "lookup"), + }; + let mut verb = if working { active } else { done }.to_string(); + if index == 0 { + verb[..1].make_ascii_uppercase(); + } else { + verb.insert_str(0, ", "); + } + counted(&mut line, &verb, *count, word); + } + line +} + +fn counted(line: &mut Line, lead: &str, count: usize, word: &str) { + line.push(format!("{lead} "), dim()); + line.push(count.to_string(), bold()); + line.push(if count == 1 { format!(" {word}") } else { format!(" {word}s") }, dim()); +} + +fn seconds_label(seconds: f32) -> String { + if seconds < 10.0 { format!("{seconds:.1}s") } else { duration(seconds.round() as u64) } +} + +pub fn duration(seconds: u64) -> String { + match seconds { + 0..60 => format!("{seconds}s"), + 60..3600 => format!("{}m {}s", seconds / 60, seconds % 60), + _ => format!("{}h {}m", seconds / 3600, seconds % 3600 / 60), + } +} + +fn command_body(output: &str) -> &str { + match output.split_once('\n') { + Some((first, rest)) if first.starts_with("Exit code") || first.starts_with("Stopped") => rest, + None if output.starts_with("Exit code") => "", + _ => output, + } +} + +fn telling(output: &str) -> String { + let lines: Vec<&str> = output + .lines() + .filter(|line| { + let line = line.trim(); + let position = line.starts_with("At line:") || line.starts_with("+ ...") || line.trim_start_matches(['+', ' ', '~']).is_empty(); + let record = line.starts_with("+ CategoryInfo") || line.starts_with("+ FullyQualifiedErrorId"); + !line.is_empty() && !line.starts_with("at ") && !position && !record + }) + .collect(); + lines.join("\n") +} + +fn target(tool: &ToolItem) -> String { + match tool.target.trim() { + "" => tool.tool.replace('_', " "), + "." | "./" => "the project".into(), + text => clean(text).split_whitespace().collect::<Vec<_>>().join(" "), + } +} + +fn tool_name(tool: &ToolItem) -> String { + match tool.tool.as_str() { + "read_file" => "Read".into(), + "grep" => "Search".into(), + "find_files" => "Find".into(), + "list_dir" => "List".into(), + "write_file" => "Write".into(), + "edit_file" | "apply_patch" => "Update".into(), + "shell" => "Shell".into(), + "commit_changes" => "Commit".into(), + "open_pull_request" => "Pull request".into(), + other => { + let mut name = other.replace('_', " "); + if let Some(first) = name.get_mut(..1) { + first.make_ascii_uppercase(); + } + name + } + } +} + +fn bubble(text: &str, look: Look) -> Vec<Line> { + let lines = wrap(&Line::styled(clean(text.trim()), shade(plain())), look.inner(4)); + let lines = indent(lines, Line::styled(" › ", shade(accent())), Line::styled(" ", shade(plain()))); + lines.into_iter().map(|line| fill(line, look.width, shade(plain()))).collect() +} + +fn answer(lines: Vec<Line>, first: bool) -> Vec<Line> { + let mark = if first { Line::plain("● ") } else { Line::plain(" ") }; + indent(lines, mark, Line::plain(" ")) +} + +pub fn prompt_lines(turn: &Turn, look: Look) -> Vec<Line> { + let mut lines = bubble(&turn.prompt, look); + let images = turn.images.iter().map(|path| path.file_name().map(|name| name.to_string_lossy().into_owned()).unwrap_or_default()); + let names: Vec<String> = if turn.attachments.is_empty() { images.collect() } else { turn.attachments.clone() }; + for name in names { + lines.push(fill(Line::styled(format!(" + {name}"), shade(dim())), look.width, shade(plain()))); + } + lines +} + +pub fn tool_rows(tool: &ToolItem, look: Look, spinner: &str) -> Vec<Line> { + let mark = match tool.status { + ToolStatus::Running => Line::styled(format!("{spinner} "), accent()), + ToolStatus::Waiting => Line::styled("! ", warn()), + ToolStatus::Failed => Line::styled("● ", bad()), + ToolStatus::Done if tool.exit_code().is_some_and(|code| code != 0) => Line::styled("● ", bad()), + ToolStatus::Done => Line::styled("● ", good()), + }; + let mut name = Line::styled(tool_name(tool), bold()); + name.push(format!("({})", target(tool)), plain()); + let mut tail = Line::default(); + if tool.category == Category::Command + && let Some(code) = tool.exit_code().filter(|code| *code != 0) + { + tail.push(format!(" · exit {code}"), bad()); + } + match tool.status { + ToolStatus::Running => { + let seconds = now_ms().saturating_sub(tool.started) / 1000; + if seconds > 0 { + tail.push(format!(" · {}", duration(seconds)), dim()); + } + } + ToolStatus::Waiting => tail.push(" · needs your OK", warn()), + _ => { + if let Some(seconds) = tool.seconds().filter(|seconds| *seconds >= 1.0) { + tail.push(format!(" · {}", seconds_label(seconds)), dim()); + } + } + } + let mut lines = indent(wrap(&name, look.inner(2)), mark, Line::plain(" ")); + if let Some(last) = lines.last_mut() { + last.append(tail); + } + lines.into_iter().map(|line| truncate(&line, look.width)).collect() +} + +fn connect(lines: Vec<Line>, look: Look) -> Vec<Line> { + lines + .into_iter() + .enumerate() + .map(|(index, line)| { + let mut row = if index == 0 { Line::styled(" └ ", dim()) } else { Line::plain(" ") }; + row.append(line); + truncate(&row, look.width) + }) + .collect() +} + +fn output_lines(text: &str, limit: usize, from_end: bool, style: crossterm::style::ContentStyle) -> Vec<Line> { + let all: Vec<&str> = text.trim_end().lines().collect(); + if all.iter().all(|line| blank(line)) { + return Vec::new(); + } + let hidden = all.len().saturating_sub(limit); + let mut lines = Vec::new(); + if from_end && hidden > 0 { + lines.push(Line::styled(format!("… {hidden} earlier lines"), dim())); + } + let shown = if from_end { &all[hidden..] } else { &all[..all.len().min(limit)] }; + lines.extend(shown.iter().map(|line| Line::styled(*line, style))); + if !from_end && hidden > 0 { + lines.push(Line::styled(format!("… {hidden} more lines"), dim())); + } + lines +} + +fn plural(count: usize, word: &str) -> String { + if count == 1 { format!("{count} {word}") } else { format!("{count} {word}s") } +} + +fn changed(diffs: &[FileDiff]) -> Line { + let added: usize = diffs.iter().map(|diff| diff.added).sum(); + let removed: usize = diffs.iter().map(|diff| diff.removed).sum(); + let mut line = Line::default(); + if let [diff] = diffs + && diff.created + { + counted(&mut line, "Wrote", added, "line"); + line.push(format!(" to {}", diff.path), dim()); + return line; + } + if added > 0 { + counted(&mut line, "Added", added, "line"); + } + if removed > 0 { + counted(&mut line, if added > 0 { ", removed" } else { "Removed" }, removed, "line"); + } + if line.width() == 0 { + line.push("No lines changed", dim()); + } + if diffs.len() > 1 { + line.push(format!(" in {} files", diffs.len()), dim()); + } + line +} + +pub fn diff_lines(diff: &FileDiff, limit: usize, look: Look) -> Vec<Line> { + let mut lines = Vec::new(); + let room = look.width.saturating_sub(5); + for line in diff.lines.iter().take(limit) { + let (number, sign, style) = match line.kind { + LineKind::Added => (line.new, "+", Some(Color::AnsiValue(22))), + LineKind::Removed => (line.old, "-", Some(Color::AnsiValue(52))), + LineKind::Context => (line.new, " ", None), + LineKind::Gap => { + lines.push(Line::styled(" ⋯", dim())); + continue; + } + LineKind::Note => { + lines.push(Line::styled(format!(" {}", line.text), dim())); + continue; + } + }; + let number = number.map(|n| n.to_string()).unwrap_or_default(); + let row = match style { + Some(color) => { + let shaded = plain().with(Color::White).on(color); + let row = Line::styled(format!("{number:>4} "), shaded.dim()).with(format!("{sign} {}", clean(&line.text)), shaded); + fill(truncate(&row, room), room, shaded) + } + None => truncate(&Line::styled(format!("{number:>4} "), dim()).with(format!(" {}", clean(&line.text)), dim()), room), + }; + lines.push(Line::plain(" ").with_line(row)); + } + if diff.lines.len() > limit { + lines.push(Line::styled(format!(" … {} more lines, /diff shows them all", diff.lines.len() - limit), dim())); + } + lines +} + +fn explored_output(tool: &ToolItem, output: &str) -> String { + let lines: Vec<&str> = output.trim_end().lines().collect(); + let more = lines.last().and_then(|line| line.strip_prefix("... and ")?.split(' ').next()?.parse::<usize>().ok()); + let found = lines.iter().filter(|line| **line != "--").count() - usize::from(more.is_some()) + more.unwrap_or(0); + match tool.tool.as_str() { + "read_file" => format!( + "Read {}", + plural(lines.iter().filter(|line| line.trim_start().starts_with(|c: char| c.is_ascii_digit())).count(), "line") + ), + "find_files" if output.starts_with("No files match") => "No files found".into(), + "find_files" => format!("Found {}", plural(found, "file")), + _ if output.starts_with("No matches") => "No matches".into(), + _ => format!("Found {}", plural(found, "line")), + } +} + +pub fn tool_body(tool: &ToolItem, look: Look) -> Vec<Line> { + if !tool.diffs.is_empty() { + let mut lines = connect(vec![changed(&tool.diffs)], look); + for diff in &tool.diffs { + if tool.diffs.len() > 1 { + lines.push(Line::styled(format!(" {}", diff.path), dim())); + } + lines.extend(diff_lines(diff, DIFF_LINES, look)); + } + return lines; + } + let output = clean(&tool.output); + let failed = tool.status == ToolStatus::Failed; + match tool.category { + Category::Command => { + let failed = failed || tool.exit_code().is_some_and(|code| code != 0); + let body = command_body(&output); + let lines = if failed { + output_lines(&telling(body), FAILED_LINES, true, plain()) + } else { + output_lines(body, OUTPUT_LINES, true, dim()) + }; + connect(lines, look) + } + _ if failed => connect(output_lines(&output, 3, false, bad()), look), + Category::Explore => connect(vec![Line::styled(explored_output(tool, &output), dim())], look), + Category::Edit => Vec::new(), + _ => connect(output_lines(&output, 2, false, dim()), look), + } +} + +pub fn running_command(tool: &ToolItem, look: Look) -> Vec<Line> { + let output = clean(&tool.output); + let mut lines = output_lines(command_body(&output), LIVE_OUTPUT, true, dim()); + if lines.is_empty() { + lines.push(Line::styled("Running…", dim())); + } + connect(lines, look) +} + +fn grouped(tool: &ToolItem) -> bool { + match tool.category { + Category::Explore => tool.status != ToolStatus::Failed, + Category::Command => tool.status != ToolStatus::Failed && tool.exit_code().is_none_or(|code| code == 0), + _ => false, + } +} + +fn group_span(items: &[Item], start: usize, look: Look) -> (usize, usize) { + let mut end = start; + for (index, item) in items.iter().enumerate().skip(start) { + match item { + Item::Tool(tool) if hidden_tool(tool) => {} + Item::Tool(tool) if grouped(tool) => end = index + 1, + Item::Reasoning(_) if look.reasoning == Reasoning::Hidden => {} + Item::Text(text) | Item::Reasoning(text) if blank(text) => {} + _ => return (end, index), + } + } + (end, items.len()) +} + +fn group_tools(items: &[Item]) -> Vec<&ToolItem> { + items + .iter() + .filter_map(|item| match item { + Item::Tool(tool) if grouped(tool) => Some(tool), + _ => None, + }) + .collect() +} + +fn held(tools: &[&ToolItem]) -> bool { + tools.iter().filter_map(|tool| tool.ended).max().is_some_and(|ended| now_ms() < ended + HOLD_MS) +} + +fn group_head(tools: &[&ToolItem], look: Look, spinner: &str) -> Line { + let working = tools.iter().any(|tool| tool.working()); + let mut head = if working { Line::styled(format!("{spinner} "), accent()) } else { Line::plain(" ") }; + head.append(explored(tools, working)); + truncate(&head, look.width) +} + +pub fn group_rows(tools: &[&ToolItem], look: Look, spinner: &str) -> Vec<Line> { + let mut lines = vec![group_head(tools, look, spinner)]; + for tool in &tools[tools.len().saturating_sub(LIVE_TOOLS)..] { + lines.extend(tool_rows(tool, look, spinner)); + if tool.status == ToolStatus::Running && tool.category == Category::Command { + lines.extend(running_command(tool, look)); + } + } + lines +} + +fn unmarked(line: &str) -> String { + let line = line.replace(['*', '`', '#'], ""); + let line = line.trim().trim_start_matches(['-', '•']).trim_start(); + let digits = line.chars().take_while(char::is_ascii_digit).count(); + let line = match line[digits..].strip_prefix(['.', ')']) { + Some(rest) if digits > 0 => rest, + _ => line, + }; + line.split_whitespace().collect::<Vec<_>>().join(" ") +} + +fn sentences(text: &str) -> (Vec<String>, String) { + let text = clean(text); + let mut done = Vec::new(); + let mut rest = String::new(); + let lines: Vec<&str> = text.split('\n').collect(); + for (index, line) in lines.iter().enumerate() { + let line = unmarked(line); + let mut start = 0; + for (at, c) in line.char_indices() { + if matches!(c, '.' | '!' | '?' | ':') && line[at + 1..].starts_with(' ') { + done.push(line[start..=at].trim().to_string()); + start = at + 1; + } + } + let tail = line[start..].trim().to_string(); + if index + 1 < lines.len() { + done.extend(Some(tail).filter(|tail| !tail.is_empty())); + } else { + rest = tail; + } + } + (done, rest) +} + +pub fn summary(text: &str) -> Option<String> { + sentences(text).0.pop() +} + +fn last_sentence(text: &str) -> String { + let (mut done, rest) = sentences(text); + if !rest.is_empty() { + done.push(rest); + } + done.pop().unwrap_or_default() +} + +fn reasoning_lines(text: &str, look: Look) -> Vec<Line> { + let text = clean(text.trim()); + if blank(&text) { + return Vec::new(); + } + match look.reasoning { + Reasoning::Hidden => Vec::new(), + Reasoning::Collapsed => { + vec![truncate(&Line::styled("◇ Thought ", dim()).with(last_sentence(&text), dim().italic()), look.width)] + } + Reasoning::Expanded => { + let mut lines = vec![Line::styled("◇ Thought", dim())]; + lines.extend(indent(wrap(&Line::styled(text, dim().italic()), look.inner(2)), Line::plain(" "), Line::plain(" "))); + lines + } + } +} + +fn thinking_lines(text: &str, look: Look, thought: Option<&str>) -> Vec<Line> { + let mut lines = Vec::new(); + match look.reasoning { + Reasoning::Hidden => {} + Reasoning::Collapsed => { + lines.push(Line::styled("◇ Thinking", dim())); + if let Some(thought) = thought { + let wrapped = wrap(&Line::styled(thought, dim().italic()), look.inner(2)); + lines.extend(indent(wrapped.into_iter().take(2).collect(), Line::plain(" "), Line::plain(" "))); + } + } + Reasoning::Expanded => { + let text = clean(text.trim()); + let tail: Vec<&str> = text.lines().filter(|line| !blank(line)).collect(); + lines.push(Line::styled("◇ Thinking", dim())); + for line in &tail[tail.len().saturating_sub(6)..] { + lines.push(truncate(&Line::styled(format!(" {}", line.trim()), dim().italic()), look.width)); + } + } + } + lines +} + +pub fn plan_lines(steps: &[PlanStep], explanation: Option<&str>, look: Look) -> Vec<Line> { + let done = steps.iter().filter(|step| step.status == StepStatus::Done).count(); + let mut lines = vec![Line::styled("Plan", bold()).with(format!(" · {done} of {} done", steps.len()), dim())]; + for step in steps { + let (mark, mark_style, style) = match step.status { + StepStatus::Done => ("✓ ", good(), dim()), + StepStatus::Active => ("› ", accent(), bold()), + StepStatus::Pending => ("○ ", dim(), plain()), + }; + let text = wrap(&Line::styled(clean(&step.text), style), look.inner(4)); + lines.extend(indent(text, Line::plain(" ").with(mark, mark_style), Line::plain(" "))); + } + if let Some(explanation) = explanation.filter(|text| !blank(text)) { + lines.extend(indent(wrap(&Line::styled(clean(explanation), dim()), look.inner(2)), Line::plain(" "), Line::plain(" "))); + } + lines +} + +fn question_lines(question: &str, answer: Option<&str>, look: Look) -> Vec<Line> { + let mut lines = indent(wrap(&Line::styled(clean(question), bold()), look.inner(2)), Line::styled("? ", accent()), Line::plain(" ")); + match answer { + Some(answer) => lines.extend(bubble(answer, look)), + None => lines.push(Line::styled(" Not answered", dim())), + } + lines +} + +fn steer_lines(text: &str, look: Look) -> Vec<Line> { + let mut lines = bubble(text, look); + lines.push(Line::styled(" added while working", dim())); + lines +} + +fn note_lines(text: &str, look: Look) -> Vec<Line> { + indent(wrap(&Line::styled(clean(text), dim()), look.inner(2)), Line::styled("· ", dim()), Line::plain(" ")) +} + +fn footer(turn: &Turn) -> Line { + let millis = turn.worked_ms.unwrap_or_else(|| now_ms().saturating_sub(turn.started)); + let mut parts = vec![format!("Worked for {}", seconds_label(millis as f32 / 1000.0))]; + parts.extend(turn.model.clone()); + parts.extend(generated(turn)); + Line::styled(format!(" {}", parts.join(" · ")), dim()) +} + +pub fn generated(turn: &Turn) -> Option<String> { + (turn.usage.completion > 0).then(|| format!("↓ {} tokens", count(turn.usage.completion))) +} + +pub fn ending_lines(turn: &Turn, look: Look) -> Vec<Line> { + let mut lines = Vec::new(); + match &turn.state { + TurnState::Stopped => lines.push(Line::styled("■ You stopped this reply", dim())), + TurnState::Failed(error) => { + lines.extend(indent(wrap(&Line::styled(clean(error), bad()), look.inner(2)), Line::styled("✗ ", bad()), Line::plain(" "))) + } + _ => {} + } + let changes = turn.changes(); + if !changes.is_empty() { + let added: usize = changes.iter().map(|change| change.added).sum(); + let removed: usize = changes.iter().map(|change| change.removed).sum(); + let files = if changes.len() == 1 { "file" } else { "files" }; + lines.push( + Line::styled(format!("{} {files} changed", changes.len()), bold()) + .with(format!(" +{added}"), good()) + .with(format!(" -{removed}"), bad()), + ); + for change in &changes { + let mut line = Line::plain(format!(" {}", change.path)) + .with(format!(" +{}", change.added), good()) + .with(format!(" -{}", change.removed), bad()); + if change.created { + line.push(" new", dim()); + } + if change.deleted { + line.push(" deleted", dim()); + } + lines.push(truncate(&line, look.width)); + } + } + lines.push(truncate(&footer(turn), look.width)); + lines +} + +pub fn activity(turn: &Turn, waiting: bool, asked: bool) -> String { + if asked { + return "Waiting for your answer".into(); + } + if waiting { + return "Waiting for your OK".into(); + } + match turn.items.iter().rev().find(|item| !matches!(item, Item::Plan { .. } | Item::Note(_) | Item::Steer(_))) { + None => "Warming up the model".into(), + Some(Item::Reasoning(_)) => "Thinking".into(), + Some(Item::Text(_)) => "Writing".into(), + Some(Item::Tool(tool)) if tool.working() && !hidden_tool(tool) => "Working".into(), + _ => "Processing".into(), + } +} + +pub fn writing(turn: &Turn) -> bool { + matches!(activity(turn, false, false).as_str(), "Writing" | "Working") +} + +pub fn plan_progress(turn: &Turn, look: Look) -> Option<Line> { + let (steps, _) = plan(turn)?; + let done = steps.iter().filter(|step| step.status == StepStatus::Done).count(); + let next = steps + .iter() + .find(|step| step.status == StepStatus::Active) + .or_else(|| steps.iter().find(|step| step.status == StepStatus::Pending)); + let mut line = Line::styled(format!("Plan {done}/{}", steps.len()), dim()); + if let Some(step) = next { + line.push(format!(" · {}", clean(&step.text)), plain()); + } + Some(truncate(&line, look.width)) +} + +fn settled(text: &str, from: usize) -> usize { + let mut fence = false; + let mut cut = from; + let mut position = from; + for line in text[from..].split_inclusive('\n') { + position += line.len(); + if !line.ends_with('\n') { + break; + } + let trimmed = line.trim(); + if trimmed.starts_with("```") || trimmed.starts_with("~~~") { + fence = !fence; + } else if trimmed.is_empty() && !fence { + cut = position; + } + } + cut +} + +pub fn turn_lines(turn: &Turn, look: Look) -> Vec<Line> { + let mut lines = vec![Line::default()]; + lines.extend(prompt_lines(turn, look)); + lines.extend(Progress::new().advance(turn, look)); + lines +} + +pub struct Progress { + item: usize, + offset: usize, + plan: Option<Vec<PlanStep>>, + done: bool, +} + +impl Progress { + pub fn new() -> Progress { + Progress { item: 0, offset: 0, plan: None, done: false } + } + + pub fn done(&self) -> bool { + self.done + } + + pub fn advance(&mut self, turn: &Turn, look: Look) -> Vec<Line> { + let mut out = Vec::new(); + if self.done { + return out; + } + let working = turn.working(); + while self.item < turn.items.len() { + let streaming = working && self.item + 1 == turn.items.len(); + match &turn.items[self.item] { + Item::Text(text) => { + let end = if streaming { settled(text, self.offset) } else { text.len() }; + if end > self.offset { + let chunk = &text[self.offset..end]; + if !blank(chunk) { + let first = blank(&text[..self.offset]); + block(&mut out, answer(markdown::render(chunk, look.inner(2)), first)); + } + self.offset = end; + } + if streaming { + break; + } + } + Item::Reasoning(text) => { + if streaming { + break; + } + block(&mut out, reasoning_lines(text, look)); + } + Item::Tool(tool) if hidden_tool(tool) => {} + Item::Tool(tool) if look.group && grouped(tool) => { + let (end, scanned) = group_span(&turn.items, self.item, look); + let tools = group_tools(&turn.items[self.item..end]); + let closed = scanned < turn.items.len() || !working; + if !closed || tools.iter().any(|tool| tool.working()) || held(&tools) { + break; + } + block(&mut out, vec![group_head(&tools, look, "•")]); + self.item = end; + self.offset = 0; + continue; + } + Item::Tool(tool) => { + if tool.working() { + break; + } + let mut lines = tool_rows(tool, look, "•"); + lines.extend(tool_body(tool, look)); + block(&mut out, lines); + } + Item::Plan { steps, explanation } => { + if self.plan.as_ref() != Some(steps) { + block(&mut out, plan_lines(steps, explanation.as_deref(), look)); + self.plan = Some(steps.clone()); + } + } + Item::Question { question, answer, .. } => { + if answer.is_none() && working { + break; + } + block(&mut out, question_lines(question, answer.as_deref(), look)); + } + Item::Steer(text) => block(&mut out, steer_lines(text, look)), + Item::Note(text) => block(&mut out, note_lines(text, look)), + } + self.item += 1; + self.offset = 0; + } + if !working && self.item >= turn.items.len() { + block(&mut out, ending_lines(turn, look)); + self.done = true; + } + out + } + + pub fn live(&self, turn: &Turn, look: Look, spinner: &str, thought: Option<&str>) -> Vec<Line> { + let mut lines = Vec::new(); + let mut index = self.item; + while index < turn.items.len() { + match &turn.items[index] { + Item::Text(text) => { + let start = if index == self.item { self.offset.min(text.len()) } else { 0 }; + let rest = &text[start..]; + if !blank(rest) { + let rendered = answer(markdown::render(rest, look.inner(2)), blank(&text[..start])); + let skip = rendered.len().saturating_sub(LIVE_TEXT); + block(&mut lines, rendered.into_iter().skip(skip).collect()); + } + } + Item::Reasoning(text) if index + 1 < turn.items.len() => block(&mut lines, reasoning_lines(text, look)), + Item::Reasoning(text) => block(&mut lines, thinking_lines(text, look, thought)), + Item::Tool(tool) if hidden_tool(tool) => {} + Item::Tool(tool) if look.group && grouped(tool) => { + let (end, _) = group_span(&turn.items, index, look); + block(&mut lines, group_rows(&group_tools(&turn.items[index..end]), look, spinner)); + index = end; + continue; + } + Item::Tool(tool) => { + let mut rows = tool_rows(tool, look, spinner); + if tool.status == ToolStatus::Running && tool.category == Category::Command { + rows.extend(running_command(tool, look)); + } else if !tool.working() { + rows.extend(tool_body(tool, look)); + } + block(&mut lines, rows); + } + Item::Steer(text) => block(&mut lines, steer_lines(text, look)), + Item::Note(text) => block(&mut lines, note_lines(text, look)), + Item::Plan { .. } | Item::Question { .. } => {} + } + index += 1; + } + lines + } +} + +#[cfg(test)] +mod tests { + use super::*; + use quill_core::diff_text; + use quill_core::tools::legacy; + + fn look() -> Look { + Look { width: 60, reasoning: Reasoning::Collapsed, group: true } + } + + fn tool(id: &str, name: &str, target: &str, status: ToolStatus) -> Item { + let mut item = ToolItem::new(legacy(name)); + item.id = id.into(); + item.target = target.into(); + item.status = status; + Item::Tool(item) + } + + fn texts(lines: &[Line]) -> Vec<String> { + lines.iter().map(Line::text).collect() + } + + #[test] + fn streamed_text_commits_whole_paragraphs() { + let mut turn = Turn::new("p".into(), Vec::new()); + let mut progress = Progress::new(); + turn.push_text("First paragraph.\n\nSecond is still"); + assert_eq!(texts(&progress.advance(&turn, look())), vec!["", "● First paragraph."]); + assert_eq!(texts(&progress.live(&turn, look(), "*", None)), vec!["", " Second is still"]); + turn.push_text(" coming."); + assert!(progress.advance(&turn, look()).is_empty()); + turn.finish(TurnState::Done); + let rest = texts(&progress.advance(&turn, look())); + assert_eq!(rest[..2], ["".to_string(), " Second is still coming.".to_string()]); + assert!(rest.last().unwrap().starts_with(" Worked for")); + assert!(progress.done()); + } + + #[test] + fn code_fences_hold_back_until_closed() { + let mut turn = Turn::new("p".into(), Vec::new()); + let mut progress = Progress::new(); + turn.push_text("```\nfn main() {}\n\nmore\n"); + assert!(progress.advance(&turn, look()).is_empty()); + turn.push_text("```\n\nAfter."); + assert_eq!(texts(&progress.advance(&turn, look())), vec!["", "● │ fn main() {}", " │ ", " │ more"]); + } + + #[test] + fn exploration_groups_wait_for_the_run_to_end() { + let mut turn = Turn::new("p".into(), Vec::new()); + let mut progress = Progress::new(); + turn.items.push(tool("1", "read_file", "src/a.rs (lines 260-294)", ToolStatus::Done)); + turn.items.push(tool("2", "grep", "TODO", ToolStatus::Running)); + assert!(progress.advance(&turn, look()).is_empty()); + assert_eq!( + texts(&progress.live(&turn, look(), "*", None)), + vec!["", "* Reading 1 file, searching for 1 pattern", "● Read(src/a.rs (lines 260-294))", "* Search(TODO)"] + ); + if let Item::Tool(grep) = &mut turn.items[1] { + grep.status = ToolStatus::Done; + } + turn.items.push(tool("3", "shell", "cargo test", ToolStatus::Running)); + assert!(progress.advance(&turn, look()).is_empty()); + let wide = Look { width: 100, ..look() }; + assert_eq!( + texts(&progress.live(&turn, wide, "*", None)), + vec![ + "", + "* Reading 1 file, searching for 1 pattern, running 1 shell command", + "● Read(src/a.rs (lines 260-294))", + "● Search(TODO)", + "* Shell(cargo test)", + " └ Running…" + ] + ); + if let Item::Tool(shell) = &mut turn.items[2] { + shell.status = ToolStatus::Done; + shell.output = "Exit code 0".into(); + } + turn.finish(TurnState::Done); + let rest = texts(&progress.advance(&turn, look())); + assert_eq!(rest[..2], ["".to_string(), " Read 1 file, searched for 1 pattern, ran 1 shell command".to_string()]); + } + + #[test] + fn finished_searches_stay_open_for_a_moment() { + let mut turn = Turn::new("p".into(), Vec::new()); + let mut progress = Progress::new(); + let mut item = ToolItem::new(legacy("grep")); + item.id = "1".into(); + item.target = "send".into(); + item.status = ToolStatus::Done; + item.ended = Some(now_ms()); + turn.items.push(Item::Tool(item)); + turn.push_text("Next."); + assert!(progress.advance(&turn, look()).is_empty()); + assert_eq!(texts(&progress.live(&turn, look(), "*", None))[..3], ["", " Searched for 1 pattern", "● Search(send)"]); + if let Item::Tool(grep) = &mut turn.items[0] { + grep.ended = Some(now_ms() - HOLD_MS - 1); + } + assert_eq!(texts(&progress.advance(&turn, look()))[..2], ["".to_string(), " Searched for 1 pattern".to_string()]); + } + + #[test] + fn hidden_thoughts_do_not_split_a_group() { + let mut turn = Turn::new("p".into(), Vec::new()); + turn.items.push(tool("1", "read_file", "a.rs", ToolStatus::Done)); + turn.push_reasoning("Now search."); + turn.items.push(tool("2", "grep", "TODO", ToolStatus::Done)); + turn.finish(TurnState::Done); + let lines = texts(&Progress::new().advance(&turn, Look { reasoning: Reasoning::Hidden, ..look() })); + assert_eq!(lines[1], " Read 1 file, searched for 1 pattern"); + } + + #[test] + fn edits_show_their_diff() { + let mut turn = Turn::new("p".into(), Vec::new()); + let mut item = ToolItem::new(legacy("write_file")); + item.id = "1".into(); + item.target = "a.py".into(); + item.status = ToolStatus::Done; + item.diffs = vec![diff_text("a.py", Some("x\n"), "y\n")]; + turn.items.push(Item::Tool(item)); + turn.finish(TurnState::Done); + let lines = texts(&Progress::new().advance(&turn, look())); + assert_eq!(lines[1], "● Write(a.py)"); + assert_eq!(lines[2], " └ Added 1 line, removed 1 line"); + assert_eq!(lines[3].trim(), "1 - x"); + assert_eq!(lines[4].trim(), "1 + y"); + assert!(lines.iter().any(|line| line == "1 file changed +1 -1")); + } + + #[test] + fn reads_get_their_own_row_when_grouping_is_off() { + let mut turn = Turn::new("p".into(), Vec::new()); + let mut item = ToolItem::new(legacy("read_file")); + item.id = "1".into(); + item.target = "src/a.rs".into(); + item.status = ToolStatus::Done; + item.output = " 1→one\n 2\n 3→three\n(showing lines 1-3 of 9; pass start_line to read more)".into(); + turn.items.push(Item::Tool(item)); + turn.finish(TurnState::Done); + let lines = texts(&Progress::new().advance(&turn, Look { group: false, ..look() })); + assert_eq!(lines[1..3], ["● Read(src/a.rs)".to_string(), " └ Read 3 lines".to_string()]); + } + + #[test] + fn searches_say_what_they_found() { + let searched = |name: &str, output: &str| { + let mut item = ToolItem::new(legacy(name)); + item.status = ToolStatus::Done; + item.output = output.into(); + texts(&tool_body(&item, look()))[0].clone() + }; + assert_eq!(searched("grep", "No matches for \"sick\"."), " └ No matches"); + assert_eq!(searched("grep", "a.hx:1: sick\n--\na.hx:9: sick\n... and 4 more matches. Narrow it."), " └ Found 6 lines"); + assert_eq!(searched("find_files", "No files match \"*.hx\". Use grep."), " └ No files found"); + assert_eq!(searched("find_files", "a.hx\nb.hx"), " └ Found 2 files"); + } + + #[test] + fn failed_commands_show_their_tail() { + let mut turn = Turn::new("p".into(), Vec::new()); + let mut item = ToolItem::new(legacy("shell")); + item.id = "1".into(); + item.target = "cargo test".into(); + item.status = ToolStatus::Done; + item.output = "Exit code 101\nerror: one\nerror: two".into(); + turn.items.push(Item::Tool(item)); + turn.finish(TurnState::Done); + let lines = texts(&Progress::new().advance(&turn, look())); + assert_eq!(lines[1], "● Shell(cargo test) · exit 101"); + assert_eq!(lines[2..4], [" └ error: one".to_string(), " error: two".to_string()]); + } + + #[test] + fn failed_commands_skip_stack_frames() { + let mut item = ToolItem::new(legacy("shell")); + item.status = ToolStatus::Done; + item.output = "Exit code 1\nAssertionError: 26 !== 27\n at check (a.js:1:1)\n\n at run (b.js:2:2)\nReferenceError: before is not defined".into(); + let lines = texts(&tool_body(&item, look())); + assert_eq!(lines, [" └ AssertionError: 26 !== 27", " ReferenceError: before is not defined"]); + item.output = "Exit code 1\nGet-ChildItem : no parameter named 'la'.\nAt line:1 char:93\n+ ... $ProgressPreference='SilentlyContinue'; ls -la\n+ ~~~\n + CategoryInfo : InvalidArgument\n + FullyQualifiedErrorId : NamedParameterNotFound".into(); + let lines = texts(&tool_body(&item, look())); + assert_eq!(lines, [" └ Get-ChildItem : no parameter named 'la'."]); + } + + #[test] + fn stopped_and_failed_turns_say_so() { + let mut stopped = Turn::new("p".into(), Vec::new()); + stopped.finish(TurnState::Stopped); + assert!(texts(&ending_lines(&stopped, look())).contains(&"■ You stopped this reply".to_string())); + let mut failed = Turn::new("p".into(), Vec::new()); + failed.finish(TurnState::Failed("Nothing is answering".into())); + assert_eq!(texts(&ending_lines(&failed, look()))[0], "✗ Nothing is answering"); + } + + #[test] + fn plans_print_when_they_first_appear_and_when_they_change() { + let mut turn = Turn::new("p".into(), Vec::new()); + let mut progress = Progress::new(); + let step = |status| vec![PlanStep { text: "Write it".into(), status }]; + turn.set_plan(step(StepStatus::Active), None); + turn.push_text("working"); + let first = texts(&progress.advance(&turn, look())); + assert_eq!(first[1..], ["Plan · 0 of 1 done".to_string(), " › Write it".to_string()]); + turn.set_plan(step(StepStatus::Done), None); + turn.finish(TurnState::Done); + let last = texts(&progress.advance(&turn, look())); + assert!(last.contains(&"Plan · 1 of 1 done".to_string())); + assert_eq!(texts(&progress.advance(&turn, look())), Vec::<String>::new()); + } + + #[test] + fn reasoning_follows_the_setting() { + let mut turn = Turn::new("p".into(), Vec::new()); + turn.push_reasoning("Let me look.\nChecking the tests."); + turn.push_text("Done."); + turn.finish(TurnState::Done); + let collapsed = texts(&Progress::new().advance(&turn, look())); + assert_eq!(collapsed[1], "◇ Thought Checking the tests."); + let hidden = texts(&Progress::new().advance(&turn, Look { reasoning: Reasoning::Hidden, ..look() })); + assert_eq!(hidden[1], "● Done."); + } + + #[test] + fn thoughts_are_summarised_by_whole_sentences() { + assert_eq!(summary("Let me look at **main.rs**. Then I will"), Some("Let me look at main.rs.".into())); + assert_eq!(summary("Still going"), None); + assert_eq!(last_sentence("First one. Second one"), "Second one"); + assert_eq!(summary("Facts:\n1. Foxes rest at 110 bpm\n2. They"), Some("Foxes rest at 110 bpm".into())); + } + + #[test] + fn activity_names_what_is_happening() { + let mut turn = Turn::new("p".into(), Vec::new()); + assert_eq!(activity(&turn, false, false), "Warming up the model"); + turn.push_reasoning("hm"); + assert_eq!(activity(&turn, false, false), "Thinking"); + turn.items.push(tool("1", "shell", "ls", ToolStatus::Running)); + assert_eq!(activity(&turn, false, false), "Working"); + assert_eq!(activity(&turn, true, false), "Waiting for your OK"); + } + + #[test] + fn durations_read_naturally() { + assert_eq!(duration(42), "42s"); + assert_eq!(duration(125), "2m 5s"); + assert_eq!(duration(3720), "1h 2m"); + assert_eq!(seconds_label(2.34), "2.3s"); + assert_eq!(command_body("Exit code 0\nhello"), "hello"); + } +} \ No newline at end of file diff --git a/crates/quill-code/src/icons.rs b/crates/quill-code/src/icons.rs deleted file mode 100644 index 6d67e3e..0000000 --- a/crates/quill-code/src/icons.rs +++ /dev/null @@ -1,87 +0,0 @@ -use gpui_kit::SharedString; - -macro_rules! icons { - ($($name:ident => $file:literal,)*) => { - #[derive(Clone, Copy, Debug, PartialEq, Eq)] - pub enum Icon { - $($name,)* - } - - impl Icon { - pub fn path(self) -> SharedString { - match self { - $(Icon::$name => concat!("quill/icons/", $file, ".svg"),)* - } - .into() - } - } - - pub fn load(path: &str) -> Option<&'static [u8]> { - $( - if path == concat!("quill/icons/", $file, ".svg") { - return Some(include_bytes!(concat!("../../../assets/icons/", $file, ".svg"))); - } - )* - None - } - }; -} - -icons! { - ArrowLeft => "arrow-left", - ArrowUp => "up", - Bolt => "quick-task", - Branch => "fork", - Bulb => "bulb", - Chat => "chat", - Check => "check", - CheckCircle => "check-circle", - ChevronDown => "chev-down", - ChevronRight => "chevron", - CircleAlert => "circle-alert", - CircleStop => "circle-stop", - CircleX => "circle-x", - Code => "code", - Commit => "git-commit", - Compose => "compose", - Copy => "copy", - Cube => "cube", - Dots => "dots", - Download => "download", - Eraser => "eraser", - File => "paper", - FileCode => "file-code", - FileDiff => "file-diff", - FilePen => "file-pen", - FilePlus => "file-plus", - FileText => "file-text", - Files => "files", - Folder => "folder", - FolderOpen => "folder-open", - FolderPlus => "folder-plus", - FolderTree => "folder-tree", - Gear => "gear", - Globe => "globe", - Image => "image-icon", - Info => "info", - Isolated => "isolated", - LlamaCpp => "llama-cpp", - Link => "link", - Loader => "loader", - Paperclip => "paperclip", - Pencil => "pencil", - Pin => "pin", - Plus => "plus", - PullRequest => "pull-request", - Refresh => "refresh", - Retry => "retry", - Search => "search", - Server => "server", - Shield => "shield", - Sliders => "sliders", - Slash => "slash", - Stop => "stop", - Terminal => "terminal", - Trash => "trash", - X => "x", -} \ No newline at end of file diff --git a/crates/quill-code/src/main.rs b/crates/quill-code/src/main.rs index 70f3b24..5618692 100644 --- a/crates/quill-code/src/main.rs +++ b/crates/quill-code/src/main.rs @@ -1,65 +1,166 @@ -#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] - -mod add_project; -mod assets; +mod app; mod attachments; mod backend; -mod commit_dialog; +mod clipboard; +mod commands; +mod commit; mod composer; mod config; -mod context_ring; -mod git; -mod github; -mod icons; +mod exec; +mod history; +mod markdown; mod mentions; -mod palette; -mod panel; +mod picker; mod project; -mod publish; -mod settings; -mod shell; -mod smooth_scroll; +mod setup; mod store; -mod terminal; +mod term; +mod text; mod thread; -mod thread_view; -mod ui; -mod version; +mod update; +mod usage; mod weave; mod workspace; -use std::borrow::Cow; +use std::path::PathBuf; +use std::process::ExitCode; + +use clap::{Parser, Subcommand, ValueEnum}; +use crossterm::event::KeyEvent; +use quill_config::{ModelRef, ServerKind}; +use quill_core::{Access, Event}; +use quill_providers::{Model, Props}; + +pub enum Msg { + Key(KeyEvent), + Paste(String), + Resize, + Interrupt, + Session(u64, Event), + Probed { generation: usize, id: String, found: backend::Found }, + Props { model: ModelRef, props: Props }, + Repo(app::Repo), + Job(commit::Job), + Detected(Vec<(ServerKind, String)>), + Connected(Result<Vec<Model>, String>), + Releases(Result<Vec<quill_git::github::Release>, String>), + Scroll(term::Scroll), +} + +#[derive(Clone, Copy, ValueEnum)] +enum Mode { + Ask, + Edits, + Auto, +} -use gpui_kit::component::TitleBar; -use gpui_kit::{App, Bounds, WindowBounds, WindowOptions, prelude::*, px, size}; +impl From<Mode> for Access { + fn from(mode: Mode) -> Access { + match mode { + Mode::Ask => Access::Supervised, + Mode::Edits => Access::AutoEdits, + Mode::Auto => Access::Full, + } + } +} + +#[derive(Parser)] +#[command( + name = "quill", + bin_name = "quill", + version, + about = "Quill Code, a coding agent for your terminal that runs on your own models.", + args_conflicts_with_subcommands = true +)] +struct Cli { + #[arg(short = 'C', long = "cd", value_name = "DIR", global = true, help = "Work in this folder instead of the current one")] + dir: Option<PathBuf>, + #[arg(short = 'c', long = "continue", help = "Continue the latest thread in this folder")] + resume: bool, + #[arg(short = 'w', long = "worktree", help = "Start the new thread in an isolated copy (a git worktree)")] + isolate: bool, + #[arg(value_name = "PROMPT", help = "Start with this prompt")] + prompt: Vec<String>, + #[command(subcommand)] + command: Option<Commands>, +} + +#[derive(Subcommand)] +enum Commands { + #[command(about = "Run one task without the interactive screen; text goes to stdout, progress to stderr")] + Exec { + #[arg(value_name = "TASK", help = "The task, or - to read it from standard input")] + prompt: Vec<String>, + #[arg(short, long, value_name = "PROVIDER/MODEL", help = "Use this model instead of the selected one")] + model: Option<String>, + #[arg(short, long, value_enum, help = "How much the agent may do; anything that would ask is declined")] + access: Option<Mode>, + #[arg(long, help = "Print every event as a line of JSON")] + json: bool, + #[arg(short = 'c', long = "continue", help = "Continue the latest thread in this folder")] + resume: bool, + #[arg(short = 'w', long = "worktree", help = "Work in an isolated copy (a git worktree)")] + isolate: bool, + }, + #[command(about = "List model servers and the models they offer")] + Models { + #[arg(long, help = "Look for model servers on this machine and add them")] + scan: bool, + }, + #[command(about = "How many tokens Quill Code has used, today and over time")] + Usage, + #[command(about = "Update Quill Code to the newest release, or switch to the one you name")] + Update { + #[arg(value_name = "VERSION", help = "Install this release instead of the newest, for example 1.0.0")] + version: Option<String>, + }, + #[command(about = "List every published release of Quill Code")] + Versions, + #[command(about = "Where Quill Code keeps its settings, and ways to change them")] + Config { + #[command(subcommand)] + action: Option<ConfigAction>, + }, +} -fn load_fonts(cx: &App) { - let fonts = vec![ - Cow::Borrowed(include_bytes!("../../../assets/fonts/OpenSans-Light.ttf").as_slice()), - Cow::Borrowed(include_bytes!("../../../assets/fonts/OpenSans-Regular.ttf").as_slice()), - Cow::Borrowed(include_bytes!("../../../assets/fonts/OpenSans-SemiBold.ttf").as_slice()), - ]; - cx.text_system().add_fonts(fonts).expect("bundled fonts load"); +#[derive(Subcommand, Clone, Copy)] +enum ConfigAction { + #[command(about = "Open settings.json in your editor")] + Edit, + #[command(about = "Open your personal instructions, which every thread reads")] + Instructions, + #[command(about = "Reset every setting except your providers and models")] + Reset, } -fn main() { - gpui_kit::application().with_assets(assets::Assets).run(|cx| { - gpui_kit::init(cx); - load_fonts(cx); - cx.set_global(config::Config::load()); - palette::apply(cx.window_appearance(), None, cx); - cx.on_window_closed(|cx, _| { - if cx.windows().is_empty() { - cx.quit(); +fn main() -> ExitCode { + update::tidy(); + let cli = Cli::parse(); + let root = match &cli.dir { + Some(dir) => project::absolute(dir), + None => std::env::current_dir().unwrap_or_else(|_| PathBuf::from(".")), + }; + if !root.is_dir() { + eprintln!("{} is not a folder.", root.display()); + return ExitCode::from(2); + } + let code = match cli.command { + Some(Commands::Exec { prompt, model, access, json, resume, isolate }) => match exec::read_prompt(&prompt) { + Ok(prompt) => exec::run(exec::Options { prompt, root, model, access: access.map(Access::from), json, resume, isolate }), + Err(error) => { + eprintln!("{error}"); + 2 } - }) - .detach(); - let options = WindowOptions { - window_bounds: Some(WindowBounds::Windowed(Bounds::centered(None, size(px(1280.), px(820.)), cx))), - window_min_size: Some(size(px(720.), px(480.))), - ..TitleBar::window_options() - }; - gpui_kit::open_window(options, cx, |window, cx| cx.new(|cx| shell::Shell::new(window, cx))).expect("open the main window"); - cx.activate(true); - }); + }, + Some(Commands::Models { scan }) => commands::models(scan), + Some(Commands::Usage) => commands::usage(), + Some(Commands::Update { version }) => update::run(version), + Some(Commands::Versions) => update::versions(), + Some(Commands::Config { action: None }) => commands::show_config(), + Some(Commands::Config { action: Some(ConfigAction::Edit) }) => commands::edit_config(), + Some(Commands::Config { action: Some(ConfigAction::Instructions) }) => commands::edit_instructions(), + Some(Commands::Config { action: Some(ConfigAction::Reset) }) => commands::reset_config(), + None => app::run(root, cli.resume, cli.isolate, cli.prompt.join(" ")), + }; + ExitCode::from(code) } \ No newline at end of file diff --git a/crates/quill-code/src/markdown.rs b/crates/quill-code/src/markdown.rs new file mode 100644 index 0000000..80f610c --- /dev/null +++ b/crates/quill-code/src/markdown.rs @@ -0,0 +1,409 @@ +use crossterm::style::{ContentStyle, Stylize}; +use pulldown_cmark::{Alignment, Event, HeadingLevel, Options, Parser, Tag, TagEnd}; + +use crate::text::{Line, accent, clean, dim, split_lines, truncate, wrap, wrap_chars}; + +pub fn render(text: &str, width: usize) -> Vec<Line> { + let mut writer = Writer::new(width); + let options = Options::ENABLE_TABLES | Options::ENABLE_STRIKETHROUGH | Options::ENABLE_TASKLISTS; + for event in Parser::new_ext(text, options) { + writer.event(event); + } + writer.flush(); + writer.lines +} + +struct Container { + first: Line, + rest: Line, + used: bool, +} + +#[derive(Default)] +struct Table { + alignments: Vec<Alignment>, + rows: Vec<Vec<Line>>, + row: Vec<Line>, + cell: Line, + head: usize, +} + +struct Writer { + width: usize, + lines: Vec<Line>, + inline: Line, + containers: Vec<Container>, + lists: Vec<Option<u64>>, + bold: usize, + italic: usize, + strike: usize, + heading: Option<HeadingLevel>, + link: Option<String>, + code: Option<String>, + table: Option<Table>, + gap: bool, +} + +impl Writer { + fn new(width: usize) -> Writer { + Writer { + width: width.max(20), + lines: Vec::new(), + inline: Line::default(), + containers: Vec::new(), + lists: Vec::new(), + bold: 0, + italic: 0, + strike: 0, + heading: None, + link: None, + code: None, + table: None, + gap: false, + } + } + + fn style(&self) -> ContentStyle { + let mut style = ContentStyle::new(); + if self.bold > 0 || self.heading.is_some() { + style = style.bold(); + } + if self.heading == Some(HeadingLevel::H1) || self.link.is_some() { + style = style.underlined(); + } + if self.italic > 0 { + style = style.italic(); + } + if self.strike > 0 { + style = style.crossed_out(); + } + style + } + + fn write(&mut self, text: &str, style: ContentStyle) { + let text = clean(text); + match self.table.as_mut() { + Some(table) => table.cell.push(text.replace('\n', " "), style), + None => self.inline.push(text, style), + } + } + + fn prefix(&mut self) -> Line { + let mut line = Line::default(); + for container in &mut self.containers { + line.append(if container.used { container.rest.clone() } else { container.first.clone() }); + container.used = true; + } + line + } + + fn room(&self) -> usize { + let used: usize = self.containers.iter().map(|container| container.rest.width()).sum(); + self.width.saturating_sub(used).max(10) + } + + fn start_block(&mut self) { + self.flush(); + if self.gap && !self.lines.is_empty() { + self.lines.push(Line::default()); + } + self.gap = false; + } + + fn flush(&mut self) { + if self.inline.spans.is_empty() { + return; + } + let inline = std::mem::take(&mut self.inline); + let room = self.room(); + for logical in split_lines(&inline) { + for wrapped in wrap(&logical, room) { + let mut line = self.prefix(); + line.append(wrapped); + self.lines.push(line); + } + } + } + + fn event(&mut self, event: Event) { + match event { + Event::Start(tag) => self.start(tag), + Event::End(tag) => self.end(tag), + Event::Text(text) => match self.code.as_mut() { + Some(code) => code.push_str(&text), + None => self.write(&text, self.style()), + }, + Event::Code(text) => self.write(&text, accent()), + Event::InlineMath(text) | Event::DisplayMath(text) => self.write(&text, self.style()), + Event::Html(text) | Event::InlineHtml(text) => self.write(&text, dim()), + Event::FootnoteReference(name) => self.write(&format!("[{name}]"), dim()), + Event::SoftBreak | Event::HardBreak => self.write("\n", self.style()), + Event::Rule => { + self.start_block(); + let mut line = self.prefix(); + line.push("─".repeat(self.room().min(48)), dim()); + self.lines.push(line); + self.gap = true; + } + Event::TaskListMarker(done) => self.write(if done { "[x] " } else { "[ ] " }, dim()), + } + } + + fn start(&mut self, tag: Tag) { + match tag { + Tag::Paragraph | Tag::HtmlBlock => self.start_block(), + Tag::Heading { level, .. } => { + self.start_block(); + self.heading = Some(level); + } + Tag::BlockQuote(_) => { + self.start_block(); + let bar = Line::styled("▎ ", dim()); + self.containers.push(Container { first: bar.clone(), rest: bar, used: false }); + } + Tag::CodeBlock(_) => { + self.start_block(); + self.code = Some(String::new()); + } + Tag::List(start) => { + if self.lists.is_empty() { + self.start_block(); + } else { + self.flush(); + } + self.lists.push(start); + } + Tag::Item => { + self.flush(); + let depth = self.lists.len(); + let marker = match self.lists.last_mut() { + Some(Some(number)) => { + let marker = Line::plain(format!("{number}. ")); + *number += 1; + marker + } + _ => Line::styled( + match depth { + 0 | 1 => "• ", + 2 => "◦ ", + _ => "▪ ", + }, + dim(), + ), + }; + let rest = Line::plain(" ".repeat(marker.width())); + self.containers.push(Container { first: marker, rest, used: false }); + } + Tag::Table(alignments) => { + self.start_block(); + self.table = Some(Table { alignments, ..Table::default() }); + } + Tag::TableRow => { + if let Some(table) = self.table.as_mut() { + table.row.clear(); + } + } + Tag::TableCell => { + if let Some(table) = self.table.as_mut() { + table.cell = Line::default(); + } + } + Tag::Emphasis => self.italic += 1, + Tag::Strong => self.bold += 1, + Tag::Strikethrough => self.strike += 1, + Tag::Link { dest_url, .. } => self.link = Some(dest_url.to_string()), + Tag::Image { .. } => self.write("[image: ", dim()), + _ => {} + } + } + + fn end(&mut self, tag: TagEnd) { + match tag { + TagEnd::Paragraph | TagEnd::HtmlBlock => { + self.flush(); + self.gap = true; + } + TagEnd::Heading(_) => { + self.flush(); + self.heading = None; + self.gap = true; + } + TagEnd::BlockQuote(_) => { + self.flush(); + self.containers.pop(); + self.gap = true; + } + TagEnd::CodeBlock => { + let code = self.code.take().unwrap_or_default(); + let room = self.room().saturating_sub(2).max(10); + for raw in clean(code.trim_end_matches('\n')).split('\n') { + for wrapped in wrap_chars(&Line::plain(raw), room) { + let mut line = self.prefix(); + line.push("│ ", dim()); + line.append(wrapped); + self.lines.push(line); + } + } + self.gap = true; + } + TagEnd::List(_) => { + self.flush(); + self.lists.pop(); + if self.lists.is_empty() { + self.gap = true; + } + } + TagEnd::Item => { + self.flush(); + self.containers.pop(); + } + TagEnd::TableCell => { + if let Some(table) = self.table.as_mut() { + let cell = std::mem::take(&mut table.cell); + table.row.push(cell); + } + } + TagEnd::TableHead => { + if let Some(table) = self.table.as_mut() { + let row = std::mem::take(&mut table.row); + table.rows.push(row); + table.head = table.rows.len(); + } + } + TagEnd::TableRow => { + if let Some(table) = self.table.as_mut() { + let row = std::mem::take(&mut table.row); + table.rows.push(row); + } + } + TagEnd::Table => { + if let Some(table) = self.table.take() { + self.render_table(table); + } + self.gap = true; + } + TagEnd::Emphasis => self.italic = self.italic.saturating_sub(1), + TagEnd::Strong => self.bold = self.bold.saturating_sub(1), + TagEnd::Strikethrough => self.strike = self.strike.saturating_sub(1), + TagEnd::Link => { + if let Some(url) = self.link.take() { + let shown = self.inline.text(); + if !url.is_empty() && !url.starts_with('#') && !shown.ends_with(url.as_str()) { + self.write(&format!(" ({url})"), dim()); + } + } + } + TagEnd::Image => self.write("]", dim()), + _ => {} + } + } + + fn render_table(&mut self, table: Table) { + let columns = table.rows.iter().map(Vec::len).max().unwrap_or(0); + if columns == 0 { + return; + } + let mut widths = vec![0; columns]; + for row in &table.rows { + for (index, cell) in row.iter().enumerate() { + widths[index] = widths[index].max(cell.width()); + } + } + let room = self.room().saturating_sub(3 * (columns - 1)); + while widths.iter().sum::<usize>() > room { + let Some(widest) = widths.iter().copied().enumerate().max_by_key(|(_, width)| *width).filter(|(_, width)| *width > 3) else { + break; + }; + widths[widest.0] -= 1; + } + for (index, row) in table.rows.iter().enumerate() { + let mut line = self.prefix(); + for (column, width) in widths.iter().enumerate() { + if column > 0 { + line.push(" │ ", dim()); + } + let cell = truncate(row.get(column).unwrap_or(&Line::default()), *width); + let space = width.saturating_sub(cell.width()); + let (before, after) = match table.alignments.get(column) { + Some(Alignment::Right) => (space, 0), + Some(Alignment::Center) => (space / 2, space - space / 2), + _ => (0, space), + }; + line.push(" ".repeat(before), ContentStyle::new()); + if index < table.head { + for span in cell.spans { + line.push(span.text, span.style.bold()); + } + } else { + line.append(cell); + } + if column + 1 < columns { + line.push(" ".repeat(after), ContentStyle::new()); + } + } + self.lines.push(line); + if index + 1 == table.head { + let mut rule = self.prefix(); + let parts: Vec<String> = widths.iter().map(|width| "─".repeat(*width)).collect(); + rule.push(parts.join("─┼─"), dim()); + self.lines.push(rule); + } + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + fn texts(markdown: &str, width: usize) -> Vec<String> { + render(markdown, width).iter().map(Line::text).collect() + } + + #[test] + fn paragraphs_and_headings_are_spaced() { + assert_eq!(texts("# Title\n\nSome text\nthat breaks.\n\nNext.", 40), vec!["Title", "", "Some text", "that breaks.", "", "Next."]); + } + + #[test] + fn lists_nest_with_markers() { + let lines = texts("- one\n- two\n - inner\n\n1. first\n2. second", 40); + assert_eq!(lines, vec!["• one", "• two", " ◦ inner", "", "1. first", "2. second"]); + } + + #[test] + fn list_items_wrap_under_their_text() { + assert_eq!(texts("- a long item that wraps around", 20), vec!["• a long item that", " wraps around"]); + } + + #[test] + fn code_blocks_keep_their_lines() { + let lines = texts("Run:\n\n```sh\ncargo test\n --workspace\n```\nDone.", 40); + assert_eq!(lines, vec!["Run:", "", "│ cargo test", "│ --workspace", "", "Done."]); + } + + #[test] + fn inline_styles_and_links_render() { + let lines = render("Use `cargo` and **bold** [docs](https://x.dev).", 80); + assert_eq!(lines[0].text(), "Use cargo and bold docs (https://x.dev)."); + assert!(lines[0].spans.iter().any(|span| span.text == "cargo" && span.style == accent())); + assert!(lines[0].spans.iter().any(|span| span.text == "bold" && span.style == ContentStyle::new().bold())); + assert_eq!(texts("<https://x.dev>", 80), vec!["https://x.dev"]); + } + + #[test] + fn tables_line_up() { + let lines = texts("| Name | Size |\n|------|-----:|\n| a.rs | 12 |\n| bb.rs | 3 |", 40); + assert_eq!(lines, vec!["Name │ Size", "──────┼─────", "a.rs │ 12", "bb.rs │ 3"]); + } + + #[test] + fn quotes_and_rules_have_marks() { + assert_eq!(texts("> quoted\n\n---\n\nafter", 40), vec!["▎ quoted", "", &"─".repeat(40), "", "after"]); + } + + #[test] + fn task_lists_show_their_state() { + assert_eq!(texts("- [x] done\n- [ ] todo", 40), vec!["• [x] done", "• [ ] todo"]); + } +} \ No newline at end of file diff --git a/crates/quill-code/src/mentions.rs b/crates/quill-code/src/mentions.rs index 66267cf..8eafbcb 100644 --- a/crates/quill-code/src/mentions.rs +++ b/crates/quill-code/src/mentions.rs @@ -92,59 +92,120 @@ pub fn mentioned(text: &str) -> Vec<String> { #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum Command { New, + Connect, + Clear, + Resume, Model, - Reasoning, + Effort, Mode, - Review, - Files, - Terminal, - Commit, Init, + Instructions, + Compact, + Retry, + Diff, + Usage, + Version, + Commit, + Branch, + Rename, + Help, + Quit, } impl Command { - pub const ALL: [Command; 9] = [ + pub const ALL: [Command; 19] = [ Command::New, - Command::Init, + Command::Connect, + Command::Clear, + Command::Resume, Command::Model, - Command::Reasoning, + Command::Effort, Command::Mode, - Command::Review, - Command::Files, - Command::Terminal, + Command::Init, + Command::Instructions, + Command::Compact, + Command::Retry, + Command::Diff, + Command::Usage, + Command::Version, Command::Commit, + Command::Branch, + Command::Rename, + Command::Help, + Command::Quit, ]; pub fn name(self) -> &'static str { match self { Command::New => "new", + Command::Connect => "connect", + Command::Clear => "clear", + Command::Resume => "resume", Command::Model => "model", - Command::Reasoning => "think", + Command::Effort => "effort", Command::Mode => "mode", - Command::Review => "review", - Command::Files => "files", - Command::Terminal => "terminal", - Command::Commit => "commit", Command::Init => "init", + Command::Instructions => "instructions", + Command::Compact => "compact", + Command::Retry => "retry", + Command::Diff => "diff", + Command::Usage => "usage", + Command::Version => "version", + Command::Commit => "commit", + Command::Branch => "branch", + Command::Rename => "rename", + Command::Help => "help", + Command::Quit => "quit", } } pub fn description(self) -> &'static str { match self { Command::New => "Start a fresh thread in this project", - Command::Model => "Pick a different model for the next reply", - Command::Reasoning => "Turn reasoning on or off", + Command::Connect => "Connect another model server, such as Ollama or LM Studio", + Command::Clear => "Clear the screen and start a fresh thread", + Command::Resume => "Go back to an earlier thread in this project", + Command::Model => "Pick the model that powers Quill", + Command::Effort => "Turn thinking on or off, or pick the effort level", Command::Mode => "Choose how much the agent may do without asking", - Command::Review => "Look over what changed in the last reply", - Command::Files => "Browse the project's files", - Command::Terminal => "Open a PowerShell terminal in the project", - Command::Commit => "Commit your work, then push or open a pull request", Command::Init => "Have the agent write an AGENTS.md that explains this project", + Command::Instructions => "Edit your personal AGENTS.md, which every session reads", + Command::Compact => "Summarise the conversation to free up the model's context", + Command::Retry => "Send the last prompt again", + Command::Diff => "Show everything the last reply changed", + Command::Usage => "How many tokens this thread and everything else used", + Command::Version => "Switch to another released version of Quill Code", + Command::Commit => "Commit your work, then push or open a pull request", + Command::Branch => "Switch to another branch or create one", + Command::Rename => "Rename this thread: /rename <title>", + Command::Help => "Commands and keys", + Command::Quit => "Leave Quill Code", } } + pub fn widest() -> usize { + Command::ALL.iter().map(|command| command.name().len()).max().unwrap_or(0) + } + pub fn matching(query: &str) -> Vec<Command> { - Command::ALL.into_iter().filter(|c| c.name().starts_with(query)).collect() + let mut found: Vec<Command> = Command::ALL.into_iter().filter(|c| c.name().starts_with(query)).collect(); + found.sort_by_key(|c| c.name() != query); + found + } + + pub fn parse(text: &str) -> Option<(Command, String)> { + let rest = text.trim().strip_prefix('/')?; + let (name, argument) = rest.split_once(char::is_whitespace).unwrap_or((rest, "")); + let name = name.to_lowercase(); + let command = match name.as_str() { + "exit" => Command::Quit, + "review" => Command::Diff, + "reasoning" | "think" => Command::Effort, + "memory" | "agents" => Command::Instructions, + "versions" | "update" => Command::Version, + _ => Command::ALL.into_iter().find(|c| c.name() == name)?, + }; + Some((command, argument.trim().to_string())) } } @@ -181,7 +242,17 @@ mod tests { #[test] fn commands_filter_by_prefix() { - assert_eq!(Command::matching("te"), vec![Command::Terminal]); + assert_eq!(Command::matching("re"), vec![Command::Resume, Command::Retry, Command::Rename]); assert_eq!(Command::matching("").len(), Command::ALL.len()); + assert_eq!(Command::matching("mode"), vec![Command::Mode, Command::Model]); + } + + #[test] + fn typed_commands_parse_with_their_argument() { + assert_eq!(Command::parse("/rename Fix the build "), Some((Command::Rename, "Fix the build".into()))); + assert_eq!(Command::parse("/MODEL"), Some((Command::Model, String::new()))); + assert_eq!(Command::parse("/exit"), Some((Command::Quit, String::new()))); + assert_eq!(Command::parse("/nope"), None); + assert_eq!(Command::parse("plain text"), None); } } \ No newline at end of file diff --git a/crates/quill-code/src/palette.rs b/crates/quill-code/src/palette.rs deleted file mode 100644 index 4b9a276..0000000 --- a/crates/quill-code/src/palette.rs +++ /dev/null @@ -1,178 +0,0 @@ -use gpui_kit::component::{Theme, ThemeMode}; -use gpui_kit::{App, Global, Hsla, Window, WindowAppearance, px, rgb, rgba, transparent_black}; - -pub const FONT: &str = "Open Sans"; - -#[derive(Clone, Copy)] -pub struct Palette { - pub dark: bool, - pub bg: Hsla, - pub sidebar: Hsla, - pub surface_2: Hsla, - pub surface_hover: Hsla, - pub border: Hsla, - pub border_soft: Hsla, - pub text: Hsla, - pub text_muted: Hsla, - pub text_faint: Hsla, - pub accent: Hsla, - pub sidebar_text: Hsla, - pub row_hover: Hsla, - pub row_active: Hsla, - pub composer_bg: Hsla, - pub composer_ring: Hsla, - pub composer_ring_hover: Hsla, - pub menu_bg: Hsla, - pub fill: Hsla, - pub add: Hsla, - pub del: Hsla, - pub link: Hsla, - pub focus_ring: Hsla, - pub danger: Hsla, - pub warning: Hsla, - pub success: Hsla, - pub selection: Hsla, - pub scroll_thumb: Hsla, -} - -impl Global for Palette {} - -fn hex(value: u32) -> Hsla { - rgb(value).into() -} - -fn hexa(value: u32) -> Hsla { - rgba(value).into() -} - -impl Palette { - pub fn dark() -> Self { - Palette { - dark: true, - bg: hex(0x151515), - sidebar: hex(0x111111), - surface_2: hex(0x20201f), - surface_hover: hex(0x262625), - border: hexa(0xffffff1a), - border_soft: hexa(0xffffff14), - text: hex(0xffffff), - text_muted: hex(0xc3c2b7), - text_faint: hex(0x898781), - accent: hex(0xc6613f), - sidebar_text: hex(0xc3c2b7), - row_hover: hexa(0xffffff13), - row_active: hexa(0xffffff1a), - composer_bg: hex(0x20201f), - composer_ring: hexa(0xffffff1a), - composer_ring_hover: hexa(0xffffff33), - menu_bg: hex(0x20201f), - fill: hexa(0xffffff0d), - add: hex(0x32d74b), - del: hex(0xff2c56), - link: hex(0x6da7ec), - focus_ring: hex(0x5598e7), - danger: hex(0xe5484d), - warning: hex(0xe2b03f), - success: hex(0x4caf7d), - selection: hex(0x3d3d3d), - scroll_thumb: hexa(0xe1e0d959), - } - } - - pub fn light() -> Self { - Palette { - dark: false, - bg: hex(0xf8f8f6), - sidebar: hex(0xf7f7f4), - surface_2: hex(0xefeee7), - surface_hover: hex(0xefeeeb), - border: hex(0xdddddd), - border_soft: hexa(0x00000014), - text: hex(0x121212), - text_muted: hex(0x3d3d3a), - text_faint: hex(0x7b7974), - accent: hex(0xc9663f), - sidebar_text: hex(0x3d3d3a), - row_hover: hexa(0x0000000f), - row_active: hexa(0x00000014), - composer_bg: hex(0xffffff), - composer_ring: hexa(0x0000001a), - composer_ring_hover: hexa(0x00000033), - menu_bg: hex(0xffffff), - fill: hexa(0x1f1e1d0b), - add: hex(0x15803d), - del: hex(0xd1243f), - link: hex(0x2a78d6), - focus_ring: hex(0x5598e7), - danger: hex(0xd1243f), - warning: hex(0xb7791f), - success: hex(0x15803d), - selection: hex(0xd8d6cc), - scroll_thumb: hexa(0x1f1e1d40), - } - } - - pub fn for_appearance(appearance: WindowAppearance) -> Self { - match appearance { - WindowAppearance::Dark | WindowAppearance::VibrantDark => Palette::dark(), - WindowAppearance::Light | WindowAppearance::VibrantLight => Palette::light(), - } - } -} - -pub fn palette(cx: &App) -> Palette { - *cx.global::<Palette>() -} - -pub fn apply(appearance: WindowAppearance, window: Option<&mut Window>, cx: &mut App) { - let palette = Palette::for_appearance(appearance); - cx.set_global(palette); - let mode = if palette.dark { ThemeMode::Dark } else { ThemeMode::Light }; - Theme::change(mode, window, cx); - Theme::update(cx, |theme| { - theme.font_family = FONT.into(); - theme.font_size = px(14.); - theme.radius = px(8.); - theme.radius_lg = px(12.); - theme.shadow = false; - let colors = &mut theme.colors; - colors.background = palette.bg; - colors.foreground = palette.text; - colors.border = palette.border; - colors.input = palette.border; - colors.caret = palette.text; - colors.selection = palette.selection; - colors.ring = palette.focus_ring; - colors.muted = palette.surface_2; - colors.muted_foreground = palette.text_faint; - colors.accent = palette.row_hover; - colors.accent_foreground = palette.text; - colors.popover = palette.menu_bg; - colors.popover_foreground = palette.text; - colors.primary = palette.text; - colors.primary_foreground = palette.bg; - colors.secondary = palette.fill; - colors.secondary_foreground = palette.text; - colors.secondary_hover = palette.row_hover; - colors.secondary_active = palette.row_active; - colors.list = palette.bg; - colors.list_hover = palette.row_hover; - colors.list_active = palette.row_active; - colors.list_active_border = transparent_black(); - colors.link = palette.link; - colors.danger = palette.danger; - colors.warning = palette.warning; - colors.success = palette.success; - colors.title_bar = palette.sidebar; - colors.title_bar_border = palette.sidebar; - colors.sidebar = palette.sidebar; - colors.sidebar_foreground = palette.sidebar_text; - colors.sidebar_border = palette.sidebar; - colors.sidebar_accent = palette.row_hover; - colors.sidebar_accent_foreground = palette.text; - colors.window_border = palette.border; - colors.scrollbar = transparent_black(); - colors.scrollbar_thumb = palette.scroll_thumb; - colors.scrollbar_thumb_hover = palette.scroll_thumb; - }); -} \ No newline at end of file diff --git a/crates/quill-code/src/panel.rs b/crates/quill-code/src/panel.rs deleted file mode 100644 index 58f5f64..0000000 --- a/crates/quill-code/src/panel.rs +++ /dev/null @@ -1,513 +0,0 @@ -use std::collections::{HashMap, HashSet}; -use std::fs; -use std::path::{Path, PathBuf}; - -use gpui_kit::component::input::{Input, InputEvent, InputState}; -use gpui_kit::{ - Context, Entity, EventEmitter, FontWeight, IntoElement, ParentElement, Render, SharedString, Styled, Subscription, Window, div, - prelude::*, px, uniform_list, -}; -use quill_agent::FileDiff; - -use crate::icons::Icon; -use crate::palette::{Palette, palette}; -use crate::thread_view::{diff_lines, file_icon}; -use crate::ui::{MONO, icon}; - -const SKIP: [&str; 6] = [".git", "node_modules", "target", ".venv", "__pycache__", ".next"]; - -#[derive(Clone, Copy, PartialEq, Eq)] -pub enum Tab { - Diff, - Files, -} - -pub struct ClosePanel; - -struct Entry { - name: String, - path: PathBuf, - dir: bool, -} - -struct OpenFile { - path: PathBuf, - lines: Vec<SharedString>, - note: Option<String>, -} - -struct DiffFile { - path: String, - added: usize, - removed: usize, - created: bool, - blocks: Vec<FileDiff>, -} - -pub struct Panel { - pub tab: Tab, - root: Option<PathBuf>, - title: String, - files: Vec<DiffFile>, - collapsed: HashSet<String>, - expanded: HashSet<PathBuf>, - listing: HashMap<PathBuf, Vec<Entry>>, - open: Option<OpenFile>, - search: Entity<InputState>, - query: String, - matches: Vec<PathBuf>, - _subscription: Subscription, -} - -impl EventEmitter<ClosePanel> for Panel {} - -fn read_dir(dir: &Path) -> Vec<Entry> { - let Ok(read) = fs::read_dir(dir) else { return Vec::new() }; - let mut entries: Vec<Entry> = read - .filter_map(Result::ok) - .map(|e| Entry { name: e.file_name().to_string_lossy().into_owned(), path: e.path(), dir: e.file_type().is_ok_and(|t| t.is_dir()) }) - .filter(|e| !(e.dir && SKIP.contains(&e.name.as_str()))) - .collect(); - entries.sort_by(|a, b| b.dir.cmp(&a.dir).then_with(|| a.name.to_lowercase().cmp(&b.name.to_lowercase()))); - entries.truncate(1000); - entries -} - -fn collect(dir: &Path, needle: &str, out: &mut Vec<PathBuf>) { - for entry in read_dir(dir) { - if out.len() >= 300 { - return; - } - if entry.dir { - collect(&entry.path, needle, out); - } else if entry.name.to_lowercase().contains(needle) { - out.push(entry.path); - } - } -} - -impl Panel { - pub fn new(window: &mut Window, cx: &mut Context<Self>) -> Self { - let search = cx.new(|cx| InputState::new(window, cx).placeholder("Search files")); - let subscription = cx.subscribe(&search, |this, search, event: &InputEvent, cx| { - if let InputEvent::Change = event { - this.query = search.read(cx).value().trim().to_lowercase(); - this.matches.clear(); - if let (Some(root), false) = (this.root.clone(), this.query.is_empty()) { - collect(&root, &this.query.clone(), &mut this.matches); - } - cx.notify(); - } - }); - Panel { - tab: Tab::Diff, - root: None, - title: String::new(), - files: Vec::new(), - collapsed: HashSet::new(), - expanded: HashSet::new(), - listing: HashMap::new(), - open: None, - search, - query: String::new(), - matches: Vec::new(), - _subscription: subscription, - } - } - - pub fn set_root(&mut self, root: Option<PathBuf>, cx: &mut Context<Self>) { - if self.root != root { - self.root = root; - self.listing.clear(); - self.expanded.clear(); - self.open = None; - } - cx.notify(); - } - - pub fn show_diff(&mut self, title: String, diffs: Vec<FileDiff>, cx: &mut Context<Self>) { - let mut files: Vec<DiffFile> = Vec::new(); - for diff in diffs { - match files.iter_mut().find(|f| f.path == diff.path) { - Some(file) => { - file.added += diff.added; - file.removed += diff.removed; - file.blocks.push(diff); - } - None => files.push(DiffFile { - path: diff.path.clone(), - added: diff.added, - removed: diff.removed, - created: diff.created, - blocks: vec![diff], - }), - } - } - self.files = files; - self.title = title; - self.collapsed.clear(); - self.tab = Tab::Diff; - cx.notify(); - } - - pub fn show_files(&mut self, cx: &mut Context<Self>) { - self.tab = Tab::Files; - self.listing.clear(); - cx.notify(); - } - - fn select(&mut self, tab: Tab, cx: &mut Context<Self>) { - self.tab = tab; - cx.notify(); - } - - fn toggle_dir(&mut self, path: PathBuf, cx: &mut Context<Self>) { - if !self.expanded.remove(&path) { - self.expanded.insert(path); - } - cx.notify(); - } - - fn open_file(&mut self, path: PathBuf, cx: &mut Context<Self>) { - let (lines, note) = match fs::read(&path) { - Ok(bytes) if bytes.iter().take(8192).any(|b| *b == 0) => (Vec::new(), Some("This is a binary file.".to_string())), - Ok(bytes) => { - let text = String::from_utf8_lossy(&bytes); - let lines: Vec<SharedString> = text.lines().take(20_000).map(|l| SharedString::from(l.replace('\t', " "))).collect(); - let note = (text.lines().count() > 20_000).then(|| "Showing the first 20,000 lines.".to_string()); - (lines, note) - } - Err(e) => (Vec::new(), Some(e.to_string())), - }; - self.open = Some(OpenFile { path, lines, note }); - cx.notify(); - } - - fn entries(&mut self, dir: &Path) -> &Vec<Entry> { - self.listing.entry(dir.to_path_buf()).or_insert_with(|| read_dir(dir)) - } - - fn tree_rows(&mut self, dir: PathBuf, depth: usize, rows: &mut Vec<(PathBuf, String, bool, usize)>) { - let children: Vec<(PathBuf, String, bool)> = self.entries(&dir).iter().map(|e| (e.path.clone(), e.name.clone(), e.dir)).collect(); - for (path, name, is_dir) in children { - if rows.len() > 2000 { - return; - } - rows.push((path.clone(), name, is_dir, depth)); - if is_dir && self.expanded.contains(&path) { - self.tree_rows(path, depth + 1, rows); - } - } - } - - fn tab_button(&self, tab: Tab, name: Icon, label: &'static str, p: Palette, cx: &mut Context<Self>) -> impl IntoElement + use<> { - let on = self.tab == tab; - div() - .id(label) - .flex() - .items_center() - .gap(px(6.)) - .h(px(28.)) - .px(px(10.)) - .rounded(px(8.)) - .text_size(px(13.)) - .text_color(if on { p.text } else { p.text_faint }) - .when(on, |b| b.bg(p.row_active)) - .cursor_pointer() - .hover(move |style| style.text_color(p.text)) - .child(icon(name, 14., if on { p.text } else { p.text_faint })) - .child(label) - .on_click(cx.listener(move |this, _, _, cx| this.select(tab, cx))) - } - - fn diff_tab(&self, p: Palette, cx: &mut Context<Self>) -> impl IntoElement + use<> { - let added: usize = self.files.iter().map(|f| f.added).sum(); - let removed: usize = self.files.iter().map(|f| f.removed).sum(); - let header = div() - .flex() - .items_center() - .gap(px(8.)) - .px(px(14.)) - .py(px(10.)) - .border_b_1() - .border_color(p.border_soft) - .text_size(px(13.)) - .child(div().font_weight(FontWeight::SEMIBOLD).text_color(p.text).child(self.title.clone())) - .child(div().flex_1()) - .child(div().text_color(p.add).child(format!("+{added}"))) - .child(div().text_color(p.del).child(format!("-{removed}"))); - let body = if self.files.is_empty() { - div() - .p(px(24.)) - .text_size(px(13.5)) - .text_color(p.text_faint) - .child("Nothing to review yet. Every file the agent touches shows up here.") - } else { - div().flex().flex_col().children(self.files.iter().map(|file| { - let path = file.path.clone(); - let collapsed = self.collapsed.contains(&file.path); - div() - .flex() - .flex_col() - .border_b_1() - .border_color(p.border_soft) - .child( - div() - .id(SharedString::from(format!("diff-file-{}", file.path))) - .flex() - .items_center() - .gap(px(8.)) - .px(px(12.)) - .py(px(8.)) - .cursor_pointer() - .hover(move |style| style.bg(p.row_hover)) - .child(icon(if collapsed { Icon::ChevronRight } else { Icon::ChevronDown }, 14., p.text_faint)) - .child(icon( - if file.created { Icon::FilePlus } else { Icon::FileDiff }, - 15., - if file.created { p.add } else { p.text_muted }, - )) - .child( - div().flex_1().min_w_0().font_family(MONO).text_size(px(13.)).text_color(p.text).child(file.path.clone()), - ) - .child(div().text_size(px(12.5)).text_color(p.add).child(format!("+{}", file.added))) - .child(div().text_size(px(12.5)).text_color(p.del).child(format!("-{}", file.removed))) - .on_click(cx.listener(move |this, _, _, cx| { - if !this.collapsed.remove(&path) { - this.collapsed.insert(path.clone()); - } - cx.notify(); - })), - ) - .when(!collapsed, |col| { - col.children(file.blocks.iter().enumerate().map(|(i, block)| { - div().when(i > 0, |d| d.border_t_1().border_color(p.border_soft)).pb(px(6.)).child(diff_lines(block, 3000, p)) - })) - }) - })) - }; - div().size_full().flex().flex_col().child(header).child(div().id("diff-scroll").flex_1().min_h_0().overflow_y_scroll().child(body)) - } - - fn files_tab(&mut self, p: Palette, cx: &mut Context<Self>) -> impl IntoElement + use<> { - let Some(root) = self.root.clone() else { - return div() - .p(px(24.)) - .text_size(px(13.5)) - .text_color(p.text_faint) - .child("Pick a project to browse its files.") - .into_any_element(); - }; - if let Some(open) = &self.open { - let rel = open.path.strip_prefix(&root).map_or_else(|_| open.path.display().to_string(), |r| r.display().to_string()); - let count = open.lines.len(); - let width = count.to_string().len().max(2) as f32 * 8.5 + 16.; - let lines = open.lines.clone(); - return div() - .size_full() - .flex() - .flex_col() - .child( - div() - .flex() - .items_center() - .gap(px(6.)) - .px(px(10.)) - .py(px(8.)) - .border_b_1() - .border_color(p.border_soft) - .text_size(px(13.)) - .child( - div() - .id("file-back") - .flex() - .items_center() - .gap(px(4.)) - .px(px(6.)) - .h(px(24.)) - .rounded(px(6.)) - .text_color(p.text_faint) - .cursor_pointer() - .hover(move |style| style.bg(p.row_hover).text_color(p.text)) - .child(icon(Icon::ArrowLeft, 13., p.text_faint)) - .child(crate::project::name(&root)) - .on_click(cx.listener(|this, _, _, cx| { - this.open = None; - cx.notify(); - })), - ) - .child(icon(Icon::ChevronRight, 12., p.text_faint)) - .child(div().font_weight(FontWeight::SEMIBOLD).text_color(p.text).child(rel.replace('\\', "/"))), - ) - .when_some(open.note.clone(), |col, note| { - col.child(div().px(px(14.)).py(px(8.)).text_size(px(12.5)).text_color(p.text_faint).child(note)) - }) - .child( - uniform_list("file-lines", count, move |range, _, _| { - range - .map(|n| { - div() - .flex() - .h(px(20.)) - .font_family(MONO) - .text_size(px(12.5)) - .child( - div() - .w(px(width)) - .flex_shrink_0() - .pr(px(12.)) - .flex() - .justify_end() - .text_color(p.text_faint) - .child((n + 1).to_string()), - ) - .child(div().whitespace_nowrap().text_color(p.text).child(lines[n].clone())) - }) - .collect() - }) - .flex_1() - .py(px(6.)), - ) - .into_any_element(); - } - let mut rows = Vec::new(); - if self.query.is_empty() { - self.tree_rows(root.clone(), 0, &mut rows); - } else { - rows = self - .matches - .iter() - .map(|path| { - ( - path.clone(), - path.strip_prefix(&root) - .map_or_else(|_| path.display().to_string(), |r| r.display().to_string().replace('\\', "/")), - false, - 0, - ) - }) - .collect(); - } - let expanded = self.expanded.clone(); - div() - .size_full() - .flex() - .flex_col() - .child( - div() - .flex() - .items_center() - .gap(px(6.)) - .px(px(10.)) - .py(px(8.)) - .border_b_1() - .border_color(p.border_soft) - .child(div().flex_1().child(Input::new(&self.search).appearance(false).prefix(icon(Icon::Search, 14., p.text_faint)))) - .child( - div() - .id("refresh-files") - .size(px(26.)) - .flex() - .items_center() - .justify_center() - .rounded(px(6.)) - .cursor_pointer() - .hover(move |style| style.bg(p.row_hover)) - .child(icon(Icon::Refresh, 13., p.text_faint)) - .on_click(cx.listener(|this, _, _, cx| { - this.listing.clear(); - cx.notify(); - })), - ), - ) - .child( - div() - .id("tree-scroll") - .flex_1() - .min_h_0() - .overflow_y_scroll() - .py(px(4.)) - .when(rows.is_empty(), |list| { - list.child(div().p(px(16.)).text_size(px(13.)).text_color(p.text_faint).child(if self.query.is_empty() { - "Nothing in this folder yet." - } else { - "No file names match." - })) - }) - .children(rows.into_iter().enumerate().map(|(i, (path, name, is_dir, depth))| { - let open_dir = expanded.contains(&path); - let icon_name = if is_dir { if open_dir { Icon::FolderOpen } else { Icon::Folder } } else { file_icon(&name) }; - div() - .id(("tree-row", i)) - .flex() - .items_center() - .gap(px(6.)) - .h(px(28.)) - .pl(px(10. + depth as f32 * 14.)) - .pr(px(10.)) - .mx(px(4.)) - .rounded(px(6.)) - .text_size(px(13.)) - .text_color(p.text_muted) - .cursor_pointer() - .hover(move |style| style.bg(p.row_hover).text_color(p.text)) - .child(div().w(px(12.)).when(is_dir, |d| { - d.child(icon(if open_dir { Icon::ChevronDown } else { Icon::ChevronRight }, 12., p.text_faint)) - })) - .child(icon(icon_name, 15., p.text_faint)) - .child(div().min_w_0().whitespace_nowrap().overflow_hidden().text_ellipsis().child(name)) - .on_click(cx.listener(move |this, _, _, cx| { - if is_dir { - this.toggle_dir(path.clone(), cx); - } else { - this.open_file(path.clone(), cx); - } - })) - })), - ) - .into_any_element() - } -} - -impl Render for Panel { - fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement { - let p = palette(cx); - let body = match self.tab { - Tab::Diff => self.diff_tab(p, cx).into_any_element(), - Tab::Files => self.files_tab(p, cx).into_any_element(), - }; - div() - .size_full() - .flex() - .flex_col() - .bg(p.bg) - .child( - div() - .flex() - .items_center() - .gap(px(4.)) - .h(px(44.)) - .flex_shrink_0() - .px(px(8.)) - .border_b_1() - .border_color(p.border_soft) - .child(self.tab_button(Tab::Diff, Icon::FileDiff, "Review", p, cx)) - .child(self.tab_button(Tab::Files, Icon::Files, "Files", p, cx)) - .child(div().flex_1()) - .child( - div() - .id("close-panel") - .size(px(28.)) - .flex() - .items_center() - .justify_center() - .rounded(px(7.)) - .cursor_pointer() - .hover(move |style| style.bg(p.row_hover)) - .child(icon(Icon::X, 15., p.text_faint)) - .on_click(cx.listener(|_, _, _, cx| cx.emit(ClosePanel))), - ), - ) - .child(div().flex_1().min_h_0().child(body)) - } -} \ No newline at end of file diff --git a/crates/quill-code/src/picker.rs b/crates/quill-code/src/picker.rs new file mode 100644 index 0000000..3512155 --- /dev/null +++ b/crates/quill-code/src/picker.rs @@ -0,0 +1,197 @@ +use crossterm::event::{KeyCode, KeyEvent, KeyModifiers}; + +use crate::text::{Line, accent, bold, dim, good, pad, plain, truncate}; + +pub struct Choice<T> { + pub label: String, + pub detail: String, + pub value: T, + pub current: bool, +} + +impl<T> Choice<T> { + pub fn new(label: impl Into<String>, detail: impl Into<String>, value: T) -> Choice<T> { + Choice { label: label.into(), detail: detail.into(), value, current: false } + } + + pub fn current(mut self, current: bool) -> Choice<T> { + self.current = current; + self + } +} + +pub struct Picker<T> { + pub title: String, + pub hint: String, + pub choices: Vec<Choice<T>>, + pub query: String, + pub note: Option<Line>, + filter: bool, + selected: usize, +} + +#[derive(Debug, PartialEq, Eq)] +pub enum Picked { + Nothing, + Chosen(usize), + Closed, +} + +impl<T> Picker<T> { + pub fn new(title: impl Into<String>, choices: Vec<Choice<T>>) -> Picker<T> { + let selected = choices.iter().position(|choice| choice.current).unwrap_or(0); + let filter = choices.len() > 9; + let hint = if filter { + "type to filter · ↑↓ move · enter choose · esc close" + } else { + "↑↓ or a number · enter choose · esc close" + }; + Picker { title: title.into(), hint: hint.into(), choices, query: String::new(), note: None, filter, selected } + } + + pub fn hint(mut self, hint: impl Into<String>) -> Picker<T> { + self.hint = hint.into(); + self + } + + pub fn filtered(mut self, filter: bool) -> Picker<T> { + self.filter = filter; + self + } + + pub fn visible(&self) -> Vec<usize> { + let query = self.query.to_lowercase(); + self.choices + .iter() + .enumerate() + .filter(|(_, choice)| { + query.is_empty() || choice.label.to_lowercase().contains(&query) || choice.detail.to_lowercase().contains(&query) + }) + .map(|(index, _)| index) + .collect() + } + + pub fn highlighted(&self) -> Option<usize> { + self.visible().get(self.selected).copied() + } + + pub fn paste(&mut self, text: &str) { + if self.filter { + self.query.push_str(text.lines().next().unwrap_or_default().trim()); + self.selected = 0; + } + } + + pub fn select(&mut self, index: usize) { + if let Some(position) = self.visible().iter().position(|visible| *visible == index) { + self.selected = position; + } + } + + pub fn key(&mut self, key: KeyEvent) -> Picked { + let count = self.visible().len(); + let control = key.modifiers.intersects(KeyModifiers::CONTROL | KeyModifiers::ALT); + match key.code { + KeyCode::Esc => return Picked::Closed, + KeyCode::Enter => return self.highlighted().map_or(Picked::Nothing, Picked::Chosen), + KeyCode::Up if count > 0 => self.selected = self.selected.checked_sub(1).unwrap_or(count - 1), + KeyCode::Down | KeyCode::Tab if count > 0 => self.selected = (self.selected + 1) % count, + KeyCode::PageUp => self.selected = self.selected.saturating_sub(8), + KeyCode::PageDown if count > 0 => self.selected = (self.selected + 8).min(count - 1), + KeyCode::Home => self.selected = 0, + KeyCode::End => self.selected = count.saturating_sub(1), + KeyCode::Backspace if self.filter => { + self.query.pop(); + self.selected = 0; + } + KeyCode::Char(c) if self.filter && !control => { + self.query.push(c); + self.selected = 0; + } + KeyCode::Char(c) if !self.filter && !control => { + let index = c.to_digit(10).and_then(|n| (n as usize).checked_sub(1)).and_then(|n| self.visible().get(n).copied()); + return index.map_or(Picked::Nothing, Picked::Chosen); + } + _ => {} + } + Picked::Nothing + } + + pub fn render(&self, width: usize, rows: usize) -> Vec<Line> { + let visible = self.visible(); + let mut lines = vec![truncate(&Line::styled(&self.title, bold()), width)]; + if self.filter { + let query = if self.query.is_empty() { + Line::styled(" type to filter", dim()) + } else { + Line::styled(" › ", accent()).with(&self.query, plain()) + }; + lines.push(query); + } + let rows = rows.max(3); + let start = self.selected.saturating_sub(rows / 2).min(visible.len().saturating_sub(rows)); + let label_width = visible.iter().map(|index| self.choices[*index].label.chars().count()).max().unwrap_or(0).min(width / 2); + for (position, index) in visible.iter().enumerate().skip(start).take(rows) { + let choice = &self.choices[*index]; + let on = position == self.selected; + let mut line = if on { Line::styled("▸ ", accent()) } else { Line::plain(" ") }; + if !self.filter { + line.push(format!("{}. ", position + 1), dim()); + } + line.push(if choice.current { "✓ " } else { " " }, good()); + line.push(pad(&choice.label, label_width), if on { bold() } else { plain() }); + if !choice.detail.is_empty() { + line.push(format!(" {}", choice.detail), dim()); + } + lines.push(truncate(&line, width)); + } + if visible.is_empty() { + lines.push(Line::styled(" Nothing matches", dim())); + } else if visible.len() > rows { + lines.push(Line::styled(format!(" {} of {}", self.selected + 1, visible.len()), dim())); + } + if let Some(note) = &self.note { + lines.push(truncate(note, width)); + } + lines.push(truncate(&Line::styled(&self.hint, dim()), width)); + lines + } +} + +#[cfg(test)] +mod tests { + use super::*; + + fn picker(count: usize) -> Picker<usize> { + Picker::new("Pick", (0..count).map(|n| Choice::new(format!("item {n}"), "", n).current(n == 1)).collect()) + } + + fn press(picker: &mut Picker<usize>, code: KeyCode) -> Picked { + picker.key(KeyEvent::new(code, KeyModifiers::NONE)) + } + + #[test] + fn the_current_choice_starts_highlighted() { + let mut short = picker(3); + assert_eq!(press(&mut short, KeyCode::Enter), Picked::Chosen(1)); + press(&mut short, KeyCode::Down); + press(&mut short, KeyCode::Down); + assert_eq!(press(&mut short, KeyCode::Enter), Picked::Chosen(0)); + assert_eq!(press(&mut short, KeyCode::Char('3')), Picked::Chosen(2)); + assert_eq!(press(&mut short, KeyCode::Esc), Picked::Closed); + } + + #[test] + fn long_lists_filter_as_you_type() { + let mut long = picker(12); + for c in "item 1".chars() { + press(&mut long, KeyCode::Char(c)); + } + assert_eq!(long.visible(), vec![1, 10, 11]); + press(&mut long, KeyCode::Down); + assert_eq!(press(&mut long, KeyCode::Enter), Picked::Chosen(10)); + let lines: Vec<String> = long.render(40, 5).iter().map(Line::text).collect(); + assert_eq!(lines[1], " › item 1"); + assert!(lines.iter().any(|line| line.starts_with("▸ ") && line.contains("item 10"))); + } +} \ No newline at end of file diff --git a/crates/quill-code/src/project.rs b/crates/quill-code/src/project.rs index d6c3684..20b5378 100644 --- a/crates/quill-code/src/project.rs +++ b/crates/quill-code/src/project.rs @@ -1,45 +1,44 @@ -use std::fs; use std::path::{Path, PathBuf}; use std::process::{Command, Stdio}; -use gpui_kit::{Hsla, hsla}; - -use crate::config::projects_dir; -use crate::git::{self, hidden}; -use crate::github::{self, Visibility}; +use quill_git::hidden; pub fn name(path: &Path) -> String { path.file_name().map(|n| n.to_string_lossy().into_owned()).unwrap_or_else(|| path.display().to_string()) } -pub fn initials(name: &str) -> String { - let words: Vec<&str> = name.split(|c: char| !c.is_alphanumeric()).filter(|w| !w.is_empty()).collect(); - let letters: String = match words.as_slice() { - [] => "?".into(), - [one] => one.chars().take(2).collect(), - [first, second, ..] => first.chars().take(1).chain(second.chars().take(1)).collect(), - }; - letters.to_lowercase() -} - -pub fn color(name: &str) -> Hsla { - hsla((crate::ui::name_hash(name) % 360) as f32 / 360., 0.55, 0.42, 1.) -} - pub fn git_available() -> bool { hidden("git").arg("--version").stdout(Stdio::null()).stderr(Stdio::null()).status().is_ok_and(|s| s.success()) } -pub fn editor_available() -> bool { - hidden("cmd").args(["/C", "where", "code"]).stdout(Stdio::null()).stderr(Stdio::null()).status().is_ok_and(|s| s.success()) +pub fn short_path(path: &Path) -> String { + let home = quill_config::home_dir(); + let shown = match path.strip_prefix(&home) { + Ok(rest) if !home.as_os_str().is_empty() => Path::new("~").join(rest), + _ => path.to_path_buf(), + }; + let parts: Vec<String> = shown.components().map(|c| c.as_os_str().to_string_lossy().into_owned()).collect(); + if parts.len() <= 4 { + return shown.display().to_string(); + } + let separator = std::path::MAIN_SEPARATOR_STR; + let head = if parts[0] == separator { "" } else { parts[0].as_str() }; + format!("{head}{separator}…{separator}{}", parts[parts.len() - 2..].join(separator)) +} + +fn key(path: &Path) -> String { + let text = path.to_string_lossy().replace('\\', "/"); + let text = text.trim_end_matches('/'); + if cfg!(windows) { text.to_lowercase() } else { text.to_string() } } -pub fn open_in_editor(path: &Path) { - let _ = hidden("cmd").args(["/C", "code"]).arg(path).spawn(); +pub fn same(a: &Path, b: &Path) -> bool { + key(a) == key(b) } -pub fn open_folder(path: &Path) { - let _ = Command::new("explorer").arg(path).spawn(); +pub fn within(path: &Path, folder: &Path) -> bool { + let (path, folder) = (key(path), key(folder)); + path == folder || path.starts_with(&format!("{folder}/")) } pub fn clean_name(raw: &str) -> String { @@ -51,62 +50,48 @@ pub fn clean_name(raw: &str) -> String { .to_string() } -pub struct Created { - pub path: PathBuf, - pub note: Option<String>, -} - -pub fn create(raw: &str, git_branch: Option<&str>, publish: Option<Visibility>) -> Result<Created, String> { - let name = clean_name(raw); - if name.is_empty() { - return Err("Give the project a name.".into()); - } - let dir = projects_dir().join(&name); - if dir.exists() { - return Err(format!("{} already exists.", dir.display())); - } - let repo = publish.map(|visibility| github::create_repo(&name, visibility)).transpose()?; - fs::create_dir_all(&dir).map_err(|e| e.to_string())?; - fs::write(dir.join("README.md"), format!("# {name}")).map_err(|e| e.to_string())?; - let Some(branch) = git_branch else { return Ok(Created { path: dir, note: None }) }; - git::init(&dir, branch, &format!("Start {name}"))?; - let note = repo.map(|repo| match git::add_remote(&dir, &repo.clone_url).and_then(|()| git::push(&dir, branch)) { - Ok(()) => format!("Published to {}", repo.html_url), - Err(error) => format!("Created on GitHub, but the first push failed: {error}"), - }); - Ok(Created { path: dir, note }) +pub fn open_url(url: &str) { + let mut command = if cfg!(windows) { + let mut command = Command::new("explorer"); + command.arg(url); + command + } else if cfg!(target_os = "macos") { + let mut command = Command::new("open"); + command.arg(url); + command + } else { + let mut command = Command::new("xdg-open"); + command.arg(url); + command + }; + let _ = command.stdin(Stdio::null()).stdout(Stdio::null()).stderr(Stdio::null()).spawn(); } -pub fn repo_name(url: &str) -> String { - let last = url.trim().trim_end_matches('/').rsplit(['/', ':']).next().unwrap_or_default(); - clean_name(last.trim_end_matches(".git")) +pub fn edit(path: &Path) -> Result<(), String> { + let editor = std::env::var("VISUAL") + .or_else(|_| std::env::var("EDITOR")) + .ok() + .filter(|editor| !editor.trim().is_empty()) + .unwrap_or_else(|| if cfg!(windows) { "notepad".into() } else { "vi".into() }); + let mut words = editor.split_whitespace(); + let program = words.next().unwrap_or_default(); + let mut command = if cfg!(windows) { + let mut command = Command::new("cmd"); + command.arg("/C").arg(program); + command + } else { + Command::new(program) + }; + let status = command + .args(words) + .arg(path) + .status() + .map_err(|e| format!("{program} could not start: {e}. Set VISUAL or EDITOR to your editor."))?; + if status.success() { Ok(()) } else { Err(format!("{program} exited with {status}.")) } } -pub fn clone(url: &str) -> Result<PathBuf, String> { - let name = repo_name(url); - if name.is_empty() { - return Err("That does not look like a Git URL.".into()); - } - let base = projects_dir(); - fs::create_dir_all(&base).map_err(|e| e.to_string())?; - let mut dir = base.join(&name); - let mut n = 2; - while dir.exists() { - dir = base.join(format!("{name}-{n}")); - n += 1; - } - let output = hidden("git") - .args(["clone", "--", url.trim()]) - .arg(&dir) - .env("GIT_TERMINAL_PROMPT", "0") - .output() - .map_err(|e| format!("Git could not start: {e}"))?; - if output.status.success() { - Ok(dir) - } else { - let error = String::from_utf8_lossy(&output.stderr); - Err(error.lines().rfind(|l| !l.trim().is_empty()).unwrap_or("The clone failed.").trim().to_string()) - } +pub fn absolute(path: &Path) -> PathBuf { + std::path::absolute(path).unwrap_or_else(|_| path.to_path_buf()) } #[cfg(test)] @@ -114,22 +99,29 @@ mod tests { use super::*; #[test] - fn initials_come_from_words() { - assert_eq!(initials("quill-probe"), "qp"); - assert_eq!(initials("website"), "we"); - assert_eq!(initials(""), "?"); + fn names_are_made_safe_for_folders() { + assert_eq!(clean_name(" My App! "), "My-App"); + assert_eq!(clean_name("../x"), "x"); } #[test] - fn repo_names_come_from_urls() { - assert_eq!(repo_name("https://github.com/ggml-org/llama.cpp.git"), "llama.cpp"); - assert_eq!(repo_name("git@github.com:me/tool.git"), "tool"); - assert_eq!(repo_name("https://example.com/a/b/"), "b"); + fn folders_contain_their_subfolders() { + assert!(within(Path::new("/work/app/src"), Path::new("/work/app"))); + assert!(within(Path::new("/work/app"), Path::new("/work/app/"))); + assert!(!within(Path::new("/work/apple"), Path::new("/work/app"))); } #[test] - fn names_are_made_safe_for_folders() { - assert_eq!(clean_name(" My App! "), "My-App"); - assert_eq!(clean_name("../x"), "x"); + fn paths_compare_the_way_the_system_does() { + assert!(same(Path::new("/work/app/"), Path::new("/work/app"))); + assert_eq!(same(Path::new("C:\\Work\\App"), Path::new("c:/work/app")), cfg!(windows)); + assert!(!same(Path::new("/work/app"), Path::new("/work/other"))); + } + + #[test] + fn long_paths_are_shortened() { + let separator = std::path::MAIN_SEPARATOR_STR; + assert_eq!(short_path(Path::new("/a/b/c/d/e/f")), format!("{separator}…{separator}e{separator}f")); + assert_eq!(short_path(Path::new("/a/b")), Path::new("/a/b").display().to_string()); } } \ No newline at end of file diff --git a/crates/quill-code/src/publish.rs b/crates/quill-code/src/publish.rs deleted file mode 100644 index 362a619..0000000 --- a/crates/quill-code/src/publish.rs +++ /dev/null @@ -1,35 +0,0 @@ -use std::path::Path; - -use quill_agent::Publisher; - -use crate::{git, github}; - -pub struct GitPublisher; - -impl Publisher for GitPublisher { - fn commit(&self, root: &Path, message: &str, branch: Option<&str>) -> Result<String, String> { - if let Some(branch) = branch.filter(|b| git::branch(root).as_deref() != Some(*b)) { - if !git::valid_branch(branch) { - return Err(format!("\"{branch}\" is not a branch name Git accepts.")); - } - git::create_branch(root, branch).or_else(|_| git::switch_branch(root, branch))?; - } - let sha = git::commit_all(root, message)?; - let on = git::branch(root).unwrap_or_else(|| "a detached HEAD".into()); - Ok(format!("Committed {sha} on {on}.")) - } - - fn open_pull_request(&self, root: &Path, title: &str, body: &str) -> Result<String, String> { - let branch = git::branch(root).ok_or("Not on a branch. Commit to a new branch with commit_changes first.")?; - let base = git::default_branch(root); - if branch == base { - return Err(format!("You are on {base}, the main branch. Commit the work to a new branch with commit_changes first.")); - } - let remote = - git::remote_url(root).ok_or("This repository has no remote called origin, so there is nowhere to open a pull request.")?; - let slug = git::github_slug(&remote).ok_or("Pull requests can only be opened for repositories on GitHub.")?; - git::push(root, &branch)?; - let url = github::create_pull_request(&slug, &branch, &base, title, body)?; - Ok(format!("Pushed {branch} and opened a pull request into {base}: {url}")) - } -} \ No newline at end of file diff --git a/crates/quill-code/src/settings.rs b/crates/quill-code/src/settings.rs deleted file mode 100644 index 6da5647..0000000 --- a/crates/quill-code/src/settings.rs +++ /dev/null @@ -1,526 +0,0 @@ -use std::time::Duration; - -use gpui_kit::component::input::{Input, InputEvent, InputState, Textarea, TextareaState}; -use gpui_kit::component::switch::Switch; -use gpui_kit::{ - AnyElement, Context, Div, Entity, EventEmitter, FontWeight, IntoElement, ParentElement, Render, SharedString, Styled, Subscription, - Window, div, prelude::*, px, svg, -}; -use quill_agent::Access; -use quill_llama::{Status, context_label}; - -use crate::backend::{Backend, Connection}; -use crate::composer::access_icon; -use crate::config::{Config, personal_instructions_path, read_personal_instructions, write_personal_instructions}; -use crate::icons::Icon; -use crate::palette::{Palette, palette}; -use crate::project; -use crate::ui::{badge, icon, page}; -use crate::version::VersionPage; - -#[derive(Clone, Copy, PartialEq, Eq)] -pub enum Section { - General, - Models, - Instructions, - Projects, - Version, -} - -impl Section { - const ALL: [Section; 5] = [Section::General, Section::Models, Section::Instructions, Section::Projects, Section::Version]; - - fn label(self) -> &'static str { - match self { - Section::General => "General", - Section::Models => "Models", - Section::Instructions => "Instructions", - Section::Projects => "Projects", - Section::Version => "Version", - } - } - - fn icon(self) -> Icon { - match self { - Section::General => Icon::Sliders, - Section::Models => Icon::Cube, - Section::Instructions => Icon::FileText, - Section::Projects => Icon::Folder, - Section::Version => Icon::Info, - } - } -} - -pub enum SettingsEvent { - Back, - AddProject, -} - -pub struct Settings { - pub section: Section, - backend: Entity<Backend>, - url: Entity<InputState>, - instructions: Entity<TextareaState>, - version: Entity<VersionPage>, - saved: Option<Result<(), SharedString>>, - _subscriptions: Vec<Subscription>, -} - -impl EventEmitter<SettingsEvent> for Settings {} - -impl Settings { - pub fn new(backend: Entity<Backend>, window: &mut Window, cx: &mut Context<Self>) -> Self { - let url_text = Backend::url(cx); - let url = cx.new(|cx| InputState::new(window, cx).placeholder("http://127.0.0.1:9931").default_value(url_text)); - let instructions = cx.new(|cx| { - TextareaState::new(window, cx) - .placeholder("For example: Prefer small, focused changes. Explain risky changes before making them.") - .auto_grow(8, 28) - .default_value(read_personal_instructions()) - }); - let subscriptions = vec![ - cx.subscribe_in(&url, window, |this, _, event: &InputEvent, _, cx| { - if let InputEvent::PressEnter { .. } = event { - this.connect(cx); - } - }), - cx.observe(&backend, |_, _, cx| cx.notify()), - ]; - Settings { - section: Section::General, - backend, - url, - instructions, - version: cx.new(VersionPage::new), - saved: None, - _subscriptions: subscriptions, - } - } - - pub fn open(&mut self, section: Section, cx: &mut Context<Self>) { - self.section = section; - if section == Section::Models { - self.backend.update(cx, |b, cx| b.refresh(cx)); - } - cx.notify(); - } - - fn connect(&mut self, cx: &mut Context<Self>) { - let url = self.url.read(cx).value().to_string(); - if !url.trim().is_empty() { - self.backend.update(cx, |backend, cx| backend.set_url(&url, cx)); - } - } - - fn save_instructions(&mut self, cx: &mut Context<Self>) { - let text = self.instructions.read(cx).value().to_string(); - self.saved = Some(write_personal_instructions(&text).map_err(|e| e.to_string().into())); - cx.notify(); - cx.spawn(async move |this, cx| { - cx.background_executor().timer(Duration::from_millis(1600)).await; - _ = this.update(cx, |this, cx| { - if matches!(this.saved, Some(Ok(()))) { - this.saved = None; - cx.notify(); - } - }); - }) - .detach(); - } - - fn nav(&self, p: Palette, cx: &mut Context<Self>) -> impl IntoElement + use<> { - div() - .w(px(248.)) - .h_full() - .flex_shrink_0() - .flex() - .flex_col() - .gap(px(1.)) - .px(px(8.)) - .pb(px(8.)) - .child( - div() - .px(px(10.)) - .pt(px(4.)) - .pb(px(12.)) - .text_size(px(16.)) - .font_weight(FontWeight::SEMIBOLD) - .text_color(p.text) - .child("Settings"), - ) - .children(Section::ALL.map(|section| { - let on = self.section == section; - div() - .id(section.label()) - .flex() - .items_center() - .gap(px(10.)) - .h(px(34.)) - .px(px(10.)) - .rounded(px(8.)) - .text_size(px(14.)) - .text_color(if on { p.text } else { p.sidebar_text }) - .cursor_pointer() - .when(on, |row| row.bg(p.row_active)) - .hover(move |style| style.bg(p.row_hover).text_color(p.text)) - .child(icon(section.icon(), 16., if on { p.text } else { p.sidebar_text })) - .child(section.label()) - .on_click(cx.listener(move |this, _, _, cx| this.open(section, cx))) - })) - .child(div().flex_1()) - .child( - div() - .id("settings-back") - .flex() - .items_center() - .gap(px(10.)) - .h(px(34.)) - .px(px(10.)) - .rounded(px(8.)) - .text_size(px(14.)) - .text_color(p.sidebar_text) - .cursor_pointer() - .hover(move |style| style.bg(p.row_hover).text_color(p.text)) - .child(icon(Icon::ArrowLeft, 16., p.sidebar_text)) - .child("Back") - .on_click(cx.listener(|_, _, _, cx| cx.emit(SettingsEvent::Back))), - ) - } - - fn general(&self, p: Palette, cx: &mut Context<Self>) -> AnyElement { - let config = Config::get(cx).clone(); - div() - .flex() - .flex_col() - .child(heading("New threads", p)) - .child( - card(p) - .child(row( - "Permissions", - "What agents may do without asking. You can also change it from the prompt box.", - div().flex().flex_col().gap(px(2.)).w(px(260.)).children(Access::ALL.map(|access| { - let on = config.access == access; - div() - .id(access.label()) - .flex() - .items_center() - .gap(px(8.)) - .h(px(30.)) - .px(px(10.)) - .rounded(px(8.)) - .text_size(px(13.5)) - .text_color(if on { p.text } else { p.text_muted }) - .when(on, |seg| seg.bg(p.row_active)) - .cursor_pointer() - .hover(move |style| style.bg(p.row_hover)) - .child(icon(access_icon(access), 14., if on { p.text } else { p.text_faint })) - .child(access.label()) - .on_click(cx.listener(move |_, _, _, cx| { - Config::update(cx, |config| config.access = access); - cx.notify(); - })) - })), - p, - )) - .child(row( - "Thinking", - "Let models that support it think before they answer. Detected from each model's chat template.", - Switch::new("thinking-default").checked(config.thinking).on_click({ - let backend = self.backend.clone(); - move |on, _, cx| backend.update(cx, |b, cx| b.set_thinking(*on, cx)) - }), - p, - )), - ) - .into_any_element() - } - - fn models(&self, p: Palette, cx: &mut Context<Self>) -> AnyElement { - let backend = self.backend.read(cx); - let (color, status): (_, SharedString) = match &backend.connection { - Connection::Checking => (p.text_faint, "Connecting".into()), - Connection::Online => { - let count = backend.models.len(); - (p.success, format!("Connected · {count} {}", if count == 1 { "model" } else { "models" }).into()) - } - Connection::Offline(error) => (p.danger, error.clone()), - }; - let selected = Backend::selected_id(cx); - let models: Vec<_> = backend.models.clone(); - div() - .flex() - .flex_col() - .child(heading("llama.cpp", p)) - .child( - card(p) - .child( - div() - .flex() - .flex_col() - .gap(px(10.)) - .px(px(18.)) - .py(px(16.)) - .child( - div() - .flex() - .items_center() - .gap(px(10.)) - .child(svg().path(Icon::LlamaCpp.path()).size(px(20.)).text_color(p.text)) - .child( - div() - .flex() - .flex_col() - .child( - div() - .text_size(px(14.5)) - .font_weight(FontWeight::SEMIBOLD) - .text_color(p.text) - .child("Server address"), - ) - .child(div().text_size(px(13.)).text_color(p.text_faint).child( - "In router mode every model the server can load is listed here and in the prompt box.", - )), - ), - ) - .child( - div() - .flex() - .gap(px(8.)) - .child(div().flex_1().child(Input::new(&self.url))) - .child(primary("connect", "Connect", p).on_click(cx.listener(|this, _, _, cx| this.connect(cx)))), - ) - .child( - div() - .flex() - .items_center() - .gap(px(8.)) - .text_size(px(12.5)) - .text_color(p.text_muted) - .child(div().size(px(8.)).flex_shrink_0().rounded_full().bg(color)) - .child(status), - ), - ) - .children(models.into_iter().map(|model| { - let mut detail = vec![model.status.label().to_string()]; - if let Some(context) = model.context { - detail.push(format!("{} context", context_label(context))); - } - if model.vision { - detail.push("Vision".into()); - } - let chosen = selected.as_deref() == Some(model.id.as_str()); - let id = model.id.clone(); - div() - .id(SharedString::from(format!("settings-model-{}", model.id))) - .flex() - .items_center() - .gap(px(12.)) - .px(px(18.)) - .py(px(10.)) - .border_t_1() - .border_color(p.border_soft) - .cursor_pointer() - .hover(move |style| style.bg(p.row_hover)) - .child(div().size(px(8.)).rounded_full().bg(if model.status == Status::Loaded { - p.success - } else { - p.text_faint.opacity(0.4) - })) - .child( - div() - .flex_1() - .flex() - .flex_col() - .child(div().text_size(px(14.)).text_color(p.text).child(model.id.clone())) - .child(div().text_size(px(12.5)).text_color(p.text_faint).child(detail.join(" · "))), - ) - .when(chosen, |row| row.child(div().text_size(px(12.5)).text_color(p.text_muted).child("In use"))) - .on_click(cx.listener(move |this, _, _, cx| { - let id = id.clone(); - this.backend.update(cx, |b, cx| b.select(id, cx)); - })) - })), - ) - .into_any_element() - } - - fn instructions(&self, p: Palette, cx: &mut Context<Self>) -> AnyElement { - let note = match &self.saved { - Some(Ok(())) => Some((p.success, SharedString::from("Saved"))), - Some(Err(error)) => Some((p.danger, error.clone())), - None => None, - }; - div() - .flex() - .flex_col() - .child(heading("Personal instructions", p)) - .child(div().mb(px(12.)).text_size(px(13.5)).text_color(p.text_muted).child(format!( - "Added to every thread, in every project, after the project's own AGENTS.md or CLAUDE.md. Saved as {}", - personal_instructions_path().display() - ))) - .child(Textarea::new(&self.instructions)) - .child( - div() - .flex() - .items_center() - .gap(px(10.)) - .mt(px(12.)) - .child(primary("save-instructions", "Save", p).on_click(cx.listener(|this, _, _, cx| this.save_instructions(cx)))) - .when_some(note, |row, (color, text)| row.child(div().text_size(px(12.5)).text_color(color).child(text))), - ) - .into_any_element() - } - - fn projects(&self, p: Palette, cx: &mut Context<Self>) -> AnyElement { - let projects = Config::get(cx).projects.clone(); - div() - .flex() - .flex_col() - .child(div().flex().items_center().child(div().flex_1().child(heading("Projects", p))).child( - primary("settings-add-project", "Add project", p).on_click(cx.listener(|_, _, _, cx| cx.emit(SettingsEvent::AddProject))), - )) - .child( - card(p) - .when(projects.is_empty(), |c| { - c.child(div().px(px(18.)).py(px(16.)).text_size(px(13.5)).text_color(p.text_faint).child("No projects yet.")) - }) - .children(projects.into_iter().enumerate().map(|(index, path)| { - let name = project::name(&path); - let open = path.clone(); - div() - .flex() - .items_center() - .gap(px(12.)) - .px(px(18.)) - .py(px(12.)) - .when(index > 0, |r| r.border_t_1().border_color(p.border_soft)) - .child(badge(&name, 22.)) - .child( - div() - .flex_1() - .min_w_0() - .flex() - .flex_col() - .child(div().text_size(px(14.)).text_color(p.text).child(name)) - .child(div().text_size(px(12.5)).text_color(p.text_faint).child(path.display().to_string())), - ) - .child(ghost(("open-project", index), Icon::FolderOpen, p).on_click(move |_, _, _| project::open_folder(&open))) - .child(ghost(("remove-project", index), Icon::Trash, p).on_click(cx.listener(move |_, _, _, cx| { - Config::update(cx, |config| { - config.projects.remove(index); - }); - cx.notify(); - }))) - })), - ) - .into_any_element() - } -} - -fn heading(text: &'static str, p: Palette) -> Div { - div().pb(px(10.)).text_size(px(15.)).text_color(p.text_muted).child(text) -} - -fn card(p: Palette) -> Div { - div() - .mb(px(28.)) - .rounded(px(14.)) - .bg(p.surface_2.opacity(0.5)) - .border_1() - .border_color(p.border_soft) - .flex() - .flex_col() - .overflow_hidden() -} - -fn row(title: &'static str, detail: &'static str, control: impl IntoElement, p: Palette) -> Div { - div() - .flex() - .items_center() - .gap(px(24.)) - .px(px(18.)) - .py(px(16.)) - .border_b_1() - .border_color(p.border_soft) - .child( - div() - .flex_1() - .min_w_0() - .flex() - .flex_col() - .gap(px(3.)) - .child(div().text_size(px(14.5)).font_weight(FontWeight::SEMIBOLD).text_color(p.text).child(title)) - .child(div().text_size(px(13.)).text_color(p.text_faint).child(detail)), - ) - .child(control) -} - -fn primary(id: &'static str, label: &'static str, p: Palette) -> gpui_kit::Stateful<Div> { - div() - .id(id) - .flex() - .items_center() - .justify_center() - .h(px(32.)) - .px(px(14.)) - .rounded(px(8.)) - .bg(p.text) - .text_color(p.bg) - .text_size(px(13.5)) - .font_weight(FontWeight::SEMIBOLD) - .cursor_pointer() - .hover(|style| style.opacity(0.9)) - .child(label) -} - -fn ghost(id: impl Into<gpui_kit::ElementId>, name: Icon, p: Palette) -> gpui_kit::Stateful<Div> { - div() - .id(id) - .size(px(30.)) - .flex() - .items_center() - .justify_center() - .rounded(px(8.)) - .cursor_pointer() - .hover(move |style| style.bg(p.row_hover)) - .child(icon(name, 15., p.text_muted)) -} - -impl Render for Settings { - fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement { - let p = palette(cx); - let content = match self.section { - Section::General => self.general(p, cx), - Section::Models => self.models(p, cx), - Section::Instructions => self.instructions(p, cx), - Section::Projects => self.projects(p, cx), - Section::Version => { - return div().size_full().flex().child(self.nav(p, cx)).child(self.main(self.version.clone().into_any_element(), p)); - } - }; - div().size_full().flex().child(self.nav(p, cx)).child( - self.main( - page("settings-page") - .child(div().max_w(px(820.)).mx_auto().px(px(36.)).pt(px(36.)).pb(px(40.)).child(content)) - .into_any_element(), - p, - ), - ) - } -} - -impl Settings { - fn main(&self, content: AnyElement, p: Palette) -> impl IntoElement + use<> { - div() - .flex_1() - .min_w_0() - .h_full() - .bg(p.bg) - .rounded_tl(px(10.)) - .border_t_1() - .border_l_1() - .border_color(p.border_soft) - .overflow_hidden() - .child(content) - } -} \ No newline at end of file diff --git a/crates/quill-code/src/setup.rs b/crates/quill-code/src/setup.rs new file mode 100644 index 0000000..b136ad7 --- /dev/null +++ b/crates/quill-code/src/setup.rs @@ -0,0 +1,258 @@ +use std::sync::mpsc::Sender; + +use crossterm::event::{KeyCode, KeyEvent, KeyModifiers}; +use quill_config::{Provider, ServerKind}; +use quill_providers::{Model, context_label}; + +use crate::Msg; +use crate::backend; +use crate::composer::Composer; +use crate::picker::{Choice, Picked, Picker}; +use crate::text::{Line, accent, bad, bold, dim, truncate, wrap}; + +pub enum Outcome { + Stay, + Close, + Ready(Provider, String), +} + +enum Step { + Kind(Picker<ServerKind>), + Address(Composer), + Key(Composer), + Connecting, + Failed(String), + Models(Picker<String>), +} + +pub struct Setup { + welcome: bool, + step: Step, + kind: ServerKind, + url: String, + key: Option<String>, + found: Vec<(ServerKind, String)>, + error: Option<String>, + tx: Sender<Msg>, +} + +fn filled(text: &str) -> Composer { + let mut input = Composer::default(); + input.set(text); + input +} + +fn model_detail(model: &Model) -> String { + let mut parts = vec![model.status.label().to_string()]; + if let Some(context) = model.context { + parts.push(format!("{} context", context_label(context))); + } + if model.vision { + parts.push("vision".into()); + } + parts.join(" · ") +} + +impl Setup { + pub fn new(welcome: bool, tx: Sender<Msg>) -> Setup { + let mut setup = Setup { + welcome, + step: Step::Connecting, + kind: ServerKind::Custom, + url: String::new(), + key: None, + found: Vec::new(), + error: None, + tx, + }; + setup.step = Step::Kind(setup.kind_picker()); + setup + } + + fn kind_picker(&self) -> Picker<ServerKind> { + let choices = ServerKind::ALL + .iter() + .map(|kind| { + let detail = match self.found.iter().find(|(found, _)| found == kind) { + Some((_, url)) => format!("running now at {}", url.trim_start_matches("http://")), + None => kind.description().to_string(), + }; + Choice::new(kind.label(), detail, *kind) + }) + .collect(); + let title = if self.welcome { "Welcome to Quill Code. Which app runs your models?" } else { "Connect a model server" }; + let close = if self.welcome { "esc sets it up later" } else { "esc closes" }; + let mut picker = Picker::new(title, choices).hint(format!("↑↓ choose · enter continue · {close}")); + if let Some(index) = ServerKind::ALL.iter().position(|kind| self.found.iter().any(|(found, _)| found == kind)) { + picker.select(index); + } + picker + } + + pub fn detected(&mut self, found: Vec<(ServerKind, String)>) { + self.found = found; + if matches!(self.step, Step::Kind(_)) { + self.step = Step::Kind(self.kind_picker()); + } + } + + pub fn working(&self) -> bool { + matches!(self.step, Step::Connecting) + } + + fn provider(&self) -> Provider { + Provider { key: self.key.clone(), ..Provider::new("", self.kind, &self.url) } + } + + fn address(&self) -> Step { + Step::Address(filled(&self.url)) + } + + fn connect(&mut self) { + self.error = None; + self.step = Step::Connecting; + let provider = self.provider(); + let tx = self.tx.clone(); + std::thread::spawn(move || { + let _ = tx.send(Msg::Connected(backend::list_models(&provider))); + }); + } + + pub fn connected(&mut self, result: Result<Vec<Model>, String>) { + if !self.working() { + return; + } + self.step = match result { + Ok(models) if models.is_empty() => { + Step::Failed(format!("{} answered but has no models yet. Download or load one, then try again.", self.kind.label())) + } + Ok(models) => { + let choices = models.iter().map(|model| Choice::new(model.label(), model_detail(model), model.id.clone())).collect(); + Step::Models( + Picker::new("Pick the model that powers Quill", choices) + .filtered(true) + .hint("type to filter · enter choose · esc goes back"), + ) + } + Err(error) => Step::Failed(error), + }; + } + + pub fn key(&mut self, key: KeyEvent) -> Outcome { + let enter = key.code == KeyCode::Enter && !key.modifiers.intersects(KeyModifiers::SHIFT | KeyModifiers::ALT); + match &mut self.step { + Step::Kind(picker) => match picker.key(key) { + Picked::Closed => return Outcome::Close, + Picked::Chosen(index) => { + self.kind = picker.choices[index].value; + let found = self.found.iter().find(|(kind, _)| *kind == self.kind).map(|(_, url)| url.clone()); + self.url = found.unwrap_or_else(|| self.kind.default_url()); + self.error = None; + self.step = self.address(); + } + Picked::Nothing => {} + }, + Step::Address(input) => { + if key.code == KeyCode::Esc { + self.error = None; + self.step = Step::Kind(self.kind_picker()); + } else if enter { + let url = input.text.trim().to_string(); + if url.is_empty() { + self.error = Some("Type the server's address, for example http://127.0.0.1:9931.".into()); + return Outcome::Stay; + } + self.url = url; + if self.kind.asks_key() { + self.error = None; + self.step = Step::Key(filled(self.key.as_deref().unwrap_or_default())); + } else { + self.connect(); + } + } else { + input.key(key); + } + } + Step::Key(input) => { + if key.code == KeyCode::Esc { + self.step = self.address(); + } else if enter { + self.key = Some(input.text.trim().to_string()).filter(|key| !key.is_empty()); + self.connect(); + } else { + input.key(key); + } + } + Step::Connecting => {} + Step::Failed(_) => match key.code { + KeyCode::Enter => self.connect(), + KeyCode::Esc => self.step = self.address(), + _ => {} + }, + Step::Models(picker) => match picker.key(key) { + Picked::Closed => self.step = self.address(), + Picked::Chosen(index) => { + let model = picker.choices[index].value.clone(); + return Outcome::Ready(self.provider(), model); + } + Picked::Nothing => {} + }, + } + Outcome::Stay + } + + pub fn paste(&mut self, text: &str) { + match &mut self.step { + Step::Address(input) | Step::Key(input) => input.insert(text.trim()), + Step::Kind(picker) => picker.paste(text), + Step::Models(picker) => picker.paste(text), + _ => {} + } + } + + pub fn render(&self, width: usize, rows: usize, spinner: &str) -> (Vec<Line>, Option<(usize, usize)>) { + let label = self.kind.label(); + let mut lines = Vec::new(); + let mut cursor = None; + match &self.step { + Step::Kind(picker) => lines.extend(picker.render(width, rows)), + Step::Address(input) => { + lines.push(Line::styled(format!("Where is your {label} server?"), bold())); + let example = self.kind.default_url(); + let (text, at) = input.render(width, &example); + cursor = Some((lines.len() + at.0, at.1)); + lines.extend(text); + lines.push(Line::styled(" enter continues · esc goes back", dim())); + } + Step::Key(input) => { + lines.push(Line::styled("API key", bold()).with(" (optional)", dim())); + let typed = input.text.chars().count(); + let mut line = Line::styled("› ", accent()); + if typed == 0 { + line.push("leave it empty if the server has none", dim()); + } else { + line.push("•".repeat(typed), accent()); + } + cursor = Some((lines.len(), 2 + input.text[..input.cursor].chars().count())); + lines.push(line); + if self.kind == ServerKind::Jan { + lines.push(Line::styled(" Jan asks for the key set in its Local API Server settings.", dim())); + } + lines.push(Line::styled(" enter connects · esc goes back", dim())); + } + Step::Connecting => lines.push(Line::styled(format!("{spinner} Looking for models at {}", self.url), accent())), + Step::Failed(error) => { + lines.push(Line::styled(format!("Quill could not use {label} at {}", self.url), bold())); + for line in wrap(&Line::styled(error.clone(), bad()), width.saturating_sub(2)) { + lines.push(Line::plain(" ").with_line(line)); + } + lines.push(Line::styled(" enter tries again · esc changes the address", dim())); + } + Step::Models(picker) => lines.extend(picker.render(width, rows)), + } + if let Some(error) = &self.error { + lines.push(truncate(&Line::styled(format!(" {error}"), bad()), width)); + } + (lines, cursor) + } +} \ No newline at end of file diff --git a/crates/quill-code/src/shell.rs b/crates/quill-code/src/shell.rs deleted file mode 100644 index 70618ea..0000000 --- a/crates/quill-code/src/shell.rs +++ /dev/null @@ -1,1207 +0,0 @@ -use std::collections::HashMap; -use std::path::{Path, PathBuf}; -use std::time::{Duration, SystemTime, UNIX_EPOCH}; - -use gpui_kit::component::input::{Input, InputEvent, InputState}; -use gpui_kit::component::{Sizable, TitleBar}; -use gpui_kit::{ - Anchor, AnyElement, Context, Div, Entity, FontWeight, Hsla, IntoElement, KeystrokeEvent, MouseButton, MouseDownEvent, ParentElement, - Pixels, Point, Render, SharedString, Stateful, StyleRefinement, Styled, Subscription, Task, Window, anchored, deferred, div, point, - prelude::*, px, -}; -use quill_agent::Approval; -use quill_weave::State; - -use crate::add_project::{AddProject, AddProjectEvent}; -use crate::backend::Backend; -use crate::commit_dialog::{CommitDialog, CommitEvent}; -use crate::composer::{ApprovalCard, Composer, ComposerEvent, Strip}; -use crate::config::Config; -use crate::git::{self, Snapshot}; -use crate::github::{self, PullRequest, PullState}; -use crate::icons::Icon; -use crate::mentions::Command; -use crate::palette::{self, FONT, Palette, palette}; -use crate::panel::{ClosePanel, Panel, Tab}; -use crate::project; -use crate::settings::{Section, Settings, SettingsEvent}; -use crate::terminal::{CloseTerminal, Terminal}; -use crate::thread::{Item, Thread, ago, now_ms}; -use crate::thread_view::{OpenDiff, ThreadView}; -use crate::ui::{MONO, badge, icon, menu_item, menu_label, menu_panel, popup, separator}; -use crate::version::{APP_NAME, VERSION}; -use crate::weave::WeaveMark; -use crate::workspace::Workspace; - -const GREETINGS: [&str; 4] = ["Where should we start?", "What are we building today?", "Ready when you are.", "What needs fixing?"]; - -#[derive(Clone, Copy, PartialEq)] -enum Menu { - Project, - Thread(u64, Point<Pixels>), -} - -#[derive(Clone, Default)] -struct RepoInfo { - branch: Option<String>, - repo: bool, - has_commits: bool, - remote: Option<String>, - snapshot: Snapshot, -} - -pub struct Shell { - workspace: Entity<Workspace>, - composer: Entity<Composer>, - thread_view: Entity<ThreadView>, - panel: Entity<Panel>, - terminal: Entity<Terminal>, - settings: Entity<Settings>, - add_project: Option<Entity<AddProject>>, - commit: Option<Entity<CommitDialog>>, - hero: Entity<WeaveMark>, - brand: Entity<WeaveMark>, - search: Entity<InputState>, - filter: String, - in_settings: bool, - panel_open: bool, - terminal_open: bool, - menu: Option<Menu>, - renaming: Option<(u64, Entity<InputState>, Subscription)>, - confirm_delete: Option<u64>, - toast: Option<(SharedString, SharedString)>, - toast_timer: Option<Task<()>>, - greeting: &'static str, - git: bool, - editor: bool, - repos: HashMap<PathBuf, RepoInfo>, - pulls: HashMap<(String, String), Option<PullRequest>>, - marks: HashMap<u64, (String, Entity<WeaveMark>)>, - running: usize, - _subscriptions: Vec<Subscription>, -} - -impl Shell { - pub fn new(window: &mut Window, cx: &mut Context<Self>) -> Self { - window.set_window_title(APP_NAME); - let backend = cx.new(Backend::new); - let workspace = cx.new(|_| Workspace::new(backend.clone())); - let composer = cx.new(|cx| Composer::new(backend.clone(), window, cx)); - let thread_view = cx.new(|cx| ThreadView::new(workspace.clone(), cx)); - let panel = cx.new(|cx| Panel::new(window, cx)); - let terminal = cx.new(|cx| Terminal::new(window, cx)); - let settings = cx.new(|cx| Settings::new(backend.clone(), window, cx)); - let search = cx.new(|cx| InputState::new(window, cx).placeholder("Find a thread")); - let weak = cx.entity().downgrade(); - let subscriptions = vec![ - cx.observe_window_appearance(window, |_, window, cx| palette::apply(window.appearance(), Some(window), cx)), - cx.observe(&workspace, |this, _, cx| this.sync(cx)), - cx.observe_window_activation(window, |this, window, cx| { - if window.is_window_active() { - this.repos.clear(); - this.pulls.clear(); - this.sync(cx); - } - }), - cx.subscribe_in(&composer, window, |this, _, event, window, cx| match event { - ComposerEvent::Submit(prompt) => { - let prompt = prompt.clone(); - this.workspace.update(cx, |w, cx| w.send(prompt, cx)); - } - ComposerEvent::Stop => this.stop_active(cx), - ComposerEvent::Decide(decision) => { - let decision = *decision; - if let Some(id) = this.workspace.read(cx).active { - this.workspace.update(cx, |w, cx| w.decide(id, decision, cx)); - } - } - ComposerEvent::OpenModelSettings => this.open_settings(Section::Models, window, cx), - ComposerEvent::Command(command) => this.run_command(*command, window, cx), - ComposerEvent::SetIsolated(isolated) => { - let isolated = *isolated; - this.workspace.update(cx, |w, cx| w.set_isolated(isolated, cx)); - } - ComposerEvent::SwitchProject(path) => this.new_thread(Some(path.clone()), window, cx), - ComposerEvent::AddProject => this.show_add_project(window, cx), - ComposerEvent::RepoChanged => { - this.repos.clear(); - this.pulls.clear(); - this.sync(cx); - } - }), - cx.subscribe(&thread_view, |this, _, OpenDiff { thread, turn }, cx| this.open_diff(*thread, Some(*turn), cx)), - cx.subscribe(&panel, |this, _, _: &ClosePanel, cx| { - this.panel_open = false; - cx.notify(); - }), - cx.subscribe_in(&terminal, window, |this, _, _: &CloseTerminal, window, cx| { - this.terminal_open = false; - this.focus_composer(window, cx); - cx.notify(); - }), - cx.subscribe_in(&settings, window, |this, _, event, window, cx| match event { - SettingsEvent::Back => { - this.in_settings = false; - this.focus_composer(window, cx); - cx.notify(); - } - SettingsEvent::AddProject => this.show_add_project(window, cx), - }), - cx.subscribe(&search, |this, search, event: &InputEvent, cx| { - if let InputEvent::Change = event { - this.filter = search.read(cx).value().trim().to_lowercase(); - cx.notify(); - } - }), - cx.intercept_keystrokes(move |event, window, cx| { - if let Some(this) = weak.upgrade() { - this.update(cx, |this, cx| this.intercept(event, window, cx)); - } - }), - ]; - let seed = SystemTime::now().duration_since(UNIX_EPOCH).map_or(0, |d| d.as_secs()) as usize; - composer.update(cx, |composer, cx| composer.focus(window, cx)); - let mut shell = Shell { - workspace, - composer, - thread_view, - panel, - terminal, - settings, - add_project: None, - commit: None, - hero: cx.new(|_| WeaveMark::new(State::Idle)), - brand: cx.new(|_| WeaveMark::new(State::Idle)), - search, - filter: String::new(), - in_settings: false, - panel_open: false, - terminal_open: false, - menu: None, - renaming: None, - confirm_delete: None, - toast: None, - toast_timer: None, - greeting: GREETINGS[seed % GREETINGS.len()], - git: project::git_available(), - editor: project::editor_available(), - repos: HashMap::new(), - pulls: HashMap::new(), - marks: HashMap::new(), - running: 0, - _subscriptions: subscriptions, - }; - shell.sync(cx); - shell - } - - fn intercept(&mut self, event: &KeystrokeEvent, window: &mut Window, cx: &mut Context<Self>) { - if event.keystroke.key != "escape" { - return; - } - if self.commit.take().is_some() { - self.focus_composer(window, cx); - } else if let Some(sheet) = self.add_project.clone() { - sheet.update(cx, |sheet, cx| sheet.back(window, cx)); - } else if self.menu.is_some() || self.renaming.is_some() { - self.renaming = None; - self.menu = None; - self.confirm_delete = None; - } else { - return; - } - cx.notify(); - cx.stop_propagation(); - } - - fn repo(&mut self, path: &Path) -> RepoInfo { - if !self.git { - return RepoInfo::default(); - } - self.repos - .entry(path.to_path_buf()) - .or_insert_with(|| match git::snapshot(path) { - Some(snapshot) => RepoInfo { - branch: snapshot.branch.clone().or_else(|| snapshot.head.as_ref().map(|head| format!("detached at {head}"))), - repo: true, - has_commits: snapshot.head.is_some(), - remote: git::remote_url(path), - snapshot, - }, - None => RepoInfo::default(), - }) - .clone() - } - - fn pull_request(&mut self, info: &RepoInfo, cx: &mut Context<Self>) -> Option<PullRequest> { - let slug = info.remote.as_deref().and_then(git::github_slug)?; - let branch = info.snapshot.branch.clone().filter(|_| info.snapshot.upstream)?; - let key = (slug, branch); - if let Some(known) = self.pulls.get(&key) { - return *known; - } - self.pulls.insert(key.clone(), None); - let (slug, branch) = key.clone(); - let task = cx.background_executor().spawn(async move { github::pull_request(&slug, &branch) }); - cx.spawn(async move |this, cx| { - if let Some(pull) = task.await { - _ = this.update(cx, |this, cx| { - this.pulls.insert(key, Some(pull)); - cx.notify(); - }); - } - }) - .detach(); - None - } - - fn sync(&mut self, cx: &mut Context<Self>) { - let workspace = self.workspace.read(cx); - let running = workspace.running_count(); - let project = workspace.project(); - let workdir = workspace.workdir(); - let isolated = workspace.isolated(); - let locked = workspace.active.is_some(); - let (busy, approval) = match workspace.active { - Some(id) => ( - workspace.running(id), - workspace.pending(id).map(|pending| match &pending.approval { - Approval::FileChange(diff) => { - ApprovalCard { title: "Wants to change a file", target: diff.path.clone(), stats: Some((diff.added, diff.removed)) } - } - Approval::Command(command) => ApprovalCard { title: "Wants to run a command", target: command.clone(), stats: None }, - Approval::Commit(message) => ApprovalCard { title: "Wants to commit", target: message.clone(), stats: None }, - Approval::PullRequest(title) => { - ApprovalCard { title: "Wants to open a pull request", target: title.clone(), stats: None } - } - }), - ), - None => (false, None), - }; - if running < self.running { - self.repos.clear(); - self.pulls.clear(); - } - self.running = running; - let strip = match (&project, &workdir) { - (Some(project_path), Some(root)) => { - let can_isolate = self.repo(project_path).has_commits; - Some(Strip { - root: root.clone(), - project: project_path.clone(), - name: project::name(project_path), - branch: self.repo(root).branch, - isolated, - can_isolate, - locked, - }) - } - _ => None, - }; - let context_used = self.workspace.read(cx).active_thread().and_then(|t| t.context_used); - self.composer.update(cx, |composer, cx| composer.set_context(busy, approval, strip, context_used, cx)); - self.panel.update(cx, |panel, cx| panel.set_root(workdir.clone(), cx)); - self.terminal.update(cx, |terminal, cx| terminal.set_root(workdir, cx)); - cx.notify(); - } - - fn focus_composer(&self, window: &mut Window, cx: &mut Context<Self>) { - self.composer.update(cx, |composer, cx| composer.focus(window, cx)); - } - - fn stop_active(&mut self, cx: &mut Context<Self>) { - if let Some(id) = self.workspace.read(cx).active { - self.workspace.update(cx, |w, cx| w.stop(id, cx)); - } - } - - fn new_thread(&mut self, project: Option<PathBuf>, window: &mut Window, cx: &mut Context<Self>) { - self.in_settings = false; - self.menu = None; - self.workspace.update(cx, |w, cx| w.start_new(project, cx)); - self.focus_composer(window, cx); - } - - fn run_command(&mut self, command: Command, window: &mut Window, cx: &mut Context<Self>) { - match command { - Command::New => { - let project = self.workspace.read(cx).project(); - self.new_thread(project, window, cx); - } - Command::Review => self.toggle_panel(Tab::Diff, cx), - Command::Files => self.toggle_panel(Tab::Files, cx), - Command::Terminal => self.toggle_terminal(window, cx), - Command::Commit => self.open_commit(window, cx), - _ => {} - } - } - - fn open_settings(&mut self, section: Section, _: &mut Window, cx: &mut Context<Self>) { - self.in_settings = true; - self.menu = None; - self.settings.update(cx, |s, cx| s.open(section, cx)); - cx.notify(); - } - - fn show_add_project(&mut self, window: &mut Window, cx: &mut Context<Self>) { - self.menu = None; - let sheet = cx.new(|cx| AddProject::new(self.git, window, cx)); - let subscription = cx.subscribe_in(&sheet, window, |this, _, event, window, cx| match event { - AddProjectEvent::Close => { - this.add_project = None; - this.focus_composer(window, cx); - cx.notify(); - } - AddProjectEvent::Added(path, note) => { - let path = path.clone(); - this.add_project = None; - this.repos.remove(&path); - Config::add_project(cx, path.clone()); - let detail = note.clone().unwrap_or_else(|| path.display().to_string()); - this.show_toast(format!("{} is ready", project::name(&path)), detail, cx); - this.new_thread(Some(path), window, cx); - } - }); - self._subscriptions.push(subscription); - self.add_project = Some(sheet); - cx.notify(); - } - - fn open_commit(&mut self, window: &mut Window, cx: &mut Context<Self>) { - let Some(root) = self.workspace.read(cx).workdir() else { - self.show_toast("Pick a project first".into(), "Commits need a project that uses Git.".into(), cx); - return; - }; - if !self.repo(&root).repo { - self.show_toast("Not a Git repository".into(), root.display().to_string(), cx); - return; - } - self.menu = None; - let (url, model) = (Backend::url(cx), Backend::selected_id(cx)); - let dialog = cx.new(|cx| CommitDialog::new(root, url, model, window, cx)); - let subscription = cx.subscribe_in(&dialog, window, |this, _, event, window, cx| match event { - CommitEvent::Close => { - this.commit = None; - this.focus_composer(window, cx); - cx.notify(); - } - CommitEvent::Updated(note) => { - this.repos.clear(); - let note = note.clone(); - this.show_toast(note, String::new(), cx); - this.sync(cx); - } - }); - self._subscriptions.push(subscription); - self.commit = Some(dialog); - cx.notify(); - } - - fn show_toast(&mut self, title: String, detail: String, cx: &mut Context<Self>) { - self.toast = Some((title.into(), detail.into())); - self.toast_timer = Some(cx.spawn(async move |this, cx| { - cx.background_executor().timer(Duration::from_secs(4)).await; - _ = this.update(cx, |this, cx| { - this.toast = None; - cx.notify(); - }); - })); - cx.notify(); - } - - fn open_diff(&mut self, thread: u64, turn: Option<usize>, cx: &mut Context<Self>) { - let workspace = self.workspace.read(cx); - let Some(found) = workspace.threads.iter().find(|t| t.id == thread) else { return }; - let index = turn.unwrap_or_else(|| found.turns.iter().rposition(|t| t.diffs().next().is_some()).unwrap_or(0)); - let diffs = found.turns.get(index).map(|t| t.diffs().cloned().collect()).unwrap_or_default(); - let title = if index + 1 == found.turns.len() { "Last reply".to_string() } else { format!("Reply {}", index + 1) }; - self.panel.update(cx, |panel, cx| panel.show_diff(title, diffs, cx)); - self.panel_open = true; - cx.notify(); - } - - fn toggle_panel(&mut self, tab: Tab, cx: &mut Context<Self>) { - if self.panel_open && self.panel.read(cx).tab == tab { - self.panel_open = false; - cx.notify(); - return; - } - match tab { - Tab::Diff => match self.workspace.read(cx).active { - Some(id) => self.open_diff(id, None, cx), - None => { - self.panel.update(cx, |panel, cx| panel.show_diff("Last reply".into(), Vec::new(), cx)); - self.panel_open = true; - } - }, - Tab::Files => { - self.panel.update(cx, |panel, cx| panel.show_files(cx)); - self.panel_open = true; - } - } - cx.notify(); - } - - fn toggle_terminal(&mut self, window: &mut Window, cx: &mut Context<Self>) { - self.terminal_open = !self.terminal_open; - if self.terminal_open { - self.terminal.update(cx, |terminal, cx| terminal.focus(window, cx)); - } else { - self.focus_composer(window, cx); - } - cx.notify(); - } - - fn start_rename(&mut self, id: u64, window: &mut Window, cx: &mut Context<Self>) { - self.menu = None; - let title = self.workspace.read(cx).threads.iter().find(|t| t.id == id).map(|t| t.title.clone()).unwrap_or_default(); - let input = cx.new(|cx| InputState::new(window, cx).default_value(title)); - let subscription = cx.subscribe(&input, move |this, input, event: &InputEvent, cx| { - if matches!(event, InputEvent::PressEnter { .. } | InputEvent::Blur) && this.renaming.is_some() { - let title = input.read(cx).value().trim().to_string(); - this.renaming = None; - if !title.is_empty() { - this.workspace.update(cx, |w, cx| w.rename(id, title, cx)); - } - cx.notify(); - } - }); - input.update(cx, |input, cx| input.focus(window, cx)); - self.renaming = Some((id, input, subscription)); - cx.notify(); - } - - fn remove_isolated(&mut self, id: u64, cx: &mut Context<Self>) { - self.close_menu(cx); - match self.workspace.update(cx, |w, cx| w.remove_isolated(id, cx)) { - Ok(()) => self.show_toast("Removed the isolated copy".into(), "The thread now works in the project folder.".into(), cx), - Err(error) => self.show_toast("Could not remove the copy".into(), error, cx), - } - } - - fn close_menu(&mut self, cx: &mut Context<Self>) { - self.menu = None; - self.confirm_delete = None; - cx.notify(); - } - - fn thread_row(&mut self, thread: &Thread, cx: &mut Context<Self>) -> Stateful<Div> { - let p = palette(cx); - let info = thread.workdir().map(|path| self.repo(&path)).filter(|info| info.repo); - let pull = info.as_ref().and_then(|info| self.pull_request(info, cx)); - let workspace = self.workspace.read(cx); - let id = thread.id; - let active = !self.in_settings && workspace.active == Some(id); - let running = workspace.running(id); - let pending = workspace.pending(id).is_some(); - let project_name = thread.project.as_ref().map(|path| project::name(path)); - let elapsed = thread.turns.last().map(|t| t.elapsed_secs()).unwrap_or(0); - let motion = match thread.turns.last().and_then(|t| t.items.last()) { - _ if !running || pending => State::Idle, - Some(Item::Text(_)) => State::Generating, - _ => State::Thinking, - }; - let model = thread.turns.iter().rev().find_map(|turn| turn.model.clone()).or_else(|| thread.model.clone()); - let weave = model.map(|model| { - let fresh = self.marks.get(&id).is_none_or(|(seeded, _)| *seeded != model); - if fresh { - let mark = cx.new(|_| WeaveMark::new(State::Idle).seeded(&model).opacity(0.7)); - self.marks.insert(id, (model, mark)); - } - let mark = self.marks[&id].1.clone(); - mark.update(cx, |mark, cx| mark.set_state(motion, cx)); - mark - }); - let status = if pending { - div().px(px(6.)).rounded(px(5.)).bg(p.warning.opacity(0.14)).text_color(p.warning).child("Needs you") - } else if running { - div().flex().items_center().gap(px(4.)).text_color(p.link).child(icon(Icon::Loader, 12., p.link)).child(format!("{elapsed}s")) - } else { - div().text_color(p.text_faint).child(ago(thread.updated)) - }; - let mark = match &project_name { - Some(name) => badge(name, 26.), - None => div().size(px(26.)).flex_shrink_0().flex().items_center().justify_center().rounded(px(7.)).bg(p.fill).child(icon( - Icon::Chat, - 14., - p.text_muted, - )), - }; - let renaming = self.renaming.as_ref().filter(|(rid, _, _)| *rid == id).map(|(_, input, _)| input.clone()); - let title = match renaming { - Some(input) => div().flex_1().min_w_0().text_size(px(13.5)).child(Input::new(&input).small()).into_any_element(), - None => div() - .flex_1() - .min_w_0() - .overflow_hidden() - .whitespace_nowrap() - .text_ellipsis() - .text_size(px(13.5)) - .font_weight(FontWeight::MEDIUM) - .text_color(if active { p.text } else { p.sidebar_text }) - .child(thread.title.clone()) - .into_any_element(), - }; - let snapshot = info.as_ref().map(|info| info.snapshot.clone()).unwrap_or_default(); - let branch = info.and_then(|info| info.branch); - let place = div() - .flex() - .items_center() - .gap(px(4.)) - .overflow_hidden() - .whitespace_nowrap() - .text_size(px(12.)) - .text_color(p.text_faint) - .child(project_name.unwrap_or_else(|| "Quick chat".into())) - .when(thread.worktree.is_some() || branch.is_some(), |row| row.child("·")) - .when(thread.worktree.is_some(), |row| row.child(icon(Icon::Isolated, 11., p.text_faint))) - .when_some(branch, |row, branch| row.child(div().overflow_hidden().text_ellipsis().child(branch))); - let footer = div() - .flex() - .items_center() - .gap(px(8.)) - .text_size(px(11.5)) - .text_color(p.text_faint) - .child(div().flex_1().min_w_0().flex().items_center().gap(px(4.)).when_some(snapshot.head, |row, head| { - row.child(icon(Icon::Commit, 12., p.text_faint)).child(div().font_family(MONO).child(head)) - })) - .when(snapshot.changed > 0, |row| row.child(stat(Icon::FilePen, snapshot.changed.to_string(), p.warning))) - .when(snapshot.ahead > 0, |row| row.child(stat(Icon::ArrowUp, snapshot.ahead.to_string(), p.text_muted))) - .when_some(pull, |row, pull| { - let color = match pull.state { - PullState::Open => p.success, - PullState::Merged => p.link, - PullState::Closed => p.text_faint, - }; - row.child(stat(Icon::PullRequest, format!("#{}", pull.number), color)) - }) - .when_some(weave, |row, weave| row.child(div().size(px(16.)).flex_shrink_0().child(weave))); - div() - .id(SharedString::from(format!("thread-{id}"))) - .flex() - .items_start() - .gap(px(10.)) - .px(px(10.)) - .py(px(8.)) - .rounded(px(8.)) - .cursor_pointer() - .when(active, |row| row.bg(p.row_active)) - .hover(move |style| style.bg(p.row_hover)) - .child(div().mt(px(2.)).child(mark)) - .child( - div() - .flex_1() - .min_w_0() - .flex() - .flex_col() - .gap(px(2.)) - .child( - div().flex().items_center().gap(px(8.)).child(title).child(div().flex_shrink_0().text_size(px(11.5)).child(status)), - ) - .child(place) - .child(footer), - ) - .on_click(cx.listener(move |this, _, window, cx| { - this.in_settings = false; - this.workspace.update(cx, |w, cx| w.activate(id, cx)); - this.focus_composer(window, cx); - })) - .on_mouse_down( - MouseButton::Right, - cx.listener(move |this, event: &MouseDownEvent, _, cx| { - this.menu = Some(Menu::Thread(id, event.position)); - this.confirm_delete = None; - cx.notify(); - }), - ) - } - - fn sidebar(&mut self, cx: &mut Context<Self>) -> impl IntoElement + use<> { - let p = palette(cx); - let filter = self.filter.clone(); - let threads: Vec<Thread> = self - .workspace - .read(cx) - .threads - .iter() - .filter(|t| filter.is_empty() || t.title.to_lowercase().contains(&filter)) - .cloned() - .collect(); - let empty = threads.is_empty(); - let known: Vec<u64> = self.workspace.read(cx).threads.iter().map(|t| t.id).collect(); - self.marks.retain(|id, _| known.contains(id)); - let mut groups: Vec<Vec<Stateful<Div>>> = SECTIONS.iter().map(|_| Vec::new()).collect(); - for thread in &threads { - let workspace = self.workspace.read(cx); - let live = workspace.running(thread.id) || workspace.pending(thread.id).is_some(); - groups[section(live, thread.updated)].push(self.thread_row(thread, cx)); - } - let sections = SECTIONS.iter().zip(groups).filter(|(_, rows)| !rows.is_empty()).map(|(label, rows)| { - div() - .flex() - .flex_col() - .gap(px(1.)) - .child( - div() - .px(px(10.)) - .pt(px(10.)) - .pb(px(4.)) - .text_size(px(11.5)) - .font_weight(FontWeight::SEMIBOLD) - .text_color(p.text_faint) - .child(*label), - ) - .children(rows) - }); - div() - .w(px(272.)) - .h_full() - .flex_shrink_0() - .flex() - .flex_col() - .px(px(8.)) - .pb(px(8.)) - .child( - div() - .flex() - .items_center() - .gap(px(4.)) - .pb(px(10.)) - .child( - div() - .flex_1() - .h(px(34.)) - .px(px(10.)) - .flex() - .items_center() - .rounded(px(9.)) - .bg(p.fill) - .text_size(px(13.5)) - .child(Input::new(&self.search).appearance(false).prefix(icon(Icon::Search, 14., p.text_faint))), - ) - .child( - icon_button("add-project", Icon::FolderPlus, p) - .on_click(cx.listener(|this, _, window, cx| this.show_add_project(window, cx))), - ) - .child(icon_button("new-thread", Icon::Compose, p).on_click(cx.listener(|this, _, window, cx| { - let project = this.workspace.read(cx).project(); - this.new_thread(project, window, cx); - }))), - ) - .child(div().id("threads").flex_1().min_h_0().overflow_y_scroll().flex().flex_col().children(sections).when(empty, |list| { - list.child( - div().pt(px(24.)).flex().justify_center().text_size(px(13.5)).text_color(p.text_faint).child(if filter.is_empty() { - "Your threads will show up here" - } else { - "Nothing matches that" - }), - ) - })) - .child( - div() - .flex() - .items_center() - .gap(px(2.)) - .pt(px(6.)) - .child( - icon_button("open-settings", Icon::Gear, p) - .on_click(cx.listener(|this, _, window, cx| this.open_settings(Section::General, window, cx))), - ) - .child( - icon_button("open-models", Icon::Cube, p) - .on_click(cx.listener(|this, _, window, cx| this.open_settings(Section::Models, window, cx))), - ) - .child(div().flex_1()) - .child( - div() - .id("open-version") - .px(px(8.)) - .h(px(28.)) - .flex() - .items_center() - .rounded(px(7.)) - .text_size(px(12.)) - .text_color(p.text_faint) - .cursor_pointer() - .hover(move |style| style.bg(p.row_hover).text_color(p.text)) - .child(format!("v{VERSION}")) - .on_click(cx.listener(|this, _, window, cx| this.open_settings(Section::Version, window, cx))), - ), - ) - } - - fn breadcrumb(&self, window: &Window, cx: &mut Context<Self>) -> impl IntoElement + use<> { - let p = palette(cx); - let workspace = self.workspace.read(cx); - let thread = workspace.active_thread(); - let locked = thread.is_some(); - let isolated = thread.is_some_and(|t| t.worktree.is_some()); - let title = thread.map(|t| t.title.clone()).unwrap_or_else(|| "New thread".into()); - let project_path = workspace.project(); - let project_name = project_path.as_ref().map(|path| project::name(path)); - let picker = (self.menu == Some(Menu::Project)).then(|| { - let current = project_path.clone(); - let projects = Config::get(cx).projects.clone(); - let menu = menu_panel(p) - .w(px(320.)) - .child(menu_label("Your projects", p)) - .children(projects.into_iter().enumerate().map(|(i, path)| { - let chosen = current.as_ref() == Some(&path); - menu_item( - ("pick-project", i), - Some(Icon::Folder), - project::name(&path), - Some(path.display().to_string().into()), - chosen, - p, - ) - .on_click(cx.listener(move |this, _, window, cx| this.new_thread(Some(path.clone()), window, cx))) - })) - .child(separator(p)) - .child( - menu_item( - "no-project", - Some(Icon::Chat), - "Quick chat", - Some("Talk to the model without a project or tools".into()), - current.is_none(), - p, - ) - .on_click(cx.listener(|this, _, window, cx| this.new_thread(None, window, cx))), - ) - .child( - menu_item("picker-add", Some(Icon::FolderPlus), "Add a project", None, false, p) - .on_click(cx.listener(|this, _, window, cx| this.show_add_project(window, cx))), - ); - popup(window, cx, Anchor::TopLeft, menu, |this, cx| this.close_menu(cx)) - }); - div() - .flex() - .items_center() - .gap(px(8.)) - .min_w_0() - .text_size(px(14.)) - .child( - div() - .relative() - .child( - div() - .id("project-picker") - .occlude() - .flex() - .items_center() - .gap(px(7.)) - .h(px(28.)) - .px(px(8.)) - .rounded(px(7.)) - .text_color(p.text_muted) - .when(!locked, |b| b.cursor_pointer().hover(move |style| style.bg(p.row_hover).text_color(p.text))) - .child(match &project_name { - Some(name) => badge(name, 16.).into_any_element(), - None => icon(Icon::Chat, 15., p.text_faint).into_any_element(), - }) - .child(project_name.clone().unwrap_or_else(|| "Quick chat".into())) - .when(isolated, |b| b.child(icon(Icon::Isolated, 13., p.text_faint))) - .when(!locked, |b| b.child(icon(Icon::ChevronDown, 13., p.text_faint))) - .on_click(cx.listener(move |this, _, _, cx| { - if !locked { - this.menu = Some(Menu::Project); - cx.notify(); - } - })), - ) - .children(picker), - ) - .child(div().text_color(p.text_faint).child("/")) - .child( - div() - .min_w_0() - .overflow_hidden() - .whitespace_nowrap() - .text_ellipsis() - .font_weight(FontWeight::SEMIBOLD) - .text_color(p.text) - .child(title), - ) - } - - fn env_card(&mut self, cx: &mut Context<Self>) -> Option<impl IntoElement + use<>> { - let p = palette(cx); - let path = self.workspace.read(cx).workdir()?; - let info = self.repo(&path); - let changes = self.workspace.read(cx).active_thread().and_then(|t| { - t.turns.iter().rev().find(|turn| turn.diffs().next().is_some()).map(|turn| { - let c = turn.changes(); - (c.iter().map(|x| x.added).sum::<usize>(), c.iter().map(|x| x.removed).sum::<usize>()) - }) - }); - let editor = self.editor; - let open_path = path.clone(); - let reveal_path = path.clone(); - Some( - div() - .absolute() - .top(px(14.)) - .right(px(14.)) - .w(px(250.)) - .p(px(5.)) - .rounded(px(14.)) - .bg(p.menu_bg) - .border_1() - .border_color(p.border_soft) - .flex() - .flex_col() - .gap(px(1.)) - .when(editor, |card| { - card.child( - menu_item("open-vscode", Some(Icon::Code), "Open in VS Code", None, false, p) - .on_click(move |_, _, _| project::open_in_editor(&open_path)), - ) - }) - .child( - menu_item("open-explorer", Some(Icon::FolderOpen), "Show in File Explorer", None, false, p) - .on_click(move |_, _, _| project::open_folder(&reveal_path)), - ) - .child(separator(p)) - .child(match info.branch { - Some(branch) => menu_item("branch", Some(Icon::Branch), branch, None, false, p), - None => { - menu_item("no-git", Some(Icon::Branch), if info.repo { "No commits yet" } else { "Not using Git" }, None, false, p) - } - }) - .child( - menu_item("changes", Some(Icon::FileDiff), "Edits in this thread", None, false, p) - .when_some(changes, |row, (added, removed)| { - row.child(div().text_size(px(12.)).text_color(p.add).child(format!("+{added}"))) - .child(div().text_size(px(12.)).text_color(p.del).child(format!("-{removed}"))) - }) - .on_click(cx.listener(|this, _, _, cx| this.toggle_panel(Tab::Diff, cx))), - ) - .when(info.repo, |card| { - card.child( - menu_item("commit-work", Some(Icon::Commit), "Commit your work", None, false, p) - .on_click(cx.listener(|this, _, window, cx| this.open_commit(window, cx))), - ) - }), - ) - } - - fn fresh(&self, cx: &mut Context<Self>) -> AnyElement { - let p = palette(cx); - let project = self.workspace.read(cx).draft_project.clone(); - let heading: AnyElement = match &project { - Some(path) => div() - .flex() - .gap(px(9.)) - .child("What's next for") - .child(div().font_weight(FontWeight::SEMIBOLD).child(format!("{}?", project::name(path)))) - .into_any_element(), - None => div().child(self.greeting).into_any_element(), - }; - div() - .size_full() - .flex() - .flex_col() - .items_center() - .justify_center() - .px(px(32.)) - .pb(px(72.)) - .child(div().size(px(76.)).child(self.hero.clone())) - .child(div().mt(px(18.)).text_size(px(30.)).line_height(px(38.)).text_color(p.text).child(heading)) - .child( - div() - .id("fresh-sub") - .mt(px(6.)) - .px(px(8.)) - .py(px(2.)) - .rounded(px(7.)) - .text_size(px(14.)) - .text_color(p.text_muted) - .cursor_pointer() - .hover(move |style| style.bg(p.row_hover).text_color(p.text)) - .child(if project.is_some() { "or switch to a quick chat" } else { "Pick a project to work in" }) - .on_click(cx.listener(move |this, _, window, cx| { - if this.workspace.read(cx).draft_project.is_some() { - this.new_thread(None, window, cx); - } else { - this.menu = Some(Menu::Project); - cx.notify(); - } - })), - ) - .child(div().mt(px(26.)).w_full().flex().justify_center().child(self.composer.clone())) - .into_any_element() - } - - fn thread_menu(&self, id: u64, position: Point<Pixels>, cx: &mut Context<Self>) -> impl IntoElement + use<> { - let p = palette(cx); - let thread = self.workspace.read(cx).threads.iter().find(|t| t.id == id); - let project_path = thread.and_then(|t| t.project.clone()); - let isolated = thread.is_some_and(|t| t.worktree.is_some()); - let confirming = self.confirm_delete == Some(id); - let menu = menu_panel(p) - .w(px(240.)) - .child( - menu_item("ctx-rename", Some(Icon::Pencil), "Rename", None, false, p) - .on_click(cx.listener(move |this, _, window, cx| this.start_rename(id, window, cx))), - ) - .when_some(project_path, |menu, path| { - let next = path.clone(); - menu.child( - menu_item("ctx-new", Some(Icon::Compose), "Start another thread here", None, false, p) - .on_click(cx.listener(move |this, _, window, cx| this.new_thread(Some(next.clone()), window, cx))), - ) - .child( - menu_item("ctx-folder", Some(Icon::FolderOpen), "Show project in File Explorer", None, false, p).on_click(cx.listener( - move |this, _, _, cx| { - project::open_folder(&path); - this.close_menu(cx); - }, - )), - ) - }) - .when(isolated, |menu| { - menu.child( - menu_item("ctx-unisolate", Some(Icon::Isolated), "Remove the isolated copy", None, false, p) - .on_click(cx.listener(move |this, _, _, cx| this.remove_isolated(id, cx))), - ) - }) - .child(separator(p)) - .child( - menu_item("ctx-delete", Some(Icon::Trash), if confirming { "Click again to delete" } else { "Delete" }, None, false, p) - .text_color(p.danger) - .on_click(cx.listener(move |this, _, _, cx| { - if this.confirm_delete == Some(id) { - this.workspace.update(cx, |w, cx| w.delete(id, cx)); - this.close_menu(cx); - } else { - this.confirm_delete = Some(id); - cx.notify(); - } - })), - ); - div() - .child( - deferred( - anchored().position(point(px(0.), px(0.))).child( - div() - .id("shell-backdrop") - .w(px(10000.)) - .h(px(10000.)) - .occlude() - .on_mouse_down(MouseButton::Left, cx.listener(|this, _, _, cx| this.close_menu(cx))) - .on_mouse_down(MouseButton::Right, cx.listener(|this, _, _, cx| this.close_menu(cx))), - ), - ) - .with_priority(1), - ) - .child(deferred(anchored().position(position).snap_to_window().child(menu)).with_priority(2)) - } -} - -const SECTIONS: [&str; 4] = ["In motion", "Past day", "Past week", "Older"]; - -fn section(live: bool, updated: u64) -> usize { - if live { - return 0; - } - match now_ms().saturating_sub(updated) / 3_600_000 { - 0..24 => 1, - 24..168 => 2, - _ => 3, - } -} - -fn stat(name: Icon, text: String, color: Hsla) -> Div { - div().flex().items_center().gap(px(3.)).text_color(color).child(icon(name, 12., color)).child(text) -} - -fn icon_button(id: &'static str, name: Icon, p: Palette) -> Stateful<Div> { - div() - .id(id) - .flex() - .flex_shrink_0() - .items_center() - .justify_center() - .size(px(30.)) - .rounded(px(8.)) - .cursor_pointer() - .hover(move |style| style.bg(p.row_hover)) - .child(icon(name, 16., p.text_muted)) -} - -impl Render for Shell { - fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement { - let p = palette(cx); - let has_thread = self.workspace.read(cx).active.is_some(); - let has_repo = self.workspace.read(cx).workdir().is_some_and(|root| self.repo(&root).repo); - let panel_open = self.panel_open; - let panel_tab = self.panel.read(cx).tab; - let mut bar = div().flex().items_center().h_full().flex_1().pr(px(8.)).child( - div() - .w(px(272.)) - .flex_shrink_0() - .flex() - .items_center() - .gap(px(8.)) - .pl(px(6.)) - .child(div().size(px(20.)).child(self.brand.clone())) - .child(div().text_size(px(14.5)).font_weight(FontWeight::SEMIBOLD).text_color(p.text).child(APP_NAME)), - ); - if self.in_settings { - bar = bar.child(div().text_size(px(14.)).text_color(p.text_muted).child("Settings")); - } else { - bar = bar.child(self.breadcrumb(window, cx)).child(div().flex_1()); - if has_repo { - bar = bar.child( - icon_button("title-commit", Icon::Commit, p) - .occlude() - .when(self.commit.is_some(), |b| b.bg(p.row_active)) - .on_click(cx.listener(|this, _, window, cx| this.open_commit(window, cx))), - ); - } - bar = bar.child( - icon_button("toggle-terminal", Icon::Terminal, p) - .occlude() - .when(self.terminal_open, |b| b.bg(p.row_active)) - .on_click(cx.listener(|this, _, window, cx| this.toggle_terminal(window, cx))), - ); - for (id, name, tab) in [("toggle-files", Icon::Files, Tab::Files), ("toggle-diff", Icon::FileDiff, Tab::Diff)] { - let on = panel_open && panel_tab == tab; - bar = bar.child( - icon_button(id, name, p) - .occlude() - .when(on, |b| b.bg(p.row_active)) - .on_click(cx.listener(move |this, _, _, cx| this.toggle_panel(tab, cx))), - ); - } - } - let body: AnyElement = if self.in_settings { - self.settings.clone().cached(StyleRefinement::default().size_full()).into_any_element() - } else { - let center: AnyElement = if has_thread { - div() - .size_full() - .flex() - .flex_col() - .child(div().flex_1().min_h_0().child(self.thread_view.clone().cached(StyleRefinement::default().size_full()))) - .child(div().flex_shrink_0().flex().justify_center().px(px(28.)).pb(px(16.)).child(self.composer.clone())) - .into_any_element() - } else { - self.fresh(cx) - }; - let wide = window.viewport_size().width >= px(1700.); - let env = if panel_open || (has_thread && !wide) { None } else { self.env_card(cx) }; - let panel_width = px(((window.viewport_size().width.as_f32() - 272.) * 0.44).clamp(380., 640.)); - let sidebar = self.sidebar(cx); - let terminal_open = self.terminal_open; - div() - .size_full() - .flex() - .child(sidebar) - .child( - div() - .flex_1() - .min_w_0() - .h_full() - .flex() - .bg(p.bg) - .rounded_tl(px(10.)) - .border_t_1() - .border_l_1() - .border_color(p.border_soft) - .overflow_hidden() - .child( - div() - .flex_1() - .min_w_0() - .h_full() - .flex() - .flex_col() - .child(div().relative().flex_1().min_h_0().child(center).children(env)) - .when(terminal_open, |col| { - col.child( - div() - .h(px(280.)) - .flex_shrink_0() - .border_t_1() - .border_color(p.border_soft) - .child(self.terminal.clone().cached(StyleRefinement::default().size_full())), - ) - }), - ) - .when(panel_open, |main| { - main.child( - div() - .w(panel_width) - .flex_shrink_0() - .h_full() - .border_l_1() - .border_color(p.border_soft) - .child(self.panel.clone().cached(StyleRefinement::default().size_full())), - ) - }), - ) - .into_any_element() - }; - let thread_menu = match self.menu { - Some(Menu::Thread(id, position)) => Some(self.thread_menu(id, position, cx)), - _ => None, - }; - let toast = self.toast.clone().map(|(title, detail)| { - div() - .absolute() - .top(px(48.)) - .right(px(18.)) - .w(px(360.)) - .flex() - .gap(px(10.)) - .px(px(14.)) - .py(px(12.)) - .rounded(px(12.)) - .bg(p.menu_bg) - .border_1() - .border_color(p.border) - .shadow_lg() - .child(icon(Icon::CheckCircle, 16., p.success)) - .child( - div() - .flex_1() - .min_w_0() - .flex() - .flex_col() - .gap(px(2.)) - .child(div().text_size(px(13.5)).font_weight(FontWeight::SEMIBOLD).text_color(p.text).child(title)) - .when(!detail.is_empty(), |col| col.child(div().text_size(px(12.5)).text_color(p.text_faint).child(detail))), - ) - }); - div() - .size_full() - .relative() - .flex() - .flex_col() - .bg(p.sidebar) - .font_family(FONT) - .text_color(p.text) - .child(TitleBar::new().child(bar)) - .child(div().flex_1().min_h_0().child(body)) - .children(thread_menu) - .children(self.add_project.clone()) - .children(self.commit.clone()) - .children(toast) - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn threads_fall_into_sections_by_age() { - let hours_ago = |h: u64| now_ms() - h * 3_600_000; - assert_eq!(section(true, hours_ago(500)), 0); - assert_eq!(section(false, hours_ago(2)), 1); - assert_eq!(section(false, hours_ago(30)), 2); - assert_eq!(section(false, hours_ago(200)), 3); - } -} \ No newline at end of file diff --git a/crates/quill-code/src/smooth_scroll.rs b/crates/quill-code/src/smooth_scroll.rs deleted file mode 100644 index 9b70867..0000000 --- a/crates/quill-code/src/smooth_scroll.rs +++ /dev/null @@ -1,71 +0,0 @@ -use std::time::Instant; - -use gpui_kit::{Pixels, px}; - -const RATE: f32 = 12.0; -const SETTLE: f32 = 0.5; - -#[derive(Default)] -pub struct SmoothScroll { - target: Option<Pixels>, - last: Option<Instant>, -} - -impl SmoothScroll { - pub fn moving(&self) -> bool { - self.target.is_some() - } - - pub fn nudge(&mut self, current: Pixels, delta: Pixels, max: Pixels) { - let from = self.target.unwrap_or(current); - self.target = Some((from + delta).clamp(-max, px(0.))); - } - - pub fn cancel(&mut self) { - self.target = None; - self.last = None; - } - - pub fn step(&mut self, current: Pixels, now: Instant) -> Option<Pixels> { - let target = self.target?; - let dt = self.last.map_or(1.0 / 60.0, |last| (now - last).as_secs_f32().min(0.05)); - self.last = Some(now); - let next = current + (target - current) * (1.0 - (-dt * RATE).exp()); - if (target - next).abs() < px(SETTLE) { - self.cancel(); - return Some(target); - } - Some(next) - } -} - -#[cfg(test)] -mod tests { - use std::time::Duration; - - use super::*; - - #[test] - fn glides_to_the_target_and_settles() { - let mut scroll = SmoothScroll::default(); - scroll.nudge(px(0.), px(-300.), px(1000.)); - scroll.nudge(px(0.), px(-200.), px(1000.)); - let mut now = Instant::now(); - let mut offset = px(0.); - while let Some(next) = scroll.step(offset, now) { - offset = next; - now += Duration::from_millis(16); - } - assert_eq!(offset, px(-500.)); - assert!(!scroll.moving()); - } - - #[test] - fn targets_stay_within_the_scroll_range() { - let mut scroll = SmoothScroll::default(); - scroll.nudge(px(-10.), px(50.), px(100.)); - assert_eq!(scroll.target, Some(px(0.))); - scroll.nudge(px(0.), px(-500.), px(100.)); - assert_eq!(scroll.target, Some(px(-100.))); - } -} \ No newline at end of file diff --git a/crates/quill-code/src/store.rs b/crates/quill-code/src/store.rs index 78a26b7..1b40a2b 100644 --- a/crates/quill-code/src/store.rs +++ b/crates/quill-code/src/store.rs @@ -37,9 +37,11 @@ pub fn load_threads() -> Vec<Thread> { } pub fn save(thread: &Thread) { - let dir = threads_dir(); - if let Ok(text) = serde_json::to_string(thread) { - let _ = fs::create_dir_all(&dir).and_then(|_| fs::write(dir.join(format!("{}.json", thread.id)), text)); + let path = threads_dir().join(format!("{}.json", thread.id)); + if let Ok(value) = serde_json::to_value(thread) + && let Ok(text) = serde_json::to_string(&quill_config::keep_unknown(&path, value)) + { + let _ = quill_config::write_atomic(&path, &text); } } diff --git a/crates/quill-code/src/term.rs b/crates/quill-code/src/term.rs new file mode 100644 index 0000000..e6cdcf8 --- /dev/null +++ b/crates/quill-code/src/term.rs @@ -0,0 +1,449 @@ +use std::io::{self, Stdout, Write, stdout}; +use std::sync::atomic::{AtomicBool, Ordering}; +use std::sync::mpsc::Sender; +use std::time::Duration; + +use crossterm::Command; +use crossterm::cursor::{Hide, MoveTo, Show}; +use crossterm::event::{ + self, DisableBracketedPaste, DisableMouseCapture, EnableBracketedPaste, EnableMouseCapture, Event, KeyCode, KeyEvent, KeyEventKind, + KeyModifiers, KeyboardEnhancementFlags, MouseEventKind, PopKeyboardEnhancementFlags, PushKeyboardEnhancementFlags, +}; +use crossterm::queue; +use crossterm::terminal::{ + self, BeginSynchronizedUpdate, Clear, ClearType, EndSynchronizedUpdate, EnterAlternateScreen, LeaveAlternateScreen, SetTitle, +}; + +use crate::Msg; +use crate::text::{Line, dim, truncate}; + +static PAUSED: AtomicBool = AtomicBool::new(false); + +const WHEEL: i64 = 3; + +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Live { + pub lines: Vec<Line>, + pub cursor: Option<(usize, usize)>, + pub top: usize, +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum Scroll { + Lines(i64), + Pages(i64), + Top, + Bottom, +} + +#[derive(Default)] +pub struct Layout { + pub width: usize, + pub height: usize, + transcript: Vec<Line>, + offset: usize, + seen: usize, + area: usize, + painted: Vec<String>, +} + +fn code(out: &mut String, command: impl Command) { + let _ = command.write_ansi(out); +} + +impl Layout { + pub fn new(width: usize, height: usize) -> Layout { + Layout { width, height, ..Layout::default() } + } + + pub fn room(&self) -> usize { + self.width.max(20) - 1 + } + + pub fn rows(&self) -> usize { + self.height.max(4) + } + + pub fn transcript(&self) -> &[Line] { + &self.transcript + } + + pub fn resized(&mut self, width: usize, height: usize) { + self.width = width; + self.height = height; + self.painted.clear(); + } + + pub fn clear(&mut self) { + self.transcript.clear(); + self.offset = 0; + self.seen = 0; + self.painted.clear(); + } + + pub fn repaint(&mut self) { + self.painted.clear(); + } + + pub fn scroll(&mut self, scroll: Scroll) { + let page = self.area.saturating_sub(2).max(1) as i64; + let moved = |by: i64| (self.offset as i64 + by).max(0) as usize; + self.offset = match scroll { + Scroll::Lines(lines) => moved(lines), + Scroll::Pages(pages) => moved(pages * page), + Scroll::Top => usize::MAX, + Scroll::Bottom => 0, + }; + } + + pub fn frame(&mut self, history: &[Line], live: &Live) -> String { + self.transcript.extend_from_slice(history); + let rows = self.rows(); + let top = live.top.min(live.lines.len()); + let bottom = &live.lines[top..]; + let hidden = bottom.len().saturating_sub(rows); + let below = &bottom[hidden..]; + let area = rows - below.len(); + let total = self.transcript.len() + top; + if self.offset > 0 { + self.offset += total.saturating_sub(self.seen); + } + self.seen = total; + self.offset = self.offset.min(total.saturating_sub(area)); + self.area = area; + let end = total - self.offset; + let start = end.saturating_sub(area); + let count = self.transcript.len(); + let mut screen: Vec<Line> = (start..end) + .map(|index| if index < count { self.transcript[index].clone() } else { live.lines[index - count].clone() }) + .collect(); + if self.offset > 0 + && let Some(last) = screen.last_mut() + { + *last = Line::styled(format!(" ↓ {} more lines below · page down or scroll to follow", self.offset), dim()); + } + screen.resize(area, Line::default()); + screen.extend(below.iter().cloned()); + let cursor = live.cursor.and_then(|(row, column)| Some((area + row.checked_sub(top + hidden)?, column))); + let mut out = String::new(); + code(&mut out, BeginSynchronizedUpdate); + if self.painted.len() != rows { + self.painted = vec![String::new(); rows]; + code(&mut out, Clear(ClearType::All)); + } + let room = self.room(); + for (row, line) in screen.iter().enumerate() { + let text = truncate(line, room).ansi(); + if self.painted[row] != text { + code(&mut out, MoveTo(0, row as u16)); + out.push_str(&text); + code(&mut out, Clear(ClearType::UntilNewLine)); + self.painted[row] = text; + } + } + let (row, column) = cursor.filter(|(row, _)| *row < rows).unwrap_or((rows - 1, 0)); + code(&mut out, MoveTo(column as u16, row as u16)); + code(&mut out, EndSynchronizedUpdate); + out + } +} + +pub struct Screen { + out: Stdout, + pub layout: Layout, + enhanced: bool, + active: bool, +} + +fn restore(enhanced: bool) { + let mut out = stdout(); + if enhanced { + let _ = queue!(out, PopKeyboardEnhancementFlags); + } + let _ = queue!(out, DisableMouseCapture, DisableBracketedPaste, LeaveAlternateScreen, Show); + let _ = out.flush(); + let _ = terminal::disable_raw_mode(); +} + +fn enter(out: &mut Stdout, enhanced: bool) -> io::Result<()> { + terminal::enable_raw_mode()?; + queue!(out, EnterAlternateScreen, EnableBracketedPaste, EnableMouseCapture, Hide)?; + if enhanced { + queue!(out, PushKeyboardEnhancementFlags(KeyboardEnhancementFlags::DISAMBIGUATE_ESCAPE_CODES))?; + } + out.flush() +} + +impl Screen { + pub fn start() -> io::Result<Screen> { + let enhanced = matches!(terminal::supports_keyboard_enhancement(), Ok(true)); + let hook = std::panic::take_hook(); + std::panic::set_hook(Box::new(move |info| { + restore(enhanced); + hook(info); + })); + let mut out = stdout(); + queue!(out, SetTitle("Quill Code"))?; + enter(&mut out, enhanced)?; + let (width, height) = terminal::size()?; + Ok(Screen { out, layout: Layout::new(width as usize, height as usize), enhanced, active: true }) + } + + pub fn resized(&mut self) { + if let Ok((width, height)) = terminal::size() { + self.layout.resized(width as usize, height as usize); + } + } + + pub fn clear(&mut self) { + self.layout.clear(); + } + + pub fn draw(&mut self, history: &[Line], live: &Live) -> io::Result<()> { + let frame = self.layout.frame(history, live); + self.out.write_all(frame.as_bytes())?; + self.out.flush() + } + + pub fn finish(&mut self, lines: &[Line]) -> io::Result<()> { + restore(self.enhanced); + self.active = false; + let mut out = stdout(); + for line in self.layout.transcript().iter().chain(lines) { + writeln!(out, "{}", line.ansi())?; + } + out.flush() + } + + pub fn suspend<R>(&mut self, lines: &[Line], run: impl FnOnce() -> R) -> io::Result<R> { + PAUSED.store(true, Ordering::Relaxed); + std::thread::sleep(Duration::from_millis(150)); + self.layout.frame(lines, &Live::default()); + restore(self.enhanced); + let result = run(); + enter(&mut self.out, self.enhanced)?; + self.layout.repaint(); + PAUSED.store(false, Ordering::Relaxed); + Ok(result) + } +} + +impl Drop for Screen { + fn drop(&mut self) { + if self.active { + restore(self.enhanced); + } + } +} + +fn typed(key: &KeyEvent) -> Option<char> { + let altgr = key.modifiers.contains(KeyModifiers::CONTROL | KeyModifiers::ALT); + let plain = !key.modifiers.intersects(KeyModifiers::CONTROL | KeyModifiers::ALT); + match key.code { + KeyCode::Char(c) if plain || altgr => Some(c), + KeyCode::Enter if plain => Some('\n'), + KeyCode::Tab if plain => Some('\t'), + _ => None, + } +} + +pub fn translate(events: Vec<Event>) -> Vec<Msg> { + let presses: Vec<&KeyEvent> = events + .iter() + .filter_map(|event| match event { + Event::Key(key) if key.kind != KeyEventKind::Release => Some(key), + _ => None, + }) + .collect(); + let pasted = + presses.len() > 2 && presses.iter().all(|key| typed(key).is_some()) && presses.iter().any(|key| key.code != KeyCode::Enter); + if pasted { + return vec![Msg::Paste(presses.iter().filter_map(|key| typed(key)).collect())]; + } + events + .into_iter() + .filter_map(|event| match event { + Event::Key(key) if key.kind != KeyEventKind::Release => Some(Msg::Key(key)), + Event::Paste(text) => Some(Msg::Paste(text)), + Event::Resize(..) => Some(Msg::Resize), + Event::Mouse(mouse) => match mouse.kind { + MouseEventKind::ScrollUp => Some(Msg::Scroll(Scroll::Lines(WHEEL))), + MouseEventKind::ScrollDown => Some(Msg::Scroll(Scroll::Lines(-WHEEL))), + _ => None, + }, + _ => None, + }) + .collect() +} + +pub fn listen(tx: Sender<Msg>) { + std::thread::Builder::new() + .name("quill-input".into()) + .spawn(move || { + loop { + if PAUSED.load(Ordering::Relaxed) { + std::thread::sleep(Duration::from_millis(50)); + continue; + } + match event::poll(Duration::from_millis(100)) { + Ok(true) => {} + Ok(false) => continue, + Err(_) => return, + } + let Ok(first) = event::read() else { return }; + let mut batch = vec![first]; + while batch.len() < 8192 && event::poll(Duration::from_millis(4)).unwrap_or(false) { + match event::read() { + Ok(event) => batch.push(event), + Err(_) => break, + } + } + for msg in translate(batch) { + if tx.send(msg).is_err() { + return; + } + } + } + }) + .expect("start the input thread"); +} + +#[cfg(test)] +mod tests { + use super::*; + use crossterm::event::{MouseEvent, MouseEventKind}; + + struct Vt { + width: usize, + grid: Vec<Vec<char>>, + row: usize, + column: usize, + } + + impl Vt { + fn new(width: usize, height: usize) -> Vt { + Vt { width, grid: vec![vec![' '; width]; height], row: 0, column: 0 } + } + + fn feed(&mut self, text: &str) { + let mut chars = text.chars().peekable(); + while let Some(c) = chars.next() { + match c { + '\u{1b}' => { + chars.next(); + let mut params = String::new(); + let mut last = ' '; + for next in chars.by_ref() { + if ('@'..='~').contains(&next) { + last = next; + break; + } + params.push(next); + } + let numbers: Vec<usize> = params.trim_start_matches('?').split(';').filter_map(|p| p.parse().ok()).collect(); + match last { + 'H' => { + self.row = numbers.first().copied().unwrap_or(1).max(1) - 1; + self.column = numbers.get(1).copied().unwrap_or(1).max(1) - 1; + } + 'K' => self.grid[self.row][self.column..].fill(' '), + 'J' => self.grid.iter_mut().for_each(|row| row.fill(' ')), + _ => {} + } + } + c => { + if self.column < self.width { + self.grid[self.row][self.column] = c; + } + self.column += 1; + } + } + } + } + + fn screen(&self) -> Vec<String> { + self.grid.iter().map(|row| row.iter().collect::<String>().trim_end().to_string()).collect() + } + } + + fn lines(texts: &[&str]) -> Vec<Line> { + texts.iter().map(|text| Line::plain(*text)).collect() + } + + fn live(texts: &[&str], cursor: Option<(usize, usize)>) -> Live { + Live { lines: lines(texts), cursor, top: 0 } + } + + fn numbered(from: usize, to: usize) -> Vec<Line> { + (from..=to).map(|n| Line::plain(format!("line {n}"))).collect() + } + + #[test] + fn the_prompt_stays_at_the_bottom_and_history_fills_from_the_top() { + let mut vt = Vt::new(40, 6); + let mut layout = Layout::new(40, 6); + let banner = Live { lines: lines(&["banner", "› ", "status"]), cursor: Some((1, 2)), top: 1 }; + vt.feed(&layout.frame(&[], &banner)); + assert_eq!(vt.screen(), vec!["banner", "", "", "", "›", "status"]); + assert_eq!((vt.row, vt.column), (4, 2)); + vt.feed(&layout.frame(&lines(&["banner", "› hi"]), &live(&["› ", "status"], Some((0, 2))))); + assert_eq!(vt.screen(), vec!["banner", "› hi", "", "", "›", "status"]); + vt.feed(&layout.frame(&numbered(1, 6), &live(&["› ", "status"], Some((0, 2))))); + assert_eq!(vt.screen(), vec!["line 3", "line 4", "line 5", "line 6", "›", "status"]); + } + + #[test] + fn scrolling_up_holds_the_view_while_output_arrives() { + let mut vt = Vt::new(60, 6); + let mut layout = Layout::new(60, 6); + let prompt = live(&["› ", "status"], Some((0, 2))); + vt.feed(&layout.frame(&numbered(1, 10), &prompt)); + assert_eq!(vt.screen()[..4], ["line 7", "line 8", "line 9", "line 10"]); + layout.scroll(Scroll::Lines(3)); + vt.feed(&layout.frame(&[], &prompt)); + assert_eq!(vt.screen()[..3], ["line 4", "line 5", "line 6"]); + assert!(vt.screen()[3].contains("3 more lines below")); + vt.feed(&layout.frame(&numbered(11, 12), &prompt)); + assert_eq!(vt.screen()[..3], ["line 4", "line 5", "line 6"]); + assert!(vt.screen()[3].contains("5 more lines below")); + layout.scroll(Scroll::Top); + vt.feed(&layout.frame(&[], &prompt)); + assert_eq!(vt.screen()[0], "line 1"); + layout.scroll(Scroll::Bottom); + vt.feed(&layout.frame(&[], &prompt)); + assert_eq!(vt.screen()[..4], ["line 9", "line 10", "line 11", "line 12"]); + } + + #[test] + fn a_live_area_taller_than_the_screen_keeps_its_bottom() { + let mut vt = Vt::new(30, 4); + let mut layout = Layout::new(30, 4); + vt.feed(&layout.frame(&[], &live(&["a", "b", "c", "d", "› ", "status"], Some((4, 2))))); + assert_eq!(vt.screen(), vec!["c", "d", "›", "status"]); + assert_eq!((vt.row, vt.column), (2, 2)); + } + + #[test] + fn only_changed_rows_are_painted() { + let mut layout = Layout::new(30, 4); + let prompt = live(&["› ", "status"], Some((0, 2))); + layout.frame(&lines(&["hello"]), &prompt); + let again = layout.frame(&[], &prompt); + assert!(!again.contains("hello") && !again.contains("status")); + layout.clear(); + assert!(layout.frame(&[], &prompt).contains("status")); + } + + #[test] + fn bursts_of_typing_become_a_paste() { + let key = |code| Event::Key(KeyEvent::new(code, KeyModifiers::NONE)); + let burst = vec![key(KeyCode::Char('a')), key(KeyCode::Enter), key(KeyCode::Char('b')), key(KeyCode::Char('c'))]; + assert!(matches!(translate(burst).as_slice(), [Msg::Paste(text)] if text == "a\nbc")); + assert_eq!(translate(vec![key(KeyCode::Char('a')), key(KeyCode::Enter)]).len(), 2); + assert_eq!(translate(vec![key(KeyCode::Up), key(KeyCode::Up), key(KeyCode::Up)]).len(), 3); + let release = Event::Key(KeyEvent::new_with_kind(KeyCode::Char('x'), KeyModifiers::NONE, KeyEventKind::Release)); + assert!(translate(vec![release]).is_empty()); + let wheel = Event::Mouse(MouseEvent { kind: MouseEventKind::ScrollUp, column: 0, row: 0, modifiers: KeyModifiers::NONE }); + assert!(matches!(translate(vec![wheel]).as_slice(), [Msg::Scroll(Scroll::Lines(WHEEL))])); + } +} \ No newline at end of file diff --git a/crates/quill-code/src/terminal.rs b/crates/quill-code/src/terminal.rs deleted file mode 100644 index 1fcd0de..0000000 --- a/crates/quill-code/src/terminal.rs +++ /dev/null @@ -1,373 +0,0 @@ -use std::io::{BufRead, BufReader, Read, Write}; -use std::path::PathBuf; -use std::process::{Child, ChildStdin, Stdio}; - -use futures::StreamExt; -use futures::channel::mpsc::UnboundedSender; -use gpui_kit::component::input::{Input, InputEvent, InputState}; -use gpui_kit::{ - Context, Entity, EventEmitter, Focusable, IntoElement, KeystrokeEvent, ParentElement, Render, ScrollStrategy, SharedString, Styled, - Subscription, UniformListScrollHandle, Window, div, prelude::*, px, uniform_list, -}; - -use crate::git::hidden; -use crate::icons::Icon; -use crate::palette::palette; -use crate::ui::{MONO, icon}; - -const DONE: &str = "__quill_done__"; -const MAX_LINES: usize = 5000; - -#[derive(Clone, Copy, PartialEq, Eq)] -enum Kind { - Command, - Output, - Error, - Note, -} - -enum ShellEvent { - Line(Kind, String), - Done { ok: bool, cwd: String }, - Exited, -} - -struct Session { - child: Child, - stdin: ChildStdin, -} - -pub struct CloseTerminal; - -pub struct Terminal { - root: Option<PathBuf>, - cwd: String, - lines: Vec<(Kind, SharedString)>, - input: Entity<InputState>, - session: Option<Session>, - busy: bool, - history: Vec<String>, - recall: Option<usize>, - scroll: UniformListScrollHandle, - _subscriptions: Vec<Subscription>, -} - -impl EventEmitter<CloseTerminal> for Terminal {} - -fn pump(reader: impl Read + Send + 'static, kind: Kind, tx: UnboundedSender<ShellEvent>) { - std::thread::spawn(move || { - let mut reader = BufReader::new(reader); - let mut buf = Vec::new(); - loop { - buf.clear(); - match reader.read_until(b'\n', &mut buf) { - Ok(0) | Err(_) => break, - Ok(_) => { - let line = String::from_utf8_lossy(&buf).trim_end_matches(['\r', '\n']).to_string(); - let event = match line.strip_prefix(DONE) { - Some(rest) => { - let (ok, cwd) = rest.trim().split_once(' ').unwrap_or(("1", "")); - ShellEvent::Done { ok: ok == "1", cwd: cwd.to_string() } - } - None => ShellEvent::Line(kind, line), - }; - if tx.unbounded_send(event).is_err() { - break; - } - } - } - } - if kind == Kind::Output { - let _ = tx.unbounded_send(ShellEvent::Exited); - } - }); -} - -impl Terminal { - pub fn new(window: &mut Window, cx: &mut Context<Self>) -> Self { - let input = cx.new(|cx| InputState::new(window, cx).placeholder("Type a PowerShell command and press Enter")); - let weak = cx.entity().downgrade(); - let subscriptions = vec![ - cx.subscribe_in(&input, window, |this, _, event: &InputEvent, window, cx| { - if let InputEvent::PressEnter { .. } = event { - this.submit(window, cx); - } - }), - cx.intercept_keystrokes(move |event, window, cx| { - if let Some(this) = weak.upgrade() { - this.update(cx, |this, cx| this.intercept(event, window, cx)); - } - }), - ]; - Terminal { - root: None, - cwd: String::new(), - lines: Vec::new(), - input, - session: None, - busy: false, - history: Vec::new(), - recall: None, - scroll: UniformListScrollHandle::new(), - _subscriptions: subscriptions, - } - } - - pub fn set_root(&mut self, root: Option<PathBuf>, cx: &mut Context<Self>) { - if self.root == root { - return; - } - self.stop_session(); - self.root = root; - self.cwd = self.root.as_ref().map(|r| r.display().to_string()).unwrap_or_default(); - self.lines.clear(); - cx.notify(); - } - - pub fn focus(&self, window: &mut Window, cx: &mut Context<Self>) { - self.input.update(cx, |input, cx| input.focus(window, cx)); - } - - fn stop_session(&mut self) { - if let Some(mut session) = self.session.take() { - let _ = session.child.kill(); - } - self.busy = false; - } - - fn push(&mut self, kind: Kind, text: impl Into<SharedString>) { - self.lines.push((kind, text.into())); - if self.lines.len() > MAX_LINES { - self.lines.drain(..self.lines.len() - MAX_LINES); - } - self.scroll.scroll_to_item(self.lines.len().saturating_sub(1), ScrollStrategy::Bottom); - } - - fn start(&mut self, cx: &mut Context<Self>) -> bool { - if self.session.is_some() { - return true; - } - let Some(root) = self.root.clone() else { - self.push(Kind::Note, "Open a project to use the terminal."); - return false; - }; - let spawned = hidden("powershell") - .args(["-NoLogo", "-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-Command", "-"]) - .current_dir(&root) - .stdin(Stdio::piped()) - .stdout(Stdio::piped()) - .stderr(Stdio::piped()) - .spawn(); - let mut child = match spawned { - Ok(child) => child, - Err(error) => { - self.push(Kind::Error, format!("PowerShell could not start: {error}")); - return false; - } - }; - let (Some(stdin), Some(stdout), Some(stderr)) = (child.stdin.take(), child.stdout.take(), child.stderr.take()) else { - let _ = child.kill(); - return false; - }; - let (tx, mut rx) = futures::channel::mpsc::unbounded(); - pump(stdout, Kind::Output, tx.clone()); - pump(stderr, Kind::Error, tx); - cx.spawn(async move |this, cx| { - while let Some(event) = rx.next().await { - if this.update(cx, |this, cx| this.apply(event, cx)).is_err() { - break; - } - } - }) - .detach(); - self.session = Some(Session { child, stdin }); - let mut setup = String::from( - "[Console]::OutputEncoding=[Text.Encoding]::UTF8; $OutputEncoding=[Text.Encoding]::UTF8; $ProgressPreference='SilentlyContinue'\n", - ); - if !self.cwd.is_empty() { - setup.push_str(&format!("Set-Location -LiteralPath '{}'\n", self.cwd.replace('\'', "''"))); - } - self.write(&setup); - true - } - - fn write(&mut self, text: &str) { - let failed = match self.session.as_mut() { - Some(session) => session.stdin.write_all(text.as_bytes()).and_then(|_| session.stdin.flush()).is_err(), - None => true, - }; - if failed { - self.stop_session(); - self.push(Kind::Error, "The PowerShell session ended. Press Restart to open a new one."); - } - } - - fn apply(&mut self, event: ShellEvent, cx: &mut Context<Self>) { - match event { - ShellEvent::Line(kind, text) => self.push(kind, text), - ShellEvent::Done { ok, cwd } => { - self.busy = false; - if !cwd.is_empty() { - self.cwd = cwd; - } - if !ok { - self.push(Kind::Note, "The command reported an error."); - } - } - ShellEvent::Exited => { - if self.session.take().is_some() { - self.push(Kind::Note, "PowerShell exited."); - } - self.busy = false; - } - } - cx.notify(); - } - - fn submit(&mut self, window: &mut Window, cx: &mut Context<Self>) { - let command = self.input.read(cx).value().trim().to_string(); - if command.is_empty() || self.busy || !self.start(cx) { - cx.notify(); - return; - } - self.input.update(cx, |input, cx| input.set_value("", window, cx)); - if self.history.last() != Some(&command) { - self.history.push(command.clone()); - } - self.recall = None; - self.push(Kind::Command, command.clone()); - self.busy = true; - self.write(&format!("{command}\n$__ok=$?; [Console]::Out.WriteLine('{DONE} ' + [int]$__ok + ' ' + (Get-Location).Path)\n")); - cx.notify(); - } - - fn restart(&mut self, cx: &mut Context<Self>) { - self.stop_session(); - self.push(Kind::Note, "Restarted PowerShell."); - self.start(cx); - cx.notify(); - } - - fn intercept(&mut self, event: &KeystrokeEvent, window: &mut Window, cx: &mut Context<Self>) { - let key = event.keystroke.key.as_str(); - if !matches!(key, "up" | "down") || self.history.is_empty() || !self.input.read(cx).focus_handle(cx).is_focused(window) { - return; - } - let last = self.history.len() - 1; - self.recall = match (key, self.recall) { - ("up", None) => Some(last), - ("up", Some(i)) => Some(i.saturating_sub(1)), - ("down", Some(i)) if i < last => Some(i + 1), - _ => None, - }; - let text = self.recall.map(|i| self.history[i].clone()).unwrap_or_default(); - self.input.update(cx, |input, cx| input.set_value(text, window, cx)); - cx.stop_propagation(); - } -} - -impl Drop for Terminal { - fn drop(&mut self) { - self.stop_session(); - } -} - -impl Render for Terminal { - fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement { - let p = palette(cx); - let lines = self.lines.clone(); - let cwd = self.cwd.clone(); - let tool = |id: &'static str, name: Icon| { - div() - .id(id) - .size(px(26.)) - .flex() - .items_center() - .justify_center() - .rounded(px(6.)) - .cursor_pointer() - .hover(move |style| style.bg(p.row_hover)) - .child(icon(name, 14., p.text_faint)) - }; - div() - .size_full() - .flex() - .flex_col() - .bg(p.sidebar) - .child( - div() - .flex() - .items_center() - .gap(px(8.)) - .h(px(36.)) - .flex_shrink_0() - .px(px(12.)) - .border_b_1() - .border_color(p.border_soft) - .child(icon(Icon::Terminal, 14., p.text_muted)) - .child(div().text_size(px(13.)).text_color(p.text).child("Terminal")) - .child( - div() - .flex_1() - .min_w_0() - .overflow_hidden() - .whitespace_nowrap() - .text_ellipsis() - .font_family(MONO) - .text_size(px(12.)) - .text_color(p.text_faint) - .child(cwd.clone()), - ) - .when(self.busy, |row| row.child(div().text_size(px(12.)).text_color(p.link).child("running"))) - .child(tool("terminal-clear", Icon::Eraser).on_click(cx.listener(|this, _, _, cx| { - this.lines.clear(); - cx.notify(); - }))) - .child(tool("terminal-restart", Icon::Retry).on_click(cx.listener(|this, _, _, cx| this.restart(cx)))) - .child(tool("terminal-close", Icon::X).on_click(cx.listener(|_, _, _, cx| cx.emit(CloseTerminal)))), - ) - .child( - uniform_list("terminal-lines", lines.len(), move |range, _, _| { - range - .map(|i| { - let (kind, text) = &lines[i]; - let color = match kind { - Kind::Command => p.text, - Kind::Output => p.text_muted, - Kind::Error => p.danger, - Kind::Note => p.text_faint, - }; - div() - .h(px(19.)) - .px(px(12.)) - .flex() - .font_family(MONO) - .text_size(px(12.5)) - .whitespace_nowrap() - .text_color(color) - .when(*kind == Kind::Command, |row| row.child(div().text_color(p.link).pr(px(8.)).child("PS>"))) - .child(text.clone()) - }) - .collect() - }) - .track_scroll(&self.scroll) - .flex_1() - .py(px(6.)), - ) - .child( - div() - .flex() - .items_center() - .gap(px(8.)) - .h(px(36.)) - .flex_shrink_0() - .px(px(12.)) - .border_t_1() - .border_color(p.border_soft) - .font_family(MONO) - .text_size(px(12.5)) - .child(div().text_color(p.link).child("PS>")) - .child(div().flex_1().child(Input::new(&self.input).appearance(false))), - ) - } -} \ No newline at end of file diff --git a/crates/quill-code/src/text.rs b/crates/quill-code/src/text.rs new file mode 100644 index 0000000..ef4f7e1 --- /dev/null +++ b/crates/quill-code/src/text.rs @@ -0,0 +1,398 @@ +use std::fmt::Write; + +use crossterm::style::{Color, ContentStyle, StyledContent, Stylize}; +use unicode_width::{UnicodeWidthChar, UnicodeWidthStr}; + +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Span { + pub text: String, + pub style: ContentStyle, +} + +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Line { + pub spans: Vec<Span>, +} + +impl Line { + pub fn plain(text: impl Into<String>) -> Line { + Line::styled(text, ContentStyle::new()) + } + + pub fn styled(text: impl Into<String>, style: ContentStyle) -> Line { + let mut line = Line::default(); + line.push(text, style); + line + } + + pub fn push(&mut self, text: impl Into<String>, style: ContentStyle) { + let text = text.into(); + if text.is_empty() { + return; + } + match self.spans.last_mut() { + Some(last) if last.style == style => last.text.push_str(&text), + _ => self.spans.push(Span { text, style }), + } + } + + pub fn with(mut self, text: impl Into<String>, style: ContentStyle) -> Line { + self.push(text, style); + self + } + + pub fn append(&mut self, other: Line) { + for span in other.spans { + self.push(span.text, span.style); + } + } + + pub fn with_line(mut self, other: Line) -> Line { + self.append(other); + self + } + + pub fn width(&self) -> usize { + self.spans.iter().map(|span| span.text.width()).sum() + } + + pub fn text(&self) -> String { + self.spans.iter().map(|span| span.text.as_str()).collect() + } + + pub fn ansi(&self) -> String { + let mut out = String::new(); + for span in &self.spans { + if span.style == ContentStyle::new() { + out.push_str(&span.text); + } else { + let _ = write!(out, "{}", StyledContent::new(span.style, &span.text)); + } + } + out + } + + fn cells(&self) -> impl Iterator<Item = (char, ContentStyle)> + '_ { + self.spans.iter().flat_map(|span| span.text.chars().map(move |c| (c, span.style))) + } +} + +pub fn plain() -> ContentStyle { + ContentStyle::new() +} + +pub fn dim() -> ContentStyle { + ContentStyle::new().dim() +} + +pub fn bold() -> ContentStyle { + ContentStyle::new().bold() +} + +pub fn accent() -> ContentStyle { + ContentStyle::new().with(Color::DarkCyan) +} + +pub fn good() -> ContentStyle { + ContentStyle::new().with(Color::DarkGreen) +} + +pub fn bad() -> ContentStyle { + ContentStyle::new().with(Color::DarkRed) +} + +pub fn warn() -> ContentStyle { + ContentStyle::new().with(Color::DarkYellow) +} + +pub fn blue() -> ContentStyle { + ContentStyle::new().with(Color::Blue) +} + +pub fn caret(line: &Line, column: usize) -> Line { + let mut out = Line::default(); + let mut used = 0; + let mut placed = false; + for (c, style) in line.cells() { + if !placed && used >= column { + out.push(c, style.reverse()); + placed = true; + } else { + out.push(c, style); + } + used += char_width(c); + } + if !placed { + out.push(" ".repeat(column.saturating_sub(used)), plain()); + out.push(" ", plain().reverse()); + } + out +} + +pub fn shade(style: ContentStyle) -> ContentStyle { + let style = if style.foreground_color.is_none() { style.with(Color::White) } else { style }; + style.on(Color::AnsiValue(237)) +} + +pub fn fill(line: Line, width: usize, style: ContentStyle) -> Line { + let gap = width.saturating_sub(line.width()); + line.with(" ".repeat(gap), style) +} + +pub fn char_width(c: char) -> usize { + c.width().unwrap_or(0) +} + +pub fn clean(text: &str) -> String { + let mut out = String::with_capacity(text.len()); + let mut chars = text.chars().peekable(); + while let Some(c) = chars.next() { + match c { + '\u{1b}' => match chars.next() { + Some('[') => { + for next in chars.by_ref() { + if ('@'..='~').contains(&next) { + break; + } + } + } + Some(']') => { + while let Some(next) = chars.next() { + if next == '\u{7}' || (next == '\u{1b}' && chars.next_if_eq(&'\\').is_some()) { + break; + } + } + } + _ => {} + }, + '\t' => out.push_str(" "), + '\n' | '\r' => out.push(c), + c if c.is_control() => {} + c => out.push(c), + } + } + if !out.contains('\r') { + return out; + } + out.split('\n').map(|line| line.rsplit('\r').find(|part| !part.is_empty()).unwrap_or_default()).collect::<Vec<_>>().join("\n") +} + +struct Wrapper { + width: usize, + lines: Vec<Line>, + line: Line, + used: usize, + wrapped: bool, +} + +impl Wrapper { + fn new(width: usize) -> Wrapper { + Wrapper { width: width.max(1), lines: Vec::new(), line: Line::default(), used: 0, wrapped: false } + } + + fn push(&mut self, cells: &[(char, ContentStyle)]) { + for &(c, style) in cells { + self.line.push(c, style); + self.used += char_width(c); + } + } + + fn newline(&mut self) { + self.lines.push(std::mem::take(&mut self.line)); + self.used = 0; + self.wrapped = true; + } + + fn place(&mut self, gap: &[(char, ContentStyle)], word: &[(char, ContentStyle)]) { + let gap_width: usize = gap.iter().map(|(c, _)| char_width(*c)).sum(); + let word_width: usize = word.iter().map(|(c, _)| char_width(*c)).sum(); + let keep_gap = !(self.wrapped && self.used == 0); + if self.used + gap_width + word_width <= self.width { + if keep_gap { + self.push(gap); + } + self.push(word); + return; + } + if word_width <= self.width && self.used > 0 { + self.newline(); + self.push(word); + return; + } + if keep_gap && self.used + gap_width < self.width { + self.push(gap); + } + for &cell in word { + if self.used + char_width(cell.0) > self.width && self.used > 0 { + self.newline(); + } + self.push(&[cell]); + } + } + + fn finish(mut self) -> Vec<Line> { + self.lines.push(self.line); + self.lines + } +} + +pub fn split_lines(line: &Line) -> Vec<Line> { + let mut lines = vec![Line::default()]; + for span in &line.spans { + for (index, part) in span.text.split('\n').enumerate() { + if index > 0 { + lines.push(Line::default()); + } + if let Some(last) = lines.last_mut() { + last.push(part, span.style); + } + } + } + lines +} + +pub fn wrap(line: &Line, width: usize) -> Vec<Line> { + let mut out = Vec::new(); + for logical in split_lines(line) { + let mut wrapper = Wrapper::new(width); + let mut gap = Vec::new(); + let mut word = Vec::new(); + for (c, style) in logical.cells() { + if c == ' ' { + if !word.is_empty() { + wrapper.place(&gap, &word); + gap.clear(); + word.clear(); + } + gap.push((c, style)); + } else { + word.push((c, style)); + } + } + if !word.is_empty() || !gap.is_empty() { + wrapper.place(&gap, &word); + } + out.extend(wrapper.finish()); + } + out +} + +pub fn wrap_chars(line: &Line, width: usize) -> Vec<Line> { + let mut out = Vec::new(); + for logical in split_lines(line) { + let mut wrapper = Wrapper::new(width); + for cell in logical.cells() { + if wrapper.used + char_width(cell.0) > wrapper.width && wrapper.used > 0 { + wrapper.newline(); + } + wrapper.push(&[cell]); + } + out.extend(wrapper.finish()); + } + out +} + +pub fn truncate(line: &Line, width: usize) -> Line { + if line.width() <= width { + return line.clone(); + } + let mut out = Line::default(); + let mut used = 0; + let mut style = ContentStyle::new(); + for (c, cell_style) in line.cells() { + let w = char_width(c); + if used + w + 1 > width { + break; + } + out.push(c, cell_style); + used += w; + style = cell_style; + } + out.with("…", style) +} + +pub fn indent(lines: Vec<Line>, first: Line, rest: Line) -> Vec<Line> { + lines + .into_iter() + .enumerate() + .map(|(index, line)| { + let mut prefixed = if index == 0 { first.clone() } else { rest.clone() }; + prefixed.append(line); + prefixed + }) + .collect() +} + +pub fn pad(text: &str, width: usize) -> String { + format!("{text}{}", " ".repeat(width.saturating_sub(text.width()))) +} + +#[cfg(test)] +mod tests { + use super::*; + + fn texts(lines: &[Line]) -> Vec<String> { + lines.iter().map(Line::text).collect() + } + + #[test] + fn words_wrap_at_the_width() { + let line = Line::plain("the quick brown fox jumps"); + assert_eq!(texts(&wrap(&line, 10)), vec!["the quick", "brown fox", "jumps"]); + assert_eq!(texts(&wrap(&line, 40)), vec!["the quick brown fox jumps"]); + } + + #[test] + fn long_words_break_and_indentation_stays() { + assert_eq!(texts(&wrap(&Line::plain("abcdefghij"), 4)), vec!["abcd", "efgh", "ij"]); + assert_eq!(texts(&wrap(&Line::plain(" indented text"), 40)), vec![" indented text"]); + assert_eq!(texts(&wrap(&Line::plain("one\ntwo"), 40)), vec!["one", "two"]); + assert_eq!(texts(&wrap(&Line::default(), 10)), vec![""]); + } + + #[test] + fn styles_survive_wrapping() { + let line = Line::plain("plain ").with("bold words here", bold()); + let wrapped = wrap(&line, 11); + assert_eq!(texts(&wrapped), vec!["plain bold", "words here"]); + assert_eq!(wrapped[0].spans[1], Span { text: "bold".into(), style: bold() }); + assert_eq!(wrapped[1].spans, vec![Span { text: "words here".into(), style: bold() }]); + } + + #[test] + fn wide_characters_count_twice() { + assert_eq!(Line::plain("日本語").width(), 6); + assert_eq!(texts(&wrap_chars(&Line::plain("日本語"), 4)), vec!["日本", "語"]); + assert_eq!(texts(&wrap_chars(&Line::plain("abcdef"), 4)), vec!["abcd", "ef"]); + } + + #[test] + fn long_lines_end_with_an_ellipsis() { + assert_eq!(truncate(&Line::plain("hello world"), 8).text(), "hello w…"); + assert_eq!(truncate(&Line::plain("short"), 8).text(), "short"); + } + + #[test] + fn terminal_noise_is_cleaned() { + assert_eq!(clean("\u{1b}[32mok\u{1b}[0m\r\n"), "ok\n"); + assert_eq!(clean("a\tb"), "a b"); + assert_eq!(clean("10%\r50%\r100%\ndone"), "100%\ndone"); + assert_eq!(clean("\u{1b}]8;;http://x\u{1b}\\link\u{1b}]8;;\u{1b}\\ ok\u{7}"), "link ok"); + } + + #[test] + fn the_caret_marks_one_cell() { + let marked = caret(&Line::plain("abc"), 1); + assert_eq!(marked.text(), "abc"); + assert_eq!(marked.spans[1], Span { text: "b".into(), style: plain().reverse() }); + let end = caret(&Line::plain("ab"), 2); + assert_eq!(end.text(), "ab "); + assert_eq!(end.spans.last().map(|span| span.style), Some(plain().reverse())); + } + + #[test] + fn prefixes_mark_the_first_line() { + let lines = indent(vec![Line::plain("a"), Line::plain("b")], Line::plain("- "), Line::plain(" ")); + assert_eq!(texts(&lines), vec!["- a", " b"]); + } +} \ No newline at end of file diff --git a/crates/quill-code/src/thread.rs b/crates/quill-code/src/thread.rs index 9b79fa8..10857a8 100644 --- a/crates/quill-code/src/thread.rs +++ b/crates/quill-code/src/thread.rs @@ -1,9 +1,10 @@ use std::collections::BTreeMap; -use std::path::PathBuf; +use std::path::{Path, PathBuf}; use std::time::{SystemTime, UNIX_EPOCH}; -use quill_agent::{FileDiff, ToolKind}; -use quill_llama::Message; +use quill_core::tools::legacy; +use quill_core::{Category, FileDiff, PlanStep, ToolView}; +use quill_providers::{Message, Tokens}; use serde::{Deserialize, Serialize}; pub fn now_ms() -> u64 { @@ -27,15 +28,108 @@ pub enum ToolStatus { } #[derive(Clone, Serialize, Deserialize)] +#[serde(from = "RawTool")] pub struct ToolItem { pub id: String, - pub kind: ToolKind, + pub tool: String, + pub category: Category, + pub active: String, + pub done: String, pub target: String, pub status: ToolStatus, pub output: String, - pub diff: Option<FileDiff>, - #[serde(skip)] - pub open: bool, + pub diffs: Vec<FileDiff>, + pub image: Option<String>, + pub started: u64, + pub ended: Option<u64>, +} + +#[derive(Deserialize)] +struct RawTool { + id: String, + #[serde(default)] + tool: Option<String>, + #[serde(default)] + kind: Option<String>, + #[serde(default)] + category: Option<Category>, + #[serde(default)] + active: Option<String>, + #[serde(default)] + done: Option<String>, + #[serde(default)] + target: String, + status: ToolStatus, + #[serde(default)] + output: String, + #[serde(default)] + diffs: Vec<FileDiff>, + #[serde(default)] + diff: Option<FileDiff>, + #[serde(default)] + image: Option<String>, + #[serde(default)] + started: u64, + #[serde(default)] + ended: Option<u64>, +} + +impl From<RawTool> for ToolItem { + fn from(raw: RawTool) -> ToolItem { + let view = match (raw.tool, raw.category, raw.active, raw.done) { + (Some(tool), Some(category), Some(active), Some(done)) => { + ToolView { id: raw.id.clone(), tool, category, active, done, target: String::new() } + } + (tool, ..) => legacy(&tool.or(raw.kind).unwrap_or_default()), + }; + let diffs = if raw.diffs.is_empty() { raw.diff.into_iter().collect() } else { raw.diffs }; + ToolItem { + id: raw.id, + tool: view.tool, + category: view.category, + active: view.active, + done: view.done, + target: raw.target, + status: raw.status, + output: raw.output, + diffs, + image: raw.image, + started: raw.started, + ended: raw.ended, + } + } +} + +impl ToolItem { + pub fn new(view: ToolView) -> ToolItem { + ToolItem { + id: view.id, + tool: view.tool, + category: view.category, + active: view.active, + done: view.done, + target: view.target, + status: ToolStatus::Running, + output: String::new(), + diffs: Vec::new(), + image: None, + started: now_ms(), + ended: None, + } + } + + pub fn working(&self) -> bool { + matches!(self.status, ToolStatus::Running | ToolStatus::Waiting) + } + + pub fn seconds(&self) -> Option<f32> { + let ended = self.ended?; + (self.started > 0 && ended >= self.started).then(|| (ended - self.started) as f32 / 1000.0) + } + + pub fn exit_code(&self) -> Option<i32> { + self.output.lines().next()?.strip_prefix("Exit code ")?.trim().parse().ok() + } } #[derive(Clone, Serialize, Deserialize)] @@ -43,6 +137,10 @@ pub enum Item { Reasoning(String), Text(String), Tool(ToolItem), + Plan { steps: Vec<PlanStep>, explanation: Option<String> }, + Question { id: String, question: String, options: Vec<String>, answer: Option<String> }, + Steer(String), + Note(String), } #[derive(Clone, Serialize, Deserialize)] @@ -58,8 +156,10 @@ pub struct Turn { pub images: Vec<PathBuf>, #[serde(default)] pub model: Option<String>, - #[serde(skip)] - pub expanded: bool, + #[serde(default)] + pub usage: Tokens, + #[serde(default)] + pub gone: Vec<String>, } pub struct FileChanges { @@ -67,6 +167,7 @@ pub struct FileChanges { pub added: usize, pub removed: usize, pub created: bool, + pub deleted: bool, } impl Turn { @@ -80,7 +181,8 @@ impl Turn { attachments, images: Vec::new(), model: None, - expanded: false, + usage: Tokens::default(), + gone: Vec::new(), } } @@ -106,6 +208,16 @@ impl Turn { } } + pub fn set_plan(&mut self, steps: Vec<PlanStep>, explanation: Option<String>) { + match self.items.last_mut() { + Some(Item::Plan { steps: old_steps, explanation: old_explanation }) => { + *old_steps = steps; + *old_explanation = explanation; + } + _ => self.items.push(Item::Plan { steps, explanation }), + } + } + pub fn tool_mut(&mut self, id: &str) -> Option<&mut ToolItem> { self.items.iter_mut().rev().find_map(|item| match item { Item::Tool(tool) if tool.id == id => Some(tool), @@ -113,6 +225,16 @@ impl Turn { }) } + pub fn answer(&mut self, id: &str, answers: &[String]) { + let asked = self.items.iter_mut().filter_map(|item| match item { + Item::Question { id: question, answer, .. } if question == id => Some(answer), + _ => None, + }); + for (answer, text) in asked.zip(answers) { + *answer = Some(text.clone()); + } + } + pub fn finish(&mut self, state: TurnState) { if !self.working() { return; @@ -120,29 +242,25 @@ impl Turn { self.worked_ms = Some(now_ms().saturating_sub(self.started)); for item in &mut self.items { if let Item::Tool(tool) = item - && matches!(tool.status, ToolStatus::Running | ToolStatus::Waiting) + && tool.working() { tool.status = ToolStatus::Failed; } } + if state == TurnState::Done { + self.promote_reasoning(); + } self.state = state; } - pub fn final_text(&self) -> Option<usize> { - if self.working() { - return None; + fn promote_reasoning(&mut self) { + let last = self.items.iter_mut().rev().find(|item| !matches!(item, Item::Text(t) if t.trim().is_empty())); + if let Some(item) = last + && let Item::Reasoning(text) = item + { + let text = std::mem::take(text).trim().to_string(); + *item = Item::Text(text); } - let last = self.items.iter().rposition(|item| matches!(item, Item::Text(t) if !t.trim().is_empty()))?; - let tools_after = self.items[last..].iter().any(|item| matches!(item, Item::Tool(_))); - (!tools_after).then_some(last) - } - - pub fn has_steps(&self) -> bool { - let final_text = self.final_text(); - self.items - .iter() - .enumerate() - .any(|(index, item)| Some(index) != final_text && !matches!(item, Item::Text(t) if t.trim().is_empty())) } pub fn changes(&self) -> Vec<FileChanges> { @@ -153,55 +271,32 @@ impl Turn { added: 0, removed: 0, created: diff.created, + deleted: self.gone.contains(&diff.path), }); entry.added += diff.added; entry.removed += diff.removed; } - by_path.into_values().collect() + for entry in by_path.values_mut().filter(|entry| entry.created) { + entry.added = entry.added.saturating_sub(entry.removed); + entry.removed = 0; + } + by_path.into_values().filter(|entry| !(entry.created && entry.deleted)).collect() } - pub fn diffs(&self) -> impl Iterator<Item = &FileDiff> { - self.items.iter().filter_map(|item| match item { - Item::Tool(ToolItem { diff: Some(diff), status: ToolStatus::Done, .. }) => Some(diff), - _ => None, - }) + pub fn note_gone(&mut self, root: &Path) { + self.gone = self.diffs().map(|diff| diff.path.clone()).filter(|path| !root.join(path).exists()).collect(); + self.gone.sort(); + self.gone.dedup(); } - pub fn summary(&self) -> String { - let files = self.changes().len(); - let mut commands = 0; - let mut other = 0; - for item in &self.items { - if let Item::Tool(tool) = item { - match tool.kind { - ToolKind::Run => commands += 1, - ToolKind::Write | ToolKind::Edit => {} - _ => other += 1, - } - } - } - let mut parts = Vec::new(); - if files > 0 { - parts.push(format!("changed {files} {}", if files == 1 { "file" } else { "files" })); - } - if commands > 0 { - parts.push(format!("ran {commands} {}", if commands == 1 { "command" } else { "commands" })); - } - if other > 0 { - let noun = if other == 1 { "action" } else { "actions" }; - parts.push(format!("performed {other} {}{noun}", if parts.is_empty() { "" } else { "other " })); - } - let sentence = match parts.len() { - 0 => return "Thought it through".into(), - 1 => parts.remove(0), - 2 => parts.join(" and "), - _ => { - let last = parts.pop().unwrap_or_default(); - format!("{}, and {last}", parts.join(", ")) - } - }; - let mut chars = sentence.chars(); - chars.next().map(|c| c.to_uppercase().collect::<String>() + chars.as_str()).unwrap_or_default() + pub fn diffs(&self) -> impl Iterator<Item = &FileDiff> { + self.items + .iter() + .filter_map(|item| match item { + Item::Tool(ToolItem { diffs, status: ToolStatus::Done, .. }) => Some(diffs.iter()), + _ => None, + }) + .flatten() } } @@ -220,6 +315,8 @@ pub struct Thread { pub model: Option<String>, #[serde(default)] pub context_used: Option<u64>, + #[serde(default)] + pub provider: Option<String>, } impl Thread { @@ -236,6 +333,7 @@ impl Thread { worktree: None, model: None, context_used: None, + provider: None, } } @@ -281,10 +379,15 @@ pub fn ago(ms: u64) -> String { #[cfg(test)] mod tests { use super::*; - use quill_agent::diff_text; - - fn tool(id: &str, kind: ToolKind, diff: Option<FileDiff>) -> Item { - Item::Tool(ToolItem { id: id.into(), kind, target: "x".into(), status: ToolStatus::Done, output: String::new(), diff, open: false }) + use quill_core::{StepStatus, diff_text}; + + fn tool(id: &str, name: &str, diffs: Vec<FileDiff>) -> Item { + let mut item = ToolItem::new(legacy(name)); + item.id = id.into(); + item.target = "x".into(); + item.status = ToolStatus::Done; + item.diffs = diffs; + Item::Tool(item) } #[test] @@ -292,63 +395,94 @@ mod tests { let mut turn = Turn::new("p".into(), Vec::new()); turn.push_text("Hel"); turn.push_text("lo"); - turn.items.push(tool("1", ToolKind::Read, None)); + turn.items.push(tool("1", "read_file", Vec::new())); turn.push_text("Done"); assert_eq!(turn.items.len(), 3); - assert!(turn.final_text().is_none()); + assert!(matches!(&turn.items[0], Item::Text(t) if t == "Hello")); turn.finish(TurnState::Done); - assert_eq!(turn.final_text(), Some(2)); + assert!(!turn.working() && turn.worked_ms.is_some()); } #[test] - fn summary_reads_like_a_sentence() { + fn reasoning_that_ends_a_turn_becomes_the_answer() { let mut turn = Turn::new("p".into(), Vec::new()); - turn.items.push(tool("1", ToolKind::Write, Some(diff_text("a.py", None, "x\n")))); - turn.items.push(tool("2", ToolKind::Run, None)); - turn.items.push(tool("3", ToolKind::Read, None)); - turn.items.push(tool("4", ToolKind::List, None)); - assert_eq!(turn.summary(), "Changed 1 file, ran 1 command, and performed 2 other actions"); - let mut reads = Turn::new("p".into(), Vec::new()); - reads.items.push(tool("1", ToolKind::Read, None)); - assert_eq!(reads.summary(), "Performed 1 action"); + turn.push_reasoning("Checking"); + turn.items.push(tool("1", "shell", Vec::new())); + turn.push_reasoning("All updated."); + turn.push_text("\n"); + turn.finish(TurnState::Done); + assert!(matches!(&turn.items[0], Item::Reasoning(_))); + assert!(matches!(&turn.items[2], Item::Text(t) if t == "All updated.")); } #[test] fn changes_add_up_per_file() { let mut turn = Turn::new("p".into(), Vec::new()); - turn.items.push(tool("1", ToolKind::Write, Some(diff_text("a.py", None, "x\ny\n")))); - turn.items.push(tool("2", ToolKind::Edit, Some(diff_text("a.py", Some("x\ny\n"), "x\nz\n")))); + turn.items.push(tool("1", "write_file", vec![diff_text("a.py", None, "x\ny\n")])); + turn.items.push(tool("2", "edit_file", vec![diff_text("a.py", Some("x\ny\n"), "x\nz\n")])); let changes = turn.changes(); assert_eq!(changes.len(), 1); - assert_eq!((changes[0].added, changes[0].removed, changes[0].created), (3, 1, true)); + assert_eq!((changes[0].added, changes[0].removed, changes[0].created), (2, 0, true)); + } + + #[test] + fn files_deleted_before_the_turn_ends_leave_the_list() { + let root = std::env::temp_dir().join(format!("quill-gone-{}", std::process::id())); + std::fs::create_dir_all(&root).unwrap(); + std::fs::write(root.join("kept.txt"), "x\n").unwrap(); + let mut turn = Turn::new("p".into(), Vec::new()); + turn.items.push(tool("1", "write_file", vec![diff_text("scratch.txt", None, "x\n")])); + turn.items.push(tool("2", "write_file", vec![diff_text("kept.txt", None, "x\n")])); + turn.items.push(tool("3", "edit_file", vec![diff_text("old.txt", Some("x\n"), "y\n")])); + turn.note_gone(&root); + let changes: Vec<(String, bool)> = turn.changes().into_iter().map(|change| (change.path, change.deleted)).collect(); + assert_eq!(changes, vec![("kept.txt".to_string(), false), ("old.txt".to_string(), true)]); + std::fs::remove_dir_all(&root).unwrap(); + } + + #[test] + fn plan_updates_follow_the_work() { + let mut turn = Turn::new("p".into(), Vec::new()); + let step = |status| vec![PlanStep { text: "a".into(), status }]; + turn.set_plan(step(StepStatus::Pending), None); + turn.set_plan(step(StepStatus::Active), None); + turn.push_text("working"); + turn.set_plan(step(StepStatus::Done), Some("finished".into())); + assert_eq!(turn.items.len(), 3); + assert!(matches!(&turn.items[0], Item::Plan { steps, .. } if steps[0].status == StepStatus::Active)); + assert!(matches!(&turn.items[2], Item::Plan { steps, .. } if steps[0].status == StepStatus::Done)); } #[test] fn unfinished_turns_stop_on_recovery() { let mut thread = Thread::new(None, "hi"); let mut turn = Turn::new("hi".into(), Vec::new()); - turn.items.push(Item::Tool(ToolItem { - id: "1".into(), - kind: ToolKind::Run, - target: "x".into(), - status: ToolStatus::Running, - output: String::new(), - diff: None, - open: false, - })); + let mut running = ToolItem::new(legacy("shell")); + running.id = "1".into(); + turn.items.push(Item::Tool(running)); thread.turns.push(turn); thread.recover(); assert!(thread.turns[0].state == TurnState::Stopped); assert!(matches!(&thread.turns[0].items[0], Item::Tool(t) if t.status == ToolStatus::Failed)); } + #[test] + fn version_one_threads_still_load() { + let old = r#"{"Tool":{"id":"c1","kind":"Run","target":"npm test","status":"Done","output":"ok","diff":null}}"#; + let Item::Tool(tool) = serde_json::from_str::<Item>(old).unwrap() else { panic!("a tool item") }; + assert_eq!((tool.tool.as_str(), tool.category, tool.target.as_str()), ("shell", Category::Command, "npm test")); + let saved = serde_json::to_string(&Item::Tool(tool)).unwrap(); + let Item::Tool(again) = serde_json::from_str::<Item>(&saved).unwrap() else { panic!("a tool item") }; + assert_eq!(again.tool, "shell"); + } + #[test] fn interrupted_tool_calls_get_answers() { let mut history = vec![ Message::user("go"), Message::assistant( "", - vec![quill_llama::ToolCall::new("a", "read_file", "{}"), quill_llama::ToolCall::new("b", "list_files", "{}")], + vec![quill_providers::ToolCall::new("a", "read_file", "{}"), quill_providers::ToolCall::new("b", "list_files", "{}")], ), Message::tool("a", "ok"), ]; diff --git a/crates/quill-code/src/thread_view.rs b/crates/quill-code/src/thread_view.rs deleted file mode 100644 index 2cecca9..0000000 --- a/crates/quill-code/src/thread_view.rs +++ /dev/null @@ -1,615 +0,0 @@ -use std::time::{Duration, Instant}; - -use gpui_kit::component::text::TextView; -use gpui_kit::{ - AnyElement, ClipboardItem, Context, Div, Entity, EventEmitter, FontWeight, IntoElement, ObjectFit, ParentElement, Render, ScrollHandle, - ScrollWheelEvent, SharedString, Stateful, Styled, Subscription, Task, Window, div, img, point, prelude::*, px, relative, -}; -use quill_agent::{FileDiff, LineKind, ToolKind}; -use quill_weave::State; - -use crate::icons::Icon; -use crate::palette::{Palette, palette}; -use crate::project; -use crate::smooth_scroll::SmoothScroll; -use crate::thread::{FileChanges, Item, Thread, ToolItem, ToolStatus, Turn, TurnState}; -use crate::ui::{MONO, icon}; -use crate::weave::WeaveMark; -use crate::workspace::Workspace; - -const COPIED_FOR: Duration = Duration::from_millis(1500); - -pub struct OpenDiff { - pub thread: u64, - pub turn: usize, -} - -pub struct ThreadView { - workspace: Entity<Workspace>, - status: Entity<WeaveMark>, - scroll: ScrollHandle, - smooth: SmoothScroll, - copied: Option<SharedString>, - copy_reset: Option<Task<()>>, - shown: Option<u64>, - _subscription: Subscription, -} - -impl EventEmitter<OpenDiff> for ThreadView {} - -pub fn file_icon(path: &str) -> Icon { - let ext = path.rsplit('.').next().unwrap_or_default().to_ascii_lowercase(); - match ext.as_str() { - "md" | "txt" | "rst" => Icon::FileText, - "json" | "toml" | "yaml" | "yml" | "ini" | "cfg" => Icon::File, - "png" | "jpg" | "jpeg" | "gif" | "svg" | "webp" | "ico" => Icon::Image, - "" => Icon::File, - _ => Icon::FileCode, - } -} - -pub fn diff_lines(diff: &FileDiff, limit: usize, p: Palette) -> Div { - let shown = diff.lines.len().min(limit); - div() - .flex() - .flex_col() - .font_family(MONO) - .text_size(px(12.5)) - .line_height(px(20.)) - .children(diff.lines.iter().take(shown).map(|line| { - let (bg, sign, color) = match line.kind { - LineKind::Added => (Some(p.add.opacity(0.12)), "+", p.text), - LineKind::Removed => (Some(p.del.opacity(0.12)), "-", p.text), - LineKind::Context => (None, " ", p.text_muted), - LineKind::Gap => (Some(p.fill), "", p.text_faint), - }; - let number = |n: Option<usize>| n.map(|n| n.to_string()).unwrap_or_default(); - div() - .flex() - .when_some(bg, |row, bg| row.bg(bg)) - .when(line.kind == LineKind::Added, |row| row.border_l_2().border_color(p.add)) - .when(line.kind == LineKind::Removed, |row| row.border_l_2().border_color(p.del)) - .child(div().w(px(40.)).flex_shrink_0().pr(px(8.)).flex().justify_end().text_color(p.text_faint).child(number(line.old))) - .child(div().w(px(40.)).flex_shrink_0().pr(px(8.)).flex().justify_end().text_color(p.text_faint).child(number(line.new))) - .child(div().w(px(14.)).flex_shrink_0().text_color(p.text_faint).child(sign)) - .child( - div().flex_1().min_w_0().whitespace_nowrap().overflow_hidden().text_color(color).child(if line.kind == LineKind::Gap { - "⋯".to_string() - } else { - line.text.clone() - }), - ) - })) - .when(diff.lines.len() > shown, |col| { - col.child( - div() - .px(px(12.)) - .py(px(4.)) - .text_color(p.text_faint) - .child(format!("{} more lines in the review panel", diff.lines.len() - shown)), - ) - }) -} - -fn verb(tool: &ToolItem) -> &'static str { - let running = matches!(tool.status, ToolStatus::Running | ToolStatus::Waiting); - match (tool.kind, running) { - (ToolKind::List, true) => "Looking through", - (ToolKind::List, false) => "Looked through", - (ToolKind::Read, true) => "Opening", - (ToolKind::Read, false) => "Opened", - (ToolKind::Search, true) => "Hunting for", - (ToolKind::Search, false) => "Hunted for", - (ToolKind::Write, true) => "Writing", - (ToolKind::Write, false) => { - if tool.diff.as_ref().is_some_and(|d| d.created) { - "Added" - } else { - "Rewrote" - } - } - (ToolKind::Edit, true) => "Changing", - (ToolKind::Edit, false) => "Changed", - (ToolKind::Run, true) => "Running", - (ToolKind::Run, false) => "Ran", - (ToolKind::Commit, true) => "Committing", - (ToolKind::Commit, false) => "Committed", - (ToolKind::PullRequest, true) => "Opening a pull request", - (ToolKind::PullRequest, false) => "Opened a pull request", - } -} - -fn kind_icon(kind: ToolKind) -> Icon { - match kind { - ToolKind::List => Icon::FolderTree, - ToolKind::Read => Icon::FileText, - ToolKind::Search => Icon::Search, - ToolKind::Write => Icon::FilePlus, - ToolKind::Edit => Icon::Compose, - ToolKind::Run => Icon::Terminal, - ToolKind::Commit => Icon::Commit, - ToolKind::PullRequest => Icon::PullRequest, - } -} - -impl ThreadView { - pub fn new(workspace: Entity<Workspace>, cx: &mut Context<Self>) -> Self { - let subscription = cx.observe(&workspace, |this, workspace, cx| { - let active = workspace.read(cx).active; - if active != this.shown { - this.shown = active; - this.smooth.cancel(); - this.scroll.scroll_to_bottom(); - } - cx.notify(); - }); - ThreadView { - workspace, - status: cx.new(|_| WeaveMark::new(State::Thinking)), - scroll: ScrollHandle::new(), - smooth: SmoothScroll::default(), - copied: None, - copy_reset: None, - shown: None, - _subscription: subscription, - } - } - - fn near_bottom(&self) -> bool { - let offset = -self.scroll.offset().y; - self.scroll.max_offset().y - offset < px(2.) - } - - fn wheel(&mut self, event: &ScrollWheelEvent, window: &mut Window, cx: &mut Context<Self>) { - let delta = event.delta.pixel_delta(window.line_height()); - self.smooth.nudge(self.scroll.offset().y, delta.y, self.scroll.max_offset().y); - cx.notify(); - } - - fn glide(&mut self, window: &mut Window) { - let offset = self.scroll.offset(); - if let Some(y) = self.smooth.step(offset.y, Instant::now()) { - self.scroll.set_offset(point(offset.x, y)); - } - if self.smooth.moving() { - window.request_animation_frame(); - } - } - - fn copy(&mut self, id: SharedString, text: String, cx: &mut Context<Self>) { - cx.write_to_clipboard(ClipboardItem::new_string(text)); - self.copied = Some(id); - self.copy_reset = Some(cx.spawn(async move |this, cx| { - cx.background_executor().timer(COPIED_FOR).await; - let _ = this.update(cx, |this, cx| { - this.copied = None; - cx.notify(); - }); - })); - cx.notify(); - } - - fn copy_button(&self, id: SharedString, text: String, cx: &mut Context<Self>) -> Stateful<Div> { - let p = palette(cx); - let done = self.copied.as_ref() == Some(&id); - let click = id.clone(); - div() - .id(id) - .flex() - .items_center() - .justify_center() - .size(px(26.)) - .rounded(px(7.)) - .cursor_pointer() - .hover(move |style| style.bg(p.row_hover)) - .child(icon(if done { Icon::Check } else { Icon::Copy }, 14., if done { p.success } else { p.text_muted })) - .on_click(cx.listener(move |this, _, _, cx| this.copy(click.clone(), text.clone(), cx))) - } - - fn tool_row(&self, thread: u64, turn: usize, tool: &ToolItem, cx: &mut Context<Self>) -> AnyElement { - let p = palette(cx); - let id = tool.id.clone(); - let failed = tool.status == ToolStatus::Failed; - let waiting = tool.status == ToolStatus::Waiting; - let running = tool.status == ToolStatus::Running; - let target = if tool.target.is_empty() { tool.kind.name().to_string() } else { tool.target.clone() }; - let has_detail = !tool.output.is_empty() || tool.diff.is_some(); - let row = div() - .id(SharedString::from(format!("tool-{thread}-{turn}-{id}"))) - .flex() - .items_center() - .gap(px(10.)) - .min_h(px(30.)) - .px(px(6.)) - .mx(px(-6.)) - .rounded(px(8.)) - .text_size(px(14.)) - .when(has_detail, |row| row.cursor_pointer().hover(move |style| style.bg(p.row_hover))) - .child(icon(kind_icon(tool.kind), 15., if failed { p.danger } else { p.text_faint })) - .child( - div() - .flex_1() - .min_w_0() - .flex() - .items_center() - .gap(px(6.)) - .overflow_hidden() - .child(div().flex_shrink_0().text_color(p.text_faint).child(verb(tool))) - .child( - div() - .min_w_0() - .overflow_hidden() - .whitespace_nowrap() - .text_ellipsis() - .text_color(p.text_muted) - .when(tool.kind == ToolKind::Run, |t| t.font_family(MONO).text_size(px(13.))) - .child(target), - ) - .when_some(tool.diff.as_ref(), |row, diff| { - row.child(div().flex_shrink_0().text_size(px(12.5)).text_color(p.add).child(format!("+{}", diff.added))) - .child(div().flex_shrink_0().text_size(px(12.5)).text_color(p.del).child(format!("-{}", diff.removed))) - }), - ) - .when(waiting, |row| row.child(div().text_size(px(12.5)).text_color(p.warning).child("Needs your OK"))) - .when(running, |row| row.child(icon(Icon::Loader, 14., p.text_faint))) - .when(failed, |row| row.child(icon(Icon::CircleX, 14., p.danger))) - .when(has_detail, |row| row.child(icon(if tool.open { Icon::ChevronDown } else { Icon::ChevronRight }, 14., p.text_faint))) - .on_click(cx.listener(move |this, _, _, cx| { - let id = id.clone(); - this.workspace.update(cx, |w, cx| w.toggle_tool(thread, turn, &id, cx)); - })); - let detail = tool.open.then(|| { - let body: AnyElement = match (&tool.diff, tool.kind) { - (Some(diff), _) => diff_lines(diff, 60, p).into_any_element(), - (None, ToolKind::Run) => div() - .flex() - .flex_col() - .gap(px(6.)) - .font_family(MONO) - .text_size(px(12.5)) - .line_height(px(19.)) - .child(div().text_color(p.link).child(format!("> {}", tool.target))) - .child(div().text_color(p.text_muted).child(clip(&tool.output, 60))) - .into_any_element(), - _ => div() - .font_family(MONO) - .text_size(px(12.5)) - .line_height(px(19.)) - .text_color(if failed { p.danger } else { p.text_muted }) - .child(clip(&tool.output, 30)) - .into_any_element(), - }; - div() - .ml(px(25.)) - .mt(px(2.)) - .mb(px(6.)) - .py(px(8.)) - .px(px(10.)) - .rounded(px(10.)) - .bg(p.fill) - .border_1() - .border_color(p.border_soft) - .overflow_hidden() - .child(body) - }); - div().flex().flex_col().child(row).children(detail).into_any_element() - } - - fn changes_card(&self, thread: u64, turn: usize, changes: &[FileChanges], cx: &mut Context<Self>) -> impl IntoElement + use<> { - let p = palette(cx); - let added: usize = changes.iter().map(|c| c.added).sum(); - let removed: usize = changes.iter().map(|c| c.removed).sum(); - let count = changes.len(); - div() - .mt(px(6.)) - .rounded(px(12.)) - .bg(p.fill) - .border_1() - .border_color(p.border_soft) - .flex() - .flex_col() - .child( - div() - .flex() - .items_center() - .gap(px(8.)) - .px(px(14.)) - .py(px(10.)) - .text_size(px(13.5)) - .child( - div() - .font_weight(FontWeight::SEMIBOLD) - .text_color(p.text) - .child(format!("{count} {} touched", if count == 1 { "file" } else { "files" })), - ) - .child(div().text_size(px(12.5)).text_color(p.add).child(format!("+{added}"))) - .child(div().text_size(px(12.5)).text_color(p.del).child(format!("-{removed}"))) - .child(div().flex_1()) - .child( - div() - .id(SharedString::from(format!("open-diff-{thread}-{turn}"))) - .flex() - .items_center() - .gap(px(5.)) - .px(px(8.)) - .h(px(26.)) - .rounded(px(7.)) - .text_size(px(12.5)) - .text_color(p.text_muted) - .cursor_pointer() - .hover(move |style| style.bg(p.row_hover).text_color(p.text)) - .child(icon(Icon::FileDiff, 14., p.text_muted)) - .child("Review") - .on_click(cx.listener(move |_, _, _, cx| cx.emit(OpenDiff { thread, turn }))), - ), - ) - .children(changes.iter().map(|change| { - div() - .flex() - .items_center() - .gap(px(10.)) - .px(px(14.)) - .py(px(7.)) - .border_t_1() - .border_color(p.border_soft) - .child(icon(file_icon(&change.path), 15., p.text_muted)) - .child(div().flex_1().min_w_0().font_family(MONO).text_size(px(13.)).text_color(p.text).child(change.path.clone())) - .when(change.created, |row| row.child(div().text_size(px(11.5)).text_color(p.text_faint).child("new"))) - .child(div().w(px(44.)).flex().justify_end().text_size(px(12.5)).text_color(p.add).child(format!("+{}", change.added))) - .child( - div().w(px(44.)).flex().justify_end().text_size(px(12.5)).text_color(p.del).child(format!("-{}", change.removed)), - ) - })) - } - - fn turn_view(&self, thread: &Thread, index: usize, turn: &Turn, pending: bool, cx: &mut Context<Self>) -> Div { - let p = palette(cx); - let tid = thread.id; - let latest = index + 1 == thread.turns.len(); - let working = turn.working(); - let final_text = turn.final_text(); - let show_steps = working || turn.expanded; - let mut column = div().flex().flex_col().gap(px(12.)); - if !turn.images.is_empty() { - column = column.child(div().flex().flex_wrap().justify_end().gap(px(8.)).children(turn.images.iter().enumerate().map( - |(n, path)| { - let open = path.clone(); - div() - .id(SharedString::from(format!("turn-image-{tid}-{index}-{n}"))) - .w(px(200.)) - .h(px(140.)) - .rounded(px(12.)) - .border_1() - .border_color(p.border_soft) - .bg(p.fill) - .cursor_pointer() - .child(img(path.clone()).size_full().rounded(px(11.)).object_fit(ObjectFit::Cover)) - .on_click(move |_, _, _| project::open_folder(&open)) - }, - ))); - } - let prompt_group = SharedString::from(format!("prompt-{tid}-{index}")); - let message = div() - .max_w(relative(0.85)) - .px(px(16.)) - .py(px(10.)) - .rounded(px(18.)) - .bg(p.fill) - .text_size(px(14.5)) - .line_height(px(23.)) - .text_color(p.text) - .child(turn.prompt.clone()) - .when(!turn.attachments.is_empty(), |bubble| { - bubble.child(div().mt(px(8.)).flex().flex_wrap().gap(px(6.)).children(turn.attachments.iter().map(|name| { - div() - .flex() - .items_center() - .gap(px(5.)) - .px(px(8.)) - .h(px(24.)) - .rounded(px(7.)) - .bg(p.fill) - .text_size(px(12.)) - .text_color(p.text_muted) - .child(icon(file_icon(name), 12., p.text_muted)) - .child(name.clone()) - }))) - }); - column = column.child( - div().group(prompt_group.clone()).flex().flex_col().items_end().gap(px(2.)).child(message).child( - self.copy_button(SharedString::from(format!("copy-prompt-{tid}-{index}")), turn.prompt.clone(), cx) - .invisible() - .group_hover(prompt_group, |style| style.visible()), - ), - ); - let mut agent = div().flex().flex_col().gap(px(4.)); - if working { - agent = agent.child( - div() - .pb(px(6.)) - .mb(px(4.)) - .border_b_1() - .border_color(p.border_soft) - .text_size(px(13.5)) - .text_color(p.text_faint) - .child(format!("Agent running · {}s", turn.elapsed_secs())), - ); - } else if turn.has_steps() { - agent = agent.child( - div() - .id(SharedString::from(format!("worked-{tid}-{index}"))) - .flex() - .items_center() - .gap(px(6.)) - .pb(px(6.)) - .mb(px(4.)) - .border_b_1() - .border_color(p.border_soft) - .text_size(px(13.5)) - .text_color(if turn.expanded { p.text } else { p.text_faint }) - .cursor_pointer() - .hover(move |style| style.text_color(p.text)) - .child(format!("Finished in {}s", turn.elapsed_secs())) - .child(icon(if turn.expanded { Icon::ChevronDown } else { Icon::ChevronRight }, 13., p.text_faint)) - .when(!turn.expanded, |row| row.child(div().ml(px(4.)).text_color(p.text_faint).child(format!("· {}", turn.summary())))) - .on_click(cx.listener(move |this, _, _, cx| this.workspace.update(cx, |w, cx| w.toggle_turn(tid, index, cx)))), - ); - } - if show_steps { - for (item_index, item) in turn.items.iter().enumerate() { - if Some(item_index) == final_text { - continue; - } - agent = agent.child(match item { - Item::Reasoning(text) if !text.trim().is_empty() => div() - .flex() - .gap(px(10.)) - .py(px(4.)) - .child(div().pt(px(3.)).child(icon(Icon::Bulb, 15., p.text_faint))) - .child( - div() - .flex_1() - .min_w_0() - .text_size(px(13.5)) - .line_height(px(21.)) - .text_color(p.text_faint) - .line_clamp(4) - .child(text.trim().to_string()), - ) - .into_any_element(), - Item::Text(text) if !text.trim().is_empty() => div() - .py(px(4.)) - .text_size(px(14.5)) - .line_height(px(24.)) - .text_color(p.text) - .child(TextView::markdown(SharedString::from(format!("md-{tid}-{index}-{item_index}")), text.clone())) - .into_any_element(), - Item::Tool(tool) => self.tool_row(tid, index, tool, cx), - _ => div().into_any_element(), - }); - } - } - if let Some(item_index) = final_text - && let Item::Text(text) = &turn.items[item_index] - { - let reply_group = SharedString::from(format!("reply-{tid}-{index}")); - let copy = self - .copy_button(SharedString::from(format!("copy-reply-{tid}-{index}")), text.clone(), cx) - .when(!latest, |button| button.invisible().group_hover(reply_group.clone(), |style| style.visible())); - agent = agent.child( - div() - .group(reply_group) - .flex() - .flex_col() - .gap(px(2.)) - .child( - div() - .pt(px(4.)) - .text_size(px(14.5)) - .line_height(px(24.)) - .text_color(p.text) - .child(TextView::markdown(SharedString::from(format!("md-{tid}-{index}-{item_index}")), text.clone())), - ) - .child(copy), - ); - } - if working { - let label = if pending { - "Waiting on you" - } else { - match turn.items.last() { - None => "Warming up the model", - Some(Item::Reasoning(_)) => "Thinking", - Some(Item::Text(_)) => "Writing", - Some(Item::Tool(tool)) if tool.status == ToolStatus::Running => "Using a tool", - Some(Item::Tool(_)) => "Thinking", - } - }; - agent = agent.child( - div() - .flex() - .items_center() - .gap(px(8.)) - .pt(px(6.)) - .text_size(px(13.5)) - .text_color(p.text_faint) - .child(div().size(px(20.)).child(self.status.clone())) - .child(label), - ); - } - match &turn.state { - TurnState::Stopped => { - agent = agent.child(div().pt(px(4.)).text_size(px(13.)).text_color(p.text_faint).child("You stopped this reply")) - } - TurnState::Failed(error) => { - agent = agent.child( - div() - .mt(px(4.)) - .flex() - .items_start() - .gap(px(8.)) - .px(px(12.)) - .py(px(10.)) - .rounded(px(10.)) - .bg(p.danger.opacity(0.1)) - .text_size(px(13.5)) - .text_color(p.danger) - .child(icon(Icon::CircleAlert, 15., p.danger)) - .child(div().flex_1().child(error.clone())), - ) - } - _ => {} - } - let changes = turn.changes(); - if !working && !changes.is_empty() { - agent = agent.child(self.changes_card(tid, index, &changes, cx)); - } - column = column.child(agent); - column - } -} - -fn clip(text: &str, lines: usize) -> String { - let all: Vec<&str> = text.lines().collect(); - if all.len() <= lines { - return text.to_string(); - } - format!("{}\n… {} more lines", all[..lines].join("\n"), all.len() - lines) -} - -impl Render for ThreadView { - fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement { - self.glide(window); - if !self.smooth.moving() && self.near_bottom() { - self.scroll.scroll_to_bottom(); - } - let workspace = self.workspace.read(cx); - let Some(thread) = workspace.active_thread().cloned() else { return div().size_full() }; - let pending = workspace.pending(thread.id).is_some(); - let state = if pending { - State::Idle - } else { - match thread.turns.last().and_then(|t| t.items.last()) { - Some(Item::Text(_)) => State::Generating, - _ => State::Thinking, - } - }; - self.status.update(cx, |mark, cx| mark.set_state(state, cx)); - let last = thread.turns.len().saturating_sub(1); - let turns: Vec<Div> = thread - .turns - .iter() - .enumerate() - .map(|(index, turn)| self.turn_view(&thread, index, turn, pending && index == last, cx)) - .collect(); - div().size_full().child( - div() - .id("thread-scroll") - .size_full() - .overflow_y_hidden() - .track_scroll(&self.scroll) - .on_scroll_wheel(cx.listener(Self::wheel)) - .child(div().max_w(px(820.)).mx_auto().px(px(28.)).pt(px(20.)).pb(px(40.)).flex().flex_col().gap(px(32.)).children(turns)), - ) - } -} \ No newline at end of file diff --git a/crates/quill-code/src/ui.rs b/crates/quill-code/src/ui.rs deleted file mode 100644 index 71bb636..0000000 --- a/crates/quill-code/src/ui.rs +++ /dev/null @@ -1,125 +0,0 @@ -use gpui_kit::{ - Anchor, AnyElement, Context, Div, ElementId, FontWeight, Hsla, IntoElement, MouseButton, ParentElement, SharedString, Stateful, Styled, - Svg, Window, anchored, deferred, div, point, prelude::*, px, svg, -}; - -use crate::icons::Icon; -use crate::palette::Palette; - -pub const MONO: &str = "Consolas"; - -pub fn icon(name: Icon, size: f32, color: Hsla) -> Svg { - svg().path(name.path()).flex_shrink_0().size(px(size)).text_color(color) -} - -pub fn page(id: &'static str) -> Stateful<Div> { - div().id(id).size_full().overflow_y_scroll() -} - -pub fn menu_panel(p: Palette) -> Div { - div().occlude().p(px(5.)).rounded(px(12.)).bg(p.menu_bg).border_1().border_color(p.border).shadow_lg().flex().flex_col().gap(px(1.)) -} - -pub fn menu_label(text: impl Into<SharedString>, p: Palette) -> Div { - div().px(px(10.)).pt(px(6.)).pb(px(4.)).text_size(px(12.)).text_color(p.text_faint).child(text.into()) -} - -pub fn menu_item( - id: impl Into<ElementId>, - name: Option<Icon>, - label: impl Into<SharedString>, - detail: Option<SharedString>, - checked: bool, - p: Palette, -) -> Stateful<Div> { - div() - .id(id) - .flex() - .items_center() - .gap(px(10.)) - .px(px(10.)) - .py(px(if detail.is_some() { 7. } else { 6. })) - .rounded(px(8.)) - .text_color(p.text) - .cursor_pointer() - .hover(move |style| style.bg(p.row_hover)) - .when_some(name, |row, name| row.child(icon(name, 15., p.text_muted))) - .child( - div() - .flex_1() - .min_w_0() - .flex() - .flex_col() - .child(div().text_size(px(13.5)).child(label.into())) - .when_some(detail, |col, detail| col.child(div().text_size(px(12.)).text_color(p.text_faint).child(detail))), - ) - .when(checked, |row| row.child(icon(Icon::Check, 15., p.text))) -} - -pub fn separator(p: Palette) -> Div { - div().h(px(1.)).mx(px(6.)).my(px(3.)).bg(p.border_soft) -} - -pub fn popup<V: 'static>( - window: &Window, - cx: &mut Context<V>, - anchor: Anchor, - menu: impl IntoElement, - close: impl Fn(&mut V, &mut Context<V>) + 'static, -) -> AnyElement { - let viewport = window.viewport_size(); - let offset = match anchor { - Anchor::BottomLeft | Anchor::BottomRight => point(px(0.), px(-6.)), - _ => point(px(0.), px(6.)), - }; - let top = matches!(anchor, Anchor::TopLeft | Anchor::TopRight); - let right = matches!(anchor, Anchor::TopRight | Anchor::BottomRight); - div() - .absolute() - .top_0() - .left_0() - .size_full() - .child( - deferred( - anchored().position(point(px(0.), px(0.))).child( - div() - .id("popup-backdrop") - .w(viewport.width) - .h(viewport.height) - .occlude() - .on_mouse_down(MouseButton::Left, cx.listener(move |this, _, _, cx| close(this, cx))) - .on_mouse_down(MouseButton::Right, cx.listener(|_, _, _, cx| cx.stop_propagation())), - ), - ) - .with_priority(1), - ) - .child( - div() - .absolute() - .when(top, |d| d.bottom_0()) - .when(!top, |d| d.top_0()) - .when(right, |d| d.right_0()) - .when(!right, |d| d.left_0()) - .child(deferred(anchored().anchor(anchor).offset(offset).snap_to_window().child(menu)).with_priority(2)), - ) - .into_any_element() -} - -pub fn badge(name: &str, size: f32) -> Div { - div() - .flex() - .flex_shrink_0() - .items_center() - .justify_center() - .size(px(size)) - .rounded(px(size * 0.28)) - .bg(crate::project::color(name)) - .text_size(px(size * 0.5)) - .font_weight(FontWeight::SEMIBOLD) - .text_color(gpui_kit::white()) - .child(crate::project::initials(name)) -} - -pub fn name_hash(name: &str) -> u32 { - name.bytes().fold(2166136261u32, |h, b| (h ^ b as u32).wrapping_mul(16777619)) -} \ No newline at end of file diff --git a/crates/quill-code/src/update.rs b/crates/quill-code/src/update.rs new file mode 100644 index 0000000..83281cb --- /dev/null +++ b/crates/quill-code/src/update.rs @@ -0,0 +1,243 @@ +use std::path::{Path, PathBuf}; +use std::process::Command; + +use quill_git::github::{self, Release}; + +use crate::picker::Choice; + +const REPOSITORY: &str = env!("CARGO_PKG_REPOSITORY"); +pub const VERSION: &str = env!("CARGO_PKG_VERSION"); + +fn slug() -> &'static str { + REPOSITORY.trim_start_matches("https://github.com/") +} + +fn parts(version: &str) -> Vec<u64> { + version.split(['.', '-', '+']).take(3).map(|part| part.parse().unwrap_or(0)).collect() +} + +fn installer(name: &str) -> String { + format!("{REPOSITORY}/releases/latest/download/{name}") +} + +fn built_here(exe: &Path) -> Option<&'static str> { + let path = exe.to_string_lossy().replace('\\', "/").to_lowercase(); + if path.contains("/.cargo/bin/") { + return Some("This copy of Quill Code was installed with cargo. Update it with: cargo install --path crates/quill-code --force"); + } + if path.contains("/target/debug/") || path.contains("/target/release/") { + return Some("This copy of Quill Code was built from source. Pull the latest code and build it again."); + } + None +} + +fn old_copy(exe: &Path) -> PathBuf { + let mut name = exe.file_name().unwrap_or_default().to_os_string(); + name.push(".old"); + exe.with_file_name(name) +} + +pub fn tidy() { + if let Ok(exe) = std::env::current_exe() { + let _ = std::fs::remove_file(old_copy(&exe)); + } +} + +pub fn source_note() -> Option<&'static str> { + std::env::current_exe().ok().and_then(|exe| built_here(&exe)) +} + +pub fn releases() -> Result<Vec<Release>, String> { + let mut releases = github::releases(slug())?; + releases.sort_by_key(|release| std::cmp::Reverse(parts(&release.version))); + Ok(releases) +} + +pub fn newest(releases: &[Release]) -> Option<&Release> { + releases.iter().find(|release| !release.prerelease) +} + +pub fn tags(release: &Release, newest: Option<&str>) -> Vec<&'static str> { + let mut tags = Vec::new(); + if release.version == VERSION { + tags.push("installed"); + } + if newest == Some(release.version.as_str()) { + tags.push("latest"); + } + if release.prerelease { + tags.push("preview"); + } + tags +} + +pub fn choices(releases: &[Release]) -> Vec<Choice<String>> { + let newest = newest(releases).map(|release| release.version.clone()); + releases + .iter() + .map(|release| { + let mut detail = vec![release.date.clone()]; + detail.extend(tags(release, newest.as_deref()).into_iter().map(str::to_string)); + Choice::new(release.version.clone(), detail.join(" · "), release.version.clone()).current(release.version == VERSION) + }) + .collect() +} + +pub fn versions() -> u8 { + let releases = match releases() { + Ok(releases) => releases, + Err(error) => { + eprintln!("Could not list the releases. {error}"); + return 1; + } + }; + if releases.is_empty() { + println!("There is no published release yet."); + return 0; + } + let newest = newest(&releases).map(|release| release.version.clone()); + for release in &releases { + let tags = tags(release, newest.as_deref()); + let tags = if tags.is_empty() { String::new() } else { format!(" ({})", tags.join(", ")) }; + println!("{:<10} {:<10} {}{tags}", release.version, release.date, release.title); + } + println!("\nSwitch to one with: quill update <version>"); + 0 +} + +pub fn run(version: Option<String>) -> u8 { + let exe = match std::env::current_exe() { + Ok(exe) => exe, + Err(error) => { + eprintln!("Could not find where Quill Code is installed: {error}"); + return 1; + } + }; + if let Some(note) = built_here(&exe) { + eprintln!("{note}"); + return 1; + } + eprintln!("Checking the releases…"); + let releases = match releases() { + Ok(releases) => releases, + Err(error) => { + eprintln!("Could not check for updates. {error}"); + return 1; + } + }; + let target = match &version { + Some(wanted) => releases.iter().find(|release| release.version == wanted.trim_start_matches('v')), + None => newest(&releases), + }; + let Some(target) = target else { + match version { + Some(wanted) => eprintln!("There is no release {wanted}. See them with: quill versions"), + None => eprintln!("There is no published release yet."), + } + return 1; + }; + if target.version == VERSION { + let state = if version.is_some() { "already installed" } else { "the latest version" }; + println!("Quill Code {VERSION} is {state}."); + return 0; + } + match install(&exe, &target.version) { + Ok(()) => 0, + Err(error) => { + eprintln!("{error}"); + 1 + } + } +} + +pub fn switch(version: &str, root: &Path, resume: bool) -> u8 { + let exe = match std::env::current_exe() { + Ok(exe) => exe, + Err(error) => { + eprintln!("Could not find where Quill Code is installed: {error}"); + return 1; + } + }; + if let Err(error) = install(&exe, version) { + eprintln!("{error}"); + return 1; + } + let mut command = Command::new(&exe); + command.arg("-C").arg(root); + if resume { + command.arg("-c"); + } + match command.status() { + Ok(status) => status.code().unwrap_or(1) as u8, + Err(error) => { + eprintln!("Quill Code {version} is installed, but it could not start: {error}"); + 1 + } + } +} + +fn install(exe: &Path, version: &str) -> Result<(), String> { + eprintln!("Switching Quill Code {VERSION} to {version}…"); + let mut command = if cfg!(windows) { + let mut command = Command::new("powershell"); + command.args(["-NoProfile", "-ExecutionPolicy", "Bypass", "-Command", &format!("irm {} | iex", installer("install.ps1"))]); + command + } else { + let url = installer("install.sh"); + let mut command = Command::new("sh"); + command.args(["-c", &format!("(curl -fsSL '{url}' || wget -qO- '{url}') | sh")]); + command + }; + let dir = exe.parent().map(Path::to_path_buf).unwrap_or_default(); + let status = command.env("QUILL_VERSION", version).env("QUILL_INSTALL_DIR", &dir).env("QUILL_NO_MODIFY_PATH", "1").status(); + match status { + Ok(status) if status.success() => Ok(()), + Ok(_) => Err(format!("The switch did not finish. Quill Code {VERSION} is still installed.")), + Err(error) => Err(format!("The installer could not start: {error}")), + } +} + +#[cfg(test)] +mod tests { + use super::*; + + fn release(version: &str, prerelease: bool) -> Release { + Release { version: version.into(), title: String::new(), date: String::new(), prerelease } + } + + #[test] + fn versions_compare_by_number() { + assert!(parts("0.10.0") > parts("0.9.3")); + assert!(parts("1.0.0") > parts("0.99.0")); + assert!(parts("0.2.1") > parts("0.2.0-dev")); + assert_eq!(parts("0.2.0"), parts("0.2.0")); + } + + #[test] + fn the_newest_release_skips_previews() { + let releases = vec![release("2.0.0", true), release("1.1.0", false), release("1.0.0", false)]; + assert_eq!(newest(&releases).map(|release| release.version.as_str()), Some("1.1.0")); + assert_eq!(tags(&releases[0], Some("1.1.0")), vec!["preview"]); + assert_eq!(tags(&releases[1], Some("1.1.0")), vec!["latest"]); + } + + #[test] + fn the_picker_marks_the_running_release() { + let mut releases = vec![release("9.0.0", false), release(VERSION, false)]; + releases[1].date = "2026-10-16".into(); + let choices = choices(&releases); + assert_eq!(choices[0].detail, " · latest"); + assert!(!choices[0].current && choices[1].current); + assert_eq!(choices[1].detail, "2026-10-16 · installed"); + assert_eq!(choices[1].value, VERSION); + } + + #[test] + fn source_builds_are_told_how_to_update() { + assert!(built_here(Path::new("/home/me/.cargo/bin/quill")).is_some()); + assert!(built_here(Path::new("D:\\repos\\quill-code\\target\\release\\quill.exe")).is_some()); + assert!(built_here(Path::new("/home/me/.local/bin/quill")).is_none()); + assert_eq!(old_copy(Path::new("/opt/quill.exe")), Path::new("/opt/quill.exe.old")); + assert_eq!(slug(), "Smoffyy/quill-code"); + } +} \ No newline at end of file diff --git a/crates/quill-code/src/usage.rs b/crates/quill-code/src/usage.rs new file mode 100644 index 0000000..0aa39ea --- /dev/null +++ b/crates/quill-code/src/usage.rs @@ -0,0 +1,172 @@ +use std::collections::HashMap; +use std::fs; +use std::io::Write; +use std::path::PathBuf; + +use quill_providers::Tokens; +use serde::{Deserialize, Serialize}; + +use crate::config::app_dir; +use crate::text::{Line, bold, dim, pad, truncate}; +use crate::thread::{Thread, Turn, now_ms}; + +const DAY: u64 = 24 * 60 * 60 * 1000; + +#[derive(Clone, Serialize, Deserialize)] +pub struct Record { + pub at: u64, + pub thread: u64, + pub provider: String, + pub model: String, + pub tokens: Tokens, +} + +fn ledger_path() -> PathBuf { + app_dir().join("usage.jsonl") +} + +pub fn load(threads: &[Thread]) -> Vec<Record> { + if let Ok(text) = fs::read_to_string(ledger_path()) { + return text.lines().filter_map(|line| serde_json::from_str(line).ok()).collect(); + } + let mut records: Vec<Record> = + threads + .iter() + .flat_map(|thread| { + thread.turns.iter().filter(|turn| !turn.working()).filter_map(|turn| { + record(thread.id, thread.provider.as_deref(), turn).map(|record| Record { at: turn.started, ..record }) + }) + }) + .collect(); + records.sort_by_key(|record| record.at); + records.iter().for_each(append); + records +} + +pub fn append(record: &Record) { + let Ok(line) = serde_json::to_string(record) else { return }; + let _ = fs::create_dir_all(app_dir()); + if let Ok(mut file) = fs::OpenOptions::new().create(true).append(true).open(ledger_path()) { + let _ = writeln!(file, "{line}"); + } +} + +pub fn record(thread: u64, provider: Option<&str>, turn: &Turn) -> Option<Record> { + (turn.usage.total() > 0).then(|| Record { + at: now_ms(), + thread, + provider: provider.unwrap_or_default().to_string(), + model: turn.model.clone().unwrap_or_default(), + tokens: turn.usage, + }) +} + +pub fn count(tokens: u64) -> String { + match tokens { + 0..1000 => tokens.to_string(), + 1000..1_000_000 => format!("{:.1}K", tokens as f64 / 1000.0), + _ => format!("{:.2}M", tokens as f64 / 1_000_000.0), + } +} + +#[derive(Default, Clone, Copy)] +struct Sum { + tokens: Tokens, + turns: usize, +} + +impl Sum { + fn add(&mut self, tokens: Tokens) { + self.tokens.add(tokens); + self.turns += 1; + } +} + +pub fn tokens_line(tokens: Tokens) -> String { + if tokens.total() == 0 { + return String::new(); + } + let mut line = format!("{} in", count(tokens.prompt)); + if tokens.cache_read > 0 { + line.push_str(&format!(" ({} cached)", count(tokens.cache_read))); + } + line.push_str(&format!(" · {} out", count(tokens.completion))); + line +} + +fn heading(title: &str) -> Line { + Line::styled(title, bold()) +} + +pub fn report(thread: Option<&Thread>, records: &[Record], width: usize) -> Vec<Line> { + let mut lines = Vec::new(); + if let Some(thread) = thread { + let mut total = Sum::default(); + for turn in &thread.turns { + total.add(turn.usage); + } + lines.push(heading("This thread").with(format!(" {}", tokens_line(total.tokens)), dim())); + for (index, turn) in thread.turns.iter().enumerate().filter(|(_, t)| t.usage.total() > 0) { + let model = turn.model.as_deref().unwrap_or_default(); + lines.push(Line::plain(format!(" {}. {model}", index + 1)).with(format!(" {}", tokens_line(turn.usage)), dim())); + } + lines.push(Line::default()); + } + let now = now_ms(); + let mut windows = [Sum::default(); 4]; + let mut models: HashMap<String, Sum> = HashMap::new(); + for record in records { + for (sum, days) in windows.iter_mut().zip([1, 7, 30, u64::MAX / DAY]) { + if now.saturating_sub(record.at) < days.saturating_mul(DAY) { + sum.add(record.tokens); + } + } + models.entry(record.model.clone()).or_default().add(record.tokens); + } + lines.push(heading("Everything")); + for (label, sum) in ["Today", "Past 7 days", "Past 30 days", "All time"].iter().zip(windows) { + lines.push(Line::plain(format!(" {}", pad(label, 14))).with(format!("{} tokens", count(sum.tokens.total())), bold())); + } + let mut models: Vec<(String, Sum)> = models.into_iter().collect(); + models.sort_by_key(|(_, sum)| std::cmp::Reverse(sum.tokens.total())); + if !models.is_empty() { + lines.push(Line::default()); + lines.push(heading("By model")); + let widest = models.iter().map(|(model, _)| model.chars().count()).max().unwrap_or(0).min(40); + for (model, sum) in models { + let turns = format!("{} {}", sum.turns, if sum.turns == 1 { "turn" } else { "turns" }); + lines.push( + Line::plain(format!(" {} ", pad(&model, widest))) + .with(format!("{} tokens", count(sum.tokens.total())), bold()) + .with(format!(" · {turns}"), dim()), + ); + } + } + lines.iter().map(|line| truncate(line, width)).collect() +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn amounts_read_naturally() { + assert_eq!(count(950), "950"); + assert_eq!(count(52_300), "52.3K"); + assert_eq!(count(2_500_000), "2.50M"); + } + + #[test] + fn the_report_adds_up_by_window_and_model() { + let tokens = Tokens { prompt: 1000, completion: 500, ..Tokens::default() }; + let old = now_ms() - 10 * DAY; + let records = vec![ + Record { at: now_ms(), thread: 1, provider: "local".into(), model: "gemma".into(), tokens }, + Record { at: old, thread: 2, provider: "local".into(), model: "qwen3.5-4b".into(), tokens }, + ]; + let lines: Vec<String> = report(None, &records, 80).iter().map(Line::text).collect(); + assert!(lines.iter().any(|line| line.starts_with(" Today") && line.contains("1.5K tokens"))); + assert!(lines.iter().any(|line| line.starts_with(" All time") && line.contains("3.0K tokens"))); + assert!(lines.iter().any(|line| line.contains("gemma") && line.contains("1 turn"))); + } +} \ No newline at end of file diff --git a/crates/quill-code/src/version.rs b/crates/quill-code/src/version.rs deleted file mode 100644 index a4d8300..0000000 --- a/crates/quill-code/src/version.rs +++ /dev/null @@ -1,213 +0,0 @@ -use std::time::Duration; - -use gpui_kit::{ - App, ClipboardItem, Context, Entity, FontWeight, IntoElement, ParentElement, Render, Styled, Window, div, linear_color_stop, - linear_gradient, prelude::*, px, -}; -use quill_weave::State; - -use crate::icons::Icon; -use crate::palette::palette; -use crate::ui::icon; -use crate::weave::WeaveMark; - -pub const APP_NAME: &str = "quill-code"; -pub const VERSION: &str = env!("CARGO_PKG_VERSION"); - -pub fn version_line() -> String { - let mut line = VERSION.split(['-', '+']).next().unwrap_or(VERSION).to_string(); - while line.matches('.').count() > 0 && line.ends_with(".0") { - line.truncate(line.len() - 2); - } - line -} - -fn platform() -> String { - let os = match std::env::consts::OS { - "windows" => "Windows", - "macos" => "macOS", - "linux" => "Linux", - other => other, - }; - format!("{os} · {}", std::env::consts::ARCH) -} - -fn channel() -> Option<&'static str> { - if cfg!(debug_assertions) { Some("dev build") } else { None } -} - -pub struct VersionPage { - mark: Entity<WeaveMark>, - copied: bool, -} - -impl VersionPage { - pub fn new(cx: &mut Context<Self>) -> Self { - VersionPage { mark: cx.new(|_| WeaveMark::new(State::Idle).opacity(0.13)), copied: false } - } - - fn copy_details(&mut self, cx: &mut Context<Self>) { - let details = format!("{APP_NAME} {VERSION}\n{}", platform()); - cx.write_to_clipboard(ClipboardItem::new_string(details)); - self.copied = true; - cx.notify(); - cx.spawn(async move |this, cx| { - cx.background_executor().timer(Duration::from_millis(1400)).await; - _ = this.update(cx, |this, cx| { - this.copied = false; - cx.notify(); - }); - }) - .detach(); - } - - fn badge(&self, cx: &App) -> impl IntoElement { - let p = palette(cx); - div() - .relative() - .flex_shrink_0() - .size(px(84.)) - .rounded(px(19.)) - .overflow_hidden() - .border_1() - .border_color(p.border_soft) - .bg(linear_gradient(160., linear_color_stop(p.surface_hover, 0.), linear_color_stop(p.surface_2, 1.))) - .child(div().absolute().right(px(-34.)).bottom(px(-38.)).size(px(112.)).child(self.mark.clone())) - .child( - div() - .absolute() - .inset_0() - .flex() - .items_center() - .justify_center() - .text_size(px(40.)) - .font_weight(FontWeight::SEMIBOLD) - .text_color(p.text) - .child(version_line()), - ) - } -} - -impl Render for VersionPage { - fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement { - let p = palette(cx); - let copied = self.copied; - div() - .id("version-page") - .size_full() - .overflow_y_scroll() - .child( - div() - .max_w(px(640.)) - .mx_auto() - .px(px(32.)) - .pt(px(56.)) - .pb(px(40.)) - .flex() - .flex_col() - .child( - div() - .flex() - .flex_wrap() - .items_center() - .gap(px(20.)) - .pt(px(4.)) - .pb(px(20.)) - .child(self.badge(cx)) - .child( - div() - .min_w_0() - .flex() - .flex_col() - .child( - div() - .text_size(px(30.)) - .line_height(px(34.)) - .font_weight(FontWeight::SEMIBOLD) - .text_color(p.text) - .child(APP_NAME), - ) - .child( - div() - .flex() - .flex_wrap() - .items_center() - .gap(px(8.)) - .mt(px(6.)) - .text_size(px(14.5)) - .text_color(p.text_muted) - .child(format!("Version {VERSION}")) - .when_some(channel(), |row, channel| { - row.child( - div() - .px(px(9.)) - .py(px(2.)) - .rounded_full() - .border_1() - .border_color(p.border_soft) - .bg(p.surface_2) - .text_size(px(12.)) - .text_color(p.text_muted) - .child(channel), - ) - }), - ) - .child( - div() - .mt(px(4.)) - .text_size(px(13.)) - .text_color(p.text_faint) - .child(platform()), - ), - ), - ) - .child( - div().flex().gap(px(8.)).child( - div() - .id("copy-details") - .flex() - .items_center() - .gap(px(6.)) - .h(px(32.)) - .px(px(12.)) - .rounded(px(8.)) - .text_size(px(13.5)) - .text_color(p.text) - .cursor_pointer() - .hover(move |style| style.bg(p.row_hover)) - .child(icon( - if copied { Icon::Check } else { Icon::Copy }, - 15., - p.text_muted, - )) - .child(if copied { "Copied" } else { "Copy details" }) - .on_click(cx.listener(|this, _, _, cx| this.copy_details(cx))), - ), - ) - .child( - div() - .mt(px(28.)) - .pt(px(20.)) - .border_t_1() - .border_color(p.border_soft) - .flex() - .flex_col() - .gap(px(10.)) - .child( - div() - .text_size(px(15.)) - .font_weight(FontWeight::SEMIBOLD) - .text_color(p.text) - .child("Release notes"), - ) - .child( - div() - .text_size(px(13.5)) - .line_height(px(21.)) - .text_color(p.text_muted) - .child("The first development build: the window, the theme that follows Windows light and dark mode, the live weave mark and the Code layout. Agents arrive in the next milestones."), - ), - ), - ) - } -} \ No newline at end of file diff --git a/crates/quill-code/src/weave.rs b/crates/quill-code/src/weave.rs index 53604da..320c283 100644 --- a/crates/quill-code/src/weave.rs +++ b/crates/quill-code/src/weave.rs @@ -1,120 +1,54 @@ -use std::time::Instant; - -use gpui_kit::{ - Bounds, Context, Hsla, IntoElement, MouseButton, ParentElement, Pixels, Render, Styled, Window, canvas, div, fill, point, prelude::*, - px, size, -}; -use quill_weave::{BRAND_FRAME, Clock, Params, State, depth_order, point_count, project}; - -use crate::palette::palette; -use crate::ui::name_hash; - -const POKE_DECAY: f64 = 3.0; - -pub struct WeaveMark { - target: State, - params: Params, - clock: Clock, - last: Option<Instant>, - poke: f64, - opacity: f32, -} - -impl WeaveMark { - pub fn new(target: State) -> Self { - WeaveMark { target, params: State::Idle.params(), clock: BRAND_FRAME, last: None, poke: 0.0, opacity: 1.0 } - } - - pub fn seeded(mut self, name: &str) -> Self { - self.clock = Clock::seeded(name_hash(name) as u64); - self - } - - pub fn opacity(mut self, opacity: f32) -> Self { - self.opacity = opacity; - self - } - - pub fn set_state(&mut self, target: State, cx: &mut Context<Self>) { - if self.target != target { - if target == State::Idle { - self.poke = 1.0; - } - self.target = target; - cx.notify(); - } - } - - fn step(&mut self, reduce_motion: bool) -> bool { - if reduce_motion { - self.params = self.target.params(); - self.poke = 0.0; - self.last = None; - return false; +use quill_weave::{BRAND_FRAME, State, point_count, project}; + +const DOTS: [[u32; 4]; 2] = [[0x01, 0x02, 0x04, 0x40], [0x08, 0x10, 0x20, 0x80]]; + +pub fn mark(columns: usize, rows: usize, state: State, seconds: f64) -> Vec<String> { + let (width, height) = (columns * 2, rows * 4); + let side = width.min(height) as f64; + let radius = side * 0.46; + let mut grid = vec![vec![0u32; columns]; rows]; + let params = state.params(); + let mut clock = BRAND_FRAME; + clock.advance(¶ms, seconds); + let mut dots = Vec::new(); + project(point_count(side * 4.0), ¶ms, &clock, &mut dots); + for dot in dots.iter().filter(|dot| dot.alpha > 0.3) { + let x = (width as f64 / 2.0 + dot.x * radius).floor(); + let y = (height as f64 / 2.0 + dot.y * radius).floor(); + if x < 0.0 || y < 0.0 || x >= width as f64 || y >= height as f64 { + continue; } - let now = Instant::now(); - let dt = self.last.map_or(1.0 / 60.0, |last| (now - last).as_secs_f64().min(0.05)); - self.last = Some(now); - self.params = self.params.ease(self.target.params(), dt); - self.clock.advance(&self.params, dt); - self.poke = (self.poke - dt * POKE_DECAY).max(0.0); - true + let (x, y) = (x as usize, y as usize); + grid[y / 4][x / 2] |= DOTS[x % 2][y % 4]; } + grid.iter().map(|row| row.iter().map(|bits| char::from_u32(0x2800 + bits).unwrap_or(' ')).collect()).collect() } -impl Render for WeaveMark { - fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement { - if self.step(cx.reduce_motion()) { - window.request_animation_frame(); +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn the_mark_is_braille_of_the_asked_size() { + let rows = mark(8, 4, State::Idle, 0.0); + assert_eq!(rows.len(), 4); + assert!(rows.iter().all(|row| row.chars().count() == 8)); + assert!(rows.iter().flat_map(|row| row.chars()).all(|c| ('\u{2800}'..='\u{28ff}').contains(&c))); + assert!(rows.iter().flat_map(|row| row.chars()).any(|c| c != '\u{2800}')); + assert_eq!(mark(8, 4, State::Idle, 0.0), rows); + } + + #[test] + fn the_activity_mark_is_one_line_that_moves() { + for state in [State::Thinking, State::Generating] { + let frames: Vec<String> = (0..12).map(|step| mark(2, 1, state, step as f64 * 0.08).concat()).collect(); + assert!(frames.iter().all(|frame| frame.chars().count() == 2)); + assert!(frames.windows(2).any(|pair| pair[0] != pair[1]), "{state:?} {frames:?}"); } - let params = self.params; - let clock = self.clock; - let poke = self.poke; - let opacity = self.opacity; - let color = palette(cx).text; - div() - .size_full() - .on_mouse_down( - MouseButton::Left, - cx.listener(|this, _, _, cx| { - this.poke = 1.0; - cx.notify(); - }), - ) - .child( - canvas(|_, _, _| (), move |bounds, _, window, _| paint(bounds, ¶ms, &clock, poke, opacity, color, window)).size_full(), - ) } -} -fn paint(bounds: Bounds<Pixels>, params: &Params, clock: &Clock, poke: f64, opacity: f32, color: Hsla, window: &mut Window) { - let width = bounds.size.width.as_f32() as f64; - let height = bounds.size.height.as_f32() as f64; - let side = width.min(height); - if side <= 0.0 { - return; - } - let radius = side * 0.38 * (1.0 + 0.22 * poke); - let base = (0.85 / window.scale_factor() as f64).max(radius * 0.05); - let cx0 = bounds.origin.x.as_f32() as f64 + width / 2.0; - let cy0 = bounds.origin.y.as_f32() as f64 + height / 2.0; - let mut dots = Vec::new(); - let mut order = Vec::new(); - project(point_count(side), params, clock, &mut dots); - depth_order(&dots, &mut order); - for i in order { - let dot = dots[i]; - let r = base * dot.size * (1.0 + 0.5 * poke); - let alpha = (dot.alpha + 0.55 * poke).min(1.0) as f32 * opacity; - let x = cx0 + dot.x * radius - r; - let y = cy0 + dot.y * radius - r; - let bounds = Bounds::new(point(px(x as f32), px(y as f32)), size(px((r * 2.0) as f32), px((r * 2.0) as f32))); - window.paint_quad(fill(bounds, color.opacity(alpha)).corner_radii(px(r as f32))); + #[test] + fn the_mark_moves_over_time() { + assert_ne!(mark(8, 4, State::Idle, 0.0), mark(8, 4, State::Idle, 2.0)); } -} - -pub fn model_mark(model: &str, side: f32, color: Hsla) -> impl IntoElement + use<> { - let clock = Clock::seeded(name_hash(model) as u64); - let params = State::Idle.params(); - canvas(|_, _, _| (), move |bounds, _, window, _| paint(bounds, ¶ms, &clock, 0.0, 1.0, color, window)).size(px(side)).flex_shrink_0() } \ No newline at end of file diff --git a/crates/quill-code/src/workspace.rs b/crates/quill-code/src/workspace.rs index 648222c..aee6c53 100644 --- a/crates/quill-code/src/workspace.rs +++ b/crates/quill-code/src/workspace.rs @@ -1,76 +1,114 @@ -use std::collections::HashMap; -use std::path::PathBuf; +use std::path::{Path, PathBuf}; use std::sync::Arc; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::mpsc::Sender; -use std::time::Duration; -use futures::StreamExt; -use gpui_kit::{Context, Entity, Task as GpuiTask}; -use quill_agent::{AgentEvent, Approval, Decision, Publisher, Task, system_prompt}; -use quill_llama::Message; +use quill_config::{ModelRef, Settings}; +use quill_core::{ + Access, Approval, Decision, Event, Input, Op, Outcome, Question, SessionHandle, Summarizer, Toolsets, TurnContext, spawn, +}; +use crate::Msg; use crate::attachments::{self, Attachment}; use crate::backend::Backend; -use crate::config::worktrees_dir; -use crate::config::{Config, read_personal_instructions}; -use crate::git; +use crate::config::read_personal_instructions; use crate::mentions::mentioned; -use crate::publish::GitPublisher; +use crate::project; use crate::store; -use crate::thread::{Item, Thread, ToolItem, ToolStatus, Turn, TurnState, now_ms, repair_history}; +use crate::thread::{Item, Thread, ToolItem, ToolStatus, Turn, TurnState, now_ms}; +use crate::usage; -#[derive(Clone)] +const MAX_LIVE_OUTPUT: usize = 200_000; + +#[derive(Clone, Default)] pub struct Prompt { pub text: String, pub attachments: Vec<Attachment>, } -fn isolated_copy(thread: &Thread) -> Result<PathBuf, String> { - let project = thread.project.as_ref().ok_or("An isolated copy needs a project.")?; - let path = worktrees_dir().join(format!("{}-{}", crate::project::name(project), thread.id)); - git::add_worktree(project, &path)?; - Ok(path) +pub struct Pending { + pub id: String, + pub tool: String, + pub approval: Approval, } -enum Update { - Event(AgentEvent), - Finished(Result<(), String>), +pub struct Asked { + pub id: String, + pub questions: Vec<Question>, + pub current: usize, + pub highlight: Vec<usize>, + pub picked: Vec<Option<usize>>, + pub typed: Vec<String>, + pub answers: Vec<Option<String>>, } -pub struct Pending { - pub tool_id: String, - pub approval: Approval, - reply: Sender<Decision>, +fn open_ended(option: &str) -> bool { + let option = option.trim().trim_end_matches(['.', ':', '…']).to_lowercase(); + ["something else", "other", "other answer", "none of these", "type my own", "custom"].contains(&option.as_str()) +} + +impl Asked { + pub fn new(id: String, questions: Vec<Question>) -> Asked { + let questions: Vec<Question> = questions + .into_iter() + .map(|question| Question { options: question.options.into_iter().filter(|option| !open_ended(option)).collect(), ..question }) + .collect(); + let count = questions.len(); + Asked { + id, + questions, + current: 0, + highlight: vec![0; count], + picked: vec![None; count], + typed: vec![String::new(); count], + answers: vec![None; count], + } + } + + pub fn question(&self) -> &Question { + &self.questions[self.current] + } + + pub fn other_row(&self) -> usize { + self.question().options.len() + } + + pub fn finished(&self) -> bool { + self.answers.iter().all(Option::is_some) + } } struct Run { + thread: u64, turn: usize, cancel: Arc<AtomicBool>, pending: Option<Pending>, + asked: Option<Asked>, + compacting: bool, } pub struct Workspace { pub threads: Vec<Thread>, pub active: Option<u64>, - pub draft_project: Option<PathBuf>, - pub draft_isolated: bool, - runs: HashMap<u64, Run>, - backend: Entity<Backend>, - ticker: Option<GpuiTask<()>>, + pub usage: Vec<usage::Record>, + pub access: Option<Access>, + session: Option<(u64, SessionHandle)>, + run: Option<Run>, + tx: Sender<Msg>, +} + +fn isolated_copy(thread: &Thread, base: &Path) -> Result<PathBuf, String> { + let project = thread.project.as_ref().ok_or("An isolated copy needs a project.")?; + let path = base.join(format!("{}-{}", project::name(project), thread.id)); + quill_git::add_worktree(project, &path)?; + Ok(path) } impl Workspace { - pub fn new(backend: Entity<Backend>) -> Self { - Workspace { - threads: store::load_threads(), - active: None, - draft_project: None, - draft_isolated: false, - runs: HashMap::new(), - backend, - ticker: None, - } + pub fn new(tx: Sender<Msg>) -> Workspace { + let threads = store::load_threads(); + let usage = usage::load(&threads); + Workspace { threads, active: None, usage, access: None, session: None, run: None, tx } } pub fn active_thread(&self) -> Option<&Thread> { @@ -81,137 +119,159 @@ impl Workspace { self.threads.iter_mut().find(|t| t.id == id) } - pub fn project(&self) -> Option<PathBuf> { - match self.active_thread() { - Some(thread) => thread.project.clone(), - None => self.draft_project.clone(), - } + pub fn running(&self) -> bool { + self.run.is_some() } - pub fn workdir(&self) -> Option<PathBuf> { - match self.active_thread() { - Some(thread) => thread.workdir(), - None => self.draft_project.clone(), - } + pub fn running_turn(&self) -> Option<(u64, usize)> { + self.run.as_ref().map(|run| (run.thread, run.turn)) } - pub fn isolated(&self) -> bool { - match self.active_thread() { - Some(thread) => thread.worktree.is_some(), - None => self.draft_isolated, - } + pub fn pending(&self) -> Option<&Pending> { + self.run.as_ref().and_then(|run| run.pending.as_ref()) } - pub fn set_isolated(&mut self, isolated: bool, cx: &mut Context<Self>) { - if self.active.is_none() { - self.draft_isolated = isolated; - cx.notify(); - } + pub fn asked(&self) -> Option<&Asked> { + self.run.as_ref().and_then(|run| run.asked.as_ref()) } - pub fn remove_isolated(&mut self, id: u64, cx: &mut Context<Self>) -> Result<(), String> { - self.stop(id, cx); - let thread = self.thread_mut(id).ok_or("That thread no longer exists.")?; - let (Some(project), Some(worktree)) = (thread.project.clone(), thread.worktree.clone()) else { return Ok(()) }; - git::remove_worktree(&project, &worktree)?; - thread.worktree = None; - store::save(thread); - cx.notify(); - Ok(()) + pub fn compacting(&self) -> bool { + self.run.as_ref().is_some_and(|run| run.compacting) } - pub fn running_count(&self) -> usize { - self.runs.len() + pub fn asked_mut(&mut self) -> Option<&mut Asked> { + self.run.as_mut().and_then(|run| run.asked.as_mut()) } - pub fn running(&self, id: u64) -> bool { - self.runs.contains_key(&id) + pub fn touch(&mut self, id: u64) { + if let Some(thread) = self.thread_mut(id) { + thread.updated = now_ms(); + store::save(thread); + } } - pub fn pending(&self, id: u64) -> Option<&Pending> { - self.runs.get(&id).and_then(|run| run.pending.as_ref()) + pub fn threads_in(&self, root: &Path) -> Vec<&Thread> { + self.threads.iter().filter(|thread| thread.project.as_deref().is_some_and(|project| project::same(project, root))).collect() } - pub fn start_new(&mut self, project: Option<PathBuf>, cx: &mut Context<Self>) { - self.active = None; - self.draft_project = project; - self.draft_isolated = false; - cx.notify(); + pub fn open(&mut self, id: u64) { + if self.session.as_ref().is_some_and(|(session, _)| *session != id) + && let Some((_, handle)) = self.session.take() + { + handle.send(Op::Shutdown); + } + self.active = Some(id); } - pub fn activate(&mut self, id: u64, cx: &mut Context<Self>) { - self.active = Some(id); - cx.notify(); + pub fn start_new(&mut self) { + if let Some((_, handle)) = self.session.take() { + handle.send(Op::Shutdown); + } + self.active = None; } - pub fn rename(&mut self, id: u64, title: String, cx: &mut Context<Self>) { + pub fn rename(&mut self, id: u64, title: String) { if let Some(thread) = self.thread_mut(id) { thread.title = title; store::save(thread); } - cx.notify(); } - pub fn delete(&mut self, id: u64, cx: &mut Context<Self>) { - self.stop(id, cx); + pub fn delete(&mut self, id: u64) { + if self.run.as_ref().is_some_and(|run| run.thread == id) { + self.stop(); + } + if self.session.as_ref().is_some_and(|(session, _)| *session == id) + && let Some((_, handle)) = self.session.take() + { + handle.send(Op::Shutdown); + } self.threads.retain(|t| t.id != id); store::delete(id); if self.active == Some(id) { self.active = None; } - cx.notify(); } - pub fn toggle_turn(&mut self, id: u64, turn: usize, cx: &mut Context<Self>) { - if let Some(turn) = self.thread_mut(id).and_then(|t| t.turns.get_mut(turn)) { - turn.expanded = !turn.expanded; + fn session(&mut self, id: u64) -> SessionHandle { + if let Some((session, handle)) = &self.session + && *session == id + { + return handle.clone(); } - cx.notify(); + if let Some((_, handle)) = self.session.take() { + handle.send(Op::Shutdown); + } + let history = self.threads.iter().find(|t| t.id == id).map(|t| t.history.clone()).unwrap_or_default(); + let tx = self.tx.clone(); + let handle = spawn(history, move |event| { + let _ = tx.send(Msg::Session(id, event)); + }); + self.session = Some((id, handle.clone())); + handle } - pub fn toggle_tool(&mut self, id: u64, turn: usize, tool: &str, cx: &mut Context<Self>) { - if let Some(tool) = self.thread_mut(id).and_then(|t| t.turns.get_mut(turn)).and_then(|t| t.tool_mut(tool)) { - tool.open = !tool.open; + fn steer(&mut self, text: String) { + let Some((id, turn)) = self.running_turn() else { return }; + if let Some(turn) = self.thread_mut(id).and_then(|thread| thread.turns.get_mut(turn)) { + turn.items.push(Item::Steer(text.clone())); + } + if let Some((session, handle)) = &self.session + && *session == id + { + handle.send(Op::Steer(text)); } - cx.notify(); } - pub fn send(&mut self, prompt: Prompt, cx: &mut Context<Self>) { - let Prompt { text, attachments } = prompt; + pub fn send(&mut self, prompt: Prompt, root: &Path, isolate: bool, backend: &mut Backend, settings: &Settings) -> Option<usize> { + let Prompt { text, mut attachments } = prompt; + if self.running() { + self.steer(text); + return None; + } let id = match self.active { - Some(id) if self.running(id) => return, Some(id) => id, None => { - let thread = Thread::new(self.draft_project.take(), &text); + let thread = Thread::new(Some(root.to_path_buf()), &text); let id = thread.id; self.threads.insert(0, thread); self.active = Some(id); id } }; - let isolate = std::mem::take(&mut self.draft_isolated); - let model = Backend::selected_id(cx); - let vision = self.backend.read(cx).selected(cx).is_some_and(|m| m.vision); - let thinking = self.backend.read(cx).request_thinking(cx); - let url = Backend::url(cx); - let access = Config::get(cx).access; - let personal = read_personal_instructions(); - let Some(thread) = self.thread_mut(id) else { return }; - let index = thread.turns.len(); - let mut names = Vec::new(); - let mut images = Vec::new(); - for (n, attachment) in attachments.iter().enumerate() { - match attachment.image.then(|| store::keep_image(id, n, &attachment.path)).flatten() { - Some(path) => images.push(path), - None => names.push(attachment.name.clone()), + let model = settings.models.selected.clone(); + let found = model.as_ref().and_then(|model| backend.effective(model, settings)); + let vision = found.as_ref().is_some_and(|m| m.vision); + let label = found.as_ref().map(|m| m.label().to_string()); + let thread = self.thread_mut(id)?; + let mut mentions: Vec<(String, PathBuf)> = Vec::new(); + if let Some(root) = thread.workdir().filter(|p| p.is_dir()) { + for rel in mentioned(&text) { + let path = root.join(&rel); + if !path.is_file() || !path.starts_with(&root) { + continue; + } + match Attachment::from_path(path.clone()).filter(|attachment| attachment.image) { + Some(image) => attachments.push(image), + None => mentions.push((rel, path)), + } } } + let index = thread.turns.len(); + let names: Vec<String> = attachments.iter().map(|attachment| attachment.name.clone()).collect(); + let images: Vec<PathBuf> = attachments + .iter() + .enumerate() + .filter(|(_, attachment)| attachment.image) + .filter_map(|(n, attachment)| store::keep_image(id, n, &attachment.path)) + .collect(); let mut turn = Turn::new(text.clone(), names); turn.images = images; thread.turns.push(turn); thread.updated = now_ms(); - let failure = match (&model, isolate.then(|| isolated_copy(thread)).transpose()) { - (None, _) => Some("Choose a model from the model menu in the prompt box first.".to_string()), + let isolated = (isolate && index == 0 && thread.worktree.is_none()).then(|| isolated_copy(thread, &settings.worktrees_dir())); + let failure = match (&model, isolated.transpose()) { + (None, _) => Some("Choose a model first with /model.".to_string()), (_, Err(error)) => Some(error), (Some(_), Ok(worktree)) => { if worktree.is_some() { @@ -221,175 +281,260 @@ impl Workspace { } }; if let Some(error) = failure { - if let Some(turn) = thread.turns.last_mut() { - turn.finish(TurnState::Failed(error)); - } - store::save(thread); - cx.notify(); - return; + return self.fail(id, index, error); } - let model = model.unwrap_or_default(); - thread.model = Some(model.clone()); - thread.turns[index].model = Some(model.clone()); - let root = thread.workdir().filter(|p| p.is_dir()); - let mentions: Vec<(String, PathBuf)> = match &root { - Some(root) => mentioned(&text) - .into_iter() - .map(|rel| (rel.clone(), root.join(&rel))) - .filter(|(_, path)| path.is_file() && path.starts_with(root)) - .collect(), - None => Vec::new(), - }; + let model = model?; + let thread = self.thread_mut(id)?; + thread.model = Some(model.model.clone()); + thread.provider = Some(model.provider.clone()); + thread.turns[index].model = label.or_else(|| Some(model.model.clone())); let prepared = attachments::prepare(&attachments, &mentions, vision); let mut content = text; content.push_str(&prepared.context); if !prepared.skipped.is_empty() { content.push_str(&format!("\n\n(Not attached: {}.)", prepared.skipped.join(", "))); } - thread.history.push(Message::user_with_images(content, prepared.images)); - let publisher: Option<Arc<dyn Publisher>> = - root.as_deref().filter(|root| git::snapshot(root).is_some()).map(|_| Arc::new(GitPublisher) as Arc<dyn Publisher>); - let task = Task { - server_url: url, - system: system_prompt(&model, root.as_deref(), publisher.is_some(), &personal), - model: model.clone(), - thinking, - root, - access, - history: thread.history.clone(), - publisher, - }; store::save(thread); - self.backend.update(cx, |backend, cx| backend.mark_used(&model, cx)); + let context = match self.threads.iter().find(|t| t.id == id).map(|thread| self.context(&model, thread, backend, settings)) { + Some(Ok(context)) => context, + Some(Err(error)) => return self.fail(id, index, error), + None => return None, + }; + backend.mark_used(&model); let cancel = Arc::new(AtomicBool::new(false)); - self.runs.insert(id, Run { turn: index, cancel: cancel.clone(), pending: None }); - let (tx, mut rx) = futures::channel::mpsc::unbounded(); - cx.background_executor() - .spawn(async move { - let result = quill_agent::run(task, &cancel, |event| { - let _ = tx.unbounded_send(Update::Event(event)); - }); - let _ = tx.unbounded_send(Update::Finished(result.map_err(|e| e.to_string()))); - }) - .detach(); - cx.spawn(async move |this, cx| { - while let Some(update) = rx.next().await { - if this.update(cx, |workspace, cx| workspace.apply(id, index, update, cx)).is_err() { - break; - } - } + self.run = Some(Run { thread: id, turn: index, cancel: cancel.clone(), pending: None, asked: None, compacting: false }); + let session = self.session(id); + session.send(Op::Turn { turn: index, input: Input { text: content, images: prepared.images }, context, cancel }); + Some(index) + } + + fn fail(&mut self, id: u64, index: usize, error: String) -> Option<usize> { + let thread = self.thread_mut(id)?; + if let Some(turn) = thread.turns.get_mut(index) { + turn.finish(TurnState::Failed(error)); + } + store::save(thread); + Some(index) + } + + fn context(&self, model: &ModelRef, thread: &Thread, backend: &Backend, settings: &Settings) -> Result<TurnContext, String> { + let provider = backend.provider(model)?; + let root = thread.workdir().filter(|p| p.is_dir()); + let project = settings.for_project(root.as_deref()); + let git = project.tools.git && root.as_deref().is_some_and(|root| quill_git::snapshot(root).is_some()); + let summarizer = project.models.roles.compaction.as_ref().filter(|role| *role != model).and_then(|role| { + let provider = backend.provider(role).ok()?; + Some(Summarizer { provider, model: role.model.clone(), tuning: backend.tuning(role, &project) }) + }); + Ok(TurnContext { + provider, + model: model.model.clone(), + summarizer, + tuning: backend.tuning(model, &project), + context_window: backend.effective(model, settings).and_then(|m| m.context), + root, + access: self.access.unwrap_or(project.agent.access), + toolsets: Toolsets { git }, + personal: read_personal_instructions(), + instructions: project.agent.instruction_files.clone(), + limits: project.limits(), + rules: project.permissions.rules.clone(), }) - .detach(); - self.ensure_ticker(cx); - cx.notify(); } - fn ensure_ticker(&mut self, cx: &mut Context<Self>) { - if self.ticker.is_some() { - return; + pub fn compact(&mut self, backend: &Backend, settings: &Settings) -> Result<(), String> { + if self.running() { + return Err("Wait for the reply to finish. A thread can be compacted between replies.".into()); } - self.ticker = Some(cx.spawn(async move |this, cx| { - loop { - cx.background_executor().timer(Duration::from_secs(1)).await; - let keep = this - .update(cx, |workspace, cx| { - cx.notify(); - let keep = !workspace.runs.is_empty(); - if !keep { - workspace.ticker = None; - } - keep - }) - .unwrap_or(false); - if !keep { - break; - } - } - })); + let model = settings.models.selected.clone().ok_or("Choose a model first with /model.")?; + let id = self.active.ok_or("Nothing to compact yet.")?; + let thread = self.threads.iter().find(|t| t.id == id).filter(|t| !t.history.is_empty()).ok_or("Nothing to compact yet.")?; + let context = self.context(&model, thread, backend, settings)?; + self.session(id).send(Op::Compact { context, cancel: Arc::default() }); + Ok(()) + } + + pub fn last_prompt(&self) -> Option<String> { + self.active_thread().and_then(|thread| thread.turns.last()).map(|turn| turn.prompt.clone()) } - fn apply(&mut self, id: u64, index: usize, update: Update, cx: &mut Context<Self>) { - if self.runs.get(&id).is_none_or(|run| run.turn != index) { - return; + pub fn apply(&mut self, id: u64, event: Event) -> bool { + let Some(thread) = self.threads.iter_mut().find(|t| t.id == id) else { return false }; + match event { + Event::Message { message } => { + thread.history.push(message); + return false; + } + Event::Compacting => { + if let Some(run) = self.run.as_mut() { + run.compacting = true; + } + return false; + } + Event::CompactFailed { .. } => { + if let Some(run) = self.run.as_mut() { + run.compacting = false; + } + return false; + } + Event::Compacted { history } => { + thread.history = history; + thread.context_used = None; + let index = self.run.as_ref().filter(|run| run.thread == id).map(|run| run.turn).or(thread.turns.len().checked_sub(1)); + if let Some(turn) = index.and_then(|index| thread.turns.get_mut(index)) { + turn.items.push(Item::Note("The conversation was summarised to free up the model's context.".into())); + } + if let Some(run) = self.run.as_mut() { + run.compacting = false; + } + store::save(thread); + return false; + } + _ => {} } - let Some(thread) = self.threads.iter_mut().find(|t| t.id == id) else { return }; - if let Update::Event(AgentEvent::Usage { prompt, completion }) = update { - thread.context_used = Some(prompt + completion); - cx.notify(); - return; + let Some(run) = self.run.as_mut().filter(|run| run.thread == id) else { return false }; + if event_turn(&event) != Some(run.turn) { + return false; } - let Some(turn) = thread.turns.get_mut(index) else { return }; - match update { - Update::Event(AgentEvent::Reasoning(text)) => turn.push_reasoning(&text), - Update::Event(AgentEvent::Text(text)) => turn.push_text(&text), - Update::Event(AgentEvent::StepDone) | Update::Event(AgentEvent::Usage { .. }) => {} - Update::Event(AgentEvent::ToolStarted { id: tool_id, kind, target }) => { - turn.items.push(Item::Tool(ToolItem { - id: tool_id, - kind, - target, - status: ToolStatus::Running, - output: String::new(), - diff: None, - open: false, - })); + let Some(turn) = thread.turns.get_mut(run.turn) else { return false }; + match event { + Event::Reasoning { text, .. } => turn.push_reasoning(&text), + Event::Text { text, .. } => turn.push_text(&text), + Event::ToolBegin { view, .. } => turn.items.push(Item::Tool(ToolItem::new(view))), + Event::ToolOutput { id: tool_id, chunk, .. } => { + if let Some(tool) = turn.tool_mut(&tool_id) + && tool.output.len() < MAX_LIVE_OUTPUT + { + tool.output.push_str(&chunk); + } } - Update::Event(AgentEvent::ToolFinished { id: tool_id, ok, output, diff }) => { + Event::ToolEnd { id: tool_id, ok, output, diffs, image, .. } => { if let Some(tool) = turn.tool_mut(&tool_id) { tool.status = if ok { ToolStatus::Done } else { ToolStatus::Failed }; tool.output = output; - tool.diff = diff; + tool.diffs = diffs; + tool.image = image; + tool.ended = Some(now_ms()); } - if let Some(run) = self.runs.get_mut(&id) { + if run.pending.as_ref().is_some_and(|pending| pending.id == tool_id) { run.pending = None; } } - Update::Event(AgentEvent::NeedsApproval { id: tool_id, approval, reply }) => { - if let Some(tool) = turn.tool_mut(&tool_id) { - tool.status = ToolStatus::Waiting; - } - if let Some(run) = self.runs.get_mut(&id) { - run.pending = Some(Pending { tool_id, approval, reply }); + Event::ApprovalRequested { id: tool_id, approval, .. } => { + let tool = match turn.tool_mut(&tool_id) { + Some(tool) => { + tool.status = ToolStatus::Waiting; + tool.tool.clone() + } + None => String::new(), + }; + run.pending = Some(Pending { id: tool_id, tool, approval }); + } + Event::QuestionAsked { id: tool_id, questions, .. } => { + for asked in &questions { + let (question, options) = (asked.question.clone(), asked.options.clone()); + turn.items.push(Item::Question { id: tool_id.clone(), question, options, answer: None }); } + run.asked = Some(Asked::new(tool_id, questions)); } - Update::Event(AgentEvent::Message(message)) => thread.history.push(message), - Update::Finished(result) => { - turn.finish(match result { - Ok(()) => TurnState::Done, - Err(error) => TurnState::Failed(error), + Event::PlanUpdated { steps, explanation, .. } => turn.set_plan(steps, explanation), + Event::Note { text, .. } => turn.items.push(Item::Note(text)), + Event::Usage { tokens, .. } => { + thread.context_used = Some(tokens.total()); + turn.usage.add(tokens); + } + Event::TurnFinished { outcome, .. } => { + if let Some(root) = thread.worktree.as_ref().or(thread.project.as_ref()) { + turn.note_gone(root); + } + turn.finish(match outcome { + Outcome::Done => TurnState::Done, + Outcome::Stopped => TurnState::Stopped, + Outcome::Failed(error) => TurnState::Failed(error), }); + if let Some(record) = usage::record(thread.id, thread.provider.as_deref(), turn) { + usage::append(&record); + self.usage.push(record); + } thread.updated = now_ms(); - repair_history(&mut thread.history); store::save(thread); - self.runs.remove(&id); - self.backend.update(cx, |backend, cx| backend.refresh(cx)); + self.run = None; + return true; } + _ => {} } - cx.notify(); + false } - pub fn stop(&mut self, id: u64, cx: &mut Context<Self>) { - let Some(run) = self.runs.remove(&id) else { return }; + pub fn stop(&mut self) { + let Some(run) = self.run.take() else { return }; run.cancel.store(true, Ordering::Relaxed); - if let Some(pending) = run.pending { - let _ = pending.reply.send(Decision::Decline); - } - if let Some(thread) = self.thread_mut(id) { - if let Some(turn) = thread.turns.get_mut(run.turn) { - turn.finish(TurnState::Stopped); + let Some(thread) = self.threads.iter_mut().find(|t| t.id == run.thread) else { return }; + if let Some(turn) = thread.turns.get_mut(run.turn) { + if let Some(root) = thread.worktree.as_ref().or(thread.project.as_ref()) { + turn.note_gone(root); + } + turn.finish(TurnState::Stopped); + if let Some(record) = usage::record(thread.id, thread.provider.as_deref(), turn) { + usage::append(&record); + self.usage.push(record); } - repair_history(&mut thread.history); - store::save(thread); } - cx.notify(); + store::save(thread); } - pub fn decide(&mut self, id: u64, decision: Decision, cx: &mut Context<Self>) { - let Some(pending) = self.runs.get_mut(&id).and_then(|run| run.pending.take()) else { return }; - if let Some(tool) = self.thread_mut(id).and_then(|t| t.turns.last_mut()).and_then(|t| t.tool_mut(&pending.tool_id)) { + pub fn decide(&mut self, decision: Decision) { + let Some(run) = self.run.as_mut() else { return }; + let Some(pending) = run.pending.take() else { return }; + let (id, turn) = (run.thread, run.turn); + if let Some(tool) = self.thread_mut(id).and_then(|t| t.turns.get_mut(turn)).and_then(|t| t.tool_mut(&pending.id)) { tool.status = ToolStatus::Running; + tool.started = now_ms(); + } + if let Some((_, handle)) = &self.session { + handle.send(Op::Decide { id: pending.id, decision }); } - let _ = pending.reply.send(decision); - cx.notify(); + } + + pub fn redirect(&mut self, instead: String) { + self.decide(Decision::Decline); + self.steer(instead); + } + + pub fn answer(&mut self, answers: Vec<String>) { + let Some(run) = self.run.as_mut() else { return }; + let Some(asked) = run.asked.take() else { return }; + let (id, turn) = (run.thread, run.turn); + if let Some(turn) = self.thread_mut(id).and_then(|t| t.turns.get_mut(turn)) { + turn.answer(&asked.id, &answers); + } + if let Some((_, handle)) = &self.session { + handle.send(Op::Answer { id: asked.id, answers }); + } + } + + pub fn shutdown(&mut self) { + self.stop(); + if let Some((_, handle)) = self.session.take() { + handle.send(Op::Shutdown); + } + } +} + +fn event_turn(event: &Event) -> Option<usize> { + match event { + Event::TurnStarted { turn } + | Event::Reasoning { turn, .. } + | Event::Text { turn, .. } + | Event::ToolBegin { turn, .. } + | Event::ToolOutput { turn, .. } + | Event::ToolEnd { turn, .. } + | Event::ApprovalRequested { turn, .. } + | Event::QuestionAsked { turn, .. } + | Event::PlanUpdated { turn, .. } + | Event::Note { turn, .. } + | Event::Usage { turn, .. } + | Event::TurnFinished { turn, .. } => Some(*turn), + Event::Message { .. } | Event::Compacting | Event::Compacted { .. } | Event::CompactFailed { .. } => None, } } \ No newline at end of file diff --git a/crates/quill-agent/Cargo.toml b/crates/quill-config/Cargo.toml similarity index 66% rename from crates/quill-agent/Cargo.toml rename to crates/quill-config/Cargo.toml index a1ca59a..2025d50 100644 --- a/crates/quill-agent/Cargo.toml +++ b/crates/quill-config/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "quill-agent" +name = "quill-config" version.workspace = true edition.workspace = true license.workspace = true @@ -7,7 +7,7 @@ authors.workspace = true publish.workspace = true [dependencies] -quill-llama.workspace = true +quill-core.workspace = true +quill-providers.workspace = true serde = { version = "1", features = ["derive"] } -serde_json = "1" -similar = "2" \ No newline at end of file +serde_json = "1" \ No newline at end of file diff --git a/crates/quill-config/src/lib.rs b/crates/quill-config/src/lib.rs new file mode 100644 index 0000000..fbdaa6c --- /dev/null +++ b/crates/quill-config/src/lib.rs @@ -0,0 +1,323 @@ +mod models; +mod paths; + +use std::fs; +use std::path::{Path, PathBuf}; + +use quill_core::{Access, FinalNewline, Limits, Rule, Shell}; +use serde::{Deserialize, Serialize}; +use serde_json::Value; + +pub use models::{ModelRef, Models, Override, Provider, Roles, ServerKind}; +pub use paths::{app_dir, home_dir, personal_instructions_path, read_personal_instructions}; + +pub const INSTRUCTION_FILES: [&str; 4] = ["AGENTS.md", "CLAUDE.md", "GEMINI.md", ".github/copilot-instructions.md"]; + +#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] +#[serde(default)] +pub struct General { + pub worktrees_dir: Option<PathBuf>, + pub trusted: Vec<PathBuf>, +} + +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +pub enum Reasoning { + Expanded, + Collapsed, + #[default] + Hidden, +} + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(default)] +pub struct Appearance { + pub reasoning: Reasoning, + pub group_exploration: bool, +} + +impl Default for Appearance { + fn default() -> Self { + Appearance { reasoning: Reasoning::Hidden, group_exploration: true } + } +} + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(default)] +pub struct Agent { + pub access: Access, + pub max_steps: usize, + pub auto_compact: bool, + pub parallel_tools: bool, + pub instruction_files: Vec<String>, +} + +impl Default for Agent { + fn default() -> Self { + let limits = Limits::default(); + Agent { + access: Access::Full, + max_steps: limits.max_steps, + auto_compact: true, + parallel_tools: limits.parallel_tools, + instruction_files: INSTRUCTION_FILES.iter().map(|s| s.to_string()).collect(), + } + } +} + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(default)] +pub struct Tools { + pub shell: Shell, + pub command_timeout: u64, + pub max_command_timeout: u64, + pub max_output: usize, + pub max_read_lines: usize, + pub max_matches: usize, + pub ignored: Vec<String>, + pub disabled: Vec<String>, + pub final_newline: FinalNewline, + pub git: bool, +} + +impl Default for Tools { + fn default() -> Self { + let limits = Limits::default(); + Tools { + shell: limits.shell, + command_timeout: limits.command_timeout, + max_command_timeout: limits.max_command_timeout, + max_output: limits.max_output, + max_read_lines: limits.max_read_lines, + max_matches: limits.max_matches, + ignored: limits.ignored, + disabled: Vec::new(), + final_newline: limits.final_newline, + git: true, + } + } +} + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(default)] +pub struct Permissions { + pub rules: Vec<Rule>, + pub safe_commands: Vec<String>, +} + +impl Default for Permissions { + fn default() -> Self { + Permissions { rules: Vec::new(), safe_commands: Limits::default().safe_commands } + } +} + +#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] +#[serde(default)] +pub struct Settings { + pub general: General, + pub appearance: Appearance, + pub models: Models, + pub agent: Agent, + pub tools: Tools, + pub permissions: Permissions, +} + +pub fn settings_path() -> PathBuf { + app_dir().join("settings.json") +} + +pub fn project_settings_path(root: &Path) -> PathBuf { + root.join(".quill").join("settings.json") +} + +pub fn merge(base: &mut Value, over: Value) { + match (base, over) { + (Value::Object(base), Value::Object(over)) => { + for (key, value) in over { + merge(base.entry(key).or_insert(Value::Null), value); + } + } + (slot, value) => *slot = value, + } +} + +pub struct Loaded { + pub settings: Settings, + pub error: Option<String>, +} + +pub fn parse(text: &str) -> Result<Settings, String> { + serde_json::from_str(text).map_err(|e| format!("settings.json could not be read: {e}")) +} + +pub fn load() -> Loaded { + match fs::read_to_string(settings_path()) { + Ok(text) if !text.trim().is_empty() => match parse(&text) { + Ok(settings) => Loaded { settings, error: None }, + Err(error) => Loaded { settings: Settings::default(), error: Some(error) }, + }, + _ => { + let settings = Settings::default(); + let _ = save(&settings); + Loaded { settings, error: None } + } + } +} + +pub fn save(settings: &Settings) -> std::io::Result<()> { + let path = settings_path(); + let value = keep_unknown(&path, serde_json::to_value(settings).map_err(std::io::Error::other)?); + write_atomic(&path, &serde_json::to_string_pretty(&value).map_err(std::io::Error::other)?) +} + +pub fn keep_unknown(path: &Path, value: Value) -> Value { + let mut saved = fs::read_to_string(path).ok().and_then(|text| serde_json::from_str(&text).ok()).unwrap_or(Value::Null); + merge(&mut saved, value); + saved +} + +pub fn write_atomic(path: &Path, text: &str) -> std::io::Result<()> { + if let Some(dir) = path.parent() { + fs::create_dir_all(dir)?; + } + let temp = path.with_extension(format!("json.{}.tmp", std::process::id())); + fs::write(&temp, text)?; + fs::rename(&temp, path) +} + +impl Settings { + pub fn for_project(&self, root: Option<&Path>) -> Settings { + let Some(text) = root.and_then(|root| fs::read_to_string(project_settings_path(root)).ok()) else { return self.clone() }; + let Ok(over) = serde_json::from_str::<Value>(&text) else { return self.clone() }; + let Ok(mut base) = serde_json::to_value(self) else { return self.clone() }; + merge(&mut base, over); + serde_json::from_value(base).unwrap_or_else(|_| self.clone()) + } + + pub fn limits(&self) -> Limits { + Limits { + max_steps: self.agent.max_steps.max(1), + command_timeout: self.tools.command_timeout.max(1), + max_command_timeout: self.tools.max_command_timeout.max(self.tools.command_timeout).max(1), + max_output: self.tools.max_output.max(1000), + max_read_lines: self.tools.max_read_lines.max(10), + max_matches: self.tools.max_matches.max(1), + auto_compact: self.agent.auto_compact, + parallel_tools: self.agent.parallel_tools, + shell: self.tools.shell, + ignored: self.tools.ignored.clone(), + safe_commands: self.permissions.safe_commands.clone(), + disabled_tools: self.tools.disabled.clone(), + final_newline: self.tools.final_newline, + } + } + + pub fn worktrees_dir(&self) -> PathBuf { + self.general.worktrees_dir.clone().unwrap_or_else(|| home_dir().join(".quill-code").join("worktrees")) + } + + pub fn reset(&self) -> Settings { + let mut fresh = Settings::default(); + fresh.models.providers = self.models.providers.clone(); + fresh.models.selected = self.models.selected.clone(); + fresh.models.pinned = self.models.pinned.clone(); + fresh.models.profiles = self.models.profiles.clone(); + fresh.general.trusted = self.general.trusted.clone(); + fresh + } +} + +#[cfg(test)] +mod tests { + use super::*; + use quill_core::RuleAction; + use serde_json::json; + + #[test] + fn missing_fields_take_defaults() { + let settings = parse(r#"{ "agent": { "max_steps": 12 } }"#).unwrap(); + assert_eq!(settings.agent.max_steps, 12); + assert_eq!(settings.tools, Tools::default()); + assert!(parse("{ broken").is_err()); + } + + #[test] + fn settings_from_the_desktop_app_still_load() { + let old = r#"{ + "general": { "projects": ["C:\\work\\a"], "projects_dir": null, "worktrees_dir": "D:\\trees", "remember_project": true }, + "appearance": { "theme": "dark", "motion": "off", "reasoning": "hidden", "transcript_width": 820, "sidebar": false } + }"#; + let settings = parse(old).unwrap(); + assert_eq!(settings.general.worktrees_dir, Some(PathBuf::from("D:\\trees"))); + assert_eq!(settings.appearance.reasoning, Reasoning::Hidden); + assert!(settings.appearance.group_exploration); + let saved = serde_json::to_string(&settings).unwrap(); + assert!(!saved.contains("theme") && !saved.contains("projects")); + } + + #[test] + fn a_reset_keeps_the_models() { + let mut settings = Settings::default(); + settings.models.selected = Some(ModelRef::new("local", "qwen")); + settings.models.pinned = vec![ModelRef::new("local", "qwen")]; + settings.models.providers.push(Provider::new("ollama", ServerKind::Ollama, "http://box:11434")); + settings.agent.max_steps = 3; + settings.appearance.reasoning = Reasoning::Expanded; + let fresh = settings.reset(); + assert_eq!(fresh.models.selected, settings.models.selected); + assert_eq!(fresh.models.pinned, settings.models.pinned); + assert_eq!(fresh.models.providers, settings.models.providers); + assert_eq!(fresh.agent, Agent::default()); + assert_eq!(fresh.appearance, Appearance::default()); + } + + #[test] + fn objects_merge_and_values_replace() { + let mut base = json!({ "agent": { "max_steps": 100, "access": "full" }, "tools": { "ignored": ["a", "b"] } }); + merge(&mut base, json!({ "agent": { "access": "supervised" }, "tools": { "ignored": ["c"] } })); + assert_eq!(base, json!({ "agent": { "max_steps": 100, "access": "supervised" }, "tools": { "ignored": ["c"] } })); + } + + #[test] + fn saving_keeps_what_a_newer_version_wrote() { + let path = std::env::temp_dir().join(format!("quill-keep-{}.json", std::process::id())); + fs::write(&path, r#"{ "agent": { "max_steps": 5, "later": true }, "newer": [1] }"#).unwrap(); + let value = keep_unknown(&path, json!({ "agent": { "max_steps": 9 }, "tools": {} })); + assert_eq!(value, json!({ "agent": { "max_steps": 9, "later": true }, "newer": [1], "tools": {} })); + fs::write(&path, "{ broken").unwrap(); + assert_eq!(keep_unknown(&path, json!({ "a": 1 })), json!({ "a": 1 })); + fs::remove_file(&path).unwrap(); + } + + #[test] + fn projects_can_override_their_own_settings() { + let root = std::env::temp_dir().join(format!("quill-config-{}", std::process::id())); + let _ = fs::remove_dir_all(&root); + fs::create_dir_all(root.join(".quill")).unwrap(); + fs::write( + project_settings_path(&root), + r#"{ "agent": { "access": "supervised" }, "permissions": { "rules": [{ "tool": "shell", "pattern": "npm test", "action": "allow" }] } }"#, + ) + .unwrap(); + let user = Settings { agent: Agent { max_steps: 7, ..Agent::default() }, ..Settings::default() }; + let effective = user.for_project(Some(&root)); + assert_eq!(effective.agent.access, Access::Supervised); + assert_eq!(effective.agent.max_steps, 7); + assert_eq!(effective.permissions.rules[0].action, RuleAction::Allow); + assert_eq!(user.for_project(None), user); + fs::remove_dir_all(&root).unwrap(); + } + + #[test] + fn limits_follow_the_settings() { + let mut settings = Settings::default(); + settings.tools.shell = Shell::Cmd; + settings.tools.disabled = vec!["shell".into()]; + let limits = settings.limits(); + assert_eq!(limits.shell, Shell::Cmd); + assert_eq!(limits.disabled_tools, vec!["shell".to_string()]); + settings.agent.auto_compact = false; + assert!(!settings.limits().auto_compact); + assert_eq!(Settings::default().limits(), Limits::default()); + } +} \ No newline at end of file diff --git a/crates/quill-config/src/models.rs b/crates/quill-config/src/models.rs new file mode 100644 index 0000000..345e6f6 --- /dev/null +++ b/crates/quill-config/src/models.rs @@ -0,0 +1,236 @@ +use quill_providers::Profile; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +pub enum ServerKind { + LlamaCpp, + LmStudio, + Ollama, + Vllm, + Jan, + Gpt4All, + #[default] + #[serde(other)] + Custom, +} + +impl ServerKind { + pub const ALL: [ServerKind; 7] = [ + ServerKind::LlamaCpp, + ServerKind::LmStudio, + ServerKind::Ollama, + ServerKind::Vllm, + ServerKind::Jan, + ServerKind::Gpt4All, + ServerKind::Custom, + ]; + + pub fn label(self) -> &'static str { + match self { + ServerKind::LlamaCpp => "llama.cpp", + ServerKind::LmStudio => "LM Studio", + ServerKind::Ollama => "Ollama", + ServerKind::Vllm => "vLLM", + ServerKind::Jan => "Jan", + ServerKind::Gpt4All => "GPT4All", + ServerKind::Custom => "Another server", + } + } + + pub fn description(self) -> &'static str { + match self { + ServerKind::LlamaCpp => "llama-server", + ServerKind::LmStudio => "turn on the server in the Developer tab", + ServerKind::Ollama => "ollama serve", + ServerKind::Vllm => "vllm serve, with --enable-auto-tool-choice for tools", + ServerKind::Jan => "turn on the Local API Server in Settings", + ServerKind::Gpt4All => "turn on the API server in Settings", + ServerKind::Custom => "anything with an OpenAI-compatible API", + } + } + + pub fn port(self) -> Option<u16> { + match self { + ServerKind::LlamaCpp => Some(9931), + ServerKind::LmStudio => Some(1234), + ServerKind::Ollama => Some(11434), + ServerKind::Vllm => Some(8000), + ServerKind::Jan => Some(1337), + ServerKind::Gpt4All => Some(4891), + ServerKind::Custom => None, + } + } + + pub fn default_url(self) -> String { + self.port().map(|port| format!("http://127.0.0.1:{port}")).unwrap_or_default() + } + + pub fn asks_key(self) -> bool { + !matches!(self, ServerKind::Ollama | ServerKind::Gpt4All) + } + + fn slug(self) -> &'static str { + match self { + ServerKind::LlamaCpp => "llama-cpp", + ServerKind::LmStudio => "lm-studio", + ServerKind::Ollama => "ollama", + ServerKind::Vllm => "vllm", + ServerKind::Jan => "jan", + ServerKind::Gpt4All => "gpt4all", + ServerKind::Custom => "server", + } + } +} + +#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] +#[serde(default)] +pub struct Provider { + pub id: String, + pub name: String, + pub kind: ServerKind, + pub url: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub key: Option<String>, + pub enabled: bool, +} + +impl Provider { + pub fn new(id: &str, kind: ServerKind, url: &str) -> Provider { + Provider { id: id.into(), name: kind.label().into(), kind, url: url.into(), key: None, enabled: true } + } +} + +#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[serde(from = "RawRef")] +pub struct ModelRef { + pub provider: String, + pub model: String, +} + +#[derive(Deserialize)] +#[serde(untagged)] +enum RawRef { + Legacy(String), + Full { provider: String, model: String }, +} + +impl From<RawRef> for ModelRef { + fn from(raw: RawRef) -> ModelRef { + match raw { + RawRef::Legacy(model) => ModelRef::new("local", model), + RawRef::Full { provider, model } => ModelRef { provider, model }, + } + } +} + +impl ModelRef { + pub fn new(provider: impl Into<String>, model: impl Into<String>) -> ModelRef { + ModelRef { provider: provider.into(), model: model.into() } + } +} + +#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] +#[serde(default)] +pub struct Roles { + pub compaction: Option<ModelRef>, + pub commit: Option<ModelRef>, + pub subagent: Option<ModelRef>, +} + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Override { + pub model: ModelRef, + #[serde(default)] + pub context: Option<u64>, + #[serde(default)] + pub vision: Option<bool>, +} + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(default)] +pub struct Models { + pub providers: Vec<Provider>, + pub selected: Option<ModelRef>, + pub pinned: Vec<ModelRef>, + pub thinking: bool, + pub effort: String, + pub roles: Roles, + pub overrides: Vec<Override>, + pub profiles: Vec<Profile>, +} + +impl Default for Models { + fn default() -> Self { + Models { + providers: Vec::new(), + selected: None, + pinned: Vec::new(), + thinking: true, + effort: "medium".into(), + roles: Roles::default(), + overrides: Vec::new(), + profiles: Vec::new(), + } + } +} + +impl Models { + pub fn provider(&self, id: &str) -> Option<&Provider> { + self.providers.iter().find(|provider| provider.id == id) + } + + pub fn override_for(&self, model: &ModelRef) -> Option<&Override> { + self.overrides.iter().find(|entry| entry.model == *model) + } + + pub fn fresh_id(&self, kind: ServerKind) -> String { + (1..) + .map(|n| if n == 1 { kind.slug().to_string() } else { format!("{}-{n}", kind.slug()) }) + .find(|id| self.provider(id).is_none()) + .unwrap_or_default() + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn model_refs_read_old_plain_names() { + let old: ModelRef = serde_json::from_str("\"qwen3.5-4b\"").unwrap(); + assert_eq!(old, ModelRef::new("local", "qwen3.5-4b")); + let new: ModelRef = serde_json::from_str(r#"{ "provider": "local-2", "model": "gemma" }"#).unwrap(); + assert_eq!(new, ModelRef::new("local-2", "gemma")); + assert_eq!(serde_json::to_value(&new).unwrap()["provider"], "local-2"); + } + + #[test] + fn new_servers_get_the_next_free_id() { + let mut models = Models::default(); + assert!(models.providers.is_empty()); + assert_eq!(models.fresh_id(ServerKind::Ollama), "ollama"); + models.providers.push(Provider::new("ollama", ServerKind::Ollama, "http://127.0.0.1:11434")); + assert_eq!(models.fresh_id(ServerKind::Ollama), "ollama-2"); + } + + #[test] + fn servers_know_their_kind_and_keys_stay_out_of_the_file_when_empty() { + let provider = Provider::new("jan", ServerKind::Jan, &ServerKind::Jan.default_url()); + assert_eq!(provider.url, "http://127.0.0.1:1337"); + let saved = serde_json::to_value(&provider).unwrap(); + assert_eq!(saved["kind"], "jan"); + assert!(saved.get("key").is_none()); + let unknown: Provider = serde_json::from_str(r#"{ "kind": "something_new", "url": "http://box" }"#).unwrap(); + assert_eq!(unknown.kind, ServerKind::Custom); + } + + #[test] + fn overrides_are_found_by_model() { + let mut models = Models::default(); + let model = ModelRef::new("local", "m"); + assert!(models.override_for(&model).is_none()); + models.overrides.push(Override { model: model.clone(), context: Some(8192), vision: None }); + assert_eq!(models.override_for(&model).unwrap().context, Some(8192)); + } +} \ No newline at end of file diff --git a/crates/quill-config/src/paths.rs b/crates/quill-config/src/paths.rs new file mode 100644 index 0000000..e4e2626 --- /dev/null +++ b/crates/quill-config/src/paths.rs @@ -0,0 +1,28 @@ +use std::fs; +use std::path::PathBuf; + +pub fn home_dir() -> PathBuf { + std::env::var_os("USERPROFILE").or_else(|| std::env::var_os("HOME")).map(PathBuf::from).unwrap_or_default() +} + +fn config_dir() -> PathBuf { + if cfg!(windows) { + return std::env::var_os("APPDATA").map(PathBuf::from).unwrap_or_else(home_dir); + } + if cfg!(target_os = "macos") { + return home_dir().join("Library").join("Application Support"); + } + std::env::var_os("XDG_CONFIG_HOME").map(PathBuf::from).filter(|path| path.is_absolute()).unwrap_or_else(|| home_dir().join(".config")) +} + +pub fn app_dir() -> PathBuf { + config_dir().join("quill-code") +} + +pub fn personal_instructions_path() -> PathBuf { + home_dir().join(".quill-code").join("AGENTS.md") +} + +pub fn read_personal_instructions() -> String { + fs::read_to_string(personal_instructions_path()).unwrap_or_default() +} \ No newline at end of file diff --git a/crates/quill-core/Cargo.toml b/crates/quill-core/Cargo.toml new file mode 100644 index 0000000..231c6fa --- /dev/null +++ b/crates/quill-core/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "quill-core" +version.workspace = true +edition.workspace = true +license.workspace = true +authors.workspace = true +publish.workspace = true + +[dependencies] +globset = "0.4.20" +ignore = "0.4.33" +quill-git.workspace = true +quill-providers.workspace = true +regex = "1.13.1" +serde = { version = "1", features = ["derive"] } +serde_json = "1" +similar = "3" \ No newline at end of file diff --git a/crates/quill-core/examples/probe.rs b/crates/quill-core/examples/probe.rs new file mode 100644 index 0000000..0c5ffbc --- /dev/null +++ b/crates/quill-core/examples/probe.rs @@ -0,0 +1,66 @@ +use std::sync::Arc; +use std::sync::mpsc::channel; + +use quill_core::{Access, Decision, Event, Input, Limits, Op, Toolsets, TurnContext, spawn}; +use quill_providers::OpenAi; + +fn main() { + let mut args = std::env::args().skip(1); + let url = args.next().unwrap_or_else(|| "http://127.0.0.1:9931".into()); + let model = args.next().unwrap_or_default(); + let prompt = args.next().unwrap_or_else(|| "Create hello.py that prints a greeting, then run it.".into()); + let root = std::env::temp_dir().join("quill-probe"); + std::fs::create_dir_all(&root).expect("probe folder"); + let (tx, rx) = channel(); + let session = spawn(Vec::new(), move |event| { + let _ = tx.send(event); + }); + let context = TurnContext { + provider: Arc::new(OpenAi::new(&url)), + model, + summarizer: None, + tuning: Default::default(), + context_window: None, + root: Some(root.clone()), + access: Access::Full, + toolsets: Toolsets { git: false }, + personal: String::new(), + instructions: vec!["AGENTS.md".into()], + limits: Limits::default(), + rules: Vec::new(), + }; + println!("working in {}", root.display()); + session.send(Op::Turn { turn: 0, input: Input { text: prompt, images: Vec::new() }, context, cancel: Arc::default() }); + for event in rx { + match event { + Event::Text { text, .. } => print!("{text}"), + Event::ToolBegin { view, .. } => println!("\n[{}] {}", view.tool, view.target), + Event::ToolEnd { ok, output, diffs, .. } => { + println!(" -> {} {} ({} diffs)", if ok { "ok" } else { "failed" }, output.lines().next().unwrap_or_default(), diffs.len()) + } + Event::ApprovalRequested { id, approval, .. } => { + println!("\n approving: {} {}", approval.title, approval.subject); + session.send(Op::Decide { id, decision: Decision::Approve }); + } + Event::QuestionAsked { id, questions, .. } => { + let mut answers = Vec::new(); + for question in questions { + println!("\n question: {} {:?}", question.question, question.options); + answers.push(question.options.first().cloned().unwrap_or_else(|| "Yes".into())); + } + session.send(Op::Answer { id, answers }); + } + Event::PlanUpdated { steps, .. } => { + for step in steps { + println!(" plan: {:?} {}", step.status, step.text); + } + } + Event::Usage { tokens, .. } => println!("\n usage: {} in, {} out", tokens.prompt, tokens.completion), + Event::TurnFinished { outcome, .. } => { + println!("\nresult: {outcome:?}"); + break; + } + _ => {} + } + } +} \ No newline at end of file diff --git a/crates/quill-core/src/context.rs b/crates/quill-core/src/context.rs new file mode 100644 index 0000000..a7f85b2 --- /dev/null +++ b/crates/quill-core/src/context.rs @@ -0,0 +1,366 @@ +use std::path::Path; +use std::sync::atomic::AtomicBool; + +use quill_providers::{ChatRequest, Error, Event, Message, Provider, Role, Tuning}; + +use crate::protocol::{PlanStep, StepStatus}; +use crate::tools; + +const SUMMARY: &str = "Summary of the conversation so far:"; + +const SUMMARIZE: &str = "You are compacting a coding session so the assistant can carry on in a fresh context without losing anything that matters. Write the summary under these headings: + +1. Request: everything the user asked for, in their own words where the wording matters. +2. Decisions and constraints: choices made, the user's preferences and any rules to keep following. +3. Files: every file read, created or changed, with its path, what it holds or what was changed, and the exact code the next steps depend on. +4. Commands and results: commands run, what they showed, errors met and how they were fixed. +5. Current work: exactly what was being done when this summary was made. +6. Next step: the very next action to take. +7. Remaining: what is left to do after that. + +Keep exact names, paths, identifiers, values and error messages. Write only what the conversation shows; never guess. Reply with the summary only."; + +const CONTINUE: &str = "The conversation above was summarised because the model's context was nearly full. Carry on with the task from where it stopped, without repeating steps the summary says are done."; + +const REREAD: &str = "Before you use the exact contents of any file listed above, read it again with read_file. The summary describes those files but is not a copy of them, so never quote or answer from it when the exact text matters."; + +const RECENT: usize = 12; + +const RESTORED: usize = 5; + +const RESTORED_HEADING: &str = "Current contents of the files you worked with most recently, read again from disk just now:"; + +const ACKNOWLEDGED: &str = "I have the summary of our work so far."; + +pub fn estimate(history: &[Message]) -> u64 { + let chars: usize = history + .iter() + .map(|m| { + m.content.len() + + m.reasoning.as_ref().map_or(0, String::len) + + m.images.len() * 3000 + + m.tool_calls.iter().map(|c| c.function.name.len() + c.function.arguments.len()).sum::<usize>() + }) + .sum(); + (chars / 4) as u64 +} + +pub fn limit(window: u64) -> u64 { + let reserve = (window / 4).clamp(4096, 20_000).min(window / 2); + window - reserve +} + +pub fn over(used: u64, window: Option<u64>) -> bool { + window.is_some_and(|window| used > limit(window)) +} + +pub fn overflowed(error: &str) -> bool { + let error = error.to_lowercase(); + error.contains("context") && ["exceed", "too long", "too large", "overflow", "length", "size"].iter().any(|word| error.contains(word)) +} + +fn clip(text: &str, max: usize) -> String { + if text.len() <= max { + return text.to_string(); + } + let mut end = max; + while !text.is_char_boundary(end) { + end -= 1; + } + match text[end..].lines().count() { + 0 | 1 => format!("{} [cut here: the rest of this text was not kept]", &text[..end]), + lines => format!("{} [cut here: {} more lines were not kept]", &text[..end], lines - 1), + } +} + +fn line(message: &Message, recent: bool) -> String { + let room = if recent { 3 } else { 1 }; + match message.role { + Role::System => format!("System: {}", clip(&message.content, 2000)), + Role::User => format!("User: {}", clip(&message.content, 6000 * room)), + Role::Assistant => { + let calls: Vec<String> = + message.tool_calls.iter().map(|c| format!("[{} {}]", c.function.name, clip(&c.function.arguments, 600 * room))).collect(); + format!("Assistant: {} {}", clip(&message.content, 4000 * room), calls.join(" ")).trim_end().to_string() + } + Role::Tool => format!("Tool result: {}", clip(&message.content, 1500 * room)), + } +} + +pub fn transcript(messages: &[Message], max_chars: usize) -> String { + let recent = messages.len().saturating_sub(RECENT); + let lines: Vec<String> = messages.iter().enumerate().map(|(index, message)| line(message, index >= recent)).collect(); + let text = lines.join("\n\n"); + if text.len() <= max_chars { + return text; + } + let first = lines.first().map(|first| clip(first, max_chars / 4)).unwrap_or_default(); + let mut start = text.len() - max_chars.saturating_sub(first.len()).max(1); + while !text.is_char_boundary(start) { + start += 1; + } + format!("{first}\n\n[middle part cut]\n{}", &text[start..]) +} + +pub fn summarize( + provider: &dyn Provider, + model: &str, + tuning: &Tuning, + window: Option<u64>, + history: &[Message], + cancel: &AtomicBool, +) -> Result<String, Error> { + let budget = window.map_or(48_000, |w| (w as usize).saturating_mul(2).max(8000)); + let request = ChatRequest { + model: model.to_string(), + messages: vec![Message::system(SUMMARIZE), Message::user(transcript(history, budget))], + reasoning: tuning.quiet.clone(), + kwargs: tuning.kwargs.clone(), + context: window, + ..ChatRequest::default() + }; + let mut text = String::new(); + provider.stream(&request, cancel, &mut |event| { + if let Event::Content(chunk) = event { + text.push_str(&chunk); + } + })?; + let text = match text.rfind("</think>") { + Some(end) => text[end + 8..].trim().to_string(), + None => text.trim().to_string(), + }; + if text.is_empty() { Err(Error("The model returned an empty summary.".into())) } else { Ok(text) } +} + +fn requests(history: &[Message]) -> Vec<&str> { + let start = history.iter().rposition(|m| m.role == Role::Assistant && m.tool_calls.is_empty()).map_or(0, |index| index + 1); + history[start..].iter().filter(|m| m.role == Role::User).map(|m| m.content.as_str()).collect() +} + +pub fn recent(history: &[Message], budget: u64) -> usize { + let mut start = history.len(); + for (index, message) in history.iter().enumerate().rev() { + if message.role == Role::User { + break; + } + if message.role == Role::Assistant && !message.tool_calls.is_empty() { + if estimate(&history[index..]) > budget { + break; + } + start = index; + } + } + start +} + +fn files(history: &[Message]) -> Vec<(String, bool)> { + let mut files: Vec<(String, bool)> = Vec::new(); + for call in history.iter().flat_map(|m| &m.tool_calls) { + let Some((path, changed)) = tools::file_of(&call.function.name, &call.function.arguments) else { continue }; + match files.iter_mut().find(|(known, _)| *known == path) { + Some(file) => file.1 |= changed, + None => files.push((path, changed)), + } + } + files +} + +fn plan(history: &[Message]) -> Option<Vec<PlanStep>> { + history + .iter() + .rev() + .flat_map(|m| m.tool_calls.iter().rev()) + .find_map(|call| tools::plan_of(&call.function.name, &call.function.arguments)) +} + +fn facts(history: &[Message]) -> String { + let mut text = String::new(); + let files = files(history); + if !files.is_empty() { + let listed: Vec<String> = + files.iter().map(|(path, changed)| format!("- {path} ({})", if *changed { "changed" } else { "read" })).collect(); + text.push_str(&format!("\n\n---\n\nFiles from this session:\n{}", listed.join("\n"))); + } + if let Some(steps) = plan(history).filter(|steps| !steps.is_empty()) { + let listed: Vec<String> = steps + .iter() + .map(|step| { + let mark = match step.status { + StepStatus::Done => "done", + StepStatus::Active => "in progress", + StepStatus::Pending => "to do", + }; + format!("- [{mark}] {}", step.text) + }) + .collect(); + text.push_str(&format!("\n\n---\n\nThe plan when the summary was made:\n{}", listed.join("\n"))); + } + text +} + +fn paths(history: &[Message]) -> Vec<String> { + let mut seen: Vec<String> = Vec::new(); + for call in history.iter().rev().flat_map(|m| m.tool_calls.iter().rev()) { + if let Some((path, _)) = tools::file_of(&call.function.name, &call.function.arguments) + && !seen.contains(&path) + { + seen.push(path); + } + } + seen +} + +pub fn restore(root: &Path, history: &[Message], kept: usize, budget: u64) -> Vec<(String, String)> { + let shown = paths(&history[kept..]); + let seen: Vec<String> = paths(&history[..kept]).into_iter().filter(|path| !shown.contains(path)).collect(); + let mut room = (budget * 4) as usize; + let mut restored = Vec::new(); + for path in seen.into_iter().take(RESTORED) { + let Ok(text) = std::fs::read_to_string(root.join(&path)) else { continue }; + if room < 200 || text.contains('\0') { + break; + } + let kept = clip(&text, room); + room = room.saturating_sub(kept.len()); + restored.push((path, kept)); + } + restored +} + +pub fn rebuild(summary: &str, history: &[Message], mid_turn: bool, kept: usize, restored: &[(String, String)]) -> Vec<Message> { + let mut text = format!("{SUMMARY}\n\n{summary}{}", facts(history)); + if !restored.is_empty() { + let files: Vec<String> = restored.iter().map(|(path, contents)| format!("### {path}\n```\n{contents}\n```")).collect(); + text.push_str(&format!("\n\n---\n\n{RESTORED_HEADING}\n\n{}", files.join("\n\n"))); + } + let reread = if files(history).is_empty() { String::new() } else { format!(" {REREAD}") }; + if !mid_turn { + text.push_str(&format!("\n\n{}", reread.trim_start())); + return vec![Message::user(text.trim_end().to_string()), Message::assistant(ACKNOWLEDGED, Vec::new())]; + } + let asked: Vec<String> = requests(history).iter().map(|text| clip(text, 6000)).collect(); + if !asked.is_empty() { + text.push_str(&format!("\n\n---\n\nWhat the user asked for in this turn:\n\n{}", asked.join("\n\n"))); + } + text.push_str(&format!("\n\n---\n\n{CONTINUE}{reread}")); + let mut rebuilt = vec![Message::user(text)]; + rebuilt.extend(history[kept..].iter().cloned()); + rebuilt +} + +pub fn trim_outputs(history: &mut [Message], keep: usize) -> bool { + let tools: Vec<usize> = history.iter().enumerate().filter(|(_, m)| m.role == Role::Tool).map(|(i, _)| i).collect(); + let mut changed = false; + for &index in tools.iter().rev().skip(keep) { + if history[index].content.len() > 600 { + history[index].content = clip(&history[index].content, 400); + changed = true; + } + } + changed +} + +#[cfg(test)] +mod tests { + use super::*; + use quill_providers::ToolCall; + + fn history() -> Vec<Message> { + vec![ + Message::user("first"), + Message::assistant("", vec![ToolCall::new("a", "read_file", "{}")]), + Message::tool("a", "x".repeat(2000)), + Message::assistant("done", Vec::new()), + Message::user("second"), + Message::assistant("", vec![ToolCall::new("b", "shell", "{}")]), + Message::tool("b", "ok"), + ] + } + + #[test] + fn compaction_starts_near_the_end_of_the_window() { + assert_eq!(limit(131_072), 111_072); + assert_eq!(limit(32_768), 24_576); + assert_eq!(limit(8192), 4096); + assert!(over(30_000, Some(32_768)) && !over(20_000, Some(32_768)) && !over(1_000_000, None)); + assert_eq!(estimate(&history()[..3]), 504); + } + + #[test] + fn a_turn_compacted_midway_keeps_its_request_and_latest_steps() { + let history = history(); + let rebuilt = rebuild("They read a file.", &history, true, recent(&history, 1000), &[]); + assert_eq!(rebuilt.len(), 3); + assert!(rebuilt[0].content.contains("They read a file.") && rebuilt[0].content.contains("\n\nsecond\n\n")); + assert!(rebuilt[0].content.ends_with(CONTINUE)); + assert_eq!(rebuilt[1].tool_calls[0].function.name, "shell"); + assert_eq!(rebuilt[2].role, Role::Tool); + assert_eq!(rebuild("s", &history, true, history.len(), &[]).len(), 1); + let between = rebuild("s", &history, false, history.len(), &[]); + assert_eq!((between[0].role, between[1].role), (Role::User, Role::Assistant)); + } + + #[test] + fn the_files_touched_are_listed_so_they_get_read_again() { + let history = vec![ + Message::user("fix it"), + Message::assistant("", vec![ToolCall::new("a", "read_file", r#"{"path":"src\\main.rs"}"#)]), + Message::tool("a", "fn main() {}"), + Message::assistant("", vec![ToolCall::new("b", "edit_file", r#"{"file_path":"src/main.rs","old_text":"a","new_text":"b"}"#)]), + Message::tool("b", "ok"), + Message::assistant("", vec![ToolCall::new("c", "read_file", r#"{"path":"Cargo.toml"}"#)]), + Message::tool("c", "[package]"), + ]; + let text = facts(&history); + assert!(text.contains("- src/main.rs (changed)\n- Cargo.toml (read)"), "{text}"); + assert!(!text.contains(REREAD)); + assert!(rebuild("s", &history, true, history.len(), &[])[0].content.ends_with(REREAD)); + assert!(rebuild("s", &history, false, history.len(), &[])[0].content.ends_with(REREAD)); + assert!(facts(&[Message::user("hi")]).is_empty()); + } + + #[test] + fn the_latest_files_come_back_from_disk() { + let root = std::env::temp_dir().join(format!("quill-restore-{}", std::process::id())); + let _ = std::fs::remove_dir_all(&root); + std::fs::create_dir_all(&root).unwrap(); + std::fs::write(root.join("a.txt"), "first file").unwrap(); + std::fs::write(root.join("b.txt"), "second file").unwrap(); + let history = vec![ + Message::assistant("", vec![ToolCall::new("a", "read_file", r#"{"path":"a.txt"}"#)]), + Message::tool("a", "first file"), + Message::assistant("", vec![ToolCall::new("b", "edit_file", r#"{"path":"b.txt","old_text":"x","new_text":"y"}"#)]), + Message::tool("b", "ok"), + Message::assistant("", vec![ToolCall::new("c", "read_file", r#"{"path":"gone.txt"}"#)]), + Message::tool("c", "missing"), + ]; + let restored = restore(&root, &history, history.len(), 1000); + assert_eq!(restored, vec![("b.txt".to_string(), "second file".to_string()), ("a.txt".to_string(), "first file".to_string())]); + let rebuilt = rebuild("s", &history, true, history.len(), &restored); + assert!(rebuilt[0].content.contains("### b.txt\n```\nsecond file\n```")); + assert!(restore(&root, &history, history.len(), 10).is_empty()); + assert_eq!(restore(&root, &history, 2, 1000), vec![("a.txt".to_string(), "first file".to_string())]); + std::fs::remove_dir_all(&root).unwrap(); + } + + #[test] + fn context_errors_are_recognised() { + assert!(overflowed("The server answered 400: the request exceeds the available context size, try increasing it")); + assert!(overflowed("This model's maximum context length is 32768 tokens")); + assert!(!overflowed("Nothing is answering at that address.")); + } + + #[test] + fn old_tool_output_is_trimmed() { + let mut history = history(); + assert!(trim_outputs(&mut history, 1)); + assert!(history[2].content.len() < 600); + assert!(!trim_outputs(&mut history, 1)); + } + + #[test] + fn transcripts_keep_the_start_and_the_end_when_too_long() { + let text = transcript(&history(), 200); + assert!(text.starts_with("User: first") && text.contains("[middle part cut]") && text.ends_with("ok")); + } +} \ No newline at end of file diff --git a/crates/quill-agent/src/diff.rs b/crates/quill-core/src/diff.rs similarity index 81% rename from crates/quill-agent/src/diff.rs rename to crates/quill-core/src/diff.rs index bddcd33..f79c8b5 100644 --- a/crates/quill-agent/src/diff.rs +++ b/crates/quill-core/src/diff.rs @@ -7,6 +7,7 @@ pub enum LineKind { Added, Removed, Gap, + Note, } #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] @@ -29,6 +30,7 @@ pub struct FileDiff { pub fn diff_text(path: &str, before: Option<&str>, after: &str) -> FileDiff { let old = before.unwrap_or_default(); let diff = TextDiff::from_lines(old, after); + let newline_changed = old.ends_with('\n') != after.ends_with('\n'); let mut lines = Vec::new(); let (mut added, mut removed) = (0, 0); for (index, group) in diff.grouped_ops(3).iter().enumerate() { @@ -54,6 +56,9 @@ pub fn diff_text(path: &str, before: Option<&str>, after: &str) -> FileDiff { new: change.new_index().map(|i| i + 1), text: change.value().trim_end_matches(['\n', '\r']).to_string(), }); + if newline_changed && kind != LineKind::Context && !change.value().ends_with('\n') { + lines.push(DiffLine { kind: LineKind::Note, old: None, new: None, text: "No newline at end of file".into() }); + } } } } @@ -83,6 +88,14 @@ mod tests { assert!(diff.lines.iter().any(|l| l.kind == LineKind::Context)); } + #[test] + fn a_removed_final_newline_is_noted() { + let kinds = |diff: FileDiff| diff.lines.iter().map(|l| l.kind).collect::<Vec<_>>(); + let removed = diff_text("x", Some("a\nb\n"), "a\nb"); + assert_eq!(kinds(removed), [LineKind::Context, LineKind::Removed, LineKind::Added, LineKind::Note]); + assert!(!kinds(diff_text("x", Some("a\nb"), "a\nc")).contains(&LineKind::Note)); + } + #[test] fn distant_changes_are_split_by_a_gap() { let before: String = (1..=30).map(|n| format!("{n}\n")).collect(); diff --git a/crates/quill-agent/src/instructions.rs b/crates/quill-core/src/instructions.rs similarity index 87% rename from crates/quill-agent/src/instructions.rs rename to crates/quill-core/src/instructions.rs index e3ec6dd..da2a5a4 100644 --- a/crates/quill-agent/src/instructions.rs +++ b/crates/quill-core/src/instructions.rs @@ -16,10 +16,10 @@ fn expand_imports(root: &Path, text: &str) -> String { .join("\n") } -pub fn project_instructions(root: &Path) -> String { +pub fn project_instructions(root: &Path, files: &[String]) -> String { let mut seen: Vec<String> = Vec::new(); let mut parts = Vec::new(); - for name in ["AGENTS.md", "CLAUDE.md", "GEMINI.md", ".github/copilot-instructions.md"] { + for name in files { let Ok(raw) = fs::read_to_string(root.join(name)) else { continue }; let text = expand_imports(root, &raw).trim().to_string(); if text.is_empty() || seen.contains(&text) { @@ -50,7 +50,8 @@ mod tests { fs::create_dir_all(&dir).unwrap(); fs::write(dir.join("AGENTS.md"), "Use tabs.").unwrap(); fs::write(dir.join("CLAUDE.md"), "@AGENTS.md").unwrap(); - let text = project_instructions(&dir); + let files: Vec<String> = ["AGENTS.md", "CLAUDE.md"].iter().map(|s| s.to_string()).collect(); + let text = project_instructions(&dir, &files); assert_eq!(text.matches("Use tabs.").count(), 1); assert!(text.starts_with("## AGENTS.md")); fs::remove_dir_all(&dir).unwrap(); diff --git a/crates/quill-core/src/lib.rs b/crates/quill-core/src/lib.rs new file mode 100644 index 0000000..d71dfbd --- /dev/null +++ b/crates/quill-core/src/lib.rs @@ -0,0 +1,18 @@ +mod context; +pub mod diff; +mod instructions; +mod options; +mod policy; +mod prompt; +mod protocol; +mod session; +pub mod tools; +mod turn; + +pub use context::limit as compact_limit; +pub use diff::{DiffLine, FileDiff, LineKind, diff_text}; +pub use instructions::project_instructions; +pub use options::{FinalNewline, Limits, Shell, Toolsets}; +pub use policy::{Access, Effect, Rule, RuleAction, Verdict, read_only, verdict}; +pub use protocol::{Approval, Category, Decision, Event, Outcome, PlanStep, Question, StepStatus, ToolView}; +pub use session::{Input, Op, SessionHandle, Summarizer, TurnContext, spawn}; \ No newline at end of file diff --git a/crates/quill-core/src/options.rs b/crates/quill-core/src/options.rs new file mode 100644 index 0000000..79be7ac --- /dev/null +++ b/crates/quill-core/src/options.rs @@ -0,0 +1,128 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +pub enum Shell { + PowerShell, + Pwsh, + Cmd, + Bash, + Sh, +} + +impl Default for Shell { + fn default() -> Self { + if cfg!(windows) { Shell::PowerShell } else { Shell::Sh } + } +} + +impl Shell { + pub const ALL: [Shell; 5] = [Shell::PowerShell, Shell::Pwsh, Shell::Cmd, Shell::Bash, Shell::Sh]; + + pub fn label(self) -> &'static str { + match self { + Shell::PowerShell => "Windows PowerShell", + Shell::Pwsh => "PowerShell 7", + Shell::Cmd => "Command Prompt", + Shell::Bash => "Bash", + Shell::Sh => "sh", + } + } +} + +#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +pub enum FinalNewline { + #[default] + Keep, + Remove, + Add, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] +pub struct Toolsets { + pub git: bool, +} + +impl Default for Toolsets { + fn default() -> Self { + Toolsets { git: true } + } +} + +#[derive(Debug, Clone, PartialEq)] +pub struct Limits { + pub max_steps: usize, + pub command_timeout: u64, + pub max_command_timeout: u64, + pub max_output: usize, + pub max_read_lines: usize, + pub max_matches: usize, + pub auto_compact: bool, + pub parallel_tools: bool, + pub shell: Shell, + pub ignored: Vec<String>, + pub safe_commands: Vec<String>, + pub disabled_tools: Vec<String>, + pub final_newline: FinalNewline, +} + +pub const IGNORED: [&str; 13] = + [".git", "node_modules", "target", "dist", "build", ".venv", "venv", "__pycache__", ".next", ".idea", ".vs", "bin", "obj"]; + +pub const SAFE_COMMANDS: [&str; 34] = [ + "git status", + "git diff", + "git log", + "git show", + "git branch", + "git remote -v", + "git rev-parse", + "Get-ChildItem", + "gci", + "ls", + "dir", + "Get-Content", + "gc", + "cat", + "type", + "Select-String", + "sls", + "Select-Object", + "Where-Object", + "Sort-Object", + "Measure-Object", + "Format-Table", + "Format-List", + "Get-Location", + "pwd", + "Get-Item", + "Test-Path", + "Resolve-Path", + "rg", + "findstr", + "where", + "Get-Command", + "echo", + "Write-Output", +]; + +impl Default for Limits { + fn default() -> Self { + Limits { + max_steps: 100, + command_timeout: 120, + max_command_timeout: 600, + max_output: 30_000, + max_read_lines: 1500, + max_matches: 200, + auto_compact: true, + parallel_tools: true, + shell: Shell::default(), + ignored: IGNORED.iter().map(|s| s.to_string()).collect(), + safe_commands: SAFE_COMMANDS.iter().map(|s| s.to_string()).collect(), + disabled_tools: Vec::new(), + final_newline: FinalNewline::Keep, + } + } +} \ No newline at end of file diff --git a/crates/quill-core/src/policy.rs b/crates/quill-core/src/policy.rs new file mode 100644 index 0000000..af76ca4 --- /dev/null +++ b/crates/quill-core/src/policy.rs @@ -0,0 +1,282 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +pub enum Access { + #[serde(alias = "manual")] + Supervised, + AutoEdits, + #[default] + #[serde(alias = "auto")] + Full, +} + +impl Access { + pub const ALL: [Access; 3] = [Access::Supervised, Access::AutoEdits, Access::Full]; + + pub fn label(self) -> &'static str { + match self { + Access::Supervised => "Ask first", + Access::AutoEdits => "Trust edits", + Access::Full => "Autopilot", + } + } + + pub fn description(self) -> &'static str { + match self { + Access::Supervised => "Checks with you before every change and every command that is not read-only", + Access::AutoEdits => "Makes edits and read-only commands on its own, checks before the rest", + Access::Full => "Works without stopping to ask, except before fetching from the web or throwing work away", + } + } +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Effect { + Read, + ReadOutside, + Write, + Execute, + Publish, + Network, + Desktop, + Delegate, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +pub enum RuleAction { + Allow, + Ask, + Deny, +} + +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +pub struct Rule { + pub tool: String, + #[serde(default)] + pub pattern: String, + pub action: RuleAction, +} + +impl Rule { + pub fn allow(tool: &str, pattern: &str) -> Rule { + Rule { tool: tool.to_string(), pattern: pattern.to_string(), action: RuleAction::Allow } + } + + pub fn matches(&self, tool: &str, subject: &str) -> bool { + (self.tool == "*" || self.tool.eq_ignore_ascii_case(tool)) && pattern_matches(&self.pattern, subject) + } +} + +fn pattern_matches(pattern: &str, subject: &str) -> bool { + let pattern = pattern.trim().to_lowercase(); + let subject = subject.trim().to_lowercase(); + if pattern.is_empty() || pattern == "*" { + return true; + } + match pattern.strip_suffix('*') { + Some(prefix) => subject.starts_with(prefix), + None => subject == pattern || subject.starts_with(&format!("{pattern} ")), + } +} + +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum Verdict { + Allow, + Ask, + Deny(String), +} + +pub fn verdict(access: Access, effect: Effect, tool: &str, subject: &str, rules: &[Rule], safe_commands: &[String]) -> Verdict { + if let Some(rule) = rules.iter().rev().find(|rule| rule.matches(tool, subject)) { + return match rule.action { + RuleAction::Allow => Verdict::Allow, + RuleAction::Ask => Verdict::Ask, + RuleAction::Deny => Verdict::Deny(format!("A rule in the user's settings blocks {tool} here.")), + }; + } + match effect { + Effect::Read => Verdict::Allow, + Effect::Network => Verdict::Ask, + Effect::Execute if discards_work(subject) => Verdict::Ask, + _ if access == Access::Full => Verdict::Allow, + Effect::Write if access == Access::AutoEdits => Verdict::Allow, + Effect::Execute if read_only(subject, safe_commands) => Verdict::Allow, + _ => Verdict::Ask, + } +} + +pub fn read_only(command: &str, safe_commands: &[String]) -> bool { + if command.contains('>') || command.contains('`') || command.contains("$(") { + return false; + } + let mut parts = command.split(['|', ';', '&', '\n']).map(str::trim).filter(|part| !part.is_empty()).peekable(); + parts.peek().is_some() && parts.all(|part| safe_commands.iter().any(|safe| pattern_matches(safe, part))) +} + +pub fn discards_work(command: &str) -> bool { + let text = command.to_lowercase(); + text.split(['|', ';', '&', '\n']).any(|part| { + let words: Vec<&str> = part.split_whitespace().collect(); + let has = |word: &str| words.contains(&word); + let git = |sub: &str| words.first() == Some(&"git") && words.get(1) == Some(&sub); + let first = words.first().copied().unwrap_or_default(); + let recursive = words.iter().any(|word| word.starts_with("-r") || word.starts_with("-fr") || *word == "/s"); + (git("checkout") && (has("--") || has("."))) + || (git("restore") && !has("--staged")) + || (git("reset") && has("--hard")) + || git("clean") + || (git("stash") && (has("drop") || has("clear"))) + || (git("push") && words.iter().any(|word| word.starts_with("--force") || *word == "-f")) + || (git("branch") && has("-d")) + || (["rm", "remove-item", "ri", "del", "rd", "rmdir"].contains(&first) && recursive) + }) +} + +fn redirects_into_a_file(text: &str) -> bool { + text.match_indices('>').any(|(at, _)| { + let rest = text[at + 1..].trim_start_matches('>').trim_start(); + let target = rest.split_whitespace().next().unwrap_or_default(); + let to_stream = text[..at].ends_with(|c: char| c.is_ascii_digit()) && rest.starts_with('&'); + !to_stream && !target.is_empty() && !target.starts_with('&') && !["/dev/null", "$null", "nul", "null"].contains(&target) + }) +} + +pub fn edits_files(command: &str) -> bool { + let text = command.to_lowercase(); + let words: Vec<&str> = text + .split(|c: char| c.is_whitespace() || matches!(c, ';' | '|' | '&' | '(' | ')' | '{' | '}' | '"' | '\'')) + .filter(|word| !word.is_empty()) + .collect(); + let has = |word: &str| words.contains(&word); + let interpreter = ["python", "python3", "py", "node", "ruby", "perl", "php"].iter().any(|word| has(word)); + let inline = has("-c") || has("-e") || text.contains("<<"); + let writes = [".write(", "write_text", "write_bytes", "writefile", "appendfile"].iter().any(|marker| text.contains(marker)); + let in_place = (has("sed") || has("perl")) && (text.contains(" -i") || text.contains(" -pi") || text.contains("--in-place")); + let cmdlets = ["set-content", "add-content", "out-file", "writealltext", "writealllines", "writeallbytes", "appendalltext"] + .iter() + .any(|cmdlet| text.contains(cmdlet)) + || (has("new-item") && text.contains("-value")); + let printed = ["echo", "printf", "cat", "type", "write-output", "write-host"].iter().any(|word| has(word)); + (interpreter && inline && writes) || in_place || cmdlets || has("tee") || has("tee-object") || (printed && redirects_into_a_file(&text)) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn commands_that_edit_files_are_spotted() { + let edits = [ + "python -c \"open('a.py','w').write('x')\"", + "python3 - <<'EOF'\nfrom pathlib import Path\nPath('a.txt').write_text('x')\nEOF", + "node -e \"require('fs').writeFileSync('a.js','x')\"", + "sed -i 's/a/b/' main.rs", + "perl -pi -e 's/a/b/' main.rs", + "Set-Content -Path a.txt -Value hi", + "'hi' | Out-File notes.md", + "[IO.File]::WriteAllText('a.txt', 'x')", + "New-Item a.txt -Value hi", + "echo hello > notes.txt", + "cat <<EOF > config.toml\nx = 1\nEOF", + "printf 'x' >> log.txt", + "echo x | tee a.txt", + ]; + for command in edits { + assert!(edits_files(command), "{command}"); + } + let runs = [ + "python main.py", + "python -m pytest -q", + "cargo test 2>&1", + "npm run build > /dev/null", + "echo done", + "Get-Content a.txt | Select-String fn", + "git commit -m \"open the write path\"", + "node script.js", + "sed -n '1,20p' main.rs", + ]; + for command in runs { + assert!(!edits_files(command), "{command}"); + } + } + + fn safe() -> Vec<String> { + ["git status", "Get-ChildItem", "Select-String"].iter().map(|s| s.to_string()).collect() + } + + #[test] + fn access_reads_old_settings() { + let auto: Access = serde_json::from_str("\"auto\"").unwrap(); + let manual: Access = serde_json::from_str("\"manual\"").unwrap(); + assert_eq!((auto, manual), (Access::Full, Access::Supervised)); + assert_eq!(serde_json::to_string(&Access::AutoEdits).unwrap(), "\"auto_edits\""); + } + + #[test] + fn presets_decide_by_effect() { + let ask = |access, effect| verdict(access, effect, "t", "x", &[], &safe()); + assert_eq!(ask(Access::Supervised, Effect::Read), Verdict::Allow); + assert_eq!(ask(Access::Supervised, Effect::Write), Verdict::Ask); + assert_eq!(ask(Access::AutoEdits, Effect::Write), Verdict::Allow); + assert_eq!(ask(Access::AutoEdits, Effect::Execute), Verdict::Ask); + assert_eq!(ask(Access::Full, Effect::Execute), Verdict::Allow); + assert_eq!(ask(Access::Full, Effect::ReadOutside), Verdict::Allow); + assert_eq!(ask(Access::Full, Effect::Network), Verdict::Ask); + assert_eq!(verdict(Access::AutoEdits, Effect::Execute, "shell", "git status", &[], &safe()), Verdict::Allow); + assert_eq!(verdict(Access::Supervised, Effect::Execute, "shell", "git status", &[], &safe()), Verdict::Allow); + assert_eq!(verdict(Access::Supervised, Effect::Execute, "shell", "npm install", &[], &safe()), Verdict::Ask); + } + + #[test] + fn rules_win_over_presets() { + let rules = vec![Rule::allow("shell", "npm test"), Rule { tool: "*".into(), pattern: "rm*".into(), action: RuleAction::Deny }]; + assert_eq!(verdict(Access::Supervised, Effect::Execute, "shell", "npm test -- --watch", &rules, &[]), Verdict::Allow); + assert_eq!(verdict(Access::Supervised, Effect::Execute, "shell", "npm testing", &rules, &[]), Verdict::Ask); + assert!(matches!(verdict(Access::Full, Effect::Execute, "shell", "rm -rf x", &rules, &[]), Verdict::Deny(_))); + } + + #[test] + fn commands_that_throw_work_away_always_ask() { + let discards = [ + "git checkout -- source/Note.hx", + "git checkout .", + "git restore src/main.rs", + "git reset --hard HEAD~1", + "git clean -fd", + "git stash drop", + "git push --force origin main", + "git branch -D old", + "rm -rf build", + "Remove-Item -Recurse -Force dist", + "cargo test; git checkout -- .", + ]; + for command in discards { + assert!(discards_work(command), "{command}"); + assert_eq!(verdict(Access::Full, Effect::Execute, "shell", command, &[], &safe()), Verdict::Ask, "{command}"); + } + let keeps = [ + "git checkout -b fix-login", + "git checkout main", + "git restore --staged a.rs", + "git push", + "rm notes.txt", + "Remove-Item a.txt", + ]; + for command in keeps { + assert!(!discards_work(command), "{command}"); + } + let rules = vec![Rule::allow("shell", "git clean")]; + assert_eq!(verdict(Access::Full, Effect::Execute, "shell", "git clean -fd", &rules, &safe()), Verdict::Allow); + } + + #[test] + fn read_only_commands_are_recognised() { + assert!(read_only("git status", &safe())); + assert!(read_only("Get-ChildItem src | Select-String foo", &safe())); + assert!(!read_only("Get-ChildItem > out.txt", &safe())); + assert!(!read_only("git status; npm install", &safe())); + assert!(!read_only("", &safe())); + } +} \ No newline at end of file diff --git a/crates/quill-core/src/prompt.rs b/crates/quill-core/src/prompt.rs new file mode 100644 index 0000000..99c865d --- /dev/null +++ b/crates/quill-core/src/prompt.rs @@ -0,0 +1,168 @@ +use std::path::Path; + +use crate::instructions::project_instructions; +use crate::options::{FinalNewline, Shell}; +use crate::tools::{Tool, Toolset}; + +const POWERSHELL: &str = "# Commands + +shell runs Windows PowerShell, so write PowerShell, not bash or cmd: +- Use cmdlets such as Get-ChildItem, Get-Content, Select-String, New-Item, Copy-Item, Move-Item and Remove-Item. Do not use ls -la, grep, cat with flags, rm -rf, touch or export. +- Separate commands with a semicolon. Set environment variables with $env:NAME = 'value'. +- Paths use backslashes, and paths with spaces need quotes. +- Run programs installed on the computer, such as python, node, npm, cargo, dotnet or go, by name."; + +const CMD: &str = "# Commands + +shell runs the Windows Command Prompt, so write cmd syntax. Chain commands with &&, set variables with set NAME=value and quote paths that contain spaces."; + +const POSIX: &str = "# Commands + +shell runs a POSIX shell, so write sh syntax. Combine commands with && and quote paths that contain spaces. Run programs installed on the computer by name."; + +const COMMAND_RULES: &str = "Commands must finish on their own. Pass flags that skip prompts, such as -y, and do not start servers, watchers or anything else that waits forever; a command is stopped when its timeout runs out. To look at files, use find_files, grep and read_file rather than shell commands. For anything else, use the system's own commands and the programs installed on the computer. Never write Python or other scripts to read or change files; change files with edit_file and write_file."; + +const WORKFLOW: &str = "# How to work + +1. Understand the request. If it is unclear in a way that changes the result, ask with ask_user. Otherwise make a sensible choice and mention it. +2. For work with more than two steps, write a short plan with update_plan, keep one step in_progress, and update it as you go. +3. Explore before changing anything, and search before you read. Grep for the exact names the request mentions, such as functions, types, constants, messages or settings, and use find_files for file names. Then read_file only the lines around those matches, with start_line and end_line; read a whole file only when it is short or you need all of it. Send searches and reads that do not depend on each other together in one reply, so they run at the same time, instead of one per reply. +4. Before a change, say in one short sentence which file and names you are about to change and why. Then make focused changes that follow the project's existing style, naming and structure. Do not reformat or rewrite code the task does not touch. +5. Check your work as described under Checking your work, and fix whatever broke. +6. When a tool call fails, read the error and change your approach. Never repeat a call that failed in exactly the same way. +7. When the user declines a change or a command, do not try it again in another form. Ask what they would like instead. + +Keep going until the task is done. Do not stop between ordinary steps to ask for permission; the app asks the user when it needs to."; + +const CHECKING: &str = "# Checking your work + +You are responsible for the code working, not only for writing it. After you change code, check it the way the project's own developers would, without being asked: + +- Find the project's checks first: the scripts in package.json, a Makefile or justfile, Cargo.toml, pyproject.toml, go.mod, a .csproj or .sln, build.gradle or pom.xml, project.xml or a .hxml file, the CI workflows in .github/workflows, and what the README, AGENTS.md or CONTRIBUTING say. Use the commands they define rather than inventing your own. +- Run the checks that cover what you changed: the compiler or type checker (such as cargo check, tsc --noEmit, go build or dotnet build), the linter the project already uses (such as cargo clippy, eslint or ruff), and the tests closest to your change, then the whole test suite when the change is broad. +- When a check fails, read the error, fix the cause and run the check again until it passes. Never weaken or delete a test to make it pass unless the user asks. +- When you add behaviour and the project has tests, add or update a test for it. +- Do not install new tools or dependencies only to check your work. When the project has no way to build or test the change, or a check needs something that is missing, say so instead of claiming it works. +- Before your final reply, make sure the last run of every check you used passed."; + +const GIT: &str = "# Git + +The project uses Git. To commit or open a pull request, use commit_changes and open_pull_request rather than running git yourself. Commit or open a pull request only when the user asks for it. Put work meant for a pull request on a new branch with a short, descriptive name such as fix-login. Write commit messages as one short summary line in the imperative mood, followed by details only when they help."; + +const KEEP_NEWLINE: &str = "A file keeps its final newline, or its lack of one, unless you change it; read_file says when a file ends with a newline. To remove a final newline, call edit_file with old_text set to the last two lines followed by the line break after them, and new_text set to the same two lines without it. To add one, do the opposite. Never rewrite the file for this, and never join lines or delete any other line break."; + +const REMOVE_NEWLINE: &str = "Quill removes the final newline from every file you write or edit, so files end right after their last character; files that need one, such as patches, keep it. Never join lines or delete line breaks to do that yourself. To remove the final newline from a file without changing anything else, call edit_file with its last line as both old_text and new_text."; + +const ADD_NEWLINE: &str = "Quill ends every file you write or edit with exactly one newline, so never add or remove one yourself."; + +const REPLY: &str = "# Your reply + +The user sees any text you write between tool calls, so keep it to one short sentence about what you will do next, or write nothing; do your thinking silently, never in the reply. When you finish, reply with a short summary of what you changed and how you checked it. The user sees every tool call and diff, so do not paste file contents back. Use Markdown, with fenced code blocks for code. Be direct and concise."; + +pub struct PromptContext<'a> { + pub model: &'a str, + pub root: Option<&'a Path>, + pub tools: &'a [Box<dyn Tool>], + pub shell: Shell, + pub personal: &'a str, + pub instructions: &'a [String], + pub final_newline: FinalNewline, +} + +fn os_name() -> &'static str { + match std::env::consts::OS { + "windows" => "Windows", + "macos" => "macOS", + "linux" => "Linux", + other => other, + } +} + +pub fn system_prompt(ctx: &PromptContext<'_>) -> String { + let mut sections = vec![format!( + "You are Quill, the coding agent built into Quill Code. You run on the user's own {} computer and are powered by the {} model. If the user asks which model you are, say so.", + os_name(), + ctx.model + )]; + match ctx.root { + Some(root) => { + sections.push(format!( + "# Your workspace\n\nYou work in the project folder {}. Paths you give to tools are relative to it. You change files only inside it; reading elsewhere may need the user's OK. Use your tools to do the work rather than describing what you would do.", + root.display() + )); + let lines: Vec<String> = ctx.tools.iter().map(|tool| format!("- {}", tool.spec().guide)).collect(); + let newline = match ctx.final_newline { + FinalNewline::Keep => KEEP_NEWLINE, + FinalNewline::Remove => REMOVE_NEWLINE, + FinalNewline::Add => ADD_NEWLINE, + }; + sections.push(format!("# Your tools\n\n{}\n\n{newline}", lines.join("\n"))); + let shell = match ctx.shell { + Shell::PowerShell | Shell::Pwsh => POWERSHELL, + Shell::Cmd => CMD, + Shell::Bash | Shell::Sh => POSIX, + }; + sections.push(format!("{shell}\n\n{COMMAND_RULES}")); + sections.push(WORKFLOW.to_string()); + sections.push(CHECKING.to_string()); + if ctx.tools.iter().any(|tool| tool.spec().toolset == Toolset::Git) { + sections.push(GIT.to_string()); + } + sections.push(REPLY.to_string()); + let project = project_instructions(root, ctx.instructions); + if !project.is_empty() { + sections.push(format!("# Project instructions\n\n{project}")); + } + } + None => sections.push( + "No project is open in this conversation, so you have no tools. Answer from what you know, and when the user wants you to work on their files, suggest running Quill Code in the project folder. Use Markdown, with fenced code blocks for code. Be direct and concise.".into(), + ), + } + let personal = ctx.personal.trim(); + if !personal.is_empty() { + sections.push(format!("# The user's instructions\n\n{personal}")); + } + sections.join("\n\n") +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::options::{Limits, Toolsets}; + use crate::tools::enabled; + + fn prompt(root: Option<&Path>, git: bool, personal: &str) -> String { + let tools = enabled(Toolsets { git }, &Limits::default()); + let instructions = vec!["AGENTS.md".to_string()]; + system_prompt(&PromptContext { + model: "qwen", + root, + tools: &tools, + shell: Shell::PowerShell, + personal, + instructions: &instructions, + final_newline: FinalNewline::Keep, + }) + } + + #[test] + fn quill_is_the_assistant_whatever_the_model() { + let text = prompt(None, false, ""); + assert!(text.starts_with("You are Quill")); + assert!(text.contains("powered by the qwen model")); + assert!(text.contains("no tools")); + } + + #[test] + fn projects_get_tools_shell_and_workflow() { + let dir = std::env::temp_dir(); + let text = prompt(Some(&dir), false, ""); + assert!(text.contains("edit_file") && text.contains("read_file") && text.contains("# How to work")); + assert!(text.contains("# Checking your work")); + assert!(text.contains("Windows PowerShell")); + assert!(text.contains("A file keeps its final newline")); + assert!(!text.contains("open_pull_request")); + assert!(prompt(Some(&dir), true, "").contains("open_pull_request")); + assert!(prompt(None, false, "Use tabs.").ends_with("# The user's instructions\n\nUse tabs.")); + } +} \ No newline at end of file diff --git a/crates/quill-core/src/protocol.rs b/crates/quill-core/src/protocol.rs new file mode 100644 index 0000000..827a178 --- /dev/null +++ b/crates/quill-core/src/protocol.rs @@ -0,0 +1,113 @@ +use quill_providers::{Message, Tokens}; +use serde::{Deserialize, Serialize}; + +use crate::diff::FileDiff; + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +pub enum Category { + Explore, + Edit, + Command, + Plan, + Question, + Git, + Web, + Desktop, + Agent, + Other, +} + +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +pub struct ToolView { + pub id: String, + pub tool: String, + pub category: Category, + pub active: String, + pub done: String, + pub target: String, +} + +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +pub struct Question { + pub question: String, + pub options: Vec<String>, +} + +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +pub struct Approval { + pub title: String, + pub subject: String, + #[serde(default)] + pub diffs: Vec<FileDiff>, + #[serde(default)] + pub similar: Option<String>, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +pub enum Decision { + Approve, + Decline, + AllowSimilar, + AllowTool, + AllowAll, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +pub enum StepStatus { + Pending, + Active, + Done, +} + +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +pub struct PlanStep { + pub text: String, + pub status: StepStatus, +} + +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(tag = "outcome", content = "error", rename_all = "snake_case")] +pub enum Outcome { + Done, + Stopped, + Failed(String), +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(tag = "type", rename_all = "snake_case")] +pub enum Event { + TurnStarted { turn: usize }, + Reasoning { turn: usize, text: String }, + Text { turn: usize, text: String }, + ToolBegin { turn: usize, view: ToolView }, + ToolOutput { turn: usize, id: String, chunk: String }, + ToolEnd { turn: usize, id: String, ok: bool, output: String, diffs: Vec<FileDiff>, image: Option<String> }, + ApprovalRequested { turn: usize, id: String, approval: Approval }, + QuestionAsked { turn: usize, id: String, questions: Vec<Question> }, + PlanUpdated { turn: usize, steps: Vec<PlanStep>, explanation: Option<String> }, + Note { turn: usize, text: String }, + Message { message: Message }, + Compacting, + Compacted { history: Vec<Message> }, + CompactFailed { reason: String }, + Usage { turn: usize, tokens: Tokens }, + TurnFinished { turn: usize, outcome: Outcome }, +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn events_round_trip_as_tagged_json() { + let event = Event::TurnFinished { turn: 2, outcome: Outcome::Failed("boom".into()) }; + let text = serde_json::to_string(&event).unwrap(); + assert!(text.contains("\"type\":\"turn_finished\"") && text.contains("\"outcome\":\"failed\"")); + assert_eq!(serde_json::from_str::<Event>(&text).unwrap(), event); + let message = Event::Message { message: Message::user("hi") }; + assert_eq!(serde_json::from_str::<Event>(&serde_json::to_string(&message).unwrap()).unwrap(), message); + } +} \ No newline at end of file diff --git a/crates/quill-core/src/session.rs b/crates/quill-core/src/session.rs new file mode 100644 index 0000000..2bc5e57 --- /dev/null +++ b/crates/quill-core/src/session.rs @@ -0,0 +1,252 @@ +use std::collections::{HashMap, VecDeque}; +use std::path::PathBuf; +use std::sync::atomic::{AtomicBool, Ordering}; +use std::sync::mpsc::{Receiver, RecvTimeoutError, Sender, channel}; +use std::sync::{Arc, Mutex}; +use std::time::Duration; + +use quill_providers::{Message, Provider, Tuning}; + +use crate::context; +use crate::options::{Limits, Toolsets}; +use crate::policy::{Access, Rule}; +use crate::protocol::{Decision, Event, Outcome}; +use crate::tools; +use crate::turn; + +#[derive(Clone)] +pub struct Summarizer { + pub provider: Arc<dyn Provider>, + pub model: String, + pub tuning: Tuning, +} + +#[derive(Clone)] +pub struct TurnContext { + pub provider: Arc<dyn Provider>, + pub summarizer: Option<Summarizer>, + pub model: String, + pub tuning: Tuning, + pub context_window: Option<u64>, + pub root: Option<PathBuf>, + pub access: Access, + pub toolsets: Toolsets, + pub personal: String, + pub instructions: Vec<String>, + pub limits: Limits, + pub rules: Vec<Rule>, +} + +pub struct Input { + pub text: String, + pub images: Vec<String>, +} + +pub enum Op { + Turn { turn: usize, input: Input, context: TurnContext, cancel: Arc<AtomicBool> }, + Steer(String), + Decide { id: String, decision: Decision }, + Answer { id: String, answers: Vec<String> }, + Compact { context: TurnContext, cancel: Arc<AtomicBool> }, + Shutdown, +} + +#[derive(Clone)] +pub struct SessionHandle { + ops: Sender<Op>, +} + +impl SessionHandle { + pub fn send(&self, op: Op) -> bool { + self.ops.send(op).is_ok() + } +} + +pub(crate) type Sink = Arc<dyn Fn(Event) + Send + Sync>; + +pub fn spawn(history: Vec<Message>, sink: impl Fn(Event) + Send + Sync + 'static) -> SessionHandle { + let (ops, rx) = channel(); + let session = Session { + history, + inbox: Mutex::new(Inbox { + rx, + queue: VecDeque::new(), + steers: Vec::new(), + decisions: HashMap::new(), + answers: HashMap::new(), + closed: false, + }), + sink: Arc::new(sink), + rules: Mutex::new(Vec::new()), + raised: AtomicBool::new(false), + measured: None, + asked_for_git: false, + }; + std::thread::Builder::new().name("quill-session".into()).spawn(move || session.run()).expect("start a session thread"); + SessionHandle { ops } +} + +pub(crate) struct Inbox { + rx: Receiver<Op>, + queue: VecDeque<Op>, + steers: Vec<String>, + decisions: HashMap<String, Decision>, + answers: HashMap<String, Vec<String>>, + closed: bool, +} + +impl Inbox { + fn take(&mut self, op: Op) -> Option<Op> { + match op { + Op::Steer(text) => self.steers.push(text), + Op::Decide { id, decision } => { + self.decisions.insert(id, decision); + } + Op::Answer { id, answers } => { + self.answers.insert(id, answers); + } + Op::Shutdown => self.closed = true, + other => return Some(other), + } + None + } + + fn take_running(&mut self, op: Op) { + if let Some(op) = self.take(op) { + self.queue.push_back(op); + } + } + + pub fn pump(&mut self) { + while let Ok(op) = self.rx.try_recv() { + self.take_running(op); + } + } + + pub fn steers(&mut self) -> Vec<String> { + self.pump(); + std::mem::take(&mut self.steers) + } + + fn wait<T>(&mut self, cancel: &AtomicBool, mut found: impl FnMut(&mut Inbox) -> Option<T>) -> Option<T> { + loop { + if let Some(value) = found(self) { + return Some(value); + } + if self.closed || cancel.load(Ordering::Relaxed) { + return None; + } + match self.rx.recv_timeout(Duration::from_millis(100)) { + Ok(op) => self.take_running(op), + Err(RecvTimeoutError::Timeout) => {} + Err(RecvTimeoutError::Disconnected) => self.closed = true, + } + } + } + + pub fn decision(&mut self, id: &str, cancel: &AtomicBool) -> Decision { + self.wait(cancel, |inbox| inbox.decisions.remove(id)).unwrap_or(Decision::Decline) + } + + pub fn answer(&mut self, id: &str, cancel: &AtomicBool) -> Option<Vec<String>> { + self.wait(cancel, |inbox| inbox.answers.remove(id)) + } + + fn next(&mut self) -> Option<Op> { + if let Some(op) = self.queue.pop_front() { + return Some(op); + } + while !self.closed { + match self.rx.recv() { + Ok(op) => { + if let Some(op) = self.take(op) { + return Some(op); + } + } + Err(_) => return None, + } + } + None + } +} + +pub(crate) struct Session { + pub history: Vec<Message>, + pub inbox: Mutex<Inbox>, + pub sink: Sink, + pub rules: Mutex<Vec<Rule>>, + pub raised: AtomicBool, + pub measured: Option<(u64, usize)>, + pub asked_for_git: bool, +} + +impl Session { + fn run(mut self) { + loop { + let op = self.inbox.lock().expect("inbox lock").next(); + match op { + Some(Op::Turn { turn, input, context, cancel }) => { + self.emit(Event::TurnStarted { turn }); + let outcome = turn::run(&mut self, turn, input, &context, context.provider.as_ref(), &cancel); + let outcome = if cancel.load(Ordering::Relaxed) && outcome == Outcome::Done { Outcome::Stopped } else { outcome }; + self.emit(Event::TurnFinished { turn, outcome }); + } + Some(Op::Compact { context, cancel }) => { + if let Err(reason) = self.compact(&context, &cancel, false) { + self.emit(Event::CompactFailed { reason }); + } + } + Some(_) => {} + None => break, + } + } + } + + pub fn emit(&self, event: Event) { + (self.sink)(event); + } + + pub fn push(&mut self, message: Message) { + self.history.push(message.clone()); + self.emit(Event::Message { message }); + } + + pub fn take_steers(&mut self) -> bool { + let steers = self.inbox.lock().expect("inbox lock").steers(); + let any = !steers.is_empty(); + self.asked_for_git |= steers.iter().any(|text| tools::asks_for_git(text)); + for text in steers { + self.push(Message::user(text)); + } + any + } + + pub fn used(&self, overhead: u64) -> u64 { + match self.measured { + Some((tokens, at)) if at <= self.history.len() => tokens + context::estimate(&self.history[at..]), + _ => context::estimate(&self.history) + overhead, + } + } + + pub fn compact(&mut self, ctx: &TurnContext, cancel: &AtomicBool, mid_turn: bool) -> Result<(), String> { + if self.history.len() < 2 { + return Err("There is nothing to compact yet.".into()); + } + self.emit(Event::Compacting); + let (provider, model, tuning) = match &ctx.summarizer { + Some(other) => (other.provider.as_ref(), &other.model, &other.tuning), + None => (ctx.provider.as_ref(), &ctx.model, &ctx.tuning), + }; + let summary = match context::summarize(provider, model, tuning, ctx.context_window, &self.history, cancel) { + Ok(summary) => summary, + Err(error) => return Err(format!("The conversation could not be summarised: {error}")), + }; + let limit = ctx.context_window.map_or(16_384, context::limit); + let kept = if mid_turn { context::recent(&self.history, limit / 4) } else { self.history.len() }; + let restored = ctx.root.as_deref().map(|root| context::restore(root, &self.history, kept, limit / 6)).unwrap_or_default(); + self.history = context::rebuild(&summary, &self.history, mid_turn, kept, &restored); + self.measured = None; + self.emit(Event::Compacted { history: self.history.clone() }); + Ok(()) + } +} \ No newline at end of file diff --git a/crates/quill-core/src/tools/args.rs b/crates/quill-core/src/tools/args.rs new file mode 100644 index 0000000..33f2356 --- /dev/null +++ b/crates/quill-core/src/tools/args.rs @@ -0,0 +1,65 @@ +use serde_json::{Value, json}; + +pub const PATH: [&str; 6] = ["path", "file_path", "file", "filename", "filepath", "dir"]; +pub const CONTENT: [&str; 6] = ["content", "contents", "text", "file_text", "code", "body"]; +pub const OLD: [&str; 6] = ["old_text", "old_str", "old_string", "old", "search", "find"]; +pub const NEW: [&str; 6] = ["new_text", "new_str", "new_string", "new", "replace", "replacement"]; +pub const COMMAND: [&str; 3] = ["command", "cmd", "script"]; +pub const PATTERN: [&str; 5] = ["pattern", "query", "regex", "text", "q"]; +pub const GLOB: [&str; 3] = ["glob", "include", "file_pattern"]; +pub const MESSAGE: [&str; 3] = ["message", "commit_message", "msg"]; +pub const BRANCH: [&str; 3] = ["branch", "branch_name", "new_branch"]; +pub const TITLE: [&str; 2] = ["title", "pr_title"]; +pub const BODY: [&str; 3] = ["body", "description", "pr_body"]; + +pub fn parse(arguments: &str) -> Value { + let text = arguments.trim(); + if text.is_empty() { + return json!({}); + } + serde_json::from_str(text).unwrap_or_else(|_| json!({ "__invalid": text })) +} + +pub fn invalid(args: &Value) -> Option<&str> { + args.get("__invalid").and_then(Value::as_str) +} + +pub fn text<'a>(args: &'a Value, keys: &[&str]) -> Option<&'a str> { + keys.iter().find_map(|key| args.get(*key).and_then(Value::as_str)) +} + +pub fn trimmed<'a>(args: &'a Value, keys: &[&str]) -> Option<&'a str> { + text(args, keys).map(str::trim).filter(|value| !value.is_empty()) +} + +pub fn number(args: &Value, keys: &[&str]) -> Option<u64> { + keys.iter().find_map(|key| { + let value = args.get(*key)?; + value.as_u64().or_else(|| value.as_str()?.trim().parse().ok()) + }) +} + +pub fn flag(args: &Value, keys: &[&str]) -> bool { + keys.iter().any(|key| args.get(*key).is_some_and(|v| v.as_bool().unwrap_or_else(|| v.as_str() == Some("true")))) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn broken_arguments_are_kept_for_the_error() { + assert_eq!(parse("{\"path\": \"a\"}")["path"], "a"); + assert!(invalid(&parse("{oops")).is_some()); + assert_eq!(parse(""), json!({})); + } + + #[test] + fn lenient_keys_and_values_are_read() { + let args = json!({ "file_path": "a.rs", "start": "4", "replace_all": "true" }); + assert_eq!(text(&args, &PATH), Some("a.rs")); + assert_eq!(number(&args, &["start_line", "start"]), Some(4)); + assert!(flag(&args, &["replace_all"])); + assert!(!flag(&args, &["missing"])); + } +} \ No newline at end of file diff --git a/crates/quill-core/src/tools/editorconfig.rs b/crates/quill-core/src/tools/editorconfig.rs new file mode 100644 index 0000000..4038d46 --- /dev/null +++ b/crates/quill-core/src/tools/editorconfig.rs @@ -0,0 +1,63 @@ +use std::fs; +use std::path::Path; + +use globset::GlobBuilder; + +pub fn final_newline(path: &Path) -> Option<bool> { + for dir in path.ancestors().skip(1) { + let Ok(text) = fs::read_to_string(dir.join(".editorconfig")) else { continue }; + let rel = path.strip_prefix(dir).map(|rel| rel.to_string_lossy().replace('\\', "/")).unwrap_or_default(); + let (value, root) = read(&text, &rel); + if value.is_some() || root { + return value; + } + } + None +} + +fn read(text: &str, rel: &str) -> (Option<bool>, bool) { + let mut root = false; + let mut section = None; + let mut value = None; + for line in text.lines().map(str::trim) { + if line.is_empty() || line.starts_with(['#', ';']) { + continue; + } + if let Some(pattern) = line.strip_prefix('[').and_then(|line| line.strip_suffix(']')) { + section = Some(matches(pattern, rel)); + continue; + } + let Some((key, val)) = line.split_once('=') else { continue }; + let (key, val) = (key.trim().to_ascii_lowercase(), val.trim().to_ascii_lowercase()); + match section { + None if key == "root" => root = val == "true", + Some(true) if key == "insert_final_newline" => value = val.parse().ok(), + _ => {} + } + } + (value, root) +} + +fn matches(pattern: &str, rel: &str) -> bool { + let pattern = match pattern.strip_prefix('/') { + Some(anchored) => anchored.to_string(), + None if pattern.contains('/') => pattern.to_string(), + None => format!("**/{pattern}"), + }; + GlobBuilder::new(&pattern).literal_separator(true).build().is_ok_and(|glob| glob.compile_matcher().is_match(rel)) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn the_nearest_matching_section_decides() { + let text = "root = true\n\n[*]\ninsert_final_newline = true\n\n[*.{md,txt}]\ninsert_final_newline = false\n\n[docs/*.js]\ninsert_final_newline = false"; + assert_eq!(read(text, "src/main.rs"), (Some(true), true)); + assert_eq!(read(text, "notes/a.md"), (Some(false), true)); + assert_eq!(read(text, "docs/a.js"), (Some(false), true)); + assert_eq!(read(text, "src/docs/a.js"), (Some(true), true)); + assert_eq!(read("[*.py]\ninsert_final_newline = true", "a.rs"), (None, false)); + } +} \ No newline at end of file diff --git a/crates/quill-core/src/tools/fs.rs b/crates/quill-core/src/tools/fs.rs new file mode 100644 index 0000000..9ee07a8 --- /dev/null +++ b/crates/quill-core/src/tools/fs.rs @@ -0,0 +1,858 @@ +use std::fs; +use std::path::{Path, PathBuf}; + +use globset::{GlobBuilder, GlobSet, GlobSetBuilder}; +use ignore::WalkBuilder; +use regex::RegexBuilder; +use serde_json::{Value, json}; + +use super::args::{self, CONTENT, GLOB, NEW, OLD, PATH, PATTERN}; +use super::editorconfig; +use super::paths::{display, inside, normalize, resolve}; +use super::{Action, Ctx, Output, Prepared, Spec, Tool, Toolset}; +use crate::diff::{FileDiff, diff_text}; +use crate::options::{FinalNewline, Limits}; +use crate::policy::Effect; +use crate::protocol::Category; + +const MAX_FILE: u64 = 1_000_000; + +const NEWLINE_NOTE: &str = "(the file ends with a newline after the last line)"; + +fn files(dir: &Path, limits: &Limits) -> Vec<PathBuf> { + let ignored = limits.ignored.clone(); + WalkBuilder::new(dir) + .hidden(false) + .require_git(false) + .filter_entry(move |entry| { + let dir = entry.file_type().is_some_and(|t| t.is_dir()); + !(dir && entry.depth() > 0 && ignored.iter().any(|name| entry.file_name().to_string_lossy().eq_ignore_ascii_case(name))) + }) + .sort_by_file_path(|a, b| a.to_string_lossy().to_lowercase().cmp(&b.to_string_lossy().to_lowercase())) + .build() + .filter_map(Result::ok) + .filter(|entry| entry.file_type().is_some_and(|t| t.is_file())) + .map(|entry| entry.into_path()) + .collect() +} + +fn read_text(path: &Path) -> Result<String, String> { + let bytes = fs::read(path).map_err(|e| e.to_string())?; + if bytes.iter().take(8192).any(|b| *b == 0) { + return Err("That is a binary file, so it cannot be shown as text.".into()); + } + Ok(String::from_utf8_lossy(&bytes).into_owned()) +} + +fn locate(root: &Path, rel: &str) -> Result<(PathBuf, Effect), String> { + let path = normalize(root, rel)?; + let effect = if inside(&path, root) { Effect::Read } else { Effect::ReadOutside }; + Ok((path, effect)) +} + +fn scope(root: &Path, args: &Value) -> Result<(PathBuf, Effect, Option<GlobSet>), String> { + let given = args::trimmed(args, &PATH).unwrap_or_default().replace('\\', "/"); + let (path, effect) = locate(root, &given)?; + if path.exists() { + return Ok((path, effect, None)); + } + let missing = || format!("{} does not exist. Leave out \"path\" to search the whole project.", display(root, &path)); + let Some(at) = given.find(['*', '?', '[', '{']) else { return Err(missing()) }; + let split = given[..at].rfind('/').map_or(0, |slash| slash + 1); + let (base, effect) = locate(root, &given[..split])?; + if !base.exists() { + return Err(missing()); + } + Ok((base, effect, Some(glob_set(&given[split..])?))) +} + +fn searched(what: String, args: &Value) -> String { + match args::trimmed(args, &PATH) { + Some(path) => format!("\"{what}\" in {}", path.replace('\\', "/")), + None => what, + } +} + +fn reading(effect: Effect, path: &Path, action: Action) -> Prepared { + match effect { + Effect::Read => Prepared::read(action), + _ => Prepared::new(effect, path.display().to_string(), "Wants to read outside the project", action), + } +} + +fn glob_set(pattern: &str) -> Result<GlobSet, String> { + let mut builder = GlobSetBuilder::new(); + for part in pattern.split(',').map(str::trim).filter(|part| !part.is_empty()) { + let part = part.replace('\\', "/"); + let part = if part.contains(['*', '?', '[', '{']) { part } else { format!("**/*{part}*") }; + let glob = GlobBuilder::new(&part).case_insensitive(true).build().map_err(|e| e.to_string())?; + builder.add(glob); + } + builder.build().map_err(|e| e.to_string()) +} + +fn clip_line(line: &str) -> String { + let trimmed = line.trim(); + if trimmed.chars().count() > 300 { format!("{}…", trimmed.chars().take(300).collect::<String>()) } else { trimmed.to_string() } +} + +pub struct FindFiles; + +const FIND: Spec = Spec { + name: "find_files", + title: "Find files", + summary: "Finds files by name or path pattern.", + aliases: &["glob", "find", "find_file", "file_search", "find_by_name"], + toolset: Toolset::Core, + category: Category::Explore, + active: "Looking for", + done: "Looked for", + parallel: true, + description: "Find files whose path matches a glob pattern such as **/*.rs or src/**/test_*.py, case-insensitive. Separate several patterns with commas.", + guide: "find_files finds files by name or path pattern.", +}; + +impl Tool for FindFiles { + fn spec(&self) -> &'static Spec { + &FIND + } + + fn parameters(&self) -> Value { + json!({ + "type": "object", + "properties": { + "pattern": { "type": "string", "description": "Glob pattern, for example **/*.tsx or *config*." }, + "path": { "type": "string", "description": "Optional folder to search in." } + }, + "required": ["pattern"] + }) + } + + fn target(&self, args: &Value) -> String { + searched(args::trimmed(args, &PATTERN).unwrap_or_default().to_string(), args) + } + + fn prepare(&self, args: &Value, ctx: &Ctx<'_>) -> Result<Prepared, String> { + let pattern = args::trimmed(args, &PATTERN).ok_or("find_files needs a \"pattern\", such as **/*.rs.")?.to_string(); + let set = glob_set(&pattern)?; + let (dir, effect, within) = scope(ctx.root, args)?; + let root = ctx.root.to_path_buf(); + let shown = dir.clone(); + Ok(reading( + effect, + &shown, + Box::new(move |ctx: &Ctx<'_>| { + let mut found = Vec::new(); + let mut extra = 0; + for path in files(&dir, ctx.limits) { + let rel = display(&dir, &path); + if set.is_match(&rel) && within.as_ref().is_none_or(|within| within.is_match(&rel)) { + if found.len() < ctx.limits.max_matches { + found.push(display(&root, &path)); + } else { + extra += 1; + } + } + } + if found.is_empty() { + return Output::ok(format!( + "No files match \"{pattern}\". find_files matches file names and paths; to search inside files, use grep." + )); + } + if extra > 0 { + found.push(format!("... and {extra} more files. Use a narrower pattern.")); + } + Output::ok(found.join("\n")) + }), + )) + } +} + +pub struct Grep; + +const GREP: Spec = Spec { + name: "grep", + title: "Search files", + summary: "Searches file contents for text or a pattern.", + aliases: &["search", "search_files", "find_in_files", "search_code", "rg", "ripgrep", "grep_search"], + toolset: Toolset::Core, + category: Category::Explore, + active: "Searching for", + done: "Searched for", + parallel: true, + description: "Search the contents of every text file for a regular expression, case-insensitive unless case_sensitive is true. Returns path:line: text for each match. Plain text works too.", + guide: "grep searches file contents with a regular expression. Use it to find where something is defined or used.", +}; + +impl Tool for Grep { + fn spec(&self) -> &'static Spec { + &GREP + } + + fn parameters(&self) -> Value { + json!({ + "type": "object", + "properties": { + "pattern": { "type": "string", "description": "Regular expression or plain text to look for." }, + "path": { "type": "string", "description": "Optional folder or file to search in." }, + "glob": { "type": "string", "description": "Optional file filter, for example *.rs." }, + "case_sensitive": { "type": "boolean", "description": "Match letter case exactly. Default false." }, + "context": { "type": "integer", "description": "Lines of context to show around each match, 0 to 5. Default 0." } + }, + "required": ["pattern"] + }) + } + + fn target(&self, args: &Value) -> String { + searched(args::text(args, &PATTERN).unwrap_or_default().to_string(), args) + } + + fn prepare(&self, args: &Value, ctx: &Ctx<'_>) -> Result<Prepared, String> { + let pattern = args::text(args, &PATTERN).filter(|p| !p.trim().is_empty()).ok_or("grep needs a \"pattern\".")?.to_string(); + let case_sensitive = args::flag(args, &["case_sensitive", "match_case"]); + let regex = RegexBuilder::new(&pattern) + .case_insensitive(!case_sensitive) + .build() + .or_else(|_| RegexBuilder::new(®ex::escape(&pattern)).case_insensitive(!case_sensitive).build()) + .map_err(|e| e.to_string())?; + let filter = args::trimmed(args, &GLOB).map(glob_set).transpose()?; + let context = args::number(args, &["context", "context_lines", "-C"]).unwrap_or(0).min(5) as usize; + let (base, effect, within) = scope(ctx.root, args)?; + let root = ctx.root.to_path_buf(); + let shown = base.clone(); + Ok(reading( + effect, + &shown, + Box::new(move |ctx: &Ctx<'_>| { + let candidates = if base.is_file() { vec![base.clone()] } else { files(&base, ctx.limits) }; + let mut out = Vec::new(); + let mut matches = 0; + let mut extra = 0; + for file in candidates { + let rel = display(&base, &file); + if [&filter, &within].into_iter().flatten().any(|set| !set.is_match(&rel)) { + continue; + } + if fs::metadata(&file).map_or(true, |m| m.len() > MAX_FILE) { + continue; + } + let Ok(text) = read_text(&file) else { continue }; + let lines: Vec<&str> = text.lines().collect(); + let rel = display(&root, &file); + let mut printed: Option<usize> = None; + for (index, line) in lines.iter().enumerate() { + if !regex.is_match(line) { + continue; + } + if matches >= ctx.limits.max_matches { + extra += 1; + continue; + } + matches += 1; + let from = index.saturating_sub(context); + let to = (index + context).min(lines.len() - 1); + if context > 0 && printed.is_some_and(|last| from > last + 1) { + out.push("--".to_string()); + } + for (n, text) in lines.iter().enumerate().take(to + 1).skip(from) { + if printed.is_some_and(|last| n <= last) { + continue; + } + let sep = if n == index { ':' } else { '-' }; + out.push(format!("{rel}{sep}{}{sep} {}", n + 1, clip_line(text))); + printed = Some(n); + } + } + } + if out.is_empty() { + return Output::ok(format!("No matches for \"{pattern}\".")); + } + if extra > 0 { + out.push(format!("... and {extra} more matches. Narrow the search with a longer pattern, a path or a glob.")); + } + Output::ok(out.join("\n")) + }), + )) + } +} + +pub struct ReadFile; + +const READ: Spec = Spec { + name: "read_file", + title: "Read files", + summary: "Reads a file, or part of one, with line numbers.", + aliases: &["read", "view", "cat", "open_file", "view_file", "get_file"], + toolset: Toolset::Core, + category: Category::Explore, + active: "Reading", + done: "Read", + parallel: true, + description: "Read a text file with line numbers. Read a file before changing it. In a large file, read only the lines you need with start_line and end_line.", + guide: "read_file reads a file with line numbers. Read a file before you change it, and in a large file read only the lines you need.", +}; + +impl Tool for ReadFile { + fn spec(&self) -> &'static Spec { + &READ + } + + fn parameters(&self) -> Value { + json!({ + "type": "object", + "properties": { + "path": { "type": "string", "description": "File path relative to the project root." }, + "start_line": { "type": "integer", "description": "First line to show, starting at 1." }, + "end_line": { "type": "integer", "description": "Last line to show." } + }, + "required": ["path"] + }) + } + + fn target(&self, args: &Value) -> String { + let path = args::text(args, &PATH).unwrap_or_default().trim().replace('\\', "/"); + match span(args) { + (1, None) => path, + (start, None) => format!("{path} (from line {start})"), + (start, Some(end)) => format!("{path} (lines {start}-{end})"), + } + } + + fn prepare(&self, args: &Value, ctx: &Ctx<'_>) -> Result<Prepared, String> { + let rel = args::trimmed(args, &PATH).ok_or("read_file needs a \"path\".")?; + let (path, effect) = locate(ctx.root, rel)?; + let (start, end) = span(args); + let root = ctx.root.to_path_buf(); + let shown = path.clone(); + Ok(reading(effect, &shown, Box::new(move |ctx: &Ctx<'_>| Output::settle(read(&root, &path, start, end, ctx.limits))))) + } +} + +fn span(args: &Value) -> (usize, Option<usize>) { + let start = args::number(args, &["start_line", "offset", "start", "from", "line"]).unwrap_or(1).max(1) as usize; + let end = args::number(args, &["end_line", "end", "to"]) + .map(|end| end as usize) + .or_else(|| args::number(args, &["limit", "lines", "count"]).map(|n| start + n as usize - 1)); + (start, end) +} + +fn read(root: &Path, path: &Path, start: usize, end: Option<usize>, limits: &Limits) -> Result<String, String> { + if path.is_dir() { + return Err(format!("{} is a folder. Use find_files to see what is in it.", display(root, path))); + } + if !path.is_file() { + return Err(format!("{} does not exist. Use find_files to see what is there.", display(root, path))); + } + let text = read_text(path)?; + let lines: Vec<&str> = text.lines().collect(); + if lines.is_empty() { + return Ok("The file is empty.".into()); + } + if start > lines.len() { + return Err(format!("The file only has {} lines.", lines.len())); + } + let end = end.unwrap_or(lines.len()).min(lines.len()).min(start + limits.max_read_lines - 1).max(start); + let mut out: Vec<String> = (start..=end) + .map(|n| if lines[n - 1].trim().is_empty() { format!("{n:>5}") } else { format!("{n:>5}→{}", lines[n - 1]) }) + .collect(); + if end < lines.len() || start > 1 { + out.push(format!("(showing lines {start}-{end} of {}; pass start_line to read more)", lines.len())); + } + if end == lines.len() && text.ends_with('\n') { + out.push(NEWLINE_NOTE.into()); + } + Ok(out.join("\n")) +} + +struct Change { + path: PathBuf, + after: String, + diff: FileDiff, +} + +fn planned(change: Change, title: &str) -> Prepared { + let summary = |diff: &FileDiff| { + let verb = if diff.created { "Created" } else { "Updated" }; + format!("{verb} {} (+{} -{})", diff.path, diff.added, diff.removed) + }; + let diff = change.diff.clone(); + let mut prepared = Prepared::new( + Effect::Write, + diff.path.clone(), + title, + Box::new(move |_: &Ctx<'_>| match write(&change.path, &change.after) { + Ok(()) => Output { diffs: vec![change.diff.clone()], ..Output::ok(summary(&change.diff)) }, + Err(error) => Output::fail(error), + }), + ); + prepared.approval.diffs = vec![diff]; + prepared +} + +fn write(path: &Path, text: &str) -> Result<(), String> { + if let Some(dir) = path.parent() { + fs::create_dir_all(dir).map_err(|e| e.to_string())?; + } + fs::write(path, text).map_err(|e| e.to_string()) +} + +const NEEDS_NEWLINE: [&str; 3] = [".patch", ".diff", "crontab"]; + +fn needs_newline(path: &Path) -> bool { + let name = path.file_name().unwrap_or_default().to_string_lossy().to_lowercase(); + NEEDS_NEWLINE.iter().any(|end| name.ends_with(end)) || editorconfig::final_newline(path) == Some(true) +} + +fn setting(limits: &Limits, path: &Path) -> Option<bool> { + match limits.final_newline { + FinalNewline::Keep => None, + FinalNewline::Remove => Some(needs_newline(path)), + FinalNewline::Add => Some(true), + } +} + +fn finished(text: String, newline: Option<bool>) -> String { + let Some(newline) = newline else { return text }; + let body = text.trim_end_matches(['\n', '\r']); + let ending = if text.contains("\r\n") { "\r\n" } else { "\n" }; + if newline && !body.is_empty() { format!("{body}{ending}") } else { body.to_string() } +} + +fn target_file(root: &Path, args: &Value, tool: &str) -> Result<(PathBuf, Option<String>), String> { + let rel = args::trimmed(args, &PATH).ok_or(format!("{tool} needs a \"path\"."))?; + let path = resolve(root, rel)?; + if path.is_dir() { + return Err(format!("{} is a folder, not a file.", display(root, &path))); + } + let before = if path.is_file() { Some(read_text(&path)?) } else { None }; + Ok((path, before)) +} + +pub struct WriteFile; + +const WRITE: Spec = Spec { + name: "write_file", + title: "Write files", + summary: "Creates a file or replaces a whole file.", + aliases: &["write", "create_file", "save_file", "create"], + toolset: Toolset::Core, + category: Category::Edit, + active: "Writing", + done: "Wrote", + parallel: false, + description: "Create a file or replace its whole content. Use it for new files; prefer edit_file for changes to existing files.", + guide: "write_file creates a new file or replaces a whole file.", +}; + +impl Tool for WriteFile { + fn spec(&self) -> &'static Spec { + &WRITE + } + + fn parameters(&self) -> Value { + json!({ + "type": "object", + "properties": { + "path": { "type": "string", "description": "File path relative to the project root." }, + "content": { "type": "string", "description": "The complete content of the file." } + }, + "required": ["path", "content"] + }) + } + + fn target(&self, args: &Value) -> String { + args::text(args, &PATH).unwrap_or_default().trim().replace('\\', "/") + } + + fn prepare(&self, args: &Value, ctx: &Ctx<'_>) -> Result<Prepared, String> { + let (path, before) = target_file(ctx.root, args, "write_file")?; + let content = args::text(args, &CONTENT).ok_or("write_file needs \"content\": the complete text of the file.")?; + let newline = setting(ctx.limits, &path).unwrap_or_else(|| match &before { + Some(before) => before.ends_with('\n'), + None => editorconfig::final_newline(&path).unwrap_or(true), + }); + let after = finished(content.to_string(), Some(newline)); + let diff = diff_text(&display(ctx.root, &path), before.as_deref(), &after); + let title = if diff.created { "Wants to create a file" } else { "Wants to rewrite a file" }; + Ok(planned(Change { path, after, diff }, title)) + } +} + +pub struct EditFile; + +const EDIT: Spec = Spec { + name: "edit_file", + title: "Edit files", + summary: "Replaces exact text in a file, one or several places at once.", + aliases: &["edit", "str_replace", "replace_in_file", "apply_edit", "multi_edit", "multiedit"], + toolset: Toolset::Core, + category: Category::Edit, + active: "Editing", + done: "Edited", + parallel: false, + description: "Replace exact text in a file with new_text. old_text must match the file exactly, including spaces, and appear once unless replace_all is true. To add code, set old_text to the line it goes after and new_text to that line followed by the new code.", + guide: "edit_file replaces old_text in a file with new_text; always send both. Copy old_text exactly from read_file output, taking only what comes after the → on each line (the indentation after it is real), with enough surrounding lines to make it unique. To add code, set old_text to the line it goes after and new_text to that same line followed by the new code.", +}; + +impl Tool for EditFile { + fn spec(&self) -> &'static Spec { + &EDIT + } + + fn parameters(&self) -> Value { + json!({ + "type": "object", + "properties": { + "path": { "type": "string", "description": "File path relative to the project root." }, + "old_text": { "type": "string", "description": "Exact text to replace, copied from the file." }, + "new_text": { "type": "string", "description": "Replacement text. Use an empty string to delete." }, + "replace_all": { "type": "boolean", "description": "Replace every occurrence." } + }, + "required": ["path", "old_text", "new_text"] + }) + } + + fn target(&self, args: &Value) -> String { + args::text(args, &PATH).unwrap_or_default().trim().replace('\\', "/") + } + + fn prepare(&self, args: &Value, ctx: &Ctx<'_>) -> Result<Prepared, String> { + let (path, before) = target_file(ctx.root, args, "edit_file")?; + let current = before.as_deref().ok_or(format!("{} does not exist. Use write_file to create it.", display(ctx.root, &path)))?; + let edits = edits(args)?; + let mut after = current.to_string(); + for (index, (old, new, all)) in edits.iter().enumerate() { + after = replace(&after, old, new, *all) + .map_err(|error| if edits.len() > 1 { format!("Edit {}: {error}", index + 1) } else { error })?; + } + let after = finished(after, setting(ctx.limits, &path)); + let diff = diff_text(&display(ctx.root, &path), before.as_deref(), &after); + Ok(planned(Change { path, after, diff }, "Wants to change a file")) + } +} + +fn edits(args: &Value) -> Result<Vec<(String, String, bool)>, String> { + let one = |value: &Value| -> Result<(String, String, bool), String> { + let old = args::text(value, &OLD).ok_or("edit_file needs \"old_text\", copied exactly from the file.")?; + let new = args::text(value, &NEW).ok_or( + "edit_file needs \"new_text\", the text that takes the place of old_text. To add code, set old_text to the line it goes after and new_text to that line followed by the new code. Use an empty string to delete.", + )?; + Ok((old.replace(NEWLINE_NOTE, ""), new.replace(NEWLINE_NOTE, ""), args::flag(value, &["replace_all", "all"]))) + }; + match args.get("edits").and_then(Value::as_array) { + Some(list) if !list.is_empty() => list.iter().map(one).collect(), + _ => Ok(vec![one(args)?]), + } +} + +pub fn replace(current: &str, old: &str, new: &str, all: bool) -> Result<String, String> { + if old.is_empty() { + return Err("old_text is empty. Copy the exact text you want to replace from the file.".into()); + } + let crlf = current.contains("\r\n") && !old.contains("\r\n"); + let (old, new) = if crlf { (old.replace('\n', "\r\n"), new.replace('\n', "\r\n")) } else { (old.to_string(), new.to_string()) }; + match current.matches(old.as_str()).count() { + 0 => loose_replace(current, &old, &new).ok_or_else(|| { + "old_text was not found in the file. Read the file again and copy the text exactly, including indentation.".into() + }), + 1 => Ok(current.replacen(old.as_str(), &new, 1)), + _ if all => Ok(current.replace(old.as_str(), &new)), + n => Err(format!("old_text appears {n} times. Include more surrounding lines so it is unique, or set replace_all.")), + } +} + +fn without_numbers(text: &str) -> String { + let lines: Vec<&str> = text.lines().collect(); + let numbered: Vec<Option<(usize, &str)>> = lines + .iter() + .map(|line| { + let trimmed = line.trim_start(); + let digits = trimmed.chars().take_while(char::is_ascii_digit).count(); + let number = trimmed[..digits].parse().ok()?; + let rest = &trimmed[digits..]; + let body = rest.strip_prefix(" ").or_else(|| rest.strip_prefix('\t')).or_else(|| rest.strip_prefix('→')); + match body { + Some(body) => Some((number, body)), + None if rest.trim().is_empty() => Some((number, "")), + None => None, + } + }) + .collect(); + let consecutive = numbered.windows(2).all(|pair| matches!(pair, [Some((a, _)), Some((b, _))] if b == &(a + 1))); + if lines.is_empty() || numbered.iter().any(Option::is_none) || !consecutive { + return text.to_string(); + } + numbered.into_iter().flatten().map(|(_, body)| body).collect::<Vec<_>>().join("\n") +} + +fn indent(line: &str) -> usize { + line.len() - line.trim_start().len() +} + +fn shallowest<'a>(rows: &[&'a str]) -> Option<&'a str> { + rows.iter().copied().filter(|line| !line.trim().is_empty()).min_by_key(|line| indent(line)) +} + +fn reindent(text: &str, gave: usize, have: &str) -> String { + let lines: Vec<String> = text + .lines() + .map(|line| if line.trim().is_empty() { String::new() } else { format!("{have}{}", &line[indent(line).min(gave)..]) }) + .collect(); + lines.join("\n") +} + +fn loose_replace(current: &str, old: &str, new: &str) -> Option<String> { + let old = without_numbers(old.trim_matches(['\r', '\n'])); + let new = without_numbers(new.trim_matches(['\r', '\n'])); + let wanted: Vec<&str> = old.lines().collect(); + let lines: Vec<&str> = current.lines().collect(); + if wanted.is_empty() || wanted.len() > lines.len() { + return None; + } + for pass in 0..2 { + let same = |a: &str, b: &str| if pass == 0 { a.trim_end() == b.trim_end() } else { a.trim() == b.trim() }; + let hits: Vec<usize> = + (0..=lines.len() - wanted.len()).filter(|at| wanted.iter().enumerate().all(|(k, want)| same(lines[at + k], want))).collect(); + if let [at] = hits.as_slice() { + let sep = if current.contains("\r\n") { "\r\n" } else { "\n" }; + let new = match (shallowest(&wanted), shallowest(&lines[*at..at + wanted.len()])) { + (Some(gave), Some(have)) if pass == 1 => reindent(&new, indent(gave), &have[..indent(have)]), + _ => new.clone(), + }; + let mut out: Vec<&str> = lines[..*at].to_vec(); + out.extend(new.lines()); + out.extend(&lines[at + wanted.len()..]); + let mut text = out.join(sep); + if current.ends_with('\n') && !text.is_empty() { + text.push_str(sep); + } + return Some(text); + } + if hits.len() > 1 { + return None; + } + } + None +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::protocol::{PlanStep, Question}; + use crate::tools::Host; + use std::sync::atomic::AtomicBool; + + struct Quiet; + + impl Host for Quiet { + fn output(&self, _: &str) {} + fn plan(&self, _: Vec<PlanStep>, _: Option<String>) {} + fn ask(&self, _: &[Question]) -> Option<Vec<String>> { + None + } + } + + fn temp_root(name: &str) -> PathBuf { + let dir = std::env::temp_dir().join(format!("quill-tools-{name}-{}", std::process::id())); + let _ = fs::remove_dir_all(&dir); + fs::create_dir_all(&dir).unwrap(); + dir + } + + fn run(tool: &dyn Tool, root: &Path, args: Value) -> Result<Output, String> { + run_with(tool, root, args, &Limits::default()) + } + + fn run_with(tool: &dyn Tool, root: &Path, args: Value, limits: &Limits) -> Result<Output, String> { + let cancel = AtomicBool::new(false); + let ctx = Ctx { root, limits, cancel: &cancel, host: &Quiet }; + let prepared = tool.prepare(&args, &ctx)?; + Ok((prepared.action)(&ctx)) + } + + #[test] + fn edits_need_a_unique_match() { + assert_eq!(replace("a b a", "b", "c", false).unwrap(), "a c a"); + assert!(replace("a b a", "a", "c", false).unwrap_err().contains("2 times")); + assert_eq!(replace("a b a", "a", "c", true).unwrap(), "c b c"); + assert!(replace("x", "y", "z", false).is_err()); + assert_eq!(replace("one\r\ntwo\r\n", "one\ntwo", "1\n2", false).unwrap(), "1\r\n2\r\n"); + } + + #[test] + fn small_model_mistakes_still_edit() { + let file = "def greet(name):\n return \"Hello \" + name\n\nprint(greet(\"world\"))\n"; + let spaces = "def greet(name):\n return \"Hello \" + name\n \nprint(greet(\"world\"))"; + let fixed = replace(file, spaces, "def greet(name):\n return \"Hi \" + name\n\nprint(greet(\"world\"))", false).unwrap(); + assert_eq!(fixed, "def greet(name):\n return \"Hi \" + name\n\nprint(greet(\"world\"))\n"); + let numbered = " 1 def greet(name):\n 2 return \"Hello \" + name"; + let fixed = replace(file, numbered, "def greet(person):\n return \"Hello \" + person", false).unwrap(); + assert!(fixed.starts_with("def greet(person):\n return \"Hello \" + person\n\n")); + let indented = " def greet(name):\n return \"Hello \" + name"; + assert!(replace(file, indented, "x", false).unwrap().starts_with("x\n")); + assert!(replace("a\nb\na\nb\n", "a \nb", "c", false).is_err()); + } + + #[test] + fn loose_matches_keep_the_file_indentation() { + let file = + "class Greeter:\n def greet(self, name):\n return \"Hello \" + name\n\n def bye(self):\n return \"Bye\"\n"; + let old = "def greet(self, name):\n return \"Hello \" + name"; + let new = "def greet(self, name, loud=False):\n text = \"Hello \" + name\n return text.upper() if loud else text"; + let fixed = replace(file, old, new, false).unwrap(); + assert_eq!( + fixed, + "class Greeter:\n def greet(self, name, loud=False):\n text = \"Hello \" + name\n return text.upper() if loud else text\n\n def bye(self):\n return \"Bye\"\n" + ); + let tabs = "fn main() {\n\tlet a = 1;\n\tprintln!(\"{a}\");\n}\n"; + let fixed = replace(tabs, "let a = 1;\nprintln!(\"{a}\");", "let a = 2;\nprintln!(\"{a}\");", false).unwrap(); + assert_eq!(fixed, "fn main() {\n\tlet a = 2;\n\tprintln!(\"{a}\");\n}\n"); + let doc = "/**\n * Counts words.\n */\nexport function count(text) {\n return text.split(' ').length;\n}\n"; + let old = "* Counts words.\n*/\nexport function count(text) {\n return text.split(' ').length;"; + let new = "* Counts words.\n*/\nexport function count(text) {\n return text.split(/\\s+/).length;"; + let fixed = replace(doc, old, new, false).unwrap(); + assert!(fixed.contains("\nexport function count(text) {\n return text.split(/\\s+/).length;\n}"), "{fixed}"); + } + + #[test] + fn empty_lines_show_no_trailing_spaces() { + let root = temp_root("blank"); + fs::write(root.join("a.txt"), "one\n\ntwo\n").unwrap(); + let text = run(&ReadFile, &root, json!({ "path": "a.txt" })).unwrap().text; + assert!(text.lines().nth(1) == Some(" 2"), "{text:?}"); + fs::remove_dir_all(&root).unwrap(); + } + + #[test] + fn read_targets_name_the_lines_asked_for() { + assert_eq!(ReadFile.target(&json!({ "path": "src\\a.rs" })), "src/a.rs"); + assert_eq!(ReadFile.target(&json!({ "path": "a.rs", "start_line": 260, "end_line": 294 })), "a.rs (lines 260-294)"); + assert_eq!(ReadFile.target(&json!({ "path": "a.rs", "start_line": 260 })), "a.rs (from line 260)"); + assert_eq!(ReadFile.target(&json!({ "path": "a.rs", "offset": 5, "limit": 3 })), "a.rs (lines 5-7)"); + } + + #[test] + fn files_are_written_edited_read_and_searched() { + let root = temp_root("write"); + let created = run(&WriteFile, &root, json!({ "path": "src/a.txt", "content": "hi\n" })).unwrap(); + assert!(created.ok && created.diffs[0].created); + let edited = run(&EditFile, &root, json!({ "file_path": "src/a.txt", "old_str": "hi", "new_str": "hello" })).unwrap(); + assert_eq!((edited.diffs[0].added, edited.diffs[0].removed), (1, 1)); + assert_eq!(fs::read_to_string(root.join("src/a.txt")).unwrap(), "hello\n"); + assert!(run(&ReadFile, &root, json!({ "path": "src/a.txt" })).unwrap().text.contains(" 1→hello")); + assert!(run(&Grep, &root, json!({ "pattern": "HELLO" })).unwrap().text.contains("src/a.txt:1: hello")); + assert!(run(&FindFiles, &root, json!({ "pattern": "**/*.txt" })).unwrap().text.contains("src/a.txt")); + fs::remove_dir_all(&root).unwrap(); + } + + #[test] + fn globs_given_as_the_path_filter_the_search() { + let root = temp_root("globpath"); + fs::create_dir_all(root.join("source")).unwrap(); + fs::write(root.join("source/Note.hx"), "var rating = \"sick\";").unwrap(); + fs::write(root.join("notes.txt"), "sick").unwrap(); + let found = run(&Grep, &root, json!({ "pattern": "sick", "path": "**/*.hx" })).unwrap().text; + assert_eq!(found, "source/Note.hx:1: var rating = \"sick\";"); + let named = run(&FindFiles, &root, json!({ "pattern": "*Note*", "path": "source/**" })).unwrap().text; + assert_eq!(named, "source/Note.hx"); + assert_eq!(run(&FindFiles, &root, json!({ "pattern": "note", "path": "source" })).unwrap().text, "source/Note.hx"); + assert!(run(&Grep, &root, json!({ "pattern": "sick", "path": "src" })).unwrap_err().contains("src does not exist")); + assert_eq!(Grep.target(&json!({ "pattern": "sick", "path": "source\\" })), "\"sick\" in source/"); + fs::remove_dir_all(&root).unwrap(); + } + + #[test] + fn edits_without_new_text_explain_how_to_insert() { + let root = temp_root("nonew"); + fs::write(root.join("a.txt"), "one\n").unwrap(); + let error = run(&EditFile, &root, json!({ "path": "a.txt", "old_text": "one" })).unwrap_err(); + assert!(error.contains("To add code"), "{error}"); + fs::remove_dir_all(&root).unwrap(); + } + + #[test] + fn several_edits_apply_together_or_not_at_all() { + let root = temp_root("multi"); + fs::write(root.join("a.txt"), "one\ntwo\nthree\n").unwrap(); + let edits = json!({ "path": "a.txt", "edits": [ + { "old_text": "one", "new_text": "1" }, + { "old_text": "three", "new_text": "3" } + ]}); + assert!(run(&EditFile, &root, edits).unwrap().ok); + assert_eq!(fs::read_to_string(root.join("a.txt")).unwrap(), "1\ntwo\n3\n"); + let broken = json!({ "path": "a.txt", "edits": [ + { "old_text": "two", "new_text": "2" }, + { "old_text": "missing", "new_text": "x" } + ]}); + assert!(run(&EditFile, &root, broken).unwrap_err().starts_with("Edit 2:")); + assert_eq!(fs::read_to_string(root.join("a.txt")).unwrap(), "1\ntwo\n3\n"); + fs::remove_dir_all(&root).unwrap(); + } + + #[test] + fn files_keep_their_final_newline_unless_an_edit_changes_it() { + let root = temp_root("keep"); + let read = |name: &str| fs::read_to_string(root.join(name)).unwrap(); + fs::write(root.join("a.js"), "module.exports = {\n run() {\n go();\n },\n};\n").unwrap(); + assert!(run(&EditFile, &root, json!({ "path": "a.js", "old_text": "go();", "new_text": "stop();" })).unwrap().ok); + assert_eq!(read("a.js"), "module.exports = {\n run() {\n stop();\n },\n};\n"); + let copied = format!(" }},\n}};\n{NEWLINE_NOTE}"); + assert!(run(&EditFile, &root, json!({ "path": "a.js", "old_text": copied, "new_text": " },\n};" })).unwrap().ok); + assert_eq!(read("a.js"), "module.exports = {\n run() {\n stop();\n },\n};"); + fs::write(root.join("b.txt"), "old").unwrap(); + run(&WriteFile, &root, json!({ "path": "b.txt", "content": "new\n" })).unwrap(); + assert_eq!(read("b.txt"), "new"); + run(&WriteFile, &root, json!({ "path": "c.txt", "content": "new" })).unwrap(); + assert_eq!(read("c.txt"), "new\n"); + fs::write(root.join(".editorconfig"), "root = true\n[*.md]\ninsert_final_newline = false").unwrap(); + run(&WriteFile, &root, json!({ "path": "d.md", "content": "new\n" })).unwrap(); + assert_eq!(read("d.md"), "new"); + fs::remove_dir_all(&root).unwrap(); + } + + #[test] + fn the_setting_can_remove_or_add_it() { + let root = temp_root("newline"); + let read = |name: &str| fs::read_to_string(root.join(name)).unwrap(); + fs::write(root.join("a.js"), "one\r\ntwo\r\n\r\n").unwrap(); + let edit = json!({ "path": "a.js", "old_text": "one", "new_text": "1" }); + let remove = Limits { final_newline: FinalNewline::Remove, ..Limits::default() }; + run_with(&EditFile, &root, edit.clone(), &remove).unwrap(); + assert_eq!(read("a.js"), "1\r\ntwo"); + run_with(&WriteFile, &root, json!({ "path": "fix.patch", "content": "+a" }), &remove).unwrap(); + assert_eq!(read("fix.patch"), "+a\n"); + fs::write(root.join(".editorconfig"), "root = true\n[*.rs]\ninsert_final_newline = true").unwrap(); + run_with(&WriteFile, &root, json!({ "path": "main.rs", "content": "fn main() {}" }), &remove).unwrap(); + assert_eq!(read("main.rs"), "fn main() {}\n"); + let add = Limits { final_newline: FinalNewline::Add, ..Limits::default() }; + run_with(&EditFile, &root, json!({ "path": "a.js", "old_text": "two", "new_text": "2" }), &add).unwrap(); + assert_eq!(read("a.js"), "1\r\n2\r\n"); + fs::remove_dir_all(&root).unwrap(); + } + + #[test] + fn ignored_folders_and_gitignore_are_skipped() { + let root = temp_root("ignore"); + fs::create_dir_all(root.join("node_modules/pkg")).unwrap(); + fs::write(root.join("node_modules/pkg/index.js"), "needle").unwrap(); + fs::write(root.join(".gitignore"), "secret.txt\n").unwrap(); + fs::write(root.join("secret.txt"), "needle").unwrap(); + fs::write(root.join("kept.txt"), "needle").unwrap(); + let found = run(&Grep, &root, json!({ "pattern": "needle" })).unwrap().text; + assert!(found.contains("kept.txt") && !found.contains("node_modules") && !found.contains("secret"), "{found}"); + fs::remove_dir_all(&root).unwrap(); + } + + #[test] + fn reading_outside_the_project_needs_a_check() { + let root = temp_root("outside"); + let limits = Limits::default(); + let cancel = AtomicBool::new(false); + let ctx = Ctx { root: &root, limits: &limits, cancel: &cancel, host: &Quiet }; + let outside = std::env::temp_dir().join("elsewhere.txt"); + let prepared = ReadFile.prepare(&json!({ "path": outside.to_string_lossy() }), &ctx).unwrap(); + assert_eq!(prepared.effect, Effect::ReadOutside); + assert!(WriteFile.prepare(&json!({ "path": outside.to_string_lossy(), "content": "x" }), &ctx).is_err()); + fs::remove_dir_all(&root).unwrap(); + } +} \ No newline at end of file diff --git a/crates/quill-core/src/tools/git.rs b/crates/quill-core/src/tools/git.rs new file mode 100644 index 0000000..04e1684 --- /dev/null +++ b/crates/quill-core/src/tools/git.rs @@ -0,0 +1,156 @@ +use std::path::Path; + +use serde_json::{Value, json}; + +use super::args::{self, BODY, BRANCH, MESSAGE, TITLE}; +use super::{Ctx, Output, Prepared, Spec, Tool, Toolset}; +use crate::policy::Effect; +use crate::protocol::Category; + +pub struct CommitChanges; + +const COMMIT: Spec = Spec { + name: "commit_changes", + title: "Commit", + summary: "Stages every change and commits it, optionally on a new branch.", + aliases: &["commit", "git_commit", "create_commit"], + toolset: Toolset::Git, + category: Category::Git, + active: "Committing", + done: "Committed", + parallel: false, + description: "Stage every change in the project and commit it. Give a branch to commit on a new branch, which a pull request needs when you are on the main branch or not on a branch.", + guide: "commit_changes stages every change and commits it, optionally on a new branch.", +}; + +fn commit(root: &Path, message: &str, branch: Option<&str>) -> Result<String, String> { + if let Some(branch) = branch.filter(|b| quill_git::branch(root).as_deref() != Some(*b)) { + if !quill_git::valid_branch(branch) { + return Err(format!("\"{branch}\" is not a branch name Git accepts.")); + } + quill_git::create_branch(root, branch).or_else(|_| quill_git::switch_branch(root, branch))?; + } + let sha = quill_git::commit_all(root, message)?; + let on = quill_git::branch(root).unwrap_or_else(|| "a detached HEAD".into()); + Ok(format!("Committed {sha} on {on}.")) +} + +impl Tool for CommitChanges { + fn spec(&self) -> &'static Spec { + &COMMIT + } + + fn parameters(&self) -> Value { + json!({ + "type": "object", + "properties": { + "message": { "type": "string", "description": "Commit message: a short summary line, optionally followed by a blank line and details." }, + "branch": { "type": "string", "description": "Optional branch to create or switch to before committing, for example fix-login." } + }, + "required": ["message"] + }) + } + + fn target(&self, args: &Value) -> String { + args::text(args, &MESSAGE).unwrap_or_default().lines().next().unwrap_or_default().trim().to_string() + } + + fn prepare(&self, args: &Value, ctx: &Ctx<'_>) -> Result<Prepared, String> { + let message = args::trimmed(args, &MESSAGE).ok_or("commit_changes needs a \"message\".")?.to_string(); + let branch = args::trimmed(args, &BRANCH).map(str::to_string); + let subject = match &branch { + Some(branch) => format!("{} (on {branch})", self.target(args)), + None => self.target(args), + }; + let root = ctx.root.to_path_buf(); + Ok(Prepared::new( + Effect::Publish, + subject, + "Wants to commit", + Box::new(move |_: &Ctx<'_>| Output::settle(commit(&root, &message, branch.as_deref()))), + )) + } +} + +pub struct OpenPullRequest; + +const PULL: Spec = Spec { + name: "open_pull_request", + title: "Open pull requests", + summary: "Pushes the branch to GitHub and opens a pull request.", + aliases: &["pull_request", "create_pull_request", "open_pr", "create_pr"], + toolset: Toolset::Git, + category: Category::Git, + active: "Opening a pull request", + done: "Opened a pull request", + parallel: false, + description: "Push the current branch to GitHub and open a pull request into the main branch. Commit your work with commit_changes first.", + guide: "open_pull_request pushes the current branch to GitHub and opens a pull request into the main branch.", +}; + +fn open(root: &Path, title: &str, body: &str) -> Result<String, String> { + let branch = quill_git::branch(root).ok_or("Not on a branch. Commit to a new branch with commit_changes first.")?; + let base = quill_git::default_branch(root); + if branch == base { + return Err(format!("You are on {base}, the main branch. Commit the work to a new branch with commit_changes first.")); + } + let remote = + quill_git::remote_url(root).ok_or("This repository has no remote called origin, so there is nowhere to open a pull request.")?; + let slug = quill_git::github_slug(&remote).ok_or("Pull requests can only be opened for repositories on GitHub.")?; + quill_git::push(root, &branch)?; + let url = quill_git::github::create_pull_request(&slug, &branch, &base, title, body)?; + Ok(format!("Pushed {branch} and opened a pull request into {base}: {url}")) +} + +impl Tool for OpenPullRequest { + fn spec(&self) -> &'static Spec { + &PULL + } + + fn parameters(&self) -> Value { + json!({ + "type": "object", + "properties": { + "title": { "type": "string", "description": "Pull request title." }, + "body": { "type": "string", "description": "What changed and why, in Markdown." } + }, + "required": ["title"] + }) + } + + fn target(&self, args: &Value) -> String { + args::text(args, &TITLE).unwrap_or_default().trim().to_string() + } + + fn prepare(&self, args: &Value, ctx: &Ctx<'_>) -> Result<Prepared, String> { + let title = args::trimmed(args, &TITLE).ok_or("open_pull_request needs a \"title\".")?.to_string(); + let body = args::text(args, &BODY).unwrap_or_default().trim().to_string(); + let root = ctx.root.to_path_buf(); + Ok(Prepared::new( + Effect::Publish, + title.clone(), + "Wants to open a pull request", + Box::new(move |_: &Ctx<'_>| Output::settle(open(&root, &title, &body))), + )) + } +} + +pub fn asks_for_git(text: &str) -> bool { + let text = text.to_lowercase(); + let words: Vec<&str> = text.split(|c: char| !c.is_alphanumeric()).collect(); + ["commit", "push", "pull request"].iter().any(|word| text.contains(word)) || words.iter().any(|word| matches!(*word, "pr" | "prs")) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn only_requests_that_mention_git_allow_commits() { + assert!(asks_for_git("Fix the bug and commit it")); + assert!(asks_for_git("open a PR for this")); + assert!(asks_for_git("Push my changes")); + assert!(!asks_for_git("Add a mute command that prints a message")); + assert!(!asks_for_git("improve the parser")); + } +} \ No newline at end of file diff --git a/crates/quill-core/src/tools/mod.rs b/crates/quill-core/src/tools/mod.rs new file mode 100644 index 0000000..c99e73f --- /dev/null +++ b/crates/quill-core/src/tools/mod.rs @@ -0,0 +1,282 @@ +mod args; +mod editorconfig; +mod fs; +mod git; +mod paths; +mod plan; +mod shell; + +use std::path::Path; +use std::sync::atomic::AtomicBool; + +use quill_providers::ToolSpec; +use serde_json::Value; + +use crate::diff::FileDiff; +use crate::options::{Limits, Toolsets}; +use crate::policy::Effect; +use crate::protocol::{Approval, Category, PlanStep, Question, ToolView}; + +pub use args::{invalid, parse as parse_args}; +pub use git::asks_for_git; +pub use shell::{run as run_command, shell_command}; + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Toolset { + Core, + Git, +} + +pub struct Spec { + pub name: &'static str, + pub title: &'static str, + pub summary: &'static str, + pub aliases: &'static [&'static str], + pub toolset: Toolset, + pub category: Category, + pub active: &'static str, + pub done: &'static str, + pub parallel: bool, + pub description: &'static str, + pub guide: &'static str, +} + +pub trait Host: Sync { + fn output(&self, chunk: &str); + fn plan(&self, steps: Vec<PlanStep>, explanation: Option<String>); + fn ask(&self, questions: &[Question]) -> Option<Vec<String>>; +} + +pub struct Ctx<'a> { + pub root: &'a Path, + pub limits: &'a Limits, + pub cancel: &'a AtomicBool, + pub host: &'a dyn Host, +} + +#[derive(Debug, Clone, PartialEq)] +pub struct Output { + pub ok: bool, + pub text: String, + pub diffs: Vec<FileDiff>, + pub image: Option<String>, +} + +impl Output { + pub fn ok(text: impl Into<String>) -> Output { + Output { ok: true, text: text.into(), diffs: Vec::new(), image: None } + } + + pub fn fail(text: impl Into<String>) -> Output { + Output { ok: false, text: text.into(), diffs: Vec::new(), image: None } + } + + pub fn settle(result: Result<String, String>) -> Output { + match result { + Ok(text) => Output::ok(text), + Err(error) => Output::fail(error), + } + } +} + +pub type Action = Box<dyn FnOnce(&Ctx<'_>) -> Output + Send>; + +pub struct Prepared { + pub effect: Effect, + pub subject: String, + pub approval: Approval, + pub action: Action, +} + +impl Prepared { + pub fn new(effect: Effect, subject: impl Into<String>, title: &str, action: Action) -> Prepared { + let subject = subject.into(); + Prepared { + effect, + approval: Approval { title: title.into(), subject: subject.clone(), diffs: Vec::new(), similar: None }, + subject, + action, + } + } + + pub fn read(action: Action) -> Prepared { + Prepared::new(Effect::Read, "", "", action) + } +} + +pub trait Tool: Send + Sync { + fn spec(&self) -> &'static Spec; + fn parameters(&self) -> Value; + fn target(&self, args: &Value) -> String; + fn prepare(&self, args: &Value, ctx: &Ctx<'_>) -> Result<Prepared, String>; +} + +pub fn all() -> Vec<Box<dyn Tool>> { + vec![ + Box::new(fs::FindFiles), + Box::new(fs::Grep), + Box::new(fs::ReadFile), + Box::new(fs::WriteFile), + Box::new(fs::EditFile), + Box::new(shell::ShellTool), + Box::new(plan::UpdatePlan), + Box::new(plan::AskUser), + Box::new(git::CommitChanges), + Box::new(git::OpenPullRequest), + ] +} + +pub fn enabled(toolsets: Toolsets, limits: &Limits) -> Vec<Box<dyn Tool>> { + all() + .into_iter() + .filter(|tool| { + let spec = tool.spec(); + let on = match spec.toolset { + Toolset::Core => true, + Toolset::Git => toolsets.git, + }; + on && !limits.disabled_tools.iter().any(|name| name == spec.name) + }) + .collect() +} + +fn normalize(name: &str) -> String { + name.trim().to_ascii_lowercase().replace(['-', ' '], "_") +} + +pub fn find<'a>(tools: &'a [Box<dyn Tool>], name: &str) -> Option<&'a dyn Tool> { + let name = normalize(name); + let name = name.rsplit('.').next().unwrap_or(&name); + tools.iter().map(|tool| tool.as_ref()).find(|tool| { + let spec = tool.spec(); + spec.name == name || spec.aliases.contains(&name) + }) +} + +pub fn spec_for(tool: &dyn Tool) -> ToolSpec { + let spec = tool.spec(); + ToolSpec { name: spec.name.into(), description: spec.description.into(), parameters: tool.parameters() } +} + +pub fn view(tool: &dyn Tool, id: &str, args: &Value) -> ToolView { + let spec = tool.spec(); + ToolView { + id: id.into(), + tool: spec.name.into(), + category: spec.category, + active: spec.active.into(), + done: spec.done.into(), + target: tool.target(args), + } +} + +pub fn unknown_view(id: &str, name: &str) -> ToolView { + ToolView { + id: id.into(), + tool: name.into(), + category: Category::Other, + active: "Calling".into(), + done: "Called".into(), + target: name.into(), + } +} + +pub fn title(name: &str) -> String { + all().iter().find(|tool| tool.spec().name == name).map_or_else(|| name.replace('_', " "), |tool| tool.spec().title.to_string()) +} + +pub(crate) fn file_of(name: &str, arguments: &str) -> Option<(String, bool)> { + let tools = all(); + let spec = find(&tools, name)?.spec(); + let changed = match spec.category { + Category::Edit => true, + _ if spec.name == "read_file" => false, + _ => return None, + }; + let path = args::trimmed(&args::parse(arguments), &args::PATH)?.replace('\\', "/"); + Some((path, changed)) +} + +pub(crate) fn plan_of(name: &str, arguments: &str) -> Option<Vec<PlanStep>> { + let tools = all(); + (find(&tools, name)?.spec().name == "update_plan").then(|| plan::steps(&args::parse(arguments))) +} + +pub fn names(tools: &[Box<dyn Tool>]) -> String { + tools.iter().map(|tool| tool.spec().name).collect::<Vec<_>>().join(", ") +} + +pub fn legacy(kind: &str) -> ToolView { + let name = match kind { + "List" => "list_dir", + "Read" => "read_file", + "Search" => "grep", + "Write" => "write_file", + "Edit" => "edit_file", + "Run" => "shell", + "Commit" => "commit_changes", + "PullRequest" => "open_pull_request", + other => other, + }; + if let Some((tool, category, active, done)) = RETIRED.iter().find(|(tool, ..)| *tool == name) { + return ToolView { + id: String::new(), + tool: tool.to_string(), + category: *category, + active: active.to_string(), + done: done.to_string(), + target: String::new(), + }; + } + match all().iter().find(|tool| tool.spec().name == name) { + Some(tool) => view(tool.as_ref(), "", &Value::Null), + None => unknown_view("", name), + } +} + +const RETIRED: [(&str, Category, &str, &str); 2] = + [("list_dir", Category::Explore, "Looking through", "Looked through"), ("apply_patch", Category::Edit, "Patching", "Patched")]; + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn names_and_aliases_resolve() { + let tools = all(); + assert_eq!(find(&tools, "bash").map(|t| t.spec().name), Some("shell")); + assert_eq!(find(&tools, "str_replace").map(|t| t.spec().name), Some("edit_file")); + assert_eq!(find(&tools, "Read-File").map(|t| t.spec().name), Some("read_file")); + assert_eq!(find(&tools, "functions.grep").map(|t| t.spec().name), Some("grep")); + assert!(find(&tools, "teleport").is_none()); + } + + #[test] + fn toolsets_and_disabled_tools_filter_the_list() { + let without_git = enabled(Toolsets { git: false }, &Limits::default()); + assert!(find(&without_git, "commit_changes").is_none()); + let limits = Limits { disabled_tools: vec!["shell".into()], ..Limits::default() }; + assert!(find(&enabled(Toolsets::default(), &limits), "shell").is_none()); + } + + #[test] + fn every_name_and_alias_is_unique() { + let tools = all(); + let mut seen = Vec::new(); + for tool in &tools { + for name in std::iter::once(&tool.spec().name).chain(tool.spec().aliases) { + assert!(!seen.contains(name), "{name} appears twice"); + seen.push(*name); + } + } + } + + #[test] + fn old_tool_kinds_map_to_new_tools() { + assert_eq!(legacy("Run").tool, "shell"); + assert_eq!(legacy("Search").category, Category::Explore); + assert_eq!(legacy("List").category, Category::Explore); + assert_eq!(legacy("apply_patch").category, Category::Edit); + assert_eq!(legacy("Mystery").category, Category::Other); + } +} \ No newline at end of file diff --git a/crates/quill-core/src/tools/paths.rs b/crates/quill-core/src/tools/paths.rs new file mode 100644 index 0000000..021fa57 --- /dev/null +++ b/crates/quill-core/src/tools/paths.rs @@ -0,0 +1,73 @@ +use std::path::{Component, Path, PathBuf}; + +pub fn normalize(root: &Path, rel: &str) -> Result<PathBuf, String> { + let rel = rel.trim().trim_matches('"'); + let candidate = Path::new(rel); + let joined = if candidate.is_absolute() { candidate.to_path_buf() } else { root.join(candidate) }; + let mut out = PathBuf::new(); + for component in joined.components() { + match component { + Component::ParentDir => { + if !out.pop() { + return Err(outside()); + } + } + Component::CurDir => {} + other => out.push(other), + } + } + Ok(out) +} + +pub fn inside(path: &Path, root: &Path) -> bool { + let path = path.to_string_lossy().to_lowercase().replace('/', "\\"); + let root = root.to_string_lossy().to_lowercase().replace('/', "\\"); + let root = root.trim_end_matches('\\'); + path == root || path.starts_with(&format!("{root}\\")) +} + +pub fn resolve(root: &Path, rel: &str) -> Result<PathBuf, String> { + let path = normalize(root, rel)?; + if inside(&path, root) { Ok(path) } else { Err(outside()) } +} + +fn outside() -> String { + "That path is outside the project. Use a path relative to the project root, such as \"src/main.rs\".".into() +} + +pub fn display(root: &Path, path: &Path) -> String { + path.strip_prefix(root).map(|rel| rel.to_string_lossy().replace('\\', "/")).unwrap_or_else(|_| path.to_string_lossy().into_owned()) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn paths_cannot_leave_the_project() { + let (root, elsewhere, sibling) = if cfg!(windows) { + (r"C:\work\proj", r"C:\Windows\System32", r"C:\work\project2\a.txt") + } else { + ("/work/proj", "/etc", "/work/project2/a.txt") + }; + let root = PathBuf::from(root); + assert!(resolve(&root, "src/main.rs").is_ok()); + assert!(resolve(&root, "../other").is_err()); + assert!(resolve(&root, elsewhere).is_err()); + assert!(resolve(&root, sibling).is_err()); + assert!(normalize(&root, elsewhere).is_ok()); + } + + #[cfg(windows)] + #[test] + fn drive_letters_match_case_insensitively() { + let root = PathBuf::from(r"C:\work\proj"); + assert!(resolve(&root, r"c:\WORK\proj\a.txt").is_ok()); + } + + #[test] + fn display_paths_are_relative() { + let root = PathBuf::from(r"C:\work\proj"); + assert_eq!(display(&root, &root.join("src").join("a.rs")), "src/a.rs"); + } +} \ No newline at end of file diff --git a/crates/quill-core/src/tools/plan.rs b/crates/quill-core/src/tools/plan.rs new file mode 100644 index 0000000..0c68b7b --- /dev/null +++ b/crates/quill-core/src/tools/plan.rs @@ -0,0 +1,222 @@ +use serde_json::{Value, json}; + +use super::args; +use super::{Ctx, Output, Prepared, Spec, Tool, Toolset}; +use crate::protocol::{Category, PlanStep, Question, StepStatus}; + +pub struct UpdatePlan; + +const PLAN: Spec = Spec { + name: "update_plan", + title: "Plan", + summary: "Shows a checklist of the work and keeps it current.", + aliases: &["plan", "todo", "todo_write", "todowrite", "set_plan", "update_todos", "write_todos"], + toolset: Toolset::Core, + category: Category::Plan, + active: "Planning", + done: "Updated the plan", + parallel: false, + description: "Show the user your plan as a short checklist and keep it current. Send the whole list each time, with each step pending, in_progress or completed. Keep exactly one step in_progress while you work.", + guide: "update_plan shows your plan as a checklist. For work with several steps, set a plan first and update it as each step finishes.", +}; + +fn status(value: &str) -> StepStatus { + match value.trim().to_ascii_lowercase().as_str() { + "in_progress" | "in-progress" | "active" | "doing" | "current" | "started" => StepStatus::Active, + "completed" | "complete" | "done" | "finished" => StepStatus::Done, + _ => StepStatus::Pending, + } +} + +pub(crate) fn steps(args: &Value) -> Vec<PlanStep> { + let list = ["plan", "steps", "items", "todos"].iter().find_map(|key| args.get(*key).and_then(Value::as_array)); + list.map(|items| { + items + .iter() + .filter_map(|item| match item { + Value::String(text) => Some(PlanStep { text: text.trim().to_string(), status: StepStatus::Pending }), + _ => { + let text = args::trimmed(item, &["step", "text", "content", "title", "task"])?; + let state = args::text(item, &["status", "state"]).map_or(StepStatus::Pending, status); + Some(PlanStep { text: text.to_string(), status: state }) + } + }) + .collect() + }) + .unwrap_or_default() +} + +impl Tool for UpdatePlan { + fn spec(&self) -> &'static Spec { + &PLAN + } + + fn parameters(&self) -> Value { + json!({ + "type": "object", + "properties": { + "explanation": { "type": "string", "description": "Optional note on what changed." }, + "plan": { + "type": "array", + "items": { + "type": "object", + "properties": { + "step": { "type": "string" }, + "status": { "type": "string", "enum": ["pending", "in_progress", "completed"] } + }, + "required": ["step", "status"] + } + } + }, + "required": ["plan"] + }) + } + + fn target(&self, args: &Value) -> String { + let steps = steps(args); + let done = steps.iter().filter(|step| step.status == StepStatus::Done).count(); + if steps.is_empty() { String::new() } else { format!("{done} of {} done", steps.len()) } + } + + fn prepare(&self, args: &Value, _: &Ctx<'_>) -> Result<Prepared, String> { + let steps = steps(args); + if steps.is_empty() { + return Err("update_plan needs \"plan\": a list of {step, status} items.".into()); + } + let explanation = args::trimmed(args, &["explanation", "note"]).map(str::to_string); + Ok(Prepared::read(Box::new(move |ctx: &Ctx<'_>| { + ctx.host.plan(steps, explanation); + Output::ok("Plan updated.") + }))) + } +} + +pub struct AskUser; + +const ASK: Spec = Spec { + name: "ask_user", + title: "Ask you", + summary: "Asks you a question and waits for the answer.", + aliases: &["ask", "ask_question", "question", "ask_followup_question", "request_user_input"], + toolset: Toolset::Core, + category: Category::Question, + active: "Asking", + done: "Asked", + parallel: false, + description: "Ask the user one to four questions and wait for the answers. Use it only when you cannot continue without decisions from them. Put each choice in options, never as a list inside the question text: the user picks one with the arrow keys or types their own answer.", + guide: "ask_user asks the user up to four questions at once and waits. Use it only when you are blocked on decisions that are theirs to make, and give each question short options.", +}; + +fn question(value: &Value) -> Option<Question> { + let question = args::trimmed(value, &["question", "text", "prompt"])?.to_string(); + let options = ["options", "choices"] + .iter() + .find_map(|key| value.get(*key).and_then(Value::as_array)) + .map(|items| { + items + .iter() + .filter_map(|item| item.as_str().or_else(|| item["label"].as_str())) + .map(|option| option.trim().to_string()) + .filter(|option| !option.is_empty()) + .collect() + }) + .unwrap_or_default(); + Some(Question { question, options }) +} + +fn questions(args: &Value) -> Vec<Question> { + match args.get("questions").and_then(Value::as_array) { + Some(items) => items.iter().filter_map(question).collect(), + None => question(args).into_iter().collect(), + } +} + +fn reply(question: &Question, answer: &str) -> String { + if question.options.is_empty() || question.options.iter().any(|option| option == answer) { + answer.to_string() + } else { + format!("{answer} (in their own words, not one of the options)") + } +} + +fn answered(questions: &[Question], answers: &[String]) -> String { + if let ([question], [answer]) = (questions, answers) { + return format!("The user answered: {}", reply(question, answer)); + } + let pairs: Vec<String> = questions + .iter() + .zip(answers) + .map(|(question, answer)| format!("{}\nAnswer: {}", question.question, reply(question, answer))) + .collect(); + format!("The user answered:\n\n{}", pairs.join("\n\n")) +} + +impl Tool for AskUser { + fn spec(&self) -> &'static Spec { + &ASK + } + + fn parameters(&self) -> Value { + json!({ + "type": "object", + "properties": { + "questions": { + "type": "array", + "description": "One to four questions, asked together.", + "items": { + "type": "object", + "properties": { + "question": { "type": "string", "description": "The question to ask." }, + "options": { "type": "array", "items": { "type": "string" }, "description": "Two to four short answers to choose from. The user can always type their own." } + }, + "required": ["question"] + } + } + }, + "required": ["questions"] + }) + } + + fn target(&self, args: &Value) -> String { + questions(args).first().map(|question| question.question.clone()).unwrap_or_default() + } + + fn prepare(&self, args: &Value, _: &Ctx<'_>) -> Result<Prepared, String> { + let questions = questions(args); + if questions.is_empty() { + return Err("ask_user needs \"questions\": a list of objects with a \"question\" and its \"options\".".into()); + } + Ok(Prepared::read(Box::new(move |ctx: &Ctx<'_>| match ctx.host.ask(&questions) { + Some(answers) => Output::ok(answered(&questions, &answers)), + None => Output::fail("The user did not answer."), + }))) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn plans_accept_many_shapes() { + let codex = json!({ "plan": [{ "step": "Read", "status": "completed" }, { "step": "Fix", "status": "in_progress" }, { "step": "Test", "status": "pending" }] }); + let parsed = steps(&codex); + assert_eq!(parsed.iter().map(|s| s.status).collect::<Vec<_>>(), vec![StepStatus::Done, StepStatus::Active, StepStatus::Pending]); + assert_eq!(UpdatePlan.target(&codex), "1 of 3 done"); + let loose = json!({ "todos": ["one", { "content": "two", "state": "done" }] }); + assert_eq!(steps(&loose).len(), 2); + assert_eq!(steps(&loose)[1].status, StepStatus::Done); + } + + #[test] + fn questions_come_one_or_several_at_a_time() { + let one = json!({ "question": "Which?", "options": ["a", "b"] }); + assert_eq!(questions(&one), vec![Question { question: "Which?".into(), options: vec!["a".into(), "b".into()] }]); + let several = json!({ "questions": [{ "question": "Name?" }, { "question": "Tests?", "options": [{ "label": "Yes" }] }] }); + let parsed = questions(&several); + assert_eq!((parsed.len(), parsed[1].options.clone()), (2, vec!["Yes".to_string()])); + assert_eq!(answered(&parsed[..1], &["x".into()]), "The user answered: x"); + assert!(answered(&parsed, &["x".into(), "Yes".into()]).contains("Tests?\nAnswer: Yes")); + assert!(answered(&parsed[1..], &["Maybe".into()]).ends_with("Maybe (in their own words, not one of the options)")); + } +} \ No newline at end of file diff --git a/crates/quill-core/src/tools/shell.rs b/crates/quill-core/src/tools/shell.rs new file mode 100644 index 0000000..dcc66d8 --- /dev/null +++ b/crates/quill-core/src/tools/shell.rs @@ -0,0 +1,333 @@ +use std::io::{BufRead, BufReader, Read}; +use std::path::{Path, PathBuf}; +use std::process::{Child, Command, Stdio}; +use std::sync::atomic::{AtomicBool, Ordering}; +use std::sync::mpsc::{RecvTimeoutError, channel}; +use std::time::{Duration, Instant}; + +use serde_json::{Value, json}; + +use super::args::{self, COMMAND}; +use super::paths::resolve; +use super::{Ctx, Output, Prepared, Spec, Tool, Toolset}; +use crate::options::Shell; +use crate::policy::{Effect, discards_work, edits_files}; + +const SCRIPT_EDIT: &str = "Change files with edit_file or write_file, not with shell commands or scripts, so the user sees a diff of every change. Use shell to run programs, builds and tests."; +use crate::protocol::Category; + +pub fn shell_command(shell: Shell, command: &str) -> Command { + let mut cmd = match shell { + Shell::PowerShell | Shell::Pwsh => { + let mut cmd = Command::new(if shell == Shell::Pwsh { "pwsh" } else { "powershell" }); + cmd.args([ + "-NoLogo", + "-NoProfile", + "-NonInteractive", + "-ExecutionPolicy", + "Bypass", + "-Command", + &format!("[Console]::OutputEncoding=[Text.Encoding]::UTF8; $ProgressPreference='SilentlyContinue'; {command}"), + ]); + cmd + } + Shell::Cmd => { + let mut cmd = Command::new("cmd"); + cmd.args(["/D", "/S", "/C", command]); + cmd + } + Shell::Bash => { + let mut cmd = Command::new(git_bash().unwrap_or_else(|| PathBuf::from("bash"))); + cmd.args(["-c", command]); + cmd + } + Shell::Sh => { + let mut cmd = Command::new("sh"); + cmd.args(["-c", command]); + cmd + } + }; + hide_window(&mut cmd); + cmd +} + +fn git_bash() -> Option<PathBuf> { + let program_files = std::env::var_os("ProgramFiles")?; + let path = PathBuf::from(program_files).join("Git").join("bin").join("bash.exe"); + path.is_file().then_some(path) +} + +#[cfg(windows)] +pub(crate) fn hide_window(cmd: &mut Command) { + use std::os::windows::process::CommandExt; + cmd.creation_flags(0x0800_0000); +} + +#[cfg(not(windows))] +pub(crate) fn hide_window(_: &mut Command) {} + +#[cfg(windows)] +fn own_group(_: &mut Command) {} + +#[cfg(not(windows))] +fn own_group(cmd: &mut Command) { + use std::os::unix::process::CommandExt; + cmd.process_group(0); +} + +#[cfg(windows)] +fn stop(child: &mut Child) { + let mut taskkill = Command::new("taskkill"); + taskkill.args(["/T", "/F", "/PID"]).arg(child.id().to_string()).stdin(Stdio::null()).stdout(Stdio::null()).stderr(Stdio::null()); + hide_window(&mut taskkill); + let _ = taskkill.status(); + let _ = child.kill(); +} + +#[cfg(not(windows))] +fn stop(child: &mut Child) { + let group = format!("-{}", child.id()); + let _ = Command::new("kill").args(["-KILL", "--", &group]).stdin(Stdio::null()).stdout(Stdio::null()).stderr(Stdio::null()).status(); + let _ = child.kill(); +} + +fn cap(text: String, max: usize) -> String { + if text.len() <= max { + return text; + } + let mut head = max * 2 / 3; + while !text.is_char_boundary(head) { + head -= 1; + } + let mut tail = text.len() - max / 3; + while !text.is_char_boundary(tail) { + tail += 1; + } + format!("{}\n... [output cut] ...\n{}", &text[..head], &text[tail..]) +} + +fn pump(stream: Option<impl Read + Send + 'static>, tx: std::sync::mpsc::Sender<String>) { + let Some(stream) = stream else { return }; + std::thread::spawn(move || { + let mut reader = BufReader::new(stream); + let mut buf = Vec::new(); + while reader.read_until(b'\n', &mut buf).is_ok_and(|n| n > 0) { + if tx.send(String::from_utf8_lossy(&buf).into_owned()).is_err() { + break; + } + buf.clear(); + } + }); +} + +pub fn run( + shell: Shell, + dir: &Path, + command: &str, + timeout: Duration, + cancel: &AtomicBool, + max_output: usize, + on_chunk: &dyn Fn(&str), +) -> (bool, String) { + let mut cmd = shell_command(shell, command); + own_group(&mut cmd); + let spawned = cmd.current_dir(dir).stdin(Stdio::null()).stdout(Stdio::piped()).stderr(Stdio::piped()).spawn(); + let mut child = match spawned { + Ok(child) => child, + Err(e) => return (false, format!("The command could not start: {e}")), + }; + let (tx, rx) = channel(); + pump(child.stdout.take(), tx.clone()); + pump(child.stderr.take(), tx); + let started = Instant::now(); + let mut text = String::new(); + let mut ended: Option<Instant> = None; + let mut outcome = None; + loop { + match rx.recv_timeout(Duration::from_millis(40)) { + Ok(chunk) => { + on_chunk(&chunk); + if text.len() < max_output * 4 { + text.push_str(&chunk); + } + } + Err(RecvTimeoutError::Disconnected) if outcome.is_some() => break, + Err(_) => {} + } + if outcome.is_none() { + match child.try_wait() { + Ok(Some(status)) => outcome = Some((Some(status), None)), + Ok(None) if cancel.load(Ordering::Relaxed) => { + stop(&mut child); + outcome = Some((None, Some("Stopped by the user.".to_string()))); + } + Ok(None) if started.elapsed() > timeout => { + stop(&mut child); + outcome = Some((None, Some(format!("Stopped after {} seconds without finishing.", timeout.as_secs())))); + } + Ok(None) => {} + Err(e) => outcome = Some((None, Some(e.to_string()))), + } + if outcome.is_some() { + ended = Some(Instant::now()); + } + } else if ended.is_some_and(|at| at.elapsed() > Duration::from_millis(800)) { + break; + } + } + let _ = child.wait(); + let (status, note) = outcome.unwrap_or((None, None)); + let ok = status.is_some_and(|s| s.success()); + let mut report = match (status.and_then(|s| s.code()), note) { + (_, Some(note)) => note, + (Some(code), None) => format!("Exit code {code}"), + (None, None) => "Exited".into(), + }; + let body = text.trim_end(); + if !body.is_empty() { + report.push('\n'); + report.push_str(body); + } + (ok, cap(report, max_output)) +} + +pub struct ShellTool; + +const SHELL: Spec = Spec { + name: "shell", + title: "Run commands", + summary: "Runs commands in the project folder: builds, tests, installs.", + aliases: &[ + "run_command", + "run", + "bash", + "powershell", + "exec", + "execute_command", + "terminal", + "cmd", + "run_shell_command", + "shell_command", + ], + toolset: Toolset::Core, + category: Category::Command, + active: "Running", + done: "Ran", + parallel: false, + description: "Run a shell command in the project folder and return its output and exit code. Use it to build, test, install and run code. The command must finish on its own.", + guide: "shell runs a command in the project folder and returns its output and exit code.", +}; + +impl Tool for ShellTool { + fn spec(&self) -> &'static Spec { + &SHELL + } + + fn parameters(&self) -> Value { + json!({ + "type": "object", + "properties": { + "command": { "type": "string", "description": "The command to run." }, + "timeout_seconds": { "type": "integer", "description": "How long to wait before stopping it. Default 120." }, + "workdir": { "type": "string", "description": "Optional folder to run in, relative to the project root." } + }, + "required": ["command"] + }) + } + + fn target(&self, args: &Value) -> String { + args::text(args, &COMMAND).unwrap_or_default().trim().to_string() + } + + fn prepare(&self, args: &Value, ctx: &Ctx<'_>) -> Result<Prepared, String> { + let command = args::trimmed(args, &COMMAND).ok_or("shell needs a \"command\".")?.to_string(); + if edits_files(&command) { + return Err(SCRIPT_EDIT.into()); + } + let dir = match args::trimmed(args, &["workdir", "cwd", "dir", "directory"]) { + Some(rel) => resolve(ctx.root, rel)?, + None => ctx.root.to_path_buf(), + }; + let limits = ctx.limits; + let seconds = + args::number(args, &["timeout_seconds", "timeout"]).unwrap_or(limits.command_timeout).clamp(1, limits.max_command_timeout); + let title = if discards_work(&command) { "Wants to run a command that throws work away" } else { "Wants to run a command" }; + let mut prepared = Prepared::new( + Effect::Execute, + command.clone(), + title, + Box::new(move |ctx: &Ctx<'_>| { + let (ok, text) = + run(ctx.limits.shell, &dir, &command, Duration::from_secs(seconds), ctx.cancel, ctx.limits.max_output, &|chunk| { + ctx.host.output(chunk) + }); + Output { ok, ..Output::ok(text) } + }), + ); + prepared.approval.similar = similar(&prepared.subject); + Ok(prepared) + } +} + +pub(crate) fn similar(command: &str) -> Option<String> { + let words: Vec<&str> = command.split_whitespace().take_while(|word| !word.starts_with('-')).take(2).collect(); + (!words.is_empty()).then(|| words.join(" ")) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn stopping_ends_the_programs_a_command_started() { + let dir = std::env::temp_dir().join(format!("quill-stop-{}", std::process::id())); + let _ = std::fs::remove_dir_all(&dir); + std::fs::create_dir_all(&dir).unwrap(); + let command = if cfg!(windows) { + "cmd /C \"ping -n 3 127.0.0.1 >nul & echo late > marker.txt\"" + } else { + "sh -c 'sleep 2; echo late > marker.txt'" + }; + let cancel = std::sync::Arc::new(AtomicBool::new(false)); + let stopper = cancel.clone(); + std::thread::spawn(move || { + std::thread::sleep(Duration::from_millis(700)); + stopper.store(true, Ordering::Relaxed); + }); + let (ok, output) = run(Shell::default(), &dir, command, Duration::from_secs(60), &cancel, 30_000, &|_| {}); + assert!(!ok && output.starts_with("Stopped by the user."), "{output}"); + std::thread::sleep(Duration::from_secs(4)); + assert!(!dir.join("marker.txt").exists(), "the started program kept running"); + let _ = std::fs::remove_dir_all(&dir); + } + + #[test] + fn commands_report_exit_codes_and_stream() { + let dir = std::env::temp_dir(); + let cancel = AtomicBool::new(false); + let seen = std::sync::Mutex::new(String::new()); + let (ok, output) = run(Shell::default(), &dir, "echo quill", Duration::from_secs(60), &cancel, 30_000, &|chunk| { + seen.lock().unwrap().push_str(chunk) + }); + assert!(ok, "{output}"); + assert!(output.starts_with("Exit code 0") && output.contains("quill")); + assert!(seen.lock().unwrap().contains("quill")); + let (ok, output) = run(Shell::default(), &dir, "exit 3", Duration::from_secs(60), &cancel, 30_000, &|_| {}); + assert!(!ok); + assert!(output.starts_with("Exit code 3")); + } + + #[test] + fn long_output_keeps_head_and_tail() { + let text = format!("{}{}", "a".repeat(100), "z".repeat(100)); + let capped = cap(text, 60); + assert!(capped.starts_with("aaaa") && capped.ends_with("zzzz") && capped.contains("[output cut]")); + } + + #[test] + fn similar_commands_use_the_leading_words() { + assert_eq!(similar("npm test -- --watch").as_deref(), Some("npm test")); + assert_eq!(similar("cargo build --release").as_deref(), Some("cargo build")); + assert_eq!(similar("ls").as_deref(), Some("ls")); + } +} \ No newline at end of file diff --git a/crates/quill-core/src/turn.rs b/crates/quill-core/src/turn.rs new file mode 100644 index 0000000..2003ebe --- /dev/null +++ b/crates/quill-core/src/turn.rs @@ -0,0 +1,841 @@ +use std::sync::Mutex; +use std::sync::atomic::{AtomicBool, Ordering}; + +use quill_providers::{ChatRequest, Error, Event as Stream, Message, Provider, StopReason, ToolCall, ToolSpec}; +use serde_json::Value; + +use crate::context; +use crate::policy::{self, Access, Effect, Rule, Verdict}; +use crate::prompt::{PromptContext, system_prompt}; +use crate::protocol::{Approval, Category, Decision, Event, Outcome, PlanStep, Question, StepStatus}; +use crate::session::{Inbox, Input, Session, Sink, TurnContext}; +use crate::tools::{self, Ctx, Host, Output, Prepared, Tool, Toolset}; + +pub(crate) const STOPPED: &str = "Stopped by the user before this ran."; +const REFUSED: &str = "The model declined to continue with this request. Try rephrasing it, or pick another model."; + +const MAX_COMPACTIONS: usize = 3; + +const MALFORMED_RETRIES: usize = 2; + +const UNASKED_GIT: &str = "The user has not asked for a commit or a pull request, so leave the changes uncommitted and finish with your reply. The user commits when they choose to."; + +const CRAMPED: &str = "The context filled up three times in this turn, so Quill stopped compacting it. The task may need a model with a bigger context window, or smaller steps."; + +const REPEATED: &str = "This is the same call, with the same arguments, that already failed earlier in this turn. Do not send it again: change the arguments or take a different approach."; + +const UNCHANGED: &str = "Unchanged: this is the same result as the identical call earlier in this turn, and nothing has changed since. Use that earlier result and go on to the next step instead of calling again."; + +const STUCK_AFTER: usize = 3; + +const STUCK: &str = "You keep repeating searches and reads you already made. Stop exploring now: make the change with what you know, or give the user your answer."; + +const NUDGE_AFTER: usize = 6; + +const NUDGE: &str = "You are going in circles: your recent searches and reads returned nothing new. Stop exploring. Using what you already found, do the task now, choosing sensible values yourself where the code does not decide them, then finish with your reply."; + +const NUDGED: &str = "Quill asked the model to stop repeating searches and get on with the task."; + +const PLAN_LEFT: &str = "Your plan still has steps that are not marked completed:"; + +const PLAN_NEXT: &str = "If you finished them, call update_plan to mark them completed, then stop without repeating your summary. If any are not done, do them now, or say in one sentence why you are leaving them."; + +const REMINDED: &str = "Quill reminded the model that its plan had unfinished steps."; + +#[derive(Default)] +struct Reply { + text: String, + reasoning: String, + calls: Vec<ToolCall>, + stop: Option<StopReason>, +} + +#[derive(Default)] +struct PendingCall { + id: Option<String>, + name: String, + arguments: String, +} + +struct CallHost<'a> { + sink: &'a Sink, + inbox: &'a Mutex<Inbox>, + turn: usize, + id: String, + cancel: &'a AtomicBool, +} + +impl Host for CallHost<'_> { + fn output(&self, chunk: &str) { + (self.sink)(Event::ToolOutput { turn: self.turn, id: self.id.clone(), chunk: chunk.to_string() }); + } + + fn plan(&self, steps: Vec<PlanStep>, explanation: Option<String>) { + (self.sink)(Event::PlanUpdated { turn: self.turn, steps, explanation }); + } + + fn ask(&self, questions: &[Question]) -> Option<Vec<String>> { + (self.sink)(Event::QuestionAsked { turn: self.turn, id: self.id.clone(), questions: questions.to_vec() }); + self.inbox.lock().expect("inbox lock").answer(&self.id, self.cancel) + } +} + +pub(crate) fn run( + session: &mut Session, + turn: usize, + input: Input, + ctx: &TurnContext, + provider: &dyn Provider, + cancel: &AtomicBool, +) -> Outcome { + let tools = if ctx.root.is_some() { tools::enabled(ctx.toolsets, &ctx.limits) } else { Vec::new() }; + let system = system_prompt(&PromptContext { + model: &ctx.model, + root: ctx.root.as_deref(), + tools: &tools, + shell: ctx.limits.shell, + personal: &ctx.personal, + instructions: &ctx.instructions, + final_newline: ctx.limits.final_newline, + }); + let specs: Vec<ToolSpec> = tools.iter().map(|tool| tools::spec_for(tool.as_ref())).collect(); + let described: usize = specs.iter().map(|spec| spec.name.len() + spec.description.len() + spec.parameters.to_string().len()).sum(); + let overhead = ((system.len() + described) / 4) as u64; + session.take_steers(); + session.asked_for_git = tools::asks_for_git(&input.text); + session.push(Message::user_with_images(input.text, input.images)); + let start = session.history.len(); + let mut reminded = false; + let mut retried = false; + let mut malformed = 0; + let mut floor = 0; + let mut compactions = 0; + let mut warned = false; + let mut recall = Recall::default(); + let growth = ctx.context_window.map_or(0, |window| context::limit(window) / 4); + for _ in 0..ctx.limits.max_steps { + if cancel.load(Ordering::Relaxed) { + return Outcome::Stopped; + } + session.take_steers(); + let used = session.used(overhead); + if ctx.limits.auto_compact && context::over(used, ctx.context_window) && used.saturating_sub(floor) > growth { + recall.seen.clear(); + if compactions < MAX_COMPACTIONS { + compactions += usize::from(make_room(session, ctx, cancel, overhead)); + } else if !warned { + warned = true; + session.emit(Event::CompactFailed { reason: CRAMPED.into() }); + } + floor = session.used(overhead); + } + let reply = match step(session, turn, ctx, provider, &system, &specs, cancel) { + Ok(reply) => reply, + Err(error) if malformed < MALFORMED_RETRIES && malformed_output(&error.0) => { + malformed += 1; + continue; + } + Err(error) => { + let again = !retried && ctx.limits.auto_compact && compactions < MAX_COMPACTIONS && context::overflowed(&error.0); + if !again || !compact(session, ctx, cancel) { + return Outcome::Failed(error.0); + } + recall.seen.clear(); + compactions += 1; + retried = true; + continue; + } + }; + retried = false; + malformed = 0; + if cancel.load(Ordering::Relaxed) { + if !reply.text.trim().is_empty() || !reply.reasoning.trim().is_empty() { + session.push(Message::assistant(reply.text, Vec::new()).with_reasoning(reply.reasoning)); + } + return Outcome::Stopped; + } + let truncated = reply.stop == Some(StopReason::MaxTokens); + let refused = reply.stop == Some(StopReason::Refusal); + let calls = if truncated || refused { Vec::new() } else { reply.calls }; + let answer_is_reasoning = calls.is_empty() && reply.text.trim().is_empty(); + let content = if answer_is_reasoning { reply.reasoning.trim().to_string() } else { reply.text }; + let thinking = if answer_is_reasoning { String::new() } else { reply.reasoning }; + session.push(Message::assistant(content, calls.clone()).with_reasoning(thinking)); + if calls.is_empty() { + if session.take_steers() { + continue; + } + if refused { + return Outcome::Failed(REFUSED.into()); + } + if truncated { + return Outcome::Failed( + "The reply hit the model's output limit before it finished. Ask it to continue, or raise the limit on the server." + .into(), + ); + } + if !reminded && let Some(open) = unfinished(session.history.get(start..).unwrap_or_default()) { + reminded = true; + session.emit(Event::Note { turn, text: REMINDED.into() }); + session.push(Message::user(format!("{PLAN_LEFT}\n{open}\n\n{PLAN_NEXT}"))); + continue; + } + return Outcome::Done; + } + run_calls(session, turn, ctx, &tools, &calls, cancel, &mut recall); + if recall.repeats >= NUDGE_AFTER && !recall.nudged { + recall.nudged = true; + session.emit(Event::Note { turn, text: NUDGED.into() }); + session.push(Message::user(NUDGE)); + } + } + Outcome::Failed(format!("Stopped after {} steps. Send a follow-up to let the agent continue.", ctx.limits.max_steps)) +} + +fn compact(session: &mut Session, ctx: &TurnContext, cancel: &AtomicBool) -> bool { + match session.compact(ctx, cancel, true) { + Ok(()) => true, + Err(reason) => { + if !cancel.load(Ordering::Relaxed) { + session.emit(Event::CompactFailed { reason }); + } + false + } + } +} + +fn make_room(session: &mut Session, ctx: &TurnContext, cancel: &AtomicBool, overhead: u64) -> bool { + let full = session.history.clone(); + let measured = session.measured; + if context::trim_outputs(&mut session.history, 6) { + session.measured = None; + if !context::over(session.used(overhead), ctx.context_window) { + return false; + } + session.history = full; + session.measured = measured; + } + compact(session, ctx, cancel) +} + +fn malformed_output(error: &str) -> bool { + error.contains("peg-native") || error.contains("Failed to parse input") +} + +fn step( + session: &mut Session, + turn: usize, + ctx: &TurnContext, + provider: &dyn Provider, + system: &str, + specs: &[ToolSpec], + cancel: &AtomicBool, +) -> Result<Reply, Error> { + let mut messages = Vec::with_capacity(session.history.len() + 1); + messages.push(Message::system(system)); + messages.extend(session.history.iter().cloned()); + let request = ChatRequest { + model: ctx.model.clone(), + messages, + reasoning: ctx.tuning.reasoning.clone(), + kwargs: ctx.tuning.kwargs.clone(), + tools: specs.to_vec(), + context: ctx.context_window, + }; + let sink = session.sink.clone(); + let mut reply = Reply::default(); + let mut pending: Vec<PendingCall> = Vec::new(); + let mut used = None; + provider.stream(&request, cancel, &mut |event| match event { + Stream::Reasoning(text) => { + reply.reasoning.push_str(&text); + sink(Event::Reasoning { turn, text }); + } + Stream::Content(text) => { + reply.text.push_str(&text); + sink(Event::Text { turn, text }); + } + Stream::ToolCall { index, id, name, arguments } => { + if pending.len() <= index { + pending.resize_with(index + 1, PendingCall::default); + } + let call = &mut pending[index]; + if id.is_some() { + call.id = id; + } + if let Some(name) = name { + call.name.push_str(&name); + } + call.arguments.push_str(&arguments); + } + Stream::Usage(tokens) => { + used = Some(tokens.total()); + sink(Event::Usage { turn, tokens }); + } + Stream::Stop(reason) => reply.stop = Some(reason), + })?; + if let Some(tokens) = used { + session.measured = Some((tokens, session.history.len() + 1)); + } + let base = session.history.len(); + reply.calls = pending + .into_iter() + .enumerate() + .filter(|(_, call)| !call.name.trim().is_empty()) + .map(|(index, call)| { + ToolCall::new(call.id.filter(|id| !id.is_empty()).unwrap_or_else(|| format!("call_{base}_{index}")), call.name, call.arguments) + }) + .collect(); + Ok(reply) +} + +fn run_calls( + session: &mut Session, + turn: usize, + ctx: &TurnContext, + tools: &[Box<dyn Tool>], + calls: &[ToolCall], + cancel: &AtomicBool, + recall: &mut Recall, +) { + let mut index = 0; + while index < calls.len() { + if cancel.load(Ordering::Relaxed) { + for call in &calls[index..] { + session.push(Message::tool(call.id.clone(), STOPPED)); + } + return; + } + let batch = if ctx.limits.parallel_tools { + calls[index..] + .iter() + .take_while(|call| tools::find(tools, &call.function.name).is_some_and(|tool| tool.spec().parallel)) + .count() + } else { + 0 + }; + let end = index + batch.max(1); + let outputs = run_batch(session, turn, ctx, tools, &calls[index..end], cancel); + for (call, output) in calls[index..end].iter().zip(outputs) { + let explore = tools::find(tools, &call.function.name).is_some_and(|tool| tool.spec().category == Category::Explore); + let text = recall.reply(call, &output, explore); + finish(session, turn, call, output, text); + } + index = end; + } +} + +fn run_batch( + session: &Session, + turn: usize, + ctx: &TurnContext, + tools: &[Box<dyn Tool>], + calls: &[ToolCall], + cancel: &AtomicBool, +) -> Vec<Output> { + let hosts: Vec<CallHost<'_>> = + calls.iter().map(|call| CallHost { sink: &session.sink, inbox: &session.inbox, turn, id: call.id.clone(), cancel }).collect(); + let admitted: Vec<Result<Prepared, Output>> = + calls.iter().zip(&hosts).map(|(call, host)| admit(session, turn, ctx, tools, call, host, cancel)).collect(); + let Some(root) = ctx.root.as_deref() else { + return admitted.into_iter().map(|entry| entry.err().unwrap_or_else(|| Output::fail(STOPPED))).collect(); + }; + let run = |prepared: Prepared, host: &CallHost<'_>| { + if cancel.load(Ordering::Relaxed) { + return Output::fail(STOPPED); + } + let cx = Ctx { root, limits: &ctx.limits, cancel, host }; + (prepared.action)(&cx) + }; + if admitted.len() == 1 { + let entry = admitted.into_iter().next().expect("one call"); + return vec![entry.map_or_else(|output| output, |prepared| run(prepared, &hosts[0]))]; + } + std::thread::scope(|scope| { + let handles: Vec<_> = admitted + .into_iter() + .zip(&hosts) + .map(|(entry, host)| match entry { + Ok(prepared) => Ok(scope.spawn(move || run(prepared, host))), + Err(output) => Err(output), + }) + .collect(); + handles + .into_iter() + .map(|handle| match handle { + Ok(handle) => handle.join().unwrap_or_else(|_| Output::fail("The tool stopped unexpectedly.")), + Err(output) => output, + }) + .collect() + }) +} + +fn admit( + session: &Session, + turn: usize, + ctx: &TurnContext, + tools: &[Box<dyn Tool>], + call: &ToolCall, + host: &CallHost<'_>, + cancel: &AtomicBool, +) -> Result<Prepared, Output> { + let args = tools::parse_args(&call.function.arguments); + let Some(tool) = tools::find(tools, &call.function.name) else { + session.emit(Event::ToolBegin { turn, view: tools::unknown_view(&call.id, &call.function.name) }); + return Err(Output::fail(match ctx.root { + Some(_) => format!("There is no tool called \"{}\". The tools are {}.", call.function.name, tools::names(tools)), + None => "No project is open, so tools are unavailable. Answer directly.".into(), + })); + }; + session.emit(Event::ToolBegin { turn, view: tools::view(tool, &call.id, &args) }); + if let Some(raw) = tools::invalid(&args) { + return Err(Output::fail(format!( + "The arguments were not valid JSON: {raw}. Send a JSON object, for example {{\"path\": \"src/main.rs\"}}." + ))); + } + if tool.spec().toolset == Toolset::Git && !session.asked_for_git { + return Err(Output::fail(UNASKED_GIT)); + } + let root = ctx.root.as_deref().ok_or_else(|| Output::fail("No project is open, so tools are unavailable."))?; + let cx = Ctx { root, limits: &ctx.limits, cancel, host }; + let prepared = tool.prepare(&args, &cx).map_err(Output::fail)?; + let request = + Request { id: &call.id, tool: tool.spec().name, effect: prepared.effect, subject: &prepared.subject, approval: &prepared.approval }; + permit(session, turn, ctx, &request, cancel).map_err(Output::fail)?; + Ok(prepared) +} + +pub(crate) struct Request<'a> { + pub id: &'a str, + pub tool: &'a str, + pub effect: Effect, + pub subject: &'a str, + pub approval: &'a Approval, +} + +pub(crate) fn permit(session: &Session, turn: usize, ctx: &TurnContext, request: &Request<'_>, cancel: &AtomicBool) -> Result<(), String> { + let access = if session.raised.load(Ordering::Relaxed) { Access::Full } else { ctx.access }; + let mut rules: Vec<Rule> = ctx.rules.clone(); + rules.extend(session.rules.lock().expect("rules lock").iter().cloned()); + let name = request.tool; + match policy::verdict(access, request.effect, name, request.subject, &rules, &ctx.limits.safe_commands) { + Verdict::Allow => Ok(()), + Verdict::Deny(reason) => Err(reason), + Verdict::Ask => { + session.emit(Event::ApprovalRequested { turn, id: request.id.to_string(), approval: request.approval.clone() }); + let decision = session.inbox.lock().expect("inbox lock").decision(request.id, cancel); + if cancel.load(Ordering::Relaxed) { + return Err(STOPPED.into()); + } + match decision { + Decision::Decline => Err("The user declined this. Ask what they would like instead.".into()), + Decision::Approve => Ok(()), + Decision::AllowSimilar => { + let pattern = request.approval.similar.clone().unwrap_or_else(|| request.subject.to_string()); + session.rules.lock().expect("rules lock").push(Rule::allow(name, &pattern)); + Ok(()) + } + Decision::AllowTool => { + session.rules.lock().expect("rules lock").push(Rule::allow(name, "")); + Ok(()) + } + Decision::AllowAll => { + session.raised.store(true, Ordering::Relaxed); + Ok(()) + } + } + } + } +} + +fn unfinished(history: &[Message]) -> Option<String> { + let steps = history + .iter() + .rev() + .flat_map(|message| message.tool_calls.iter().rev()) + .find_map(|call| tools::plan_of(&call.function.name, &call.function.arguments))?; + let open: Vec<String> = steps.iter().filter(|step| step.status != StepStatus::Done).map(|step| format!("- {}", step.text)).collect(); + (!open.is_empty()).then(|| open.join("\n")) +} + +#[derive(Default)] +struct Recall { + failed: Vec<(String, Value)>, + seen: Vec<(String, Value, String)>, + repeats: usize, + nudged: bool, +} + +impl Recall { + fn reply(&mut self, call: &ToolCall, output: &Output, explore: bool) -> String { + let (name, args) = (call.function.name.trim().to_ascii_lowercase(), tools::parse_args(&call.function.arguments)); + if !output.ok { + let key = (name, args); + if self.failed.contains(&key) { + return format!("Error: {}\n\n{REPEATED}", output.text); + } + self.failed.push(key); + return format!("Error: {}", output.text); + } + if explore { + if self.seen.iter().any(|(seen, given, text)| *seen == name && *given == args && *text == output.text) { + self.repeats += 1; + return if self.repeats >= STUCK_AFTER { format!("{UNCHANGED}\n\n{STUCK}") } else { UNCHANGED.into() }; + } + self.seen.push((name, args, output.text.clone())); + } + output.text.clone() + } +} + +fn finish(session: &mut Session, turn: usize, call: &ToolCall, output: Output, text: String) { + session.emit(Event::ToolEnd { + turn, + id: call.id.clone(), + ok: output.ok, + output: output.text, + diffs: output.diffs, + image: output.image, + }); + session.push(Message::tool(call.id.clone(), text)); +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::options::{Limits, Toolsets}; + use crate::session::{Op, spawn}; + use quill_providers::{Model, Provider}; + use std::sync::Arc; + use std::sync::mpsc::{Receiver, channel}; + use std::time::Duration; + + struct Script { + replies: Mutex<Vec<Vec<Stream>>>, + seen: Mutex<Vec<ChatRequest>>, + } + + impl Script { + fn new(replies: Vec<Vec<Stream>>) -> Arc<Script> { + Arc::new(Script { replies: Mutex::new(replies.into_iter().rev().collect()), seen: Mutex::new(Vec::new()) }) + } + } + + impl Provider for Script { + fn models(&self) -> Result<Vec<Model>, Error> { + Ok(Vec::new()) + } + + fn stream(&self, request: &ChatRequest, _: &AtomicBool, on_event: &mut dyn FnMut(Stream)) -> Result<(), Error> { + self.seen.lock().unwrap().push(request.clone()); + let reply = self.replies.lock().unwrap().pop().unwrap_or_else(|| vec![Stream::Content("done".into())]); + reply.into_iter().for_each(on_event); + Ok(()) + } + } + + fn call(id: &str, name: &str, arguments: &str) -> Stream { + Stream::ToolCall { index: 0, id: Some(id.into()), name: Some(name.into()), arguments: arguments.into() } + } + + fn context(script: Arc<Script>, root: &std::path::Path, access: Access) -> TurnContext { + TurnContext { + provider: script, + summarizer: None, + model: "test".into(), + tuning: quill_providers::Tuning::default(), + context_window: None, + root: Some(root.to_path_buf()), + access, + toolsets: Toolsets { git: false }, + personal: String::new(), + instructions: Vec::new(), + limits: Limits::default(), + rules: Vec::new(), + } + } + + fn start(root: &std::path::Path) -> (crate::session::SessionHandle, Receiver<Event>) { + let (tx, rx) = channel(); + let _ = std::fs::create_dir_all(root); + let handle = spawn(Vec::new(), move |event| { + let _ = tx.send(event); + }); + (handle, rx) + } + + fn until_finished(rx: &Receiver<Event>, mut each: impl FnMut(&Event)) -> Outcome { + loop { + let event = rx.recv_timeout(Duration::from_secs(20)).expect("an event"); + each(&event); + if let Event::TurnFinished { outcome, .. } = event { + return outcome; + } + } + } + + fn temp(name: &str) -> std::path::PathBuf { + let dir = std::env::temp_dir().join(format!("quill-turn-{name}-{}", std::process::id())); + let _ = std::fs::remove_dir_all(&dir); + dir + } + + #[test] + fn a_turn_runs_tools_and_finishes() { + let root = temp("run"); + let script = Script::new(vec![ + vec![call("c1", "write_file", r#"{"path":"a.txt","content":"hi"}"#), Stream::Stop(StopReason::ToolUse)], + vec![Stream::Content("All done.".into())], + ]); + let (handle, rx) = start(&root); + let input = Input { text: "make a file".into(), images: Vec::new() }; + handle.send(Op::Turn { turn: 0, input, context: context(script.clone(), &root, Access::Full), cancel: Arc::default() }); + let mut ended = Vec::new(); + let outcome = until_finished(&rx, |event| { + if let Event::ToolEnd { ok, diffs, .. } = event { + ended.push((*ok, diffs.len())); + } + }); + assert_eq!(outcome, Outcome::Done); + assert_eq!(ended, vec![(true, 1)]); + assert_eq!(std::fs::read_to_string(root.join("a.txt")).unwrap(), "hi\n"); + let second = &script.seen.lock().unwrap()[1]; + assert_eq!(second.messages.last().unwrap().tool_call_id.as_deref(), Some("c1")); + let _ = std::fs::remove_dir_all(&root); + } + + #[test] + fn approvals_wait_for_a_decision() { + let root = temp("ask"); + let script = + Script::new(vec![vec![call("c1", "write_file", r#"{"path":"b.txt","content":"x"}"#)], vec![Stream::Content("ok".into())]]); + let (handle, rx) = start(&root); + let input = Input { text: "go".into(), images: Vec::new() }; + handle.send(Op::Turn { turn: 0, input, context: context(script.clone(), &root, Access::Supervised), cancel: Arc::default() }); + let decider = handle.clone(); + let outcome = until_finished(&rx, |event| { + if let Event::ApprovalRequested { id, .. } = event { + decider.send(Op::Decide { id: id.clone(), decision: Decision::Decline }); + } + }); + assert_eq!(outcome, Outcome::Done); + assert!(!root.join("b.txt").exists()); + let second = &script.seen.lock().unwrap()[1]; + assert!(second.messages.last().unwrap().content.contains("declined")); + let _ = std::fs::remove_dir_all(&root); + } + + #[test] + fn a_failed_call_sent_again_is_called_out() { + let root = temp("repeat"); + let script = Script::new(vec![ + vec![call("c1", "read_file", r#"{"path":"missing.txt"}"#)], + vec![call("c2", "read_file", r#"{ "path": "missing.txt" }"#)], + vec![Stream::Content("ok".into())], + ]); + let (handle, rx) = start(&root); + let input = Input { text: "go".into(), images: Vec::new() }; + handle.send(Op::Turn { turn: 0, input, context: context(script.clone(), &root, Access::Full), cancel: Arc::default() }); + assert_eq!(until_finished(&rx, |_| {}), Outcome::Done); + let seen = script.seen.lock().unwrap(); + assert!(!seen[1].messages.last().unwrap().content.contains(REPEATED)); + assert!(seen[2].messages.last().unwrap().content.ends_with(REPEATED)); + let _ = std::fs::remove_dir_all(&root); + } + + #[test] + fn reading_the_same_unchanged_lines_again_says_so() { + let root = temp("reread"); + std::fs::create_dir_all(&root).unwrap(); + std::fs::write(root.join("a.txt"), "one\ntwo\n").unwrap(); + let read = r#"{"path":"a.txt","start_line":2}"#; + let script = Script::new(vec![ + vec![call("c1", "read_file", read)], + vec![call("c2", "read_file", read)], + vec![call("c3", "edit_file", r#"{"path":"a.txt","old_text":"two","new_text":"2"}"#)], + vec![call("c4", "read_file", read)], + vec![call("c5", "read_file", read)], + vec![call("c6", "read_file", read)], + vec![Stream::Content("ok".into())], + ]); + let (handle, rx) = start(&root); + let input = Input { text: "go".into(), images: Vec::new() }; + handle.send(Op::Turn { turn: 0, input, context: context(script.clone(), &root, Access::Full), cancel: Arc::default() }); + assert_eq!(until_finished(&rx, |_| {}), Outcome::Done); + let seen = script.seen.lock().unwrap(); + let last = |index: usize| seen[index].messages.last().unwrap().content.clone(); + assert!(last(1).contains("two")); + assert_eq!(last(2), UNCHANGED); + assert!(last(4).contains("2")); + assert_eq!(last(5), UNCHANGED); + assert!(last(6).ends_with(STUCK)); + let _ = std::fs::remove_dir_all(&root); + } + + #[test] + fn going_in_circles_gets_a_nudge_from_the_user_side() { + let root = temp("circles"); + std::fs::create_dir_all(&root).unwrap(); + std::fs::write(root.join("a.txt"), "one\n").unwrap(); + let mut replies: Vec<Vec<Stream>> = (1..=7).map(|n| vec![call(&format!("c{n}"), "read_file", r#"{"path":"a.txt"}"#)]).collect(); + replies.push(vec![Stream::Content("ok".into())]); + let script = Script::new(replies); + let (handle, rx) = start(&root); + let input = Input { text: "go".into(), images: Vec::new() }; + handle.send(Op::Turn { turn: 0, input, context: context(script.clone(), &root, Access::Full), cancel: Arc::default() }); + let mut notes = 0; + assert_eq!(until_finished(&rx, |event| notes += usize::from(matches!(event, Event::Note { .. }))), Outcome::Done); + let seen = script.seen.lock().unwrap(); + assert_eq!(notes, 1); + assert_ne!(seen[6].messages.last().unwrap().content, NUDGE); + assert_eq!(seen[7].messages.last().unwrap().content, NUDGE); + let _ = std::fs::remove_dir_all(&root); + } + + #[test] + fn parser_failures_are_the_ones_retried() { + assert!(malformed_output("The model produced output that does not match the expected peg-native format")); + assert!(malformed_output("Failed to parse input at pos 12")); + assert!(!malformed_output("The server answered 500")); + } + + #[test] + fn reasoning_stays_in_the_history_for_the_next_step() { + let root = temp("reasoning-history"); + let plan = call("c1", "update_plan", r#"{"plan":[{"step":"Write it","status":"in_progress"}]}"#); + let script = Script::new(vec![ + vec![Stream::Reasoning("Plan the parser first.".into()), plan, Stream::Stop(StopReason::ToolUse)], + vec![Stream::Content("Done.".into())], + ]); + let (handle, rx) = start(&root); + let input = Input { text: "write the parser".into(), images: Vec::new() }; + handle.send(Op::Turn { turn: 0, input, context: context(script.clone(), &root, Access::Full), cancel: Arc::default() }); + assert_eq!(until_finished(&rx, |_| {}), Outcome::Done); + let seen = script.seen.lock().unwrap(); + let assistant = seen[1].messages.iter().find(|m| m.role == quill_providers::Role::Assistant).unwrap(); + assert_eq!(assistant.reasoning.as_deref(), Some("Plan the parser first.")); + let _ = std::fs::remove_dir_all(&root); + } + + #[test] + fn an_unfinished_plan_gets_one_reminder() { + let root = temp("plan-left"); + let open = + call("c1", "update_plan", r#"{"plan":[{"step":"Write it","status":"completed"},{"step":"Test it","status":"in_progress"}]}"#); + let done = + call("c2", "update_plan", r#"{"plan":[{"step":"Write it","status":"completed"},{"step":"Test it","status":"completed"}]}"#); + let script = + Script::new(vec![vec![open], vec![Stream::Content("All done.".into())], vec![done], vec![Stream::Content(String::new())]]); + let (handle, rx) = start(&root); + let input = Input { text: "go".into(), images: Vec::new() }; + handle.send(Op::Turn { turn: 0, input, context: context(script.clone(), &root, Access::Full), cancel: Arc::default() }); + let mut notes = 0; + assert_eq!(until_finished(&rx, |event| notes += usize::from(matches!(event, Event::Note { .. }))), Outcome::Done); + let seen = script.seen.lock().unwrap(); + assert_eq!((seen.len(), notes), (4, 1)); + let reminder = &seen[2].messages.last().unwrap().content; + assert!(reminder.starts_with(PLAN_LEFT) && reminder.contains("- Test it") && !reminder.contains("- Write it")); + let _ = std::fs::remove_dir_all(&root); + } + + #[test] + fn a_full_window_is_compacted_and_the_turn_carries_on() { + let root = temp("compact-turn"); + let usage = Stream::Usage(quill_providers::Tokens { prompt: 8000, completion: 10, cache_read: 0 }); + let plan = call("c1", "update_plan", r#"{"plan":[{"step":"Write it","status":"in_progress"}]}"#); + let script = Script::new(vec![ + vec![plan, usage, Stream::Stop(StopReason::ToolUse)], + vec![Stream::Content("They started writing it.".into())], + vec![Stream::Content("finished".into())], + ]); + let (handle, rx) = start(&root); + let input = Input { text: "write the parser".into(), images: Vec::new() }; + let context = TurnContext { context_window: Some(9000), ..context(script.clone(), &root, Access::Full) }; + handle.send(Op::Turn { turn: 0, input, context, cancel: Arc::default() }); + let mut compacted = false; + let outcome = until_finished(&rx, |event| compacted |= matches!(event, Event::Compacted { .. })); + assert_eq!(outcome, Outcome::Done); + assert!(compacted); + let seen = script.seen.lock().unwrap(); + assert_eq!(seen.len(), 4); + assert!(seen[3].messages.last().unwrap().content.starts_with(PLAN_LEFT)); + assert!(seen[1].messages[0].content.starts_with("You are compacting a coding session")); + let resumed = &seen[2].messages; + assert!(resumed[1].content.contains("They started writing it.") && resumed[1].content.contains("write the parser")); + assert!(resumed[1].content.contains("- [in progress] Write it")); + assert_eq!(resumed[2].tool_calls[0].function.name, "update_plan"); + assert_eq!(resumed.last().unwrap().role, quill_providers::Role::Tool); + let _ = std::fs::remove_dir_all(&root); + } + + #[test] + fn steering_adds_a_message_before_the_next_step() { + let root = temp("steer"); + let script = Script::new(vec![vec![call("c1", "ask_user", r#"{"question":"Which one?"}"#)], vec![Stream::Content("ok".into())]]); + let (handle, rx) = start(&root); + let input = Input { text: "go".into(), images: Vec::new() }; + handle.send(Op::Turn { turn: 0, input, context: context(script.clone(), &root, Access::Full), cancel: Arc::default() }); + let answerer = handle.clone(); + let outcome = until_finished(&rx, |event| { + if let Event::QuestionAsked { id, .. } = event { + answerer.send(Op::Steer("use the blue one".into())); + answerer.send(Op::Answer { id: id.clone(), answers: vec!["the second".into()] }); + } + }); + assert_eq!(outcome, Outcome::Done); + let second = &script.seen.lock().unwrap()[1]; + let texts: Vec<&str> = second.messages.iter().map(|m| m.content.as_str()).collect(); + assert!(texts.iter().any(|t| t.contains("The user answered: the second"))); + assert_eq!(texts.last(), Some(&"use the blue one")); + let _ = std::fs::remove_dir_all(&root); + } + + #[test] + fn stopping_answers_every_open_call() { + let root = temp("stop"); + let script = Script::new(vec![vec![ + Stream::ToolCall { index: 0, id: Some("a".into()), name: Some("shell".into()), arguments: r#"{"command":"npm run a"}"#.into() }, + Stream::ToolCall { index: 1, id: Some("b".into()), name: Some("shell".into()), arguments: r#"{"command":"npm run b"}"#.into() }, + ]]); + let (handle, rx) = start(&root); + let cancel = Arc::new(AtomicBool::new(false)); + let input = Input { text: "go".into(), images: Vec::new() }; + handle.send(Op::Turn { turn: 0, input, context: context(script, &root, Access::Supervised), cancel: cancel.clone() }); + let mut tool_messages = 0; + let outcome = until_finished(&rx, |event| match event { + Event::ApprovalRequested { .. } => cancel.store(true, Ordering::Relaxed), + Event::Message { message } if message.tool_call_id.is_some() => tool_messages += 1, + _ => {} + }); + assert_eq!(outcome, Outcome::Stopped); + assert_eq!(tool_messages, 2); + let _ = std::fs::remove_dir_all(&root); + } + + #[test] + fn compacting_with_nothing_earlier_says_why() { + let root = temp("compact"); + let (handle, rx) = start(&root); + handle.send(Op::Compact { context: context(Script::new(Vec::new()), &root, Access::Full), cancel: Arc::default() }); + let event = rx.recv_timeout(Duration::from_secs(20)).expect("an event"); + assert_eq!(event, Event::CompactFailed { reason: "There is nothing to compact yet.".into() }); + let _ = std::fs::remove_dir_all(&root); + } + + #[test] + fn a_reply_only_in_reasoning_becomes_the_answer() { + let root = temp("reasoning"); + let script = Script::new(vec![vec![Stream::Reasoning("The answer is 4.".into())]]); + let (handle, rx) = start(&root); + let input = Input { text: "2+2".into(), images: Vec::new() }; + handle.send(Op::Turn { turn: 0, input, context: context(script, &root, Access::Full), cancel: Arc::default() }); + let mut last = None; + until_finished(&rx, |event| { + if let Event::Message { message } = event { + last = Some(message.content.clone()); + } + }); + assert_eq!(last.as_deref(), Some("The answer is 4.")); + let _ = std::fs::remove_dir_all(&root); + } +} \ No newline at end of file diff --git a/crates/quill-git/Cargo.toml b/crates/quill-git/Cargo.toml new file mode 100644 index 0000000..3aa9dc0 --- /dev/null +++ b/crates/quill-git/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "quill-git" +version.workspace = true +edition.workspace = true +license.workspace = true +authors.workspace = true +publish.workspace = true + +[dependencies] +serde_json = "1" +ureq = { version = "3.4.2", default-features = false, features = ["json", "rustls", "platform-verifier"] } \ No newline at end of file diff --git a/crates/quill-code/src/git.rs b/crates/quill-git/src/git.rs similarity index 97% rename from crates/quill-code/src/git.rs rename to crates/quill-git/src/git.rs index 0615822..7149583 100644 --- a/crates/quill-code/src/git.rs +++ b/crates/quill-git/src/git.rs @@ -220,10 +220,6 @@ pub fn branches(root: &Path) -> Branches { Branches { current, local, remote, unmerged } } -pub fn delete_branch(root: &Path, name: &str) -> Result<(), String> { - run(root, &["branch", "-D", name]).map(|_| ()) -} - pub fn switch_branch(root: &Path, name: &str) -> Result<(), String> { run(root, &["switch", name]).map(|_| ()) } @@ -293,11 +289,6 @@ pub fn add_worktree(project: &Path, path: &Path) -> Result<(), String> { }) } -pub fn remove_worktree(project: &Path, path: &Path) -> Result<(), String> { - let target = path.to_string_lossy().into_owned(); - run(project, &["worktree", "remove", "--force", &target]).map(|_| ()) -} - #[cfg(test)] mod tests { use super::*; diff --git a/crates/quill-code/src/github.rs b/crates/quill-git/src/github.rs similarity index 75% rename from crates/quill-code/src/github.rs rename to crates/quill-git/src/github.rs index d977a6e..bba751f 100644 --- a/crates/quill-code/src/github.rs +++ b/crates/quill-git/src/github.rs @@ -27,6 +27,14 @@ pub enum PullState { Closed, } +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct Release { + pub version: String, + pub title: String, + pub date: String, + pub prerelease: bool, +} + #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct PullRequest { pub number: u64, @@ -58,7 +66,7 @@ fn token(credential: &str) -> Option<&str> { fn agent() -> ureq::Agent { ureq::Agent::config_builder() - .tls_config(TlsConfig::builder().provider(TlsProvider::NativeTls).root_certs(RootCerts::PlatformVerifier).build()) + .tls_config(TlsConfig::builder().provider(TlsProvider::Rustls).root_certs(RootCerts::PlatformVerifier).build()) .timeout_global(Some(Duration::from_secs(30))) .http_status_as_error(false) .build() @@ -121,6 +129,34 @@ fn parse_pull(pull: &Value) -> Option<PullRequest> { Some(PullRequest { number, state }) } +pub fn releases(slug: &str) -> Result<Vec<Release>, String> { + let mut response = agent() + .get(format!("https://api.github.com/repos/{slug}/releases")) + .query("per_page", "100") + .header("Accept", "application/vnd.github+json") + .header("User-Agent", "quill-code") + .call() + .map_err(|e| format!("Could not reach GitHub: {e}"))?; + let status = response.status().as_u16(); + let body: Value = response.body_mut().read_json().unwrap_or_default(); + if status != 200 { + return Err(api_error(&body)); + } + Ok(body.as_array().into_iter().flatten().filter_map(parse_release).collect()) +} + +fn parse_release(release: &Value) -> Option<Release> { + if release["draft"] == true { + return None; + } + Some(Release { + version: release["tag_name"].as_str()?.trim_start_matches('v').to_string(), + title: release["name"].as_str().unwrap_or_default().to_string(), + date: release["published_at"].as_str().unwrap_or_default().chars().take(10).collect(), + prerelease: release["prerelease"] == true, + }) +} + pub fn pull_request(slug: &str, branch: &str) -> Option<PullRequest> { let owner = slug.split('/').next()?; let mut request = agent() @@ -154,6 +190,15 @@ mod tests { assert_eq!(api_error(&Value::Null), "GitHub said: the request failed"); } + #[test] + fn releases_skip_drafts() { + let published = json!({ "tag_name": "v1.0.0", "name": "Quill Code v1.0.0", "published_at": "2026-10-16T09:00:00Z", "draft": false, "prerelease": false }); + let draft = json!({ "tag_name": "v1.1.0", "name": "", "published_at": null, "draft": true }); + let release = parse_release(&published).unwrap(); + assert_eq!((release.version.as_str(), release.date.as_str(), release.prerelease), ("1.0.0", "2026-10-16", false)); + assert!(parse_release(&draft).is_none()); + } + #[test] fn pull_requests_report_their_state() { let open = json!({ "number": 3, "state": "open", "merged_at": null }); diff --git a/crates/quill-git/src/lib.rs b/crates/quill-git/src/lib.rs new file mode 100644 index 0000000..bae9fb2 --- /dev/null +++ b/crates/quill-git/src/lib.rs @@ -0,0 +1,4 @@ +mod git; +pub mod github; + +pub use git::*; \ No newline at end of file diff --git a/crates/quill-llama/src/lib.rs b/crates/quill-llama/src/lib.rs deleted file mode 100644 index 13c615c..0000000 --- a/crates/quill-llama/src/lib.rs +++ /dev/null @@ -1,551 +0,0 @@ -use std::io::{BufRead, BufReader}; -use std::sync::atomic::{AtomicBool, Ordering}; -use std::time::Duration; - -use serde::{Deserialize, Serialize}; -use serde_json::{Value, json}; - -#[derive(Debug, Clone, PartialEq, Eq)] -pub struct Error(pub String); - -impl std::fmt::Display for Error { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.write_str(&self.0) - } -} - -impl std::error::Error for Error {} - -impl From<ureq::Error> for Error { - fn from(error: ureq::Error) -> Self { - let refused = "Nothing is answering at that address. Is llama-server running?"; - match error { - ureq::Error::Io(io) if io.kind() == std::io::ErrorKind::ConnectionRefused => Error(refused.into()), - ureq::Error::ConnectionFailed => Error(refused.into()), - ureq::Error::HostNotFound => Error("That host name could not be found.".into()), - ureq::Error::Timeout(_) => Error("The server took too long to answer.".into()), - ureq::Error::TlsRequired => Error("That address needs https, which quill-code cannot open yet.".into()), - ureq::Error::Io(io) => Error(io.to_string()), - other => Error(other.to_string()), - } - } -} - -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub enum Status { - Loaded, - Loading, - Sleeping, - Unloaded, -} - -impl Status { - fn parse(value: &str) -> Status { - match value { - "loaded" => Status::Loaded, - "loading" => Status::Loading, - "sleeping" => Status::Sleeping, - _ => Status::Unloaded, - } - } - - pub fn label(self) -> &'static str { - match self { - Status::Loaded => "Loaded", - Status::Loading => "Loading", - Status::Sleeping => "Sleeping", - Status::Unloaded => "Not loaded", - } - } -} - -#[derive(Debug, Clone, PartialEq)] -pub struct Model { - pub id: String, - pub status: Status, - pub context: Option<u64>, - pub vision: bool, -} - -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub enum Thinking { - None, - Toggle, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct Props { - pub context: Option<u64>, - pub slots: u32, - pub vision: bool, - pub tools: bool, - pub thinking: Thinking, -} - -#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] -#[serde(rename_all = "lowercase")] -pub enum Role { - System, - User, - Assistant, - Tool, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] -pub struct FunctionCall { - pub name: String, - pub arguments: String, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] -pub struct ToolCall { - pub id: String, - #[serde(rename = "type")] - pub kind: String, - pub function: FunctionCall, -} - -impl ToolCall { - pub fn new(id: impl Into<String>, name: impl Into<String>, arguments: impl Into<String>) -> ToolCall { - ToolCall { id: id.into(), kind: "function".into(), function: FunctionCall { name: name.into(), arguments: arguments.into() } } - } -} - -#[derive(Debug, Clone, PartialEq, Deserialize)] -#[serde(from = "RawMessage")] -pub struct Message { - pub role: Role, - pub content: String, - pub images: Vec<String>, - pub tool_calls: Vec<ToolCall>, - pub tool_call_id: Option<String>, -} - -#[derive(Deserialize)] -struct RawMessage { - role: Role, - #[serde(default)] - content: Value, - #[serde(default)] - tool_calls: Vec<ToolCall>, - #[serde(default)] - tool_call_id: Option<String>, -} - -impl From<RawMessage> for Message { - fn from(raw: RawMessage) -> Message { - let (content, images) = match raw.content { - Value::String(text) => (text, Vec::new()), - Value::Array(parts) => { - let text = parts.iter().filter_map(|p| p["text"].as_str()).collect::<Vec<_>>().join("\n"); - let images = parts.iter().filter_map(|p| p["image_url"]["url"].as_str().map(str::to_string)).collect(); - (text, images) - } - _ => (String::new(), Vec::new()), - }; - Message { role: raw.role, content, images, tool_calls: raw.tool_calls, tool_call_id: raw.tool_call_id } - } -} - -impl Serialize for Message { - fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> { - use serde::ser::SerializeMap; - let mut map = serializer.serialize_map(None)?; - map.serialize_entry("role", &self.role)?; - if self.images.is_empty() { - map.serialize_entry("content", &self.content)?; - } else { - let mut parts = vec![json!({ "type": "text", "text": self.content })]; - parts.extend(self.images.iter().map(|url| json!({ "type": "image_url", "image_url": { "url": url } }))); - map.serialize_entry("content", &parts)?; - } - if !self.tool_calls.is_empty() { - map.serialize_entry("tool_calls", &self.tool_calls)?; - } - if let Some(id) = &self.tool_call_id { - map.serialize_entry("tool_call_id", id)?; - } - map.end() - } -} - -impl Message { - fn new(role: Role, content: impl Into<String>) -> Message { - Message { role, content: content.into(), images: Vec::new(), tool_calls: Vec::new(), tool_call_id: None } - } - - pub fn system(content: impl Into<String>) -> Message { - Message::new(Role::System, content) - } - - pub fn user(content: impl Into<String>) -> Message { - Message::new(Role::User, content) - } - - pub fn user_with_images(content: impl Into<String>, images: Vec<String>) -> Message { - Message { images, ..Message::new(Role::User, content) } - } - - pub fn assistant(content: impl Into<String>, tool_calls: Vec<ToolCall>) -> Message { - Message { tool_calls, ..Message::new(Role::Assistant, content) } - } - - pub fn tool(id: impl Into<String>, content: impl Into<String>) -> Message { - Message { tool_call_id: Some(id.into()), ..Message::new(Role::Tool, content) } - } -} - -#[derive(Debug, Clone, PartialEq)] -pub struct ChatRequest { - pub model: String, - pub messages: Vec<Message>, - pub thinking: Option<bool>, - pub tools: Vec<Value>, -} - -#[derive(Debug, Clone, PartialEq)] -pub enum Event { - Reasoning(String), - Content(String), - ToolCall { index: usize, id: Option<String>, name: Option<String>, arguments: String }, - Usage { prompt: u64, completion: u64 }, -} - -pub struct Server { - base: String, - agent: ureq::Agent, -} - -impl Server { - pub fn new(base_url: &str) -> Server { - let agent = ureq::Agent::config_builder().timeout_connect(Some(Duration::from_secs(5))).http_status_as_error(false).build().into(); - Server { base: normalize_url(base_url), agent } - } - - pub fn base(&self) -> &str { - &self.base - } - - pub fn models(&self) -> Result<Vec<Model>, Error> { - let body = self.get_json("/v1/models")?; - Ok(parse_models(&body)) - } - - pub fn props(&self, model: &str) -> Result<Props, Error> { - let body = self.get_json(&format!("/props?model={}", encode(model)))?; - Ok(parse_props(&body)) - } - - pub fn stream_chat(&self, request: &ChatRequest, cancel: &AtomicBool, mut on_event: impl FnMut(Event)) -> Result<(), Error> { - let response = self.agent.post(format!("{}/v1/chat/completions", self.base)).send_json(chat_body(request))?; - let status = response.status().as_u16(); - let mut body = response.into_body(); - if status >= 400 { - let text = body.read_to_string().unwrap_or_default(); - return Err(Error(error_message(status, &text))); - } - let reader = BufReader::new(body.into_reader()); - for line in reader.lines() { - if cancel.load(Ordering::Relaxed) { - return Ok(()); - } - let line = line.map_err(|e| Error(e.to_string()))?; - match parse_sse_line(&line) { - Some(Sse::Done) => break, - Some(Sse::Error(message)) => return Err(Error(message)), - Some(Sse::Events(events)) => events.into_iter().for_each(&mut on_event), - None => {} - } - } - Ok(()) - } - - fn get_json(&self, path: &str) -> Result<Value, Error> { - let response = self.agent.get(format!("{}{path}", self.base)).call()?; - let status = response.status().as_u16(); - let text = response.into_body().read_to_string()?; - if status >= 400 { - return Err(Error(error_message(status, &text))); - } - serde_json::from_str(&text).map_err(|e| Error(format!("The server sent something that is not JSON: {e}"))) - } -} - -pub fn normalize_url(url: &str) -> String { - let trimmed = url.trim().trim_end_matches('/'); - let trimmed = trimmed.strip_suffix("/v1").unwrap_or(trimmed); - if trimmed.contains("://") { trimmed.to_string() } else { format!("http://{trimmed}") } -} - -fn encode(value: &str) -> String { - value - .bytes() - .map(|b| match b { - b'A'..=b'Z' | b'a'..=b'z' | b'0'..=b'9' | b'-' | b'_' | b'.' | b'~' => (b as char).to_string(), - _ => format!("%{b:02X}"), - }) - .collect() -} - -fn error_message(status: u16, body: &str) -> String { - let detail = serde_json::from_str::<Value>(body) - .ok() - .and_then(|v| v["error"]["message"].as_str().map(str::to_string)) - .unwrap_or_else(|| body.trim().chars().take(300).collect()); - if detail.is_empty() { format!("The server answered {status}.") } else { format!("The server answered {status}: {detail}") } -} - -fn ctx_size_arg(args: &[Value]) -> Option<u64> { - args.windows(2).find(|pair| matches!(pair[0].as_str(), Some("--ctx-size") | Some("-c"))).and_then(|pair| pair[1].as_str()?.parse().ok()) -} - -pub fn parse_models(body: &Value) -> Vec<Model> { - let Some(list) = body["data"].as_array() else { return Vec::new() }; - list.iter() - .filter_map(|entry| { - let id = entry["id"].as_str()?.to_string(); - let status = entry["status"]["value"].as_str().map_or(Status::Loaded, Status::parse); - let args = entry["status"]["args"].as_array().map(Vec::as_slice).unwrap_or(&[]); - let context = entry["meta"]["n_ctx"] - .as_u64() - .or_else(|| ctx_size_arg(args)) - .or_else(|| { - ["max_model_len", "loaded_context_length", "context_length", "max_context_length"] - .iter() - .find_map(|k| entry[k].as_u64()) - }) - .or_else(|| entry["meta"]["n_ctx_train"].as_u64()); - let vision = entry["architecture"]["input_modalities"].as_array().is_some_and(|m| m.iter().any(|v| v == "image")); - Some(Model { id, status, context, vision }) - }) - .collect() -} - -pub fn parse_props(body: &Value) -> Props { - let template = body["chat_template"].as_str().unwrap_or_default(); - let caps = &body["chat_template_caps"]; - let thinking = if template.contains("enable_thinking") { Thinking::Toggle } else { Thinking::None }; - Props { - context: body["default_generation_settings"]["n_ctx"].as_u64().filter(|n| *n > 0), - slots: body["total_slots"].as_u64().unwrap_or(1).max(1) as u32, - vision: body["modalities"]["vision"].as_bool().unwrap_or(false), - tools: caps["supports_tool_calls"].as_bool().unwrap_or(template.contains("tools")), - thinking, - } -} - -pub fn guess_thinking(model: &str) -> Thinking { - let id = model.to_ascii_lowercase(); - let toggles = ["qwen3", "glm-4.5", "glm-4.6", "glm-4.7", "hunyuan"]; - if toggles.iter().any(|family| id.contains(family)) && !id.contains("instruct") { Thinking::Toggle } else { Thinking::None } -} - -pub fn context_label(tokens: u64) -> String { - if tokens >= 1024 && tokens.is_multiple_of(1024) { - format!("{}K", tokens / 1024) - } else if tokens >= 1000 { - format!("{}K", tokens / 1000) - } else { - tokens.to_string() - } -} - -fn chat_body(request: &ChatRequest) -> Value { - let mut body = json!({ - "model": request.model, - "messages": request.messages, - "stream": true, - "stream_options": { "include_usage": true }, - }); - if let Some(thinking) = request.thinking { - body["chat_template_kwargs"] = json!({ "enable_thinking": thinking }); - } - if !request.tools.is_empty() { - body["tools"] = Value::Array(request.tools.clone()); - } - body -} - -#[derive(Debug, PartialEq)] -enum Sse { - Events(Vec<Event>), - Error(String), - Done, -} - -fn parse_sse_line(line: &str) -> Option<Sse> { - let data = line.strip_prefix("data:")?.trim(); - if data == "[DONE]" { - return Some(Sse::Done); - } - let value: Value = serde_json::from_str(data).ok()?; - if let Some(message) = value["error"]["message"].as_str() { - return Some(Sse::Error(message.to_string())); - } - let mut events = Vec::new(); - let delta = &value["choices"][0]["delta"]; - if let Some(text) = delta["reasoning_content"].as_str().filter(|t| !t.is_empty()) { - events.push(Event::Reasoning(text.to_string())); - } - if let Some(text) = delta["content"].as_str().filter(|t| !t.is_empty()) { - events.push(Event::Content(text.to_string())); - } - for (position, call) in delta["tool_calls"].as_array().map(Vec::as_slice).unwrap_or(&[]).iter().enumerate() { - events.push(Event::ToolCall { - index: call["index"].as_u64().map_or(position, |i| i as usize), - id: call["id"].as_str().map(str::to_string), - name: call["function"]["name"].as_str().map(str::to_string), - arguments: call["function"]["arguments"].as_str().unwrap_or_default().to_string(), - }); - } - if let (Some(prompt), Some(completion)) = (value["usage"]["prompt_tokens"].as_u64(), value["usage"]["completion_tokens"].as_u64()) { - events.push(Event::Usage { prompt, completion }); - } - Some(Sse::Events(events)) -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn urls_are_normalized() { - assert_eq!(normalize_url("127.0.0.1:9931/"), "http://127.0.0.1:9931"); - assert_eq!(normalize_url("http://localhost:8080/v1"), "http://localhost:8080"); - assert_eq!(normalize_url(" https://box.lan "), "https://box.lan"); - } - - #[test] - fn router_models_are_parsed() { - let body = json!({ "data": [ - { "id": "qwen3.5-35b-a3b", "status": { "value": "unloaded", "args": ["llama-server.exe", "--ctx-size", "65536"] }, - "architecture": { "input_modalities": ["text", "image"] }, "context_length": 262144 }, - { "id": "qwen3.5-4b", "status": { "value": "sleeping", "args": ["--ctx-size", "131072"] }, - "architecture": { "input_modalities": ["text"] }, "meta": { "n_ctx": 131072, "n_ctx_train": 262144 } }, - { "id": "single" } - ]}); - let models = parse_models(&body); - assert_eq!(models.len(), 3); - assert_eq!(models[0], Model { id: "qwen3.5-35b-a3b".into(), status: Status::Unloaded, context: Some(65536), vision: true }); - assert_eq!(models[1].status, Status::Sleeping); - assert_eq!(models[1].context, Some(131072)); - assert!(!models[1].vision); - assert_eq!(models[2].status, Status::Loaded); - } - - #[test] - fn other_servers_report_their_window() { - let body = json!({ "data": [ - { "id": "vllm", "max_model_len": 32768 }, - { "id": "lmstudio", "loaded_context_length": 8192, "max_context_length": 131072 }, - { "id": "router", "context_length": 200000 } - ]}); - let windows: Vec<Option<u64>> = parse_models(&body).into_iter().map(|m| m.context).collect(); - assert_eq!(windows, vec![Some(32768), Some(8192), Some(200000)]); - } - - #[test] - fn props_detect_thinking_and_tools() { - let body = json!({ - "chat_template": "{%- if enable_thinking is defined and enable_thinking is false %}<think>\n\n</think>{%- endif %}", - "chat_template_caps": { "supports_tool_calls": true }, - "total_slots": 4, - "modalities": { "vision": true }, - "default_generation_settings": { "n_ctx": 131072 } - }); - let props = parse_props(&body); - assert_eq!(props.thinking, Thinking::Toggle); - assert!(props.tools && props.vision); - assert_eq!(props.slots, 4); - assert_eq!(props.context, Some(131072)); - assert_eq!(parse_props(&json!({})).thinking, Thinking::None); - } - - #[test] - fn sse_lines_become_events() { - assert_eq!(parse_sse_line("data: [DONE]"), Some(Sse::Done)); - assert_eq!(parse_sse_line(": keep-alive"), None); - assert_eq!( - parse_sse_line(r#"data: {"choices":[{"delta":{"reasoning_content":"hm"}}]}"#), - Some(Sse::Events(vec![Event::Reasoning("hm".into())])) - ); - assert_eq!( - parse_sse_line(r#"data: {"choices":[{"delta":{"content":"Hi"}}],"usage":{"prompt_tokens":5,"completion_tokens":1}}"#), - Some(Sse::Events(vec![Event::Content("Hi".into()), Event::Usage { prompt: 5, completion: 1 }])) - ); - assert_eq!(parse_sse_line(r#"data: {"error":{"message":"boom"}}"#), Some(Sse::Error("boom".into()))); - } - - #[test] - fn thinking_goes_through_template_kwargs() { - let request = ChatRequest { model: "m".into(), messages: vec![Message::user("hi")], thinking: Some(false), tools: Vec::new() }; - let body = chat_body(&request); - assert_eq!(body["chat_template_kwargs"]["enable_thinking"], false); - assert_eq!(body["messages"][0]["role"], "user"); - assert!(body.get("tools").is_none()); - let plain = chat_body(&ChatRequest { thinking: None, ..request }); - assert!(plain.get("chat_template_kwargs").is_none()); - } - - #[test] - fn tool_calls_stream_in_pieces() { - let first = parse_sse_line( - r#"data: {"choices":[{"delta":{"tool_calls":[{"index":0,"id":"abc","type":"function","function":{"name":"read_file","arguments":"{"}}]}}]}"#, - ); - assert_eq!( - first, - Some(Sse::Events(vec![Event::ToolCall { - index: 0, - id: Some("abc".into()), - name: Some("read_file".into()), - arguments: "{".into() - }])) - ); - let next = parse_sse_line(r#"data: {"choices":[{"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"path\""}}]}}]}"#); - assert_eq!(next, Some(Sse::Events(vec![Event::ToolCall { index: 0, id: None, name: None, arguments: "\"path\"".into() }]))); - } - - #[test] - fn images_become_content_parts_and_back() { - let message = Message::user_with_images("look", vec!["data:image/png;base64,AAAA".into()]); - let value = serde_json::to_value(&message).unwrap(); - assert_eq!(value["content"][0]["text"], "look"); - assert_eq!(value["content"][1]["image_url"]["url"], "data:image/png;base64,AAAA"); - let back: Message = serde_json::from_value(value).unwrap(); - assert_eq!(back, message); - let plain: Message = serde_json::from_value(json!({ "role": "user", "content": "hi" })).unwrap(); - assert_eq!(plain, Message::user("hi")); - } - - #[test] - fn tool_messages_serialize_like_openai() { - let call = ToolCall::new("c1", "read_file", r#"{"path":"a"}"#); - let assistant = serde_json::to_value(Message::assistant("", vec![call])).unwrap(); - assert_eq!(assistant["tool_calls"][0]["type"], "function"); - assert_eq!(assistant["tool_calls"][0]["function"]["name"], "read_file"); - let result = serde_json::to_value(Message::tool("c1", "text")).unwrap(); - assert_eq!(result["role"], "tool"); - assert_eq!(result["tool_call_id"], "c1"); - assert!(serde_json::to_value(Message::user("x")).unwrap().get("tool_calls").is_none()); - } - - #[test] - fn thinking_is_guessed_from_the_name() { - assert_eq!(guess_thinking("qwen3.5-4b"), Thinking::Toggle); - assert_eq!(guess_thinking("Qwen3-30B-A3B-Instruct-2507"), Thinking::None); - assert_eq!(guess_thinking("llama-3.1-8b"), Thinking::None); - } - - #[test] - fn context_sizes_read_naturally() { - assert_eq!(context_label(131072), "128K"); - assert_eq!(context_label(65536), "64K"); - assert_eq!(context_label(32000), "32K"); - assert_eq!(context_label(512), "512"); - } - - #[test] - fn model_names_are_encoded() { - assert_eq!(encode("qwen3.5 4b/q4"), "qwen3.5%204b%2Fq4"); - } -} \ No newline at end of file diff --git a/crates/quill-llama/Cargo.toml b/crates/quill-providers/Cargo.toml similarity index 80% rename from crates/quill-llama/Cargo.toml rename to crates/quill-providers/Cargo.toml index a63c44e..c90ced7 100644 --- a/crates/quill-llama/Cargo.toml +++ b/crates/quill-providers/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "quill-llama" +name = "quill-providers" version.workspace = true edition.workspace = true license.workspace = true @@ -9,4 +9,4 @@ publish.workspace = true [dependencies] serde = { version = "1", features = ["derive"] } serde_json = "1" -ureq = { version = "3.4.2", default-features = false, features = ["json"] } \ No newline at end of file +ureq = { version = "3.4.2", default-features = false, features = ["json", "rustls", "platform-verifier"] } \ No newline at end of file diff --git a/crates/quill-providers/src/lib.rs b/crates/quill-providers/src/lib.rs new file mode 100644 index 0000000..1b41de4 --- /dev/null +++ b/crates/quill-providers/src/lib.rs @@ -0,0 +1,248 @@ +mod lmstudio; +mod message; +mod ollama; +mod openai; +mod profiles; + +use std::sync::atomic::AtomicBool; + +use serde::{Deserialize, Serialize}; +use serde_json::{Map, Value}; + +pub use lmstudio::LmStudio; +pub use message::{FunctionCall, Message, Role, ToolCall}; +pub use ollama::{OLLAMA_CONTEXT, Ollama}; +pub use openai::{OpenAi, normalize_url, parse_models, parse_props}; +pub use profiles::{Control, Profile, Reasoning, Tuning, builtin as builtin_profiles, profile_for}; + +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct Error(pub String); + +impl std::fmt::Display for Error { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(&self.0) + } +} + +impl std::error::Error for Error {} + +impl From<ureq::Error> for Error { + fn from(error: ureq::Error) -> Self { + let refused = "Nothing is answering at that address. Is the model server running?"; + match error { + ureq::Error::Io(io) if io.kind() == std::io::ErrorKind::ConnectionRefused => Error(refused.into()), + ureq::Error::ConnectionFailed => Error(refused.into()), + ureq::Error::HostNotFound => Error("That host name could not be found.".into()), + ureq::Error::Timeout(_) => Error("The server took too long to answer.".into()), + ureq::Error::TlsRequired => Error("That address needs https, which this connection cannot open.".into()), + ureq::Error::Io(io) => Error(io.to_string()), + other => Error(other.to_string()), + } + } +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Status { + Loaded, + Loading, + Sleeping, + Unloaded, +} + +impl Status { + fn parse(value: &str) -> Status { + match value { + "loaded" => Status::Loaded, + "loading" => Status::Loading, + "sleeping" => Status::Sleeping, + _ => Status::Unloaded, + } + } + + pub fn label(self) -> &'static str { + match self { + Status::Loaded => "Loaded", + Status::Loading => "Loading", + Status::Sleeping => "Sleeping", + Status::Unloaded => "Not loaded", + } + } +} + +#[derive(Debug, Clone, PartialEq)] +pub struct Model { + pub id: String, + pub name: Option<String>, + pub status: Status, + pub context: Option<u64>, + pub vision: bool, + pub control: Option<Control>, +} + +impl Model { + pub fn new(id: impl Into<String>) -> Model { + Model { id: id.into(), name: None, status: Status::Loaded, context: None, vision: false, control: None } + } + + pub fn label(&self) -> &str { + self.name.as_deref().unwrap_or(&self.id) + } +} + +#[derive(Debug, Clone, PartialEq)] +pub struct Props { + pub context: Option<u64>, + pub slots: u32, + pub vision: bool, + pub tools: bool, + pub control: Control, +} + +#[derive(Debug, Clone, PartialEq)] +pub struct ToolSpec { + pub name: String, + pub description: String, + pub parameters: Value, +} + +#[derive(Debug, Clone, PartialEq, Default)] +pub struct ChatRequest { + pub model: String, + pub messages: Vec<Message>, + pub reasoning: Option<Reasoning>, + pub kwargs: Map<String, Value>, + pub tools: Vec<ToolSpec>, + pub context: Option<u64>, +} + +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum StopReason { + End, + ToolUse, + MaxTokens, + Refusal, + Other(String), +} + +#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)] +#[serde(default)] +pub struct Tokens { + pub prompt: u64, + pub completion: u64, + pub cache_read: u64, +} + +impl Tokens { + pub fn total(self) -> u64 { + self.prompt + self.completion + } + + pub fn add(&mut self, other: Tokens) { + self.prompt += other.prompt; + self.completion += other.completion; + self.cache_read += other.cache_read; + } +} + +#[derive(Debug, Clone, PartialEq)] +pub enum Event { + Reasoning(String), + Content(String), + ToolCall { index: usize, id: Option<String>, name: Option<String>, arguments: String }, + Usage(Tokens), + Stop(StopReason), +} + +pub trait Provider: Send + Sync { + fn models(&self) -> Result<Vec<Model>, Error>; + + fn stream(&self, request: &ChatRequest, cancel: &AtomicBool, on_event: &mut dyn FnMut(Event)) -> Result<(), Error>; +} + +pub fn context_label(tokens: u64) -> String { + if tokens >= 1_000_000 && tokens.is_multiple_of(1_000_000) { + format!("{}M", tokens / 1_000_000) + } else if tokens >= 1024 && tokens.is_multiple_of(1024) { + format!("{}K", tokens / 1024) + } else if tokens >= 1000 { + format!("{}K", tokens / 1000) + } else { + tokens.to_string() + } +} + +fn agent() -> ureq::Agent { + use ureq::tls::{RootCerts, TlsConfig, TlsProvider}; + let tls = TlsConfig::builder().provider(TlsProvider::Rustls).root_certs(RootCerts::PlatformVerifier).build(); + ureq::Agent::config_builder() + .timeout_connect(Some(std::time::Duration::from_secs(8))) + .http_status_as_error(false) + .tls_config(tls) + .build() + .into() +} + +fn authorized<B>(request: ureq::RequestBuilder<B>, key: Option<&str>) -> ureq::RequestBuilder<B> { + match key { + Some(key) => request.header("Authorization", format!("Bearer {key}")), + None => request, + } +} + +fn error_message(status: u16, body: &str) -> String { + if matches!(status, 401 | 403) { + return format!("The server turned the request down ({status}). Check the API key."); + } + let detail = serde_json::from_str::<Value>(body) + .ok() + .and_then(|v| v["error"]["message"].as_str().or(v["error"].as_str()).map(str::to_string)) + .unwrap_or_else(|| body.trim().chars().take(300).collect()); + if detail.is_empty() { format!("The server answered {status}.") } else { format!("The server answered {status}: {detail}") } +} + +fn read_json(response: ureq::http::Response<ureq::Body>) -> Result<Value, Error> { + let status = response.status().as_u16(); + let text = response.into_body().read_to_string()?; + if status >= 400 { + return Err(Error(error_message(status, &text))); + } + serde_json::from_str(&text).map_err(|e| Error(format!("The server sent something that is not JSON: {e}"))) +} + +fn stream_lines( + response: ureq::http::Response<ureq::Body>, + cancel: &AtomicBool, + mut each: impl FnMut(&str) -> Result<bool, Error>, +) -> Result<(), Error> { + use std::io::BufRead; + let status = response.status().as_u16(); + let mut body = response.into_body(); + if status >= 400 { + let text = body.read_to_string().unwrap_or_default(); + return Err(Error(error_message(status, &text))); + } + for line in std::io::BufReader::new(body.into_reader()).lines() { + if cancel.load(std::sync::atomic::Ordering::Relaxed) { + return Ok(()); + } + let line = line.map_err(|e| Error(e.to_string()))?; + if !each(&line)? { + break; + } + } + Ok(()) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn context_sizes_read_naturally() { + assert_eq!(context_label(131072), "128K"); + assert_eq!(context_label(65536), "64K"); + assert_eq!(context_label(32000), "32K"); + assert_eq!(context_label(1_000_000), "1M"); + assert_eq!(context_label(512), "512"); + } +} \ No newline at end of file diff --git a/crates/quill-providers/src/lmstudio.rs b/crates/quill-providers/src/lmstudio.rs new file mode 100644 index 0000000..c910a52 --- /dev/null +++ b/crates/quill-providers/src/lmstudio.rs @@ -0,0 +1,67 @@ +use std::sync::atomic::AtomicBool; + +use serde_json::Value; + +use crate::{ChatRequest, Error, Event, Model, OpenAi, Provider, Status}; + +pub struct LmStudio { + server: OpenAi, +} + +impl LmStudio { + pub fn new(base_url: &str, key: Option<&str>) -> LmStudio { + LmStudio { server: OpenAi::new(base_url).with_key(key) } + } +} + +impl Provider for LmStudio { + fn models(&self) -> Result<Vec<Model>, Error> { + match self.server.get_json("/api/v1/models") { + Ok(body) if body["models"].is_array() => Ok(parse_catalog(&body)), + _ => self.server.models(), + } + } + + fn stream(&self, request: &ChatRequest, cancel: &AtomicBool, on_event: &mut dyn FnMut(Event)) -> Result<(), Error> { + self.server.stream(request, cancel, on_event) + } +} + +fn parse_catalog(body: &Value) -> Vec<Model> { + let Some(list) = body["models"].as_array() else { return Vec::new() }; + list.iter() + .filter(|entry| entry["type"] == "llm") + .filter_map(|entry| { + let id = entry["key"].as_str()?.to_string(); + let loaded = entry["loaded_instances"].as_array().and_then(|instances| instances.first()); + Some(Model { + name: entry["display_name"].as_str().map(str::to_string), + status: if loaded.is_some() { Status::Loaded } else { Status::Unloaded }, + context: loaded.and_then(|instance| instance["config"]["context_length"].as_u64()).or(entry["max_context_length"].as_u64()), + vision: entry["capabilities"]["vision"].as_bool().unwrap_or(false), + ..Model::new(id) + }) + }) + .collect() +} + +#[cfg(test)] +mod tests { + use super::*; + use serde_json::json; + + #[test] + fn the_catalog_keeps_language_models_with_their_loaded_window() { + let body = json!({ "models": [ + { "type": "llm", "key": "google/gemma-4-26b-a4b", "display_name": "Gemma 4 26B A4B", + "loaded_instances": [{ "id": "google/gemma-4-26b-a4b", "config": { "context_length": 32768 } }], + "max_context_length": 262144, "capabilities": { "vision": true, "trained_for_tool_use": true } }, + { "type": "llm", "key": "qwen/qwen3-8b", "loaded_instances": [], "max_context_length": 40960 }, + { "type": "embedding", "key": "nomic-embed", "loaded_instances": [], "max_context_length": 2048 } + ]}); + let models = parse_catalog(&body); + assert_eq!(models.len(), 2); + assert_eq!((models[0].label(), models[0].context, models[0].vision), ("Gemma 4 26B A4B", Some(32768), true)); + assert_eq!((models[1].status, models[1].context), (Status::Unloaded, Some(40960))); + } +} \ No newline at end of file diff --git a/crates/quill-providers/src/message.rs b/crates/quill-providers/src/message.rs new file mode 100644 index 0000000..21e2081 --- /dev/null +++ b/crates/quill-providers/src/message.rs @@ -0,0 +1,167 @@ +use serde::{Deserialize, Serialize}; +use serde_json::{Value, json}; + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "lowercase")] +pub enum Role { + System, + User, + Assistant, + Tool, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct FunctionCall { + pub name: String, + pub arguments: String, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct ToolCall { + pub id: String, + #[serde(rename = "type")] + pub kind: String, + pub function: FunctionCall, +} + +impl ToolCall { + pub fn new(id: impl Into<String>, name: impl Into<String>, arguments: impl Into<String>) -> ToolCall { + ToolCall { id: id.into(), kind: "function".into(), function: FunctionCall { name: name.into(), arguments: arguments.into() } } + } +} + +#[derive(Debug, Clone, PartialEq, Deserialize)] +#[serde(from = "RawMessage")] +pub struct Message { + pub role: Role, + pub content: String, + pub images: Vec<String>, + pub tool_calls: Vec<ToolCall>, + pub tool_call_id: Option<String>, + pub reasoning: Option<String>, +} + +#[derive(Deserialize)] +struct RawMessage { + role: Role, + #[serde(default)] + content: Value, + #[serde(default)] + tool_calls: Vec<ToolCall>, + #[serde(default)] + tool_call_id: Option<String>, + #[serde(default)] + reasoning_content: Option<String>, +} + +impl From<RawMessage> for Message { + fn from(raw: RawMessage) -> Message { + let (content, images) = match raw.content { + Value::String(text) => (text, Vec::new()), + Value::Array(parts) => { + let text = parts.iter().filter_map(|p| p["text"].as_str()).collect::<Vec<_>>().join("\n"); + let images = parts.iter().filter_map(|p| p["image_url"]["url"].as_str().map(str::to_string)).collect(); + (text, images) + } + _ => (String::new(), Vec::new()), + }; + let reasoning = raw.reasoning_content.filter(|text| !text.trim().is_empty()); + Message { role: raw.role, content, images, tool_calls: raw.tool_calls, tool_call_id: raw.tool_call_id, reasoning } + } +} + +impl Serialize for Message { + fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> { + self.wire().serialize(serializer) + } +} + +impl Message { + fn new(role: Role, content: impl Into<String>) -> Message { + Message { role, content: content.into(), images: Vec::new(), tool_calls: Vec::new(), tool_call_id: None, reasoning: None } + } + + pub fn system(content: impl Into<String>) -> Message { + Message::new(Role::System, content) + } + + pub fn user(content: impl Into<String>) -> Message { + Message::new(Role::User, content) + } + + pub fn user_with_images(content: impl Into<String>, images: Vec<String>) -> Message { + Message { images, ..Message::new(Role::User, content) } + } + + pub fn assistant(content: impl Into<String>, tool_calls: Vec<ToolCall>) -> Message { + Message { tool_calls, ..Message::new(Role::Assistant, content) } + } + + pub fn with_reasoning(self, reasoning: impl Into<String>) -> Message { + let reasoning = reasoning.into(); + Message { reasoning: (!reasoning.trim().is_empty()).then_some(reasoning), ..self } + } + + pub fn tool(id: impl Into<String>, content: impl Into<String>) -> Message { + Message { tool_call_id: Some(id.into()), ..Message::new(Role::Tool, content) } + } + + pub fn wire(&self) -> Value { + let mut value = json!({ "role": self.role }); + value["content"] = if self.images.is_empty() { + json!(self.content) + } else { + let mut parts = vec![json!({ "type": "text", "text": self.content })]; + parts.extend(self.images.iter().map(|url| json!({ "type": "image_url", "image_url": { "url": url } }))); + json!(parts) + }; + if let Some(reasoning) = &self.reasoning { + value["reasoning_content"] = json!(reasoning); + } + if !self.tool_calls.is_empty() { + value["tool_calls"] = json!(self.tool_calls); + } + if let Some(id) = &self.tool_call_id { + value["tool_call_id"] = json!(id); + } + value + } +} +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn images_become_content_parts_and_back() { + let message = Message::user_with_images("look", vec!["data:image/png;base64,AAAA".into()]); + let value = serde_json::to_value(&message).unwrap(); + assert_eq!(value["content"][0]["text"], "look"); + assert_eq!(value["content"][1]["image_url"]["url"], "data:image/png;base64,AAAA"); + let back: Message = serde_json::from_value(value).unwrap(); + assert_eq!(back, message); + let plain: Message = serde_json::from_value(json!({ "role": "user", "content": "hi" })).unwrap(); + assert_eq!(plain, Message::user("hi")); + } + + #[test] + fn tool_messages_serialize_like_openai() { + let call = ToolCall::new("c1", "read_file", r#"{"path":"a"}"#); + let assistant = serde_json::to_value(Message::assistant("", vec![call])).unwrap(); + assert_eq!(assistant["tool_calls"][0]["type"], "function"); + assert_eq!(assistant["tool_calls"][0]["function"]["name"], "read_file"); + let result = serde_json::to_value(Message::tool("c1", "text")).unwrap(); + assert_eq!(result["role"], "tool"); + assert_eq!(result["tool_call_id"], "c1"); + assert!(serde_json::to_value(Message::user("x")).unwrap().get("tool_calls").is_none()); + } + + #[test] + fn reasoning_round_trips_through_the_saved_history() { + let message = Message::assistant("", Vec::new()).with_reasoning("Check the listing first."); + let value = serde_json::to_value(&message).unwrap(); + assert_eq!(value["reasoning_content"], "Check the listing first."); + let back: Message = serde_json::from_value(value).unwrap(); + assert_eq!(back, message); + assert!(serde_json::to_value(Message::user("x")).unwrap().get("reasoning_content").is_none()); + } +} \ No newline at end of file diff --git a/crates/quill-providers/src/ollama.rs b/crates/quill-providers/src/ollama.rs new file mode 100644 index 0000000..0536584 --- /dev/null +++ b/crates/quill-providers/src/ollama.rs @@ -0,0 +1,252 @@ +use std::collections::HashMap; +use std::sync::atomic::AtomicBool; + +use serde_json::{Value, json}; + +use crate::openai::normalize_url; +use crate::{ + ChatRequest, Control, Error, Event, Message, Model, Provider, Reasoning, Role, Status, StopReason, Tokens, agent, authorized, + read_json, stream_lines, +}; + +pub const OLLAMA_CONTEXT: u64 = 32768; + +pub struct Ollama { + base: String, + key: Option<String>, + agent: ureq::Agent, +} + +impl Ollama { + pub fn new(base_url: &str, key: Option<&str>) -> Ollama { + let key = key.map(str::trim).filter(|key| !key.is_empty()).map(str::to_string); + Ollama { base: normalize_url(base_url), key, agent: agent() } + } + + fn get_json(&self, path: &str) -> Result<Value, Error> { + read_json(authorized(self.agent.get(format!("{}{path}", self.base)), self.key.as_deref()).call()?) + } + + fn show(&self, name: &str) -> Option<Value> { + let post = authorized(self.agent.post(format!("{}/api/show", self.base)), self.key.as_deref()); + read_json(post.send_json(json!({ "model": name })).ok()?).ok() + } +} + +impl Provider for Ollama { + fn models(&self) -> Result<Vec<Model>, Error> { + let tags = self.get_json("/api/tags")?; + let running = self.get_json("/api/ps").unwrap_or_default(); + let names: Vec<String> = tags["models"] + .as_array() + .map(Vec::as_slice) + .unwrap_or(&[]) + .iter() + .filter_map(|m| m["name"].as_str().map(str::to_string)) + .collect(); + let details: Vec<Option<Value>> = std::thread::scope(|scope| { + let jobs: Vec<_> = names.iter().map(|name| scope.spawn(move || self.show(name))).collect(); + jobs.into_iter().map(|job| job.join().ok().flatten()).collect() + }); + Ok(names.into_iter().zip(details).filter_map(|(name, details)| model(name, details.as_ref(), &running)).collect()) + } + + fn stream(&self, request: &ChatRequest, cancel: &AtomicBool, on_event: &mut dyn FnMut(Event)) -> Result<(), Error> { + let post = authorized(self.agent.post(format!("{}/api/chat", self.base)), self.key.as_deref()); + let response = post.send_json(chat_body(request))?; + let mut calls = 0; + stream_lines(response, cancel, |line| { + let (events, done) = parse_line(line, &mut calls)?; + events.into_iter().for_each(&mut *on_event); + Ok(!done) + }) + } +} + +fn capabilities(details: Option<&Value>) -> Vec<String> { + let list = details.and_then(|d| d["capabilities"].as_array()).map(Vec::as_slice).unwrap_or(&[]); + list.iter().filter_map(|c| c.as_str().map(str::to_string)).collect() +} + +fn window(details: Option<&Value>) -> Option<u64> { + let details = details?; + let parameters = details["parameters"].as_str().unwrap_or_default(); + let chosen = parameters.lines().find_map(|line| line.trim().strip_prefix("num_ctx")?.trim().parse().ok()); + let trained = details["model_info"] + .as_object() + .and_then(|info| info.iter().find(|(key, _)| key.ends_with(".context_length")).and_then(|(_, value)| value.as_u64())); + chosen.or(trained.map(|trained| trained.min(OLLAMA_CONTEXT))) +} + +fn model(name: String, details: Option<&Value>, running: &Value) -> Option<Model> { + let capabilities = capabilities(details); + if !capabilities.is_empty() && !capabilities.iter().any(|c| c == "completion") { + return None; + } + let loaded = running["models"].as_array().is_some_and(|list| list.iter().any(|m| m["name"] == name.as_str())); + let has = |capability: &str| capabilities.iter().any(|c| c == capability); + Some(Model { + status: if loaded { Status::Loaded } else { Status::Unloaded }, + context: window(details).or(Some(OLLAMA_CONTEXT)), + vision: has("vision"), + control: Some(if has("thinking") { Control::toggle() } else { Control::None }), + ..Model::new(name) + }) +} + +fn wire(message: &Message, names: &HashMap<&str, &str>) -> Value { + let mut value = json!({ "role": message.role, "content": message.content }); + if let Some(reasoning) = &message.reasoning { + value["thinking"] = json!(reasoning); + } + if !message.images.is_empty() { + let images: Vec<&str> = message.images.iter().map(|url| url.split_once("base64,").map_or(url.as_str(), |(_, data)| data)).collect(); + value["images"] = json!(images); + } + if !message.tool_calls.is_empty() { + let calls: Vec<Value> = message + .tool_calls + .iter() + .map(|call| { + let arguments: Value = serde_json::from_str(&call.function.arguments).unwrap_or_else(|_| json!({})); + json!({ "function": { "name": call.function.name, "arguments": arguments } }) + }) + .collect(); + value["tool_calls"] = json!(calls); + } + if message.role == Role::Tool + && let Some(name) = message.tool_call_id.as_deref().and_then(|id| names.get(id)) + { + value["tool_name"] = json!(name); + } + value +} + +fn chat_body(request: &ChatRequest) -> Value { + let names: HashMap<&str, &str> = request + .messages + .iter() + .flat_map(|message| message.tool_calls.iter().map(|call| (call.id.as_str(), call.function.name.as_str()))) + .collect(); + let messages: Vec<Value> = request.messages.iter().map(|message| wire(message, &names)).collect(); + let mut body = json!({ "model": request.model, "messages": messages, "stream": true }); + if let Some(context) = request.context { + body["options"] = json!({ "num_ctx": context }); + } + match &request.reasoning { + Some(Reasoning::Toggle { on, .. }) => body["think"] = json!(on), + Some(Reasoning::Effort(level)) => body["think"] = json!(level), + None => {} + } + if !request.tools.is_empty() { + let tools: Vec<Value> = request + .tools + .iter() + .map(|tool| json!({ "type": "function", "function": { "name": tool.name, "description": tool.description, "parameters": tool.parameters } })) + .collect(); + body["tools"] = json!(tools); + } + body +} + +fn parse_line(line: &str, calls: &mut usize) -> Result<(Vec<Event>, bool), Error> { + let Ok(value) = serde_json::from_str::<Value>(line) else { return Ok((Vec::new(), false)) }; + if let Some(error) = value["error"].as_str() { + return Err(Error(error.to_string())); + } + let mut events = Vec::new(); + let message = &value["message"]; + if let Some(text) = message["thinking"].as_str().filter(|t| !t.is_empty()) { + events.push(Event::Reasoning(text.to_string())); + } + if let Some(text) = message["content"].as_str().filter(|t| !t.is_empty()) { + events.push(Event::Content(text.to_string())); + } + for call in message["tool_calls"].as_array().map(Vec::as_slice).unwrap_or(&[]) { + events.push(Event::ToolCall { + index: *calls, + id: None, + name: call["function"]["name"].as_str().map(str::to_string), + arguments: call["function"]["arguments"].to_string(), + }); + *calls += 1; + } + let done = value["done"].as_bool().unwrap_or(false); + if done { + let count = |key: &str| value[key].as_u64().unwrap_or(0); + events.push(Event::Usage(Tokens { prompt: count("prompt_eval_count"), completion: count("eval_count"), cache_read: 0 })); + let stop = match value["done_reason"].as_str() { + _ if *calls > 0 => StopReason::ToolUse, + Some("length") => StopReason::MaxTokens, + _ => StopReason::End, + }; + events.push(Event::Stop(stop)); + } + Ok((events, done)) +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::{ToolCall, ToolSpec}; + + #[test] + fn models_report_their_window_and_abilities() { + let details = json!({ + "capabilities": ["completion", "tools", "thinking"], + "model_info": { "general.architecture": "qwen3", "qwen3.context_length": 40960 }, + "parameters": "temperature 0.6" + }); + let running = json!({ "models": [{ "name": "qwen3:8b" }] }); + let qwen = model("qwen3:8b".into(), Some(&details), &running).unwrap(); + assert_eq!((qwen.status, qwen.context, qwen.control), (Status::Loaded, Some(OLLAMA_CONTEXT), Some(Control::toggle()))); + let custom = json!({ "capabilities": ["completion", "vision"], "parameters": "num_ctx 8192" }); + let gemma = model("gemma".into(), Some(&custom), &json!({})).unwrap(); + assert_eq!((gemma.status, gemma.context, gemma.vision), (Status::Unloaded, Some(8192), true)); + assert!(model("nomic-embed-text".into(), Some(&json!({ "capabilities": ["embedding"] })), &json!({})).is_none()); + } + + #[test] + fn requests_carry_the_window_thinking_and_tool_names() { + let request = ChatRequest { + model: "qwen3:8b".into(), + messages: vec![ + Message::user_with_images("look", vec!["data:image/png;base64,AAAA".into()]), + Message::assistant("", vec![ToolCall::new("c1", "shell", r#"{"command":"ls"}"#)]).with_reasoning("Checking the listing."), + Message::tool("c1", "a.txt"), + ], + reasoning: Some(Reasoning::Toggle { kwarg: "enable_thinking".into(), on: false }), + tools: vec![ToolSpec { name: "shell".into(), description: "Run".into(), parameters: json!({ "type": "object" }) }], + context: Some(32768), + ..ChatRequest::default() + }; + let body = chat_body(&request); + assert_eq!(body["options"]["num_ctx"], 32768); + assert_eq!(body["think"], false); + let effort = ChatRequest { reasoning: Some(Reasoning::Effort("high".into())), ..request.clone() }; + assert_eq!(chat_body(&effort)["think"], "high"); + assert_eq!(body["messages"][0]["images"][0], "AAAA"); + assert_eq!(body["messages"][1]["tool_calls"][0]["function"]["arguments"]["command"], "ls"); + assert_eq!(body["messages"][1]["thinking"], "Checking the listing."); + assert_eq!(body["messages"][2]["tool_name"], "shell"); + assert_eq!(body["tools"][0]["function"]["name"], "shell"); + } + + #[test] + fn stream_lines_become_events() { + let mut calls = 0; + let (events, done) = + parse_line(r#"{"message":{"role":"assistant","content":"","thinking":"hm"},"done":false}"#, &mut calls).unwrap(); + assert_eq!((events, done), (vec![Event::Reasoning("hm".into())], false)); + let call = r#"{"message":{"role":"assistant","content":"","tool_calls":[{"function":{"name":"shell","arguments":{"command":"ls"}}}]},"done":false}"#; + let (events, _) = parse_line(call, &mut calls).unwrap(); + assert_eq!( + events, + vec![Event::ToolCall { index: 0, id: None, name: Some("shell".into()), arguments: r#"{"command":"ls"}"#.into() }] + ); + let (events, done) = parse_line(r#"{"done":true,"done_reason":"stop","prompt_eval_count":12,"eval_count":3}"#, &mut calls).unwrap(); + assert!(done); + assert_eq!(events[1], Event::Stop(StopReason::ToolUse)); + assert!(parse_line(r#"{"error":"model not found"}"#, &mut calls).is_err()); + } +} \ No newline at end of file diff --git a/crates/quill-providers/src/openai.rs b/crates/quill-providers/src/openai.rs new file mode 100644 index 0000000..4bd19e6 --- /dev/null +++ b/crates/quill-providers/src/openai.rs @@ -0,0 +1,377 @@ +use std::sync::atomic::AtomicBool; + +use serde_json::{Value, json}; + +use crate::{ + ChatRequest, Control, Error, Event, Model, Props, Provider, Reasoning, Status, StopReason, Tokens, agent, authorized, read_json, + stream_lines, +}; + +pub struct OpenAi { + base: String, + key: Option<String>, + agent: ureq::Agent, +} + +impl OpenAi { + pub fn new(base_url: &str) -> OpenAi { + OpenAi { base: normalize_url(base_url), key: None, agent: agent() } + } + + pub fn with_key(self, key: Option<&str>) -> OpenAi { + OpenAi { key: key.map(str::trim).filter(|key| !key.is_empty()).map(str::to_string), ..self } + } + + pub fn base(&self) -> &str { + &self.base + } + + pub fn reachable(&self) -> bool { + self.agent.get(format!("{}/v1/models", self.base)).call().is_ok() + } + + pub fn props(&self, model: &str) -> Result<Props, Error> { + let body = self.get_json(&format!("/props?model={}", encode(model)))?; + Ok(parse_props(&body)) + } + + pub(crate) fn get_json(&self, path: &str) -> Result<Value, Error> { + read_json(authorized(self.agent.get(format!("{}{path}", self.base)), self.key.as_deref()).call()?) + } +} + +impl Provider for OpenAi { + fn models(&self) -> Result<Vec<Model>, Error> { + Ok(parse_models(&self.get_json("/v1/models")?)) + } + + fn stream(&self, request: &ChatRequest, cancel: &AtomicBool, on_event: &mut dyn FnMut(Event)) -> Result<(), Error> { + let post = authorized(self.agent.post(format!("{}/v1/chat/completions", self.base)), self.key.as_deref()); + let response = post.send_json(chat_body(request))?; + let whole = response.headers().get("content-type").and_then(|kind| kind.to_str().ok()).is_some_and(|kind| kind.contains("json")); + if whole { + events(&read_json(response)?, "message").into_iter().for_each(on_event); + return Ok(()); + } + stream_lines(response, cancel, |line| match parse_sse_line(line) { + Some(Sse::Done) => Ok(false), + Some(Sse::Error(message)) => Err(Error(message)), + Some(Sse::Events(events)) => { + events.into_iter().for_each(&mut *on_event); + Ok(true) + } + None => Ok(true), + }) + } +} + +pub fn normalize_url(url: &str) -> String { + let trimmed = url.trim().trim_end_matches('/'); + let trimmed = trimmed.strip_suffix("/v1").unwrap_or(trimmed); + if trimmed.contains("://") { trimmed.to_string() } else { format!("http://{trimmed}") } +} + +fn encode(value: &str) -> String { + value + .bytes() + .map(|b| match b { + b'A'..=b'Z' | b'a'..=b'z' | b'0'..=b'9' | b'-' | b'_' | b'.' | b'~' => (b as char).to_string(), + _ => format!("%{b:02X}"), + }) + .collect() +} + +fn ctx_size_arg(args: &[Value]) -> Option<u64> { + args.windows(2).find(|pair| matches!(pair[0].as_str(), Some("--ctx-size") | Some("-c"))).and_then(|pair| pair[1].as_str()?.parse().ok()) +} + +pub fn parse_models(body: &Value) -> Vec<Model> { + let Some(list) = body["data"].as_array() else { return Vec::new() }; + list.iter() + .filter_map(|entry| { + let id = entry["id"].as_str()?.to_string(); + let status = entry["status"]["value"].as_str().map_or(Status::Loaded, Status::parse); + let args = entry["status"]["args"].as_array().map(Vec::as_slice).unwrap_or(&[]); + let context = entry["meta"]["n_ctx"] + .as_u64() + .or_else(|| ctx_size_arg(args)) + .or_else(|| { + ["max_model_len", "loaded_context_length", "context_length", "max_context_length"] + .iter() + .find_map(|k| entry[k].as_u64()) + }) + .or_else(|| entry["meta"]["n_ctx_train"].as_u64()); + let vision = entry["architecture"]["input_modalities"].as_array().is_some_and(|m| m.iter().any(|v| v == "image")); + let name = entry["name"].as_str().filter(|name| *name != id).map(str::to_string); + Some(Model { name, status, context, vision, ..Model::new(id) }) + }) + .collect() +} + +pub fn parse_props(body: &Value) -> Props { + let template = body["chat_template"].as_str().unwrap_or_default(); + let caps = &body["chat_template_caps"]; + let control = if template.contains("reasoning_effort") { + Control::effort() + } else if template.contains("enable_thinking") { + Control::toggle() + } else { + Control::None + }; + Props { + context: body["default_generation_settings"]["n_ctx"].as_u64().filter(|n| *n > 0), + slots: body["total_slots"].as_u64().unwrap_or(1).max(1) as u32, + vision: body["modalities"]["vision"].as_bool().unwrap_or(false), + tools: caps["supports_tool_calls"].as_bool().unwrap_or(template.contains("tools")), + control, + } +} + +fn chat_body(request: &ChatRequest) -> Value { + let messages: Vec<Value> = request.messages.iter().map(|message| message.wire()).collect(); + let mut body = json!({ + "model": request.model, + "messages": messages, + "stream": true, + "stream_options": { "include_usage": true }, + }); + let mut kwargs = request.kwargs.clone(); + match &request.reasoning { + Some(Reasoning::Toggle { kwarg, on }) => { + kwargs.insert(kwarg.clone(), json!(on)); + } + Some(Reasoning::Effort(level)) => { + kwargs.insert("reasoning_effort".into(), json!(level)); + body["reasoning_effort"] = json!(level); + } + None => {} + } + if !kwargs.is_empty() { + body["chat_template_kwargs"] = Value::Object(kwargs); + } + if !request.tools.is_empty() { + body["tools"] = request + .tools + .iter() + .map(|tool| { + json!({ + "type": "function", + "function": { "name": tool.name, "description": tool.description, "parameters": tool.parameters } + }) + }) + .collect(); + } + body +} + +#[derive(Debug, PartialEq)] +enum Sse { + Events(Vec<Event>), + Error(String), + Done, +} + +fn stop_reason(reason: &str) -> StopReason { + match reason { + "stop" => StopReason::End, + "tool_calls" | "function_call" => StopReason::ToolUse, + "length" => StopReason::MaxTokens, + "content_filter" => StopReason::Refusal, + other => StopReason::Other(other.to_string()), + } +} + +fn parse_sse_line(line: &str) -> Option<Sse> { + let data = line.strip_prefix("data:")?.trim(); + if data == "[DONE]" { + return Some(Sse::Done); + } + let value: Value = serde_json::from_str(data).ok()?; + if let Some(message) = value["error"]["message"].as_str() { + return Some(Sse::Error(message.to_string())); + } + Some(Sse::Events(events(&value, "delta"))) +} + +fn events(value: &Value, part: &str) -> Vec<Event> { + let mut events = Vec::new(); + let choice = &value["choices"][0]; + let delta = &choice[part]; + let reasoning = delta["reasoning_content"].as_str().or_else(|| delta["reasoning"].as_str()); + if let Some(text) = reasoning.filter(|t| !t.is_empty()) { + events.push(Event::Reasoning(text.to_string())); + } + if let Some(text) = delta["content"].as_str().filter(|t| !t.is_empty()) { + events.push(Event::Content(text.to_string())); + } + for (position, call) in delta["tool_calls"].as_array().map(Vec::as_slice).unwrap_or(&[]).iter().enumerate() { + events.push(Event::ToolCall { + index: call["index"].as_u64().map_or(position, |i| i as usize), + id: call["id"].as_str().map(str::to_string), + name: call["function"]["name"].as_str().map(str::to_string), + arguments: call["function"]["arguments"].as_str().unwrap_or_default().to_string(), + }); + } + if let Some(reason) = choice["finish_reason"].as_str() { + events.push(Event::Stop(stop_reason(reason))); + } + let usage = &value["usage"]; + if let (Some(prompt), Some(completion)) = (usage["prompt_tokens"].as_u64(), usage["completion_tokens"].as_u64()) { + let cache_read = usage["prompt_tokens_details"]["cached_tokens"].as_u64().unwrap_or(0); + events.push(Event::Usage(Tokens { prompt, completion, cache_read })); + } + events +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::{Message, ToolSpec}; + + #[test] + fn urls_are_normalized() { + assert_eq!(normalize_url("127.0.0.1:9931/"), "http://127.0.0.1:9931"); + assert_eq!(normalize_url("http://localhost:8080/v1"), "http://localhost:8080"); + assert_eq!(normalize_url(" https://box.lan "), "https://box.lan"); + } + + #[test] + fn router_models_are_parsed() { + let body = json!({ "data": [ + { "id": "qwen3.5-35b-a3b", "status": { "value": "unloaded", "args": ["llama-server.exe", "--ctx-size", "65536"] }, + "architecture": { "input_modalities": ["text", "image"] }, "context_length": 262144 }, + { "id": "qwen3.5-4b", "status": { "value": "sleeping", "args": ["--ctx-size", "131072"] }, + "architecture": { "input_modalities": ["text"] }, "meta": { "n_ctx": 131072, "n_ctx_train": 262144 } }, + { "id": "single" } + ]}); + let models = parse_models(&body); + assert_eq!(models.len(), 3); + assert_eq!(models[0], Model { status: Status::Unloaded, context: Some(65536), vision: true, ..Model::new("qwen3.5-35b-a3b") }); + assert_eq!(models[1].status, Status::Sleeping); + assert_eq!(models[1].context, Some(131072)); + assert!(!models[1].vision); + assert_eq!(models[2].status, Status::Loaded); + } + + #[test] + fn other_servers_report_their_window() { + let body = json!({ "data": [ + { "id": "vllm", "max_model_len": 32768 }, + { "id": "lmstudio", "loaded_context_length": 8192, "max_context_length": 131072 }, + { "id": "router", "context_length": 200000, "name": "Router Model" } + ]}); + let models = parse_models(&body); + let windows: Vec<Option<u64>> = models.iter().map(|m| m.context).collect(); + assert_eq!(windows, vec![Some(32768), Some(8192), Some(200000)]); + assert_eq!(models[2].label(), "Router Model"); + } + + #[test] + fn props_detect_thinking_and_tools() { + let body = json!({ + "chat_template": "{%- if enable_thinking is defined and enable_thinking is false %}<think>\n\n</think>{%- endif %}", + "chat_template_caps": { "supports_tool_calls": true }, + "total_slots": 4, + "modalities": { "vision": true }, + "default_generation_settings": { "n_ctx": 131072 } + }); + let props = parse_props(&body); + assert_eq!(props.control, Control::toggle()); + assert!(props.tools && props.vision); + assert_eq!(props.slots, 4); + assert_eq!(props.context, Some(131072)); + assert_eq!(parse_props(&json!({})).control, Control::None); + assert_eq!(parse_props(&json!({ "chat_template": "Reasoning: {{ reasoning_effort }}" })).control, Control::effort()); + } + + #[test] + fn sse_lines_become_events() { + assert_eq!(parse_sse_line("data: [DONE]"), Some(Sse::Done)); + assert_eq!(parse_sse_line(": keep-alive"), None); + assert_eq!( + parse_sse_line(r#"data: {"choices":[{"delta":{"reasoning_content":"hm"}}]}"#), + Some(Sse::Events(vec![Event::Reasoning("hm".into())])) + ); + assert_eq!( + parse_sse_line(r#"data: {"choices":[{"delta":{"content":"Hi"}}],"usage":{"prompt_tokens":5,"completion_tokens":1}}"#), + Some(Sse::Events(vec![Event::Content("Hi".into()), Event::Usage(Tokens { prompt: 5, completion: 1, ..Tokens::default() })])) + ); + assert_eq!(parse_sse_line(r#"data: {"error":{"message":"boom"}}"#), Some(Sse::Error("boom".into()))); + } + + #[test] + fn a_whole_reply_reads_like_a_stream() { + let reply = json!({ + "choices": [{ "message": { "content": "Hi", "tool_calls": [{ "id": "a", "function": { "name": "shell", "arguments": "{}" } }] }, "finish_reason": "tool_calls" }], + "usage": { "prompt_tokens": 3, "completion_tokens": 1 } + }); + assert_eq!( + events(&reply, "message"), + vec![ + Event::Content("Hi".into()), + Event::ToolCall { index: 0, id: Some("a".into()), name: Some("shell".into()), arguments: "{}".into() }, + Event::Stop(StopReason::ToolUse), + Event::Usage(Tokens { prompt: 3, completion: 1, cache_read: 0 }), + ] + ); + } + + #[test] + fn finish_reasons_become_stops() { + assert_eq!( + parse_sse_line(r#"data: {"choices":[{"finish_reason":"tool_calls","index":0,"delta":{}}]}"#), + Some(Sse::Events(vec![Event::Stop(StopReason::ToolUse)])) + ); + assert_eq!(stop_reason("length"), StopReason::MaxTokens); + } + + #[test] + fn requests_carry_reasoning_kwargs_and_tools() { + let tool = ToolSpec { name: "read_file".into(), description: "Read".into(), parameters: json!({ "type": "object" }) }; + let request = ChatRequest { + model: "m".into(), + messages: vec![Message::user("hi")], + reasoning: Some(Reasoning::Toggle { kwarg: "enable_thinking".into(), on: false }), + tools: vec![tool], + ..ChatRequest::default() + }; + let body = chat_body(&request); + assert_eq!(body["chat_template_kwargs"]["enable_thinking"], false); + assert_eq!(body["messages"][0]["role"], "user"); + assert_eq!(body["tools"][0]["function"]["name"], "read_file"); + let effort = chat_body(&ChatRequest { reasoning: Some(Reasoning::Effort("high".into())), ..request.clone() }); + assert_eq!( + (effort["reasoning_effort"].clone(), effort["chat_template_kwargs"]["reasoning_effort"].clone()), + (json!("high"), json!("high")) + ); + let mut kwargs = serde_json::Map::new(); + kwargs.insert("top_k".into(), json!(20)); + let extra = chat_body(&ChatRequest { reasoning: None, kwargs, ..request.clone() }); + assert_eq!(extra["chat_template_kwargs"], json!({ "top_k": 20 })); + let plain = chat_body(&ChatRequest { reasoning: None, tools: Vec::new(), ..request }); + assert!(plain.get("chat_template_kwargs").is_none() && plain.get("tools").is_none() && plain.get("reasoning_effort").is_none()); + } + + #[test] + fn tool_calls_stream_in_pieces() { + let first = parse_sse_line( + r#"data: {"choices":[{"delta":{"tool_calls":[{"index":0,"id":"abc","type":"function","function":{"name":"read_file","arguments":"{"}}]}}]}"#, + ); + assert_eq!( + first, + Some(Sse::Events(vec![Event::ToolCall { + index: 0, + id: Some("abc".into()), + name: Some("read_file".into()), + arguments: "{".into() + }])) + ); + let next = parse_sse_line(r#"data: {"choices":[{"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"path\""}}]}}]}"#); + assert_eq!(next, Some(Sse::Events(vec![Event::ToolCall { index: 0, id: None, name: None, arguments: "\"path\"".into() }]))); + } + + #[test] + fn model_names_are_encoded() { + assert_eq!(encode("qwen3.5 4b/q4"), "qwen3.5%204b%2Fq4"); + } +} \ No newline at end of file diff --git a/crates/quill-providers/src/profiles.rs b/crates/quill-providers/src/profiles.rs new file mode 100644 index 0000000..61a50ff --- /dev/null +++ b/crates/quill-providers/src/profiles.rs @@ -0,0 +1,144 @@ +use serde::{Deserialize, Serialize}; +use serde_json::{Map, Value}; + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(tag = "reasoning", rename_all = "snake_case")] +pub enum Control { + None, + Toggle { + #[serde(default = "thinking_kwarg")] + kwarg: String, + }, + Effort { + #[serde(default = "effort_levels")] + levels: Vec<String>, + }, +} + +fn thinking_kwarg() -> String { + "enable_thinking".into() +} + +fn effort_levels() -> Vec<String> { + ["low", "medium", "high"].map(String::from).to_vec() +} + +impl Control { + pub fn toggle() -> Control { + Control::Toggle { kwarg: thinking_kwarg() } + } + + pub fn effort() -> Control { + Control::Effort { levels: effort_levels() } + } +} + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Profile { + #[serde(rename = "match")] + pub pattern: String, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub except: Vec<String>, + #[serde(flatten)] + pub control: Control, + #[serde(default, skip_serializing_if = "Map::is_empty")] + pub kwargs: Map<String, Value>, +} + +impl Profile { + fn new(pattern: &str, except: &[&str], control: Control) -> Profile { + Profile { pattern: pattern.into(), except: except.iter().map(|s| s.to_string()).collect(), control, kwargs: Map::new() } + } + + pub fn fits(&self, model: &str) -> bool { + let model = model.to_lowercase(); + model.contains(&self.pattern.to_lowercase()) && !self.except.iter().any(|word| model.contains(&word.to_lowercase())) + } +} + +pub fn builtin() -> Vec<Profile> { + let kwarg = |name: &str| Control::Toggle { kwarg: name.into() }; + vec![ + Profile::new("gpt-oss", &[], Control::effort()), + Profile::new("qwen3", &["instruct", "coder"], Control::toggle()), + Profile::new("glm-4.5", &[], Control::toggle()), + Profile::new("glm-4.6", &[], Control::toggle()), + Profile::new("glm-4.7", &[], Control::toggle()), + Profile::new("hunyuan", &[], Control::toggle()), + Profile::new("deepseek-v3.1", &[], kwarg("thinking")), + Profile::new("deepseek-v3.2", &[], kwarg("thinking")), + ] +} + +pub fn profile_for(model: &str, extra: &[Profile]) -> Option<Profile> { + extra.iter().find(|profile| profile.fits(model)).cloned().or_else(|| builtin().into_iter().find(|profile| profile.fits(model))) +} + +#[derive(Clone, Debug, PartialEq)] +pub enum Reasoning { + Toggle { kwarg: String, on: bool }, + Effort(String), +} + +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Tuning { + pub reasoning: Option<Reasoning>, + pub quiet: Option<Reasoning>, + pub kwargs: Map<String, Value>, +} + +impl Tuning { + pub fn new(control: &Control, thinking: bool, effort: &str, kwargs: Map<String, Value>) -> Tuning { + let (reasoning, quiet) = match control { + Control::None => (None, None), + Control::Toggle { kwarg } => ( + Some(Reasoning::Toggle { kwarg: kwarg.clone(), on: thinking }), + Some(Reasoning::Toggle { kwarg: kwarg.clone(), on: false }), + ), + Control::Effort { levels } => { + let chosen = levels.iter().find(|level| level.eq_ignore_ascii_case(effort)).or(levels.get(levels.len() / 2)); + (chosen.map(|level| Reasoning::Effort(level.clone())), levels.first().map(|level| Reasoning::Effort(level.clone()))) + } + }; + Tuning { reasoning, quiet, kwargs } + } +} + +#[cfg(test)] +mod tests { + use super::*; + use serde_json::json; + + #[test] + fn families_are_matched_by_name() { + assert_eq!(profile_for("gpt-oss-20b", &[]).unwrap().control, Control::effort()); + assert_eq!(profile_for("Qwen3.5-4B", &[]).unwrap().control, Control::toggle()); + assert!(profile_for("Qwen3-30B-A3B-Instruct-2507", &[]).is_none()); + assert!(profile_for("llama-3.1-8b", &[]).is_none()); + assert_eq!(profile_for("deepseek-v3.1-terminus", &[]).unwrap().control, Control::Toggle { kwarg: "thinking".into() }); + } + + #[test] + fn profiles_from_settings_come_first_and_read_plainly() { + let mine: Vec<Profile> = serde_json::from_value(json!([ + { "match": "qwen3.5-4b", "reasoning": "none", "kwargs": { "top_k": 20 } }, + { "match": "my-model", "reasoning": "effort", "levels": ["minimal", "high"] } + ])) + .unwrap(); + let qwen = profile_for("qwen3.5-4b", &mine).unwrap(); + assert_eq!((qwen.control, qwen.kwargs["top_k"].clone()), (Control::None, json!(20))); + assert_eq!(profile_for("my-model", &mine).unwrap().control, Control::Effort { levels: vec!["minimal".into(), "high".into()] }); + let toggle: Profile = serde_json::from_value(json!({ "match": "x", "reasoning": "toggle" })).unwrap(); + assert_eq!(toggle.control, Control::toggle()); + } + + #[test] + fn tuning_picks_the_chosen_level_and_a_quiet_one() { + let tuning = Tuning::new(&Control::effort(), true, "high", Map::new()); + assert_eq!((tuning.reasoning, tuning.quiet), (Some(Reasoning::Effort("high".into())), Some(Reasoning::Effort("low".into())))); + assert_eq!(Tuning::new(&Control::effort(), true, "turbo", Map::new()).reasoning, Some(Reasoning::Effort("medium".into()))); + let toggle = Tuning::new(&Control::toggle(), true, "", Map::new()); + assert_eq!(toggle.quiet, Some(Reasoning::Toggle { kwarg: "enable_thinking".into(), on: false })); + assert_eq!(Tuning::new(&Control::None, true, "high", Map::new()), Tuning::default()); + } +} \ No newline at end of file diff --git a/crates/quill-weave/src/lib.rs b/crates/quill-weave/src/lib.rs index 729f86b..c72631d 100644 --- a/crates/quill-weave/src/lib.rs +++ b/crates/quill-weave/src/lib.rs @@ -3,7 +3,6 @@ use std::f64::consts::TAU; const GOLDEN: f64 = 2.399_963_229_728_653; const PERSPECTIVE: f64 = 3.4; const STRANDS: usize = 3; -const EASE_RATE: f64 = 4.0; #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] pub enum State { @@ -31,20 +30,6 @@ impl State { } } -impl Params { - pub fn ease(self, target: Params, dt: f64) -> Params { - let k = 1.0 - (-dt * EASE_RATE).exp(); - let mix = |a: f64, b: f64| a + (b - a) * k; - Params { - braid: mix(self.braid, target.braid), - ribbon: mix(self.ribbon, target.ribbon), - glass: mix(self.glass, target.glass), - spin: mix(self.spin, target.spin), - stream: mix(self.stream, target.stream), - } - } -} - #[derive(Clone, Copy, Debug, Default, PartialEq)] pub struct Clock { pub time: f64, @@ -55,13 +40,6 @@ pub struct Clock { pub const BRAND_FRAME: Clock = Clock { time: 123.1833, angle: 0.5074, flow: 0.0 }; impl Clock { - pub fn seeded(seed: u64) -> Clock { - let a = hash(seed as f64 * 0.731 + 0.5); - let b = hash(seed as f64 * 1.913 + 0.25); - let c = hash(seed as f64 * 2.417 + 0.75); - Clock { time: a * 10.0, angle: b * TAU, flow: c } - } - pub fn advance(&mut self, params: &Params, dt: f64) { self.angle += params.spin * dt; self.flow += params.stream * dt; @@ -74,9 +52,7 @@ pub struct Dot { pub x: f64, pub y: f64, pub depth: f64, - pub size: f64, pub alpha: f64, - pub hot: f64, } pub fn point_count(px: f64) -> usize { @@ -187,20 +163,11 @@ pub fn project(n: usize, params: &Params, clock: &Clock, out: &mut Vec<Dot>) { x: acc.x * persp, y: -acc.y * persp, depth: acc.depth, - size: (0.5 + 0.7 * acc.depth) * (1.0 + 0.8 * glow), alpha: (0.16 + 0.84 * acc.depth.powf(1.4) + glow * 0.3).min(1.0) * acc.fade, - hot: glow, }); } } -pub fn depth_order(dots: &[Dot], order: &mut Vec<usize>) { - if order.len() != dots.len() { - *order = (0..dots.len()).collect(); - } - order.sort_by(|a, b| dots[*a].depth.total_cmp(&dots[*b].depth)); -} - #[cfg(test)] mod tests { use super::*; @@ -212,18 +179,6 @@ mod tests { assert_eq!(point_count(1000.0), 330); } - #[test] - fn easing_converges_on_target() { - let mut p = State::Idle.params(); - for _ in 0..600 { - p = p.ease(State::Generating.params(), 1.0 / 60.0); - } - let g = State::Generating.params(); - assert!((p.ribbon - g.ribbon).abs() < 1e-3); - assert!((p.braid - g.braid).abs() < 1e-3); - assert!((p.stream - g.stream).abs() < 1e-3); - } - #[test] fn projection_is_finite_and_bounded() { let mut dots = Vec::new(); @@ -270,13 +225,4 @@ mod tests { assert!((d.alpha - alpha).abs() < 1e-9, "alpha {i}"); } } - - #[test] - fn depth_order_sorts_far_to_near() { - let mut dots = Vec::new(); - project(60, &State::Idle.params(), &BRAND_FRAME, &mut dots); - let mut order = Vec::new(); - depth_order(&dots, &mut order); - assert!(order.windows(2).all(|w| dots[w[0]].depth <= dots[w[1]].depth)); - } } \ No newline at end of file diff --git a/deny.toml b/deny.toml index 7073154..9a66385 100644 --- a/deny.toml +++ b/deny.toml @@ -1,26 +1,23 @@ [graph] -targets = ["x86_64-pc-windows-msvc"] +targets = ["x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu", "aarch64-apple-darwin", "x86_64-apple-darwin"] all-features = false [licenses] allow = [ "MIT", - "MIT-0", "Apache-2.0", "Apache-2.0 WITH LLVM-exception", - "BSD-2-Clause", "BSD-3-Clause", "Zlib", - "0BSD", - "CC0-1.0", "Unlicense", - "BSL-1.0", "Unicode-3.0", + "ISC", ] confidence-threshold = 0.9 exceptions = [ - { allow = ["MPL-2.0"], crate = "option-ext" }, - { allow = ["CDLA-Permissive-2.0"], crate = "webpki-root-certs" }, + { allow = ["CDLA-Permissive-2.0"], crate = "webpki-roots" }, + { allow = ["BSL-1.0"], crate = "clipboard-win" }, + { allow = ["BSL-1.0"], crate = "error-code" }, ] [bans] @@ -41,4 +38,7 @@ deny = [ [sources] unknown-registry = "deny" -unknown-git = "deny" \ No newline at end of file +unknown-git = "deny" + +[advisories] +unmaintained = "workspace" \ No newline at end of file diff --git a/docs/demo/demo.tape b/docs/demo/demo.tape new file mode 100644 index 0000000..6b729c3 --- /dev/null +++ b/docs/demo/demo.tape @@ -0,0 +1,26 @@ +Output docs/images/demo.gif + +Set Shell "powershell" +Set FontSize 16 +Set Width 1200 +Set Height 720 +Set Padding 20 +Set Framerate 20 +Set TypingSpeed 45ms +Set Theme { "name": "Quill", "background": "#1f1f1e", "foreground": "#e9e7e2", "cursor": "#e9e7e2", "selection": "#3a3936", "black": "#1f1f1e", "red": "#e5786d", "green": "#8fbf7f", "yellow": "#e0b56a", "blue": "#7193f5", "magenta": "#c79bd8", "cyan": "#6fc2c8", "white": "#d6d3cc", "brightBlack": "#7d7a73", "brightRed": "#f08a80", "brightGreen": "#a4d394", "brightYellow": "#ecc888", "brightBlue": "#8eabf8", "brightMagenta": "#d6b0e4", "brightCyan": "#8ad3d8", "brightWhite": "#f4f3ee" } + +Hide +Type '& ./docs/demo/setup.ps1; Remove-Item Env:NO_COLOR -ErrorAction SilentlyContinue; $env:APPDATA = "$env:TEMP\quill-demo\appdata"; Set-Location "$env:TEMP\quill-demo\slugs"; Clear-Host' +Enter +Sleep 3s +Show + +Type "quill" +Enter +Wait+Screen@60s /›/ +Sleep 1.5s +Type "npm test fails. Find out why and fix it." +Sleep 500ms +Enter +Wait+Screen@600s /Worked for/ +Sleep 5s \ No newline at end of file diff --git a/docs/demo/project/package.json b/docs/demo/project/package.json new file mode 100644 index 0000000..4d97c28 --- /dev/null +++ b/docs/demo/project/package.json @@ -0,0 +1,8 @@ +{ + "name": "slugs", + "version": "1.0.0", + "type": "module", + "scripts": { + "test": "node --test" + } +} \ No newline at end of file diff --git a/docs/demo/project/src/slug.js b/docs/demo/project/src/slug.js new file mode 100644 index 0000000..0f92600 --- /dev/null +++ b/docs/demo/project/src/slug.js @@ -0,0 +1,3 @@ +export function slugify(title) { + return title.toLowerCase().replace(/\s/g, '-'); +} \ No newline at end of file diff --git a/docs/demo/project/test/slug.test.js b/docs/demo/project/test/slug.test.js new file mode 100644 index 0000000..971d463 --- /dev/null +++ b/docs/demo/project/test/slug.test.js @@ -0,0 +1,11 @@ +import { test } from 'node:test'; +import assert from 'node:assert/strict'; +import { slugify } from '../src/slug.js'; + +test('joins words with single dashes', () => { + assert.equal(slugify('Hello World'), 'hello-world'); +}); + +test('drops punctuation and trims the ends', () => { + assert.equal(slugify(' Ship it, now! '), 'ship-it-now'); +}); \ No newline at end of file diff --git a/docs/demo/setup.ps1 b/docs/demo/setup.ps1 new file mode 100644 index 0000000..dec11b6 --- /dev/null +++ b/docs/demo/setup.ps1 @@ -0,0 +1,12 @@ +$demo = Join-Path $env:TEMP 'quill-demo' +$project = Join-Path $demo 'slugs' +$appdata = Join-Path $demo 'appdata' +if (Test-Path $demo) { Remove-Item $demo -Recurse -Force } +New-Item -ItemType Directory (Join-Path $appdata 'quill-code') -Force | Out-Null +Copy-Item (Join-Path $PSScriptRoot 'project') $project -Recurse +git -C $project init -q -b main +git -C $project add . +git -C $project -c user.name=Quill -c user.email=quill@localhost commit -q -m 'Add slugify' +$settings = Get-Content (Join-Path $env:APPDATA 'quill-code\settings.json') -Raw | ConvertFrom-Json +$settings.general.trusted = @($demo) +[IO.File]::WriteAllText((Join-Path $appdata 'quill-code\settings.json'), ($settings | ConvertTo-Json -Depth 20)) \ No newline at end of file diff --git a/docs/demo/tour.tape b/docs/demo/tour.tape new file mode 100644 index 0000000..1773cbf --- /dev/null +++ b/docs/demo/tour.tape @@ -0,0 +1,57 @@ +Output docs/demo/tour.gif + +Set Shell "powershell" +Set FontSize 16 +Set Width 1000 +Set Height 620 +Set Padding 20 +Set Framerate 10 +Set TypingSpeed 20ms +Set Theme { "name": "Quill", "background": "#1f1f1e", "foreground": "#e9e7e2", "cursor": "#e9e7e2", "selection": "#3a3936", "black": "#1f1f1e", "red": "#e5786d", "green": "#8fbf7f", "yellow": "#e0b56a", "blue": "#7193f5", "magenta": "#c79bd8", "cyan": "#6fc2c8", "white": "#d6d3cc", "brightBlack": "#7d7a73", "brightRed": "#f08a80", "brightGreen": "#a4d394", "brightYellow": "#ecc888", "brightBlue": "#8eabf8", "brightMagenta": "#d6b0e4", "brightCyan": "#8ad3d8", "brightWhite": "#f4f3ee" } + +Hide +Type '& ./docs/demo/setup.ps1; Remove-Item Env:NO_COLOR -ErrorAction SilentlyContinue; $env:APPDATA = "$env:TEMP\quill-demo\appdata"; Set-Location "$env:TEMP\quill-demo\slugs"; Clear-Host' +Enter +Sleep 3s +Show + +Type "quill" +Enter +Wait+Screen@60s /›/ +Shift+Tab +Wait+Screen@10s /Ask first/ +Type "Rename slugify to toSlug everywhere." +Enter +Wait+Screen@300s /Allow everything in this thread/ +Sleep 1s +Screenshot docs/images/approval.png +Sleep 2s +Escape +Sleep 1s +Escape +Sleep 3s + +Type "/model" +Sleep 500ms +Enter +Wait+Screen@20s /Pick the model that powers Quill/ +Sleep 1s +Screenshot docs/images/models.png +Sleep 2s +Escape +Sleep 1s +Ctrl+D +Sleep 3s + +Hide +Type "Clear-Host" +Enter +Sleep 1s +Show +Type 'quill exec --access auto "Run the tests and tell me which ones fail."' +Enter +Sleep 5s +Wait@300s />\s*$/ +Sleep 1s +Screenshot docs/images/exec.png +Sleep 2s \ No newline at end of file diff --git a/docs/images/approval.png b/docs/images/approval.png new file mode 100644 index 0000000..7847873 Binary files /dev/null and b/docs/images/approval.png differ diff --git a/docs/images/demo.gif b/docs/images/demo.gif new file mode 100644 index 0000000..4b278be Binary files /dev/null and b/docs/images/demo.gif differ diff --git a/docs/images/exec.png b/docs/images/exec.png new file mode 100644 index 0000000..002d699 Binary files /dev/null and b/docs/images/exec.png differ diff --git a/docs/images/models.png b/docs/images/models.png new file mode 100644 index 0000000..853e3bb Binary files /dev/null and b/docs/images/models.png differ diff --git a/install.ps1 b/install.ps1 new file mode 100644 index 0000000..0421e3e --- /dev/null +++ b/install.ps1 @@ -0,0 +1,69 @@ +& { + $ErrorActionPreference = 'Stop' + $ProgressPreference = 'SilentlyContinue' + $repo = 'Smoffyy/quill-code' + $version = if ($env:QUILL_VERSION) { $env:QUILL_VERSION } else { 'latest' } + $dir = if ($env:QUILL_INSTALL_DIR) { $env:QUILL_INSTALL_DIR } else { Join-Path $env:LOCALAPPDATA 'Programs\quill' } + $target = 'x86_64-pc-windows-msvc' + $archive = "quill-$target.zip" + + if ($env:QUILL_DOWNLOAD_URL) { + $base = $env:QUILL_DOWNLOAD_URL + } elseif ($version -eq 'latest') { + $base = "https://github.com/$repo/releases/latest/download" + } else { + $base = "https://github.com/$repo/releases/download/v$($version.TrimStart('v'))" + } + + function Get-QuillFile($name, $path) { + $source = "$base/$name" + if ($source -match '^https?://') { + [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 + Invoke-WebRequest -Uri $source -OutFile $path -UseBasicParsing + } else { + Copy-Item -LiteralPath (Join-Path $base $name) -Destination $path + } + } + + $work = Join-Path ([IO.Path]::GetTempPath()) ("quill-install-" + [Guid]::NewGuid()) + New-Item -ItemType Directory -Path $work | Out-Null + try { + Write-Host "Downloading quill for $target..." + Get-QuillFile $archive (Join-Path $work $archive) + Get-QuillFile 'SHA256SUMS' (Join-Path $work 'SHA256SUMS') + + $line = Get-Content (Join-Path $work 'SHA256SUMS') | Where-Object { $_ -match "\s\*?$([regex]::Escape($archive))$" } | Select-Object -First 1 + if (-not $line) { throw "The release has no checksum for $archive." } + $expected = ($line -split '\s+')[0] + $actual = (Get-FileHash -Algorithm SHA256 -LiteralPath (Join-Path $work $archive)).Hash + if ($expected -ne $actual) { throw 'The download is damaged (checksum mismatch). Try again.' } + + Expand-Archive -LiteralPath (Join-Path $work $archive) -DestinationPath (Join-Path $work 'files') -Force + New-Item -ItemType Directory -Path $dir -Force | Out-Null + $exe = Join-Path $dir 'quill.exe' + $old = "$exe.old" + if (Test-Path -LiteralPath $old) { Remove-Item -LiteralPath $old -Force -ErrorAction SilentlyContinue } + if (Test-Path -LiteralPath $exe) { Move-Item -LiteralPath $exe -Destination $old -Force } + Copy-Item -LiteralPath (Join-Path $work 'files\quill.exe') -Destination $exe + + $installed = & $exe --version + if ($LASTEXITCODE -ne 0) { throw "quill was copied to $dir but does not start." } + Write-Host "Installed $installed to $exe" + + $userPath = [Environment]::GetEnvironmentVariable('Path', 'User') + $parts = @($userPath -split ';' | Where-Object { $_ }) + $onPath = ($env:Path -split ';') -contains $dir + if ($onPath -or $parts -contains $dir) { + if (-not $onPath) { $env:Path = "$dir;$env:Path" } + Write-Host 'Run quill in any project folder to start.' + } elseif ($env:QUILL_NO_MODIFY_PATH) { + Write-Host "Add $dir to your PATH to run quill from anywhere." + } else { + [Environment]::SetEnvironmentVariable('Path', (@($dir) + $parts) -join ';', 'User') + $env:Path = "$dir;$env:Path" + Write-Host "Added $dir to your PATH. Run quill in any project folder to start." + } + } finally { + Remove-Item -LiteralPath $work -Recurse -Force -ErrorAction SilentlyContinue + } +} \ No newline at end of file diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..c528968 --- /dev/null +++ b/install.sh @@ -0,0 +1,119 @@ +#!/bin/sh +set -eu + +repo="Smoffyy/quill-code" +version="${QUILL_VERSION:-latest}" +dir="${QUILL_INSTALL_DIR:-$HOME/.local/bin}" + +say() { + printf '%s\n' "$*" +} + +fail() { + printf 'quill install: %s\n' "$*" >&2 + exit 1 +} + +case "$(uname -s)" in + Linux) system="unknown-linux-musl" ;; + Darwin) system="apple-darwin" ;; + *) fail "there is no quill build for $(uname -s). On Windows, run in PowerShell: irm https://github.com/$repo/releases/latest/download/install.ps1 | iex" ;; +esac + +machine="$(uname -m)" +if [ "$system" = "apple-darwin" ] && [ "$(sysctl -n sysctl.proc_translated 2>/dev/null || echo 0)" = "1" ]; then + machine="arm64" +fi +case "$machine" in + x86_64 | amd64) arch="x86_64" ;; + arm64 | aarch64) arch="aarch64" ;; + *) fail "there is no quill build for $machine processors yet." ;; +esac + +target="$arch-$system" +archive="quill-$target.tar.gz" +if [ -n "${QUILL_DOWNLOAD_URL:-}" ]; then + base="$QUILL_DOWNLOAD_URL" +elif [ "$version" = "latest" ]; then + base="https://github.com/$repo/releases/latest/download" +else + base="https://github.com/$repo/releases/download/v${version#v}" +fi + +fetch() { + case "$1" in + http://* | https://*) + if command -v curl >/dev/null 2>&1; then + curl -fsSL --retry 3 -o "$2" "$1" + elif command -v wget >/dev/null 2>&1; then + wget -q -O "$2" "$1" + else + fail "curl or wget is needed to download quill." + fi + ;; + *) cp "$1" "$2" ;; + esac +} + +work="$(mktemp -d)" +trap 'rm -rf "$work"' EXIT + +say "Downloading quill for $target..." +fetch "$base/$archive" "$work/$archive" || fail "could not download $base/$archive" +fetch "$base/SHA256SUMS" "$work/SHA256SUMS" || fail "could not download the checksums from $base" + +expected="$(grep " $archive\$" "$work/SHA256SUMS" | cut -d ' ' -f 1)" +[ -n "$expected" ] || fail "the release has no checksum for $archive." +if command -v sha256sum >/dev/null 2>&1; then + actual="$(sha256sum "$work/$archive" | cut -d ' ' -f 1)" +else + actual="$(shasum -a 256 "$work/$archive" | cut -d ' ' -f 1)" +fi +[ "$expected" = "$actual" ] || fail "the download is damaged (checksum mismatch). Try again." + +tar -xzf "$work/$archive" -C "$work" +mkdir -p "$dir" +cp "$work/quill" "$dir/quill.new" +chmod 755 "$dir/quill.new" +mv -f "$dir/quill.new" "$dir/quill" + +installed="$("$dir/quill" --version)" || fail "quill was copied to $dir but does not start." +say "Installed $installed to $dir/quill" + +case ":$PATH:" in + *":$dir:"*) + say "Run quill in any project folder to start." + exit 0 + ;; +esac + +if [ -n "${QUILL_NO_MODIFY_PATH:-}" ]; then + say "Add $dir to your PATH to run quill from anywhere." + exit 0 +fi + +line="export PATH=\"$dir:\$PATH\"" +case "$(basename "${SHELL:-sh}")" in + zsh) profiles="$HOME/.zshrc" ;; + bash) + if [ "$system" = "apple-darwin" ]; then + profiles="$HOME/.bash_profile" + else + profiles="$HOME/.bashrc" + fi + ;; + fish) + profiles="" + mkdir -p "$HOME/.config/fish/conf.d" + printf 'fish_add_path %s\n' "$dir" > "$HOME/.config/fish/conf.d/quill.fish" + ;; + *) profiles="$HOME/.profile" ;; +esac +for profile in $profiles; do + if ! grep -qsF "$line" "$profile"; then + printf '\n%s\n' "$line" >> "$profile" + say "Added $dir to your PATH in $profile." + fi +done + +say "Open a new terminal, then run quill in any project folder." \ No newline at end of file diff --git a/scripts/package.sh b/scripts/package.sh new file mode 100644 index 0000000..85310dd --- /dev/null +++ b/scripts/package.sh @@ -0,0 +1,37 @@ +#!/bin/sh +set -eu + +if [ "$#" -ne 3 ]; then + echo "usage: scripts/package.sh <target> <path to the quill binary> <output folder>" >&2 + exit 2 +fi + +target="$1" +binary="$2" +out="$3" +stage=$(mktemp -d) +trap 'rm -rf "$stage"' EXIT + +mkdir -p "$out" +cp "$binary" LICENSE README.md "$stage/" + +case "$target" in + *windows*) + name="quill-$target.zip" + rm -f "$out/$name" + powershell -NoProfile -Command "Compress-Archive -Path '$(cygpath -w "$stage")\\*' -DestinationPath '$(cygpath -w "$out")\\$name' -Force" + ;; + *) + name="quill-$target.tar.gz" + chmod 755 "$stage/quill" + tar -czf "$out/$name" -C "$stage" quill LICENSE README.md + ;; +esac + +cd "$out" +if command -v sha256sum >/dev/null 2>&1; then + sha256sum "$name" | sed 's/ [*]/ /' > "$name.sha256" +else + shasum -a 256 "$name" > "$name.sha256" +fi +echo "packed $out/$name" \ No newline at end of file