Skip to content

Serve the new AX Studio UX from the web app and connect live AX flows - #4

Merged
Raji14 merged 2 commits into
web-studiofrom
ax-ux-web
Nov 19, 2026
Merged

Raji14 merged 2 commits into
web-studiofrom
ax-ux-web

Conversation

@Raji14

@Raji14 Raji14 commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Brings the new AX Studio Sanctuary UX (ux/) onto the Go local web server (cmd/ax-studio) and wires every live workflow end-to-end against AX (ax CLI, gRPC guest/API tunnels, and Kubernetes/Agent Substrate inspection), achieving feature parity with main's desktop app while following the Sanctuary visual style, progressive disclosure, and WCAG 2.2 AA accessibility patterns.

  • Served at / by default: ax-studio embeds ux/ in the binary (or serves directly from disk with --ux-dir ux during development). If the legacy Vite bundle (dist/) is also present, it remains reachable at /classic/.
  • Zero-build browser UI + static demo mode preserved: ux/ runs without a bundler. When opened via a plain static server (python3 -m http.server 8789), window.AX_STUDIO in ux/env.js stays unset and all seeded demo journeys/scenarios continue to work unchanged.
  • Non-destructive cluster & atespace scoping: Selecting a cluster or atespace in Studio is stored per-browser and passed explicitly (--context, -a) on every call — ~/.kube/config is never mutated.

What's Included by Screen

