diff options
| author | Adam Malczewski <[email protected]> | 2026-06-06 18:55:53 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-06-06 18:55:53 +0900 |
| commit | 22936857685c318b71752d625808100b1a96e63e (patch) | |
| tree | 5e10a73d616c206e3820a8d8568e5f3d4c8a302e /bin | |
| parent | 969afc45f895230fe3da1c737f18e64452efc8f2 (diff) | |
| download | dispatch-22936857685c318b71752d625808100b1a96e63e.tar.gz dispatch-22936857685c318b71752d625808100b1a96e63e.zip | |
feat(frontend,wire): surface system (FE slice 1) + @dispatch/wire types-only split (B2)
FE slice 1 — backend-declared, frontend-agnostic surface system (verified live): new types-only @dispatch/ui-contract (SurfaceSpec / field kinds / region / ActionRef / catalog), surface-registry (typed service handle), transport-ws (Bun WS :24205, path-agnostic upgrade), surface-loaded-extensions (first real surface); kernel HostAPI.getExtensions; host-bin wiring; bin/up. Harness: retire AGENTS 'backend only', ORCHESTRATOR §3/§7/§8, frontend-design.md locked.
B2 — wire-types split (chat-slice prerequisite): new types-only @dispatch/wire single-sources the wire ABI (AgentEvent + 11 variants; conversation model Chunk/ChatMessage/Role/TurnId/StepId + 6 chunk variants; Usage) with zero @dispatch/* deps. @dispatch/kernel re-exports via shims so its public surface is byte-identical (zero consumer blast radius). transport-contract re-exports AgentEvent from @dispatch/wire and drops its @dispatch/kernel dependency, so HTTP clients (the web frontend) consume the wire without the kernel runtime.
tsc -b + biome clean; 460 vitest + 77 bun pass.
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/up | 54 |
1 files changed, 54 insertions, 0 deletions
@@ -0,0 +1,54 @@ +#!/usr/bin/env bash +# bin/up — run the Dispatch backend + web frontend together, both live-reloading. +# Ctrl-C stops BOTH cleanly (including the backend's spawned observability collector). +# +# backend (this repo) bun --watch → HTTP :24203 + surface WS :24205 (FULL restart on change) +# frontend (../dispatch-web) vite → http://localhost:24204 (HMR, in-place) +# +# Assumes dispatch-web is a sibling of this repo. Run: bin/up (or: bun run dev:all) + +set -uo pipefail + +HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # .../arch-rewrite/bin +BACKEND="$(cd "$HERE/.." && pwd)" # backend repo root +FRONTEND="$(cd "$HERE/../.." && pwd)/dispatch-web" # sibling repo + +if [ ! -d "$FRONTEND" ]; then + echo "up: frontend repo not found at $FRONTEND" >&2 + echo "up: check out 'dispatch-web' beside this repo and retry." >&2 + exit 1 +fi + +cleanup() { + echo + echo "[up] stopping backend + frontend..." + # Each child runs in its OWN process group (setsid) → signal the whole subtree. + [ -n "${BACK_PG:-}" ] && kill -TERM "-$BACK_PG" 2>/dev/null + [ -n "${FRONT_PG:-}" ] && kill -TERM "-$FRONT_PG" 2>/dev/null + sleep 1 + # Safety net for the backend's collector child + any straggler (bracket trick: + # the literal pattern '[h]ost-bin' can't match the pkill command line itself). + pkill -9 -f '[h]ost-bin/src/main' 2>/dev/null + pkill -9 -f '[o]bservability-collector/src/main' 2>/dev/null + [ -n "${BACK_PG:-}" ] && kill -KILL "-$BACK_PG" 2>/dev/null + [ -n "${FRONT_PG:-}" ] && kill -KILL "-$FRONT_PG" 2>/dev/null + echo "[up] stopped." + return 0 +} +trap cleanup EXIT +trap 'exit 130' INT TERM + +echo "[up] backend → http://localhost:24203 (surface WS :24205) [bun --watch — restarts on change]" +echo "[up] frontend → http://localhost:24204 [vite HMR]" +echo "[up] Ctrl-C to stop both." +echo + +setsid bash -c "cd '$BACKEND' && exec bun --watch packages/host-bin/src/main.ts" \ + > >(sed -u 's/^/[backend] /') 2>&1 & +BACK_PG=$! + +setsid bash -c "cd '$FRONTEND' && exec bun run dev" \ + > >(sed -u 's/^/[frontend] /') 2>&1 & +FRONT_PG=$! + +wait |
