Skip to content

Add the baseline for ax studio web app - #3

Merged
YoyinZyc merged 1 commit into
agentexecutor:web-studiofrom
YoyinZyc:feat/web-studio
Nov 18, 2026
Merged

YoyinZyc merged 1 commit into
agentexecutor:web-studiofrom
YoyinZyc:feat/web-studio

Conversation

@YoyinZyc

Copy link
Copy Markdown
Collaborator

TLDR

A baseline change for studio web app. We will iterate on it. Send it out for easier collaboration and e2e test.

Known gap

There are a lot of overlap between ax cli and studio go server. We need a public client library which can be shared.

Below is AI-generated description:


What this changes

AX Studio was an Electron app. Its main process ran ax on behalf of the UI. This PR replaces it with one Go binary, ax-studio, that serves the same React UI and a small API on 127.0.0.1:8080 and opens it in the browser.

  • No Electron, no installer, no code signing. The binary is about 5.5 MB with the UI embedded.
  • It works over SSH: run ax-studio --no-open on a remote machine and forward the port.
  • The UI is updated for the AX v1alpha1 API: goal, sessionId, profile, workspace setup, and Gateways with egress allow-lists.

What the server does

The server is kept thin. ax stays the source of truth; the server only does what a browser cannot.

Area What it does
Tasks, workspaces, gateways Runs an allow-list of ax subcommands for the UI: version, ctx, get, apply -f -, delete, suspend, resume, promote.
Environments Checks the host (container runtime, kernel, memory, disk), then runs ax local start/stop/delete or ax install and streams the output to the page. The server, default task, and runner volume images can be overridden; each maps to the ax flag of the same name.
Promote Runs ax promote. The dialog only picks its flags and shows --preflight-only output.
Sandbox changes For a task with spec.debug: true, shows the uncommitted Git changes in the sandbox over ax ssh, and can discard a file, apply the patch to a local checkout (after git apply --check), or push a branch.
Credentials Stores an API key as a cluster Secret labelled ax.io/credential: "true", passed over stdin, for a Gateway to inject.
Terminal Bridges ax ssh sessions to the in-page terminal.

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

Layout

cmd/ax-studio      entry point: flags, start the server, open the browser
internal/studio    HTTP server, security checks, API handlers, embedded UI
internal/kube      host checks, kubeconfig contexts, port-forward to ax-server
src/               React UI

Security

The server runs commands as the user, so it must not be reachable by anything but the user's own browser tab.

  • It binds only to loopback and refuses any other address.
  • It rejects requests whose Host or Origin is not loopback, which blocks DNS rebinding and cross-site requests.
  • Every request needs a per-process session cookie (HttpOnly, SameSite=Strict); every change also needs a CSRF token held only in page memory.
  • The browser can run only the ax subcommands listed above, and apply only from stdin, never a local file path.
  • A strict Content-Security-Policy allows scripts only from the server itself.

Not in this PR

  • Release workflow. CI builds and tests on every PR and cross-compiles the four release archives, but nothing publishes them yet.
  • ax studio. The launcher subcommand and the install.sh change that downloads ax-studio are a separate PR in google/ax.
  • Screenshots. docs/screenshots/ still shows the Electron app and needs to be retaken.

Follow-up: a public axclient package in google/ax

The code needed to reach an ax-server lives under internal/ in google/ax, so Studio carries its own copies. A small public package would let Studio delete them.

Proposed for axclient:

API From (google/ax) Replaces in Studio
ServerURL(context, namespace): return a reachable ax-server address, reusing or starting the port-forward recorded in ~/.ax/tunnels internal/tunnel.EnsureServerURL internal/kube/tunnel.go (~290 lines)
Dial(context, namespace): return a v1alpha1.AXClient for that address getAXClient in cmd/ax dialAXForContext in internal/studio/guest.go
ListContexts() / CurrentContext(): kubeconfig contexts and the active one internal/tunnel/context.go internal/kube/context.go (~150 lines)

Installer-side code Studio also duplicates (not client code; a separate public package, or JSON output from the CLI, would fit better):

API From (google/ax) Replaces in Studio
Local cluster status (state, Substrate, ax-server) internal/install/cluster (KindProvider.Status) internal/kube/local.go (~190 lines)
Container host checks (runtime, rootless, kernel, memory) internal/install/executil about half of internal/kube/exec.go (~170 lines)

Testing

  • make build and make verify pass: TypeScript check, go test -race ./..., gofmt, go vet.
  • golangci-lint with google/ax's configuration reports no issues.
  • Unit tests cover the loopback, Host, Origin, session and CSRF checks, the ax allow-list, and the sandbox changes flow (diff, apply to a local repository, push a branch) against a stub ax-server.
  • Manual: an earlier build of this branch was installed with install.sh and used end to end on macOS (local cluster setup, creating and running a task).
  • Not yet exercised on a real cluster: the ax promote dialog, which was rewritten after that manual run. ax promote accepts the command line the dialog builds, but a promotion between two clusters has not been run from the UI.

How to try it

make build
./bin/ax-studio            # opens http://127.0.0.1:8080
./bin/ax-studio --no-open  # over SSH; forward port 8080

It needs the ax CLI on PATH or in ~/.ax/bin.

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.
@YoyinZyc

YoyinZyc commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator Author

@mayawang @Raji14

I will merge it into this separated branch, @Raji14 you can play around with it with the following instruction:

  1. Image env: feel free to use my own image, or build your own(with /hack/publish-multiarch-images.sh in ax repo), before we have the official release. Please be aware the image could be a little bit outdated
export AX_SERVER_IMAGE=ghcr.io/yoyinzyc/ax/ax-server@sha256:32e1a9bdf6a0ca4558b7faee727a6e2a36eba5f495ed6725e867034e25d3c786
export AX_DEFAULT_TASK_IMAGE=ghcr.io/yoyinzyc/ax/ax-task-runner@sha256:5382526a63b0cabf694ac3e0b7ac5fe95c94975c563677e7078169f05ff911b0
  1. binaries installation: as we don't have the official release yet, please built it from code
git clone https://github.com/google/ax && cd ax
export GOTOOLCHAIN=auto
mkdir -p ~/.ax/bin
go build -o ~/.ax/bin/ax ./cmd/ax
export PATH="$HOME/.ax/bin:$PATH"

git clone -b feat/web-studio https://github.com/YoyinZyc/studio && cd studio
make build                          
cp bin/ax-studio ~/.ax/bin/
ax-studio     // open 127.0.0.1:8080

@YoyinZyc
YoyinZyc merged commit ccb5e69 into agentexecutor:web-studio Nov 18, 2026
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.

1 participant