1. Home (#/) & All Tasks (#/tasks)

  • Personalized Home hero: Greets the user by their OS account display name or git config user.name (internal/studio/user.go, customizable in Settings — never guessed from a username/LDAP), paired with Axel in the Clear Spring pool and a quick-goal launcher (Set up task).
  • 4-stage task pipeline & session grouping: Live tasks (ListTasks up to 500) are grouped by sessionId (keeping multi-turn follow-ups together) into Needs you, Running, Paused, and Done sections with jump tiles, cluster/atespace scope controls next to Your tasks, and live relative refresh timestamps.
  • Workspaces, Gateways, and Models: Collapsible resource inventory under Home showing which tasks bind each Workspace or Gateway, surfacing Failed workspace setup errors (lastSetupError), listing Models read-only, and offering one-click cleanup of unused Workspaces and Gateways.
  • All tasks (#/tasks): Searchable, filterable flat table (Task, Status, Template, Workspace, Where, Resources, Created) with live state counts, linked from the sidebar (See all), Home, and the Command Palette.

2. Where Agents Run (#/places) & First-Run Setup (#/setup)

  • On this computer (ax-local):
    • Real preflight checks (os_arch, container_engine distinguishing missing binary vs. stopped daemon, disk_space) and tool discovery (ax, kubectl, kind versions, paths, and supported CLI flags).
    • Live health states (Running, Starting or degraded, Not in your kubeconfig, Not answering, Stopped, Not set up) with per-layer status and elapsed stage durations (kind, substrate, workers, ax).
    • Context-aware Set up / Start / Update / Repair (ax local start), Stop (offering to pause/checkpoint Working tasks first so gVisor state is saved), and Remove (ax local delete).
    • Persistent AX images disclosure (serverImage, defaultTaskImage, and conditional runnerVolumeImage) validated as you type and saved in localStorage.
  • Remote clusters (~/.kube/config):
    • Read-only cluster inspection (GET /api/env/check) verifying Kubernetes version, node architecture/kernel, ClusterTrustBundle & PodCertificateRequest APIs, default StorageClass, Agent Substrate deployments + WorkerPool readiness, and ax-server deployment/image, with actionable next-step guidance and pre-filled gcloud container clusters get-credentials hints.
    • Confirmation flows for Install AX…, Upgrade AX…, and Uninstall AX… (ax install / ax uninstall), plus collapsible A cluster for AX needs and To set one up disclosures.
  • Operations & Output: Cancelable running commands (POST /api/env/cancel), exit-code badges on failures, and a streaming Output panel at the bottom of the page.

3. New Task & Multi-Turn Follow-Up (#/new)

  • 4-step guided form + sticky Run Plan:
    1. Pick a template: Antigravity, Claude Code, or Your own image (@sha256:… digest validation), with out-of-sandbox API key storage (POST /api/secrets/credential -> Gateway header replacement so raw keys never enter the sandbox).
    2. Where should it run?: Local gVisor sandbox or any remote cluster in ~/.kube/config (locked to the session's cluster on follow-ups).
    3. Set up the workspace: Clone from Git (with recent-repo and common-branch pills), An existing workspace (live picker from the target cluster, refusing Failed workspaces), or Empty workspace; debug access toggle (on by default locally, off on shared clusters); and Customize workspace for extra Git repos, setup commands (npm ci, pip install, go mod download, uv sync pills), inline files (AGENTS.md quick-add), and MCP servers (whose hosts are added to the Gateway automatically).
    4. Describe the goal: Starter goal suggestions and prompt-clarity helper pills (How to check it's done, Where to start, What not to change).
  • More options & YAML: Network preset (Balanced vs. Locked down), resource limits (Small / Medium / Large / Custom CPU & memory), custom container command (shell-style quoting), plain-text NAME=value env vars, task name, and ax.io/v1alpha1 multi-doc YAML preview, raw editor, .yaml download, and local file loader (with automatic goal.text -> goal.spec fallback for older ax-server builds).

4. Task Detail (#/task/<name>)

  • Activity: Goal, translated AX conditions, workspace setup failures, worker-log agent-exit error detection (surfacing crashes even while AX still reports Working), task outcome/output, and collapsible Details (sandbox actor & UID, previous attempt failure, labels, and raw conditions table).
  • Logs: Live-polling log viewer (GET /api/tasks/logs) tailing Agent Substrate worker pods for the task's actor, visually separating agent output, runner lines, lifecycle events, and optional gVisor startup lines.
  • Changes (debug tasks): Live git status + unified diffs inside /workspace, per-file Discard…, Apply to a folder on this computer…, and Push to a branch….
  • Terminal (debug, Working tasks): Up to 4 tabbed ax ssh shell sessions with Up/Down command history, ANSI SGR colors, and Ctrl-C / Ctrl-D / Ctrl-L support.
  • Run on another cluster (Promote / Move): Runs ax promote --preflight-only + ax promote when available, and automatically falls back to Studio's API-driven move (POST /api/tasks/move) when the installed ax binary lacks promote — supporting dry-run preflight plans, Gateway/Workspace/Task copying, optional /workspace file streaming over ax ssh, target atespace selection, --no-resume, --replace, and keeping/pausing/deleting the source task.
  • Delete task: Offers checkboxes to also delete unshared ws-* / gw-* resources created for that task.

5. Settings (#/settings) & Navigation

  • Consolidated into 5 sections: AX & this computer (Studio/API/ax versions, loopback origin, kubeconfig, namespace, atespace switcher, image summary, and secret-redacted Diagnostics), Keyboard & commands (Command Palette, shortcuts, and ax CLI equivalents), Notifications (opt-in background browser notifications for tasks needing attention and completed operations), Accessibility (single-key shortcuts and reduced motion), and Appearance & story (System/Light/Dark theme, Home greeting name, compact list density, and Axel & the Clear Spring).
  • Sidebar footer cluster card: Displays connection health and active sandbox count, and opens an upward cluster switcher menu; deep links (?context=…&atespace=…) and Copy link preserve cluster/atespace context.

Backend Changes (cmd/ax-studio, internal/studio, internal/kube)

Area Endpoints / Files Summary
UX static serving cmd/ax-studio/main.go, ux/embed.go, internal/studio/server.go Embed ux/ at /, add --ux-dir flag for live reload, inject /env.js config, serve legacy dist/ at /classic/ when present
Environment & tools internal/studio/env.go, internal/studio/envcheck.go Tool version/path discovery (ax, kubectl, kind), ax flag probing, local cluster access & stage-duration tracking, GET /api/env/check, POST /api/env/{uninstall,cancel}, exit codes on EnvOpSnapshot, Linux Docker daemon check & warm-up retry
Tasks & resources internal/studio/tasks.go, internal/studio/resources.go GET /api/tasks (limit 500), GET /api/tasks/get, GET /api/gateways/get, POST /api/tasks/{suspend,resume,delete}, GET /api/{workspaces,gateways,models}, POST /api/{workspaces,gateways}/delete
Worker logs internal/studio/logs.go GET /api/tasks/logs filtering kubectl logs -l ate.dev/worker-pool JSON records for the task's actor and detecting non-zero agent exits
Cross-cluster move internal/studio/move.go POST /api/tasks/move (dryRun preflight + background task-move operation copying Gateway/Workspace/Task via gRPC and optional /workspace tar pipe over ax ssh)
Sandbox & tunnels internal/studio/sandbox.go, internal/studio/guest.go, internal/kube/ POST /api/tasks/discard-file, --untracked-files=all in sandbox status, per-cluster mutex around EnsureGuestEndpoint, AX_HOME fallback in BinDir(), user display-name lookup (internal/studio/user.go)

Known Upstream AX Constraints

  • Line-oriented sandbox shell: AX's guest exec behind ax ssh does not allocate a PTY/TTY yet, so full-screen curses apps (vim, top) cannot run regardless of frontend terminal library; Studio provides multi-tab line shells with history, ANSI colors, and signals until guest PTY support lands.
  • Global Guardrails page: Kept hidden in live mode (#/guardrails explains why) until AX exposes cluster/org-level guardrail policy APIs beyond per-task Gateway resources.

Verification

  • Go vet & race tests: go vet ./... and go test -race -count=1 ./... pass across internal/kube and internal/studio (including new unit tests in env_test.go, envcheck_test.go, tasks_test.go, logs_test.go, move_test.go, resources_test.go, user_test.go, server_test.go).
  • UI smoke test suites:
    • node ux/tests/smoke_live.cjs — 96/96 checks pass
    • node ux/tests/smoke_cuj2.cjs — 30/30 checks pass
    • node ux/tests/smoke_cuj3.cjs — 20/20 checks pass
    • node ux/tests/smoke_cuj45.cjs — 43/43 checks pass
    • node ux/tests/smoke_general.cjs — all checks pass
  • Browser verification: Exercised end-to-end against both a live ax-local Kind + Agent Substrate + gVisor (systrap) cluster on Linux and a multi-cluster stand-in setup covering first-run setup, remote cluster checks, task creation, Logs, Changes, multi-shell Terminal, task move dry-run & execution, All tasks filtering, and Settings.

Serves ux/ at / from ax-studio (embedded in the binary, or from disk with
--ux-dir for development; when dist/ is also built, the previous React pages
stay at /classic/ for comparison). In a plain static server (python3 -m
http.server in ux/), ux/env.js leaves window.AX_STUDIO null so the demo and
review routes continue to run unchanged.

Connected to the Go server (/api/* and /api/events SSE) and verified against a
live ax-local Kind + Agent Substrate + gVisor cluster:
- First-run setup (Set up AX on this computer) with real preflight checks,
  custom server and task-runner image digests, streamed setup progress, and
  Start / Stop / Remove lifecycle controls (including a checkpoint guard that
  offers to pause running tasks before ax local stop).
- Where agents run: AX on this computer plus every cluster in the kubeconfig,
  with Spring-to-Lake Aqueduct visual and per-cluster reachability, version
  mismatch, and missing-install diagnostics. Studio remembers the selected
  cluster locally without mutating the user's kubeconfig.
- Home: live task list grouped by multi-turn session, 4-stage pipeline bar,
  quick-goal launcher, starter ideas, and Axel in the Clear Spring pool.
- New task and multi-turn follow-up: Antigravity, Claude Code, and Your own
  image templates, prompt-clarity helper pills, 4-step readiness card with
  Axel, visual Guardrails gateMap, editable ax.io/v1alpha1 Gateway + Workspace
  + Task YAML, Secret creation outside the sandbox, and automatic goal.text to
  goal.spec fallback for older ax-server images.
- Task page: Pause (SuspendTask), Resume (ResumeTask), Delete, Send a
  follow-up, Run on another cluster (ax promote --preflight-only then promote),
  uncommitted sandbox Changes with per-file diffs, per-file Discard, Apply to a
  local folder, Push to a branch, in-page interactive Terminal (ax ssh over
  /api/sessions/* and SSE), and Sandbox & network gateMap.
- Live Command Palette (Cmd/Ctrl+K), keyboard shortcuts (?), and "Why an
  axolotl?" story dialog.

Server fixes and additions:
- internal/studio/tasks.go: GET /api/tasks, GET /api/tasks/get, POST
  /api/tasks/{suspend,resume,delete,apply-yaml}.
- internal/studio/sandbox.go & server.go: POST /api/tasks/discard-file and
  git status --untracked-files=all so new files inside new directories show up
  in Changes.
- internal/studio/guest.go: per-cluster mutex around EnsureGuestEndpoint so
  concurrent requests share a single port-forward tunnel.
- internal/studio/env.go: container runtime check distinguishes "not installed"
  from "daemon not running" on Linux; local-up retries once after a 2s warm-up
  on transient kube-apiserver RBAC 403 ("nodes is forbidden") right after
  docker start, and clears stale failed local-up state once ax-local is healthy.
- internal/kube/exec.go & local.go: BinDir() honors AX_HOME when AX_BIN_DIR is
  unset, and InspectLocalCluster falls back to kind-<name> context if needed.
@Raji14
Raji14 requested a review from YoyinZyc November 18, 2026 06:35
@Raji14 Raji14 closed this Nov 18, 2026
… Settings

- Environment (Where agents run): tool discovery, local health states with
  Update/Repair, stage durations, cancelable operations with exit codes,
  AX image persistence, read-only remote cluster checks, install/upgrade/
  uninstall flows, and collapsible cluster guide disclosures.
- Tasks & resources: searchable/filterable All tasks view (#/tasks), worker
  Logs tab with agent-exit error detection, Workspaces/Gateways/Models
  listing and unused cleanup, multi-shell sandbox terminal with history/ANSI
  colors/Ctrl keys, and Studio-managed task move fallback (/api/tasks/move)
  when ax lacks promote.
- New task, Home, Settings & navigation: prototype four-step New task layout
  with Customize workspace and More options, user greeting on Home, cluster
  switcher in the sidebar footer card, deep links, browser notifications,
  and consolidated Settings tabs.
@Raji14 Raji14 reopened this Nov 19, 2026
@YoyinZyc

Copy link
Copy Markdown
Collaborator

@Raji14 feel free to merge and I will play around with it. I will do some clean up on the golang code and pin the latest ax lib on top of your change

@Raji14
Raji14 merged commit 61114fd into web-studio Nov 19, 2026
@mayawang

Copy link
Copy Markdown
Contributor

Nice work, the loopback/Host/Origin checks and CSRF handling look solid. One thing before merge: the go.mod pin (Nov 14) misreads tasks from a current ax-server, since google/ax#605 renumbered the Task fields (state is read from the old attempt slot, goal collides with the old config field, and move's CreateTask sends old numbers). Bumping github.com/google/ax to main compiles; only the tests need Delete*Response → Empty and Goal{Spec} → Goal{Text}. Follow-up: internal/kube/tunnel.go duplicates the CLI's tunnel logic, github.com/google/ax/client (google/ax#640) now covers it.

YoyinZyc added a commit that referenced this pull request Nov 19, 2026
* Add the baseline for ax studio web app- #3

AX Studio was an Electron app whose main process ran `ax` for the UI. It is
now one Go binary, ax-studio, that serves the React UI and a small API on
127.0.0.1:8080 and opens it in the browser.

The server stays thin: `ax` remains the source of truth, and the server only
does what a browser cannot.

- Run an allow-list of `ax` subcommands for the UI (version, ctx, get,
  apply, delete, suspend, resume, promote).
- Stream the output of `ax local start|stop|delete` and `ax install` to the
  page.
- Show, discard, apply locally, and push the uncommitted Git changes in a
  debug task's sandbox, over `ax ssh`.
- Store an API key as a cluster Secret labelled ax.io/credential, read from
  stdin, for a Gateway to inject.
- Bridge `ax ssh` sessions to the in-page terminal.

The UI is updated for the v1alpha1 API: goal, sessionId, profile, workspace
setup, and Gateways with egress allow-lists. Promotion runs `ax promote`.

The server binds only to loopback, rejects other Host and Origin values, and
requires a per-process session cookie plus a CSRF token for every change.

From AX it imports only github.com/google/ax/pkg/apis/v1alpha1.

* Serve the new AX Studio UX from the web app and connect live AX flows (#4)

* Serve the new AX Studio UX from the web app and connect live AX flows

Serves ux/ at / from ax-studio (embedded in the binary, or from disk with
--ux-dir for development; when dist/ is also built, the previous React pages
stay at /classic/ for comparison). In a plain static server (python3 -m
http.server in ux/), ux/env.js leaves window.AX_STUDIO null so the demo and
review routes continue to run unchanged.

Connected to the Go server (/api/* and /api/events SSE) and verified against a
live ax-local Kind + Agent Substrate + gVisor cluster:
- First-run setup (Set up AX on this computer) with real preflight checks,
  custom server and task-runner image digests, streamed setup progress, and
  Start / Stop / Remove lifecycle controls (including a checkpoint guard that
  offers to pause running tasks before ax local stop).
- Where agents run: AX on this computer plus every cluster in the kubeconfig,
  with Spring-to-Lake Aqueduct visual and per-cluster reachability, version
  mismatch, and missing-install diagnostics. Studio remembers the selected
  cluster locally without mutating the user's kubeconfig.
- Home: live task list grouped by multi-turn session, 4-stage pipeline bar,
  quick-goal launcher, starter ideas, and Axel in the Clear Spring pool.
- New task and multi-turn follow-up: Antigravity, Claude Code, and Your own
  image templates, prompt-clarity helper pills, 4-step readiness card with
  Axel, visual Guardrails gateMap, editable ax.io/v1alpha1 Gateway + Workspace
  + Task YAML, Secret creation outside the sandbox, and automatic goal.text to
  goal.spec fallback for older ax-server images.
- Task page: Pause (SuspendTask), Resume (ResumeTask), Delete, Send a
  follow-up, Run on another cluster (ax promote --preflight-only then promote),
  uncommitted sandbox Changes with per-file diffs, per-file Discard, Apply to a
  local folder, Push to a branch, in-page interactive Terminal (ax ssh over
  /api/sessions/* and SSE), and Sandbox & network gateMap.
- Live Command Palette (Cmd/Ctrl+K), keyboard shortcuts (?), and "Why an
  axolotl?" story dialog.

Server fixes and additions:
- internal/studio/tasks.go: GET /api/tasks, GET /api/tasks/get, POST
  /api/tasks/{suspend,resume,delete,apply-yaml}.
- internal/studio/sandbox.go & server.go: POST /api/tasks/discard-file and
  git status --untracked-files=all so new files inside new directories show up
  in Changes.
- internal/studio/guest.go: per-cluster mutex around EnsureGuestEndpoint so
  concurrent requests share a single port-forward tunnel.
- internal/studio/env.go: container runtime check distinguishes "not installed"
  from "daemon not running" on Linux; local-up retries once after a 2s warm-up
  on transient kube-apiserver RBAC 403 ("nodes is forbidden") right after
  docker start, and clears stale failed local-up state once ax-local is healthy.
- internal/kube/exec.go & local.go: BinDir() honors AX_HOME when AX_BIN_DIR is
  unset, and InspectLocalCluster falls back to kind-<name> context if needed.

* Complete live AX Studio UX parity, task move fallback, All tasks, and Settings

- Environment (Where agents run): tool discovery, local health states with
  Update/Repair, stage durations, cancelable operations with exit codes,
  AX image persistence, read-only remote cluster checks, install/upgrade/
  uninstall flows, and collapsible cluster guide disclosures.
- Tasks & resources: searchable/filterable All tasks view (#/tasks), worker
  Logs tab with agent-exit error detection, Workspaces/Gateways/Models
  listing and unused cleanup, multi-shell sandbox terminal with history/ANSI
  colors/Ctrl keys, and Studio-managed task move fallback (/api/tasks/move)
  when ax lacks promote.
- New task, Home, Settings & navigation: prototype four-step New task layout
  with Customize workspace and More options, user greeting on Home, cluster
  switcher in the sidebar footer card, deep links, browser notifications,
  and consolidated Settings tabs.

* Remove default task image setting (#9)

* Remove the default task image from Studio

AX is dropping the default task image: a task that names no image will
be rejected. Studio no longer asks for one at setup or install, passes
--default-task-image to `ax local start` and `ax install`, or reads
AX_DEFAULT_TASK_IMAGE to show it in Settings and suggest it on New task.
The AX server image and the runner volume image stay.

* Show this computer and the kubeconfig before the first cluster answers

The page drew nothing until the task list came back, so with a cluster
that can't be reached it stayed on "Checking…" for over a minute.
Render as soon as the environment is read.

* Add a tag-triggered release workflow (#8)

* Add a tag-triggered release workflow

Pushing a vX.Y.Z[-PRERELEASE] tag tests ax-studio, builds it for Linux and
macOS (amd64 and arm64) with `make dist`, and publishes the four archives
and checksums.txt to a GitHub release for the tag. The binary reports the
tag as its version, and a tag with a "-" is published as a prerelease.

A manual run builds the archives and keeps them as workflow artifacts
without publishing.

The build runs npm packages, so the checkout leaves no token in the git
config and only the publishing step is given one.

* remove clobber

* Refresh ax server dependency(go.mod) and use the shared ax client (#7)

* Use the ax client package and ax promote, and build against current AX

Studio now builds against AX main, where the proto field numbers, the
goal field (goal.text) and the Delete RPCs' responses changed.

- Connect through github.com/google/ax/client (ServerURL, Dial,
  CurrentContext, ListContexts) and drop Studio's own copy of the tunnel
  and kubeconfig code. Every handler passes its request context, so a
  request that is cancelled stops waiting for a port-forward.
- Read the local cluster from `ax local status -o json` instead of
  probing the container engine and kind.
- Running a task on another cluster is `ax promote` only. Studio's own
  move (POST /api/tasks/move) and its UI are removed.

* Say what the buttons for AX on this computer do when you point at them

Set up, Start, Update, Repair, Stop and Remove each get a tooltip that
names the ax command it runs and what happens to your tasks.

---------

Co-authored-by: Rajitha Leonhard <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants