Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ __pycache__/

#temp
plan-*
ui

# Distribution / packaging
.Python
Expand Down
75 changes: 75 additions & 0 deletions ui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Agent Workspace UI

A stark, high-contrast monochrome terminal-style frontend for configuring and testing the AI pipeline generation agent.

## Features

- **High-Contrast Monochrome Design**: Stark developer-terminal theme with zero rounded corners, monospaced typography, and red/green accenting reserved strictly for execution outcomes.
- **In-Memory Session Caching**: Chat history and active model configurations are saved inside the browser's `sessionStorage` (retains logs on page refresh but clears automatically when you close the tab or start a new session).
- **Collapsible thinking process**: Streamed thinking tokens (`[THINKING PROCESS]`) automatically collapse when finished to keep the logs readable.
- **Dynamic Tool Execution Cards**: Shows a real-time status spinner, turning green on success (`[OK]`) and collapsing, or red on failure (`[FAILED]`) while showing output details.
- **Inline Human-In-The-Loop (HITL) Handling**: Allows you to approve/deny bash commands and file writes, or answer clarifying questions directly inside the chat feed.
- **Local Credentials & Model Catalog**: Saves provider API keys locally, dynamically loads tool-calling models from `models.dev`, and supports adding custom OpenAI-compatible models.

---

## How to Start the System

There are two ways to start the servers: using the single-command helper (recommended) or launching each server manually.

### Option 1: Single-Command Launch (Recommended)

The helper script `ui/run_demo.py` launches both the FastAPI backend and the static UI server in the background, handles clean shutdowns, and verifies backend health before launching your browser.

From the repository root:

```bash
python ui/run_demo.py
```

If the browser does not open automatically, or if you prefer to open it yourself, use:

```bash
python ui/run_demo.py --no-open
```

You can customize port bindings:

```bash
python ui/run_demo.py --backend-port 8000 --ui-port 5173
```

---

### Option 2: Manual Start

If you prefer to run the backend and frontend in separate terminals:

1. **Start the FastAPI Backend**:
From the repository root, add `src` to your python path and run `uvicorn`:
```bash
# Windows (PowerShell)
$env:PYTHONPATH="src"
python -m uvicorn agent.api.api:app --host 127.0.0.1 --port 8000

# Linux/macOS
PYTHONPATH=src python -m uvicorn agent.api.api:app --host 127.0.0.1 --port 8000
```

2. **Start the UI Static Server**:
From the `ui/` directory, host the static HTML files using python's built-in server:
```bash
python -m http.server 5173 --bind 127.0.0.1 --directory ui
```

Once both servers are running, navigate to:
[http://127.0.0.1:5173/?backend=http://127.0.0.1:8000](http://127.0.0.1:5173/?backend=http://127.0.0.1:8000)

---

## Active API Endpoints consumed by UI

- `POST /generate/stream` — Starts the execution graph for pipeline generation.
- `POST /generate/{thread_id}/resume/permission` — Resumes a paused execution after human approval or denial of tool execution.
- `POST /generate/{thread_id}/resume/clarification` — Resumes execution by submitting user answers to clarifying questions.
- `POST /generate/runs/{run_id}/cancel` — Interrupts and terminates an active pipeline generation run.
Loading
Loading