Your own team of AI bots in one self-hosted binary: spaces, every account you have, handoffs, approvals and routines. Open-source, self-hosted alternative to Grok Bot, Claude Duet and OpenAI dots. Rust + React.
Rust ai-agentsai-assistantai-botautomationbotbots-teamchatbotclaude-duetgrokgrok-botgrok-bot-alternativeharnessllmmulti-agentopenai-dotsopenbotpersonal-agentrustself-hostedselfhosted-ai
0.7.7: Windows installer on the release, Windows tests on main (#451)
Oleksandr Ivanchenkod92d75fcaa54
diff --git a/.github/workflows/windows-release.yml b/.github/workflows/windows-release.ymlnew file mode 100644index 00000000..50b0bcb5--- /dev/null+++ b/.github/workflows/windows-release.yml@@ -0,0 +1,332 @@+name: windows release++# Puts the Windows (beta) installer on a release that mac.yml publishes. A mac-v* tag starts both+# workflows; they share nothing, and this one never decides anything about the Mac/Linux release:+#+# - It builds the NSIS installer from the tag's commit, checks its version against the tag, installs+# it silently, starts it and checks /api/health, then checksums it as+# kwant_<version>_windows_x64_beta_setup.exe (+ .sha256).+# - It never creates, retitles, deletes or re-marks a release, and never touches latest.json. The+# publish job only waits (at most WAIT_MINUTES) for mac.yml's release of that tag to be published+# (not a draft), uploads the two files with --clobber, and adds one "### Windows (beta)" section to+# the notes if it isn't there yet. So a Windows failure (build, smoke test, the wait running out)+# leaves the Mac/Linux release, its assets and latest.json exactly as mac.yml made them, and a rerun+# is safe.+# - To attach the installer by hand later (say the Mac release came after the wait): Run workflow+# with tag = mac-vX.Y.Z and dry_run off.+#+# Dry run: pull requests that change this file, and Run workflow with dry_run on (the default), do+# everything up to the upload and keep the installer as a workflow artifact.+on:+ push:+ tags:+ - "mac-v*"+ pull_request:+ branches: [main]+ paths:+ - ".github/workflows/windows-release.yml"+ workflow_dispatch:+ inputs:+ tag:+ description: "Tag to build (mac-vX.Y.Z). Empty: the selected branch, dry run only."+ required: false+ default: ""+ dry_run:+ description: "Build, test and checksum only; don't touch the release"+ type: boolean+ default: true++permissions:+ contents: read++concurrency:+ group: windows-release-${{ inputs.tag || github.ref }}+ # never cancel an upload half-way+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}++env:+ CARGO_TERM_COLOR: always+ CARGO_INCREMENTAL: 0++jobs:+ version:+ name: version+ runs-on: ubuntu-latest+ timeout-minutes: 5+ outputs:+ tag: ${{ steps.which.outputs.tag }}+ ref: ${{ steps.which.outputs.ref }}+ upload: ${{ steps.which.outputs.upload }}+ version: ${{ steps.check.outputs.version }}+ base: ${{ steps.check.outputs.base }}+ steps:+ - name: Which tag, and whether to upload+ id: which+ env:+ EVENT: ${{ github.event_name }}+ REF_NAME: ${{ github.ref_name }}+ IN_TAG: ${{ inputs.tag }}+ IN_DRY: ${{ inputs.dry_run }}+ run: |+ set -euo pipefail+ tag=""; upload=false+ case "$EVENT" in+ push) tag="$REF_NAME"; upload=true ;;+ workflow_dispatch)+ tag="$IN_TAG"+ if [ "$IN_DRY" = "false" ]; then+ if [ -z "$tag" ]; then echo "::error::an upload needs a tag (mac-vX.Y.Z)"; exit 1; fi+ upload=true+ fi ;;+ esac+ ref=""+ if [ -n "$tag" ]; then+ if ! printf '%s' "$tag" | grep -Eq '^mac-v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.]+)?$'; then+ echo "::error::$tag isn't a mac-vX.Y.Z tag"; exit 1+ fi+ ref="refs/tags/$tag"+ fi+ echo "event $EVENT, tag '${tag:-none}', upload $upload"+ { echo "tag=$tag"; echo "ref=$ref"; echo "upload=$upload"; } >> "$GITHUB_OUTPUT"+ - uses: actions/checkout@v4+ with:+ ref: ${{ steps.which.outputs.ref }}+ # The installer's version comes from apps/mac/tauri.conf.json (file name, the .exe's version+ # info), the app's from apps/mac/Cargo.toml, and the kwnt inside it (/api/health) from the root+ # Cargo.toml. The release commit bumps all three with both Cargo.locks; they must agree with the tag.+ - name: Tag matches the app and kwnt versions+ id: check+ env:+ TAG: ${{ steps.which.outputs.tag }}+ run: |+ set -euo pipefail+ cargo=$(sed -n 's/^version = "\(.*\)"/\1/p' apps/mac/Cargo.toml | head -1)+ tauri=$(python3 -c 'import json;print(json.load(open("apps/mac/tauri.conf.json"))["version"])')+ kwnt=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)+ win=$(python3 -c 'import json;print(json.load(open("apps/mac/tauri.windows.conf.json")).get("version",""))')+ if [ -n "$win" ]; then+ echo "::error::apps/mac/tauri.windows.conf.json sets its own version ($win); the release bump doesn't cover it"; exit 1+ fi+ if [ -n "$TAG" ]; then version="${TAG#mac-v}"; else version="$tauri"; fi+ base="${version%%-*}"+ echo "version $version (base $base); apps/mac/Cargo.toml $cargo; tauri.conf.json $tauri; kwnt $kwnt"+ if [ "$base" != "$cargo" ] || [ "$base" != "$tauri" ] || [ "$base" != "$kwnt" ]; then+ echo "::error::version $base doesn't match apps/mac $cargo (tauri.conf.json $tauri, kwnt Cargo.toml $kwnt)"; exit 1+ fi+ { echo "version=$version"; echo "base=$base"; } >> "$GITHUB_OUTPUT"++ frontend:+ name: frontend+ needs: version+ runs-on: ubuntu-latest+ timeout-minutes: 15+ defaults:+ run:+ working-directory: frontend+ steps:+ - uses: actions/checkout@v4+ with:+ ref: ${{ needs.version.outputs.ref }}+ - uses: actions/setup-node@v4+ with:+ node-version: 20+ cache: npm+ cache-dependency-path: frontend/package-lock.json+ - run: npm ci+ - run: npm run build+ - uses: actions/upload-artifact@v4+ with:+ name: frontend-dist+ path: frontend/dist+ retention-days: 1++ installer:+ name: installer (windows)+ needs: [version, frontend]+ runs-on: windows-latest+ timeout-minutes: 60+ outputs:+ name: ${{ steps.file.outputs.name }}+ sha256: ${{ steps.file.outputs.sha256 }}+ steps:+ - uses: actions/checkout@v4+ with:+ ref: ${{ needs.version.outputs.ref }}+ - uses: actions/download-artifact@v4+ with:+ name: frontend-dist+ path: frontend/dist+ - uses: actions/setup-node@v4+ with:+ node-version: 20+ - uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable+ - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3+ with:+ workspaces: apps/mac -> target+ - name: Build the NSIS installer+ working-directory: apps/mac+ shell: bash+ run: npx --yes @tauri-apps/[email protected] build --ci --bundles nsis -- --locked+ - name: Name, version and checksum+ id: file+ shell: pwsh+ env:+ VERSION: ${{ needs.version.outputs.version }}+ BASE: ${{ needs.version.outputs.base }}+ run: |+ $ErrorActionPreference = 'Stop'+ $built = @(Get-ChildItem apps/mac/target/release/bundle/nsis/*-setup.exe)+ if ($built.Count -ne 1) { Write-Error "expected one NSIS installer, found $($built.Count)"; exit 1 }+ $exe = $built[0]+ "built: {0} {1:N1} MB" -f $exe.Name, ($exe.Length / 1MB)+ if ($exe.Name -ne "kwant_$($env:BASE)_x64-setup.exe") { Write-Error "the installer is $($exe.Name), not version $($env:BASE)"; exit 1 }+ $pv = $exe.VersionInfo.ProductVersion+ "installer ProductVersion: $pv"+ if (-not "$pv".StartsWith($env:BASE)) { Write-Error "the installer's ProductVersion is '$pv', not $($env:BASE)"; exit 1 }+ New-Item -ItemType Directory -Force out | Out-Null+ $name = "kwant_$($env:VERSION)_windows_x64_beta_setup.exe"+ $dest = Join-Path (Resolve-Path out) $name+ Copy-Item $exe.FullName $dest+ $hash = (Get-FileHash -Algorithm SHA256 $dest).Hash.ToLowerInvariant()+ # sha256sum's format, so `sha256sum -c` works on it+ [System.IO.File]::WriteAllText("$dest.sha256", "$hash $name`n")+ Get-Content "$dest.sha256"+ "path=$dest" >> $env:GITHUB_OUTPUT+ "name=$name" >> $env:GITHUB_OUTPUT+ "sha256=$hash" >> $env:GITHUB_OUTPUT+ - name: Silent install, start, /api/health reports the version, quit, uninstall+ shell: pwsh+ env:+ SETUP: ${{ steps.file.outputs.path }}+ BASE: ${{ needs.version.outputs.base }}+ run: |+ $ErrorActionPreference = 'Stop'+ $install = Start-Process -FilePath $env:SETUP -ArgumentList '/S' -Wait -PassThru+ if ($install.ExitCode -ne 0) { Write-Error "the installer exited with $($install.ExitCode)"; exit 1 }+ $dir = Join-Path $env:LOCALAPPDATA 'kwant'+ $app = Join-Path $dir 'kwant.exe'+ if (-not (Test-Path $app)) { Write-Error "kwant.exe isn't in $dir after a per-user install"; exit 1 }+ $fv = (Get-Item $app).VersionInfo+ "kwant.exe ProductVersion $($fv.ProductVersion), FileVersion $($fv.FileVersion)"+ if (-not "$($fv.ProductVersion)".StartsWith($env:BASE)) { Write-Error "the installed kwant.exe says $($fv.ProductVersion), not $($env:BASE)"; exit 1 }++ $proc = Start-Process -FilePath $app -PassThru+ $health = $null+ $deadline = (Get-Date).AddSeconds(120)+ while ((Get-Date) -lt $deadline -and -not $health) {+ if ($proc.HasExited) { break }+ try {+ $r = Invoke-WebRequest -UseBasicParsing -TimeoutSec 3 'http://127.0.0.1:8799/api/health'+ if ($r.StatusCode -eq 200) { $health = $r.Content }+ } catch { Start-Sleep -Milliseconds 500 }+ }+ $log = Join-Path $env:USERPROFILE '.kwnt\desktop-app.log'+ if (-not $health) {+ "app exited: $($proc.HasExited)"+ if (Test-Path $log) { Get-Content $log -Tail 80 }+ Write-Error "kwant inside the app never answered /api/health"; exit 1+ }+ "/api/health: $health"+ $json = $health | ConvertFrom-Json+ if ($json.app -ne 'kwnt' -or $json.version -ne $env:BASE) { Write-Error "kwnt in the app reports $($json.version), not $($env:BASE)"; exit 1 }++ Stop-Process -Id $proc.Id+ $proc.WaitForExit(15000) | Out-Null+ Get-Process kwant -ErrorAction SilentlyContinue | Stop-Process -Force+ $uninstaller = Join-Path $dir 'uninstall.exe'+ if (Test-Path $uninstaller) {+ $u = Start-Process -FilePath $uninstaller -ArgumentList '/S' -Wait -PassThru+ "uninstall exit code: $($u.ExitCode)"+ }+ - uses: actions/upload-artifact@v4+ with:+ name: kwant-windows-installer-release+ path: |+ out/${{ steps.file.outputs.name }}+ out/${{ steps.file.outputs.name }}.sha256+ if-no-files-found: error+ retention-days: 14++ # The only job that can write, and only to an existing release: it never creates one.+ publish:+ name: attach to the release+ needs: [version, installer]+ if: needs.version.outputs.upload == 'true'+ runs-on: ubuntu-latest+ # the wait below plus the upload+ timeout-minutes: 140+ permissions:+ contents: write+ env:+ GH_TOKEN: ${{ github.token }}+ TAG: ${{ needs.version.outputs.tag }}+ VERSION: ${{ needs.version.outputs.version }}+ NAME: ${{ needs.installer.outputs.name }}+ SHA256: ${{ needs.installer.outputs.sha256 }}+ # mac.yml publishes ~40-60 min after the tag (the .dmg build alone is 21-30 min)+ WAIT_MINUTES: 120+ steps:+ - uses: actions/download-artifact@v4+ with:+ name: kwant-windows-installer-release+ path: out+ - name: Check the files+ working-directory: out+ run: |+ set -euo pipefail+ ls -l+ sha256sum -c "$NAME.sha256"+ test "$(cut -d' ' -f1 "$NAME.sha256")" = "$SHA256"+ # mac.yml's `gh release create … assets` makes a draft first, uploads ~200 MB, then publishes it+ # as latest. `gh release view TAG` finds that draft too, so only a published release counts:+ # touching it while it's a draft could race mac.yml's publish (and the latest guard below).+ - name: Wait for mac.yml's release of the tag to be published+ run: |+ set -euo pipefail+ for i in $(seq 1 "$WAIT_MINUTES"); do+ state=$(gh release view "$TAG" -R "$GITHUB_REPOSITORY" --json isDraft -q .isDraft 2>/dev/null || true)+ case "$state" in+ false) echo "the $TAG release is published (after ~$((i - 1)) min)"; exit 0 ;;+ true) echo "the $TAG release is still a draft (mac.yml is uploading); waiting" ;;+ *) echo "no $TAG release yet; waiting" ;;+ esac+ sleep 60+ done+ echo "::error::no published $TAG release after $WAIT_MINUTES minutes. The Mac/Linux release is untouched. Once it's published, Run workflow with tag=$TAG and dry_run off."+ exit 1+ - name: Upload the installer and add the Windows line to the notes+ run: |+ set -euo pipefail+ R="$GITHUB_REPOSITORY"+ # published, again: never upload to or edit a draft mac.yml is still filling+ state=$(gh release view "$TAG" -R "$R" --json isDraft -q .isDraft)+ if [ "$state" != "false" ]; then+ echo "::error::the $TAG release isn't published (isDraft: $state); nothing was uploaded"; exit 1+ fi+ latest_before=$(gh api "repos/$R/releases/latest" -q .tag_name 2>/dev/null || true)+ gh release upload "$TAG" -R "$R" --clobber "out/$NAME" "out/$NAME.sha256"+ gh release view "$TAG" -R "$R" --json body -q .body > notes.md+ if grep -q '^### Windows (beta)' notes.md; then+ echo "the notes already have the Windows (beta) section"+ else+ {+ printf '\n\n### Windows (beta)\n\n'+ printf '%s\n' "\`$NAME\` for 64-bit Windows installs for your user only, with no admin rights. It isn't code-signed yet, so the first time you run it Windows SmartScreen warns about an unrecognized app: click **More info**, then **Run anyway**. SHA-256: \`$SHA256\`"+ } >> notes.md+ gh release edit "$TAG" -R "$R" --notes-file notes.md+ fi+ # Editing notes must never move "latest" (installed apps read releases/latest/download/latest.json)+ latest_after=$(gh api "repos/$R/releases/latest" -q .tag_name 2>/dev/null || true)+ if [ "$latest_before" != "$latest_after" ]; then+ echo "::error::the latest release moved from $latest_before to $latest_after; putting it back"+ if [ -n "$latest_before" ]; then gh release edit "$latest_before" -R "$R" --latest; fi+ exit 1+ fi+ - name: Check the release's copy+ run: |+ set -euo pipefail+ mkdir check && cd check+ gh release download "$TAG" -R "$GITHUB_REPOSITORY" --pattern "$NAME" --pattern "$NAME.sha256"+ sha256sum -c "$NAME.sha256"+ test "$(cut -d' ' -f1 "$NAME.sha256")" = "$SHA256"+ echo "https://github.com/$GITHUB_REPOSITORY/releases/download/$TAG/$NAME"diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.ymlindex fb91363b..1298d7b2 100644--- a/.github/workflows/windows.yml+++ b/.github/workflows/windows.yml@@ -1,10 +1,14 @@name: Windows-# The Windows port (0.7.6, branch win-076). Runs only on win-* branches and by hand,-# so it never touches the Mac and Linux releases.+# Windows (beta, since 0.7.7): build, clippy and the Windows tests on every pull request to main and+# every push to main, so main can't break Windows without anyone noticing, plus the installer job.+# win-* branches still run it too. It never publishes anything: the installer on a release comes+# from windows-release.yml, which only adds files to mac.yml's release.on:push:- branches: ['win-*']+ branches: [main, 'win-*']+ pull_request:+ branches: [main]workflow_dispatch:permissions:@@ -12,7 +16,8 @@ permissions:concurrency:group: windows-${{ github.ref }}- cancel-in-progress: true+ # every push to main gets its own full run+ cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}env:CARGO_TERM_COLOR: always@@ -75,7 +80,23 @@ jobs:# of the gate above (next-076/windows/plan.md, "Tests not ported").- name: Dev mode git readers (head_branch, fresh reviews, diff paths)timeout-minutes: 15- run: 'cargo test --locked --lib --no-fail-fast -- server::dev::floor:: server::dev::poller::tests::fresh_means server::dev::poller::tests::candidates_go_newest server::dev::poller::tests::the_skipped_count server::dev::git::tests::diff_output_parses server::dev::git::tests::patches_are_matched'+ shell: bash+ env:+ # Exactly this many tests must run (Rigel's F-2): a renamed or moved test that no longer+ # matches the filters fails here instead of quietly dropping out. Change it with the filters.+ EXPECTED_TESTS: 13+ run: |+ set -euo pipefail+ cargo test --locked --lib --no-fail-fast -- server::dev::floor:: server::dev::poller::tests::fresh_means server::dev::poller::tests::candidates_go_newest server::dev::poller::tests::the_skipped_count server::dev::git::tests::diff_output_parses server::dev::git::tests::patches_are_matched 2>&1 | tee dev-readers.log+ read -r results passed failed ignored < <(awk '/test result:/ { n+++ for (i = 1; i < NF; i++) { w = $(i + 1); gsub(/[;,]/, "", w)+ if (w == "passed") p += $i; if (w == "failed") f += $i; if (w == "ignored") g += $i } }+ END { print n + 0, p + 0, f + 0, g + 0 }' dev-readers.log)+ echo "test binaries: $results; passed $passed, failed $failed, ignored $ignored; expected $EXPECTED_TESTS passed"+ if [ "$results" != 1 ] || [ "$passed" != "$EXPECTED_TESTS" ] || [ "$failed" != 0 ] || [ "$ignored" != 0 ]; then+ echo "::error::Dev mode git readers ran $passed tests (failed $failed, ignored $ignored), expected exactly $EXPECTED_TESTS"+ exit 1+ fi- name: Windows integration tests (bash, Stop ends the process tree)timeout-minutes: 20run: cargo test --locked --no-fail-fast --test shell_stop_tree_test --test shell_tool_testdiff --git a/CHANGELOG.md b/CHANGELOG.mdindex 3cbeb450..5eaeda39 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).## Unreleased### Added+- **kwant for Windows (beta).** kwant now has a Windows app for 64-bit Windows. Each release has an installer, `kwant_X.Y.Z_windows_x64_beta_setup.exe`, with its SHA-256. It installs for your user only, so it needs no admin rights, and it runs kwant on your PC with the same data folder as `kwnt serve` (`.kwnt` in your user folder). The installer isn't code-signed yet, so the first time you run it Windows SmartScreen warns about an unrecognized app: click **More info**, then **Run anyway**. In the beta, the app doesn't update itself (a new version is a new installer), Grok, the isolated computer (bots work on your own computer instead) and looking inside videos aren't available on Windows yet. Dev mode works, with one difference: in a folder that OneDrive syncs with "Files On-Demand", kwant can't safely read the repository's git files, so Dev mode asks you before every push from that folder.- **Get started offers to bring your bots.** Step 3, "Pick a team", has a new "Bring your bots" tile next to "Keep the starter bots". It opens the same importer as Space settings › Import bots, so you can bring a bot from Grok Bot, ChatGPT or Claude, or from a file, and check a preview first. A finished import completes step 3. Closing the importer without importing leaves step 3 as it was.- **Import several bots at once.** The importer's "Upload a file" now takes several files in one pick or drop, for example every Grok Bot export you have. You don't need to zip them yourself. kwant packs them into one zip in your browser and shows one preview with every bot, plus the names of any files it couldn't read. Picks are limited to 500 files and 20 MB in all, and a zip can only be imported on its own.