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
release: Linux packages in the Mac release, one latest.json for both
Lin (kwant bot)0ea12a6f50f8
diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.ymlindex 4c0cd103..6facf765 100644--- a/.github/workflows/linux.yml+++ b/.github/workflows/linux.yml@@ -2,13 +2,16 @@ name: linux# Builds kwant for Linux (x86_64): a .deb and an AppImage, from the same apps/mac Tauri app.# tauri.linux.conf.json switches the bundle targets; the Mac config and mac.yml are untouched.-# Pull requests and manual runs only: the packages are a workflow artifact, proving the app builds,-# installs and starts. Releases still come from mac.yml (mac-v* tags); Linux joins them later, in-# the same GitHub release, so the one latest.json keeps working for installed Macs.+# On pull requests and manual runs the packages are only a workflow artifact, proving the app builds,+# installs and starts. A mac-v* tag runs this from mac.yml (workflow_call), and mac.yml's release+# job puts the packages in the same GitHub release as the Mac app, with one latest.json for both,+# so installed Macs keep finding their updates.## Built on ubuntu-22.04 so the AppImage runs on distros with glibc 2.35 or newer. The updater-# artifacts (.AppImage.sig, .deb.sig) are signed with a throwaway key: no PR code sees the release key.+# artifacts (.AppImage.sig, .deb.sig) are signed with a throwaway key on pull requests and manual+# runs; only tag builds get the release key, so no PR code ever runs with it.on:+ workflow_call:workflow_dispatch:pull_request:paths:@@ -21,7 +24,8 @@ permissions:concurrency:group: linux-${{ github.ref }}- cancel-in-progress: true+ # never cancel a release half-way+ cancel-in-progress: ${{ !startsWith(github.ref, 'refs/tags/') }}env:CARGO_TERM_COLOR: always@@ -56,19 +60,34 @@ jobs:working-directory: apps/macrun: cargo test --locked- name: Throwaway updater key+ if: ${{ !startsWith(github.ref, 'refs/tags/mac-v') }}run: |set -euo pipefailopenssl rand -hex 16 > "$RUNNER_TEMP/ci-updater.password"npx --yes @tauri-apps/[email protected] signer generate --ci -w "$RUNNER_TEMP/ci-updater.key" -p "$(cat "$RUNNER_TEMP/ci-updater.password")" > /dev/nullcp "$RUNNER_TEMP/ci-updater.key.pub" "$RUNNER_TEMP/updater.pub"+ - name: Release updater key+ if: startsWith(github.ref, 'refs/tags/mac-v')+ run: python3 -c 'import json; print(json.load(open("apps/mac/tauri.conf.json"))["plugins"]["updater"]["pubkey"])' > "$RUNNER_TEMP/updater.pub"- name: Build the .deb and AppImageworking-directory: apps/mactimeout-minutes: 30+ env:+ IS_TAG: ${{ startsWith(github.ref, 'refs/tags/mac-v') }}+ TAURI_SIGNING_PRIVATE_KEY: ${{ startsWith(github.ref, 'refs/tags/mac-v') && secrets.TAURI_SIGNING_PRIVATE_KEY || '' }}+ TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ startsWith(github.ref, 'refs/tags/mac-v') && secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD || '' }}run: |set -euo pipefail- TAURI_SIGNING_PRIVATE_KEY=$(cat "$RUNNER_TEMP/ci-updater.key")- TAURI_SIGNING_PRIVATE_KEY_PASSWORD=$(cat "$RUNNER_TEMP/ci-updater.password")- export TAURI_SIGNING_PRIVATE_KEY TAURI_SIGNING_PRIVATE_KEY_PASSWORD+ if [ "$IS_TAG" = "true" ]; then+ if [ -z "$TAURI_SIGNING_PRIVATE_KEY" ]; then+ echo "::error::the repository secret TAURI_SIGNING_PRIVATE_KEY is missing, so installed apps couldn't verify this release"+ exit 1+ fi+ else+ TAURI_SIGNING_PRIVATE_KEY=$(cat "$RUNNER_TEMP/ci-updater.key")+ TAURI_SIGNING_PRIVATE_KEY_PASSWORD=$(cat "$RUNNER_TEMP/ci-updater.password")+ export TAURI_SIGNING_PRIVATE_KEY TAURI_SIGNING_PRIVATE_KEY_PASSWORD+ finpx --yes @tauri-apps/[email protected] build --ci --bundles deb,appimage \--config '{"bundle":{"createUpdaterArtifacts":true}}' -- --locked# The installed app only accepts an update whose signature matches the key built into it anddiff --git a/.github/workflows/mac.yml b/.github/workflows/mac.ymlindex 70751f74..cabfcf08 100644--- a/.github/workflows/mac.yml+++ b/.github/workflows/mac.yml@@ -12,6 +12,11 @@ name: mac# Pull requests and manual runs never see the release key: they sign with a throwaway key, so the# same steps run without the secret. A full release needs a non-empty "## [Mac x.y.z]" CHANGELOG section,# which becomes the update's notes.+#+# Linux: a tag also builds the Linux .deb and AppImage (linux.yml, called below) and the release+# carries them next to the Mac files, with linux-x86_64-* entries added after the darwin-* ones in+# the same latest.json. There is never a separate Linux release: it would become "latest" and hide+# the Mac latest.json from installed Macs.on:workflow_dispatch:pull_request:@@ -335,9 +340,19 @@ jobs:if-no-files-found: errorretention-days: 14+ # Same packages as linux.yml builds on pull requests, signed with the release key on tags.+ linux:+ name: linux+ needs: version+ if: startsWith(github.ref, 'refs/tags/mac-v')+ permissions:+ contents: read+ uses: ./.github/workflows/linux.yml+ secrets: inherit+release:name: release- needs: [version, dmg]+ needs: [version, dmg, linux]if: startsWith(github.ref, 'refs/tags/mac-v')runs-on: ubuntu-latesttimeout-minutes: 10@@ -367,11 +382,24 @@ jobs:cp "$tarball" kwant_universal.app.tar.gzcp "$tarball.sig" kwant_universal.app.tar.gz.sigassets=(kwant_universal.dmg kwant_universal.dmg.sha256 kwant_universal.app.tar.gz kwant_universal.app.tar.gz.sig)+ # Linux (from linux.yml): the updater downloads the package itself and checks its .sig+ deb=$(find dist -type f -name '*_amd64.deb' | head -1)+ appimage=$(find dist -type f -name '*_amd64.AppImage' | head -1)+ test -n "$deb" && test -f "$deb.sig" && test -n "$appimage" && test -f "$appimage.sig"+ cp "$deb" kwant_amd64.deb+ cp "$deb.sig" kwant_amd64.deb.sig+ cp "$appimage" kwant_x86_64.AppImage+ cp "$appimage.sig" kwant_x86_64.AppImage.sig+ for f in kwant_amd64.deb kwant_x86_64.AppImage; do sha256sum "$f" > "$f.sha256"; done+ assets+=(kwant_amd64.deb kwant_amd64.deb.sig kwant_amd64.deb.sha256 kwant_x86_64.AppImage kwant_x86_64.AppImage.sig kwant_x86_64.AppImage.sha256)+ dl="https://github.com/$GITHUB_REPOSITORY/releases/download/$TAG"# Installed apps read releases/latest/download/latest.json, which only ever resolves to the# newest full release; a prerelease gets no latest.json, so it's never offered as an updateif [ "$PRERELEASE" != "true" ]; thenpython3 scripts/mac_latest_json.py --version "$VERSION" --signature kwant_universal.app.tar.gz.sig \- --url "https://github.com/$GITHUB_REPOSITORY/releases/download/$TAG/kwant_universal.app.tar.gz" > latest.json+ --url "$dl/kwant_universal.app.tar.gz" \+ --linux linux-x86_64-appimage kwant_x86_64.AppImage.sig "$dl/kwant_x86_64.AppImage" \+ --linux linux-x86_64-deb kwant_amd64.deb.sig "$dl/kwant_amd64.deb" > latest.jsoncat latest.jsonassets+=(latest.json)fi@@ -390,6 +418,10 @@ jobs:The app runs kwant on your Mac with the same data folder as \`kwnt serve\` (\`~/.kwnt\`) and stays in the menu bar when you close the window.SHA-256: \`$(cut -d' ' -f1 kwant_universal.dmg.sha256)\`++ **Linux (beta, x86_64):** \`kwant_amd64.deb\` for Ubuntu 22.04 or later and Debian 12 (\`sudo apt install ./kwant_amd64.deb\`), or \`kwant_x86_64.AppImage\` for other distros with a GTK desktop (\`chmod +x\` it and run it). Both update themselves in the app.++ SHA-256: \`$(cut -d' ' -f1 kwant_amd64.deb.sha256)\` (.deb), \`$(cut -d' ' -f1 kwant_x86_64.AppImage.sha256)\` (AppImage)NOTESsed -i 's/^ //' notes.mdflags=()diff --git a/scripts/mac_latest_json.py b/scripts/mac_latest_json.pyindex 7104d380..3ba1553a 100644--- a/scripts/mac_latest_json.py+++ b/scripts/mac_latest_json.py@@ -1,14 +1,24 @@#!/usr/bin/env python3-"""Writes latest.json, the feed the Mac app's updater reads, for one Mac release.+"""Writes latest.json, the feed the desktop app's updater reads, for one release.The app asks https://github.com/alexsergivan/kwant/releases/latest/download/latest.json, so onlythe newest non-prerelease release's file counts. The release notes are that version's CHANGELOGsection ("## [Mac 0.1.2] - 2026-10-27"); a release without one fails here, before anything ispublished. Both Mac architectures point at the same universal app.+The Linux app (AppImage and .deb) ships in the same release, so the one latest.json serves both.+Its entries are optional and only ever added after the Mac ones: the updater looks up+`{os}-{arch}-{installer}` and then `{os}-{arch}`, so a Mac reads `darwin-*` and never sees them,+and there is no bare `linux-x86_64` entry that an AppImage and a .deb would both match.+python3 scripts/mac_latest_json.py --version 0.1.2 --signature kwant.app.tar.gz.sig \\--url https://github.com/alexsergivan/kwant/releases/download/mac-v0.1.2/kwant_universal.app.tar.gz \\> latest.json++ # the same, plus the Linux packages+ python3 scripts/mac_latest_json.py ... \\+ --linux linux-x86_64-appimage kwant_x86_64.AppImage.sig https://.../kwant_x86_64.AppImage \\+ --linux linux-x86_64-deb kwant_amd64.deb.sig https://.../kwant_amd64.deb > latest.json"""import argparse@@ -18,6 +28,8 @@ import reimport sysPLATFORMS = ("darwin-aarch64", "darwin-x86_64")+# What the Linux app looks up first (tauri-plugin-updater: `{os}-{arch}-{installer}`)+LINUX_PLATFORMS = ("linux-x86_64-appimage", "linux-x86_64-deb")VERSION = re.compile(r"^\d+\.\d+\.\d+$")@@ -45,7 +57,18 @@ def release_notes(changelog: str, version: str) -> str:return notes-def latest_json(version: str, signature: str, url: str, notes: str, pub_date: str) -> dict:+def _entry(signature: str, url: str) -> dict:+ signature = signature.strip()+ if not signature:+ raise ValueError("the signature is empty")+ if not url.startswith("https://"):+ raise ValueError("the download URL must be https")+ return {"signature": signature, "url": url}+++def latest_json(version: str, signature: str, url: str, notes: str, pub_date: str,+ linux=None) -> dict:+ """`linux` maps a LINUX_PLATFORMS key to its (signature, url); its entries follow the Mac ones."""if not VERSION.match(version):raise ValueError(f"'{version}' is not a release version (x.y.z); prereleases get no latest.json")signature = signature.strip()@@ -56,11 +79,16 @@ def latest_json(version: str, signature: str, url: str, notes: str, pub_date: stif not notes:raise ValueError(f"the CHANGELOG section for {version} is empty")entry = {"signature": signature, "url": url}+ platforms = {p: dict(entry) for p in PLATFORMS}+ for key, (sig, link) in (linux or {}).items():+ if key not in LINUX_PLATFORMS:+ raise ValueError(f"'{key}' is not a Linux platform ({', '.join(LINUX_PLATFORMS)})")+ platforms[key] = _entry(sig, link)return {"version": version,"notes": notes,"pub_date": pub_date,- "platforms": {p: dict(entry) for p in PLATFORMS},+ "platforms": platforms,}@@ -71,6 +99,8 @@ def main(argv=None) -> int:help="only check that the CHANGELOG section exists and isn't empty")ap.add_argument("--signature", help="the .sig file the Tauri build wrote")ap.add_argument("--url", help="where the release serves the .app.tar.gz")+ ap.add_argument("--linux", nargs=3, action="append", default=[], metavar=("PLATFORM", "SIG", "URL"),+ help=f"add a Linux package: one of {', '.join(LINUX_PLATFORMS)}, its .sig file and URL")ap.add_argument("--changelog", default="CHANGELOG.md")ap.add_argument("--pub-date", help="RFC 3339; default now (UTC)")args = ap.parse_args(argv)@@ -84,7 +114,13 @@ def main(argv=None) -> int:return 0with open(args.signature, encoding="utf-8") as f:signature = f.read()- doc = latest_json(args.version, signature, args.url, notes, pub_date)+ linux = {}+ for key, sig_file, link in args.linux:+ if key in linux:+ raise ValueError(f"{key} is given twice")+ with open(sig_file, encoding="utf-8") as f:+ linux[key] = (f.read(), link)+ doc = latest_json(args.version, signature, args.url, notes, pub_date, linux)except (OSError, ValueError) as e:print(f"mac_latest_json: {e}", file=sys.stderr)return 1diff --git a/scripts/test_mac_latest_json.py b/scripts/test_mac_latest_json.pyindex e6e3f4e0..c186ab43 100644--- a/scripts/test_mac_latest_json.py+++ b/scripts/test_mac_latest_json.py@@ -135,5 +135,93 @@ class Cli(unittest.TestCase):self.assertTrue(m.changelog_section(text, "0.1.1"))+# What scripts/mac_latest_json.py wrote at main 72a8ac5 (Mac 0.6.0) for the inputs in MacBytes.+# Installed Macs parse this file; adding Linux must not change a byte of it.+MAC_ONLY_GOLDEN = """{+ "version": "0.1.2",+ "notes": "### Added\\n- **In-app updates.** \u201cquotes\u201d and \u00fcn\u00efcode.",+ "pub_date": "2026-10-27T10:00:00Z",+ "platforms": {+ "darwin-aarch64": {+ "signature": "c2lnbmF0dXJl",+ "url": "https://github.com/alexsergivan/kwant/releases/download/mac-v0.1.2/kwant_universal.app.tar.gz"+ },+ "darwin-x86_64": {+ "signature": "c2lnbmF0dXJl",+ "url": "https://github.com/alexsergivan/kwant/releases/download/mac-v0.1.2/kwant_universal.app.tar.gz"+ }+ }+}+"""++DL = "https://github.com/alexsergivan/kwant/releases/download/mac-v0.1.2/"+++class MacBytes(unittest.TestCase):+ """The Linux entries are extra keys after the Mac ones; the Mac part of the file stays as it was."""++ def feed(self, *linux):+ with tempfile.TemporaryDirectory() as d:+ cl, sig = os.path.join(d, "CHANGELOG.md"), os.path.join(d, "a.sig")+ with open(cl, "w", encoding="utf-8") as f:+ f.write("## [Mac 0.1.2] - 2026-10-27\n\n### Added\n- **In-app updates.** \u201cquotes\u201d and \u00fcn\u00efcode.\n")+ with open(sig, "w", encoding="utf-8") as f:+ f.write("c2lnbmF0dXJl\n")+ args = ["--version", "0.1.2", "--signature", sig, "--url", DL + "kwant_universal.app.tar.gz",+ "--changelog", cl, "--pub-date", "2026-10-27T10:00:00Z"]+ for key, name in linux:+ path = os.path.join(d, name + ".sig")+ with open(path, "w", encoding="utf-8") as f:+ f.write(f"sig-of-{name}\n")+ args += ["--linux", key, path, DL + name]+ out, err = io.StringIO(), io.StringIO()+ with contextlib.redirect_stdout(out), contextlib.redirect_stderr(err):+ code = m.main(args)+ self.assertEqual(code, 0, err.getvalue())+ return out.getvalue()++ def test_mac_only_feed_is_byte_identical_to_main(self):+ self.assertEqual(self.feed(), MAC_ONLY_GOLDEN)++ def test_adding_linux_leaves_every_darwin_entry_byte_identical(self):+ both = self.feed(("linux-x86_64-appimage", "kwant_x86_64.AppImage"), ("linux-x86_64-deb", "kwant_amd64.deb"))+ doc = json.loads(both)+ self.assertEqual(list(doc["platforms"]),+ ["darwin-aarch64", "darwin-x86_64", "linux-x86_64-appimage", "linux-x86_64-deb"])+ self.assertEqual(doc["platforms"]["linux-x86_64-appimage"],+ {"signature": "sig-of-kwant_x86_64.AppImage", "url": DL + "kwant_x86_64.AppImage"})+ self.assertEqual(doc["platforms"]["linux-x86_64-deb"],+ {"signature": "sig-of-kwant_amd64.deb", "url": DL + "kwant_amd64.deb"})+ # drop the Linux keys and the file is, byte for byte, the Mac-only one+ for key in m.LINUX_PLATFORMS:+ del doc["platforms"][key]+ self.assertEqual(json.dumps(doc, indent=2, ensure_ascii=False) + "\n", MAC_ONLY_GOLDEN)+ # and the darwin lines are a verbatim prefix of the file a Mac downloads+ cut = MAC_ONLY_GOLDEN.rindex(' }\n }\n}\n') + len(" }")+ self.assertTrue(both.startswith(MAC_ONLY_GOLDEN[:cut] + ",\n"), both)++ def test_no_bare_linux_key_and_no_unknown_key(self):+ for key in ("linux-x86_64", "linux-aarch64-appimage", "darwin-aarch64", "windows-x86_64-nsis"):+ with self.subTest(key=key), self.assertRaises(ValueError):+ m.latest_json("0.1.2", "s", URL, "n", "2026-10-27T10:00:00Z", {key: ("s", URL)})++ def test_bad_linux_entries_are_refused(self):+ for sig, url in [(" \n", URL), ("s", "http://example.com/kwant.deb")]:+ with self.subTest(sig=sig, url=url), self.assertRaises(ValueError):+ m.latest_json("0.1.2", "s", URL, "n", "2026-10-27T10:00:00Z", {"linux-x86_64-deb": (sig, url)})++ def test_a_platform_given_twice_fails(self):+ with tempfile.TemporaryDirectory() as d:+ cl, sig = os.path.join(d, "CHANGELOG.md"), os.path.join(d, "a.sig")+ open(cl, "w").write(CHANGELOG)+ open(sig, "w").write("s")+ err = io.StringIO()+ with contextlib.redirect_stdout(io.StringIO()), contextlib.redirect_stderr(err):+ code = m.main(["--version", "0.1.2", "--signature", sig, "--url", URL, "--changelog", cl,+ "--linux", "linux-x86_64-deb", sig, URL, "--linux", "linux-x86_64-deb", sig, URL])+ self.assertEqual(code, 1)+ self.assertIn("twice", err.getvalue())++if __name__ == "__main__":unittest.main()