Skip to content

An open-source, faster Devin alternative

TypeScript

Add Redis-backed worker discovery and gRPC dispatch from control plane

motatoes55bd47a348bf
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 00000000..a1904c8d
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,10 @@
+.git
+bin/
+web/node_modules/
+web/dist/
+archive/
+examples/
+server/
+*.md
+deploy/grafana/
+deploy/prometheus/
diff --git a/HANDOFF.md b/HANDOFF.md
new file mode 100644
index 00000000..c7b700c7
--- /dev/null
+++ b/HANDOFF.md
@@ -0,0 +1,278 @@
+# OpenSandbox — Implementation Handoff
+
+## What Was Built
+
+OpenSandbox was evolved from a single-process Go server into a globally distributed sandbox platform. The architecture is inspired by Cloudflare Durable Objects: the control plane is removed from the data path. SDKs connect directly to workers after initial sandbox creation.
+
+```
+CREATION (one-time):
+ SDK ──POST /sandboxes──> Control Plane ──gRPC──> Worker
+ SDK <── { sandboxID, connectURL, token }
+
+ALL SUBSEQUENT OPS (direct):
+ SDK ──HTTP/WS──> Worker (no control plane involved)
+
+ASYNC SYNC (background):
+ Worker ──NATS──> Consumer ──batch insert──> PostgreSQL
+```
+
+---
+
+## What's Done
+
+### Phase 1: Database + Auth + Session Tracking
+
+| File | What it does |
+|------|-------------|
+| `internal/db/store.go` | pgx-based data access layer — 15+ methods for orgs, users, API keys, sessions, workers |
+| `internal/db/migrations/001_initial.up.sql` | Full PG schema: orgs, users, api_keys, sandbox_sessions, command_logs, pty_session_logs, workers, templates |
+| `internal/auth/jwt.go` | Sandbox-scoped JWT issuing/validation (HS256). Claims: org_id, sandbox_id, worker_id |
+| `internal/auth/middleware.go` | `PGAPIKeyMiddleware` (API keys vs PG, static fallback) + `SandboxJWTMiddleware` (Bearer token on workers) |
+| `internal/sandbox/sqlite.go` | Per-sandbox SQLite with WAL mode — command_log, pty_sessions, events (with sync flag for NATS) |
+| `internal/api/sandbox.go` | Org quota checks, SQLite init, JWT/connectURL (only in server mode), PG session records |
+| `internal/api/commands.go` | SQLite command logging with timing |
+
+### Phase 2: Worker HTTP Server + Direct SDK Access
+
+| File | What it does |
+|------|-------------|
+| `internal/worker/http_server.go` | Echo HTTP server on worker — same REST API as control plane, but with JWT auth |
+| `internal/worker/handlers.go` | All handlers: getSandbox, runCommand, readFile, writeFile, listDir, makeDir, removeFile, createPTY, ptyWebSocket, killPTY |
+| `sdks/python/opensandbox/sandbox.py` | Uses `connectURL` + `token` from create response. `_data_client` for direct worker access |
+| `sdks/typescript/src/sandbox.ts` | Same pattern. `connectUrl`/`token` fields, passed to Filesystem/Commands/Pty classes |
+| `sdks/typescript/src/commands.ts`, `filesystem.ts`, `pty.ts` | Accept `token` param, use `Authorization: Bearer` when available |
+
+### Phase 3: gRPC + NATS Sync
+
+| File | What it does |
+|------|-------------|
+| `proto/worker/worker.pb.go`, `worker_grpc.pb.go` | Generated from `worker.proto` |
+| `internal/worker/grpc_server.go` | gRPC server wrapping sandbox.Manager — CreateSandbox, DestroySandbox, GetSandbox, ExecCommand, ReadFile, WriteFile, etc. |
+| `internal/worker/event_publisher.go` | NATS JetStream publisher — syncs SQLite events every 2s, heartbeats every 5s |
+| `internal/db/sync_consumer.go` | NATS consumer on control plane side — writes worker events to PG in batches |
+
+### Phase 4: Control Plane as Orchestrator
+
+| File | What it does |
+|------|-------------|
+| `internal/controlplane/server.go` | Thin CP: create via gRPC, discover sandbox location, destroy, list sessions/workers |
+| `internal/controlplane/worker_registry.go` | In-memory registry from NATS heartbeats. Stale detection (15s), region-based selection |
+| `internal/controlplane/scaler.go` | Autoscaler: >70% util = scale up, <30% = scale down, 10s check interval |
+| `internal/compute/pool.go` | Extended Pool interface: `SupportedRegions()`, `DrainMachine()`, Machine.HTTPAddr |
+| `internal/compute/router.go` | `AssignInRegion()` for region-aware routing |
+
+### Phase 5: Deploy + Observability
+
+| File | What it does |
+|------|-------------|
+| `internal/metrics/metrics.go` | 14 Prometheus metrics (gauges, counters, histograms) + Echo middleware + standalone /metrics server |
+| `deploy/docker-compose.yml` | PostgreSQL 16 + NATS 2 (JetStream) for local dev |
+| `deploy/fly.toml` | Fly.io control plane deployment config |
+| `deploy/fly-worker.toml` | Fly.io worker deployment (HTTP :8080, gRPC :9090, metrics :9091) |
+| `deploy/prometheus/prometheus.yml` | Scrape configs for CP and workers |
+| `deploy/grafana/dashboards/opensandbox-overview.json` | Dashboard: active sandboxes, create latency, utilization, sync lag |
+| `deploy/Dockerfile.server`, `Dockerfile.worker` | Both use CGO_ENABLED=1 (required by go-sqlite3) |
+
+### Phase 6: WorkOS (skeleton only)
+
+| File | What it does |
+|------|-------------|
+| `internal/auth/workos.go` | Middleware structure, `ProvisionOrgAndUser()`, `GenerateAPIKey()`. **`validateSession()` is stubbed.** |
+
+### Entry Points
+
+| File | What it does |
+|------|-------------|
+| `cmd/server/main.go` | Wires up: Podman, sandbox/PTY managers, templates, PG + migrations, JWT, SQLite, NATS consumer |
+| `cmd/worker/main.go` | Wires up: Podman, sandbox/PTY managers, SQLite, JWT, gRPC (:9090), HTTP (cfg.Port), NATS publisher, metrics (:9091), image pre-pulling |
+
+---
+
+## What's NOT Done
+
+### 1. WorkOS Authentication (Phase 6)
+`internal/auth/workos.go:97` — `validateSession()` returns `"not yet implemented"`.
+
+**To finish:**
+- Install WorkOS Go SDK
+- Implement `validateSession()` to call WorkOS session validation API
+- Add OAuth callback routes (`/auth/callback`, `/auth/login`, `/auth/logout`)
+- Wire into `cmd/server/main.go`
+
+### 2. Web Dashboard Frontend
+No frontend exists. The plan calls for a web dashboard with:
+- Session history viewer (data already available via `GET /sessions`)
+- API key management (CRUD already in `store.go`)
+- Org settings / billing (org table exists)
+- SSO login via WorkOS
+
+### 3. Prometheus Metrics Not Instrumented in Handlers
+`internal/metrics/metrics.go` defines 14 metrics but they are not yet called from the actual API handlers. For example, `metrics.SandboxesActive.Inc()` is never called in `createSandbox()`.
+
+**To finish:**
+- Add `metrics.SandboxesActive.Inc()` / `.Dec()` in sandbox create/kill handlers
+- Add `metrics.ExecDuration.Observe()` in command execution
+- Add `metrics.SandboxCreateDuration.Observe()` in create flow
+- Add `metrics.PTYSessionsActive` tracking in PTY handlers
+- etc.
+
+### 4. gRPC Streaming RPCs (intentionally deferred)
+`internal/worker/grpc_server.go` — `ExecCommandStream` (line 190) and `PTYStream` (line 208) return "not implemented, use HTTP/WS directly". These are low priority since SDKs use HTTP/WebSocket for the data path.
+
+### 5. Worker Heartbeat Stats
+`cmd/worker/main.go` line ~108 — heartbeat reports hardcoded `Capacity: 50, Current: 0`. Should read actual sandbox count from the manager.
+
+---
+
+## How to Test Locally
+
+### Prerequisites
+- Go 1.23+
+- Podman installed and running
+- Docker (for infrastructure containers)
+
+### Tier 1 — Simplest (no PG, no auth)
+```bash
+make run-dev
+# In another terminal:
+curl -s http://localhost:8080/health
+curl -s -X POST http://localhost:8080/sandboxes \
+ -H "Content-Type: application/json" \
+ -d '{"template":"base"}'
+```
+
+### Tier 2 — With PostgreSQL
+```bash
+make infra-up # starts PG + NATS
+make run-pg # starts server in combined mode with PG
+# In another terminal:
+make seed # creates test org + API key
+curl -s -X POST http://localhost:8080/sandboxes \
+ -H "Content-Type: application/json" \
+ -H "X-API-Key: test-key" \
+ -d '{"template":"base"}'
+```
+
+### Tier 3 — Separate Control Plane + Worker
+```bash
+make infra-up
+# Terminal 1 — control plane on :8080
+make run-full-server
+# Terminal 2 — worker on :8081
+make run-full-worker
+# Terminal 3
+make seed
+# Create sandbox via CP → get connectURL pointing to worker
+curl -s -X POST http://localhost:8080/sandboxes \
+ -H "Content-Type: application/json" \
+ -H "X-API-Key: test-key" \
+ -d '{"template":"base"}'
+# Response includes connectURL + token for direct worker access
+```
+
+### Stop Infrastructure
+```bash
+make infra-down # stop containers
+make infra-reset # stop + delete volumes
+```
+
+---
+
+## Key Design Decisions to Know
+
+1. **connectURL/token only in server mode** — In combined mode (`make run-pg`), the SDK already talks to the right server, so no redirect. This was a bug fix: `internal/api/sandbox.go` gates on `s.mode == "server"`.
+
+2. **CGO_ENABLED=1** — Required everywhere because of `go-sqlite3`. Both Dockerfiles and Makefile use it.
+
+3. **Three auth contexts** — Dashboard (WorkOS, stubbed), SDK (API keys in PG), Worker direct access (sandbox-scoped JWT). All coexist.
+
+4. **Fail, don't migrate** — When a worker dies, its sandboxes are marked as errored. No state migration attempted. Un-synced SQLite events are lost (acceptable — it's metadata).
+
+5. **gRPC only for creation** — CP → Worker uses gRPC only for create/destroy. All data-path operations (commands, files, PTY) go directly from SDK to worker over HTTP/WS.
+
+---
+
+## File Map
+
+```
+cmd/
+ server/main.go — Control plane / combined mode entry point
+ worker/main.go — Worker entry point
+
+internal/
+ api/
+ router.go — Echo server, routes, Server struct
+ sandbox.go — Create/get/kill/list/setTimeout/listSessions
+ commands.go — Execute commands (with SQLite logging)
+ filesystem.go — File read/write/list/mkdir/remove
+ pty.go — WebSocket PTY
+ template.go — Template CRUD
+
+ auth/
+ jwt.go — Sandbox-scoped JWT (issue + validate)
+ middleware.go — PGAPIKeyMiddleware + SandboxJWTMiddleware
+ workos.go — WorkOS skeleton (stubbed)
+
+ controlplane/
+ server.go — Thin CP server (create/discover/destroy)
+ worker_registry.go — NATS heartbeat → in-memory registry
+ scaler.go — Autoscaler (Pool interface)
+
+ db/
+ store.go — pgx data access layer
+ sync_consumer.go — NATS → PG batch writer
+ migrations/ — SQL up/down files
+
+ worker/
+ http_server.go — Worker HTTP server (JWT-authed)
+ handlers.go — All worker handlers
+ grpc_server.go — gRPC server (wraps sandbox.Manager)
+ event_publisher.go — NATS publisher (events + heartbeats)
+
+ sandbox/
+ manager.go — Container lifecycle (Podman)
+ pty.go — PTY session management
+ sqlite.go — Per-sandbox SQLite
+
+ compute/
+ pool.go — Pool interface (extended)
+ fly.go — Fly.io Machines API
+ local.go — Local/dev pool
+ router.go — Region-aware routing
+
+ config/config.go — All env var config
+ metrics/metrics.go — Prometheus metrics + Echo middleware
+
+sdks/
+ python/opensandbox/sandbox.py — Uses connectURL for direct worker access
+ typescript/src/
+ sandbox.ts — Uses connectURL for direct worker access
+ commands.ts — Bearer token support
+ filesystem.ts — Bearer token support
+ pty.ts — Bearer token support
+
+deploy/
+ docker-compose.yml — PG + NATS for local dev
+ fly.toml — CP Fly.io config
+ fly-worker.toml — Worker Fly.io config
+ Dockerfile.server — CP Docker image
+ Dockerfile.worker — Worker Docker image
+ prometheus/prometheus.yml — Prometheus scrape config
+ grafana/dashboards/ — Grafana dashboard JSON
+
+proto/worker/
+ worker.proto — gRPC service definition
+ worker.pb.go — Generated protobuf
+ worker_grpc.pb.go — Generated gRPC stubs
+```
+
+---
+
+## Suggested Next Steps (in priority order)
+
+1. **Test Tier 2 end-to-end** — `make infra-up && make run-pg`, then `make seed`, then create/exec/kill a sandbox with curl. Verify PG records are written.
+2. **Wire Prometheus metrics into handlers** — Low effort, high value. Add Inc/Dec/Observe calls in sandbox.go, commands.go, pty.go.
+3. **Fix worker heartbeat stats** — Read actual sandbox count from manager instead of hardcoded 50/0.
+4. **Implement WorkOS auth** — If you want a dashboard, this is the prerequisite.
+5. **Build web dashboard** — React/Next.js app, session history, API key management.
+6. **Test Tier 3 flow** — CP + Worker in separate processes, verify gRPC creation + direct SDK access.
diff --git a/Makefile b/Makefile
index 4fb3d50c..c1ac1a20 100644
--- a/Makefile
+++ b/Makefile
@@ -46,6 +46,35 @@ run-pg: build-server
OPENSANDBOX_HTTP_ADDR=http://localhost:8080 \
$(BUILD_DIR)/$(BINARY_SERVER)
+## run-pg-workos: Tier 2 - Combined with PG + WorkOS + Vite dev (requires: make infra-up)
+## Redirect URI goes through Vite proxy so cookies are set on :3000.
+## Add http://localhost:3000/auth/callback as redirect URI in your WorkOS dashboard.
+run-pg-workos: build-server
+ OPENSANDBOX_MODE=combined \
+ OPENSANDBOX_API_KEY=test-key \
+ OPENSANDBOX_JWT_SECRET=dev-secret-change-me \
+ OPENSANDBOX_DATABASE_URL="postgres://opensandbox:opensandbox@localhost:5432/opensandbox?sslmode=disable" \
+ OPENSANDBOX_DATA_DIR=/tmp/opensandbox-data \
+ OPENSANDBOX_HTTP_ADDR=http://localhost:8080 \
+ WORKOS_API_KEY=$${WORKOS_API_KEY} \
+ WORKOS_CLIENT_ID=$${WORKOS_CLIENT_ID} \
+ WORKOS_REDIRECT_URI=http://localhost:3000/auth/callback \
+ WORKOS_FRONTEND_URL=$${WORKOS_FRONTEND_URL} \
+ $(BUILD_DIR)/$(BINARY_SERVER)
+
+## run-pg-workos-prod: Tier 2 - Combined with PG + WorkOS + built dashboard (requires: make infra-up web-build)
+run-pg-workos-prod: build-server
+ OPENSANDBOX_MODE=combined \
+ OPENSANDBOX_API_KEY=test-key \
+ OPENSANDBOX_JWT_SECRET=dev-secret-change-me \
+ OPENSANDBOX_DATABASE_URL="postgres://opensandbox:opensandbox@localhost:5432/opensandbox?sslmode=disable" \
+ OPENSANDBOX_DATA_DIR=/tmp/opensandbox-data \
+ OPENSANDBOX_HTTP_ADDR=http://localhost:8080 \
+ WORKOS_API_KEY=$${WORKOS_API_KEY} \
+ WORKOS_CLIENT_ID=$${WORKOS_CLIENT_ID} \
+ WORKOS_REDIRECT_URI=http://localhost:8080/auth/callback \
+ $(BUILD_DIR)/$(BINARY_SERVER)
+
## run-full-server: Tier 3 - Control plane only (requires: make infra-up)
run-full-server: build-server
OPENSANDBOX_MODE=server \
@@ -70,6 +99,7 @@ run-full-worker: build-worker
OPENSANDBOX_WORKER_ID=w-local-1 \
OPENSANDBOX_HTTP_ADDR=http://localhost:8081 \
OPENSANDBOX_DATA_DIR=/tmp/opensandbox-worker-data \
+ OPENSANDBOX_MAX_CAPACITY=50 \
$(BUILD_DIR)/$(BINARY_WORKER)
## --- Infrastructure ---
@@ -99,6 +129,19 @@ seed:
ON CONFLICT (key_hash) DO NOTHING; \
" 2>/dev/null && echo "Seeded: org=test-org, api_key=test-key" || echo "Seed failed (run migrations first by starting the server)"
+## --- Web Dashboard ---
+
+## web-dev: Start Vite dev server for dashboard (proxies to Go on :8080)
+web-dev:
+ cd web && npm run dev
+
+## web-build: Build dashboard for production
+web-build:
+ cd web && npm install && npm run build
+
+## build-all: Build Go binaries + web dashboard
+build-all: build web-build
+
## --- Standard ---
## test: Run all tests
diff --git a/cmd/server/main.go b/cmd/server/main.go
index 50e206ef..1684500f 100644
--- a/cmd/server/main.go
+++ b/cmd/server/main.go
@@ -12,6 +12,7 @@ import (
"github.com/opensandbox/opensandbox/internal/api"
"github.com/opensandbox/opensandbox/internal/auth"
"github.com/opensandbox/opensandbox/internal/config"
+ "github.com/opensandbox/opensandbox/internal/controlplane"
"github.com/opensandbox/opensandbox/internal/db"
"github.com/opensandbox/opensandbox/internal/podman"
"github.com/opensandbox/opensandbox/internal/sandbox"
@@ -24,31 +25,43 @@ func main() {
log.Fatalf("failed to load config: %v", err)
}
- podmanClient, err := podman.NewClient()
- if err != nil {
- log.Fatalf("failed to initialize podman: %v", err)
- }
-
- // Verify podman is working
ctx := context.Background()
- version, err := podmanClient.Version(ctx)
+
+ // Initialize Podman (optional in server mode — no container runtime needed)
+ var mgr *sandbox.Manager
+ var ptyMgr *sandbox.PTYManager
+ var registry *template.Registry
+ var builder *template.Builder
+
+ podmanClient, err := podman.NewClient()
if err != nil {
- log.Fatalf("failed to get podman version: %v", err)
- }
- log.Printf("opensandbox: using podman %s", version)
+ if cfg.Mode == "server" {
+ log.Printf("opensandbox: podman not available (server-only mode, sandbox execution disabled): %v", err)
+ } else {
+ log.Fatalf("failed to initialize podman: %v", err)
+ }
+ } else {
+ version, err := podmanClient.Version(ctx)
+ if err != nil {
+ if cfg.Mode == "server" {
+ log.Printf("opensandbox: podman not responding (server-only mode, sandbox execution disabled): %v", err)
+ } else {
+ log.Fatalf("failed to get podman version: %v", err)
+ }
+ } else {
+ log.Printf("opensandbox: using podman %s", version)
- // Initialize sandbox manager
- mgr := sandbox.NewManager(podmanClient)
- defer mgr.Close()
+ mgr = sandbox.NewManager(podmanClient)
+ defer mgr.Close()
- // Initialize PTY manager
- podmanPath, _ := exec.LookPath("podman")
- ptyMgr := sandbox.NewPTYManager(podmanPath, podmanClient.AuthFile())
- defer ptyMgr.CloseAll()
+ podmanPath, _ := exec.LookPath("podman")
+ ptyMgr = sandbox.NewPTYManager(podmanPath, podmanClient.AuthFile())
+ defer ptyMgr.CloseAll()
- // Initialize template system
- registry := template.NewRegistry()
- builder := template.NewBuilder(podmanClient, registry)
+ registry = template.NewRegistry()
+ builder = template.NewBuilder(podmanClient, registry)
+ }
+ }
// Build server options
opts := &api.ServerOpts{
@@ -89,9 +102,35 @@ func main() {
opts.SandboxDBs = sandboxDBMgr
log.Printf("opensandbox: SQLite data directory: %s", cfg.DataDir)
+ // Configure WorkOS if credentials are set
+ if cfg.WorkOSAPIKey != "" && cfg.WorkOSClientID != "" {
+ opts.WorkOSConfig = &auth.WorkOSConfig{
+ APIKey: cfg.WorkOSAPIKey,
+ ClientID: cfg.WorkOSClientID,
+ RedirectURI: cfg.WorkOSRedirectURI,
+ CookieDomain: cfg.WorkOSCookieDomain,
+ FrontendURL: cfg.WorkOSFrontendURL,
+ }
+ log.Println("opensandbox: WorkOS authentication configured")
+ }
+
+ // Initialize Redis worker registry in server mode
+ if cfg.Mode == "server" && cfg.RedisURL != "" {
+ redisRegistry, err := controlplane.NewRedisWorkerRegistry(cfg.RedisURL)
+ if err != nil {
+ log.Fatalf("failed to connect to Redis: %v", err)
+ }
+ redisRegistry.Start()
+ defer redisRegistry.Stop()
+ opts.WorkerRegistry = redisRegistry
+ log.Println("opensandbox: Redis worker registry started")
+ }
+
// Create API server
server := api.NewServer(mgr, ptyMgr, cfg.APIKey, opts)
- server.SetTemplateDeps(registry, builder)
+ if registry != nil && builder != nil {
+ server.SetTemplateDeps(registry, builder)
+ }
// Start NATS sync consumer if both PG and NATS are configured
if opts.Store != nil && cfg.NATSURL != "" {
diff --git a/cmd/worker/main.go b/cmd/worker/main.go
index faeb8355..2b8de6f7 100644
--- a/cmd/worker/main.go
+++ b/cmd/worker/main.go
@@ -37,23 +37,6 @@ func main() {
}
log.Printf("opensandbox-worker: using podman %s", version)
- // Pre-pull common template images
- log.Println("opensandbox-worker: pre-pulling template images...")
- images := []string{
- "docker.io/library/ubuntu:22.04",
- "docker.io/library/python:3.12-slim",
- "docker.io/library/node:20-slim",
- }
- for _, img := range images {
- exists, _ := client.ImageExists(ctx, img)
- if !exists {
- log.Printf("opensandbox-worker: pulling %s...", img)
- if err := client.PullImage(ctx, img); err != nil {
- log.Printf("opensandbox-worker: warning: failed to pull %s: %v", img, err)
- }
- }
- }
-
// Initialize sandbox manager
mgr := sandbox.NewManager(client)
defer mgr.Close()
@@ -98,6 +81,47 @@ func main() {
}
}()
+ // Pre-pull common template images in background (non-blocking)
+ go func() {
+ images := []string{
+ "docker.io/library/ubuntu:22.04",
+ "docker.io/library/python:3.12-slim",
+ "docker.io/library/node:20-slim",
+ }
+ for _, img := range images {
+ exists, _ := client.ImageExists(ctx, img)
+ if !exists {
+ log.Printf("opensandbox-worker: pulling %s...", img)
+ if err := client.PullImage(ctx, img); err != nil {
+ log.Printf("opensandbox-worker: warning: failed to pull %s: %v", img, err)
+ }
+ }
+ }
+ log.Println("opensandbox-worker: template images ready")
+ }()
+
+ // Start Redis heartbeat for control plane discovery
+ if cfg.RedisURL != "" {
+ // On Fly.io, use the machine-specific internal address for gRPC
+ grpcAdvertise := grpcAddr
+ if allocID := os.Getenv("FLY_ALLOC_ID"); allocID != "" {
+ grpcAdvertise = allocID + ".vm.opensandbox-worker.internal:9090"
+ }
+
+ hb, err := worker.NewRedisHeartbeat(cfg.RedisURL, cfg.WorkerID, cfg.Region, grpcAdvertise, cfg.HTTPAddr)
+ if err != nil {
+ log.Printf("opensandbox-worker: Redis heartbeat not available: %v", err)
+ } else {
+ hb.Start(func() (int, int, float64, float64) {
+ count, _ := mgr.Count(context.Background())
+ cpuPct, memPct := worker.SystemStats()
+ return cfg.MaxCapacity, count, cpuPct, memPct
+ })
+ defer hb.Stop()
+ log.Println("opensandbox-worker: Redis heartbeat started")
+ }
+ }
+
// Start NATS event publisher if configured
if cfg.NATSURL != "" {
pub, err := worker.NewEventPublisher(cfg.NATSURL, cfg.Region, cfg.WorkerID, sandboxDBMgr)
@@ -106,8 +130,9 @@ func main() {
} else {
pub.Start()
pub.StartHeartbeat(func() (int, int, float64, float64) {
- // TODO: get actual stats from sandbox manager
- return 50, 0, 0.0, 0.0
+ count, _ := mgr.Count(context.Background())
+ cpuPct, memPct := worker.SystemStats()
+ return cfg.MaxCapacity, count, cpuPct, memPct
})
defer pub.Stop()
log.Println("opensandbox-worker: NATS event publisher started")
diff --git a/deploy/Dockerfile.server b/deploy/Dockerfile.server
index 51719413..56e72187 100644
--- a/deploy/Dockerfile.server
+++ b/deploy/Dockerfile.server
@@ -1,3 +1,13 @@
+# Stage 1: Build web frontend
+FROM node:20-slim AS frontend
+
+WORKDIR /web
+COPY web/package.json web/package-lock.json* ./
+RUN npm ci
+COPY web/ .
+RUN npm run build
+
+# Stage 2: Build Go binary
FROM golang:1.23-bookworm AS builder
WORKDIR /app
@@ -7,13 +17,16 @@ RUN go mod download
COPY . .
RUN CGO_ENABLED=1 go build -o /opensandbox-server ./cmd/server
+# Stage 3: Runtime
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
+WORKDIR /app
COPY --from=builder /opensandbox-server /usr/local/bin/opensandbox-server
+COPY --from=frontend /web/dist /app/web/dist
EXPOSE 8080
CMD ["opensandbox-server"]
diff --git a/deploy/fly-worker.toml b/deploy/fly-worker.toml
index 0de00d14..1fa33356 100644
--- a/deploy/fly-worker.toml
+++ b/deploy/fly-worker.toml
@@ -32,6 +32,8 @@ primary_region = "iad"
OPENSANDBOX_PORT = "8080"
OPENSANDBOX_REGION = "iad"
OPENSANDBOX_DATA_DIR = "/data/sandboxes"
+ OPENSANDBOX_HTTP_ADDR = "https://worker.opensandbox.ai"
+ # Secrets via `fly secrets set`: OPENSANDBOX_JWT_SECRET, OPENSANDBOX_REDIS_URL
[mounts]
source = "sandbox_data"
diff --git a/deploy/fly.toml b/deploy/fly.toml
index cb1b50ab..53beac88 100644
--- a/deploy/fly.toml
+++ b/deploy/fly.toml
@@ -7,7 +7,7 @@ primary_region = "iad"
[http_service]
internal_port = 8080
force_https = true
- auto_stop_machines = true
+ auto_stop_machines = false
auto_start_machines = true
min_machines_running = 1
@@ -16,5 +16,17 @@ primary_region = "iad"
OPENSANDBOX_PORT = "8080"
OPENSANDBOX_REGION = "iad"
OPENSANDBOX_WORKER_ID = "cp-iad-1"
- OPENSANDBOX_HTTP_ADDR = "https://opensandbox.fly.dev"
- # DATABASE_URL, JWT_SECRET, NATS_URL set via fly secrets
+ OPENSANDBOX_HTTP_ADDR = "https://app.opensandbox.ai"
+ OPENSANDBOX_DATA_DIR = "/data/sandboxes"
+ WORKOS_REDIRECT_URI = "https://app.opensandbox.ai/auth/callback"
+ WORKOS_COOKIE_DOMAIN = "opensandbox.ai"
+ # Secrets via `fly secrets set`: OPENSANDBOX_DATABASE_URL, OPENSANDBOX_JWT_SECRET,
+ # WORKOS_API_KEY, WORKOS_CLIENT_ID, OPENSANDBOX_REDIS_URL
+
+[mounts]
+ source = "osb_data"
+ destination = "/data"
+
+[[vm]]
+ size = "shared-cpu-1x"
+ memory = "512mb"
diff --git a/examples/test.py b/examples/test.py
index 2cfc437e..89d403c1 100644
--- a/examples/test.py
+++ b/examples/test.py
@@ -1,5 +1,6 @@
import asyncio
import sys
+
sys.path.insert(0, "../sdks/python")
from opensandbox import Sandbox
@@ -7,12 +8,16 @@ from opensandbox import Sandbox
async def main():
print("Creating sandbox...")
- async with await Sandbox.create(template="base", timeout=3600) as sb:
+ async with await Sandbox.create(
+ template="base",
+ timeout=3600,
+ api_url="https://app.opensandbox.ai",
+ ) as sb:
print(f"Sandbox created: {sb.sandbox_id}")
# Run commands
print("\n--- Commands ---")
- result = await sb.commands.run("echo hello from python sdk")
+ result = await sb.commands.run('echo "hello from python sdk"')
print(f"stdout: {result.stdout.strip()}")
print(f"exit code: {result.exit_code}")
@@ -39,26 +44,36 @@ async def main():
# Run a multi-line script
print("\n--- Script execution ---")
- await sb.files.write("/tmp/script.sh", "\n".join([
- "#!/bin/bash",
- 'echo "Current directory: $(pwd)"',
- 'echo "User: $(whoami)"',
- 'echo "Date: $(date)"',
- 'echo "Files in /tmp:"',
- "ls /tmp",
- ]))
+ await sb.files.write(
+ "/tmp/script.sh",
+ "\n".join(
+ [
+ "#!/bin/bash",
+ 'echo "Current directory: $(pwd)"',
+ 'echo "User: $(whoami)"',
+ 'echo "Date: $(date)"',
+ 'echo "Files in /tmp:"',
+ "ls /tmp",
+ ]
+ ),
+ )
script = await sb.commands.run("bash /tmp/script.sh")
print(script.stdout)
# Run Python inside the sandbox
print("--- Python in sandbox ---")
- await sb.files.write("/tmp/hello.py", "\n".join([
- "import os",
- "print(f'PID: {os.getpid()}')",
- "print(f'CWD: {os.getcwd()}')",
- "print('2 + 2 =', 2 + 2)",
- ]))
+ await sb.files.write(
+ "/tmp/hello.py",
+ "\n".join(
+ [
+ "import os",
+ "print(f'PID: {os.getpid()}')",
+ "print(f'CWD: {os.getcwd()}')",
+ "print('2 + 2 =', 2 + 2)",
+ ]
+ ),
+ )
py = await sb.commands.run("python /tmp/hello.py")
if py.exit_code == 0:
print(py.stdout)
diff --git a/examples/test.ts b/examples/test.ts
index c61811fa..2c5ec16a 100644
--- a/examples/test.ts
+++ b/examples/test.ts
@@ -2,7 +2,11 @@ import { Sandbox } from "../sdks/typescript/src/index";
async function main() {
console.log("Creating sandbox...");
- const sb = await Sandbox.create({ template: "base", timeout: 3600 });
+ const sb = await Sandbox.create({
+ template: "base",
+ timeout: 3600,
+ apiUrl: "https://app.opensandbox.ai",
+ });
console.log(`Sandbox created: ${sb.sandboxId}`);
// Run commands
@@ -34,14 +38,17 @@ async function main() {
// Run a multi-line script
console.log("\n--- Script execution ---");
- await sb.files.write("/tmp/script.sh", [
- "#!/bin/bash",
- 'echo "Current directory: $(pwd)"',
- 'echo "User: $(whoami)"',
- 'echo "Date: $(date)"',
- 'echo "Files in /tmp:"',
- "ls /tmp",
- ].join("\n"));
+ await sb.files.write(
+ "/tmp/script.sh",
+ [
+ "#!/bin/bash",
+ 'echo "Current directory: $(pwd)"',
+ 'echo "User: $(whoami)"',
+ 'echo "Date: $(date)"',
+ 'echo "Files in /tmp:"',
+ "ls /tmp",
+ ].join("\n"),
+ );
const script = await sb.commands.run("bash /tmp/script.sh");
console.log(script.stdout);
diff --git a/go.mod b/go.mod
index 3694356a..0d60981f 100644
--- a/go.mod
+++ b/go.mod
@@ -12,6 +12,8 @@ require (
github.com/mattn/go-sqlite3 v1.14.24
github.com/nats-io/nats.go v1.48.0
github.com/prometheus/client_golang v1.20.5
+ github.com/redis/go-redis/v9 v9.18.0
+ github.com/workos/workos-go/v4 v4.46.1
google.golang.org/grpc v1.69.4
google.golang.org/protobuf v1.36.3
)
@@ -19,7 +21,9 @@ require (
require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
+ github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
+ github.com/google/go-querystring v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/puddle/v2 v2.2.2 // indirect
@@ -35,6 +39,7 @@ require (
github.com/prometheus/procfs v0.15.1 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
+ go.uber.org/atomic v1.11.0 // indirect
golang.org/x/crypto v0.37.0 // indirect
golang.org/x/net v0.33.0 // indirect
golang.org/x/sync v0.13.0 // indirect
diff --git a/go.sum b/go.sum
index ee40f693..a2eb0254 100644
--- a/go.sum
+++ b/go.sum
@@ -1,5 +1,9 @@
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
+github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
+github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=
+github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
+github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/creack/pty v1.1.24 h1:bJrF4RRfyJnbTJqzRLHzcGaZK1NeM5kTC9jGgovnR1s=
@@ -7,6 +11,8 @@ github.com/creack/pty v1.1.24/go.mod h1:08sCNb52WyoAwi2QDyzUCTgcvVFhUzewun7wtTfv
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
+github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
@@ -19,6 +25,8 @@ github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
+github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=
+github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
@@ -33,6 +41,8 @@ github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo
github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
+github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4=
+github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/labstack/echo/v4 v4.12.0 h1:IKpw49IMryVB2p1a4dzwlhP1O2Tf2E0Ir/450lH+kI0=
@@ -64,15 +74,27 @@ github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G
github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8=
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
+github.com/redis/go-redis/v9 v9.18.0 h1:pMkxYPkEbMPwRdenAzUNyFNrDgHx9U+DrBabWNfSRQs=
+github.com/redis/go-redis/v9 v9.18.0/go.mod h1:k3ufPphLU5YXwNTUcCRXGxUoF1fqxnhFQmscfkCoDA0=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
+github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
+github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
-github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
-github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
+github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
+github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
+github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
+github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
+github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
+github.com/workos/workos-go/v4 v4.46.1 h1:Gk4EWxLIHxZ8aNlGpvddYyqhtq96fzcTHNqSoq0jVnE=
+github.com/workos/workos-go/v4 v4.46.1/go.mod h1:5NYFvNKzTkxTj2n3AbUc/8SOXvpzmP8LsiB31Vw5RCM=
+github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0=
+github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA=
go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY=
go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE=
go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE=
@@ -83,6 +105,8 @@ go.opentelemetry.io/otel/sdk/metric v1.31.0 h1:i9hxxLJF/9kkvfHppyLL55aW7iIJz4Jjx
go.opentelemetry.io/otel/sdk/metric v1.31.0/go.mod h1:CRInTMVvNhUKgSAMbKyTMxqOBC0zgyxzW55lZzX43Y8=
go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys=
go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A=
+go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
+go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
golang.org/x/crypto v0.37.0 h1:kJNSjF/Xp7kU0iB2Z+9viTPMW4EqqsrywMXLJOOsXSE=
golang.org/x/crypto v0.37.0/go.mod h1:vg+k43peMZ0pUMhYmVAWysMK35e6ioLh3wB8ZCAfbVc=
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
diff --git a/internal/api/commands.go b/internal/api/commands.go
index 92a3674c..3023bcca 100644
--- a/internal/api/commands.go
+++ b/internal/api/commands.go
@@ -9,6 +9,10 @@ import (
)
func (s *Server) runCommand(c echo.Context) error {
+ if s.manager == nil {
+ return c.JSON(http.StatusServiceUnavailable, errSandboxNotAvailable)
+ }
+
id := c.Param("id")
var cfg types.ProcessConfig
diff --git a/internal/api/dashboard.go b/internal/api/dashboard.go
new file mode 100644
index 00000000..fdac608c
--- /dev/null
+++ b/internal/api/dashboard.go
@@ -0,0 +1,217 @@
+package api
+
+import (
+ "net/http"
+
+ "github.com/google/uuid"
+ "github.com/labstack/echo/v4"
+ "github.com/opensandbox/opensandbox/internal/auth"
+ "github.com/opensandbox/opensandbox/internal/db"
+)
+
+// dashboardMe returns the current authenticated user info.
+func (s *Server) dashboardMe(c echo.Context) error {
+ userID := c.Get("user_id")
+ email := c.Get("user_email")
+ orgID, _ := auth.GetOrgID(c)
+
+ return c.JSON(http.StatusOK, map[string]interface{}{
+ "id": userID,
+ "email": email,
+ "orgId": orgID,
+ })
+}
+
+// dashboardSessions returns session history for the authenticated org.
+func (s *Server) dashboardSessions(c echo.Context) error {
+ if s.store == nil {
+ return c.JSON(http.StatusServiceUnavailable, map[string]string{
+ "error": "database not configured",
+ })
+ }
+
+ orgID, ok := auth.GetOrgID(c)
+ if !ok {
+ return c.JSON(http.StatusUnauthorized, map[string]string{
+ "error": "org context required",
+ })
+ }
+
+ status := c.QueryParam("status")
+ sessions, err := s.store.ListSandboxSessions(c.Request().Context(), orgID, status, 100, 0)
+ if err != nil {
+ return c.JSON(http.StatusInternalServerError, map[string]string{
+ "error": err.Error(),
+ })
+ }
+
+ return c.JSON(http.StatusOK, sessions)
+}
+
+// dashboardListAPIKeys returns all API keys for the authenticated org.
+func (s *Server) dashboardListAPIKeys(c echo.Context) error {
+ if s.store == nil {
+ return c.JSON(http.StatusServiceUnavailable, map[string]string{
+ "error": "database not configured",
+ })
+ }
+
+ orgID, ok := auth.GetOrgID(c)
+ if !ok {
+ return c.JSON(http.StatusUnauthorized, map[string]string{
+ "error": "org context required",
+ })
+ }
+
+ keys, err := s.store.ListAPIKeys(c.Request().Context(), orgID)
+ if err != nil {
+ return c.JSON(http.StatusInternalServerError, map[string]string{
+ "error": err.Error(),
+ })
+ }
+
+ return c.JSON(http.StatusOK, keys)
+}
+
+// dashboardCreateAPIKey creates a new API key for the authenticated org.
+func (s *Server) dashboardCreateAPIKey(c echo.Context) error {
+ if s.store == nil {
+ return c.JSON(http.StatusServiceUnavailable, map[string]string{
+ "error": "database not configured",
+ })
+ }
+
+ orgID, ok := auth.GetOrgID(c)
+ if !ok {
+ return c.JSON(http.StatusUnauthorized, map[string]string{
+ "error": "org context required",
+ })
+ }
+
+ var req struct {
+ Name string `json:"name"`
+ }
+ if err := c.Bind(&req); err != nil {
+ return c.JSON(http.StatusBadRequest, map[string]string{
+ "error": "invalid request body",
+ })
+ }
+ if req.Name == "" {
+ req.Name = "Untitled"
+ }
+
+ // Get user ID if available
+ var createdBy *uuid.UUID
+ if uid, ok := c.Get("user_id").(uuid.UUID); ok {
+ createdBy = &uid
+ }
+
+ plainKey, err := auth.GenerateAPIKey()
+ if err != nil {
+ return c.JSON(http.StatusInternalServerError, map[string]string{
+ "error": "failed to generate key",
+ })
+ }
+
+ hash := db.HashAPIKey(plainKey)
+ prefix := plainKey[:8]
+
+ apiKey, err := s.store.CreateAPIKey(c.Request().Context(), orgID, createdBy, hash, prefix, req.Name, []string{"sandbox:*"})
+ if err != nil {
+ return c.JSON(http.StatusInternalServerError, map[string]string{
+ "error": err.Error(),
+ })
+ }
+
+ // Return the key with the plaintext key (only shown once)
+ return c.JSON(http.StatusCreated, map[string]interface{}{
+ "id": apiKey.ID,
+ "name": apiKey.Name,
+ "key": plainKey,
+ "keyPrefix": apiKey.KeyPrefix,
+ "createdAt": apiKey.CreatedAt,
+ })
+}
+
+// dashboardDeleteAPIKey revokes an API key.
+func (s *Server) dashboardDeleteAPIKey(c echo.Context) error {
+ if s.store == nil {
+ return c.JSON(http.StatusServiceUnavailable, map[string]string{
+ "error": "database not configured",
+ })
+ }
+
+ keyID, err := uuid.Parse(c.Param("keyId"))
+ if err != nil {
+ return c.JSON(http.StatusBadRequest, map[string]string{
+ "error": "invalid key ID",
+ })
+ }
+
+ if err := s.store.DeleteAPIKey(c.Request().Context(), keyID); err != nil {
+ return c.JSON(http.StatusInternalServerError, map[string]string{
+ "error": err.Error(),
+ })
+ }
+
+ return c.NoContent(http.StatusNoContent)
+}
+
+// dashboardGetOrg returns the authenticated org info.
+func (s *Server) dashboardGetOrg(c echo.Context) error {
+ if s.store == nil {
+ return c.JSON(http.StatusServiceUnavailable, map[string]string{
+ "error": "database not configured",
+ })
+ }
+
+ orgID, ok := auth.GetOrgID(c)
+ if !ok {
+ return c.JSON(http.StatusUnauthorized, map[string]string{
+ "error": "org context required",
+ })
+ }
+
+ org, err := s.store.GetOrg(c.Request().Context(), orgID)
+ if err != nil {
+ return c.JSON(http.StatusInternalServerError, map[string]string{
+ "error": err.Error(),
+ })
+ }
+
+ return c.JSON(http.StatusOK, org)
+}
+
+// dashboardUpdateOrg updates the org name.
+func (s *Server) dashboardUpdateOrg(c echo.Context) error {
+ if s.store == nil {
+ return c.JSON(http.StatusServiceUnavailable, map[string]string{
+ "error": "database not configured",
+ })
+ }
+
+ orgID, ok := auth.GetOrgID(c)
+ if !ok {
+ return c.JSON(http.StatusUnauthorized, map[string]string{
+ "error": "org context required",
+ })
+ }
+
+ var req struct {
+ Name string `json:"name"`
+ }
+ if err := c.Bind(&req); err != nil || req.Name == "" {
+ return c.JSON(http.StatusBadRequest, map[string]string{
+ "error": "name is required",
+ })
+ }
+
+ org, err := s.store.UpdateOrg(c.Request().Context(), orgID, req.Name)
+ if err != nil {
+ return c.JSON(http.StatusInternalServerError, map[string]string{
+ "error": err.Error(),
+ })
+ }
+
+ return c.JSON(http.StatusOK, org)
+}
diff --git a/internal/api/filesystem.go b/internal/api/filesystem.go
index 96e72f29..41d2b515 100644
--- a/internal/api/filesystem.go
+++ b/internal/api/filesystem.go
@@ -8,6 +8,10 @@ import (
)
func (s *Server) readFile(c echo.Context) error {
+ if s.manager == nil {
+ return c.JSON(http.StatusServiceUnavailable, errSandboxNotAvailable)
+ }
+
id := c.Param("id")
path := c.QueryParam("path")
if path == "" {
@@ -27,6 +31,10 @@ func (s *Server) readFile(c echo.Context) error {
}
func (s *Server) writeFile(c echo.Context) error {
+ if s.manager == nil {
+ return c.JSON(http.StatusServiceUnavailable, errSandboxNotAvailable)
+ }
+
id := c.Param("id")
path := c.QueryParam("path")
if path == "" {
@@ -52,6 +60,10 @@ func (s *Server) writeFile(c echo.Context) error {
}
func (s *Server) listDir(c echo.Context) error {
+ if s.manager == nil {
+ return c.JSON(http.StatusServiceUnavailable, errSandboxNotAvailable)
+ }
+
id := c.Param("id")
path := c.QueryParam("path")
if path == "" {
@@ -69,6 +81,10 @@ func (s *Server) listDir(c echo.Context) error {
}
func (s *Server) makeDir(c echo.Context) error {
+ if s.manager == nil {
+ return c.JSON(http.StatusServiceUnavailable, errSandboxNotAvailable)
+ }
+
id := c.Param("id")
path := c.QueryParam("path")
if path == "" {
@@ -87,6 +103,10 @@ func (s *Server) makeDir(c echo.Context) error {
}
func (s *Server) removeFile(c echo.Context) error {
+ if s.manager == nil {
+ return c.JSON(http.StatusServiceUnavailable, errSandboxNotAvailable)
+ }
+
id := c.Param("id")
path := c.QueryParam("path")
if path == "" {
diff --git a/internal/api/pty.go b/internal/api/pty.go
index 763e583a..e7a5445c 100644
--- a/internal/api/pty.go
+++ b/internal/api/pty.go
@@ -18,6 +18,10 @@ var upgrader = websocket.Upgrader{
}
func (s *Server) createPTY(c echo.Context) error {
+ if s.ptyManager == nil {
+ return c.JSON(http.StatusServiceUnavailable, errSandboxNotAvailable)
+ }
+
id := c.Param("id")
var req types.PTYCreateRequest
@@ -41,6 +45,10 @@ func (s *Server) createPTY(c echo.Context) error {
}
func (s *Server) ptyWebSocket(c echo.Context) error {
+ if s.ptyManager == nil {
+ return c.JSON(http.StatusServiceUnavailable, errSandboxNotAvailable)
+ }
+
sessionID := c.Param("sessionID")
session, err := s.ptyManager.GetSession(sessionID)
@@ -102,6 +110,10 @@ func (s *Server) ptyWebSocket(c echo.Context) error {
}
func (s *Server) killPTY(c echo.Context) error {
+ if s.ptyManager == nil {
+ return c.JSON(http.StatusServiceUnavailable, errSandboxNotAvailable)
+ }
+
sessionID := c.Param("sessionID")
if err := s.ptyManager.KillSession(sessionID); err != nil {
diff --git a/internal/api/router.go b/internal/api/router.go
index 417f5de8..7902f003 100644
--- a/internal/api/router.go
+++ b/internal/api/router.go
@@ -1,39 +1,53 @@
package api
import (
+ "io/fs"
+ "log"
"net/http"
+ "os"
+ "path/filepath"
+ "strings"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
"github.com/opensandbox/opensandbox/internal/auth"
+ "github.com/opensandbox/opensandbox/internal/controlplane"
"github.com/opensandbox/opensandbox/internal/db"
"github.com/opensandbox/opensandbox/internal/sandbox"
)
+var errSandboxNotAvailable = map[string]string{
+ "error": "sandbox execution not available in server-only mode",
+}
+
// Server holds the API server dependencies.
type Server struct {
echo *echo.Echo
manager *sandbox.Manager
ptyManager *sandbox.PTYManager
templates *templateDeps
- store *db.Store // nil in combined/dev mode without PG
- jwtIssuer *auth.JWTIssuer // nil if JWT not configured
- mode string // "server", "worker", "combined"
- workerID string // this worker's ID
- region string // this worker's region
- httpAddr string // public HTTP address for direct access
- sandboxDBs *sandbox.SandboxDBManager // per-sandbox SQLite manager
+ store *db.Store // nil in combined/dev mode without PG
+ jwtIssuer *auth.JWTIssuer // nil if JWT not configured
+ mode string // "server", "worker", "combined"
+ workerID string // this worker's ID
+ region string // this worker's region
+ httpAddr string // public HTTP address for direct access
+ sandboxDBs *sandbox.SandboxDBManager // per-sandbox SQLite manager
+ workos *auth.WorkOSMiddleware // nil if WorkOS not configured
+ workerRegistry *controlplane.RedisWorkerRegistry // nil in combined/worker mode
}
// ServerOpts holds optional dependencies for the API server.
type ServerOpts struct {
- Store *db.Store
- JWTIssuer *auth.JWTIssuer
- Mode string // "server", "worker", "combined"
- WorkerID string
- Region string
- HTTPAddr string
- SandboxDBs *sandbox.SandboxDBManager
+ Store *db.Store
+ JWTIssuer *auth.JWTIssuer
+ Mode string // "server", "worker", "combined"
+ WorkerID string
+ Region string
+ HTTPAddr string
+ SandboxDBs *sandbox.SandboxDBManager
+ WorkOSConfig *auth.WorkOSConfig // nil if WorkOS not configured
+ WorkerRegistry *controlplane.RedisWorkerRegistry // nil in combined/worker mode
}
// NewServer creates a new API server with all routes configured.
@@ -56,6 +70,7 @@ func NewServer(mgr *sandbox.Manager, ptyMgr *sandbox.PTYManager, apiKey string,
s.region = opts.Region
s.httpAddr = opts.HTTPAddr
s.sandboxDBs = opts.SandboxDBs
+ s.workerRegistry = opts.WorkerRegistry
}
// Global middleware
@@ -69,8 +84,8 @@ func NewServer(mgr *sandbox.Manager, ptyMgr *sandbox.PTYManager, apiKey string,
return c.JSON(http.StatusOK, map[string]string{"status": "ok"})
})
- // API routes (with auth)
- api := e.Group("")
+ // API routes (with API key auth)
+ api := e.Group("/api")
api.Use(auth.PGAPIKeyMiddleware(s.store, apiKey))
// Sandbox lifecycle
@@ -104,9 +119,107 @@ func NewServer(mgr *sandbox.Manager, ptyMgr *sandbox.PTYManager, apiKey string,
// Session history (requires PG)
api.GET("/sessions", s.listSessions)
+ // WorkOS OAuth + Dashboard API routes (only if WorkOS is configured)
+ var frontendURL string
+ if opts != nil && opts.WorkOSConfig != nil && opts.WorkOSConfig.APIKey != "" {
+ frontendURL = opts.WorkOSConfig.FrontendURL
+
+ s.workos = auth.NewWorkOSMiddleware(*opts.WorkOSConfig, s.store)
+ oauthHandlers := auth.NewOAuthHandlers(s.workos)
+
+ // Public OAuth routes
+ e.GET("/auth/login", oauthHandlers.HandleLogin)
+ e.GET("/auth/callback", oauthHandlers.HandleCallback)
+ e.POST("/auth/logout", oauthHandlers.HandleLogout)
+
+ // Dashboard API routes (protected by WorkOS session middleware)
+ dash := e.Group("/api/dashboard")
+ dash.Use(s.workos.Middleware())
+
+ dash.GET("/me", s.dashboardMe)
+ dash.GET("/sessions", s.dashboardSessions)
+ dash.GET("/api-keys", s.dashboardListAPIKeys)
+ dash.POST("/api-keys", s.dashboardCreateAPIKey)
+ dash.DELETE("/api-keys/:keyId", s.dashboardDeleteAPIKey)
+ dash.GET("/org", s.dashboardGetOrg)
+ dash.PUT("/org", s.dashboardUpdateOrg)
+ }
+
+ // Auto-detect FrontendURL for dev: if web/dist doesn't exist, assume Vite dev on :3000
+ if frontendURL == "" && !dashboardDistExists() {
+ frontendURL = "http://localhost:3000"
+ log.Println("opensandbox: web/dist/ not found, auto-setting FrontendURL=http://localhost:3000 (Vite dev)")
+ }
+
+ // Serve web dashboard SPA at root (catch-all after API/auth routes)
+ s.serveDashboardUI(e, frontendURL)
+
return s
}
+// dashboardDistExists checks if the built web dashboard exists.
+func dashboardDistExists() bool {
+ if _, err := os.Stat("web/dist/index.html"); err == nil {
+ return true
+ }
+ execPath, _ := os.Executable()
+ distIndex := filepath.Join(filepath.Dir(execPath), "web", "dist", "index.html")
+ if _, err := os.Stat(distIndex); err == nil {
+ return true
+ }
+ return false
+}
+
+// serveDashboardUI serves the web dashboard SPA from web/dist/ at the root path.
+// All unmatched routes fall through to the SPA (client-side routing).
+func (s *Server) serveDashboardUI(e *echo.Echo, frontendURL string) {
+ // Look for web/dist relative to the working directory
+ distDir := "web/dist"
+ if _, err := os.Stat(distDir); err != nil {
+ execPath, _ := os.Executable()
+ distDir = filepath.Join(filepath.Dir(execPath), "web", "dist")
+ }
+
+ if _, err := os.Stat(distDir); err == nil {
+ // Production: serve built static files at root
+ fsys := os.DirFS(distDir)
+ fileServer := http.FileServer(http.FS(fsys))
+
+ spaHandler := echo.WrapHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ path := r.URL.Path
+ if path == "" || path == "/" {
+ http.ServeFileFS(w, r, fsys, "index.html")
+ return
+ }
+
+ // Serve static asset if it exists
+ if f, err := fs.Stat(fsys, strings.TrimPrefix(path, "/")); err == nil && !f.IsDir() {
+ fileServer.ServeHTTP(w, r)
+ return
+ }
+
+ // SPA fallback — serve index.html for client-side routes
+ http.ServeFileFS(w, r, fsys, "index.html")
+ }))
+
+ e.GET("/*", spaHandler)
+ return
+ }
+
+ // Dev mode: proxy to the Vite dev server
+ e.GET("/*", func(c echo.Context) error {
+ if frontendURL != "" {
+ target := frontendURL + c.Request().URL.Path
+ return c.Redirect(http.StatusFound, target)
+ }
+ return c.HTML(http.StatusOK, `<!DOCTYPE html>
+<html><head><title>OpenSandbox</title></head><body style="font-family:sans-serif;padding:40px;text-align:center">
+<h1>Dashboard not built</h1>
+<p>Run <code>cd web && npm run build</code> or start Vite dev: <code>cd web && npm run dev</code></p>
+</body></html>`)
+ })
+}
+
// Start starts the HTTP server on the given address.
func (s *Server) Start(addr string) error {
return s.echo.Start(addr)
diff --git a/internal/api/sandbox.go b/internal/api/sandbox.go
index c8e071a7..18a46e5b 100644
--- a/internal/api/sandbox.go
+++ b/internal/api/sandbox.go
@@ -1,13 +1,16 @@
package api
import (
+ "context"
"encoding/json"
+ "log"
"net/http"
"time"
"github.com/labstack/echo/v4"
"github.com/opensandbox/opensandbox/internal/auth"
"github.com/opensandbox/opensandbox/pkg/types"
+ pb "github.com/opensandbox/opensandbox/proto/worker"
)
func (s *Server) createSandbox(c echo.Context) error {
@@ -34,6 +37,16 @@ func (s *Server) createSandbox(c echo.Context) error {
}
}
+ // Server mode with worker registry: dispatch to remote worker via gRPC
+ if s.workerRegistry != nil {
+ return s.createSandboxRemote(c, ctx, cfg, orgID, hasOrg)
+ }
+
+ // Combined/worker mode: create locally
+ if s.manager == nil {
+ return c.JSON(http.StatusServiceUnavailable, errSandboxNotAvailable)
+ }
+
sb, err := s.manager.Create(ctx, cfg)
if err != nil {
return c.JSON(http.StatusInternalServerError, map[string]string{
@@ -52,9 +65,8 @@ func (s *Server) createSandbox(c echo.Context) error {
}
}
- // Issue sandbox-scoped JWT and connectURL only in server mode (separate worker).
- // In combined mode the SDK already talks to the right server, so no redirect needed.
- if s.jwtIssuer != nil && s.mode == "server" {
+ // Issue sandbox-scoped JWT for combined mode
+ if s.jwtIssuer != nil {
timeout := cfg.Timeout
if timeout <= 0 {
timeout = 300
@@ -63,9 +75,6 @@ func (s *Server) createSandbox(c echo.Context) error {
if err == nil {
sb.Token = token
}
- if s.httpAddr != "" {
- sb.ConnectURL = s.httpAddr
- }
}
// Write session record to PG if available
@@ -90,9 +99,91 @@ func (s *Server) createSandbox(c echo.Context) error {
return c.JSON(http.StatusCreated, sb)
}
+// createSandboxRemote dispatches sandbox creation to a remote worker via gRPC.
+func (s *Server) createSandboxRemote(c echo.Context, ctx context.Context, cfg types.SandboxConfig, orgID [16]byte, hasOrg bool) error {
+ // Select region (explicit header, or default to server's region)
+ region := c.Request().Header.Get("Fly-Region")
+ if region == "" {
+ region = s.region
+ }
+ if region == "" {
+ region = "iad"
+ }
+
+ worker, grpcClient, err := s.workerRegistry.GetLeastLoadedWorker(region)
+ if err != nil {
+ return c.JSON(http.StatusServiceUnavailable, map[string]string{
+ "error": "no workers available: " + err.Error(),
+ })
+ }
+
+ // Dispatch via persistent gRPC connection
+ grpcCtx, cancel := context.WithTimeout(ctx, 10*time.Second)
+ defer cancel()
+
+ grpcResp, err := grpcClient.CreateSandbox(grpcCtx, &pb.CreateSandboxRequest{
+ Template: cfg.Template,
+ Timeout: int32(cfg.Timeout),
+ Envs: cfg.Envs,
+ MemoryMb: int32(cfg.MemoryMB),
+ CpuCount: int32(cfg.CpuCount),
+ NetworkEnabled: cfg.NetworkEnabled,
+ })
+ if err != nil {
+ return c.JSON(http.StatusInternalServerError, map[string]string{
+ "error": "worker create failed: " + err.Error(),
+ })
+ }
+
+ // Issue sandbox-scoped JWT
+ timeout := cfg.Timeout
+ if timeout <= 0 {
+ timeout = 300
+ }
+ var token string
+ if s.jwtIssuer != nil {
+ t, err := s.jwtIssuer.IssueSandboxToken(orgID, grpcResp.SandboxId, worker.ID, time.Duration(timeout)*time.Second)
+ if err != nil {
+ log.Printf("sandbox: failed to issue JWT: %v", err)
+ } else {
+ token = t
+ }
+ }
+
+ // Record session in PG
+ if s.store != nil && hasOrg {
+ template := cfg.Template
+ if template == "" {
+ template = "base"
+ }
+ cfgJSON, _ := json.Marshal(cfg)
+ metadataJSON, _ := json.Marshal(cfg.Metadata)
+ _, _ = s.store.CreateSandboxSession(ctx, grpcResp.SandboxId, orgID, nil, template, region, worker.ID, cfgJSON, metadataJSON)
+ }
+
+ return c.JSON(http.StatusCreated, map[string]interface{}{
+ "sandboxID": grpcResp.SandboxId,
+ "connectURL": worker.HTTPAddr,
+ "token": token,
+ "status": grpcResp.Status,
+ "region": region,
+ "workerID": worker.ID,
+ })
+}
+
func (s *Server) getSandbox(c echo.Context) error {
id := c.Param("id")
+ // Server mode with worker registry: look up from PG and issue fresh token
+ if s.workerRegistry != nil {
+ return s.getSandboxRemote(c, id)
+ }
+
+ // Combined/worker mode: look up locally
+ if s.manager == nil {
+ return c.JSON(http.StatusServiceUnavailable, errSandboxNotAvailable)
+ }
+
sb, err := s.manager.Get(c.Request().Context(), id)
if err != nil {
return c.JSON(http.StatusNotFound, map[string]string{
@@ -100,10 +191,7 @@ func (s *Server) getSandbox(c echo.Context) error {
})
}
- // Attach connectURL for discovery only in server mode (separate worker)
- if s.jwtIssuer != nil && s.httpAddr != "" && s.mode == "server" {
- sb.ConnectURL = s.httpAddr
-
+ if s.jwtIssuer != nil {
orgID, hasOrg := auth.GetOrgID(c)
if hasOrg {
token, err := s.jwtIssuer.IssueSandboxToken(orgID, id, s.workerID, 24*time.Hour)
@@ -116,21 +204,74 @@ func (s *Server) getSandbox(c echo.Context) error {
return c.JSON(http.StatusOK, sb)
}
+// getSandboxRemote looks up a sandbox via the PG session record and returns
+// the worker's connectURL + a fresh JWT.
+func (s *Server) getSandboxRemote(c echo.Context, sandboxID string) error {
+ if s.store == nil {
+ return c.JSON(http.StatusServiceUnavailable, map[string]string{
+ "error": "database not configured",
+ })
+ }
+
+ session, err := s.store.GetSandboxSession(c.Request().Context(), sandboxID)
+ if err != nil {
+ return c.JSON(http.StatusNotFound, map[string]string{
+ "error": "sandbox not found",
+ })
+ }
+
+ // Look up worker address
+ worker := s.workerRegistry.GetWorker(session.WorkerID)
+ connectURL := ""
+ if worker != nil {
+ connectURL = worker.HTTPAddr
+ }
+
+ // Issue a fresh token
+ orgID, _ := auth.GetOrgID(c)
+ var token string
+ if s.jwtIssuer != nil {
+ t, err := s.jwtIssuer.IssueSandboxToken(orgID, sandboxID, session.WorkerID, 24*time.Hour)
+ if err == nil {
+ token = t
+ }
+ }
+
+ return c.JSON(http.StatusOK, map[string]interface{}{
+ "sandboxID": sandboxID,
+ "connectURL": connectURL,
+ "token": token,
+ "status": session.Status,
+ "region": session.Region,
+ "workerID": session.WorkerID,
+ "startedAt": session.StartedAt,
+ "template": session.Template,
+ })
+}
+
func (s *Server) killSandbox(c echo.Context) error {
id := c.Param("id")
+ // Server mode with worker registry: dispatch destroy via gRPC
+ if s.workerRegistry != nil {
+ return s.killSandboxRemote(c, id)
+ }
+
+ // Combined/worker mode: kill locally
+ if s.manager == nil {
+ return c.JSON(http.StatusServiceUnavailable, errSandboxNotAvailable)
+ }
+
if err := s.manager.Kill(c.Request().Context(), id); err != nil {
return c.JSON(http.StatusInternalServerError, map[string]string{
"error": err.Error(),
})
}
- // Update session in PG
if s.store != nil {
_ = s.store.UpdateSandboxSessionStatus(c.Request().Context(), id, "stopped", nil)
}
- // Clean up SQLite
if s.sandboxDBs != nil {
_ = s.sandboxDBs.Remove(id)
}
@@ -138,7 +279,54 @@ func (s *Server) killSandbox(c echo.Context) error {
return c.NoContent(http.StatusNoContent)
}
+// killSandboxRemote dispatches sandbox destruction to the appropriate worker via gRPC.
+func (s *Server) killSandboxRemote(c echo.Context, sandboxID string) error {
+ if s.store == nil {
+ return c.JSON(http.StatusServiceUnavailable, map[string]string{
+ "error": "database not configured",
+ })
+ }
+
+ session, err := s.store.GetSandboxSession(c.Request().Context(), sandboxID)
+ if err != nil {
+ return c.JSON(http.StatusNotFound, map[string]string{
+ "error": "sandbox not found",
+ })
+ }
+
+ // Attempt gRPC destroy (best-effort)
+ client, err := s.workerRegistry.GetWorkerClient(session.WorkerID)
+ if err != nil {
+ // Worker is unreachable — mark as error in PG
+ log.Printf("sandbox: worker %s unreachable for destroy: %v", session.WorkerID, err)
+ errMsg := "worker unreachable"
+ _ = s.store.UpdateSandboxSessionStatus(c.Request().Context(), sandboxID, "error", &errMsg)
+ return c.NoContent(http.StatusNoContent)
+ }
+
+ grpcCtx, cancel := context.WithTimeout(c.Request().Context(), 10*time.Second)
+ defer cancel()
+
+ if _, err := client.DestroySandbox(grpcCtx, &pb.DestroySandboxRequest{SandboxId: sandboxID}); err != nil {
+ log.Printf("sandbox: gRPC destroy failed for %s: %v", sandboxID, err)
+ }
+
+ _ = s.store.UpdateSandboxSessionStatus(c.Request().Context(), sandboxID, "stopped", nil)
+
+ return c.NoContent(http.StatusNoContent)
+}
+
func (s *Server) listSandboxes(c echo.Context) error {
+ // Server mode with worker registry: query PG for org's running sandboxes
+ if s.workerRegistry != nil {
+ return s.listSandboxesRemote(c)
+ }
+
+ // Combined/worker mode: list locally
+ if s.manager == nil {
+ return c.JSON(http.StatusServiceUnavailable, errSandboxNotAvailable)
+ }
+
sandboxes, err := s.manager.List(c.Request().Context())
if err != nil {
return c.JSON(http.StatusInternalServerError, map[string]string{
@@ -149,7 +337,72 @@ func (s *Server) listSandboxes(c echo.Context) error {
return c.JSON(http.StatusOK, sandboxes)
}
+// listSandboxesRemote queries PG for the org's running sandboxes and returns
+// connectURL + fresh JWT for each.
+func (s *Server) listSandboxesRemote(c echo.Context) error {
+ if s.store == nil {
+ return c.JSON(http.StatusServiceUnavailable, map[string]string{
+ "error": "database not configured",
+ })
+ }
+
+ orgID, ok := auth.GetOrgID(c)
+ if !ok {
+ return c.JSON(http.StatusUnauthorized, map[string]string{
+ "error": "org context required",
+ })
+ }
+
+ sessions, err := s.store.ListSandboxSessions(c.Request().Context(), orgID, "running", 100, 0)
+ if err != nil {
+ return c.JSON(http.StatusInternalServerError, map[string]string{
+ "error": err.Error(),
+ })
+ }
+
+ result := make([]map[string]interface{}, 0, len(sessions))
+ for _, sess := range sessions {
+ entry := map[string]interface{}{
+ "sandboxID": sess.SandboxID,
+ "status": sess.Status,
+ "region": sess.Region,
+ "workerID": sess.WorkerID,
+ "template": sess.Template,
+ "startedAt": sess.StartedAt,
+ }
+
+ // Attach connectURL from registry
+ worker := s.workerRegistry.GetWorker(sess.WorkerID)
+ if worker != nil {
+ entry["connectURL"] = worker.HTTPAddr
+ }
+
+ // Issue fresh JWT
+ if s.jwtIssuer != nil {
+ token, err := s.jwtIssuer.IssueSandboxToken(orgID, sess.SandboxID, sess.WorkerID, 24*time.Hour)
+ if err == nil {
+ entry["token"] = token
+ }
+ }
+
+ result = append(result, entry)
+ }
+
+ return c.JSON(http.StatusOK, result)
+}
+
func (s *Server) setTimeout(c echo.Context) error {
+ // In server mode, timeout must be set directly on the worker via connectURL
+ if s.workerRegistry != nil {
+ return c.JSON(http.StatusBadRequest, map[string]string{
+ "error": "timeout must be set directly on the worker via connectURL",
+ })
+ }
+
+ if s.manager == nil {
+ return c.JSON(http.StatusServiceUnavailable, errSandboxNotAvailable)
+ }
+
id := c.Param("id")
var req types.TimeoutRequest
diff --git a/internal/auth/oauth_handlers.go b/internal/auth/oauth_handlers.go
new file mode 100644
index 00000000..d64b7da6
--- /dev/null
+++ b/internal/auth/oauth_handlers.go
@@ -0,0 +1,226 @@
+package auth
+
+import (
+ "crypto/rand"
+ "encoding/hex"
+ "log"
+ "net/http"
+ "time"
+
+ "github.com/labstack/echo/v4"
+ "github.com/workos/workos-go/v4/pkg/usermanagement"
+)
+
+// OAuthHandlers provides HTTP handlers for WorkOS OAuth flow.
+type OAuthHandlers struct {
+ workos *WorkOSMiddleware
+}
+
+// NewOAuthHandlers creates new OAuth handlers.
+func NewOAuthHandlers(workos *WorkOSMiddleware) *OAuthHandlers {
+ return &OAuthHandlers{workos: workos}
+}
+
+// HandleLogin redirects the user to WorkOS AuthKit for authentication.
+func (h *OAuthHandlers) HandleLogin(c echo.Context) error {
+ cfg := h.workos.Config()
+
+ state, err := generateState()
+ if err != nil {
+ return c.JSON(http.StatusInternalServerError, map[string]string{
+ "error": "failed to generate state",
+ })
+ }
+
+ // Store state in cookie for CSRF protection
+ c.SetCookie(&http.Cookie{
+ Name: "oauth_state",
+ Value: state,
+ Path: "/",
+ MaxAge: 600,
+ HttpOnly: true,
+ SameSite: http.SameSiteLaxMode,
+ })
+
+ authURL, err := h.workos.UserMgr().GetAuthorizationURL(usermanagement.GetAuthorizationURLOpts{
+ ClientID: cfg.ClientID,
+ RedirectURI: cfg.RedirectURI,
+ Provider: "authkit",
+ State: state,
+ })
+ if err != nil {
+ return c.JSON(http.StatusInternalServerError, map[string]string{
+ "error": "failed to generate authorization URL: " + err.Error(),
+ })
+ }
+
+ return c.Redirect(http.StatusFound, authURL.String())
+}
+
+// HandleCallback exchanges the authorization code for user info and sets session cookie.
+func (h *OAuthHandlers) HandleCallback(c echo.Context) error {
+ code := c.QueryParam("code")
+ state := c.QueryParam("state")
+
+ if code == "" {
+ return c.JSON(http.StatusBadRequest, map[string]string{
+ "error": "missing authorization code",
+ })
+ }
+
+ // Verify CSRF state
+ stateCookie, err := c.Cookie("oauth_state")
+ if err != nil || stateCookie.Value != state {
+ return c.JSON(http.StatusBadRequest, map[string]string{
+ "error": "invalid state parameter",
+ })
+ }
+
+ // Clear state cookie
+ c.SetCookie(&http.Cookie{
+ Name: "oauth_state",
+ Value: "",
+ Path: "/",
+ MaxAge: -1,
+ })
+
+ cfg := h.workos.Config()
+ ctx := c.Request().Context()
+
+ // Exchange code for user info
+ authResult, err := h.workos.UserMgr().AuthenticateWithCode(ctx, usermanagement.AuthenticateWithCodeOpts{
+ ClientID: cfg.ClientID,
+ Code: code,
+ })
+ if err != nil {
+ log.Printf("workos: callback authentication failed: %v", err)
+ return c.JSON(http.StatusUnauthorized, map[string]string{
+ "error": "authentication failed",
+ })
+ }
+
+ // Build user display name
+ name := authResult.User.FirstName
+ if authResult.User.LastName != "" {
+ name += " " + authResult.User.LastName
+ }
+ if name == "" {
+ name = authResult.User.Email
+ }
+
+ // Determine org name — use organization ID or default
+ orgName := "Default"
+ if authResult.OrganizationID != "" {
+ orgName = authResult.OrganizationID
+ }
+
+ // Provision org and user in local database
+ localUser, err := h.workos.ProvisionOrgAndUser(ctx, authResult.User.Email, name, orgName)
+ if err != nil {
+ log.Printf("workos: provisioning failed: %v", err)
+ return c.JSON(http.StatusInternalServerError, map[string]string{
+ "error": "failed to provision user",
+ })
+ }
+
+ // Store the access token mapped to user for session validation
+ if h.workos.Store() != nil {
+ _ = h.workos.Store().StoreAccessToken(ctx, localUser.ID, authResult.AccessToken)
+ }
+
+ // Set session cookie with the access token
+ cookieDomain := cfg.CookieDomain
+ c.SetCookie(&http.Cookie{
+ Name: "workos_session",
+ Value: authResult.AccessToken,
+ Path: "/",
+ Domain: cookieDomain,
+ MaxAge: 86400 * 7, // 7 days
+ HttpOnly: true,
+ Secure: isSecureRequest(c),
+ SameSite: http.SameSiteLaxMode,
+ })
+
+ // Redirect to dashboard after login
+ return c.Redirect(http.StatusFound, "/")
+}
+
+// HandleLogout clears the session cookie and invalidates the server-side session.
+func (h *OAuthHandlers) HandleLogout(c echo.Context) error {
+ // Invalidate server-side session if we can identify the user
+ if cookie, err := c.Cookie("workos_session"); err == nil && cookie.Value != "" {
+ store := h.workos.Store()
+ if store != nil {
+ ctx := c.Request().Context()
+ user, err := store.GetUserByAccessToken(ctx, cookie.Value)
+ if err == nil {
+ _ = store.DeleteAccessTokensForUser(ctx, user.ID)
+ }
+ }
+ }
+
+ // Clear all auth cookies
+ ClearAllCookies(c)
+
+ return c.JSON(http.StatusOK, map[string]string{
+ "message": "logged out",
+ })
+}
+
+// HandleMe returns the current user info from the authenticated context.
+func (h *OAuthHandlers) HandleMe(c echo.Context) error {
+ userID := c.Get("user_id")
+ email := c.Get("user_email")
+ orgID, _ := GetOrgID(c)
+
+ return c.JSON(http.StatusOK, map[string]interface{}{
+ "id": userID,
+ "email": email,
+ "orgId": orgID,
+ })
+}
+
+// isSecureRequest returns true if the request is over HTTPS,
+// either directly or via a TLS-terminating proxy (e.g. fly.io).
+func isSecureRequest(c echo.Context) bool {
+ if c.Request().TLS != nil {
+ return true
+ }
+ return c.Request().Header.Get("X-Forwarded-Proto") == "https"
+}
+
+func generateState() (string, error) {
+ b := make([]byte, 16)
+ if _, err := rand.Read(b); err != nil {
+ return "", err
+ }
+ return hex.EncodeToString(b), nil
+}
+
+// SetRefreshCookie sets a refresh token cookie (used for token renewal).
+func SetRefreshCookie(c echo.Context, refreshToken, domain string) {
+ c.SetCookie(&http.Cookie{
+ Name: "workos_refresh",
+ Value: refreshToken,
+ Path: "/",
+ Domain: domain,
+ MaxAge: 86400 * 30, // 30 days
+ HttpOnly: true,
+ Secure: isSecureRequest(c),
+ SameSite: http.SameSiteLaxMode,
+ })
+}
+
+// ClearAllCookies helper to clear all auth cookies (used for force-logout).
+func ClearAllCookies(c echo.Context) {
+ for _, name := range []string{"workos_session", "workos_refresh", "oauth_state"} {
+ c.SetCookie(&http.Cookie{
+ Name: name,
+ Value: "",
+ Path: "/",
+ MaxAge: -1,
+ Expires: time.Unix(0, 0),
+ HttpOnly: true,
+ })
+ }
+}
diff --git a/internal/auth/workos.go b/internal/auth/workos.go
index 6e338c01..aa65466f 100644
--- a/internal/auth/workos.go
+++ b/internal/auth/workos.go
@@ -12,25 +12,34 @@ import (
"github.com/google/uuid"
"github.com/labstack/echo/v4"
"github.com/opensandbox/opensandbox/internal/db"
+ "github.com/workos/workos-go/v4/pkg/usermanagement"
)
// WorkOSConfig holds WorkOS integration settings.
type WorkOSConfig struct {
- APIKey string
- ClientID string
+ APIKey string
+ ClientID string
+ RedirectURI string
+ CookieDomain string
+ FrontendURL string // e.g. "http://localhost:3000" for Vite dev; empty = same origin
}
// WorkOSMiddleware validates WorkOS session tokens for dashboard access.
// It checks for a session cookie or Authorization header, validates with WorkOS,
// and provisions orgs/users in the local database on first login.
type WorkOSMiddleware struct {
- config WorkOSConfig
- store *db.Store
+ config WorkOSConfig
+ store *db.Store
+ userMgr *usermanagement.Client
}
// NewWorkOSMiddleware creates WorkOS session middleware.
func NewWorkOSMiddleware(config WorkOSConfig, store *db.Store) *WorkOSMiddleware {
- return &WorkOSMiddleware{config: config, store: store}
+ var userMgr *usermanagement.Client
+ if config.APIKey != "" {
+ userMgr = usermanagement.NewClient(config.APIKey)
+ }
+ return &WorkOSMiddleware{config: config, store: store, userMgr: userMgr}
}
// Middleware returns the Echo middleware function.
@@ -42,26 +51,26 @@ func (w *WorkOSMiddleware) Middleware() echo.MiddlewareFunc {
return next(c)
}
- // Extract session token from cookie or header
- sessionToken := ""
+ // Extract access token from cookie or header
+ accessToken := ""
if cookie, err := c.Cookie("workos_session"); err == nil {
- sessionToken = cookie.Value
+ accessToken = cookie.Value
}
- if sessionToken == "" {
+ if accessToken == "" {
auth := c.Request().Header.Get("Authorization")
- if strings.HasPrefix(auth, "Bearer wos_") {
- sessionToken = strings.TrimPrefix(auth, "Bearer ")
+ if strings.HasPrefix(auth, "Bearer ") {
+ accessToken = strings.TrimPrefix(auth, "Bearer ")
}
}
- if sessionToken == "" {
+ if accessToken == "" {
return c.JSON(http.StatusUnauthorized, map[string]string{
"error": "authentication required",
})
}
// Validate session with WorkOS
- user, err := w.validateSession(c.Request().Context(), sessionToken)
+ user, err := w.validateSession(c.Request().Context(), accessToken)
if err != nil {
return c.JSON(http.StatusUnauthorized, map[string]string{
"error": "invalid session: " + err.Error(),
@@ -86,15 +95,53 @@ type WorkOSUser struct {
Name string
}
-// validateSession validates a WorkOS session token.
-// In production, this calls the WorkOS API. For now, it's a placeholder.
-func (w *WorkOSMiddleware) validateSession(ctx context.Context, token string) (*WorkOSUser, error) {
- // TODO: Implement actual WorkOS API call:
- // POST https://api.workos.com/user_management/sessions/authenticate
- // with { session_token: token, client_id: w.config.ClientID }
- // This returns user info including email, org membership, etc.
- _ = token
- return nil, fmt.Errorf("WorkOS session validation not yet implemented")
+// UserMgr returns the WorkOS user management client for use in OAuth handlers.
+func (w *WorkOSMiddleware) UserMgr() *usermanagement.Client {
+ return w.userMgr
+}
+
+// Config returns the WorkOS configuration.
+func (w *WorkOSMiddleware) Config() WorkOSConfig {
+ return w.config
+}
+
+// Store returns the database store.
+func (w *WorkOSMiddleware) Store() *db.Store {
+ return w.store
+}
+
+// validateSession validates a WorkOS access token by looking up the user
+// in the local database. The access token is the one returned by
+// AuthenticateWithCode during the OAuth callback, and the user was
+// provisioned at that time.
+func (w *WorkOSMiddleware) validateSession(ctx context.Context, accessToken string) (*WorkOSUser, error) {
+ if w.store == nil {
+ return nil, fmt.Errorf("database not configured")
+ }
+
+ // The access token is stored alongside the user email during callback.
+ // Look up the user by the stored access token.
+ // For simplicity, we re-validate with WorkOS by fetching user info
+ // using the access token that was issued during authentication.
+ if w.userMgr == nil {
+ return nil, fmt.Errorf("WorkOS not configured")
+ }
+
+ // Use the refresh token flow to validate the session.
+ // First try to find the user from the cookie's access token.
+ // The access token was set during the callback after AuthenticateWithCode.
+ // We look up the user by matching the token stored in the session cookie.
+ user, err := w.store.GetUserByAccessToken(ctx, accessToken)
+ if err != nil {
+ return nil, fmt.Errorf("invalid or expired session")
+ }
+
+ return &WorkOSUser{
+ ID: user.ID,
+ OrgID: user.OrgID,
+ Email: user.Email,
+ Name: user.Name,
+ }, nil
}
// ProvisionOrgAndUser creates or fetches an org and user based on WorkOS data.
diff --git a/internal/config/config.go b/internal/config/config.go
index 974ad413..04a35153 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -30,8 +30,17 @@ type Config struct {
HTTPAddr string // Public HTTP address for direct SDK access
// WorkOS
- WorkOSAPIKey string
- WorkOSClientID string
+ WorkOSAPIKey string
+ WorkOSClientID string
+ WorkOSRedirectURI string
+ WorkOSCookieDomain string
+ WorkOSFrontendURL string // e.g. "http://localhost:3000" for Vite dev
+
+ // Redis (Upstash) for worker discovery
+ RedisURL string
+
+ // Worker capacity
+ MaxCapacity int
}
// Load reads configuration from environment variables with sensible defaults.
@@ -43,7 +52,7 @@ func Load() (*Config, error) {
Mode: envOrDefault("OPENSANDBOX_MODE", "combined"),
LogLevel: envOrDefault("OPENSANDBOX_LOG_LEVEL", "info"),
- DatabaseURL: os.Getenv("OPENSANDBOX_DATABASE_URL"),
+ DatabaseURL: envOrDefault("OPENSANDBOX_DATABASE_URL", os.Getenv("DATABASE_URL")),
DataDir: envOrDefault("OPENSANDBOX_DATA_DIR", "/data/sandboxes"),
JWTSecret: os.Getenv("OPENSANDBOX_JWT_SECRET"),
NATSURL: envOrDefault("OPENSANDBOX_NATS_URL", "nats://localhost:4222"),
@@ -51,8 +60,15 @@ func Load() (*Config, error) {
WorkerID: envOrDefault("OPENSANDBOX_WORKER_ID", "w-local-1"),
HTTPAddr: envOrDefault("OPENSANDBOX_HTTP_ADDR", "http://localhost:8080"),
- WorkOSAPIKey: os.Getenv("WORKOS_API_KEY"),
- WorkOSClientID: os.Getenv("WORKOS_CLIENT_ID"),
+ WorkOSAPIKey: os.Getenv("WORKOS_API_KEY"),
+ WorkOSClientID: os.Getenv("WORKOS_CLIENT_ID"),
+ WorkOSRedirectURI: envOrDefault("WORKOS_REDIRECT_URI", "http://localhost:8080/auth/callback"),
+ WorkOSCookieDomain: os.Getenv("WORKOS_COOKIE_DOMAIN"),
+ WorkOSFrontendURL: os.Getenv("WORKOS_FRONTEND_URL"),
+
+ RedisURL: os.Getenv("OPENSANDBOX_REDIS_URL"),
+
+ MaxCapacity: envOrDefaultInt("OPENSANDBOX_MAX_CAPACITY", 50),
}
if portStr := os.Getenv("OPENSANDBOX_PORT"); portStr != "" {
@@ -72,3 +88,12 @@ func envOrDefault(key, fallback string) string {
}
return fallback
}
+
+func envOrDefaultInt(key string, fallback int) int {
+ if v := os.Getenv(key); v != "" {
+ if n, err := strconv.Atoi(v); err == nil {
+ return n
+ }
+ }
+ return fallback
+}
diff --git a/internal/controlplane/redis_registry.go b/internal/controlplane/redis_registry.go
new file mode 100644
index 00000000..d424ada7
--- /dev/null
+++ b/internal/controlplane/redis_registry.go
@@ -0,0 +1,327 @@
+package controlplane
+
+import (
+ "context"
+ "encoding/json"
+ "fmt"
+ "log"
+ "sync"
+ "time"
+
+ "github.com/redis/go-redis/v9"
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/credentials/insecure"
+
+ pb "github.com/opensandbox/opensandbox/proto/worker"
+)
+
+// WorkerEntry represents a worker in the Redis-backed registry.
+type WorkerEntry struct {
+ ID string `json:"worker_id"`
+ Region string `json:"region"`
+ GRPCAddr string `json:"grpc_addr"`
+ HTTPAddr string `json:"http_addr"`
+ Capacity int `json:"capacity"`
+ Current int `json:"current"`
+ CPUPct float64 `json:"cpu_pct"`
+ MemPct float64 `json:"mem_pct"`
+}
+
+// RedisWorkerRegistry maintains an in-memory cache of worker state
+// backed by Redis pub/sub for real-time updates and periodic SCAN for reconciliation.
+// It also maintains a persistent gRPC connection pool to workers.
+type RedisWorkerRegistry struct {
+ rdb *redis.Client
+ mu sync.RWMutex
+ workers map[string]*WorkerEntry // in-memory hot cache
+ conns map[string]*grpc.ClientConn // persistent gRPC connections
+ clients map[string]pb.SandboxWorkerClient // cached gRPC clients
+ stop chan struct{}
+}
+
+// NewRedisWorkerRegistry connects to Redis and returns a new registry.
+func NewRedisWorkerRegistry(redisURL string) (*RedisWorkerRegistry, error) {
+ opts, err := redis.ParseURL(redisURL)
+ if err != nil {
+ return nil, fmt.Errorf("invalid redis URL: %w", err)
+ }
+
+ rdb := redis.NewClient(opts)
+
+ ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
+ defer cancel()
+ if err := rdb.Ping(ctx).Err(); err != nil {
+ rdb.Close()
+ return nil, fmt.Errorf("redis ping failed: %w", err)
+ }
+
+ return &RedisWorkerRegistry{
+ rdb: rdb,
+ workers: make(map[string]*WorkerEntry),
+ conns: make(map[string]*grpc.ClientConn),
+ clients: make(map[string]pb.SandboxWorkerClient),
+ stop: make(chan struct{}),
+ }, nil
+}
+
+// Start subscribes to the workers:heartbeat pub/sub channel and runs
+// periodic reconciliation by scanning worker:* keys in Redis.
+func (r *RedisWorkerRegistry) Start() {
+ // Pub/sub subscriber
+ go r.subscribeLoop()
+
+ // Periodic reconciliation + stale worker cleanup
+ go r.reconcileLoop()
+}
+
+// subscribeLoop listens for heartbeat messages via Redis pub/sub.
+func (r *RedisWorkerRegistry) subscribeLoop() {
+ for {
+ select {
+ case <-r.stop:
+ return
+ default:
+ }
+
+ pubsub := r.rdb.Subscribe(context.Background(), "workers:heartbeat")
+ ch := pubsub.Channel()
+
+ for {
+ select {
+ case msg, ok := <-ch:
+ if !ok {
+ goto reconnect
+ }
+ var entry WorkerEntry
+ if err := json.Unmarshal([]byte(msg.Payload), &entry); err != nil {
+ log.Printf("redis_registry: invalid heartbeat payload: %v", err)
+ continue
+ }
+ r.handleHeartbeat(entry)
+ case <-r.stop:
+ pubsub.Close()
+ return
+ }
+ }
+
+ reconnect:
+ pubsub.Close()
+ log.Println("redis_registry: pub/sub channel closed, reconnecting...")
+ time.Sleep(2 * time.Second)
+ }
+}
+
+// reconcileLoop periodically scans Redis for worker:* keys.
+// Workers present in Redis are added/updated; workers absent from Redis
+// for 2 consecutive cycles are removed. This is the primary discovery
+// mechanism — pub/sub provides faster first-detection but is not required.
+func (r *RedisWorkerRegistry) reconcileLoop() {
+ ticker := time.NewTicker(10 * time.Second)
+ defer ticker.Stop()
+
+ // Do an initial scan immediately
+ r.reconcileAndPrune()
+
+ for {
+ select {
+ case <-ticker.C:
+ r.reconcileAndPrune()
+ case <-r.stop:
+ return
+ }
+ }
+}
+
+// reconcileAndPrune scans all worker:* keys in Redis, updates the in-memory
+// map, and removes any workers whose keys have expired (TTL elapsed).
+func (r *RedisWorkerRegistry) reconcileAndPrune() {
+ ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
+ defer cancel()
+
+ var cursor uint64
+ seen := make(map[string]bool)
+
+ for {
+ keys, nextCursor, err := r.rdb.Scan(ctx, cursor, "worker:*", 100).Result()
+ if err != nil {
+ log.Printf("redis_registry: SCAN failed: %v", err)
+ return
+ }
+
+ for _, key := range keys {
+ val, err := r.rdb.Get(ctx, key).Result()
+ if err != nil {
+ continue
+ }
+ var entry WorkerEntry
+ if err := json.Unmarshal([]byte(val), &entry); err != nil {
+ continue
+ }
+ seen[entry.ID] = true
+ r.handleHeartbeat(entry)
+ }
+
+ cursor = nextCursor
+ if cursor == 0 {
+ break
+ }
+ }
+
+ // Remove workers not found in this scan
+ r.mu.Lock()
+ defer r.mu.Unlock()
+ for id := range r.workers {
+ if !seen[id] {
+ log.Printf("redis_registry: worker %s no longer in Redis, removing", id)
+ delete(r.workers, id)
+ if conn, ok := r.conns[id]; ok {
+ conn.Close()
+ delete(r.conns, id)
+ delete(r.clients, id)
+ }
+ }
+ }
+}
+
+// handleHeartbeat updates the in-memory worker map and dials gRPC if this is a new worker.
+func (r *RedisWorkerRegistry) handleHeartbeat(entry WorkerEntry) {
+ r.mu.Lock()
+ defer r.mu.Unlock()
+
+ existing, ok := r.workers[entry.ID]
+ if ok {
+ // Update existing entry
+ existing.Current = entry.Current
+ existing.Capacity = entry.Capacity
+ existing.CPUPct = entry.CPUPct
+ existing.MemPct = entry.MemPct
+ if entry.GRPCAddr != "" {
+ existing.GRPCAddr = entry.GRPCAddr
+ }
+ if entry.HTTPAddr != "" {
+ existing.HTTPAddr = entry.HTTPAddr
+ }
+ } else {
+ // New worker
+ r.workers[entry.ID] = &entry
+ log.Printf("redis_registry: new worker registered: %s (region=%s, grpc=%s)", entry.ID, entry.Region, entry.GRPCAddr)
+ }
+
+ // Ensure gRPC connection exists
+ if _, hasConn := r.conns[entry.ID]; !hasConn && entry.GRPCAddr != "" {
+ r.dialWorkerLocked(entry.ID, entry.GRPCAddr)
+ }
+}
+
+// dialWorkerLocked dials a gRPC connection to a worker. Must be called with r.mu held.
+func (r *RedisWorkerRegistry) dialWorkerLocked(workerID, grpcAddr string) {
+ conn, err := grpc.NewClient(grpcAddr,
+ grpc.WithTransportCredentials(insecure.NewCredentials()),
+ )
+ if err != nil {
+ log.Printf("redis_registry: failed to dial gRPC for worker %s at %s: %v", workerID, grpcAddr, err)
+ return
+ }
+ r.conns[workerID] = conn
+ r.clients[workerID] = pb.NewSandboxWorkerClient(conn)
+ log.Printf("redis_registry: gRPC connection established to worker %s at %s", workerID, grpcAddr)
+}
+
+// GetLeastLoadedWorker returns the worker with the most remaining capacity.
+// If region is non-empty, only workers in that region are considered.
+// If no workers match the region, falls back to all workers.
+func (r *RedisWorkerRegistry) GetLeastLoadedWorker(region string) (*WorkerEntry, pb.SandboxWorkerClient, error) {
+ r.mu.RLock()
+ defer r.mu.RUnlock()
+
+ var best *WorkerEntry
+ bestRemaining := -1
+
+ // First pass: try workers in the requested region
+ for _, w := range r.workers {
+ if region != "" && w.Region != region {
+ continue
+ }
+ remaining := w.Capacity - w.Current
+ if remaining <= 0 {
+ continue
+ }
+ if remaining > bestRemaining {
+ best = w
+ bestRemaining = remaining
+ }
+ }
+
+ // Fallback: try any region
+ if best == nil && region != "" {
+ for _, w := range r.workers {
+ remaining := w.Capacity - w.Current
+ if remaining <= 0 {
+ continue
+ }
+ if remaining > bestRemaining {
+ best = w
+ bestRemaining = remaining
+ }
+ }
+ }
+
+ if best == nil {
+ return nil, nil, fmt.Errorf("no workers available")
+ }
+
+ client, ok := r.clients[best.ID]
+ if !ok {
+ return nil, nil, fmt.Errorf("no gRPC connection to worker %s", best.ID)
+ }
+
+ return best, client, nil
+}
+
+// GetWorkerClient returns the gRPC client for a specific worker.
+func (r *RedisWorkerRegistry) GetWorkerClient(workerID string) (pb.SandboxWorkerClient, error) {
+ r.mu.RLock()
+ defer r.mu.RUnlock()
+
+ client, ok := r.clients[workerID]
+ if !ok {
+ return nil, fmt.Errorf("no gRPC connection to worker %s", workerID)
+ }
+ return client, nil
+}
+
+// GetWorker returns the entry for a specific worker.
+func (r *RedisWorkerRegistry) GetWorker(workerID string) *WorkerEntry {
+ r.mu.RLock()
+ defer r.mu.RUnlock()
+ return r.workers[workerID]
+}
+
+// GetAllWorkers returns all known workers.
+func (r *RedisWorkerRegistry) GetAllWorkers() []*WorkerEntry {
+ r.mu.RLock()
+ defer r.mu.RUnlock()
+
+ result := make([]*WorkerEntry, 0, len(r.workers))
+ for _, w := range r.workers {
+ result = append(result, w)
+ }
+ return result
+}
+
+// Stop closes the Redis client and all gRPC connections.
+func (r *RedisWorkerRegistry) Stop() {
+ close(r.stop)
+
+ r.mu.Lock()
+ defer r.mu.Unlock()
+
+ for id, conn := range r.conns {
+ conn.Close()
+ delete(r.conns, id)
+ delete(r.clients, id)
+ }
+
+ r.rdb.Close()
+ log.Println("redis_registry: stopped")
+}
diff --git a/internal/db/migrations/002_user_sessions.up.sql b/internal/db/migrations/002_user_sessions.up.sql
new file mode 100644
index 00000000..7a3525a6
--- /dev/null
+++ b/internal/db/migrations/002_user_sessions.up.sql
@@ -0,0 +1,10 @@
+-- User Sessions (WorkOS access tokens)
+CREATE TABLE user_sessions (
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
+ user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
+ access_token TEXT NOT NULL UNIQUE,
+ created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
+ expires_at TIMESTAMPTZ NOT NULL DEFAULT now() + INTERVAL '7 days'
+);
+CREATE INDEX idx_user_sessions_token ON user_sessions(access_token);
+CREATE INDEX idx_user_sessions_user ON user_sessions(user_id);
diff --git a/internal/db/store.go b/internal/db/store.go
index 090fa8ef..e6932ea8 100644
--- a/internal/db/store.go
+++ b/internal/db/store.go
@@ -60,26 +60,36 @@ func (s *Store) Migrate(ctx context.Context) error {
return fmt.Errorf("failed to get current migration version: %w", err)
}
- // Apply migration 1 if not applied
- if currentVersion < 1 {
- sql, err := migrationsFS.ReadFile("migrations/001_initial.up.sql")
+ migrations := []struct {
+ version int
+ filename string
+ }{
+ {1, "migrations/001_initial.up.sql"},
+ {2, "migrations/002_user_sessions.up.sql"},
+ }
+
+ for _, m := range migrations {
+ if currentVersion >= m.version {
+ continue
+ }
+ sql, err := migrationsFS.ReadFile(m.filename)
if err != nil {
- return fmt.Errorf("failed to read migration file: %w", err)
+ return fmt.Errorf("failed to read migration file %s: %w", m.filename, err)
}
tx, err := s.pool.Begin(ctx)
if err != nil {
- return fmt.Errorf("failed to begin transaction: %w", err)
+ return fmt.Errorf("failed to begin transaction for migration %d: %w", m.version, err)
}
defer tx.Rollback(ctx)
if _, err := tx.Exec(ctx, string(sql)); err != nil {
- return fmt.Errorf("failed to apply migration 001: %w", err)
+ return fmt.Errorf("failed to apply migration %03d: %w", m.version, err)
}
- if _, err := tx.Exec(ctx, `INSERT INTO schema_migrations (version) VALUES (1)`); err != nil {
- return fmt.Errorf("failed to record migration 001: %w", err)
+ if _, err := tx.Exec(ctx, `INSERT INTO schema_migrations (version) VALUES ($1)`, m.version); err != nil {
+ return fmt.Errorf("failed to record migration %03d: %w", m.version, err)
}
if err := tx.Commit(ctx); err != nil {
- return fmt.Errorf("failed to commit migration 001: %w", err)
+ return fmt.Errorf("failed to commit migration %03d: %w", m.version, err)
}
}
@@ -139,6 +149,20 @@ func (s *Store) GetOrgBySlug(ctx context.Context, slug string) (*Org, error) {
return org, nil
}
+func (s *Store) UpdateOrg(ctx context.Context, id uuid.UUID, name string) (*Org, error) {
+ org := &Org{}
+ err := s.pool.QueryRow(ctx,
+ `UPDATE orgs SET name = $1, updated_at = now() WHERE id = $2
+ RETURNING id, name, slug, plan, max_concurrent_sandboxes, max_sandbox_timeout_sec, created_at, updated_at`,
+ name, id,
+ ).Scan(&org.ID, &org.Name, &org.Slug, &org.Plan, &org.MaxConcurrentSandboxes,
+ &org.MaxSandboxTimeoutSec, &org.CreatedAt, &org.UpdatedAt)
+ if err != nil {
+ return nil, fmt.Errorf("failed to update org: %w", err)
+ }
+ return org, nil
+}
+
// --- User operations ---
type User struct {
@@ -448,6 +472,42 @@ func (s *Store) ListHealthyWorkers(ctx context.Context, region string) ([]Worker
return workers, nil
}
+// --- User Session (access token) operations ---
+
+// StoreAccessToken stores a WorkOS access token mapped to a user ID.
+// Replaces any existing token for the user.
+func (s *Store) StoreAccessToken(ctx context.Context, userID uuid.UUID, accessToken string) error {
+ // Delete old sessions for this user
+ _, _ = s.pool.Exec(ctx, `DELETE FROM user_sessions WHERE user_id = $1`, userID)
+ // Insert new session
+ _, err := s.pool.Exec(ctx,
+ `INSERT INTO user_sessions (user_id, access_token) VALUES ($1, $2)`,
+ userID, accessToken)
+ return err
+}
+
+// GetUserByAccessToken looks up a user by their active access token.
+func (s *Store) GetUserByAccessToken(ctx context.Context, accessToken string) (*User, error) {
+ user := &User{}
+ err := s.pool.QueryRow(ctx,
+ `SELECT u.id, u.org_id, u.email, u.name, u.role, u.created_at
+ FROM users u
+ INNER JOIN user_sessions s ON s.user_id = u.id
+ WHERE s.access_token = $1 AND s.expires_at > now()`,
+ accessToken,
+ ).Scan(&user.ID, &user.OrgID, &user.Email, &user.Name, &user.Role, &user.CreatedAt)
+ if err != nil {
+ return nil, fmt.Errorf("session not found or expired: %w", err)
+ }
+ return user, nil
+}
+
+// DeleteAccessTokensForUser removes all sessions for a user (logout).
+func (s *Store) DeleteAccessTokensForUser(ctx context.Context, userID uuid.UUID) error {
+ _, err := s.pool.Exec(ctx, `DELETE FROM user_sessions WHERE user_id = $1`, userID)
+ return err
+}
+
// Pool returns the underlying pgx pool for advanced use cases.
func (s *Store) Pool() *pgxpool.Pool {
return s.pool
diff --git a/internal/sandbox/manager.go b/internal/sandbox/manager.go
index cdb6b737..93985754 100644
--- a/internal/sandbox/manager.go
+++ b/internal/sandbox/manager.go
@@ -149,6 +149,15 @@ func (m *Manager) List(ctx context.Context) ([]types.Sandbox, error) {
return sandboxes, nil
}
+// Count returns the number of active sandbox containers.
+func (m *Manager) Count(ctx context.Context) (int, error) {
+ entries, err := m.podman.ListContainers(ctx, labelID)
+ if err != nil {
+ return 0, fmt.Errorf("failed to count sandboxes: %w", err)
+ }
+ return len(entries), nil
+}
+
// SetTimeout updates the timeout for a running sandbox.
func (m *Manager) SetTimeout(ctx context.Context, id string, timeoutSec int) error {
name := fmt.Sprintf("%s-%s", containerName, id)
diff --git a/internal/worker/redis_heartbeat.go b/internal/worker/redis_heartbeat.go
new file mode 100644
index 00000000..bc2badbe
--- /dev/null
+++ b/internal/worker/redis_heartbeat.go
@@ -0,0 +1,133 @@
+package worker
+
+import (
+ "context"
+ "encoding/json"
+ "fmt"
+ "log"
+ "time"
+
+ "github.com/redis/go-redis/v9"
+)
+
+// redisHeartbeatPayload is the JSON structure published to Redis.
+type redisHeartbeatPayload struct {
+ WorkerID string `json:"worker_id"`
+ Region string `json:"region"`
+ GRPCAddr string `json:"grpc_addr"`
+ HTTPAddr string `json:"http_addr"`
+ Capacity int `json:"capacity"`
+ Current int `json:"current"`
+ CPUPct float64 `json:"cpu_pct"`
+ MemPct float64 `json:"mem_pct"`
+}
+
+// RedisHeartbeat publishes periodic heartbeats to Redis for worker discovery.
+// Each heartbeat:
+// 1. SETs worker:{id} with a 30s TTL (auto-expires if worker dies)
+// 2. PUBLISHes to workers:heartbeat for real-time server notification
+type RedisHeartbeat struct {
+ rdb *redis.Client
+ workerID string
+ region string
+ grpcAddr string
+ httpAddr string
+ getStats func() (capacity, current int, cpuPct, memPct float64)
+ stop chan struct{}
+}
+
+// NewRedisHeartbeat creates a new heartbeat publisher.
+func NewRedisHeartbeat(redisURL, workerID, region, grpcAddr, httpAddr string) (*RedisHeartbeat, error) {
+ opts, err := redis.ParseURL(redisURL)
+ if err != nil {
+ return nil, fmt.Errorf("invalid redis URL: %w", err)
+ }
+
+ rdb := redis.NewClient(opts)
+
+ ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
+ defer cancel()
+ if err := rdb.Ping(ctx).Err(); err != nil {
+ rdb.Close()
+ return nil, fmt.Errorf("redis ping failed: %w", err)
+ }
+
+ return &RedisHeartbeat{
+ rdb: rdb,
+ workerID: workerID,
+ region: region,
+ grpcAddr: grpcAddr,
+ httpAddr: httpAddr,
+ stop: make(chan struct{}),
+ }, nil
+}
+
+// Start begins publishing heartbeats every 10 seconds.
+func (h *RedisHeartbeat) Start(getStats func() (int, int, float64, float64)) {
+ h.getStats = getStats
+
+ go func() {
+ // Publish immediately on start
+ h.publish()
+
+ ticker := time.NewTicker(10 * time.Second)
+ defer ticker.Stop()
+
+ for {
+ select {
+ case <-ticker.C:
+ h.publish()
+ case <-h.stop:
+ return
+ }
+ }
+ }()
+}
+
+func (h *RedisHeartbeat) publish() {
+ capacity, current, cpuPct, memPct := h.getStats()
+
+ payload := redisHeartbeatPayload{
+ WorkerID: h.workerID,
+ Region: h.region,
+ GRPCAddr: h.grpcAddr,
+ HTTPAddr: h.httpAddr,
+ Capacity: capacity,
+ Current: current,
+ CPUPct: cpuPct,
+ MemPct: memPct,
+ }
+
+ data, err := json.Marshal(payload)
+ if err != nil {
+ log.Printf("redis_heartbeat: marshal error: %v", err)
+ return
+ }
+
+ ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
+ defer cancel()
+
+ // SET with 30s TTL — key auto-expires if worker dies
+ key := "worker:" + h.workerID
+ if err := h.rdb.Set(ctx, key, data, 30*time.Second).Err(); err != nil {
+ log.Printf("redis_heartbeat: SET failed: %v", err)
+ }
+
+ // PUBLISH for real-time notification
+ if err := h.rdb.Publish(ctx, "workers:heartbeat", data).Err(); err != nil {
+ log.Printf("redis_heartbeat: PUBLISH failed: %v", err)
+ }
+}
+
+// Stop stops the heartbeat publisher and closes the Redis connection.
+func (h *RedisHeartbeat) Stop() {
+ close(h.stop)
+
+ // Remove the key so the server knows we're gone immediately
+ ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
+ defer cancel()
+ h.rdb.Del(ctx, "worker:"+h.workerID)
+
+ h.rdb.Close()
+ log.Println("redis_heartbeat: stopped")
+}
diff --git a/internal/worker/stats.go b/internal/worker/stats.go
new file mode 100644
index 00000000..636f6214
--- /dev/null
+++ b/internal/worker/stats.go
@@ -0,0 +1,90 @@
+package worker
+
+import (
+ "bufio"
+ "os"
+ "runtime"
+ "strconv"
+ "strings"
+)
+
+// SystemStats returns current CPU and memory usage percentages.
+// On Linux, reads from /proc. On other platforms, returns 0.0 gracefully.
+func SystemStats() (cpuPct, memPct float64) {
+ if runtime.GOOS == "linux" {
+ memPct = linuxMemoryPercent()
+ cpuPct = linuxCPUPercent()
+ }
+ return cpuPct, memPct
+}
+
+func linuxMemoryPercent() float64 {
+ f, err := os.Open("/proc/meminfo")
+ if err != nil {
+ return 0.0
+ }
+ defer f.Close()
+
+ var memTotal, memAvailable uint64
+ scanner := bufio.NewScanner(f)
+ for scanner.Scan() {
+ line := scanner.Text()
+ if strings.HasPrefix(line, "MemTotal:") {
+ memTotal = parseMeminfoKB(line)
+ } else if strings.HasPrefix(line, "MemAvailable:") {
+ memAvailable = parseMeminfoKB(line)
+ }
+ if memTotal > 0 && memAvailable > 0 {
+ break
+ }
+ }
+ if memTotal == 0 {
+ return 0.0
+ }
+ return float64(memTotal-memAvailable) / float64(memTotal) * 100.0
+}
+
+func parseMeminfoKB(line string) uint64 {
+ // Format: "MemTotal: 16384000 kB"
+ fields := strings.Fields(line)
+ if len(fields) < 2 {
+ return 0
+ }
+ val, err := strconv.ParseUint(fields[1], 10, 64)
+ if err != nil {
+ return 0
+ }
+ return val
+}
+
+func linuxCPUPercent() float64 {
+ // Read /proc/stat for aggregate CPU time
+ f, err := os.Open("/proc/stat")
+ if err != nil {
+ return 0.0
+ }
+ defer f.Close()
+
+ scanner := bufio.NewScanner(f)
+ if !scanner.Scan() {
+ return 0.0
+ }
+ line := scanner.Text() // "cpu user nice system idle iowait irq softirq steal"
+ fields := strings.Fields(line)
+ if len(fields) < 5 || fields[0] != "cpu" {
+ return 0.0
+ }
+
+ var total, idle uint64
+ for i := 1; i < len(fields); i++ {
+ val, _ := strconv.ParseUint(fields[i], 10, 64)
+ total += val
+ if i == 4 { // idle is the 4th value (index 4 after "cpu")
+ idle = val
+ }
+ }
+ if total == 0 {
+ return 0.0
+ }
+ return float64(total-idle) / float64(total) * 100.0
+}
diff --git a/sdks/python/opensandbox/sandbox.py b/sdks/python/opensandbox/sandbox.py
index 13d8c1a2..34bcb9b8 100644
--- a/sdks/python/opensandbox/sandbox.py
+++ b/sdks/python/opensandbox/sandbox.py
@@ -39,13 +39,17 @@ class Sandbox:
) -> Sandbox:
"""Create a new sandbox instance."""
url = api_url or os.environ.get("OPENSANDBOX_API_URL", "http://localhost:8080")
+ url = url.rstrip("/")
key = api_key or os.environ.get("OPENSANDBOX_API_KEY", "")
+ # Control plane client always uses /api prefix
+ api_base = url if url.endswith("/api") else f"{url}/api"
+
headers = {}
if key:
headers["X-API-Key"] = key
- client = httpx.AsyncClient(base_url=url, headers=headers, timeout=30.0)
+ client = httpx.AsyncClient(base_url=api_base, headers=headers, timeout=30.0)
body: dict[str, Any] = {
"templateID": template,
@@ -93,13 +97,16 @@ class Sandbox:
) -> Sandbox:
"""Connect to an existing sandbox."""
url = api_url or os.environ.get("OPENSANDBOX_API_URL", "http://localhost:8080")
+ url = url.rstrip("/")
key = api_key or os.environ.get("OPENSANDBOX_API_KEY", "")
+ api_base = url if url.endswith("/api") else f"{url}/api"
+
headers = {}
if key:
headers["X-API-Key"] = key
- client = httpx.AsyncClient(base_url=url, headers=headers, timeout=30.0)
+ client = httpx.AsyncClient(base_url=api_base, headers=headers, timeout=30.0)
resp = await client.get(f"/sandboxes/{sandbox_id}")
resp.raise_for_status()
diff --git a/sdks/typescript/src/sandbox.ts b/sdks/typescript/src/sandbox.ts
index b7e3bc9a..e1a17775 100644
--- a/sdks/typescript/src/sandbox.ts
+++ b/sdks/typescript/src/sandbox.ts
@@ -2,6 +2,11 @@ import { Filesystem } from "./filesystem";
import { Commands } from "./commands";
import { Pty } from "./pty";
+function resolveApiUrl(url: string): string {
+ const base = url.replace(/\/+$/, "");
+ return base.endsWith("/api") ? base : `${base}/api`;
+}
+
export interface SandboxOpts {
template?: string;
timeout?: number;
@@ -54,7 +59,7 @@ export class Sandbox {
}
static async create(opts: SandboxOpts = {}): Promise<Sandbox> {
- const apiUrl = opts.apiUrl ?? process.env.OPENSANDBOX_API_URL ?? "http://localhost:8080";
+ const apiUrl = resolveApiUrl(opts.apiUrl ?? process.env.OPENSANDBOX_API_URL ?? "http://localhost:8080");
const apiKey = opts.apiKey ?? process.env.OPENSANDBOX_API_KEY ?? "";
const body: Record<string, unknown> = {
@@ -83,7 +88,7 @@ export class Sandbox {
}
static async connect(sandboxId: string, opts: Pick<SandboxOpts, "apiKey" | "apiUrl"> = {}): Promise<Sandbox> {
- const apiUrl = opts.apiUrl ?? process.env.OPENSANDBOX_API_URL ?? "http://localhost:8080";
+ const apiUrl = resolveApiUrl(opts.apiUrl ?? process.env.OPENSANDBOX_API_URL ?? "http://localhost:8080");
const apiKey = opts.apiKey ?? process.env.OPENSANDBOX_API_KEY ?? "";
const resp = await fetch(`${apiUrl}/sandboxes/${sandboxId}`, {
diff --git a/web/.gitignore b/web/.gitignore
new file mode 100644
index 00000000..f06235c4
--- /dev/null
+++ b/web/.gitignore
@@ -0,0 +1,2 @@
+node_modules
+dist
diff --git a/web/index.html b/web/index.html
new file mode 100644
index 00000000..d5e655ef
--- /dev/null
+++ b/web/index.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <title>OpenSandbox</title>
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
+ <link
+ href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300..700;1,9..40,300..700&family=JetBrains+Mono:wght@400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap"
+ rel="stylesheet"
+ />
+ </head>
+ <body>
+ <div id="root"></div>
+ <script type="module" src="/src/main.tsx"></script>
+ </body>
+</html>
diff --git a/web/package-lock.json b/web/package-lock.json
new file mode 100644
index 00000000..7ba0205a
--- /dev/null
+++ b/web/package-lock.json
@@ -0,0 +1,2328 @@
+{
+ "name": "opensandbox-dashboard",
+ "version": "0.1.0",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "opensandbox-dashboard",
+ "version": "0.1.0",
+ "dependencies": {
+ "@tanstack/react-query": "^5.60.0",
+ "react": "^18.3.1",
+ "react-dom": "^18.3.1",
+ "react-router-dom": "^6.28.0",
+ "recharts": "^3.7.0"
+ },
+ "devDependencies": {
+ "@types/react": "^18.3.12",
+ "@types/react-dom": "^18.3.1",
+ "@vitejs/plugin-react": "^4.3.4",
+ "typescript": "~5.6.2",
+ "vite": "^6.0.0"
+ }
+ },
+ "node_modules/@babel/code-frame": {
+ "version": "7.29.0",
+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.0.tgz",
+ "integrity": "sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-validator-identifier": "^7.28.5",
+ "js-tokens": "^4.0.0",
+ "picocolors": "^1.1.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/compat-data": {
+ "version": "7.29.0",
+ "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.0.tgz",
+ "integrity": "sha512-T1NCJqT/j9+cn8fvkt7jtwbLBfLC/1y1c7NtCeXFRgzGTsafi68MRv8yzkYSapBnFA6L3U2VSc02ciDzoAJhJg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/core": {
+ "version": "7.29.0",
+ "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.0.tgz",
+ "integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==",
+ "dev": true,
+ "license": "MIT",
+ "peer": true,
+ "dependencies": {
+ "@babel/code-frame": "^7.29.0",
+ "@babel/generator": "^7.29.0",
+ "@babel/helper-compilation-targets": "^7.28.6",
+ "@babel/helper-module-transforms": "^7.28.6",
+ "@babel/helpers": "^7.28.6",
+ "@babel/parser": "^7.29.0",
+ "@babel/template": "^7.28.6",
+ "@babel/traverse": "^7.29.0",
+ "@babel/types": "^7.29.0",
+ "@jridgewell/remapping": "^2.3.5",
+ "convert-source-map": "^2.0.0",
+ "debug": "^4.1.0",
+ "gensync": "^1.0.0-beta.2",
+ "json5": "^2.2.3",
+ "semver": "^6.3.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/babel"
+ }
+ },
+ "node_modules/@babel/generator": {
+ "version": "7.29.1",
+ "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.1.tgz",
+ "integrity": "sha512-qsaF+9Qcm2Qv8SRIMMscAvG4O3lJ0F1GuMo5HR/Bp02LopNgnZBC/EkbevHFeGs4ls/oPz9v+Bsmzbkbe+0dUw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/parser": "^7.29.0",
+ "@babel/types": "^7.29.0",
+ "@jridgewell/gen-mapping": "^0.3.12",
+ "@jridgewell/trace-mapping": "^0.3.28",
+ "jsesc": "^3.0.2"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-compilation-targets": {
+ "version": "7.28.6",
+ "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.28.6.tgz",
+ "integrity": "sha512-JYtls3hqi15fcx5GaSNL7SCTJ2MNmjrkHXg4FSpOA/grxK8KwyZ5bubHsCq8FXCkua6xhuaaBit+3b7+VZRfcA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/compat-data": "^7.28.6",
+ "@babel/helper-validator-option": "^7.27.1",
+ "browserslist": "^4.24.0",
+ "lru-cache": "^5.1.1",
+ "semver": "^6.3.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-globals": {
+ "version": "7.28.0",
+ "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.28.0.tgz",
+ "integrity": "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-module-imports": {
+ "version": "7.28.6",
+ "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.28.6.tgz",
+ "integrity": "sha512-l5XkZK7r7wa9LucGw9LwZyyCUscb4x37JWTPz7swwFE/0FMQAGpiWUZn8u9DzkSBWEcK25jmvubfpw2dnAMdbw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/traverse": "^7.28.6",
+ "@babel/types": "^7.28.6"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-module-transforms": {
+ "version": "7.28.6",
+ "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.28.6.tgz",
+ "integrity": "sha512-67oXFAYr2cDLDVGLXTEABjdBJZ6drElUSI7WKp70NrpyISso3plG9SAGEF6y7zbha/wOzUByWWTJvEDVNIUGcA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-module-imports": "^7.28.6",
+ "@babel/helper-validator-identifier": "^7.28.5",
+ "@babel/traverse": "^7.28.6"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0"
+ }
+ },
+ "node_modules/@babel/helper-plugin-utils": {
+ "version": "7.28.6",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.28.6.tgz",
+ "integrity": "sha512-S9gzZ/bz83GRysI7gAD4wPT/AI3uCnY+9xn+Mx/KPs2JwHJIz1W8PZkg2cqyt3RNOBM8ejcXhV6y8Og7ly/Dug==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-string-parser": {
+ "version": "7.27.1",
+ "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz",
+ "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-validator-identifier": {
+ "version": "7.28.5",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz",
+ "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-validator-option": {
+ "version": "7.27.1",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz",
+ "integrity": "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helpers": {
+ "version": "7.28.6",
+ "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.28.6.tgz",
+ "integrity": "sha512-xOBvwq86HHdB7WUDTfKfT/Vuxh7gElQ+Sfti2Cy6yIWNW05P8iUslOVcZ4/sKbE+/jQaukQAdz/gf3724kYdqw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/template": "^7.28.6",
+ "@babel/types": "^7.28.6"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/parser": {
+ "version": "7.29.0",
+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.0.tgz",
+ "integrity": "sha512-IyDgFV5GeDUVX4YdF/3CPULtVGSXXMLh1xVIgdCgxApktqnQV0r7/8Nqthg+8YLGaAtdyIlo2qIdZrbCv4+7ww==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/types": "^7.29.0"
+ },
+ "bin": {
+ "parser": "bin/babel-parser.js"
+ },
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-react-jsx-self": {
+ "version": "7.27.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.27.1.tgz",
+ "integrity": "sha512-6UzkCs+ejGdZ5mFFC/OCUrv028ab2fp1znZmCZjAOBKiBK2jXD1O+BPSfX8X2qjJ75fZBMSnQn3Rq2mrBJK2mw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-react-jsx-source": {
+ "version": "7.27.1",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.27.1.tgz",
+ "integrity": "sha512-zbwoTsBruTeKB9hSq73ha66iFeJHuaFkUbwvqElnygoNbj/jHRsSeokowZFN3CZ64IvEqcmmkVe89OPXc7ldAw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.27.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/template": {
+ "version": "7.28.6",
+ "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.28.6.tgz",
+ "integrity": "sha512-YA6Ma2KsCdGb+WC6UpBVFJGXL58MDA6oyONbjyF/+5sBgxY/dwkhLogbMT2GXXyU84/IhRw/2D1Os1B/giz+BQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/code-frame": "^7.28.6",
+ "@babel/parser": "^7.28.6",
+ "@babel/types": "^7.28.6"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/traverse": {
+ "version": "7.29.0",
+ "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.0.tgz",
+ "integrity": "sha512-4HPiQr0X7+waHfyXPZpWPfWL/J7dcN1mx9gL6WdQVMbPnF3+ZhSMs8tCxN7oHddJE9fhNE7+lxdnlyemKfJRuA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/code-frame": "^7.29.0",
+ "@babel/generator": "^7.29.0",
+ "@babel/helper-globals": "^7.28.0",
+ "@babel/parser": "^7.29.0",
+ "@babel/template": "^7.28.6",
+ "@babel/types": "^7.29.0",
+ "debug": "^4.3.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/types": {
+ "version": "7.29.0",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.0.tgz",
+ "integrity": "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-string-parser": "^7.27.1",
+ "@babel/helper-validator-identifier": "^7.28.5"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@esbuild/aix-ppc64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz",
+ "integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "aix"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/android-arm": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.12.tgz",
+ "integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/android-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.12.tgz",
+ "integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/android-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.12.tgz",
+ "integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/darwin-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz",
+ "integrity": "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/darwin-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.12.tgz",
+ "integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/freebsd-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.12.tgz",
+ "integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/freebsd-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.12.tgz",
+ "integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-arm": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.12.tgz",
+ "integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.12.tgz",
+ "integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-ia32": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.12.tgz",
+ "integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-loong64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.12.tgz",
+ "integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==",
+ "cpu": [
+ "loong64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-mips64el": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.12.tgz",
+ "integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==",
+ "cpu": [
+ "mips64el"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-ppc64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.12.tgz",
+ "integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-riscv64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.12.tgz",
+ "integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==",
+ "cpu": [
+ "riscv64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-s390x": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.12.tgz",
+ "integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==",
+ "cpu": [
+ "s390x"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz",
+ "integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/netbsd-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.12.tgz",
+ "integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "netbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/netbsd-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.12.tgz",
+ "integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "netbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/openbsd-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.12.tgz",
+ "integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/openbsd-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.12.tgz",
+ "integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/openharmony-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.12.tgz",
+ "integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openharmony"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/sunos-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.12.tgz",
+ "integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "sunos"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/win32-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.12.tgz",
+ "integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/win32-ia32": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.12.tgz",
+ "integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/win32-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz",
+ "integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@jridgewell/gen-mapping": {
+ "version": "0.3.13",
+ "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
+ "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/sourcemap-codec": "^1.5.0",
+ "@jridgewell/trace-mapping": "^0.3.24"
+ }
+ },
+ "node_modules/@jridgewell/remapping": {
+ "version": "2.3.5",
+ "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz",
+ "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/gen-mapping": "^0.3.5",
+ "@jridgewell/trace-mapping": "^0.3.24"
+ }
+ },
+ "node_modules/@jridgewell/resolve-uri": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
+ "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/@jridgewell/sourcemap-codec": {
+ "version": "1.5.5",
+ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz",
+ "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@jridgewell/trace-mapping": {
+ "version": "0.3.31",
+ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz",
+ "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/resolve-uri": "^3.1.0",
+ "@jridgewell/sourcemap-codec": "^1.4.14"
+ }
+ },
+ "node_modules/@reduxjs/toolkit": {
+ "version": "2.11.2",
+ "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.11.2.tgz",
+ "integrity": "sha512-Kd6kAHTA6/nUpp8mySPqj3en3dm0tdMIgbttnQ1xFMVpufoj+ADi8pXLBsd4xzTRHQa7t/Jv8W5UnCuW4kuWMQ==",
+ "license": "MIT",
+ "dependencies": {
+ "@standard-schema/spec": "^1.0.0",
+ "@standard-schema/utils": "^0.3.0",
+ "immer": "^11.0.0",
+ "redux": "^5.0.1",
+ "redux-thunk": "^3.1.0",
+ "reselect": "^5.1.0"
+ },
+ "peerDependencies": {
+ "react": "^16.9.0 || ^17.0.0 || ^18 || ^19",
+ "react-redux": "^7.2.1 || ^8.1.3 || ^9.0.0"
+ },
+ "peerDependenciesMeta": {
+ "react": {
+ "optional": true
+ },
+ "react-redux": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@reduxjs/toolkit/node_modules/immer": {
+ "version": "11.1.4",
+ "resolved": "https://registry.npmjs.org/immer/-/immer-11.1.4.tgz",
+ "integrity": "sha512-XREFCPo6ksxVzP4E0ekD5aMdf8WMwmdNaz6vuvxgI40UaEiu6q3p8X52aU6GdyvLY3XXX/8R7JOTXStz/nBbRw==",
+ "license": "MIT",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/immer"
+ }
+ },
+ "node_modules/@remix-run/router": {
+ "version": "1.23.2",
+ "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.23.2.tgz",
+ "integrity": "sha512-Ic6m2U/rMjTkhERIa/0ZtXJP17QUi2CbWE7cqx4J58M8aA3QTfW+2UlQ4psvTX9IO1RfNVhK3pcpdjej7L+t2w==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=14.0.0"
+ }
+ },
+ "node_modules/@rolldown/pluginutils": {
+ "version": "1.0.0-beta.27",
+ "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.27.tgz",
+ "integrity": "sha512-+d0F4MKMCbeVUJwG96uQ4SgAznZNSq93I3V+9NHA4OpvqG8mRCpGdKmK8l/dl02h2CCDHwW2FqilnTyDcAnqjA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@rollup/rollup-android-arm-eabi": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.57.1.tgz",
+ "integrity": "sha512-A6ehUVSiSaaliTxai040ZpZ2zTevHYbvu/lDoeAteHI8QnaosIzm4qwtezfRg1jOYaUmnzLX1AOD6Z+UJjtifg==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ]
+ },
+ "node_modules/@rollup/rollup-android-arm64": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.57.1.tgz",
+ "integrity": "sha512-dQaAddCY9YgkFHZcFNS/606Exo8vcLHwArFZ7vxXq4rigo2bb494/xKMMwRRQW6ug7Js6yXmBZhSBRuBvCCQ3w==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ]
+ },
+ "node_modules/@rollup/rollup-darwin-arm64": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.57.1.tgz",
+ "integrity": "sha512-crNPrwJOrRxagUYeMn/DZwqN88SDmwaJ8Cvi/TN1HnWBU7GwknckyosC2gd0IqYRsHDEnXf328o9/HC6OkPgOg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ]
+ },
+ "node_modules/@rollup/rollup-darwin-x64": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.57.1.tgz",
+ "integrity": "sha512-Ji8g8ChVbKrhFtig5QBV7iMaJrGtpHelkB3lsaKzadFBe58gmjfGXAOfI5FV0lYMH8wiqsxKQ1C9B0YTRXVy4w==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ]
+ },
+ "node_modules/@rollup/rollup-freebsd-arm64": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.57.1.tgz",
+ "integrity": "sha512-R+/WwhsjmwodAcz65guCGFRkMb4gKWTcIeLy60JJQbXrJ97BOXHxnkPFrP+YwFlaS0m+uWJTstrUA9o+UchFug==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ]
+ },
+ "node_modules/@rollup/rollup-freebsd-x64": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.57.1.tgz",
+ "integrity": "sha512-IEQTCHeiTOnAUC3IDQdzRAGj3jOAYNr9kBguI7MQAAZK3caezRrg0GxAb6Hchg4lxdZEI5Oq3iov/w/hnFWY9Q==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-arm-gnueabihf": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.57.1.tgz",
+ "integrity": "sha512-F8sWbhZ7tyuEfsmOxwc2giKDQzN3+kuBLPwwZGyVkLlKGdV1nvnNwYD0fKQ8+XS6hp9nY7B+ZeK01EBUE7aHaw==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-arm-musleabihf": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.57.1.tgz",
+ "integrity": "sha512-rGfNUfn0GIeXtBP1wL5MnzSj98+PZe/AXaGBCRmT0ts80lU5CATYGxXukeTX39XBKsxzFpEeK+Mrp9faXOlmrw==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-arm64-gnu": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.57.1.tgz",
+ "integrity": "sha512-MMtej3YHWeg/0klK2Qodf3yrNzz6CGjo2UntLvk2RSPlhzgLvYEB3frRvbEF2wRKh1Z2fDIg9KRPe1fawv7C+g==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-arm64-musl": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.57.1.tgz",
+ "integrity": "sha512-1a/qhaaOXhqXGpMFMET9VqwZakkljWHLmZOX48R0I/YLbhdxr1m4gtG1Hq7++VhVUmf+L3sTAf9op4JlhQ5u1Q==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-loong64-gnu": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.57.1.tgz",
+ "integrity": "sha512-QWO6RQTZ/cqYtJMtxhkRkidoNGXc7ERPbZN7dVW5SdURuLeVU7lwKMpo18XdcmpWYd0qsP1bwKPf7DNSUinhvA==",
+ "cpu": [
+ "loong64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-loong64-musl": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.57.1.tgz",
+ "integrity": "sha512-xpObYIf+8gprgWaPP32xiN5RVTi/s5FCR+XMXSKmhfoJjrpRAjCuuqQXyxUa/eJTdAE6eJ+KDKaoEqjZQxh3Gw==",
+ "cpu": [
+ "loong64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-ppc64-gnu": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.57.1.tgz",
+ "integrity": "sha512-4BrCgrpZo4hvzMDKRqEaW1zeecScDCR+2nZ86ATLhAoJ5FQ+lbHVD3ttKe74/c7tNT9c6F2viwB3ufwp01Oh2w==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-ppc64-musl": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.57.1.tgz",
+ "integrity": "sha512-NOlUuzesGauESAyEYFSe3QTUguL+lvrN1HtwEEsU2rOwdUDeTMJdO5dUYl/2hKf9jWydJrO9OL/XSSf65R5+Xw==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-riscv64-gnu": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.57.1.tgz",
+ "integrity": "sha512-ptA88htVp0AwUUqhVghwDIKlvJMD/fmL/wrQj99PRHFRAG6Z5nbWoWG4o81Nt9FT+IuqUQi+L31ZKAFeJ5Is+A==",
+ "cpu": [
+ "riscv64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-riscv64-musl": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.57.1.tgz",
+ "integrity": "sha512-S51t7aMMTNdmAMPpBg7OOsTdn4tySRQvklmL3RpDRyknk87+Sp3xaumlatU+ppQ+5raY7sSTcC2beGgvhENfuw==",
+ "cpu": [
+ "riscv64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-s390x-gnu": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.57.1.tgz",
+ "integrity": "sha512-Bl00OFnVFkL82FHbEqy3k5CUCKH6OEJL54KCyx2oqsmZnFTR8IoNqBF+mjQVcRCT5sB6yOvK8A37LNm/kPJiZg==",
+ "cpu": [
+ "s390x"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-x64-gnu": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.57.1.tgz",
+ "integrity": "sha512-ABca4ceT4N+Tv/GtotnWAeXZUZuM/9AQyCyKYyKnpk4yoA7QIAuBt6Hkgpw8kActYlew2mvckXkvx0FfoInnLg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-x64-musl": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.57.1.tgz",
+ "integrity": "sha512-HFps0JeGtuOR2convgRRkHCekD7j+gdAuXM+/i6kGzQtFhlCtQkpwtNzkNj6QhCDp7DRJ7+qC/1Vg2jt5iSOFw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-openbsd-x64": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.57.1.tgz",
+ "integrity": "sha512-H+hXEv9gdVQuDTgnqD+SQffoWoc0Of59AStSzTEj/feWTBAnSfSD3+Dql1ZruJQxmykT/JVY0dE8Ka7z0DH1hw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openbsd"
+ ]
+ },
+ "node_modules/@rollup/rollup-openharmony-arm64": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.57.1.tgz",
+ "integrity": "sha512-4wYoDpNg6o/oPximyc/NG+mYUejZrCU2q+2w6YZqrAs2UcNUChIZXjtafAiiZSUc7On8v5NyNj34Kzj/Ltk6dQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openharmony"
+ ]
+ },
+ "node_modules/@rollup/rollup-win32-arm64-msvc": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.57.1.tgz",
+ "integrity": "sha512-O54mtsV/6LW3P8qdTcamQmuC990HDfR71lo44oZMZlXU4tzLrbvTii87Ni9opq60ds0YzuAlEr/GNwuNluZyMQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ]
+ },
+ "node_modules/@rollup/rollup-win32-ia32-msvc": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.57.1.tgz",
+ "integrity": "sha512-P3dLS+IerxCT/7D2q2FYcRdWRl22dNbrbBEtxdWhXrfIMPP9lQhb5h4Du04mdl5Woq05jVCDPCMF7Ub0NAjIew==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ]
+ },
+ "node_modules/@rollup/rollup-win32-x64-gnu": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.57.1.tgz",
+ "integrity": "sha512-VMBH2eOOaKGtIJYleXsi2B8CPVADrh+TyNxJ4mWPnKfLB/DBUmzW+5m1xUrcwWoMfSLagIRpjUFeW5CO5hyciQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ]
+ },
+ "node_modules/@rollup/rollup-win32-x64-msvc": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.57.1.tgz",
+ "integrity": "sha512-mxRFDdHIWRxg3UfIIAwCm6NzvxG0jDX/wBN6KsQFTvKFqqg9vTrWUE68qEjHt19A5wwx5X5aUi2zuZT7YR0jrA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ]
+ },
+ "node_modules/@standard-schema/spec": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz",
+ "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==",
+ "license": "MIT"
+ },
+ "node_modules/@standard-schema/utils": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/@standard-schema/utils/-/utils-0.3.0.tgz",
+ "integrity": "sha512-e7Mew686owMaPJVNNLs55PUvgz371nKgwsc4vxE49zsODpJEnxgxRo2y/OKrqueavXgZNMDVj3DdHFlaSAeU8g==",
+ "license": "MIT"
+ },
+ "node_modules/@tanstack/query-core": {
+ "version": "5.90.20",
+ "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.90.20.tgz",
+ "integrity": "sha512-OMD2HLpNouXEfZJWcKeVKUgQ5n+n3A2JFmBaScpNDUqSrQSjiveC7dKMe53uJUg1nDG16ttFPz2xfilz6i2uVg==",
+ "license": "MIT",
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/tannerlinsley"
+ }
+ },
+ "node_modules/@tanstack/react-query": {
+ "version": "5.90.21",
+ "resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.90.21.tgz",
+ "integrity": "sha512-0Lu6y5t+tvlTJMTO7oh5NSpJfpg/5D41LlThfepTixPYkJ0sE2Jj0m0f6yYqujBwIXlId87e234+MxG3D3g7kg==",
+ "license": "MIT",
+ "dependencies": {
+ "@tanstack/query-core": "5.90.20"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/tannerlinsley"
+ },
+ "peerDependencies": {
+ "react": "^18 || ^19"
+ }
+ },
+ "node_modules/@types/babel__core": {
+ "version": "7.20.5",
+ "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz",
+ "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/parser": "^7.20.7",
+ "@babel/types": "^7.20.7",
+ "@types/babel__generator": "*",
+ "@types/babel__template": "*",
+ "@types/babel__traverse": "*"
+ }
+ },
+ "node_modules/@types/babel__generator": {
+ "version": "7.27.0",
+ "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.27.0.tgz",
+ "integrity": "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/types": "^7.0.0"
+ }
+ },
+ "node_modules/@types/babel__template": {
+ "version": "7.4.4",
+ "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz",
+ "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/parser": "^7.1.0",
+ "@babel/types": "^7.0.0"
+ }
+ },
+ "node_modules/@types/babel__traverse": {
+ "version": "7.28.0",
+ "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.28.0.tgz",
+ "integrity": "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/types": "^7.28.2"
+ }
+ },
+ "node_modules/@types/d3-array": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/@types/d3-array/-/d3-array-3.2.2.tgz",
+ "integrity": "sha512-hOLWVbm7uRza0BYXpIIW5pxfrKe0W+D5lrFiAEYR+pb6w3N2SwSMaJbXdUfSEv+dT4MfHBLtn5js0LAWaO6otw==",
+ "license": "MIT"
+ },
+ "node_modules/@types/d3-color": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/@types/d3-color/-/d3-color-3.1.3.tgz",
+ "integrity": "sha512-iO90scth9WAbmgv7ogoq57O9YpKmFBbmoEoCHDB2xMBY0+/KVrqAaCDyCE16dUspeOvIxFFRI+0sEtqDqy2b4A==",
+ "license": "MIT"
+ },
+ "node_modules/@types/d3-ease": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/@types/d3-ease/-/d3-ease-3.0.2.tgz",
+ "integrity": "sha512-NcV1JjO5oDzoK26oMzbILE6HW7uVXOHLQvHshBUW4UMdZGfiY6v5BeQwh9a9tCzv+CeefZQHJt5SRgK154RtiA==",
+ "license": "MIT"
+ },
+ "node_modules/@types/d3-interpolate": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/@types/d3-interpolate/-/d3-interpolate-3.0.4.tgz",
+ "integrity": "sha512-mgLPETlrpVV1YRJIglr4Ez47g7Yxjl1lj7YKsiMCb27VJH9W8NVM6Bb9d8kkpG/uAQS5AmbA48q2IAolKKo1MA==",
+ "license": "MIT",
+ "dependencies": {
+ "@types/d3-color": "*"
+ }
+ },
+ "node_modules/@types/d3-path": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/@types/d3-path/-/d3-path-3.1.1.tgz",
+ "integrity": "sha512-VMZBYyQvbGmWyWVea0EHs/BwLgxc+MKi1zLDCONksozI4YJMcTt8ZEuIR4Sb1MMTE8MMW49v0IwI5+b7RmfWlg==",
+ "license": "MIT"
+ },
+ "node_modules/@types/d3-scale": {
+ "version": "4.0.9",
+ "resolved": "https://registry.npmjs.org/@types/d3-scale/-/d3-scale-4.0.9.tgz",
+ "integrity": "sha512-dLmtwB8zkAeO/juAMfnV+sItKjlsw2lKdZVVy6LRr0cBmegxSABiLEpGVmSJJ8O08i4+sGR6qQtb6WtuwJdvVw==",
+ "license": "MIT",
+ "dependencies": {
+ "@types/d3-time": "*"
+ }
+ },
+ "node_modules/@types/d3-shape": {
+ "version": "3.1.8",
+ "resolved": "https://registry.npmjs.org/@types/d3-shape/-/d3-shape-3.1.8.tgz",
+ "integrity": "sha512-lae0iWfcDeR7qt7rA88BNiqdvPS5pFVPpo5OfjElwNaT2yyekbM0C9vK+yqBqEmHr6lDkRnYNoTBYlAgJa7a4w==",
+ "license": "MIT",
+ "dependencies": {
+ "@types/d3-path": "*"
+ }
+ },
+ "node_modules/@types/d3-time": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/@types/d3-time/-/d3-time-3.0.4.tgz",
+ "integrity": "sha512-yuzZug1nkAAaBlBBikKZTgzCeA+k1uy4ZFwWANOfKw5z5LRhV0gNA7gNkKm7HoK+HRN0wX3EkxGk0fpbWhmB7g==",
+ "license": "MIT"
+ },
+ "node_modules/@types/d3-timer": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/@types/d3-timer/-/d3-timer-3.0.2.tgz",
+ "integrity": "sha512-Ps3T8E8dZDam6fUyNiMkekK3XUsaUEik+idO9/YjPtfj2qruF8tFBXS7XhtE4iIXBLxhmLjP3SXpLhVf21I9Lw==",
+ "license": "MIT"
+ },
+ "node_modules/@types/estree": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz",
+ "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/prop-types": {
+ "version": "15.7.15",
+ "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.15.tgz",
+ "integrity": "sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw==",
+ "devOptional": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/react": {
+ "version": "18.3.28",
+ "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.28.tgz",
+ "integrity": "sha512-z9VXpC7MWrhfWipitjNdgCauoMLRdIILQsAEV+ZesIzBq/oUlxk0m3ApZuMFCXdnS4U7KrI+l3WRUEGQ8K1QKw==",
+ "devOptional": true,
+ "license": "MIT",
+ "peer": true,
+ "dependencies": {
+ "@types/prop-types": "*",
+ "csstype": "^3.2.2"
+ }
+ },
+ "node_modules/@types/react-dom": {
+ "version": "18.3.7",
+ "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.7.tgz",
+ "integrity": "sha512-MEe3UeoENYVFXzoXEWsvcpg6ZvlrFNlOQ7EOsvhI3CfAXwzPfO8Qwuxd40nepsYKqyyVQnTdEfv68q91yLcKrQ==",
+ "dev": true,
+ "license": "MIT",
+ "peerDependencies": {
+ "@types/react": "^18.0.0"
+ }
+ },
+ "node_modules/@types/use-sync-external-store": {
+ "version": "0.0.6",
+ "resolved": "https://registry.npmjs.org/@types/use-sync-external-store/-/use-sync-external-store-0.0.6.tgz",
+ "integrity": "sha512-zFDAD+tlpf2r4asuHEj0XH6pY6i0g5NeAHPn+15wk3BV6JA69eERFXC1gyGThDkVa1zCyKr5jox1+2LbV/AMLg==",
+ "license": "MIT"
+ },
+ "node_modules/@vitejs/plugin-react": {
+ "version": "4.7.0",
+ "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.7.0.tgz",
+ "integrity": "sha512-gUu9hwfWvvEDBBmgtAowQCojwZmJ5mcLn3aufeCsitijs3+f2NsrPtlAWIR6OPiqljl96GVCUbLe0HyqIpVaoA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/core": "^7.28.0",
+ "@babel/plugin-transform-react-jsx-self": "^7.27.1",
+ "@babel/plugin-transform-react-jsx-source": "^7.27.1",
+ "@rolldown/pluginutils": "1.0.0-beta.27",
+ "@types/babel__core": "^7.20.5",
+ "react-refresh": "^0.17.0"
+ },
+ "engines": {
+ "node": "^14.18.0 || >=16.0.0"
+ },
+ "peerDependencies": {
+ "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0"
+ }
+ },
+ "node_modules/baseline-browser-mapping": {
+ "version": "2.9.19",
+ "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.9.19.tgz",
+ "integrity": "sha512-ipDqC8FrAl/76p2SSWKSI+H9tFwm7vYqXQrItCuiVPt26Km0jS+NzSsBWAaBusvSbQcfJG+JitdMm+wZAgTYqg==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "bin": {
+ "baseline-browser-mapping": "dist/cli.js"
+ }
+ },
+ "node_modules/browserslist": {
+ "version": "4.28.1",
+ "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.1.tgz",
+ "integrity": "sha512-ZC5Bd0LgJXgwGqUknZY/vkUQ04r8NXnJZ3yYi4vDmSiZmC/pdSN0NbNRPxZpbtO4uAfDUAFffO8IZoM3Gj8IkA==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/browserslist"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/browserslist"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "peer": true,
+ "dependencies": {
+ "baseline-browser-mapping": "^2.9.0",
+ "caniuse-lite": "^1.0.30001759",
+ "electron-to-chromium": "^1.5.263",
+ "node-releases": "^2.0.27",
+ "update-browserslist-db": "^1.2.0"
+ },
+ "bin": {
+ "browserslist": "cli.js"
+ },
+ "engines": {
+ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
+ }
+ },
+ "node_modules/caniuse-lite": {
+ "version": "1.0.30001770",
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001770.tgz",
+ "integrity": "sha512-x/2CLQ1jHENRbHg5PSId2sXq1CIO1CISvwWAj027ltMVG2UNgW+w9oH2+HzgEIRFembL8bUlXtfbBHR1fCg2xw==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/browserslist"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/caniuse-lite"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "CC-BY-4.0"
+ },
+ "node_modules/clsx": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz",
+ "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/convert-source-map": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz",
+ "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/csstype": {
+ "version": "3.2.3",
+ "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",
+ "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==",
+ "devOptional": true,
+ "license": "MIT"
+ },
+ "node_modules/d3-array": {
+ "version": "3.2.4",
+ "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-3.2.4.tgz",
+ "integrity": "sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg==",
+ "license": "ISC",
+ "dependencies": {
+ "internmap": "1 - 2"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/d3-color": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.1.0.tgz",
+ "integrity": "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==",
+ "license": "ISC",
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/d3-ease": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-3.0.1.tgz",
+ "integrity": "sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==",
+ "license": "BSD-3-Clause",
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/d3-format": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-3.1.2.tgz",
+ "integrity": "sha512-AJDdYOdnyRDV5b6ArilzCPPwc1ejkHcoyFarqlPqT7zRYjhavcT3uSrqcMvsgh2CgoPbK3RCwyHaVyxYcP2Arg==",
+ "license": "ISC",
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/d3-interpolate": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz",
+ "integrity": "sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==",
+ "license": "ISC",
+ "dependencies": {
+ "d3-color": "1 - 3"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/d3-path": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-3.1.0.tgz",
+ "integrity": "sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ==",
+ "license": "ISC",
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/d3-scale": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-4.0.2.tgz",
+ "integrity": "sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==",
+ "license": "ISC",
+ "dependencies": {
+ "d3-array": "2.10.0 - 3",
+ "d3-format": "1 - 3",
+ "d3-interpolate": "1.2.0 - 3",
+ "d3-time": "2.1.1 - 3",
+ "d3-time-format": "2 - 4"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/d3-shape": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-3.2.0.tgz",
+ "integrity": "sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA==",
+ "license": "ISC",
+ "dependencies": {
+ "d3-path": "^3.1.0"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/d3-time": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-3.1.0.tgz",
+ "integrity": "sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q==",
+ "license": "ISC",
+ "dependencies": {
+ "d3-array": "2 - 3"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/d3-time-format": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-4.1.0.tgz",
+ "integrity": "sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==",
+ "license": "ISC",
+ "dependencies": {
+ "d3-time": "1 - 3"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/d3-timer": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-3.0.1.tgz",
+ "integrity": "sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==",
+ "license": "ISC",
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/debug": {
+ "version": "4.4.3",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
+ "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ms": "^2.1.3"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/decimal.js-light": {
+ "version": "2.5.1",
+ "resolved": "https://registry.npmjs.org/decimal.js-light/-/decimal.js-light-2.5.1.tgz",
+ "integrity": "sha512-qIMFpTMZmny+MMIitAB6D7iVPEorVw6YQRWkvarTkT4tBeSLLiHzcwj6q0MmYSFCiVpiqPJTJEYIrpcPzVEIvg==",
+ "license": "MIT"
+ },
+ "node_modules/electron-to-chromium": {
+ "version": "1.5.286",
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.286.tgz",
+ "integrity": "sha512-9tfDXhJ4RKFNerfjdCcZfufu49vg620741MNs26a9+bhLThdB+plgMeou98CAaHu/WATj2iHOOHTp1hWtABj2A==",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/es-toolkit": {
+ "version": "1.44.0",
+ "resolved": "https://registry.npmjs.org/es-toolkit/-/es-toolkit-1.44.0.tgz",
+ "integrity": "sha512-6penXeZalaV88MM3cGkFZZfOoLGWshWWfdy0tWw/RlVVyhvMaWSBTOvXNeiW3e5FwdS5ePW0LGEu17zT139ktg==",
+ "license": "MIT",
+ "workspaces": [
+ "docs",
+ "benchmarks"
+ ]
+ },
+ "node_modules/esbuild": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz",
+ "integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==",
+ "dev": true,
+ "hasInstallScript": true,
+ "license": "MIT",
+ "bin": {
+ "esbuild": "bin/esbuild"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "optionalDependencies": {
+ "@esbuild/aix-ppc64": "0.25.12",
+ "@esbuild/android-arm": "0.25.12",
+ "@esbuild/android-arm64": "0.25.12",
+ "@esbuild/android-x64": "0.25.12",
+ "@esbuild/darwin-arm64": "0.25.12",
+ "@esbuild/darwin-x64": "0.25.12",
+ "@esbuild/freebsd-arm64": "0.25.12",
+ "@esbuild/freebsd-x64": "0.25.12",
+ "@esbuild/linux-arm": "0.25.12",
+ "@esbuild/linux-arm64": "0.25.12",
+ "@esbuild/linux-ia32": "0.25.12",
+ "@esbuild/linux-loong64": "0.25.12",
+ "@esbuild/linux-mips64el": "0.25.12",
+ "@esbuild/linux-ppc64": "0.25.12",
+ "@esbuild/linux-riscv64": "0.25.12",
+ "@esbuild/linux-s390x": "0.25.12",
+ "@esbuild/linux-x64": "0.25.12",
+ "@esbuild/netbsd-arm64": "0.25.12",
+ "@esbuild/netbsd-x64": "0.25.12",
+ "@esbuild/openbsd-arm64": "0.25.12",
+ "@esbuild/openbsd-x64": "0.25.12",
+ "@esbuild/openharmony-arm64": "0.25.12",
+ "@esbuild/sunos-x64": "0.25.12",
+ "@esbuild/win32-arm64": "0.25.12",
+ "@esbuild/win32-ia32": "0.25.12",
+ "@esbuild/win32-x64": "0.25.12"
+ }
+ },
+ "node_modules/escalade": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz",
+ "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/eventemitter3": {
+ "version": "5.0.4",
+ "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.4.tgz",
+ "integrity": "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==",
+ "license": "MIT"
+ },
+ "node_modules/fdir": {
+ "version": "6.5.0",
+ "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
+ "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12.0.0"
+ },
+ "peerDependencies": {
+ "picomatch": "^3 || ^4"
+ },
+ "peerDependenciesMeta": {
+ "picomatch": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/fsevents": {
+ "version": "2.3.3",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
+ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
+ "dev": true,
+ "hasInstallScript": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
+ }
+ },
+ "node_modules/gensync": {
+ "version": "1.0.0-beta.2",
+ "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz",
+ "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/immer": {
+ "version": "10.2.0",
+ "resolved": "https://registry.npmjs.org/immer/-/immer-10.2.0.tgz",
+ "integrity": "sha512-d/+XTN3zfODyjr89gM3mPq1WNX2B8pYsu7eORitdwyA2sBubnTl3laYlBk4sXY5FUa5qTZGBDPJICVbvqzjlbw==",
+ "license": "MIT",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/immer"
+ }
+ },
+ "node_modules/internmap": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/internmap/-/internmap-2.0.3.tgz",
+ "integrity": "sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==",
+ "license": "ISC",
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/js-tokens": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
+ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
+ "license": "MIT"
+ },
+ "node_modules/jsesc": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz",
+ "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "jsesc": "bin/jsesc"
+ },
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/json5": {
+ "version": "2.2.3",
+ "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
+ "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "json5": "lib/cli.js"
+ },
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/loose-envify": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
+ "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==",
+ "license": "MIT",
+ "dependencies": {
+ "js-tokens": "^3.0.0 || ^4.0.0"
+ },
+ "bin": {
+ "loose-envify": "cli.js"
+ }
+ },
+ "node_modules/lru-cache": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
+ "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "yallist": "^3.0.2"
+ }
+ },
+ "node_modules/ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/nanoid": {
+ "version": "3.3.11",
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz",
+ "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "bin": {
+ "nanoid": "bin/nanoid.cjs"
+ },
+ "engines": {
+ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
+ }
+ },
+ "node_modules/node-releases": {
+ "version": "2.0.27",
+ "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.27.tgz",
+ "integrity": "sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/picocolors": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
+ "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/picomatch": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz",
+ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
+ "dev": true,
+ "license": "MIT",
+ "peer": true,
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/jonschlinkert"
+ }
+ },
+ "node_modules/postcss": {
+ "version": "8.5.6",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz",
+ "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/postcss/"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/postcss"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "nanoid": "^3.3.11",
+ "picocolors": "^1.1.1",
+ "source-map-js": "^1.2.1"
+ },
+ "engines": {
+ "node": "^10 || ^12 || >=14"
+ }
+ },
+ "node_modules/react": {
+ "version": "18.3.1",
+ "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz",
+ "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==",
+ "license": "MIT",
+ "peer": true,
+ "dependencies": {
+ "loose-envify": "^1.1.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/react-dom": {
+ "version": "18.3.1",
+ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz",
+ "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==",
+ "license": "MIT",
+ "peer": true,
+ "dependencies": {
+ "loose-envify": "^1.1.0",
+ "scheduler": "^0.23.2"
+ },
+ "peerDependencies": {
+ "react": "^18.3.1"
+ }
+ },
+ "node_modules/react-is": {
+ "version": "19.2.4",
+ "resolved": "https://registry.npmjs.org/react-is/-/react-is-19.2.4.tgz",
+ "integrity": "sha512-W+EWGn2v0ApPKgKKCy/7s7WHXkboGcsrXE+2joLyVxkbyVQfO3MUEaUQDHoSmb8TFFrSKYa9mw64WZHNHSDzYA==",
+ "license": "MIT",
+ "peer": true
+ },
+ "node_modules/react-redux": {
+ "version": "9.2.0",
+ "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-9.2.0.tgz",
+ "integrity": "sha512-ROY9fvHhwOD9ySfrF0wmvu//bKCQ6AeZZq1nJNtbDC+kk5DuSuNX/n6YWYF/SYy7bSba4D4FSz8DJeKY/S/r+g==",
+ "license": "MIT",
+ "peer": true,
+ "dependencies": {
+ "@types/use-sync-external-store": "^0.0.6",
+ "use-sync-external-store": "^1.4.0"
+ },
+ "peerDependencies": {
+ "@types/react": "^18.2.25 || ^19",
+ "react": "^18.0 || ^19",
+ "redux": "^5.0.0"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ },
+ "redux": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/react-refresh": {
+ "version": "0.17.0",
+ "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.17.0.tgz",
+ "integrity": "sha512-z6F7K9bV85EfseRCp2bzrpyQ0Gkw1uLoCel9XBVWPg/TjRj94SkJzUTGfOa4bs7iJvBWtQG0Wq7wnI0syw3EBQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/react-router": {
+ "version": "6.30.3",
+ "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.30.3.tgz",
+ "integrity": "sha512-XRnlbKMTmktBkjCLE8/XcZFlnHvr2Ltdr1eJX4idL55/9BbORzyZEaIkBFDhFGCEWBBItsVrDxwx3gnisMitdw==",
+ "license": "MIT",
+ "dependencies": {
+ "@remix-run/router": "1.23.2"
+ },
+ "engines": {
+ "node": ">=14.0.0"
+ },
+ "peerDependencies": {
+ "react": ">=16.8"
+ }
+ },
+ "node_modules/react-router-dom": {
+ "version": "6.30.3",
+ "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.30.3.tgz",
+ "integrity": "sha512-pxPcv1AczD4vso7G4Z3TKcvlxK7g7TNt3/FNGMhfqyntocvYKj+GCatfigGDjbLozC4baguJ0ReCigoDJXb0ag==",
+ "license": "MIT",
+ "dependencies": {
+ "@remix-run/router": "1.23.2",
+ "react-router": "6.30.3"
+ },
+ "engines": {
+ "node": ">=14.0.0"
+ },
+ "peerDependencies": {
+ "react": ">=16.8",
+ "react-dom": ">=16.8"
+ }
+ },
+ "node_modules/recharts": {
+ "version": "3.7.0",
+ "resolved": "https://registry.npmjs.org/recharts/-/recharts-3.7.0.tgz",
+ "integrity": "sha512-l2VCsy3XXeraxIID9fx23eCb6iCBsxUQDnE8tWm6DFdszVAO7WVY/ChAD9wVit01y6B2PMupYiMmQwhgPHc9Ew==",
+ "license": "MIT",
+ "workspaces": [
+ "www"
+ ],
+ "dependencies": {
+ "@reduxjs/toolkit": "1.x.x || 2.x.x",
+ "clsx": "^2.1.1",
+ "decimal.js-light": "^2.5.1",
+ "es-toolkit": "^1.39.3",
+ "eventemitter3": "^5.0.1",
+ "immer": "^10.1.1",
+ "react-redux": "8.x.x || 9.x.x",
+ "reselect": "5.1.1",
+ "tiny-invariant": "^1.3.3",
+ "use-sync-external-store": "^1.2.2",
+ "victory-vendor": "^37.0.2"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "peerDependencies": {
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
+ "react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
+ "react-is": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
+ }
+ },
+ "node_modules/redux": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz",
+ "integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==",
+ "license": "MIT",
+ "peer": true
+ },
+ "node_modules/redux-thunk": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-3.1.0.tgz",
+ "integrity": "sha512-NW2r5T6ksUKXCabzhL9z+h206HQw/NJkcLm1GPImRQ8IzfXwRGqjVhKJGauHirT0DAuyy6hjdnMZaRoAcy0Klw==",
+ "license": "MIT",
+ "peerDependencies": {
+ "redux": "^5.0.0"
+ }
+ },
+ "node_modules/reselect": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/reselect/-/reselect-5.1.1.tgz",
+ "integrity": "sha512-K/BG6eIky/SBpzfHZv/dd+9JBFiS4SWV7FIujVyJRux6e45+73RaUHXLmIR1f7WOMaQ0U1km6qwklRQxpJJY0w==",
+ "license": "MIT"
+ },
+ "node_modules/rollup": {
+ "version": "4.57.1",
+ "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.57.1.tgz",
+ "integrity": "sha512-oQL6lgK3e2QZeQ7gcgIkS2YZPg5slw37hYufJ3edKlfQSGGm8ICoxswK15ntSzF/a8+h7ekRy7k7oWc3BQ7y8A==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/estree": "1.0.8"
+ },
+ "bin": {
+ "rollup": "dist/bin/rollup"
+ },
+ "engines": {
+ "node": ">=18.0.0",
+ "npm": ">=8.0.0"
+ },
+ "optionalDependencies": {
+ "@rollup/rollup-android-arm-eabi": "4.57.1",
+ "@rollup/rollup-android-arm64": "4.57.1",
+ "@rollup/rollup-darwin-arm64": "4.57.1",
+ "@rollup/rollup-darwin-x64": "4.57.1",
+ "@rollup/rollup-freebsd-arm64": "4.57.1",
+ "@rollup/rollup-freebsd-x64": "4.57.1",
+ "@rollup/rollup-linux-arm-gnueabihf": "4.57.1",
+ "@rollup/rollup-linux-arm-musleabihf": "4.57.1",
+ "@rollup/rollup-linux-arm64-gnu": "4.57.1",
+ "@rollup/rollup-linux-arm64-musl": "4.57.1",
+ "@rollup/rollup-linux-loong64-gnu": "4.57.1",
+ "@rollup/rollup-linux-loong64-musl": "4.57.1",
+ "@rollup/rollup-linux-ppc64-gnu": "4.57.1",
+ "@rollup/rollup-linux-ppc64-musl": "4.57.1",
+ "@rollup/rollup-linux-riscv64-gnu": "4.57.1",
+ "@rollup/rollup-linux-riscv64-musl": "4.57.1",
+ "@rollup/rollup-linux-s390x-gnu": "4.57.1",
+ "@rollup/rollup-linux-x64-gnu": "4.57.1",
+ "@rollup/rollup-linux-x64-musl": "4.57.1",
+ "@rollup/rollup-openbsd-x64": "4.57.1",
+ "@rollup/rollup-openharmony-arm64": "4.57.1",
+ "@rollup/rollup-win32-arm64-msvc": "4.57.1",
+ "@rollup/rollup-win32-ia32-msvc": "4.57.1",
+ "@rollup/rollup-win32-x64-gnu": "4.57.1",
+ "@rollup/rollup-win32-x64-msvc": "4.57.1",
+ "fsevents": "~2.3.2"
+ }
+ },
+ "node_modules/scheduler": {
+ "version": "0.23.2",
+ "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz",
+ "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==",
+ "license": "MIT",
+ "dependencies": {
+ "loose-envify": "^1.1.0"
+ }
+ },
+ "node_modules/semver": {
+ "version": "6.3.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
+ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
+ "dev": true,
+ "license": "ISC",
+ "bin": {
+ "semver": "bin/semver.js"
+ }
+ },
+ "node_modules/source-map-js": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
+ "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/tiny-invariant": {
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.3.tgz",
+ "integrity": "sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==",
+ "license": "MIT"
+ },
+ "node_modules/tinyglobby": {
+ "version": "0.2.15",
+ "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz",
+ "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "fdir": "^6.5.0",
+ "picomatch": "^4.0.3"
+ },
+ "engines": {
+ "node": ">=12.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/SuperchupuDev"
+ }
+ },
+ "node_modules/typescript": {
+ "version": "5.6.3",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz",
+ "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "bin": {
+ "tsc": "bin/tsc",
+ "tsserver": "bin/tsserver"
+ },
+ "engines": {
+ "node": ">=14.17"
+ }
+ },
+ "node_modules/update-browserslist-db": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz",
+ "integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/browserslist"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/browserslist"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "escalade": "^3.2.0",
+ "picocolors": "^1.1.1"
+ },
+ "bin": {
+ "update-browserslist-db": "cli.js"
+ },
+ "peerDependencies": {
+ "browserslist": ">= 4.21.0"
+ }
+ },
+ "node_modules/use-sync-external-store": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.6.0.tgz",
+ "integrity": "sha512-Pp6GSwGP/NrPIrxVFAIkOQeyw8lFenOHijQWkUTrDvrF4ALqylP2C/KCkeS9dpUM3KvYRQhna5vt7IL95+ZQ9w==",
+ "license": "MIT",
+ "peerDependencies": {
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
+ }
+ },
+ "node_modules/victory-vendor": {
+ "version": "37.3.6",
+ "resolved": "https://registry.npmjs.org/victory-vendor/-/victory-vendor-37.3.6.tgz",
+ "integrity": "sha512-SbPDPdDBYp+5MJHhBCAyI7wKM3d5ivekigc2Dk2s7pgbZ9wIgIBYGVw4zGHBml/qTFbexrofXW6Gu4noGxrOwQ==",
+ "license": "MIT AND ISC",
+ "dependencies": {
+ "@types/d3-array": "^3.0.3",
+ "@types/d3-ease": "^3.0.0",
+ "@types/d3-interpolate": "^3.0.1",
+ "@types/d3-scale": "^4.0.2",
+ "@types/d3-shape": "^3.1.0",
+ "@types/d3-time": "^3.0.0",
+ "@types/d3-timer": "^3.0.0",
+ "d3-array": "^3.1.6",
+ "d3-ease": "^3.0.1",
+ "d3-interpolate": "^3.0.1",
+ "d3-scale": "^4.0.2",
+ "d3-shape": "^3.1.0",
+ "d3-time": "^3.0.0",
+ "d3-timer": "^3.0.1"
+ }
+ },
+ "node_modules/vite": {
+ "version": "6.4.1",
+ "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.1.tgz",
+ "integrity": "sha512-+Oxm7q9hDoLMyJOYfUYBuHQo+dkAloi33apOPP56pzj+vsdJDzr+j1NISE5pyaAuKL4A3UD34qd0lx5+kfKp2g==",
+ "dev": true,
+ "license": "MIT",
+ "peer": true,
+ "dependencies": {
+ "esbuild": "^0.25.0",
+ "fdir": "^6.4.4",
+ "picomatch": "^4.0.2",
+ "postcss": "^8.5.3",
+ "rollup": "^4.34.9",
+ "tinyglobby": "^0.2.13"
+ },
+ "bin": {
+ "vite": "bin/vite.js"
+ },
+ "engines": {
+ "node": "^18.0.0 || ^20.0.0 || >=22.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/vitejs/vite?sponsor=1"
+ },
+ "optionalDependencies": {
+ "fsevents": "~2.3.3"
+ },
+ "peerDependencies": {
+ "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0",
+ "jiti": ">=1.21.0",
+ "less": "*",
+ "lightningcss": "^1.21.0",
+ "sass": "*",
+ "sass-embedded": "*",
+ "stylus": "*",
+ "sugarss": "*",
+ "terser": "^5.16.0",
+ "tsx": "^4.8.1",
+ "yaml": "^2.4.2"
+ },
+ "peerDependenciesMeta": {
+ "@types/node": {
+ "optional": true
+ },
+ "jiti": {
+ "optional": true
+ },
+ "less": {
+ "optional": true
+ },
+ "lightningcss": {
+ "optional": true
+ },
+ "sass": {
+ "optional": true
+ },
+ "sass-embedded": {
+ "optional": true
+ },
+ "stylus": {
+ "optional": true
+ },
+ "sugarss": {
+ "optional": true
+ },
+ "terser": {
+ "optional": true
+ },
+ "tsx": {
+ "optional": true
+ },
+ "yaml": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/yallist": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
+ "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
+ "dev": true,
+ "license": "ISC"
+ }
+ }
+}
diff --git a/web/package.json b/web/package.json
new file mode 100644
index 00000000..9226c901
--- /dev/null
+++ b/web/package.json
@@ -0,0 +1,25 @@
+{
+ "name": "opensandbox-dashboard",
+ "private": true,
+ "version": "0.1.0",
+ "type": "module",
+ "scripts": {
+ "dev": "vite",
+ "build": "tsc -b && vite build",
+ "preview": "vite preview"
+ },
+ "dependencies": {
+ "@tanstack/react-query": "^5.60.0",
+ "react": "^18.3.1",
+ "react-dom": "^18.3.1",
+ "react-router-dom": "^6.28.0",
+ "recharts": "^3.7.0"
+ },
+ "devDependencies": {
+ "@types/react": "^18.3.12",
+ "@types/react-dom": "^18.3.1",
+ "@vitejs/plugin-react": "^4.3.4",
+ "typescript": "~5.6.2",
+ "vite": "^6.0.0"
+ }
+}
diff --git a/web/src/App.tsx b/web/src/App.tsx
new file mode 100644
index 00000000..6b98cc0f
--- /dev/null
+++ b/web/src/App.tsx
@@ -0,0 +1,28 @@
+import { Routes, Route, Navigate } from 'react-router-dom'
+import { AuthProvider } from './hooks/useAuth'
+import ProtectedRoute from './components/ProtectedRoute'
+import Layout from './components/Layout'
+import Login from './pages/Login'
+import Dashboard from './pages/Dashboard'
+import Sessions from './pages/Sessions'
+import APIKeys from './pages/APIKeys'
+import Settings from './pages/Settings'
+
+export default function App() {
+ return (
+ <AuthProvider>
+ <Routes>
+ <Route path="/login" element={<Login />} />
+ <Route element={<ProtectedRoute />}>
+ <Route element={<Layout />}>
+ <Route index element={<Dashboard />} />
+ <Route path="sessions" element={<Sessions />} />
+ <Route path="api-keys" element={<APIKeys />} />
+ <Route path="settings" element={<Settings />} />
+ </Route>
+ </Route>
+ <Route path="*" element={<Navigate to="/" replace />} />
+ </Routes>
+ </AuthProvider>
+ )
+}
diff --git a/web/src/api/client.ts b/web/src/api/client.ts
new file mode 100644
index 00000000..f22bee41
--- /dev/null
+++ b/web/src/api/client.ts
@@ -0,0 +1,94 @@
+const API_BASE = '/api/dashboard'
+
+export async function apiFetch<T>(path: string, options: RequestInit = {}): Promise<T> {
+ const res = await fetch(`${API_BASE}${path}`, {
+ ...options,
+ credentials: 'include',
+ headers: {
+ 'Content-Type': 'application/json',
+ ...options.headers,
+ },
+ })
+
+ if (res.status === 401) {
+ // Don't auto-redirect — let ProtectedRoute handle auth flow.
+ // This prevents a redirect loop on the login page.
+ throw new Error('Unauthorized')
+ }
+
+ if (!res.ok) {
+ const body = await res.json().catch(() => ({}))
+ throw new Error(body.error || `Request failed: ${res.status}`)
+ }
+
+ if (res.status === 204) {
+ return undefined as T
+ }
+
+ return res.json()
+}
+
+// Logout: clears server session, then navigates to login
+export async function logout(): Promise<void> {
+ await fetch('/auth/logout', { method: 'POST', credentials: 'include' }).catch(() => {})
+ // Navigate to login page — use replace to prevent back-button loop
+ window.location.replace('/login')
+}
+
+// API functions
+export const getMe = () => apiFetch<{ id: string; email: string; orgId: string }>('/me')
+
+export const getSessions = (status?: string) =>
+ apiFetch<Session[]>(`/sessions${status ? `?status=${status}` : ''}`)
+
+export const getAPIKeys = () => apiFetch<APIKey[]>('/api-keys')
+
+export const createAPIKey = (name: string) =>
+ apiFetch<{ id: string; name: string; key: string; keyPrefix: string; createdAt: string }>(
+ '/api-keys',
+ { method: 'POST', body: JSON.stringify({ name }) },
+ )
+
+export const deleteAPIKey = (keyId: string) =>
+ apiFetch<void>(`/api-keys/${keyId}`, { method: 'DELETE' })
+
+export const getOrg = () => apiFetch<Org>('/org')
+
+export const updateOrg = (name: string) =>
+ apiFetch<Org>('/org', { method: 'PUT', body: JSON.stringify({ name }) })
+
+// Types
+export interface Session {
+ id: string
+ sandboxId: string
+ orgId: string
+ template: string
+ region: string
+ workerId: string
+ status: string
+ startedAt: string
+ stoppedAt?: string
+ errorMsg?: string
+}
+
+export interface APIKey {
+ id: string
+ orgId: string
+ keyPrefix: string
+ name: string
+ scopes: string[]
+ lastUsed?: string
+ expiresAt?: string
+ createdAt: string
+}
+
+export interface Org {
+ id: string
+ name: string
+ slug: string
+ plan: string
+ maxConcurrentSandboxes: number
+ maxSandboxTimeoutSec: number
+ createdAt: string
+ updatedAt: string
+}
diff --git a/web/src/components/Layout.tsx b/web/src/components/Layout.tsx
new file mode 100644
index 00000000..76e00c86
--- /dev/null
+++ b/web/src/components/Layout.tsx
@@ -0,0 +1,179 @@
+import { NavLink, Outlet } from 'react-router-dom'
+import { useAuth } from '../hooks/useAuth'
+import { logout } from '../api/client'
+
+/* ── SVG Icons (inline, no extra deps) ────────────────────── */
+const icons = {
+ grid: (
+ <svg width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.7" strokeLinecap="round" strokeLinejoin="round">
+ <rect x="3" y="3" width="7" height="7" rx="1.5" />
+ <rect x="14" y="3" width="7" height="7" rx="1.5" />
+ <rect x="3" y="14" width="7" height="7" rx="1.5" />
+ <rect x="14" y="14" width="7" height="7" rx="1.5" />
+ </svg>
+ ),
+ clock: (
+ <svg width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.7" strokeLinecap="round" strokeLinejoin="round">
+ <circle cx="12" cy="12" r="9" />
+ <polyline points="12 7 12 12 15.5 14.5" />
+ </svg>
+ ),
+ key: (
+ <svg width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.7" strokeLinecap="round" strokeLinejoin="round">
+ <path d="M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4" />
+ </svg>
+ ),
+ gear: (
+ <svg width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.7" strokeLinecap="round" strokeLinejoin="round">
+ <circle cx="12" cy="12" r="3" />
+ <path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z" />
+ </svg>
+ ),
+ logout: (
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.7" strokeLinecap="round" strokeLinejoin="round">
+ <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" />
+ <polyline points="16 17 21 12 16 7" />
+ <line x1="21" y1="12" x2="9" y2="12" />
+ </svg>
+ ),
+}
+
+const navItems = [
+ { to: '/', label: 'Dashboard', end: true, icon: icons.grid },
+ { to: '/sessions', label: 'Sessions', icon: icons.clock },
+ { to: '/api-keys', label: 'API Keys', icon: icons.key },
+ { to: '/settings', label: 'Settings', icon: icons.gear },
+]
+
+export default function Layout() {
+ const { user } = useAuth()
+
+ return (
+ <div style={{ display: 'flex', minHeight: '100vh' }}>
+ {/* ── Sidebar ── */}
+ <nav style={{
+ width: 232,
+ background: 'var(--bg-deep)',
+ borderRight: '1px solid var(--border-subtle)',
+ display: 'flex',
+ flexDirection: 'column',
+ position: 'fixed',
+ top: 0,
+ left: 0,
+ bottom: 0,
+ zIndex: 50,
+ }}>
+ {/* Brand */}
+ <div style={{ padding: '22px 20px 18px', borderBottom: '1px solid var(--border-subtle)' }}>
+ <div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
+ <div style={{
+ width: 30, height: 30, borderRadius: 8,
+ background: 'var(--gradient-primary)',
+ display: 'flex', alignItems: 'center', justifyContent: 'center',
+ fontSize: 12, fontWeight: 800, color: '#fff',
+ fontFamily: 'var(--font-display)',
+ boxShadow: '0 0 16px rgba(99,102,241,0.25)',
+ }}>OS</div>
+ <div>
+ <div style={{
+ fontSize: 14, fontWeight: 700,
+ fontFamily: 'var(--font-display)',
+ color: 'var(--text-primary)',
+ letterSpacing: '-0.02em',
+ }}>OpenSandbox</div>
+ <div style={{
+ fontSize: 9, color: 'var(--text-tertiary)',
+ fontFamily: 'var(--font-mono)',
+ letterSpacing: '0.06em',
+ textTransform: 'uppercase',
+ }}>Console</div>
+ </div>
+ </div>
+ </div>
+
+ {/* Nav Links */}
+ <div style={{ flex: 1, padding: '10px 8px' }}>
+ {navItems.map(item => (
+ <NavLink
+ key={item.to}
+ to={item.to}
+ end={item.end}
+ style={({ isActive }) => ({
+ display: 'flex',
+ alignItems: 'center',
+ gap: 10,
+ padding: '9px 14px',
+ color: isActive ? 'var(--text-primary)' : 'var(--text-secondary)',
+ background: isActive ? 'rgba(99, 102, 241, 0.07)' : 'transparent',
+ textDecoration: 'none',
+ fontSize: 13,
+ fontWeight: isActive ? 600 : 400,
+ fontFamily: 'var(--font-body)',
+ borderRadius: 8,
+ marginBottom: 2,
+ transition: 'all 0.15s ease',
+ borderLeft: isActive
+ ? '2px solid var(--accent-indigo)'
+ : '2px solid transparent',
+ })}
+ >
+ <span style={{ display: 'flex', alignItems: 'center', opacity: 0.6 }}>{item.icon}</span>
+ {item.label}
+ </NavLink>
+ ))}
+ </div>
+
+ {/* User */}
+ <div style={{
+ padding: '14px 16px',
+ borderTop: '1px solid var(--border-subtle)',
+ }}>
+ <div style={{ display: 'flex', alignItems: 'center', gap: 10, marginBottom: 10 }}>
+ <div style={{
+ width: 28, height: 28, borderRadius: '50%',
+ background: 'var(--gradient-primary)',
+ display: 'flex', alignItems: 'center', justifyContent: 'center',
+ fontSize: 11, fontWeight: 700, color: '#fff',
+ flexShrink: 0,
+ }}>
+ {user?.email?.charAt(0).toUpperCase() || '?'}
+ </div>
+ <div style={{
+ fontSize: 12, color: 'var(--text-secondary)',
+ overflow: 'hidden', textOverflow: 'ellipsis',
+ whiteSpace: 'nowrap', flex: 1,
+ }}>{user?.email}</div>
+ </div>
+ <button
+ onClick={() => logout()}
+ style={{
+ display: 'flex', alignItems: 'center', gap: 6,
+ background: 'none', border: 'none',
+ color: 'var(--text-tertiary)',
+ cursor: 'pointer', fontSize: 12,
+ fontFamily: 'var(--font-body)',
+ padding: 0,
+ transition: 'color 0.15s ease',
+ }}
+ onMouseOver={e => (e.currentTarget.style.color = 'var(--accent-rose)')}
+ onMouseOut={e => (e.currentTarget.style.color = 'var(--text-tertiary)')}
+ >
+ {icons.logout}
+ Sign out
+ </button>
+ </div>
+ </nav>
+
+ {/* ── Main Content ── */}
+ <main style={{
+ flex: 1,
+ marginLeft: 232,
+ padding: '32px 36px',
+ minHeight: '100vh',
+ background: 'radial-gradient(ellipse 80% 50% at 50% -10%, rgba(99,102,241,0.04) 0%, transparent 70%)',
+ }}>
+ <Outlet />
+ </main>
+ </div>
+ )
+}
diff --git a/web/src/components/ProtectedRoute.tsx b/web/src/components/ProtectedRoute.tsx
new file mode 100644
index 00000000..0a85c64d
--- /dev/null
+++ b/web/src/components/ProtectedRoute.tsx
@@ -0,0 +1,36 @@
+import { Navigate, Outlet } from 'react-router-dom'
+import { useAuth } from '../hooks/useAuth'
+
+export default function ProtectedRoute() {
+ const { user, loading } = useAuth()
+
+ if (loading) {
+ return (
+ <div style={{
+ display: 'flex',
+ flexDirection: 'column',
+ alignItems: 'center',
+ justifyContent: 'center',
+ height: '100vh',
+ gap: 16,
+ background: 'var(--bg-void)',
+ }}>
+ <div className="loading-spinner" />
+ <span style={{
+ fontSize: 12,
+ color: 'var(--text-tertiary)',
+ fontFamily: 'var(--font-mono)',
+ letterSpacing: '0.04em',
+ }}>
+ Loading&hellip;
+ </span>
+ </div>
+ )
+ }
+
+ if (!user) {
+ return <Navigate to="/login" replace />
+ }
+
+ return <Outlet />
+}
diff --git a/web/src/data/mockData.ts b/web/src/data/mockData.ts
new file mode 100644
index 00000000..7c78e317
--- /dev/null
+++ b/web/src/data/mockData.ts
@@ -0,0 +1,164 @@
+/**
+ * Deterministic mock data for dashboard charts.
+ * Uses a seeded PRNG so charts look consistent across renders.
+ * Replace with real API calls when endpoints exist.
+ */
+
+function createRng(seed: number) {
+ let s = seed
+ return () => {
+ s = (s * 16807 + 13) % 2147483647
+ return (s - 1) / 2147483646
+ }
+}
+
+// ── Chart color palette ─────────────────────────────────────
+export const CHART_COLORS = [
+ '#818cf8', // indigo
+ '#34d399', // emerald
+ '#22d3ee', // cyan
+ '#f472b6', // pink
+ '#fbbf24', // amber
+ '#a78bfa', // violet
+]
+
+// ── Types ────────────────────────────────────────────────────
+export interface UsagePoint {
+ time: string
+ sandboxes: number
+ sessions: number
+}
+
+export interface TemplateSlice {
+ name: string
+ value: number
+ color: string
+}
+
+export interface RegionBar {
+ region: string
+ label: string
+ count: number
+ color: string
+}
+
+export interface SparkPoint {
+ value: number
+}
+
+export interface TimelinePoint {
+ hour: string
+ started: number
+ stopped: number
+ errors: number
+}
+
+// ── Generators ───────────────────────────────────────────────
+
+export function generateUsageData(days: number): UsagePoint[] {
+ const rng = createRng(days === 7 ? 101 : 202)
+ const data: UsagePoint[] = []
+ const points = days === 7 ? 42 : 30
+
+ const now = new Date()
+
+ for (let i = points; i >= 0; i--) {
+ const date = new Date(now)
+ if (days === 7) {
+ date.setHours(date.getHours() - i * 4)
+ } else {
+ date.setDate(date.getDate() - i)
+ }
+
+ const hour = date.getHours()
+ const dayPeak = Math.sin((hour - 5) * Math.PI / 13) * 0.35
+ const base = 16 + dayPeak * 12
+ const trend = ((points - i) / points) * 9
+ const noise = (rng() - 0.5) * 10
+
+ data.push({
+ time:
+ days === 7
+ ? `${(date.getMonth() + 1)}/${date.getDate()} ${String(date.getHours()).padStart(2, '0')}:00`
+ : date.toLocaleDateString('en-US', { month: 'short', day: 'numeric' }),
+ sandboxes: Math.round(Math.max(3, base + trend + noise)),
+ sessions: Math.round(Math.max(6, (base + trend) * 2.8 + (rng() - 0.5) * 18)),
+ })
+ }
+ return data
+}
+
+export function generateTemplateData(): TemplateSlice[] {
+ return [
+ { name: 'Python', value: 342, color: CHART_COLORS[0] },
+ { name: 'Node.js', value: 256, color: CHART_COLORS[1] },
+ { name: 'Go', value: 128, color: CHART_COLORS[2] },
+ { name: 'Rust', value: 89, color: CHART_COLORS[3] },
+ { name: 'Custom', value: 45, color: CHART_COLORS[4] },
+ ]
+}
+
+export function generateRegionData(): RegionBar[] {
+ return [
+ { region: 'us-east-1', label: 'US East', count: 412, color: CHART_COLORS[0] },
+ { region: 'eu-west-1', label: 'EU West', count: 289, color: CHART_COLORS[1] },
+ { region: 'ap-south-1', label: 'AP South', count: 198, color: CHART_COLORS[2] },
+ { region: 'us-west-2', label: 'US West', count: 156, color: CHART_COLORS[3] },
+ { region: 'eu-central-1', label: 'EU Central', count: 134, color: CHART_COLORS[4] },
+ ]
+}
+
+export function generateSparkData(
+ seed: number,
+ points = 24,
+ trend: 'up' | 'down' | 'stable' = 'up',
+): SparkPoint[] {
+ const rng = createRng(seed)
+ const data: SparkPoint[] = []
+ let value = 35 + rng() * 25
+
+ for (let i = 0; i < points; i++) {
+ const t = trend === 'up' ? 0.7 : trend === 'down' ? -0.5 : 0
+ value = Math.max(4, Math.min(96, value + t + (rng() - 0.5) * 11))
+ data.push({ value: Math.round(value) })
+ }
+ return data
+}
+
+export function generateSessionTimeline(): TimelinePoint[] {
+ const rng = createRng(303)
+ const data: TimelinePoint[] = []
+
+ for (let i = 23; i >= 0; i--) {
+ const date = new Date()
+ date.setHours(date.getHours() - i, 0, 0, 0)
+ const peak = Math.sin((date.getHours() - 4) * Math.PI / 12)
+
+ data.push({
+ hour: date.toLocaleTimeString('en-US', { hour: '2-digit', minute: '2-digit' }),
+ started: Math.round(Math.max(1, 14 + peak * 9 + (rng() - 0.5) * 7)),
+ stopped: Math.round(Math.max(0, 9 + peak * 6 + (rng() - 0.5) * 5)),
+ errors: Math.round(Math.max(0, rng() * 2.5 - 0.3)),
+ })
+ }
+ return data
+}
+
+/** Demo sandboxes for the live-list when no real data exists. */
+export function generateDemoSandboxes() {
+ const rng = createRng(404)
+ const templates = ['python', 'node', 'go', 'rust', 'python', 'node']
+ const regions = ['us-east-1', 'eu-west-1', 'ap-south-1', 'us-west-2', 'eu-central-1', 'us-east-1']
+ const ids = ['a8f2c1', 'b3d7e9', 'c1a4b6', 'd9e2f0', 'e5b8a3', 'f7c6d4']
+
+ return ids.map((id, i) => ({
+ id: `demo-${i}`,
+ sandboxId: `sbx-${id}`,
+ orgId: 'demo',
+ template: templates[i],
+ region: regions[i],
+ workerId: `wkr-${Math.round(rng() * 99)}`,
+ status: 'running' as const,
+ startedAt: new Date(Date.now() - (8 + i * 18) * 60000).toISOString(),
+ }))
+}
diff --git a/web/src/hooks/useAuth.tsx b/web/src/hooks/useAuth.tsx
new file mode 100644
index 00000000..c0fc090f
--- /dev/null
+++ b/web/src/hooks/useAuth.tsx
@@ -0,0 +1,47 @@
+import { createContext, useContext, useEffect, useState, type ReactNode } from 'react'
+import { getMe } from '../api/client'
+
+interface AuthUser {
+ id: string
+ email: string
+ orgId: string
+}
+
+interface AuthContextValue {
+ user: AuthUser | null
+ loading: boolean
+ error: string | null
+}
+
+const AuthContext = createContext<AuthContextValue>({
+ user: null,
+ loading: true,
+ error: null,
+})
+
+export function AuthProvider({ children }: { children: ReactNode }) {
+ const [user, setUser] = useState<AuthUser | null>(null)
+ const [loading, setLoading] = useState(true)
+ const [error, setError] = useState<string | null>(null)
+
+ useEffect(() => {
+ getMe()
+ .then(setUser)
+ .catch((err: Error) => {
+ if (!err.message.includes('Unauthorized')) {
+ setError(err.message)
+ }
+ })
+ .finally(() => setLoading(false))
+ }, [])
+
+ return (
+ <AuthContext.Provider value={{ user, loading, error }}>
+ {children}
+ </AuthContext.Provider>
+ )
+}
+
+export function useAuth() {
+ return useContext(AuthContext)
+}
diff --git a/web/src/main.tsx b/web/src/main.tsx
new file mode 100644
index 00000000..915c6ea0
--- /dev/null
+++ b/web/src/main.tsx
@@ -0,0 +1,25 @@
+import React from 'react'
+import ReactDOM from 'react-dom/client'
+import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
+import { BrowserRouter } from 'react-router-dom'
+import App from './App'
+import './styles/theme.css'
+
+const queryClient = new QueryClient({
+ defaultOptions: {
+ queries: {
+ retry: 1,
+ staleTime: 30_000,
+ },
+ },
+})
+
+ReactDOM.createRoot(document.getElementById('root')!).render(
+ <React.StrictMode>
+ <QueryClientProvider client={queryClient}>
+ <BrowserRouter>
+ <App />
+ </BrowserRouter>
+ </QueryClientProvider>
+ </React.StrictMode>,
+)
diff --git a/web/src/pages/APIKeys.tsx b/web/src/pages/APIKeys.tsx
new file mode 100644
index 00000000..e45f103b
--- /dev/null
+++ b/web/src/pages/APIKeys.tsx
@@ -0,0 +1,172 @@
+import { useState } from 'react'
+import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
+import { getAPIKeys, createAPIKey, deleteAPIKey, type APIKey } from '../api/client'
+
+export default function APIKeys() {
+ const queryClient = useQueryClient()
+ const { data: keys, isLoading } = useQuery({
+ queryKey: ['api-keys'],
+ queryFn: getAPIKeys,
+ })
+
+ const [showCreate, setShowCreate] = useState(false)
+ const [newKeyName, setNewKeyName] = useState('')
+ const [createdKey, setCreatedKey] = useState<string | null>(null)
+
+ const createMutation = useMutation({
+ mutationFn: (name: string) => createAPIKey(name),
+ onSuccess: (data) => {
+ setCreatedKey(data.key)
+ setShowCreate(false)
+ setNewKeyName('')
+ queryClient.invalidateQueries({ queryKey: ['api-keys'] })
+ },
+ })
+
+ const deleteMutation = useMutation({
+ mutationFn: (id: string) => deleteAPIKey(id),
+ onSuccess: () => {
+ queryClient.invalidateQueries({ queryKey: ['api-keys'] })
+ },
+ })
+
+ return (
+ <div>
+ {/* Header */}
+ <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'flex-start', marginBottom: 28 }}>
+ <div>
+ <h1 className="page-title">API Keys</h1>
+ <p className="page-subtitle">Manage authentication tokens for your integrations</p>
+ </div>
+ <button className="btn-primary" onClick={() => setShowCreate(true)}>
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round">
+ <line x1="12" y1="5" x2="12" y2="19" /><line x1="5" y1="12" x2="19" y2="12" />
+ </svg>
+ Create Key
+ </button>
+ </div>
+
+ {/* Created Key Banner */}
+ {createdKey && (
+ <div className="animate-in" style={{
+ background: 'rgba(99, 102, 241, 0.06)',
+ border: '1px solid var(--border-accent)',
+ borderRadius: 'var(--radius-lg)',
+ padding: 20,
+ marginBottom: 20,
+ }}>
+ <div style={{ fontWeight: 600, marginBottom: 4, fontSize: 14 }}>New API key created</div>
+ <div style={{ fontSize: 12, color: 'var(--text-tertiary)', marginBottom: 10 }}>
+ Copy this key now. You won&apos;t be able to see it again.
+ </div>
+ <code style={{
+ display: 'block',
+ background: 'var(--bg-deep)',
+ color: 'var(--text-accent)',
+ padding: 14,
+ borderRadius: 'var(--radius-sm)',
+ fontSize: 13,
+ fontFamily: 'var(--font-mono)',
+ wordBreak: 'break-all',
+ border: '1px solid var(--border-subtle)',
+ }}>{createdKey}</code>
+ <button
+ onClick={() => setCreatedKey(null)}
+ style={{
+ marginTop: 10, fontSize: 12, background: 'none', border: 'none',
+ color: 'var(--accent-indigo)', cursor: 'pointer',
+ fontFamily: 'var(--font-body)',
+ }}
+ >
+ Dismiss
+ </button>
+ </div>
+ )}
+
+ {/* Create Dialog */}
+ {showCreate && (
+ <div className="glass-card animate-in" style={{ padding: 22, marginBottom: 20 }}>
+ <div style={{ marginBottom: 14 }}>
+ <label style={{ display: 'block', fontSize: 12, fontWeight: 600, color: 'var(--text-secondary)', marginBottom: 6 }}>
+ Key Name
+ </label>
+ <input
+ type="text"
+ value={newKeyName}
+ onChange={e => setNewKeyName(e.target.value)}
+ placeholder="e.g. Production Key"
+ className="input"
+ autoFocus
+ />
+ </div>
+ <div style={{ display: 'flex', gap: 8 }}>
+ <button
+ className="btn-primary"
+ onClick={() => createMutation.mutate(newKeyName)}
+ disabled={createMutation.isPending || !newKeyName.trim()}
+ >
+ {createMutation.isPending ? 'Creating\u2026' : 'Create'}
+ </button>
+ <button className="btn-ghost" onClick={() => { setShowCreate(false); setNewKeyName('') }}>
+ Cancel
+ </button>
+ </div>
+ </div>
+ )}
+
+ {/* Table */}
+ {isLoading ? (
+ <div style={{ display: 'flex', justifyContent: 'center', padding: 48 }}>
+ <div className="loading-spinner" />
+ </div>
+ ) : (
+ <div className="glass-card animate-in stagger-1" style={{ overflow: 'hidden' }}>
+ <table className="data-table">
+ <thead>
+ <tr>
+ <th>Name</th>
+ <th>Prefix</th>
+ <th>Last Used</th>
+ <th>Created</th>
+ <th style={{ width: 80 }}></th>
+ </tr>
+ </thead>
+ <tbody>
+ {(keys ?? []).map((k: APIKey) => (
+ <tr key={k.id}>
+ <td style={{ fontWeight: 500, color: 'var(--text-primary)' }}>{k.name}</td>
+ <td><code>{k.keyPrefix}\u2026</code></td>
+ <td style={{ fontFamily: 'var(--font-mono)', fontSize: 12 }}>
+ {k.lastUsed ? new Date(k.lastUsed).toLocaleString() : 'Never'}
+ </td>
+ <td style={{ fontFamily: 'var(--font-mono)', fontSize: 12 }}>
+ {new Date(k.createdAt).toLocaleString()}
+ </td>
+ <td>
+ <button
+ className="btn-danger"
+ onClick={() => {
+ if (confirm('Revoke this API key?')) {
+ deleteMutation.mutate(k.id)
+ }
+ }}
+ >
+ Revoke
+ </button>
+ </td>
+ </tr>
+ ))}
+ {(keys ?? []).length === 0 && (
+ <tr>
+ <td colSpan={5} style={{ textAlign: 'center', padding: 32, color: 'var(--text-tertiary)' }}>
+ No API keys yet
+ </td>
+ </tr>
+ )}
+ </tbody>
+ </table>
+ </div>
+ )}
+ </div>
+ )
+}
diff --git a/web/src/pages/Dashboard.tsx b/web/src/pages/Dashboard.tsx
new file mode 100644
index 00000000..bab2a5f0
--- /dev/null
+++ b/web/src/pages/Dashboard.tsx
@@ -0,0 +1,306 @@
+import { useState, useMemo } from 'react'
+import { useQuery } from '@tanstack/react-query'
+import { getSessions, type Session } from '../api/client'
+import {
+ AreaChart, Area, XAxis, YAxis, CartesianGrid, Tooltip,
+ ResponsiveContainer, PieChart, Pie, Cell, LineChart, Line,
+} from 'recharts'
+import {
+ generateUsageData, generateTemplateData, generateRegionData,
+ generateSparkData, generateDemoSandboxes, CHART_COLORS,
+} from '../data/mockData'
+
+/* ── Custom Tooltip ───────────────────────────────────────── */
+function ChartTooltip({ active, payload, label }: {
+ active?: boolean
+ payload?: Array<{ name: string; value: number; color: string }>
+ label?: string
+}) {
+ if (!active || !payload?.length) return null
+ return (
+ <div style={{
+ background: 'rgba(8, 8, 12, 0.92)',
+ backdropFilter: 'blur(14px)',
+ border: '1px solid var(--border-accent)',
+ borderRadius: 10,
+ padding: '10px 14px',
+ boxShadow: '0 12px 40px rgba(0,0,0,0.5)',
+ }}>
+ <div style={{
+ fontSize: 10, color: 'var(--text-tertiary)',
+ fontFamily: 'var(--font-mono)', marginBottom: 6,
+ }}>{label}</div>
+ {payload.map((p, i) => (
+ <div key={i} style={{ display: 'flex', alignItems: 'center', gap: 8, fontSize: 12, marginBottom: 2 }}>
+ <span style={{ width: 7, height: 7, borderRadius: '50%', background: p.color, flexShrink: 0 }} />
+ <span style={{ color: 'var(--text-secondary)' }}>{p.name}</span>
+ <span style={{ color: 'var(--text-primary)', fontFamily: 'var(--font-mono)', fontWeight: 600, marginLeft: 'auto' }}>
+ {p.value.toLocaleString()}
+ </span>
+ </div>
+ ))}
+ </div>
+ )
+}
+
+/* ── Main Dashboard ───────────────────────────────────────── */
+export default function Dashboard() {
+ const [timeRange, setTimeRange] = useState<7 | 30>(7)
+
+ const { data: sessions, isLoading } = useQuery({
+ queryKey: ['sessions', 'running'],
+ queryFn: () => getSessions('running'),
+ })
+
+ const activeSandboxes = sessions ?? []
+
+ const usageData = useMemo(() => generateUsageData(timeRange), [timeRange])
+ const templateData = useMemo(() => generateTemplateData(), [])
+ const regionData = useMemo(() => generateRegionData(), [])
+ const sparkActive = useMemo(() => generateSparkData(10, 24, 'up'), [])
+ const sparkSessions = useMemo(() => generateSparkData(20, 24, 'up'), [])
+ const sparkUptime = useMemo(() => generateSparkData(30, 24, 'stable'), [])
+ const sparkAPI = useMemo(() => generateSparkData(40, 24, 'up'), [])
+
+ const templateTotal = templateData.reduce((s, t) => s + t.value, 0)
+ const liveList = activeSandboxes.length > 0 ? activeSandboxes : generateDemoSandboxes()
+
+ return (
+ <div>
+ {/* Header */}
+ <div style={{ marginBottom: 32 }}>
+ <h1 className="page-title">Dashboard</h1>
+ <p className="page-subtitle">Real-time overview of your sandbox infrastructure</p>
+ </div>
+
+ {/* ── Stat Cards ── */}
+ <div className="grid-stats" style={{
+ display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 14, marginBottom: 24,
+ }}>
+ <StatCard label="Active Sandboxes" value={activeSandboxes.length || 24} change="+12%" up sparkData={sparkActive} color={CHART_COLORS[0]} idx={0} />
+ <StatCard label="Sessions Today" value={847} change="+23%" up sparkData={sparkSessions} color={CHART_COLORS[1]} idx={1} />
+ <StatCard label="Avg Uptime" value="99.7%" change="+0.2%" up sparkData={sparkUptime} color={CHART_COLORS[2]} idx={2} />
+ <StatCard label="API Calls (24h)" value="12.4k" change="+18%" up sparkData={sparkAPI} color={CHART_COLORS[4]} idx={3} />
+ </div>
+
+ {/* ── Main Charts Row ── */}
+ <div className="grid-charts-main" style={{
+ display: 'grid', gridTemplateColumns: '5fr 2fr', gap: 14, marginBottom: 24,
+ }}>
+ {/* Area — Usage Over Time */}
+ <div className="glass-card animate-in stagger-5" style={{ padding: '22px 24px' }}>
+ <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 18 }}>
+ <span className="section-title" style={{ marginBottom: 0 }}>Usage Over Time</span>
+ <div style={{ display: 'flex', gap: 4 }}>
+ {([7, 30] as const).map(d => (
+ <button key={d} onClick={() => setTimeRange(d)}
+ className={`filter-btn${timeRange === d ? ' active' : ''}`}
+ style={{ padding: '3px 12px', fontSize: 11 }}>
+ {d}d
+ </button>
+ ))}
+ </div>
+ </div>
+ <ResponsiveContainer width="100%" height={270}>
+ <AreaChart data={usageData}>
+ <defs>
+ <linearGradient id="gSandboxes" x1="0" y1="0" x2="0" y2="1">
+ <stop offset="0%" stopColor="#818cf8" stopOpacity={0.22} />
+ <stop offset="100%" stopColor="#818cf8" stopOpacity={0} />
+ </linearGradient>
+ <linearGradient id="gSessions" x1="0" y1="0" x2="0" y2="1">
+ <stop offset="0%" stopColor="#34d399" stopOpacity={0.18} />
+ <stop offset="100%" stopColor="#34d399" stopOpacity={0} />
+ </linearGradient>
+ </defs>
+ <CartesianGrid strokeDasharray="3 3" />
+ <XAxis dataKey="time" tick={{ fontSize: 10 }} axisLine={{ stroke: 'rgba(255,255,255,0.05)' }} tickLine={false} interval="preserveStartEnd" />
+ <YAxis tick={{ fontSize: 10 }} axisLine={false} tickLine={false} width={36} />
+ <Tooltip content={<ChartTooltip />} />
+ <Area type="monotone" dataKey="sessions" name="Sessions" stroke="#34d399" strokeWidth={1.5} fill="url(#gSessions)" />
+ <Area type="monotone" dataKey="sandboxes" name="Sandboxes" stroke="#818cf8" strokeWidth={2} fill="url(#gSandboxes)" />
+ </AreaChart>
+ </ResponsiveContainer>
+ </div>
+
+ {/* Donut — Template Distribution */}
+ <div className="glass-card animate-in stagger-5" style={{ padding: '22px 24px', display: 'flex', flexDirection: 'column' }}>
+ <span className="section-title">By Template</span>
+ <div style={{ flex: 1, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
+ <ResponsiveContainer width="100%" height={175}>
+ <PieChart>
+ <Pie data={templateData} cx="50%" cy="50%" innerRadius={52} outerRadius={78}
+ paddingAngle={3} dataKey="value" stroke="none">
+ {templateData.map((e, i) => <Cell key={i} fill={e.color} />)}
+ </Pie>
+ <Tooltip content={<ChartTooltip />} />
+ </PieChart>
+ </ResponsiveContainer>
+ </div>
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 7, marginTop: 4 }}>
+ {templateData.map(t => (
+ <div key={t.name} style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
+ <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
+ <span style={{ width: 8, height: 8, borderRadius: 2, background: t.color, flexShrink: 0 }} />
+ <span style={{ fontSize: 12, color: 'var(--text-secondary)' }}>{t.name}</span>
+ </div>
+ <span className="metric-value" style={{ fontSize: 11, color: 'var(--text-tertiary)' }}>
+ {Math.round((t.value / templateTotal) * 100)}%
+ </span>
+ </div>
+ ))}
+ </div>
+ </div>
+ </div>
+
+ {/* ── Bottom Row ── */}
+ <div className="grid-charts-secondary" style={{
+ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 14,
+ }}>
+ {/* Region Distribution */}
+ <div className="glass-card" style={{ padding: '22px 24px' }}>
+ <span className="section-title">By Region</span>
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 14 }}>
+ {regionData.map((r, i) => {
+ const pct = (r.count / regionData[0].count) * 100
+ return (
+ <div key={r.region}>
+ <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 7 }}>
+ <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
+ <span style={{ fontSize: 12, color: 'var(--text-secondary)' }}>{r.label}</span>
+ <code style={{
+ fontSize: 10, color: 'var(--text-tertiary)',
+ fontFamily: 'var(--font-mono)',
+ background: 'rgba(255,255,255,0.03)', padding: '1px 5px', borderRadius: 3,
+ }}>{r.region}</code>
+ </div>
+ <span className="metric-value" style={{ fontSize: 12, color: 'var(--text-tertiary)' }}>
+ {r.count}
+ </span>
+ </div>
+ <div style={{ height: 5, borderRadius: 3, background: 'rgba(255,255,255,0.04)', overflow: 'hidden' }}>
+ <div style={{
+ height: '100%', width: `${pct}%`, borderRadius: 3,
+ background: CHART_COLORS[i],
+ boxShadow: `0 0 8px ${CHART_COLORS[i]}33`,
+ transition: 'width 0.6s cubic-bezier(0.16,1,0.3,1)',
+ }} />
+ </div>
+ </div>
+ )
+ })}
+ </div>
+ </div>
+
+ {/* Live Sandboxes */}
+ <div className="glass-card" style={{ padding: '22px 24px' }}>
+ <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 14 }}>
+ <span className="section-title" style={{ marginBottom: 0 }}>Live Sandboxes</span>
+ <span style={{
+ fontSize: 11, fontFamily: 'var(--font-mono)', color: 'var(--accent-emerald)',
+ display: 'flex', alignItems: 'center', gap: 6,
+ }}>
+ <span className="pulse-dot" style={{
+ width: 6, height: 6, borderRadius: '50%',
+ background: 'var(--accent-emerald)', display: 'inline-block',
+ }} />
+ {liveList.length} active
+ </span>
+ </div>
+
+ {isLoading ? (
+ <div style={{ display: 'flex', justifyContent: 'center', padding: 40 }}>
+ <div className="loading-spinner" />
+ </div>
+ ) : (
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 6, maxHeight: 270, overflowY: 'auto' }}>
+ {liveList.map((s, i) => <SandboxRow key={s.id ?? i} session={s} />)}
+ </div>
+ )}
+ </div>
+ </div>
+ </div>
+ )
+}
+
+/* ── Stat Card w/ Sparkline ───────────────────────────────── */
+function StatCard({ label, value, change, up, sparkData, color, idx }: {
+ label: string
+ value: number | string
+ change: string
+ up: boolean
+ sparkData: { value: number }[]
+ color: string
+ idx: number
+}) {
+ const gradId = `spark-g-${idx}`
+ return (
+ <div className={`stat-card animate-in stagger-${idx + 1}`}>
+ <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'flex-start', marginBottom: 10 }}>
+ <div>
+ <div style={{ fontSize: 11, color: 'var(--text-tertiary)', marginBottom: 8, letterSpacing: '0.03em' }}>{label}</div>
+ <div className="metric-value" style={{ fontSize: 30, fontWeight: 700, lineHeight: 1 }}>{typeof value === 'number' ? value.toLocaleString() : value}</div>
+ </div>
+ <span style={{
+ fontSize: 11, fontFamily: 'var(--font-mono)', fontWeight: 500,
+ color: up ? 'var(--accent-emerald)' : 'var(--accent-rose)',
+ background: up ? 'rgba(52,211,153,0.08)' : 'rgba(251,113,133,0.08)',
+ padding: '2px 8px', borderRadius: 10,
+ }}>{change}</span>
+ </div>
+ <div style={{ height: 36, marginLeft: -6, marginRight: -6 }}>
+ <ResponsiveContainer width="100%" height="100%">
+ <LineChart data={sparkData}>
+ <defs>
+ <linearGradient id={gradId} x1="0" y1="0" x2="1" y2="0">
+ <stop offset="0%" stopColor={color} stopOpacity={0.15} />
+ <stop offset="100%" stopColor={color} stopOpacity={0.9} />
+ </linearGradient>
+ </defs>
+ <Line type="monotone" dataKey="value" stroke={`url(#${gradId})`} strokeWidth={1.8} dot={false} />
+ </LineChart>
+ </ResponsiveContainer>
+ </div>
+ </div>
+ )
+}
+
+/* ── Sandbox Row ──────────────────────────────────────────── */
+function SandboxRow({ session }: { session: Session | ReturnType<typeof generateDemoSandboxes>[number] }) {
+ const elapsed = Math.round((Date.now() - new Date(session.startedAt).getTime()) / 1000 / 60)
+ return (
+ <div style={{
+ display: 'flex', alignItems: 'center', justifyContent: 'space-between',
+ padding: '9px 12px', borderRadius: 8,
+ background: 'rgba(255,255,255,0.015)',
+ border: '1px solid rgba(255,255,255,0.035)',
+ transition: 'all 0.15s ease', cursor: 'default',
+ }}
+ onMouseOver={e => {
+ e.currentTarget.style.background = 'rgba(99,102,241,0.05)'
+ e.currentTarget.style.borderColor = 'rgba(99,102,241,0.12)'
+ }}
+ onMouseOut={e => {
+ e.currentTarget.style.background = 'rgba(255,255,255,0.015)'
+ e.currentTarget.style.borderColor = 'rgba(255,255,255,0.035)'
+ }}>
+ <div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
+ <span className="pulse-dot" style={{
+ width: 6, height: 6, borderRadius: '50%',
+ background: 'var(--accent-emerald)', flexShrink: 0,
+ }} />
+ <div>
+ <code style={{ fontSize: 12, fontFamily: 'var(--font-mono)', color: 'var(--text-accent)' }}>
+ {session.sandboxId}
+ </code>
+ <div style={{ fontSize: 10, color: 'var(--text-tertiary)', marginTop: 1 }}>
+ {session.template || 'base'} &middot; {session.region}
+ </div>
+ </div>
+ </div>
+ <span className="metric-value" style={{ fontSize: 11, color: 'var(--text-tertiary)' }}>
+ {elapsed}m
+ </span>
+ </div>
+ )
+}
diff --git a/web/src/pages/Login.tsx b/web/src/pages/Login.tsx
new file mode 100644
index 00000000..11aa3016
--- /dev/null
+++ b/web/src/pages/Login.tsx
@@ -0,0 +1,87 @@
+export default function Login() {
+ return (
+ <div style={{
+ display: 'flex',
+ flexDirection: 'column',
+ alignItems: 'center',
+ justifyContent: 'center',
+ height: '100vh',
+ background: 'var(--bg-void)',
+ position: 'relative',
+ overflow: 'hidden',
+ }}>
+ {/* Ambient glow */}
+ <div style={{
+ position: 'absolute',
+ width: 600, height: 600,
+ borderRadius: '50%',
+ background: 'radial-gradient(circle, rgba(99,102,241,0.08) 0%, transparent 70%)',
+ top: '50%', left: '50%',
+ transform: 'translate(-50%, -55%)',
+ pointerEvents: 'none',
+ }} />
+
+ {/* Content */}
+ <div style={{ position: 'relative', textAlign: 'center' }}>
+ {/* Logo */}
+ <div style={{
+ width: 56, height: 56,
+ borderRadius: 16,
+ background: 'var(--gradient-primary)',
+ display: 'flex', alignItems: 'center', justifyContent: 'center',
+ fontSize: 20, fontWeight: 800, color: '#fff',
+ fontFamily: 'var(--font-display)',
+ margin: '0 auto 24px',
+ boxShadow: '0 0 40px rgba(99,102,241,0.3)',
+ }}>
+ OS
+ </div>
+
+ <h1 style={{
+ fontSize: 34,
+ fontWeight: 700,
+ fontFamily: 'var(--font-display)',
+ letterSpacing: '-0.04em',
+ color: 'var(--text-primary)',
+ marginBottom: 8,
+ }}>
+ OpenSandbox
+ </h1>
+
+ <p style={{
+ fontSize: 14,
+ color: 'var(--text-tertiary)',
+ marginBottom: 40,
+ maxWidth: 280,
+ lineHeight: 1.5,
+ }}>
+ Sign in to manage your sandbox infrastructure
+ </p>
+
+ <a
+ href="/auth/login"
+ className="btn-primary"
+ style={{
+ display: 'inline-flex',
+ padding: '14px 40px',
+ fontSize: 15,
+ borderRadius: 10,
+ textDecoration: 'none',
+ }}
+ >
+ Sign in with WorkOS
+ </a>
+
+ <div style={{
+ marginTop: 48,
+ fontSize: 11,
+ color: 'var(--text-tertiary)',
+ fontFamily: 'var(--font-mono)',
+ letterSpacing: '0.04em',
+ }}>
+ SECURE &middot; GLOBAL &middot; FAST
+ </div>
+ </div>
+ </div>
+ )
+}
diff --git a/web/src/pages/Sessions.tsx b/web/src/pages/Sessions.tsx
new file mode 100644
index 00000000..afb13c5d
--- /dev/null
+++ b/web/src/pages/Sessions.tsx
@@ -0,0 +1,154 @@
+import { useState, useMemo } from 'react'
+import { useQuery } from '@tanstack/react-query'
+import { getSessions, type Session } from '../api/client'
+import {
+ BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, Legend,
+} from 'recharts'
+import { generateSessionTimeline } from '../data/mockData'
+
+const statusFilters = ['', 'running', 'stopped', 'error'] as const
+
+/* ── Tooltip ──────────────────────────────────────────────── */
+function TimelineTooltip({ active, payload, label }: {
+ active?: boolean
+ payload?: Array<{ name: string; value: number; color: string }>
+ label?: string
+}) {
+ if (!active || !payload?.length) return null
+ return (
+ <div style={{
+ background: 'rgba(8,8,12,0.92)', backdropFilter: 'blur(14px)',
+ border: '1px solid var(--border-accent)', borderRadius: 10,
+ padding: '10px 14px', boxShadow: '0 12px 40px rgba(0,0,0,0.5)',
+ }}>
+ <div style={{ fontSize: 10, color: 'var(--text-tertiary)', fontFamily: 'var(--font-mono)', marginBottom: 6 }}>{label}</div>
+ {payload.map((p, i) => (
+ <div key={i} style={{ display: 'flex', alignItems: 'center', gap: 8, fontSize: 12, marginBottom: 2 }}>
+ <span style={{ width: 7, height: 7, borderRadius: '50%', background: p.color, flexShrink: 0 }} />
+ <span style={{ color: 'var(--text-secondary)' }}>{p.name}</span>
+ <span style={{ color: 'var(--text-primary)', fontFamily: 'var(--font-mono)', fontWeight: 600, marginLeft: 'auto' }}>{p.value}</span>
+ </div>
+ ))}
+ </div>
+ )
+}
+
+/* ── Main ─────────────────────────────────────────────────── */
+export default function Sessions() {
+ const [status, setStatus] = useState<string>('')
+ const { data: sessions, isLoading } = useQuery({
+ queryKey: ['sessions', status],
+ queryFn: () => getSessions(status || undefined),
+ })
+
+ const timeline = useMemo(() => generateSessionTimeline(), [])
+
+ return (
+ <div>
+ <div style={{ marginBottom: 28 }}>
+ <h1 className="page-title">Sessions</h1>
+ <p className="page-subtitle">Session history and activity timeline</p>
+ </div>
+
+ {/* ── Timeline Chart ── */}
+ <div className="glass-card animate-in stagger-1" style={{ padding: '22px 24px', marginBottom: 22 }}>
+ <span className="section-title">Activity — Last 24 Hours</span>
+ <ResponsiveContainer width="100%" height={190}>
+ <BarChart data={timeline} barGap={1}>
+ <defs>
+ <linearGradient id="gStarted" x1="0" y1="0" x2="0" y2="1">
+ <stop offset="0%" stopColor="#818cf8" stopOpacity={0.85} />
+ <stop offset="100%" stopColor="#818cf8" stopOpacity={0.45} />
+ </linearGradient>
+ <linearGradient id="gStopped" x1="0" y1="0" x2="0" y2="1">
+ <stop offset="0%" stopColor="#8585a0" stopOpacity={0.6} />
+ <stop offset="100%" stopColor="#8585a0" stopOpacity={0.25} />
+ </linearGradient>
+ </defs>
+ <CartesianGrid strokeDasharray="3 3" />
+ <XAxis dataKey="hour" tick={{ fontSize: 9 }} axisLine={{ stroke: 'rgba(255,255,255,0.05)' }} tickLine={false} interval={2} />
+ <YAxis tick={{ fontSize: 10 }} axisLine={false} tickLine={false} width={30} />
+ <Tooltip content={<TimelineTooltip />} />
+ <Legend
+ iconType="circle"
+ iconSize={7}
+ wrapperStyle={{ fontSize: 11, color: 'var(--text-tertiary)', fontFamily: 'var(--font-body)' }}
+ />
+ <Bar dataKey="started" name="Started" fill="url(#gStarted)" radius={[3, 3, 0, 0]} />
+ <Bar dataKey="stopped" name="Stopped" fill="url(#gStopped)" radius={[3, 3, 0, 0]} />
+ <Bar dataKey="errors" name="Errors" fill="#fb718544" radius={[3, 3, 0, 0]} />
+ </BarChart>
+ </ResponsiveContainer>
+ </div>
+
+ {/* ── Filters ── */}
+ <div style={{ marginBottom: 16, display: 'flex', gap: 6 }}>
+ {statusFilters.map(f => (
+ <button key={f} onClick={() => setStatus(f)}
+ className={`filter-btn${status === f ? ' active' : ''}`}>
+ {f || 'All'}
+ </button>
+ ))}
+ </div>
+
+ {/* ── Table ── */}
+ {isLoading ? (
+ <div style={{ display: 'flex', justifyContent: 'center', padding: 48 }}>
+ <div className="loading-spinner" />
+ </div>
+ ) : (
+ <div className="glass-card animate-in stagger-2" style={{ overflow: 'hidden' }}>
+ <table className="data-table">
+ <thead>
+ <tr>
+ <th>Sandbox ID</th>
+ <th>Template</th>
+ <th>Region</th>
+ <th>Status</th>
+ <th>Started</th>
+ <th>Stopped</th>
+ </tr>
+ </thead>
+ <tbody>
+ {(sessions ?? []).map((s: Session) => (
+ <tr key={s.id}>
+ <td><code>{s.sandboxId}</code></td>
+ <td>{s.template || 'base'}</td>
+ <td>{s.region}</td>
+ <td><StatusBadge status={s.status} /></td>
+ <td style={{ fontFamily: 'var(--font-mono)', fontSize: 12 }}>{new Date(s.startedAt).toLocaleString()}</td>
+ <td style={{ fontFamily: 'var(--font-mono)', fontSize: 12 }}>{s.stoppedAt ? new Date(s.stoppedAt).toLocaleString() : '\u2014'}</td>
+ </tr>
+ ))}
+ {(sessions ?? []).length === 0 && (
+ <tr>
+ <td colSpan={6} style={{ textAlign: 'center', padding: 32, color: 'var(--text-tertiary)' }}>
+ No sessions found
+ </td>
+ </tr>
+ )}
+ </tbody>
+ </table>
+ </div>
+ )}
+ </div>
+ )
+}
+
+function StatusBadge({ status }: { status: string }) {
+ const cls =
+ status === 'running' ? 'badge-running'
+ : status === 'error' ? 'badge-error'
+ : 'badge-stopped'
+ return (
+ <span className={`badge ${cls}`}>
+ {status === 'running' && (
+ <span className="pulse-dot" style={{
+ width: 5, height: 5, borderRadius: '50%',
+ background: 'currentColor', display: 'inline-block',
+ }} />
+ )}
+ {status}
+ </span>
+ )
+}
diff --git a/web/src/pages/Settings.tsx b/web/src/pages/Settings.tsx
new file mode 100644
index 00000000..ce0a73e8
--- /dev/null
+++ b/web/src/pages/Settings.tsx
@@ -0,0 +1,135 @@
+import { useState, useEffect } from 'react'
+import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
+import { getOrg, updateOrg } from '../api/client'
+
+export default function Settings() {
+ const queryClient = useQueryClient()
+ const { data: org, isLoading } = useQuery({
+ queryKey: ['org'],
+ queryFn: getOrg,
+ })
+
+ const [name, setName] = useState('')
+ const [saved, setSaved] = useState(false)
+
+ useEffect(() => {
+ if (org) setName(org.name)
+ }, [org])
+
+ const mutation = useMutation({
+ mutationFn: (n: string) => updateOrg(n),
+ onSuccess: () => {
+ queryClient.invalidateQueries({ queryKey: ['org'] })
+ setSaved(true)
+ setTimeout(() => setSaved(false), 2000)
+ },
+ })
+
+ if (isLoading) {
+ return (
+ <div style={{ display: 'flex', justifyContent: 'center', padding: 64 }}>
+ <div className="loading-spinner" />
+ </div>
+ )
+ }
+
+ const unchanged = name === org?.name
+
+ return (
+ <div>
+ <div style={{ marginBottom: 28 }}>
+ <h1 className="page-title">Settings</h1>
+ <p className="page-subtitle">Organization configuration</p>
+ </div>
+
+ <div className="glass-card animate-in stagger-1" style={{ padding: 28, maxWidth: 520 }}>
+ {/* Org Name */}
+ <div style={{ marginBottom: 22 }}>
+ <label style={{ display: 'block', fontSize: 12, fontWeight: 600, color: 'var(--text-secondary)', marginBottom: 6 }}>
+ Organization Name
+ </label>
+ <input
+ type="text"
+ value={name}
+ onChange={e => setName(e.target.value)}
+ className="input"
+ />
+ </div>
+
+ {/* Plan (read-only) */}
+ <div style={{ marginBottom: 22 }}>
+ <label style={{ display: 'block', fontSize: 12, fontWeight: 600, color: 'var(--text-secondary)', marginBottom: 6 }}>
+ Plan
+ </label>
+ <div style={{
+ padding: '10px 14px',
+ background: 'rgba(255,255,255,0.02)',
+ border: '1px solid var(--border-subtle)',
+ borderRadius: 'var(--radius-sm)',
+ fontSize: 14,
+ color: 'var(--text-tertiary)',
+ textTransform: 'capitalize',
+ }}>
+ {org?.plan ?? 'free'}
+ </div>
+ </div>
+
+ {/* Limits */}
+ <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 16, marginBottom: 24 }}>
+ <div>
+ <label style={{ display: 'block', fontSize: 12, fontWeight: 600, color: 'var(--text-secondary)', marginBottom: 6 }}>
+ Max Concurrent Sandboxes
+ </label>
+ <div style={{
+ padding: '10px 14px',
+ background: 'rgba(255,255,255,0.02)',
+ border: '1px solid var(--border-subtle)',
+ borderRadius: 'var(--radius-sm)',
+ fontSize: 14,
+ fontFamily: 'var(--font-mono)',
+ color: 'var(--text-tertiary)',
+ }}>
+ {org?.maxConcurrentSandboxes}
+ </div>
+ </div>
+ <div>
+ <label style={{ display: 'block', fontSize: 12, fontWeight: 600, color: 'var(--text-secondary)', marginBottom: 6 }}>
+ Max Timeout (sec)
+ </label>
+ <div style={{
+ padding: '10px 14px',
+ background: 'rgba(255,255,255,0.02)',
+ border: '1px solid var(--border-subtle)',
+ borderRadius: 'var(--radius-sm)',
+ fontSize: 14,
+ fontFamily: 'var(--font-mono)',
+ color: 'var(--text-tertiary)',
+ }}>
+ {org?.maxSandboxTimeoutSec}
+ </div>
+ </div>
+ </div>
+
+ {/* Save */}
+ <div style={{ display: 'flex', alignItems: 'center', gap: 14 }}>
+ <button
+ className="btn-primary"
+ onClick={() => mutation.mutate(name)}
+ disabled={mutation.isPending || unchanged}
+ >
+ {mutation.isPending ? 'Saving\u2026' : 'Save Changes'}
+ </button>
+ {saved && (
+ <span style={{
+ fontSize: 12, fontWeight: 500,
+ color: 'var(--accent-emerald)',
+ animation: 'fadeInUp 0.3s ease',
+ }}>
+ Saved
+ </span>
+ )}
+ </div>
+ </div>
+ </div>
+ )
+}
diff --git a/web/src/styles/theme.css b/web/src/styles/theme.css
new file mode 100644
index 00000000..17d99137
--- /dev/null
+++ b/web/src/styles/theme.css
@@ -0,0 +1,442 @@
+/* ============================================================
+ OpenSandbox — "Void Glass" Design System
+ Deep black surfaces, glass-morphism cards, neon chart accents
+ ============================================================ */
+
+/* --- Design Tokens --- */
+:root {
+ /* Backgrounds */
+ --bg-void: #08080c;
+ --bg-deep: #0c0c12;
+ --bg-surface: #111118;
+ --bg-card: rgba(17, 17, 24, 0.65);
+ --bg-elevated: #18182200;
+ --bg-hover: rgba(99, 102, 241, 0.05);
+
+ /* Borders */
+ --border-subtle: rgba(255, 255, 255, 0.06);
+ --border-default: rgba(255, 255, 255, 0.08);
+ --border-accent: rgba(129, 140, 248, 0.22);
+ --border-glow: rgba(129, 140, 248, 0.4);
+
+ /* Text */
+ --text-primary: #ededf0;
+ --text-secondary: #8585a0;
+ --text-tertiary: #4e4e64;
+ --text-accent: #a5b4fc;
+
+ /* Accents */
+ --accent-indigo: #818cf8;
+ --accent-violet: #a78bfa;
+ --accent-emerald: #34d399;
+ --accent-cyan: #22d3ee;
+ --accent-amber: #fbbf24;
+ --accent-rose: #fb7185;
+ --accent-pink: #f472b6;
+
+ /* Gradients */
+ --gradient-primary: linear-gradient(135deg, #6366f1, #818cf8);
+ --gradient-surface: linear-gradient(180deg, rgba(255,255,255,0.025) 0%, transparent 100%);
+
+ /* Shadows */
+ --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
+ --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
+ --shadow-glow: 0 0 24px rgba(99, 102, 241, 0.12);
+
+ /* Radii */
+ --radius-sm: 6px;
+ --radius-md: 10px;
+ --radius-lg: 14px;
+ --radius-xl: 20px;
+
+ /* Typography */
+ --font-display: 'Outfit', sans-serif;
+ --font-body: 'DM Sans', sans-serif;
+ --font-mono: 'JetBrains Mono', monospace;
+}
+
+/* --- Reset & Base --- */
+*, *::before, *::after {
+ box-sizing: border-box;
+ margin: 0;
+ padding: 0;
+}
+
+html {
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+}
+
+body {
+ font-family: var(--font-body);
+ background: var(--bg-void);
+ color: var(--text-primary);
+ line-height: 1.5;
+}
+
+/* Ambient dot-grid texture */
+body::before {
+ content: '';
+ position: fixed;
+ inset: 0;
+ background-image: radial-gradient(circle, rgba(99, 102, 241, 0.035) 1px, transparent 1px);
+ background-size: 28px 28px;
+ pointer-events: none;
+ z-index: 0;
+}
+
+#root {
+ position: relative;
+ z-index: 1;
+}
+
+/* --- Scrollbar --- */
+::-webkit-scrollbar { width: 5px; height: 5px; }
+::-webkit-scrollbar-track { background: transparent; }
+::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }
+::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.14); }
+
+/* --- Glass Card --- */
+.glass-card {
+ background: var(--bg-card);
+ backdrop-filter: blur(16px);
+ -webkit-backdrop-filter: blur(16px);
+ border: 1px solid var(--border-subtle);
+ border-radius: var(--radius-lg);
+ background-image: var(--gradient-surface);
+ transition: border-color 0.25s ease, box-shadow 0.25s ease;
+}
+
+.glass-card:hover {
+ border-color: var(--border-accent);
+ box-shadow: var(--shadow-glow);
+}
+
+/* --- Stat Card --- */
+.stat-card {
+ position: relative;
+ background: var(--bg-surface);
+ background-image: var(--gradient-surface);
+ border: 1px solid var(--border-subtle);
+ border-radius: var(--radius-lg);
+ padding: 22px 24px;
+ overflow: hidden;
+ transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
+}
+
+.stat-card::after {
+ content: '';
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ height: 2px;
+ background: var(--gradient-primary);
+ opacity: 0;
+ transition: opacity 0.3s ease;
+}
+
+.stat-card:hover {
+ transform: translateY(-3px);
+ border-color: var(--border-accent);
+ box-shadow: var(--shadow-glow);
+}
+
+.stat-card:hover::after {
+ opacity: 1;
+}
+
+/* --- Animations --- */
+@keyframes fadeInUp {
+ from { opacity: 0; transform: translateY(16px); }
+ to { opacity: 1; transform: translateY(0); }
+}
+
+@keyframes pulseDot {
+ 0%, 100% { opacity: 1; transform: scale(1); }
+ 50% { opacity: 0.35; transform: scale(0.85); }
+}
+
+@keyframes shimmer {
+ 0% { background-position: -200% center; }
+ 100% { background-position: 200% center; }
+}
+
+@keyframes spin {
+ to { transform: rotate(360deg); }
+}
+
+@keyframes subtleFloat {
+ 0%, 100% { transform: translateY(0); }
+ 50% { transform: translateY(-6px); }
+}
+
+.animate-in {
+ animation: fadeInUp 0.55s cubic-bezier(0.16, 1, 0.3, 1) forwards;
+}
+
+.stagger-1 { animation-delay: 0.04s; opacity: 0; }
+.stagger-2 { animation-delay: 0.10s; opacity: 0; }
+.stagger-3 { animation-delay: 0.16s; opacity: 0; }
+.stagger-4 { animation-delay: 0.22s; opacity: 0; }
+.stagger-5 { animation-delay: 0.28s; opacity: 0; }
+
+.pulse-dot { animation: pulseDot 2.2s ease-in-out infinite; }
+
+/* --- Status Badges --- */
+.badge {
+ display: inline-flex;
+ align-items: center;
+ gap: 6px;
+ font-size: 11px;
+ padding: 3px 10px;
+ border-radius: 20px;
+ font-weight: 500;
+ letter-spacing: 0.03em;
+}
+
+.badge-running {
+ background: rgba(52, 211, 153, 0.10);
+ color: #34d399;
+ border: 1px solid rgba(52, 211, 153, 0.18);
+}
+
+.badge-stopped {
+ background: rgba(133, 133, 160, 0.10);
+ color: #8585a0;
+ border: 1px solid rgba(133, 133, 160, 0.15);
+}
+
+.badge-error {
+ background: rgba(251, 113, 133, 0.10);
+ color: #fb7185;
+ border: 1px solid rgba(251, 113, 133, 0.18);
+}
+
+/* --- Table --- */
+.data-table {
+ width: 100%;
+ border-collapse: separate;
+ border-spacing: 0;
+}
+
+.data-table thead th {
+ text-align: left;
+ padding: 14px 16px;
+ font-size: 10px;
+ font-weight: 600;
+ color: var(--text-tertiary);
+ text-transform: uppercase;
+ letter-spacing: 0.1em;
+ border-bottom: 1px solid var(--border-subtle);
+ font-family: var(--font-body);
+}
+
+.data-table tbody tr {
+ transition: background 0.15s ease;
+}
+
+.data-table tbody tr:hover {
+ background: var(--bg-hover);
+}
+
+.data-table tbody td {
+ padding: 13px 16px;
+ font-size: 13px;
+ color: var(--text-secondary);
+ border-bottom: 1px solid rgba(255, 255, 255, 0.025);
+}
+
+.data-table tbody td code {
+ font-family: var(--font-mono);
+ font-size: 12px;
+ color: var(--text-accent);
+ background: rgba(99, 102, 241, 0.07);
+ padding: 2px 7px;
+ border-radius: 4px;
+}
+
+/* --- Buttons --- */
+.btn-primary {
+ display: inline-flex;
+ align-items: center;
+ gap: 6px;
+ padding: 9px 22px;
+ background: var(--gradient-primary);
+ color: #fff;
+ border: none;
+ border-radius: var(--radius-sm);
+ cursor: pointer;
+ font-size: 13px;
+ font-weight: 600;
+ font-family: var(--font-body);
+ letter-spacing: 0.01em;
+ transition: all 0.2s ease;
+}
+
+.btn-primary:hover {
+ box-shadow: 0 0 24px rgba(99, 102, 241, 0.3);
+ transform: translateY(-1px);
+}
+
+.btn-primary:disabled {
+ opacity: 0.45;
+ cursor: default;
+ transform: none;
+ box-shadow: none;
+}
+
+.btn-ghost {
+ display: inline-flex;
+ align-items: center;
+ gap: 6px;
+ padding: 9px 18px;
+ background: transparent;
+ color: var(--text-secondary);
+ border: 1px solid var(--border-subtle);
+ border-radius: var(--radius-sm);
+ cursor: pointer;
+ font-size: 13px;
+ font-weight: 500;
+ font-family: var(--font-body);
+ transition: all 0.2s ease;
+}
+
+.btn-ghost:hover {
+ border-color: var(--border-accent);
+ color: var(--text-primary);
+ background: var(--bg-hover);
+}
+
+.btn-danger {
+ display: inline-flex;
+ align-items: center;
+ padding: 5px 14px;
+ background: rgba(251, 113, 133, 0.07);
+ color: var(--accent-rose);
+ border: 1px solid rgba(251, 113, 133, 0.14);
+ border-radius: var(--radius-sm);
+ cursor: pointer;
+ font-size: 12px;
+ font-weight: 500;
+ font-family: var(--font-body);
+ transition: all 0.2s ease;
+}
+
+.btn-danger:hover {
+ background: rgba(251, 113, 133, 0.14);
+ border-color: rgba(251, 113, 133, 0.28);
+}
+
+/* --- Filter Pills --- */
+.filter-btn {
+ padding: 5px 16px;
+ border-radius: 20px;
+ border: 1px solid var(--border-subtle);
+ background: transparent;
+ color: var(--text-secondary);
+ cursor: pointer;
+ font-size: 12px;
+ font-weight: 500;
+ font-family: var(--font-body);
+ transition: all 0.2s ease;
+}
+
+.filter-btn:hover {
+ border-color: var(--border-accent);
+ color: var(--text-primary);
+}
+
+.filter-btn.active {
+ background: rgba(99, 102, 241, 0.10);
+ border-color: rgba(99, 102, 241, 0.28);
+ color: var(--accent-indigo);
+}
+
+/* --- Inputs --- */
+.input {
+ width: 100%;
+ padding: 10px 14px;
+ background: var(--bg-deep);
+ border: 1px solid var(--border-subtle);
+ border-radius: var(--radius-sm);
+ color: var(--text-primary);
+ font-size: 14px;
+ font-family: var(--font-body);
+ outline: none;
+ transition: border-color 0.2s ease, box-shadow 0.2s ease;
+}
+
+.input:focus {
+ border-color: var(--accent-indigo);
+ box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08);
+}
+
+.input::placeholder {
+ color: var(--text-tertiary);
+}
+
+/* --- Loading --- */
+.loading-spinner {
+ width: 22px;
+ height: 22px;
+ border: 2px solid var(--border-subtle);
+ border-top-color: var(--accent-indigo);
+ border-radius: 50%;
+ animation: spin 0.75s linear infinite;
+}
+
+/* --- Recharts Overrides --- */
+.recharts-cartesian-grid-horizontal line,
+.recharts-cartesian-grid-vertical line {
+ stroke: rgba(255, 255, 255, 0.035) !important;
+}
+
+.recharts-text {
+ fill: var(--text-tertiary) !important;
+ font-family: var(--font-mono) !important;
+ font-size: 10px !important;
+}
+
+.recharts-tooltip-wrapper {
+ outline: none !important;
+}
+
+/* --- Utility --- */
+.metric-value {
+ font-family: var(--font-mono);
+ font-variant-numeric: tabular-nums;
+ letter-spacing: -0.03em;
+}
+
+.section-title {
+ font-family: var(--font-display);
+ font-size: 11px;
+ font-weight: 600;
+ color: var(--text-tertiary);
+ text-transform: uppercase;
+ letter-spacing: 0.1em;
+ margin-bottom: 16px;
+}
+
+.page-title {
+ font-size: 26px;
+ font-weight: 700;
+ font-family: var(--font-display);
+ letter-spacing: -0.03em;
+ color: var(--text-primary);
+ margin-bottom: 4px;
+}
+
+.page-subtitle {
+ font-size: 13px;
+ color: var(--text-tertiary);
+ margin-bottom: 0;
+}
+
+/* --- Responsive --- */
+@media (max-width: 1100px) {
+ .grid-stats { grid-template-columns: repeat(2, 1fr) !important; }
+ .grid-charts-main { grid-template-columns: 1fr !important; }
+ .grid-charts-secondary { grid-template-columns: 1fr !important; }
+}
diff --git a/web/src/vite-env.d.ts b/web/src/vite-env.d.ts
new file mode 100644
index 00000000..11f02fe2
--- /dev/null
+++ b/web/src/vite-env.d.ts
@@ -0,0 +1 @@
+/// <reference types="vite/client" />
diff --git a/web/tsconfig.json b/web/tsconfig.json
new file mode 100644
index 00000000..39a405b9
--- /dev/null
+++ b/web/tsconfig.json
@@ -0,0 +1,21 @@
+{
+ "compilerOptions": {
+ "target": "ES2020",
+ "useDefineForClassFields": true,
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
+ "module": "ESNext",
+ "skipLibCheck": true,
+ "moduleResolution": "bundler",
+ "allowImportingTsExtensions": true,
+ "isolatedModules": true,
+ "moduleDetection": "force",
+ "noEmit": true,
+ "jsx": "react-jsx",
+ "strict": true,
+ "noUnusedLocals": true,
+ "noUnusedParameters": true,
+ "noFallthroughCasesInSwitch": true,
+ "noUncheckedSideEffectImports": true
+ },
+ "include": ["src"]
+}
diff --git a/web/tsconfig.tsbuildinfo b/web/tsconfig.tsbuildinfo
new file mode 100644
index 00000000..967e053a
--- /dev/null
+++ b/web/tsconfig.tsbuildinfo
@@ -0,0 +1 @@
+{"root":["./src/app.tsx","./src/main.tsx","./src/vite-env.d.ts","./src/api/client.ts","./src/components/layout.tsx","./src/components/protectedroute.tsx","./src/data/mockdata.ts","./src/hooks/useauth.tsx","./src/pages/apikeys.tsx","./src/pages/dashboard.tsx","./src/pages/login.tsx","./src/pages/sessions.tsx","./src/pages/settings.tsx"],"version":"5.6.3"}
\ No newline at end of file
diff --git a/web/vite.config.ts b/web/vite.config.ts
new file mode 100644
index 00000000..d4850990
--- /dev/null
+++ b/web/vite.config.ts
@@ -0,0 +1,14 @@
+import { defineConfig } from 'vite'
+import react from '@vitejs/plugin-react'
+
+export default defineConfig({
+ plugins: [react()],
+ base: '/',
+ server: {
+ port: 3000,
+ proxy: {
+ '/auth': 'http://localhost:8080',
+ '/api': 'http://localhost:8080',
+ },
+ },
+})