ui

package
v1.801.490 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

README

Tracker UI (embedded)

dist/ is the built Hanzo Tracker SPA — the admin-tracker app (@hanzo/tracker, Vite + a @hanzogui shell over the forge's own board CSS) — baked into the cloud binary via //go:embed and served at /tracker/* by apps/tracker. This is the real UI behind tracker.hanzo.ai, and it is what retires the Huly tracker that used to answer that host.

The SPA is built with base: '/tracker/' and VITE_API_PREFIX=/v1/tracker, so every asset and XHR is same-origin under paths this binary already serves (/tracker/* static, /v1/tracker/* API).

Same-origin is load-bearing rather than convenient: the SPA sends no tenancy of its own. cloud's identity layer mints the validated org from the IAM session before any tracker handler runs, so the page carries the session cookie and nothing else. A UI on a second host would have to hold a token and name an org — exactly the client-supplied tenancy this surface refuses.

Regenerating dist/

Source of truth: the admin-tracker app in hanzoai/admin. Build it where hanzogui@7.x and @hanzogui/admin both resolve, then sync its dist/:

cd apps/admin-tracker
../../node_modules/.bin/tsc --noEmit     # typecheck gate
../../node_modules/.bin/vite build       # → dist/  (base=/tracker/, api=/v1/tracker)

rsync -a --delete --exclude='.sync-stamp' apps/admin-tracker/dist/ <cloud>/apps/tracker/ui/dist/

Then go build ./plugin/tracker re-embeds it. Do NOT hand-edit files under dist/ — they are content-addressed Vite output. Update .sync-stamp to name the commit you built from.

--exclude='.sync-stamp' is not optional. The source dist/ has no copy of the stamp, so a plain --delete removes it — and no test can catch that, because what embed_test.go asserts is precisely that the stamp is NOT in the binary. It went missing twice before the flag was written down here.

embed_test.go pins the two things a bad sync breaks silently: that the bundle was built for /tracker/ (a wrong base resolves every chunk to a path nothing serves — a blank page, not an error), and that it calls /v1/tracker (the API prefix is inlined at build time, so a bundle built against a dev proxy would render and then talk to a surface this binary does not answer).

Documentation

Overview

Package ui embeds the built Hanzo Tracker SPA (@hanzo/tracker, the admin-tracker app in hanzoai/admin, Vite + hanzogui shell over the forge's own board CSS) into the cloud binary and serves it at /tracker/*.

WHY cloud owns this embed: cloud is the ONE process that answers /v1/tracker (apps/tracker's per-org board store), so it serves the UI for that store too — one binary, one origin, one deploy. Same-origin is not cosmetic here: the SPA sends no tenancy of its own, because cloud's gateway mints the validated org from the IAM session BEFORE any tracker handler runs. A UI served from a second host would have to carry a token and assert an org, which is exactly the client-supplied tenancy the tracker refuses.

This is what lets tracker.hanzo.ai serve a native board and retire the Huly tracker that answered that host.

dist/ is the committed, content-addressed Vite build. The SPA is built with base '/tracker/' and API prefix '/v1/tracker' (see the admin-tracker vite.config), so every asset and XHR is same-origin under paths cloud already serves. To refresh it, rebuild the admin-tracker app and sync its dist/ here — see apps/tracker/ui/README.md.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FS

func FS() fs.FS

FS returns the embedded built-UI filesystem rooted at dist/.

func Handler

func Handler() http.Handler

Handler serves the embedded board. Mount it under StripPrefix("/tracker", …) so it sees root-relative paths. The serving policy — immutable hashed assets, 404 for a purged chunk, index fallback for a deep link, 503 for an unsynced bundle — is spa.Handler's, which is the ONE copy of it in this repo.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL