# WorkPilot web dashboard Next.js 16 (App Router, TypeScript strict), Tailwind CSS 4, shadcn/ui (Radix), light/dark themes, English and Urdu (Nastaliq, right-to-left). | Screen | What it does | |---|---| | `/inbox` | Agent Inbox: pending approvals with wait time, a structured before → after diff, exact arguments with a provenance badge per value, live facts from the system of record, policy rule, required role and step-up; approve, edit (form from the tool's argument schema; the tool is fixed), reject, respond; bulk approve with per-item exclusion; undo countdown for queued sends (`send_after`, Phase 7) | | `/runs`, `/runs/[id]` | Runs list and a live run timeline over SSE (trigger, plan, every gateway decision, outcome) | | `/chat` | Natural-language requests; results render as generative components (order table, risk card, status card) picked from `actions[].tool` / `data` | | `/orders`, `/cod` | Orders and COD views against the e-commerce pack (`/packs/ecommerce/*`); an empty state until it is installed | | `/analytics` | Auto-resolution rate, approval rate and latency, gateway decisions, denial reasons, cost | | `/settings` | Policy thresholds and approval rules (owner), kill switches, team and roles | ## Run ```bash # API (repo root): see the main README quick start, then python -m core.serve # http://127.0.0.1:8000, CORS allows :3000 by default cd web npm install npm run dev # http://localhost:3000 ``` `NEXT_PUBLIC_API_URL` (browser → API, default `http://127.0.0.1:8000`) and `WP_API_URL` (Next.js server → API for the session routes, defaults to the same) configure the API address. Set `WP_CORS_ORIGINS` on the API to the web origin in other environments. ## Auth tokens - **Access token** (15 min): memory only (`src/lib/session.ts`), sent as `Authorization: Bearer`. - **Refresh token** (14 days): an `httpOnly`, `SameSite=Strict` cookie scoped to `/api/session`, set by a small Next.js route handler (`src/app/api/session/[action]/route.ts`) that proxies login, signup, refresh, logout and tenant switch. Browser JavaScript never reads it; a reload silently exchanges it for a new access token. Session calls also require an `X-Requested-With` header (CSRF). - **Step-up token** (5 min, from `POST /auth/stepup` with a TOTP code): memory only, sent as `X-Stepup-Token` on approvals that need it. Trade-off: an XSS can still *use* the session while the tab is open, but cannot steal the long-lived token; and the app needs a Node runtime for the session routes (no static export). ## Checks ```bash npm run lint && npm run typecheck && npm test && npm run build npm run e2e # Playwright: boots tests/e2e/server.py (real API, fresh embedded Postgres, # demo pack, scripted LLM) and a production build on :3100 ``` On Windows the e2e config uses `../.venv/Scripts/python.exe`; set `WP_PYTHON` to override.