diff options
| author | Adam Malczewski <[email protected]> | 2026-06-04 21:21:20 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-06-04 21:21:20 +0900 |
| commit | 394f1ed37ce860da6fdc385769bf29f9737105cd (patch) | |
| tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 /packaging | |
| parent | 81a9cdbadf8c9d940d4fe9a2a0de607dee1f5f1a (diff) | |
| download | dispatch-394f1ed37ce860da6fdc385769bf29f9737105cd.tar.gz dispatch-394f1ed37ce860da6fdc385769bf29f9737105cd.zip | |
chore: genesis — remove all files to rebuild from scratch (arch rewrite)
Diffstat (limited to 'packaging')
32 files changed, 0 insertions, 799 deletions
diff --git a/packaging/PKGBUILD b/packaging/PKGBUILD deleted file mode 100644 index 323f9cc..0000000 --- a/packaging/PKGBUILD +++ /dev/null @@ -1,274 +0,0 @@ -# Maintainer: dispatch -# -# Split package: builds the base application once and produces three packages: -# dispatch — application files + CLI wrappers + env configs -# dispatch-systemd — systemd system units (run as a given user: dispatch-api@<user>) -# dispatch-s6 — s6 service definitions for dispatch-api / dispatch-frontend -# -# The Electron desktop wrapper lives in a separate PKGBUILD at packaging/electron/. -# -# Build with: -# bin/build-pkg # makepkg -fd in packaging/ - -pkgbase=dispatch -pkgname=('dispatch' 'dispatch-systemd' 'dispatch-s6' 'code-search') -pkgver=0.0.1 -pkgrel=1 -arch=('x86_64') -url='https://github.com/anomalyco/dispatch' -license=('MIT') -makedepends=('bun' 'go' 'git') - -# Pinned cs (code spelunker) commit (tag v3.1.0) built for the search_code tool. -# Kept in lockstep with the Docker build (see Dockerfile / Dockerfile.dev). -_cs_commit=697e0bf194bbc7a4a877e5170c70618989fc92e7 -# All static files are read directly from ${_projectdir}/packaging/. We don't -# use source=() because two of the s6 files share basenames (run, type), which -# would collide inside ${srcdir}. -source=() -sha256sums=() - -_projectdir="${startdir}/.." -_packagingdir="${_projectdir}/packaging" - -prepare() { - mkdir -p "${srcdir}/dispatch-${pkgver}" - - # Copy project files into the src build directory (preserve symlinks) - cp -a \ - "${_projectdir}/packages" \ - "${_projectdir}/package.json" \ - "${_projectdir}/bun.lock" \ - "${_projectdir}/tsconfig.base.json" \ - "${srcdir}/dispatch-${pkgver}/" - - if [ -f "${_projectdir}/dispatch.toml" ]; then - cp "${_projectdir}/dispatch.toml" "${srcdir}/dispatch-${pkgver}/" - fi -} - -build() { - cd "${srcdir}/dispatch-${pkgver}" - - # Install all deps (including devDependencies for vite build) - bun install --frozen-lockfile - - # Build the frontend with production API port - VITE_API_URL="${VITE_API_URL:-http://localhost:18390}" \ - bun run --cwd packages/frontend build - - # Slim node_modules for runtime - rm -rf node_modules - bun install --frozen-lockfile --production - - # --- Provide the patched `cs` code-search binary for the search_code tool --- - # Building cs means a network clone + Go compile every run, which is wasted - # work when a matching cs is already on the system: the code-search package - # owns /usr/bin/cs and is pinned to the same _cs_commit. If it's already - # installed, reuse that binary instead of recloning/recompiling. Force a - # fresh build with DISPATCH_FORCE_CS_BUILD=1 (required when bumping - # _cs_commit, since the installed binary won't reflect the new commit). - if [ -z "${DISPATCH_FORCE_CS_BUILD:-}" ] && pacman -Qq code-search &>/dev/null \ - && [ -x /usr/bin/cs ]; then - echo "cs: code-search already installed — reusing /usr/bin/cs" \ - "(set DISPATCH_FORCE_CS_BUILD=1 to rebuild)" - cp /usr/bin/cs "${srcdir}/cs" - else - # Clone the pinned cs commit, apply the Luau declaration + fuzzy-distance - # patches, and build a statically-linked binary. cs vendors its deps, so - # `go build -mod=vendor` needs no network beyond the clone. Mirrors the - # Docker cs-builder stage. - # - # rm -rf first so a rerun (makepkg -e, or two invocations without -C) - # that reuses $srcdir doesn't abort on "destination path already exists". - # This PKGBUILD intentionally avoids source=() (the s6 service files - # share basenames and would collide in $srcdir), so we clone here rather - # than via makepkg's VCS source handling. - rm -rf "${srcdir}/cs-src" - git clone https://github.com/boyter/cs.git "${srcdir}/cs-src" - cd "${srcdir}/cs-src" - git checkout "${_cs_commit}" - git apply "${_projectdir}/docker/cs/luau-declarations.patch" - git apply "${_projectdir}/docker/cs/fuzzy-distance.patch" - CGO_ENABLED=0 GOFLAGS=-mod=vendor GOPATH="${srcdir}/gopath" GOCACHE="${srcdir}/gocache" \ - go build -ldflags="-s -w" -o "${srcdir}/cs" . - fi - "${srcdir}/cs" --version -} - -# ---------------------------------------------------------------------------- -# dispatch — application files, CLI wrappers, env configs -# ---------------------------------------------------------------------------- -package_dispatch() { - pkgdesc='AI Agent Dispatch — backend + frontend (application files)' - depends=('bun') - install=dispatch.install - backup=( - 'etc/dispatch/dispatch-api.conf' - 'etc/dispatch/dispatch-frontend.conf' - ) - - cd "${srcdir}/dispatch-${pkgver}" - - local optdir="${pkgdir}/opt/dispatch" - - # --- Application files --- - - # API package (full source) - install -dm755 "${optdir}/packages/api" - cp -a packages/api/. "${optdir}/packages/api/" - - # Core package (full source) - install -dm755 "${optdir}/packages/core" - cp -a packages/core/. "${optdir}/packages/core/" - - # Frontend: built dist + serve script + package.json (for workspace resolution) - install -dm755 "${optdir}/packages/frontend/dist" - cp -a packages/frontend/dist/. "${optdir}/packages/frontend/dist/" - install -Dm644 packages/frontend/serve.ts "${optdir}/packages/frontend/serve.ts" - install -Dm644 packages/frontend/package.json "${optdir}/packages/frontend/package.json" - - # Runtime node_modules (preserve symlinks for bun workspaces) - # Exclude prebuilt ARM64 .node binaries — strip (x86_64 host) can't process them. - install -dm755 "${optdir}/node_modules" - cp -a node_modules/. "${optdir}/node_modules/" - find "${optdir}/node_modules" -path '*/prebuilds/linux-arm64/*.node' -delete - - # Root manifest + lockfile - install -Dm644 package.json "${optdir}/package.json" - install -Dm644 bun.lock "${optdir}/bun.lock" - - # Optional default config - if [ -f dispatch.toml ]; then - install -Dm644 dispatch.toml "${optdir}/dispatch.toml" - fi - - # --- Environment configs (preserved across upgrades via backup=()) --- - install -Dm644 \ - "${_packagingdir}/dispatch-api.conf" \ - "${pkgdir}/etc/dispatch/dispatch-api.conf" - install -Dm644 \ - "${_packagingdir}/dispatch-frontend.conf" \ - "${pkgdir}/etc/dispatch/dispatch-frontend.conf" - - # --- CLI wrappers --- - install -Dm755 \ - "${_packagingdir}/dispatch-api-wrapper.sh" \ - "${pkgdir}/usr/bin/dispatch-api" - install -Dm755 \ - "${_packagingdir}/dispatch-frontend-wrapper.sh" \ - "${pkgdir}/usr/bin/dispatch-frontend" - - # --- License --- - if [ -f "${_projectdir}/LICENSE" ]; then - install -Dm644 "${_projectdir}/LICENSE" \ - "${pkgdir}/usr/share/licenses/dispatch/LICENSE" - fi -} - -# ---------------------------------------------------------------------------- -# dispatch-systemd — systemd system unit templates (run as a chosen user) -# -# These are *system* units (managed by PID 1), not user units, so they do not -# depend on a per-user `[email protected]` manager. Each is a template keyed on -# the username: `dispatch-api@tradam` runs as the `tradam` user via User=%i. -# ---------------------------------------------------------------------------- -package_dispatch-systemd() { - pkgdesc='Systemd system unit templates for the Dispatch API and Frontend services (run as dispatch-api@<user>)' - depends=("dispatch=${pkgver}" 'systemd') - conflicts=('dispatch-s6') - install=dispatch-systemd.install - - install -Dm644 \ - "${_packagingdir}/[email protected]" \ - "${pkgdir}/usr/lib/systemd/system/[email protected]" - - install -Dm644 \ - "${_packagingdir}/[email protected]" \ - "${pkgdir}/usr/lib/systemd/system/[email protected]" -} - -# ---------------------------------------------------------------------------- -# dispatch-s6 — s6 service definitions (for Artix / standalone s6) -# ---------------------------------------------------------------------------- -package_dispatch-s6() { - pkgdesc='s6-rc service definitions for the Dispatch API and Frontend services' - depends=("dispatch=${pkgver}" 's6' 's6-rc') - conflicts=('dispatch-systemd') - install=dispatch-s6.install - - # s6-rc layout: each service is split into a `-srv` (the daemon) and a - # `-log` (s6-log consumer), linked by producer-for/consumer-for/pipeline-name. - # The pipeline-name lets `s6-rc -u change dispatch-api` bring both up together. - - # --- dispatch-api-srv --- - install -Dm755 "${_packagingdir}/s6/dispatch-api-srv/run" \ - "${pkgdir}/etc/s6/sv/dispatch-api-srv/run" - install -Dm644 "${_packagingdir}/s6/dispatch-api-srv/type" \ - "${pkgdir}/etc/s6/sv/dispatch-api-srv/type" - install -Dm644 "${_packagingdir}/s6/dispatch-api-srv/producer-for" \ - "${pkgdir}/etc/s6/sv/dispatch-api-srv/producer-for" - - # --- dispatch-api-log --- - install -Dm755 "${_packagingdir}/s6/dispatch-api-log/run" \ - "${pkgdir}/etc/s6/sv/dispatch-api-log/run" - install -Dm644 "${_packagingdir}/s6/dispatch-api-log/type" \ - "${pkgdir}/etc/s6/sv/dispatch-api-log/type" - install -Dm644 "${_packagingdir}/s6/dispatch-api-log/consumer-for" \ - "${pkgdir}/etc/s6/sv/dispatch-api-log/consumer-for" - install -Dm644 "${_packagingdir}/s6/dispatch-api-log/pipeline-name" \ - "${pkgdir}/etc/s6/sv/dispatch-api-log/pipeline-name" - # notification-fd must match the `-d3` flag in run; without it s6-log - # aborts with "invalid notification fd" and the API blocks on a full - # stdout pipe before it can listen(). - install -Dm644 "${_packagingdir}/s6/dispatch-api-log/notification-fd" \ - "${pkgdir}/etc/s6/sv/dispatch-api-log/notification-fd" - - # --- dispatch-frontend-srv --- - install -Dm755 "${_packagingdir}/s6/dispatch-frontend-srv/run" \ - "${pkgdir}/etc/s6/sv/dispatch-frontend-srv/run" - install -Dm644 "${_packagingdir}/s6/dispatch-frontend-srv/type" \ - "${pkgdir}/etc/s6/sv/dispatch-frontend-srv/type" - install -Dm644 "${_packagingdir}/s6/dispatch-frontend-srv/producer-for" \ - "${pkgdir}/etc/s6/sv/dispatch-frontend-srv/producer-for" - - # --- dispatch-frontend-log --- - install -Dm755 "${_packagingdir}/s6/dispatch-frontend-log/run" \ - "${pkgdir}/etc/s6/sv/dispatch-frontend-log/run" - install -Dm644 "${_packagingdir}/s6/dispatch-frontend-log/type" \ - "${pkgdir}/etc/s6/sv/dispatch-frontend-log/type" - install -Dm644 "${_packagingdir}/s6/dispatch-frontend-log/consumer-for" \ - "${pkgdir}/etc/s6/sv/dispatch-frontend-log/consumer-for" - install -Dm644 "${_packagingdir}/s6/dispatch-frontend-log/pipeline-name" \ - "${pkgdir}/etc/s6/sv/dispatch-frontend-log/pipeline-name" - # notification-fd must match the `-d3` flag in run (see dispatch-api-log). - install -Dm644 "${_packagingdir}/s6/dispatch-frontend-log/notification-fd" \ - "${pkgdir}/etc/s6/sv/dispatch-frontend-log/notification-fd" -} - - -# ---------------------------------------------------------------------------- -# code-search — patched `cs` (code spelunker) binary -# -# A standalone, relevance-ranked code search CLI (github.com/boyter/cs), built -# from a pinned commit with an added Luau declaration table (see -# docker/cs/luau-declarations.patch). Powers Dispatch's `search_code` agent -# tool, but is a self-contained binary usable on its own. Built once in build() -# and installed to /usr/bin/cs. -# ---------------------------------------------------------------------------- -package_code-search() { - pkgdesc='code spelunker (cs) — fast, relevance-ranked code search CLI (patched for Luau)' - depends=() - # Both this package and the unrelated AUR `cs` (a colored ls) own /usr/bin/cs; - # declare the conflict so pacman reports it cleanly instead of a raw file - # collision. We do NOT `provides=('cs')` — this is a different program. - conflicts=('cs') - url='https://github.com/boyter/cs' - - install -Dm755 "${srcdir}/cs" "${pkgdir}/usr/bin/cs" - - if [ -f "${srcdir}/cs-src/LICENSE" ]; then - install -Dm644 "${srcdir}/cs-src/LICENSE" \ - "${pkgdir}/usr/share/licenses/code-search/LICENSE" - fi -} diff --git a/packaging/dispatch-api-wrapper.sh b/packaging/dispatch-api-wrapper.sh deleted file mode 100755 index d8c656b..0000000 --- a/packaging/dispatch-api-wrapper.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# dispatch-api-wrapper.sh -# Wrapper script for running the Dispatch API outside of systemd. -# Install to /usr/bin/dispatch-api (chmod 755). -# -# Usage: -# dispatch-api # runs the server, inheriting the current environment -# dispatch-api --help # passes flags through to bun - -set -euo pipefail - -DISPATCH_CONF="/etc/dispatch/dispatch-api.conf" -DISPATCH_DIR="/opt/dispatch" -BUN="/usr/bin/bun" -ENTRY_POINT="packages/api/src/index.ts" - -# Source the environment file if it exists -if [[ -f "$DISPATCH_CONF" ]]; then - # Export every variable defined in the conf file so child processes see them. - # Lines starting with '#' and blank lines are skipped automatically by bash's - # 'source' builtin. - set -o allexport - # shellcheck source=/etc/dispatch/dispatch-api.conf - source "$DISPATCH_CONF" - set +o allexport -fi - -# Change to the application directory -cd "$DISPATCH_DIR" - -# Hand off to bun — exec replaces this process so signals are forwarded correctly -exec "$BUN" "$ENTRY_POINT" "$@" diff --git a/packaging/dispatch-api.conf b/packaging/dispatch-api.conf deleted file mode 100644 index 9824e16..0000000 --- a/packaging/dispatch-api.conf +++ /dev/null @@ -1,31 +0,0 @@ -# /etc/dispatch/dispatch-api.conf -# Environment configuration for the Dispatch API service. -# This file is sourced by systemd (via EnvironmentFile=) and by the -# dispatch-api-wrapper.sh script for manual invocation. -# -# Lines beginning with '#' are comments and are ignored. -# Syntax: KEY=value (no spaces around '=', no 'export' keyword needed for systemd) - -# --------------------------------------------------------------------------- -# LLM / AI provider -# --------------------------------------------------------------------------- - -# API key used by the backend to call the OpenCode (or compatible) LLM API. -OPENCODE_API_KEY= - -# --------------------------------------------------------------------------- -# Runtime environment -# --------------------------------------------------------------------------- - -# Set to "production" for live deployments. -NODE_ENV=production - -# --------------------------------------------------------------------------- -# Server -# --------------------------------------------------------------------------- - -# Port the API listens on (default: 3000). -PORT=18390 - -# Hostname/address to bind to (default: 0.0.0.0). -# HOST=0.0.0.0 diff --git a/packaging/[email protected] b/packaging/[email protected] deleted file mode 100644 index e1946dd..0000000 --- a/packaging/[email protected] +++ /dev/null @@ -1,21 +0,0 @@ -[Unit] -Description=Dispatch API server (user %i) -After=network.target local-fs.target home.mount -# The API stores its SQLite DB and reads Claude credentials under the user's -# home (~/.local/share/dispatch). If /home is a separate filesystem, starting -# before it is mounted makes credential discovery fail (EACCES) and Claude -# tabs fall back to an empty API key (401). Ensure /home is mounted first. -RequiresMountsFor=/home - -[Service] -Type=simple -User=%i -Environment=NODE_ENV=production -Environment=PORT=18390 -WorkingDirectory=/opt/dispatch -ExecStart=/usr/bin/bun packages/api/src/index.ts -Restart=on-failure -RestartSec=5 - -[Install] -WantedBy=multi-user.target diff --git a/packaging/dispatch-frontend-wrapper.sh b/packaging/dispatch-frontend-wrapper.sh deleted file mode 100755 index 06aa9b0..0000000 --- a/packaging/dispatch-frontend-wrapper.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -# dispatch-frontend-wrapper.sh -# Wrapper script for running the Dispatch Frontend static-file server -# outside of systemd / s6. -# Install to /usr/bin/dispatch-frontend (chmod 755). -# -# Usage: -# dispatch-frontend # runs the server, inheriting the current environment -# dispatch-frontend --help # passes flags through to bun - -set -euo pipefail - -DISPATCH_CONF="/etc/dispatch/dispatch-frontend.conf" -DISPATCH_DIR="/opt/dispatch" -BUN="/usr/bin/bun" -ENTRY_POINT="packages/frontend/serve.ts" - -# Source the environment file if it exists -if [[ -f "$DISPATCH_CONF" ]]; then - set -o allexport - # shellcheck source=/etc/dispatch/dispatch-frontend.conf - source "$DISPATCH_CONF" - set +o allexport -fi - -# Change to the application directory -cd "$DISPATCH_DIR" - -# Hand off to bun — exec replaces this process so signals are forwarded correctly -exec "$BUN" "$ENTRY_POINT" "$@" diff --git a/packaging/dispatch-frontend.conf b/packaging/dispatch-frontend.conf deleted file mode 100644 index 37d2984..0000000 --- a/packaging/dispatch-frontend.conf +++ /dev/null @@ -1,21 +0,0 @@ -# /etc/dispatch/dispatch-frontend.conf -# Environment configuration for the Dispatch Frontend static-file server. -# Sourced by systemd (EnvironmentFile=), the s6 run script, and the -# dispatch-frontend-wrapper.sh script for manual invocation. -# -# Lines beginning with '#' are comments and are ignored. -# Syntax: KEY=value (no spaces around '=', no 'export' keyword needed for systemd) - -# --------------------------------------------------------------------------- -# Server -# --------------------------------------------------------------------------- - -# Port the static file server listens on (default: 18391). -PORT=18391 - -# Interface to bind to (default: 0.0.0.0). -# HOST=0.0.0.0 - -# Directory containing the built frontend assets. -# Defaults to /opt/dispatch/packages/frontend/dist -# DIST_DIR=/opt/dispatch/packages/frontend/dist diff --git a/packaging/[email protected] b/packaging/[email protected] deleted file mode 100644 index 6f35cc1..0000000 --- a/packaging/[email protected] +++ /dev/null @@ -1,22 +0,0 @@ -# Dispatch Frontend — system service template. -# Runs under the system manager (PID 1) but drops privileges to the user named -# in the instance: `dispatch-frontend@tradam` runs as the `tradam` user. -# Tied to the matching API instance for the same user. -# -# Enable/start: -# sudo systemctl enable --now dispatch-frontend@<user> -[Unit] -Description=Dispatch Frontend (static file server, running as %i) -After=dispatch-api@%i.service - -[Service] -Type=simple -User=%i -WorkingDirectory=/opt/dispatch -ExecStart=/usr/bin/bun packages/frontend/serve.ts -EnvironmentFile=-/etc/dispatch/dispatch-frontend.conf -Restart=on-failure -RestartSec=5 - -[Install] -WantedBy=multi-user.target diff --git a/packaging/dispatch-s6.install b/packaging/dispatch-s6.install deleted file mode 100644 index efa4c9b..0000000 --- a/packaging/dispatch-s6.install +++ /dev/null @@ -1,46 +0,0 @@ -post_install() { - install -dm755 -o tradam -g tradam /var/log/dispatch-api - install -dm755 -o tradam -g tradam /var/log/dispatch-frontend - - echo "" - echo "==> Dispatch s6-rc services installed at /etc/s6/sv/" - echo " Service pipelines: dispatch-api (= dispatch-api-srv | dispatch-api-log)" - echo " dispatch-frontend (= dispatch-frontend-srv | dispatch-frontend-log)" - echo " To enable and start:" - echo " s6 repository sync" - echo " s6 set enable -I pull dispatch-api-srv dispatch-api-log" - echo " s6 set enable -I pull dispatch-frontend-srv dispatch-frontend-log" - echo " s6 set commit -f" - echo " s6 live install" - echo " s6-rc -u change dispatch-api" - echo " s6-rc -u change dispatch-frontend" - echo "" -} - -post_upgrade() { - install -dm755 -o tradam -g tradam /var/log/dispatch-api 2>/dev/null || true - install -dm755 -o tradam -g tradam /var/log/dispatch-frontend 2>/dev/null || true - - # Remove any stale legacy service dirs from the old (pre-srv/-log split) - # layout, which would otherwise confuse s6 repository sync. - for legacy in /etc/s6/sv/dispatch-api /etc/s6/sv/dispatch-frontend; do - if [ -d "$legacy" ] && [ -d "$legacy/log" ] && [ ! -e "$legacy/producer-for" ]; then - rm -rf "$legacy" - fi - done - - echo "" - echo "==> Dispatch s6 services upgraded." - echo " Restart:" - echo " s6-rc -d change dispatch-api && s6-rc -u change dispatch-api" - echo " s6-rc -d change dispatch-frontend && s6-rc -u change dispatch-frontend" - echo "" -} - -pre_remove() { - echo "" - echo "==> Stopping dispatch services..." - s6-rc -d change dispatch-api 2>/dev/null || true - s6-rc -d change dispatch-frontend 2>/dev/null || true - echo "" -} diff --git a/packaging/dispatch-systemd.install b/packaging/dispatch-systemd.install deleted file mode 100644 index 5ebf261..0000000 --- a/packaging/dispatch-systemd.install +++ /dev/null @@ -1,25 +0,0 @@ -post_install() { - echo "" - echo "==> Dispatch systemd system unit templates installed." - echo " These run as the user named in the instance (replace <user>)." - echo " Enable and start (e.g. for user 'tradam'):" - echo " sudo systemctl daemon-reload" - echo " sudo systemctl enable --now dispatch-api@<user> dispatch-frontend@<user>" - echo "" -} - -post_upgrade() { - echo "" - echo "==> Dispatch systemd units upgraded." - echo " Reload and restart your instances (replace <user>):" - echo " sudo systemctl daemon-reload" - echo " sudo systemctl restart dispatch-api@<user> dispatch-frontend@<user>" - echo "" -} - -pre_remove() { - echo "" - echo "==> Stop dispatch services before removal (replace <user>):" - echo " sudo systemctl disable --now dispatch-api@<user> dispatch-frontend@<user>" - echo "" -} diff --git a/packaging/dispatch.install b/packaging/dispatch.install deleted file mode 100644 index 75b36cc..0000000 --- a/packaging/dispatch.install +++ /dev/null @@ -1,31 +0,0 @@ -post_install() { - echo "" - echo "==> Dispatch (base) has been installed." - echo " Application files: /opt/dispatch" - echo " Config:" - echo " /etc/dispatch/dispatch-api.conf" - echo " /etc/dispatch/dispatch-frontend.conf" - echo "" - echo " Run manually:" - echo " dispatch-api # backend (port 18390 by default)" - echo " dispatch-frontend # static frontend (port 18391 by default)" - echo "" - echo " To run as a service, install one of:" - echo " pacman -S dispatch-systemd # systemd system services (run as your user)" - echo " pacman -S dispatch-s6 # s6 services (Artix)" - echo "" - echo " For the Electron desktop wrapper:" - echo " pacman -S dispatch-electron" - echo "" -} - -post_upgrade() { - echo "" - echo "==> Dispatch (base) upgraded." - echo " If you use dispatch-systemd, restart the units (replace <user>):" - echo " sudo systemctl restart dispatch-api@<user> dispatch-frontend@<user>" - echo " If you use dispatch-s6, restart the services:" - echo " s6-svc -r /run/service/dispatch-api" - echo " s6-svc -r /run/service/dispatch-frontend" - echo "" -} diff --git a/packaging/electron/PKGBUILD b/packaging/electron/PKGBUILD deleted file mode 100644 index a259418..0000000 --- a/packaging/electron/PKGBUILD +++ /dev/null @@ -1,100 +0,0 @@ -# Maintainer: dispatch -# -# Electron desktop wrapper for Dispatch on Linux. -# -# Self-contained: bundles its own copy of the built frontend dist + electron -# entry points under /opt/dispatch-electron/. Does NOT depend on the `dispatch` -# package — install that separately (with dispatch-systemd or dispatch-s6) if -# you want to run the backend locally, or point VITE_API_URL at a remote -# instance at build time. -# -# Build with: -# bin/build-pkg-electron # makepkg -fd in packaging/electron/ -# -# Override the backend URL the bundled frontend talks to: -# VITE_API_URL="http://your-host:18390" bin/build-pkg-electron - -pkgname=dispatch-electron -pkgver=0.0.1 -pkgrel=1 -pkgdesc='Electron desktop wrapper for Dispatch (self-contained)' -arch=('x86_64') -url='https://github.com/anomalyco/dispatch' -license=('MIT') -depends=('electron') -makedepends=('bun') -install=dispatch-electron.install -source=() -sha256sums=() - -_projectdir="${startdir}/../.." -_packagingdir="${_projectdir}/packaging" -_electrondir="${_packagingdir}/electron" - -prepare() { - mkdir -p "${srcdir}/dispatch-electron-${pkgver}" - - # Copy project files into the src build directory (preserve symlinks) - cp -a \ - "${_projectdir}/packages" \ - "${_projectdir}/package.json" \ - "${_projectdir}/bun.lock" \ - "${_projectdir}/tsconfig.base.json" \ - "${srcdir}/dispatch-electron-${pkgver}/" -} - -build() { - cd "${srcdir}/dispatch-electron-${pkgver}" - - # Install all deps (including devDependencies for vite build) - bun install --frozen-lockfile - - # Build the SPA. VITE_API_URL is baked in at build time. - VITE_API_URL="${VITE_API_URL:-http://localhost:18390}" \ - bun run --cwd packages/frontend build -} - -package() { - cd "${srcdir}/dispatch-electron-${pkgver}" - - local optdir="${pkgdir}/opt/dispatch-electron" - - # --- Bundled SPA dist --- - install -dm755 "${optdir}/dist" - cp -a packages/frontend/dist/. "${optdir}/dist/" - - # --- Electron entry points --- - # main.cjs loads ../dist/index.html — so the dist must sit alongside electron/. - install -Dm644 \ - packages/frontend/electron/main.cjs \ - "${optdir}/electron/main.cjs" - install -Dm644 \ - packages/frontend/electron/preload.cjs \ - "${optdir}/electron/preload.cjs" - - # --- /usr/bin/dispatch (electron wrapper) --- - install -Dm755 \ - "${_electrondir}/dispatch-electron-wrapper.sh" \ - "${pkgdir}/usr/bin/dispatch" - - # --- Desktop integration --- - install -Dm644 \ - "${_electrondir}/dispatch.desktop" \ - "${pkgdir}/usr/share/applications/dispatch.desktop" - - install -Dm644 \ - "${_electrondir}/dispatch.svg" \ - "${pkgdir}/usr/share/icons/hicolor/scalable/apps/dispatch.svg" - - if [ -f "${_electrondir}/dispatch.png" ]; then - install -Dm644 \ - "${_electrondir}/dispatch.png" \ - "${pkgdir}/usr/share/icons/hicolor/512x512/apps/dispatch.png" - fi - - # --- License --- - if [ -f "${_projectdir}/LICENSE" ]; then - install -Dm644 "${_projectdir}/LICENSE" \ - "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" - fi -} diff --git a/packaging/electron/dispatch-electron-wrapper.sh b/packaging/electron/dispatch-electron-wrapper.sh deleted file mode 100755 index 948db3b..0000000 --- a/packaging/electron/dispatch-electron-wrapper.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -exec /usr/bin/electron --name="Dispatch" /opt/dispatch-electron/electron/main.cjs "$@" diff --git a/packaging/electron/dispatch-electron.install b/packaging/electron/dispatch-electron.install deleted file mode 100644 index 9eea6b1..0000000 --- a/packaging/electron/dispatch-electron.install +++ /dev/null @@ -1,32 +0,0 @@ -post_install() { - echo "" - echo "==> Dispatch Electron desktop wrapper installed (self-contained)." - echo " Launch from your menu (Dispatch) or run:" - echo " dispatch" - echo "" - echo " The bundled frontend talks to the API URL baked in at build" - echo " time (default: http://localhost:18390). To run a local backend:" - echo " pacman -S dispatch dispatch-systemd # systemd" - echo " pacman -S dispatch dispatch-s6 # s6 / Artix" - echo "" - echo " To point the wrapper at a different backend, rebuild with:" - echo " VITE_API_URL=\"http://your-host:18390\" bin/build-pkg-electron" - echo "" - - if command -v update-desktop-database >/dev/null 2>&1; then - update-desktop-database -q /usr/share/applications 2>/dev/null || true - fi - if command -v gtk-update-icon-cache >/dev/null 2>&1; then - gtk-update-icon-cache -q /usr/share/icons/hicolor 2>/dev/null || true - fi -} - -post_upgrade() { - post_install -} - -post_remove() { - if command -v update-desktop-database >/dev/null 2>&1; then - update-desktop-database -q /usr/share/applications 2>/dev/null || true - fi -} diff --git a/packaging/electron/dispatch.desktop b/packaging/electron/dispatch.desktop deleted file mode 100644 index 0ed44af..0000000 --- a/packaging/electron/dispatch.desktop +++ /dev/null @@ -1,9 +0,0 @@ -[Desktop Entry] -Name=Dispatch -Comment=AI Agent Dispatch Interface -Exec=/usr/bin/dispatch %U -Icon=dispatch -Terminal=false -Type=Application -Categories=Development;Utility; -StartupWMClass=Dispatch diff --git a/packaging/electron/dispatch.png b/packaging/electron/dispatch.png Binary files differdeleted file mode 100644 index 84d743a..0000000 --- a/packaging/electron/dispatch.png +++ /dev/null diff --git a/packaging/electron/dispatch.svg b/packaging/electron/dispatch.svg deleted file mode 100644 index 2aae97f..0000000 --- a/packaging/electron/dispatch.svg +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64"> - <defs> - <linearGradient id="bg" x1="0%" y1="0%" x2="100%" y2="100%"> - <stop offset="0%" style="stop-color:#5b6af0"/> - <stop offset="100%" style="stop-color:#9b59f7"/> - </linearGradient> - <linearGradient id="arrow" x1="0%" y1="0%" x2="100%" y2="100%"> - <stop offset="0%" style="stop-color:#ffffff;stop-opacity:1"/> - <stop offset="100%" style="stop-color:#e0d8ff;stop-opacity:1"/> - </linearGradient> - </defs> - - <!-- Rounded square background --> - <rect x="2" y="2" width="60" height="60" rx="14" ry="14" fill="url(#bg)"/> - - <!-- Send/dispatch arrow icon: a paper-plane style arrow pointing upper-right --> - <!-- Main arrow body --> - <polygon points="10,50 54,10 38,32" fill="url(#arrow)" opacity="0.95"/> - <!-- Arrow tail fill --> - <polygon points="10,50 28,36 22,54" fill="url(#arrow)" opacity="0.75"/> - <!-- Subtle highlight line --> - <line x1="54" y1="10" x2="28" y2="36" stroke="white" stroke-width="1.5" stroke-linecap="round" opacity="0.5"/> -</svg> diff --git a/packaging/s6/dispatch-api-log/consumer-for b/packaging/s6/dispatch-api-log/consumer-for deleted file mode 100644 index 8a696f4..0000000 --- a/packaging/s6/dispatch-api-log/consumer-for +++ /dev/null @@ -1 +0,0 @@ -dispatch-api-srv diff --git a/packaging/s6/dispatch-api-log/notification-fd b/packaging/s6/dispatch-api-log/notification-fd deleted file mode 100644 index 00750ed..0000000 --- a/packaging/s6/dispatch-api-log/notification-fd +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/packaging/s6/dispatch-api-log/pipeline-name b/packaging/s6/dispatch-api-log/pipeline-name deleted file mode 100644 index 9dab7e6..0000000 --- a/packaging/s6/dispatch-api-log/pipeline-name +++ /dev/null @@ -1 +0,0 @@ -dispatch-api diff --git a/packaging/s6/dispatch-api-log/run b/packaging/s6/dispatch-api-log/run deleted file mode 100644 index 5d1b821..0000000 --- a/packaging/s6/dispatch-api-log/run +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -# Logger for dispatch-api. Reads stdout from dispatch-api-srv and writes to -# /var/log/dispatch-api/ using s6-log (auto-rotation, timestamping). - -exec /usr/bin/s6-setuidgid tradam \ - /usr/bin/s6-log -b -d3 -- n10 s10000000 T /var/log/dispatch-api diff --git a/packaging/s6/dispatch-api-log/type b/packaging/s6/dispatch-api-log/type deleted file mode 100644 index 5883cff..0000000 --- a/packaging/s6/dispatch-api-log/type +++ /dev/null @@ -1 +0,0 @@ -longrun diff --git a/packaging/s6/dispatch-api-srv/producer-for b/packaging/s6/dispatch-api-srv/producer-for deleted file mode 100644 index 88f7df2..0000000 --- a/packaging/s6/dispatch-api-srv/producer-for +++ /dev/null @@ -1 +0,0 @@ -dispatch-api-log diff --git a/packaging/s6/dispatch-api-srv/run b/packaging/s6/dispatch-api-srv/run deleted file mode 100644 index f9c3a67..0000000 --- a/packaging/s6/dispatch-api-srv/run +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh -# dispatch-api service — runs the Dispatch backend API as the `tradam` user. -# stdout/stderr are piped to dispatch-api-log via the s6-rc pipeline. - -DISPATCH_CONF="/etc/dispatch/dispatch-api.conf" -DISPATCH_DIR="/opt/dispatch" - -if [ -f "$DISPATCH_CONF" ]; then - set -a - . "$DISPATCH_CONF" - set +a -fi - -cd "$DISPATCH_DIR" || exit 1 - -# Merge stderr into stdout so both get logged by the consumer. -exec 2>&1 - -# Wait for the home directory to be available before starting. -# -# On the cyberdeck /home is a separate filesystem (ext4 on /dev/sda4). If this -# service starts before that mount is ready, the API runs as `tradam` with -# HOME=/home/tradam while /home/tradam does not yet exist. Creating the data -# dir (~/.local/share/dispatch) then fails with EACCES, Claude credential -# discovery silently fails, and Claude tabs fall back to an empty API key -# (401 from OpenCode Zen) for the entire lifetime of the process. Block until -# the home directory appears (capped at ~30s as a safety net). Where /home is -# part of the root filesystem this check passes immediately. -i=0 -while [ ! -d "/home/tradam" ]; do - i=$((i + 1)) - if [ "$i" -ge 30 ]; then - echo "dispatch-api: /home/tradam still missing after ${i}s — starting anyway" >&2 - break - fi - echo "dispatch-api: waiting for /home/tradam to be available (${i})..." >&2 - sleep 1 -done - -# Drop privileges to tradam and run bun. -exec /usr/bin/s6-setuidgid tradam \ - /usr/bin/env \ - HOME=/home/tradam \ - USER=tradam \ - LOGNAME=tradam \ - PATH=/usr/local/bin:/usr/bin:/bin \ - NODE_ENV="${NODE_ENV:-production}" \ - PORT="${PORT:-18390}" \ - OPENCODE_API_KEY="${OPENCODE_API_KEY:-}" \ - /usr/bin/bun packages/api/src/index.ts diff --git a/packaging/s6/dispatch-api-srv/type b/packaging/s6/dispatch-api-srv/type deleted file mode 100644 index 5883cff..0000000 --- a/packaging/s6/dispatch-api-srv/type +++ /dev/null @@ -1 +0,0 @@ -longrun diff --git a/packaging/s6/dispatch-frontend-log/consumer-for b/packaging/s6/dispatch-frontend-log/consumer-for deleted file mode 100644 index f941d04..0000000 --- a/packaging/s6/dispatch-frontend-log/consumer-for +++ /dev/null @@ -1 +0,0 @@ -dispatch-frontend-srv diff --git a/packaging/s6/dispatch-frontend-log/notification-fd b/packaging/s6/dispatch-frontend-log/notification-fd deleted file mode 100644 index 00750ed..0000000 --- a/packaging/s6/dispatch-frontend-log/notification-fd +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/packaging/s6/dispatch-frontend-log/pipeline-name b/packaging/s6/dispatch-frontend-log/pipeline-name deleted file mode 100644 index 0ee914b..0000000 --- a/packaging/s6/dispatch-frontend-log/pipeline-name +++ /dev/null @@ -1 +0,0 @@ -dispatch-frontend diff --git a/packaging/s6/dispatch-frontend-log/run b/packaging/s6/dispatch-frontend-log/run deleted file mode 100644 index 4dda559..0000000 --- a/packaging/s6/dispatch-frontend-log/run +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -# Logger for dispatch-frontend. Reads stdout from dispatch-frontend-srv and -# writes to /var/log/dispatch-frontend/ using s6-log. - -exec /usr/bin/s6-setuidgid tradam \ - /usr/bin/s6-log -b -d3 -- n10 s10000000 T /var/log/dispatch-frontend diff --git a/packaging/s6/dispatch-frontend-log/type b/packaging/s6/dispatch-frontend-log/type deleted file mode 100644 index 5883cff..0000000 --- a/packaging/s6/dispatch-frontend-log/type +++ /dev/null @@ -1 +0,0 @@ -longrun diff --git a/packaging/s6/dispatch-frontend-srv/producer-for b/packaging/s6/dispatch-frontend-srv/producer-for deleted file mode 100644 index c29eb09..0000000 --- a/packaging/s6/dispatch-frontend-srv/producer-for +++ /dev/null @@ -1 +0,0 @@ -dispatch-frontend-log diff --git a/packaging/s6/dispatch-frontend-srv/run b/packaging/s6/dispatch-frontend-srv/run deleted file mode 100644 index 3411476..0000000 --- a/packaging/s6/dispatch-frontend-srv/run +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -# dispatch-frontend service — serves the built frontend assets as the `tradam` user. -# stdout/stderr are piped to dispatch-frontend-log via the s6-rc pipeline. - -DISPATCH_CONF="/etc/dispatch/dispatch-frontend.conf" -DISPATCH_DIR="/opt/dispatch" - -if [ -f "$DISPATCH_CONF" ]; then - set -a - . "$DISPATCH_CONF" - set +a -fi - -cd "$DISPATCH_DIR" || exit 1 - -exec 2>&1 - -exec /usr/bin/s6-setuidgid tradam \ - /usr/bin/env \ - HOME=/home/tradam \ - USER=tradam \ - LOGNAME=tradam \ - PATH=/usr/local/bin:/usr/bin:/bin \ - PORT="${PORT:-18391}" \ - /usr/bin/bun packages/frontend/serve.ts diff --git a/packaging/s6/dispatch-frontend-srv/type b/packaging/s6/dispatch-frontend-srv/type deleted file mode 100644 index 5883cff..0000000 --- a/packaging/s6/dispatch-frontend-srv/type +++ /dev/null @@ -1 +0,0 @@ -longrun |
