docs(readme): redesenha o README com hero em SVG [skip ci]
This commit is contained in:
1 parent
8ce05620e0
commit
13b464b4d6
5 files changed
+403
-647
No files matched your search
+94
-172
@@ -1,214 +1,136 @@
|
||||
<p align="center">
|
||||
<img src="./src/assets/images/logo/PiAgentUiBlack%20%283%29.png" alt="Logo de PiAgentUI" width="760" />
|
||||
</p>
|
||||
<div align="center">
|
||||
|
||||
# PiAgentUI
|
||||
<img src="assets/readme/hero.svg" width="100%" alt="PiAgentUI: workspace de escritorio y web para sesiones reales de Pi Agent, con chat, tarjetas de tool calls y el panel Files, Changes, MCP y Skills">
|
||||
|
||||
[English (US)](./README.md) | [Português (BR)](./README.pt-BR.md) | **Español** | [日本語](./README.ja.md)
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
> Esta traducción puede quedar por detrás de la versión de referencia, que es el [README principal](./README.md). Repositorio: https://github.com/evandrodevbr/PiAgentUI
|
||||
[Issues](https://git.evandro.dev.br/evandro/PiAgentUI/issues) · [Changelog](CHANGELOG.md) · [Specs de diseño](docs/superpowers/specs/)
|
||||
|
||||
PiAgentUI es una interfaz moderna web y de escritorio para **Pi Agent**. No es solo una capa visual de chat: el objetivo es convertirse en una aplicación completa de agentes, en la misma categoría de producto que Codex, Claude Desktop y otros entornos de desarrollo agent-first.
|
||||
[English](README.md) · [Português (BR)](README.pt-BR.md) · **Español** · [日本語](README.ja.md)
|
||||
|
||||
PiAgentUI trata el runtime real de Pi como la fuente de verdad. Sesiones, metadatos de modelos, uso de contexto, tool calls, skills, configuración MCP y slash commands vienen de Pi siempre que sea posible, en lugar de recrearse como estado falso de interfaz.
|
||||
</div>
|
||||
|
||||
> **Estado del proyecto:** desarrollo local activo. Algunas áreas ya son cercanas a producto, mientras otras siguen cambiando rápidamente.
|
||||

|
||||
|
||||
## Demostración del software
|
||||
## Qué es
|
||||
|
||||
Estas capturas muestran la experiencia actual de PiAgentUI: un workspace oscuro y enfocado para agentes, con sesiones reales de Pi, selección de modelos, metadatos MCP, settings, chat con herramientas y paneles laterales.
|
||||
PiAgentUI es una interfaz de chat y un workspace para el [agente de código Pi](https://www.npmjs.com/package/@mariozechner/pi-coding-agent). Funciona como app web servida por una extensión de Pi o como app de escritorio con Tauri 2, y muestra en una ventana lo que una terminal sola esconde: la lista de sesiones, las tool calls, los servidores MCP, las skills y el uso de contexto.
|
||||
|
||||

|
||||
- Transmite sesiones reales de Pi por SSE (`/global/event`) y renderiza Markdown, código (Shiki) y matemáticas (KaTeX).
|
||||
- Muestra las tool calls como tarjetas y el uso de contexto de la sesión activa.
|
||||
- Cambia de modelo con las capacidades que informa el runtime.
|
||||
- Lista los servidores MCP configurados (transporte, comando, URL, origen) y las skills efectivas agrupadas por origen.
|
||||
- Expone slash commands integrados y dinámicos, además de controles de Git en el composer.
|
||||
- Integra una terminal (xterm.js) y un explorador de archivos junto al chat.
|
||||
- Acepta entrada de voz mediante un endpoint STT compatible con OpenAI configurado en settings.
|
||||
- Idiomas de la interfaz: `en`, `pt-BR`, `es`, `zh-CN`, `hi`, `bn`, `ar` (`src/locales/`).
|
||||
|
||||

|
||||
## Por qué usarlo
|
||||
|
||||

|
||||
PiAgentUI no guarda estado propio del agente. Sesiones, modelos, tools, skills y comandos vienen del runtime de Pi a través de la extensión, así que lo que ves es lo que Pi está ejecutando.
|
||||
|
||||
## Qué hace PiAgentUI hoy
|
||||
No lo uses si no ejecutas Pi: sin la extensión, la interfaz solo muestra el diálogo de conexión al servidor. También atiende un runtime por ventana y no tiene demo alojada ni paquete publicado en npm.
|
||||
|
||||
- **Chat con streaming** — salida en vivo por SSE, reconciliación estable de mensajes, markdown, resaltado de código, partes de razonamiento y tarjetas de herramientas.
|
||||
- **Sesiones reales de Pi** — lista de sesiones, enrutamiento a la sesión activa, historial seguro tras reinicio, títulos derivados y envío a la sesión seleccionada.
|
||||
- **Salida de herramientas en tarjetas** — tool calls/results quedan anexados a los mensajes del asistente, sin filtrarse como texto normal en el chat.
|
||||
- **Uso real de contexto** — el uso de contexto viene del runtime de Pi cuando está disponible; el contexto desconocido/compactado se muestra de forma segura en lugar de `NaN`.
|
||||
- **Metadatos de modelos** — la identidad de provider/modelo viene de Pi; el catálogo local de OpenRouter se usa solo como enriquecimiento de detalles.
|
||||
- **Panel de Skills** — las skills reales se leen del prompt efectivo de Pi y se agrupan por origen: global, project, package y other.
|
||||
- **Panel MCP** — lee servidores MCP configurados en archivos locales/globales y muestra transporte, comando, URL, lifecycle, direct tools y origen.
|
||||
- **Slash commands de Pi** — `/api/commands/list` expone comandos built-in de Pi y comandos dinámicos de extensiones, prompts y skills.
|
||||
- **Adjuntos multimodales** — soporte visual para archivos/imágenes/PDF/audio/video según las capacidades del modelo seleccionado.
|
||||
- **Terminal y archivos** — terminal integrado, explorador de archivos, syntax highlighting, componentes de diff e integración de escritorio con Tauri.
|
||||
- **UI keyboard-first** — command palette, atajos configurables, split panes, selector de modelo, navegación por proyecto/sesión y layouts responsivos.
|
||||
## Cómo funciona
|
||||
|
||||
## Dirección del producto
|
||||
- `extensions/piagentui-server.ts` es la extensión de Pi. Sirve la UI compilada desde `dist/` con `http` + `ws` de Node e inyecta `window.PI_BOOT_DATA` (URL base y token).
|
||||
- Al arrancar escucha en el puerto `58785` (o el siguiente libre) y escribe el puerto y un token aleatorio en `~/.pi/agent/piagentui-port.json`.
|
||||
- `GET /global/health` es abierto; las demás rutas `/api/*` exigen `Authorization: Bearer <token>`. El socket escucha en `0.0.0.0`, pero cada petición se valida contra loopback salvo que el acceso por LAN en `/api/network/access` esté activado (viene desactivado).
|
||||
- La app Tauri lee el mismo archivo de descubrimiento con el comando `get_pi_agent_connection`, así que el build de escritorio se conecta al runtime local sin configuración manual.
|
||||
- En contenedores, el router en Rust (`src-router/`, axum) va detrás de Caddy como gateway delante de los servicios de frontend y backend.
|
||||
|
||||
PiAgentUI está evolucionando hacia una aplicación completa de agentes:
|
||||
## Inicio rápido
|
||||
|
||||
1. **Acciones visuales para todos los comandos de Pi** — los slash commands siguen disponibles, pero las acciones frecuentes deben convertirse en botones, menús, diálogos o paneles.
|
||||
2. **Entrada por voz y transcripción en tiempo real** — grabación de micrófono, deltas parciales, inserción de la transcripción final en el composer y configuración de proveedores STT OpenAI-compatible.
|
||||
3. **Integración MCP más profunda** — más allá de metadatos: conectar, autenticar, inspeccionar herramientas y ejecutar workflows MCP desde la UI.
|
||||
4. **Control completo de sesiones** — fork, clone, navegación en árbol, import/export/share, branch summaries y gestión de contexto como flujos nativos.
|
||||
5. **Experiencia de escritorio completa** — app Tauri pulida con descubrimiento local de runtime, settings seguros, notificaciones y controles ricos de workspace.
|
||||
|
||||
## Roadmap de audio y transcripción
|
||||
|
||||
PiAgentUI ya acepta adjuntos de audio cuando el modelo seleccionado declara soporte de entrada de audio. El sistema de voz planeado añade speech-to-text en vivo directamente en el composer.
|
||||
|
||||
Arquitectura recomendada:
|
||||
|
||||
- **Proveedor realtime por defecto:** OpenAI Realtime Transcription con `gpt-realtime-whisper` para transcripción parcial de baja latencia.
|
||||
- **Fallback por archivo:** OpenAI Audio Transcriptions con `gpt-4o-transcribe`, `gpt-4o-mini-transcribe` o `whisper-1`.
|
||||
- **Proveedores personalizados:** APIs STT OpenAI-compatible configurables por el usuario, como proveedores que implementan `POST /v1/audio/transcriptions`.
|
||||
|
||||
UX planeada:
|
||||
|
||||
- botón de micrófono en el composer;
|
||||
- estados de grabación y permisos;
|
||||
- overlay de transcripción parcial;
|
||||
- texto final insertado en el input;
|
||||
- comportamiento configurable de append/replace;
|
||||
- auto-send desactivado por defecto;
|
||||
- manejo recuperable de errores de permisos, red y proveedor.
|
||||
|
||||
Ejemplo de configuración de proveedor:
|
||||
|
||||
```json
|
||||
{
|
||||
"kind": "openai-compatible",
|
||||
"mode": "file",
|
||||
"baseUrl": "https://api.example.com/v1",
|
||||
"transcriptionEndpoint": "/audio/transcriptions",
|
||||
"transcriptionModel": "openai/whisper-large-v3",
|
||||
"language": "es"
|
||||
}
|
||||
```
|
||||
|
||||
El soporte realtime se trata como una capability separada, porque la compatibilidad HTTP con OpenAI no garantiza compatibilidad WebSocket.
|
||||
|
||||
## Arquitectura
|
||||
|
||||
```text
|
||||
PiAgentUI
|
||||
├─ Frontend React/Vite
|
||||
│ ├─ chat, renderizado de mensajes, input, paneles y settings
|
||||
│ ├─ stores locales para preferencias de UI
|
||||
│ └─ clientes SSE/API para endpoints locales de PiAgentUI
|
||||
├─ Backend como extensión Pi
|
||||
│ └─ extensions/piagentui-server.ts
|
||||
│ ├─ expone endpoints locales /api/*
|
||||
│ ├─ conecta con runtime/sesiones/modelos de Pi
|
||||
│ ├─ transmite eventos de Pi al navegador
|
||||
│ └─ lee metadatos locales como MCP config y skills
|
||||
└─ Runtime Pi Agent
|
||||
├─ sesiones
|
||||
├─ modelos/providers
|
||||
├─ herramientas
|
||||
├─ skills
|
||||
├─ MCP
|
||||
└─ slash commands
|
||||
```
|
||||
|
||||
La UI no debe inventar estado de runtime cuando Pi ya conoce la respuesta. PiAgentUI puede cachear y enriquecer datos para UX, pero Pi sigue siendo autoritativo para el comportamiento del agente.
|
||||
|
||||
## Stack técnico
|
||||
|
||||
| Área | Stack |
|
||||
| ------------------- | --------------------------------------------- |
|
||||
| UI | React 19, TypeScript |
|
||||
| Build | Vite 8 |
|
||||
| Estilo | Tailwind CSS v4 y design tokens del proyecto |
|
||||
| Escritorio | Tauri 2 |
|
||||
| Markdown | Streamdown / pipeline de markdown |
|
||||
| Syntax highlighting | Shiki |
|
||||
| Terminal | xterm.js |
|
||||
| Tests | Vitest, Testing Library |
|
||||
| Backend local | Extensión Pi, Node HTTP server, WebSocket/SSE |
|
||||
|
||||
## Desarrollo local
|
||||
|
||||
Instalar dependencias:
|
||||
| Herramienta | Versión | Necesaria para |
|
||||
|---|---|---|
|
||||
| Node.js | `>=22` (`.tool-versions`: 22.22.0) | todo |
|
||||
| npm | la que trae Node | todo (`package-lock.json`) |
|
||||
| Rust | `1.85.0` (`.tool-versions`) | app de escritorio y router del gateway |
|
||||
| Docker Compose | reciente | solo el stack de contenedores |
|
||||
| Pi Agent | instalado localmente | sesiones y modelos reales |
|
||||
|
||||
```bash
|
||||
npm install
|
||||
git clone https://git.evandro.dev.br/evandro/PiAgentUI.git
|
||||
cd PiAgentUI
|
||||
npm ci # el postinstall ejecuta scripts/copy-material-icons.mjs
|
||||
npm run build # tsc -b && vite build -> dist/
|
||||
npm run dev # servidor Vite en http://localhost:5173
|
||||
```
|
||||
|
||||
Iniciar el frontend en modo dev:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
Build:
|
||||
`npm run dev` es solo el front end: hace proxy de `/api` a `127.0.0.1:4096` sin el prefijo. Para el flujo con Pi, compila primero y deja que la extensión sirva `dist/` (Pi carga este repositorio como paquete mediante el campo `pi.extensions` de `package.json`):
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
cat ~/.pi/agent/piagentui-port.json # {"port": 58785, "token": "..."}
|
||||
# abre http://127.0.0.1:58785
|
||||
```
|
||||
|
||||
Tests:
|
||||
Escritorio y Android:
|
||||
|
||||
```bash
|
||||
npm run test:run
|
||||
npm run tauri dev # ventana de escritorio sobre el servidor Vite
|
||||
npm run tauri build # bundles: nsis, dmg, deb (src-tauri/tauri.conf.json)
|
||||
npm run tauri android dev # ver scripts/dev-android.sh
|
||||
```
|
||||
|
||||
Type checks:
|
||||
Antes de un PR, `npm run validate` ejecuta typecheck, typecheck de la extensión, lint, build y tests; es el gate que corre el CI en `build.yml`.
|
||||
|
||||
```bash
|
||||
npm run typecheck
|
||||
npm run typecheck:extensions
|
||||
```
|
||||
## Configuración
|
||||
|
||||
Validación completa:
|
||||
El stack de contenedores viene heredado del despliegue de OpenCodeUI. Copia `.env.example` a `.env` primero.
|
||||
|
||||
```bash
|
||||
npm run validate
|
||||
```
|
||||
| Archivo | Comando | Qué hace |
|
||||
|---|---|---|
|
||||
| `docker-compose.yml` | `docker compose up -d` | Stack completo: `gateway` (Caddy + router en Rust, `127.0.0.1:6658` y `6659`), `frontend`, `backend` (`opencode serve`, 4096, límite de 4G de memoria). |
|
||||
| `docker-compose.standalone.yml` | `docker compose -f docker-compose.standalone.yml up -d` | Solo el front end, para un `opencode serve` existente. Usa `BACKEND_URL` (por defecto `host.docker.internal:4096`) y `PORT` (por defecto `3000`). |
|
||||
| `docker-compose.host.yml` | `docker compose -f docker-compose.yml -f docker-compose.host.yml up -d` | Override opcional: el `backend` corre privilegiado, con el socket de Docker y el `/` del host montado en `/host`. |
|
||||
| `docker-compose.build.yml` | `docker compose -f docker-compose.yml -f docker-compose.build.yml up -d --build` | Override opcional: compila gateway, frontend y backend localmente desde `docker/`. |
|
||||
|
||||
## Runtime de la extensión Pi
|
||||
<details>
|
||||
<summary>Variables de entorno (solo para el stack de contenedores)</summary>
|
||||
|
||||
PiAgentUI se registra como extensión Pi en `package.json`:
|
||||
| Variable | Obligatoria | Descripción |
|
||||
|---|---|---|
|
||||
| `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GEMINI_API_KEY`, `DEEPSEEK_API_KEY`, `GROQ_API_KEY`, `MISTRAL_API_KEY`, `XAI_API_KEY` | Al menos una | Claves de proveedores de LLM que se pasan al contenedor del backend. |
|
||||
| `GATEWAY_PORT` | No (`6658`) | Puerto del host para el punto de entrada unificado. |
|
||||
| `PREVIEW_PORT` | No (`6659`) | Puerto del host para el punto de entrada de previews. |
|
||||
| `PREVIEW_DOMAIN` | No | Dominio aparte para previews; el proxy inverso lo reenvía a `PREVIEW_PORT`. |
|
||||
| `WORKSPACE` | No (`./workspace`) | Carpeta del host montada en `/workspace` en el backend. |
|
||||
| `OPENCODE_SERVER_PASSWORD` | En despliegues públicos | Contraseña del backend y del router. |
|
||||
| `OPENCODE_SERVER_USERNAME` | No (`opencode`) | Usuario que acompaña a la contraseña anterior. |
|
||||
| `PUBLIC_BASE_URL` | No | URL base pública que usa el router integrado en el gateway. |
|
||||
| `ROUTER_SCAN_INTERVAL` | No (`5`) | Intervalo de escaneo del router. |
|
||||
| `ROUTER_TOKEN_LENGTH` | No (`12`) | Longitud de los tokens de ruta generados. |
|
||||
| `ROUTER_PORT_RANGE` | No (`3000-9999`) | Rango de puertos que atiende el router. |
|
||||
| `ROUTER_EXCLUDE_PORTS` | No (`4096`) | Puertos que el router omite. |
|
||||
| `DOCKER_API_VERSION` | No (`1.40`) | Versión de la API de Docker para el backend; se define en `docker-compose.yml`, no en `.env.example`. |
|
||||
| `USE_CHINA_MIRROR` | No (`1`) | Opción de build de la imagen del backend: usa los mirrors de abajo. |
|
||||
| `APT_MIRROR`, `APT_SECURITY_MIRROR`, `NPM_CONFIG_REGISTRY`, `NODEJS_ORG_MIRROR`, `PIP_INDEX_URL`, `PIP_TRUSTED_HOST` | No | Mirrors para el toolchain del backend. |
|
||||
| `MISE_INSTALL_URL`, `OPENCODE_INSTALL_URL` | No | URLs de instalación usadas al compilar la imagen del backend. |
|
||||
|
||||
```json
|
||||
{
|
||||
"pi": {
|
||||
"extensions": ["./extensions/piagentui-server.ts"]
|
||||
}
|
||||
}
|
||||
```
|
||||
</details>
|
||||
|
||||
Cuando la extensión arranca, escribe metadatos de descubrimiento local en:
|
||||
## Estado del proyecto
|
||||
|
||||
```text
|
||||
~/.pi/agent/piagentui-port.json
|
||||
```
|
||||
Beta, antes de la 1.0 (`0.6.10`), mantenido por un desarrollador. Las releases salen de `release.yml` en tags `v*` (artefactos para Windows, macOS, Linux y Android); `deploy.yml` publica el build web con `VITE_BASE_PATH=/PiAgentUI/`.
|
||||
|
||||
La app web usa el puerto/token de ese archivo para hablar con el servidor local de la extensión. Algunos cambios de backend requieren reiniciar o recargar el proceso de la extensión Pi antes de verse en el navegador.
|
||||
- El nombre OpenCodeUI no ha desaparecido del todo: el crate del router en Rust es `opencodeui-router`, las imágenes son `opencodeui-*`, los APK de Android salen como `OpenCodeUI-*`, los comentarios de `.env.example` están en chino y el backend Docker ejecuta `opencode serve`, que pertenece al despliegue heredado, no al flujo con la extensión de Pi.
|
||||
- `docker-compose.yml` y `docker-compose.standalone.yml` todavía descargan la imagen upstream `ghcr.io/lehhair/opencodeui-frontend`.
|
||||
- Los tests son de componente y de servidor (Vitest). No hay tests del shell Tauri ni del router en Rust más allá de la compilación, ni test end-to-end en navegador, ni umbral de cobertura.
|
||||
- La entrada de voz necesita un endpoint STT compatible con OpenAI y no tiene test automatizado en navegador.
|
||||
|
||||
## Endpoints locales importantes
|
||||
|
||||
| Endpoint | Propósito |
|
||||
| -------------------------------- | ---------------------------------------------------------- |
|
||||
| `GET /api/models` | Lista real de modelos Pi con capacidades normalizadas |
|
||||
| `GET /api/sessions` | Lista de sesiones leída desde los archivos de sesión de Pi |
|
||||
| `GET /api/sessions/:id/messages` | Historial normalizado para renderizado en la UI |
|
||||
| `GET /api/sessions/:id/context` | Uso de contexto runtime para la sesión activa |
|
||||
| `POST /api/messages/send` | Envía un mensaje a la sesión Pi solicitada |
|
||||
| `GET /api/skills` | Skills efectivas de Pi agrupadas por origen |
|
||||
| `GET /api/mcp/status` | Metadatos de servidores MCP configurados |
|
||||
| `GET /api/commands/list` | Slash commands built-in y dinámicos de Pi |
|
||||
| `GET /global/event` | Stream SSE de eventos del backend PiAgentUI |
|
||||
|
||||
## Principios de desarrollo
|
||||
|
||||
- Preferir datos reales del runtime Pi en vez de estado falso solo de UI.
|
||||
- Mantener OpenRouter como enriquecimiento de catálogo, nunca como sustituto de la identidad provider/modelo de Pi.
|
||||
- Tratar valores runtime desconocidos explícitamente.
|
||||
- Escribir tests antes de cambios de comportamiento siempre que sea posible.
|
||||
- Mantener tool results dentro de tarjetas de herramienta.
|
||||
- Seguir el sistema visual existente: tema, movimiento, espaciado y patrones de paneles.
|
||||
- Separar claramente lo implementado del roadmap.
|
||||
|
||||
## Notas del repositorio
|
||||
|
||||
El proyecto todavía contiene nombres heredados de la base original OpenCodeUI en algunos puntos, incluyendo metadatos del paquete y documentación antigua. La dirección actual es PiAgentUI-first, y una limpieza futura debe migrar esos nombres sin romper los workflows locales.
|
||||
Issues y pull requests van al [issue tracker](https://git.evandro.dev.br/evandro/PiAgentUI/issues); ejecuta `npm run validate` antes de abrir un PR.
|
||||
|
||||
## Licencia
|
||||
|
||||
Este repositorio sigue la licencia declarada en `package.json`: `GPL-3.0-only`.
|
||||
GPL-3.0-only, ver [`LICENSE`](LICENSE). PiAgentUI es un fork reelaborado de OpenCodeUI; el autor original figura en `src-tauri/Cargo.toml`.
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<sub>Hecho por <a href="https://evandro.dev.br">Evandro Fonseca Junior</a> · <a href="https://git.evandro.dev.br/evandro">git.evandro.dev.br</a></sub>
|
||||
</div>
|
||||
+94
-172
@@ -1,214 +1,136 @@
|
||||
<p align="center">
|
||||
<img src="./src/assets/images/logo/PiAgentUiBlack%20%283%29.png" alt="PiAgentUI ロゴ" width="760" />
|
||||
</p>
|
||||
<div align="center">
|
||||
|
||||
# PiAgentUI
|
||||
<img src="assets/readme/hero.svg" width="100%" alt="PiAgentUI: 実際の Pi Agent セッションを扱うデスクトップ/Web ワークスペース。チャット、tool call カード、Files・Changes・MCP・Skills パネル">
|
||||
|
||||
[English (US)](./README.md) | [Português (BR)](./README.pt-BR.md) | [Español](./README.es.md) | **日本語**
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
> この翻訳は基準となる [メイン README](./README.md) より古い可能性があります。リポジトリ: https://github.com/evandrodevbr/PiAgentUI
|
||||
[Issues](https://git.evandro.dev.br/evandro/PiAgentUI/issues) · [Changelog](CHANGELOG.md) · [設計 spec](docs/superpowers/specs/)
|
||||
|
||||
PiAgentUI は **Pi Agent** のためのモダンな Web / デスクトップ UI です。単なるチャット画面ではありません。最終的には Codex や Claude Desktop のような、エージェント中心の本格的な開発アプリになることを目指しています。
|
||||
[English](README.md) · [Português (BR)](README.pt-BR.md) · [Español](README.es.md) · **日本語**
|
||||
|
||||
PiAgentUI は、実際の Pi runtime を信頼できる唯一の情報源として扱います。セッション、モデルメタデータ、コンテキスト使用量、tool call、skills、MCP 設定、slash command は、可能な限り Pi から取得し、UI 側だけの仮の状態として再実装しません。
|
||||
</div>
|
||||
|
||||
> **プロジェクト状態:** アクティブなローカル開発中です。一部は製品に近い品質ですが、まだ高速に変化している領域もあります。
|
||||

|
||||
|
||||
## ソフトウェアプレビュー
|
||||
## 概要
|
||||
|
||||
以下のスクリーンショットは、現在の PiAgentUI の体験を示しています。実際の Pi セッション、モデル選択、MCP メタデータ、settings、ツール対応チャット、サイドパネルを備えた、暗色で集中しやすいエージェント workspace です。
|
||||
PiAgentUI は [Pi coding agent](https://www.npmjs.com/package/@mariozechner/pi-coding-agent) 用のチャット UI 兼 workspace です。Pi 拡張機能が配信する Web アプリとして、または Tauri 2 のデスクトップアプリとして動き、素のターミナルでは見えないもの(セッション一覧、tool call、MCP サーバー、skills、コンテキスト使用量)を 1 つのウィンドウにまとめます。
|
||||
|
||||

|
||||
- 実際の Pi セッションを SSE(`/global/event`)でストリーミングし、Markdown、コード(Shiki)、数式(KaTeX)を描画します。
|
||||
- tool call をカードで表示し、アクティブなセッションのコンテキスト使用量を表示します。
|
||||
- ランタイムが返す capability を使ってモデルを切り替えます。
|
||||
- 設定済みの MCP サーバー(transport、command、URL、source)と、source ごとにまとめた有効な skills を一覧表示します。
|
||||
- 組み込みと動的な slash command、composer の Git 操作を提供します。
|
||||
- チャットの横にターミナル(xterm.js)とファイルエクスプローラーを組み込んでいます。
|
||||
- settings で指定した OpenAI 互換の STT エンドポイント経由で音声入力を受け付けます。
|
||||
- UI の言語: `en`, `pt-BR`, `es`, `zh-CN`, `hi`, `bn`, `ar`(`src/locales/`)。日本語の UI はまだありません。
|
||||
|
||||

|
||||
## 使う理由
|
||||
|
||||

|
||||
PiAgentUI はエージェントの状態を独自に持ちません。セッション、モデル、tools、skills、コマンドは拡張機能を通じて Pi ランタイムから取得するので、画面に出るものは Pi が実際に動かしているものです。
|
||||
|
||||
## 現在できること
|
||||
Pi を使っていないなら向きません。拡張機能がないと、UI はサーバー接続ダイアログしか表示しません。また 1 ウィンドウにつき 1 ランタイムで、ホストされたデモや npm 公開パッケージもありません。
|
||||
|
||||
- **ストリーミング対応チャット** — SSE によるライブ出力、安定したメッセージ同期、Markdown、コードハイライト、reasoning part、ツールカード。
|
||||
- **実際の Pi セッション** — セッション一覧、アクティブセッションへのルーティング、再起動後も安全な履歴読み込み、セッションタイトル生成、選択中セッションへの送信。
|
||||
- **ツール出力のカード表示** — tool calls/results は通常のチャット本文として漏れず、アシスタントメッセージに紐づいたカードとして表示されます。
|
||||
- **実 runtime のコンテキスト使用量** — 利用可能な場合は Pi runtime から取得し、不明または compacted な値は `NaN` ではなく安全に表示します。
|
||||
- **モデルメタデータ** — provider/model の実体は Pi が authoritative であり、ローカル OpenRouter カタログは context、output、modality、pricing、tokenizer などの補助情報としてのみ使います。
|
||||
- **Skills パネル** — 有効な Pi prompt から実際の skills を読み取り、global / project / package / other に分類します。
|
||||
- **MCP パネル** — ローカル/グローバル設定ファイルから MCP サーバーを読み取り、transport、command、URL、lifecycle、direct tools、source を表示します。
|
||||
- **Pi slash commands** — `/api/commands/list` が Pi の built-in commands と、extension / prompt / skill 由来の動的コマンドを公開します。
|
||||
- **マルチモーダル添付** — 選択中モデルの能力に応じて、ファイル、画像、PDF、音声、動画の添付 UI を表示します。
|
||||
- **ターミナルとファイル操作** — 統合ターミナル、ファイルエクスプローラー、syntax highlighting、diff 関連コンポーネント、Tauri デスクトップ連携。
|
||||
- **キーボード中心の UI** — command palette、カスタム keybindings、split panes、モデルセレクター、プロジェクト/セッションナビゲーション、レスポンシブレイアウト。
|
||||
## 仕組み
|
||||
|
||||
## プロダクトの方向性
|
||||
- `extensions/piagentui-server.ts` が Pi 拡張機能です。Node の `http` + `ws` で `dist/` のビルド済み UI を配信し、`window.PI_BOOT_DATA`(ベース URL とトークン)を注入します。
|
||||
- 起動時にポート `58785`(使用中なら次の空きポート)で待ち受け、ポートとランダムなトークンを `~/.pi/agent/piagentui-port.json` に書き込みます。
|
||||
- `GET /global/health` は認証なしで、ほかの `/api/*` ルートは `Authorization: Bearer <token>` が必要です。ソケットは `0.0.0.0` にバインドしますが、`/api/network/access` の LAN アクセスが有効(デフォルトは無効)でない限り、各リクエストは loopback かどうか検査されます。
|
||||
- Tauri アプリは `get_pi_agent_connection` コマンドで同じ discovery ファイルを読むため、デスクトップ版は手動設定なしでローカルのランタイムに接続します。
|
||||
- コンテナでは、Rust の router(`src-router/`、axum)が Caddy の背後で gateway として frontend と backend の前に立ちます。
|
||||
|
||||
PiAgentUI は、完全なエージェントアプリへ進化しています。
|
||||
## クイックスタート
|
||||
|
||||
1. **すべての Pi コマンドに視覚的な操作を提供** — slash commands は残しつつ、よく使う操作はボタン、メニュー、ダイアログ、パネルにします。
|
||||
2. **音声入力とリアルタイム文字起こし** — マイク録音、部分 transcript delta、最終 transcript の composer 挿入、OpenAI-compatible STT provider 設定。
|
||||
3. **より深い MCP 統合** — メタデータ表示だけでなく、接続、認証、ツール確認、MCP workflow 実行を UI から行えるようにします。
|
||||
4. **完全なセッション制御** — fork、clone、tree navigation、import/export/share、branch summary、context management をネイティブ UI として提供します。
|
||||
5. **デスクトップグレードの体験** — Tauri アプリとして、ローカル runtime discovery、安全な settings、通知、より豊かな workspace control を提供します。
|
||||
|
||||
## 音声と文字起こしのロードマップ
|
||||
|
||||
PiAgentUI は、選択中モデルが audio input をサポートしている場合、すでに音声ファイル添付を扱えます。計画中の voice system では、composer にリアルタイム speech-to-text を追加します。
|
||||
|
||||
推奨アーキテクチャ:
|
||||
|
||||
- **デフォルト realtime provider:** 低レイテンシの部分 transcript 用に OpenAI Realtime Transcription と `gpt-realtime-whisper` を使用。
|
||||
- **ファイル fallback:** OpenAI Audio Transcriptions の `gpt-4o-transcribe`、`gpt-4o-mini-transcribe`、または `whisper-1` を使用。
|
||||
- **カスタム provider:** `POST /v1/audio/transcriptions` を実装する OpenAI-compatible STT API をユーザーが設定可能。
|
||||
|
||||
計画中の UX:
|
||||
|
||||
- composer のマイクボタン;
|
||||
- 録音状態と権限状態;
|
||||
- 部分 transcript overlay;
|
||||
- 最終 transcript を input に挿入;
|
||||
- append / replace 動作の設定;
|
||||
- auto-send はデフォルト無効;
|
||||
- 権限、ネットワーク、provider エラーを復旧可能な形で表示。
|
||||
|
||||
provider 設定例:
|
||||
|
||||
```json
|
||||
{
|
||||
"kind": "openai-compatible",
|
||||
"mode": "file",
|
||||
"baseUrl": "https://api.example.com/v1",
|
||||
"transcriptionEndpoint": "/audio/transcriptions",
|
||||
"transcriptionModel": "openai/whisper-large-v3",
|
||||
"language": "ja"
|
||||
}
|
||||
```
|
||||
|
||||
OpenAI-compatible な HTTP transcription は WebSocket 互換性を保証しないため、realtime support は別 capability として扱います。
|
||||
|
||||
## アーキテクチャ
|
||||
|
||||
```text
|
||||
PiAgentUI
|
||||
├─ React/Vite frontend
|
||||
│ ├─ chat, message rendering, input, panels, settings
|
||||
│ ├─ UI preferences 用の local stores
|
||||
│ └─ PiAgentUI local endpoints 用の SSE/API clients
|
||||
├─ Pi extension backend
|
||||
│ └─ extensions/piagentui-server.ts
|
||||
│ ├─ local /api/* endpoints を公開
|
||||
│ ├─ Pi runtime/session/model APIs への bridge
|
||||
│ ├─ Pi events を browser に stream
|
||||
│ └─ MCP config や skills などの local metadata を読み取り
|
||||
└─ Pi Agent runtime
|
||||
├─ sessions
|
||||
├─ models/providers
|
||||
├─ tools
|
||||
├─ skills
|
||||
├─ MCP
|
||||
└─ slash commands
|
||||
```
|
||||
|
||||
Pi がすでに知っている runtime state を UI が勝手に作るべきではありません。PiAgentUI は UX のために cache や enrichment を行えますが、agent behavior については Pi が authoritative です。
|
||||
|
||||
## 技術スタック
|
||||
|
||||
| 領域 | Stack |
|
||||
| ------------------- | --------------------------------------------- |
|
||||
| UI | React 19, TypeScript |
|
||||
| Build | Vite 8 |
|
||||
| Styling | Tailwind CSS v4 と project design tokens |
|
||||
| Desktop | Tauri 2 |
|
||||
| Markdown | Streamdown / markdown rendering pipeline |
|
||||
| Syntax highlighting | Shiki |
|
||||
| Terminal | xterm.js |
|
||||
| Tests | Vitest, Testing Library |
|
||||
| Local backend | Pi extension, Node HTTP server, WebSocket/SSE |
|
||||
|
||||
## ローカル開発
|
||||
|
||||
依存関係をインストール:
|
||||
| ツール | バージョン | 用途 |
|
||||
|---|---|---|
|
||||
| Node.js | `>=22`(`.tool-versions`: 22.22.0) | すべて |
|
||||
| npm | Node に同梱のもの | すべて(`package-lock.json`) |
|
||||
| Rust | `1.85.0`(`.tool-versions`) | デスクトップアプリと gateway の router |
|
||||
| Docker Compose | 最近のもの | コンテナ構成のみ |
|
||||
| Pi Agent | ローカルにインストール済み | 実際のセッションとモデル |
|
||||
|
||||
```bash
|
||||
npm install
|
||||
git clone https://git.evandro.dev.br/evandro/PiAgentUI.git
|
||||
cd PiAgentUI
|
||||
npm ci # postinstall で scripts/copy-material-icons.mjs が動きます
|
||||
npm run build # tsc -b && vite build -> dist/
|
||||
npm run dev # Vite 開発サーバー http://localhost:5173
|
||||
```
|
||||
|
||||
frontend dev server を起動:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
ビルド:
|
||||
`npm run dev` はフロントエンドのみで、`/api` をプレフィックスを外して `127.0.0.1:4096` にプロキシします。Pi で使う場合は先にビルドし、拡張機能に `dist/` を配信させます(Pi は `package.json` の `pi.extensions` フィールドでこのリポジトリをパッケージとして読み込みます)。
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
cat ~/.pi/agent/piagentui-port.json # {"port": 58785, "token": "..."}
|
||||
# http://127.0.0.1:58785 を開く
|
||||
```
|
||||
|
||||
テスト:
|
||||
デスクトップと Android:
|
||||
|
||||
```bash
|
||||
npm run test:run
|
||||
npm run tauri dev # Vite 開発サーバー上のデスクトップウィンドウ
|
||||
npm run tauri build # bundles: nsis, dmg, deb (src-tauri/tauri.conf.json)
|
||||
npm run tauri android dev # scripts/dev-android.sh を参照
|
||||
```
|
||||
|
||||
型チェック:
|
||||
PR の前に `npm run validate` を実行してください。typecheck、拡張機能の typecheck、lint、build、テストを順に実行し、CI の `build.yml` もこれを使います。
|
||||
|
||||
```bash
|
||||
npm run typecheck
|
||||
npm run typecheck:extensions
|
||||
```
|
||||
## 設定
|
||||
|
||||
完全な検証:
|
||||
コンテナ構成は OpenCodeUI のデプロイから引き継いだものです。最初に `.env.example` を `.env` にコピーしてください。
|
||||
|
||||
```bash
|
||||
npm run validate
|
||||
```
|
||||
| ファイル | コマンド | 内容 |
|
||||
|---|---|---|
|
||||
| `docker-compose.yml` | `docker compose up -d` | フル構成: `gateway`(Caddy + Rust router、`127.0.0.1:6658` と `6659`)、`frontend`、`backend`(`opencode serve`、4096、メモリ上限 4G)。 |
|
||||
| `docker-compose.standalone.yml` | `docker compose -f docker-compose.standalone.yml up -d` | 既存の `opencode serve` 向けのフロントエンドのみ。`BACKEND_URL`(デフォルト `host.docker.internal:4096`)と `PORT`(デフォルト `3000`)を使います。 |
|
||||
| `docker-compose.host.yml` | `docker compose -f docker-compose.yml -f docker-compose.host.yml up -d` | 任意の override: `backend` を privileged で動かし、Docker ソケットとホストの `/` を `/host` にマウントします。 |
|
||||
| `docker-compose.build.yml` | `docker compose -f docker-compose.yml -f docker-compose.build.yml up -d --build` | 任意の override: `docker/` から gateway、frontend、backend をローカルでビルドします。 |
|
||||
|
||||
## Pi extension runtime
|
||||
<details>
|
||||
<summary>環境変数(コンテナ構成のみ)</summary>
|
||||
|
||||
PiAgentUI は `package.json` で Pi extension として登録されています。
|
||||
| 変数 | 必須 | 説明 |
|
||||
|---|---|---|
|
||||
| `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GEMINI_API_KEY`, `DEEPSEEK_API_KEY`, `GROQ_API_KEY`, `MISTRAL_API_KEY`, `XAI_API_KEY` | 最低 1 つ | backend コンテナに渡す LLM プロバイダーのキー。 |
|
||||
| `GATEWAY_PORT` | いいえ(`6658`) | 統合エントリーポイントのホスト側ポート。 |
|
||||
| `PREVIEW_PORT` | いいえ(`6659`) | プレビュー用エントリーポイントのホスト側ポート。 |
|
||||
| `PREVIEW_DOMAIN` | いいえ | プレビュー用の別ドメイン。リバースプロキシが `PREVIEW_PORT` に転送します。 |
|
||||
| `WORKSPACE` | いいえ(`./workspace`) | backend の `/workspace` にマウントするホストのディレクトリ。 |
|
||||
| `OPENCODE_SERVER_PASSWORD` | 公開デプロイ時 | backend と router のパスワード。 |
|
||||
| `OPENCODE_SERVER_USERNAME` | いいえ(`opencode`) | 上記パスワードと組になるユーザー名。 |
|
||||
| `PUBLIC_BASE_URL` | いいえ | gateway 内蔵の router が使う公開ベース URL。 |
|
||||
| `ROUTER_SCAN_INTERVAL` | いいえ(`5`) | router のスキャン間隔。 |
|
||||
| `ROUTER_TOKEN_LENGTH` | いいえ(`12`) | 生成するルートトークンの長さ。 |
|
||||
| `ROUTER_PORT_RANGE` | いいえ(`3000-9999`) | router が扱うポート範囲。 |
|
||||
| `ROUTER_EXCLUDE_PORTS` | いいえ(`4096`) | router が除外するポート。 |
|
||||
| `DOCKER_API_VERSION` | いいえ(`1.40`) | backend が使う Docker API のバージョン。`.env.example` ではなく `docker-compose.yml` で設定されています。 |
|
||||
| `USE_CHINA_MIRROR` | いいえ(`1`) | backend イメージのビルドオプション。下のミラーを使います。 |
|
||||
| `APT_MIRROR`, `APT_SECURITY_MIRROR`, `NPM_CONFIG_REGISTRY`, `NODEJS_ORG_MIRROR`, `PIP_INDEX_URL`, `PIP_TRUSTED_HOST` | いいえ | backend のツールチェーン用ミラー。 |
|
||||
| `MISE_INSTALL_URL`, `OPENCODE_INSTALL_URL` | いいえ | backend イメージのビルドで使うインストーラーの URL。 |
|
||||
|
||||
```json
|
||||
{
|
||||
"pi": {
|
||||
"extensions": ["./extensions/piagentui-server.ts"]
|
||||
}
|
||||
}
|
||||
```
|
||||
</details>
|
||||
|
||||
extension 起動時、ローカル discovery metadata が以下に書き込まれます。
|
||||
## プロジェクトの状態
|
||||
|
||||
```text
|
||||
~/.pi/agent/piagentui-port.json
|
||||
```
|
||||
1.0 前のベータ版(`0.6.10`)で、開発者 1 人がメンテナンスしています。リリースは `v*` タグで `release.yml` がビルドし(Windows、macOS、Linux、Android の成果物)、`deploy.yml` が `VITE_BASE_PATH=/PiAgentUI/` で Web 版を公開します。
|
||||
|
||||
Web アプリはこのファイルの port/token を使ってローカル extension server と通信します。一部の backend 変更は、ブラウザに反映される前に Pi extension process の再起動または reload が必要です。
|
||||
- OpenCodeUI の名前はまだ一部に残っています。Rust router の crate は `opencodeui-router`、イメージは `opencodeui-*`、Android の APK は `OpenCodeUI-*`、`.env.example` のコメントは中国語で、Docker の backend が動かす `opencode serve` は Pi 拡張機能のフローではなく引き継いだデプロイのものです。
|
||||
- `docker-compose.yml` と `docker-compose.standalone.yml` は、まだ upstream の `ghcr.io/lehhair/opencodeui-frontend` イメージを取得します。
|
||||
- テストはコンポーネントとサーバーのレベル(Vitest)です。Tauri シェルと Rust router はコンパイル以外のテストがなく、ブラウザの end-to-end テストもカバレッジの閾値もありません。
|
||||
- 音声入力には OpenAI 互換の STT エンドポイントが必要で、ブラウザでの自動テストはありません。
|
||||
|
||||
## 重要なローカル endpoints
|
||||
|
||||
| Endpoint | 目的 |
|
||||
| -------------------------------- | --------------------------------------------------- |
|
||||
| `GET /api/models` | Pi の実モデル一覧と正規化された capability metadata |
|
||||
| `GET /api/sessions` | Pi session files から読み取ったセッション一覧 |
|
||||
| `GET /api/sessions/:id/messages` | UI rendering 用に正規化されたセッション履歴 |
|
||||
| `GET /api/sessions/:id/context` | active session の runtime context usage |
|
||||
| `POST /api/messages/send` | 指定された Pi session にユーザーメッセージを送信 |
|
||||
| `GET /api/skills` | 有効な Pi skills を source ごとに分類 |
|
||||
| `GET /api/mcp/status` | 設定済み MCP servers の metadata |
|
||||
| `GET /api/commands/list` | Pi built-in / dynamic slash commands |
|
||||
| `GET /global/event` | PiAgentUI backend からの SSE event stream |
|
||||
|
||||
## 開発原則
|
||||
|
||||
- UI-only の仮状態よりも、Pi runtime の実データを優先する。
|
||||
- OpenRouter は catalog enrichment としてのみ使い、Pi の provider/model identity を置き換えない。
|
||||
- 不明な runtime 値は明示的に扱う。
|
||||
- 振る舞いを変える場合は、可能な限り先にテストを書く。
|
||||
- tool results は tool cards 内に保持する。
|
||||
- 既存の theme、motion、spacing、panel patterns に合わせる。
|
||||
- 実装済み機能と roadmap を明確に分ける。
|
||||
|
||||
## リポジトリノート
|
||||
|
||||
このプロジェクトには、元の OpenCodeUI ベースから継承した名前が一部残っています。package metadata や古い documentation などです。現在の方向性は PiAgentUI-first であり、将来的な cleanup ではローカル workflow を壊さずに残りの名称を移行する必要があります。
|
||||
Issue と pull request は [issue tracker](https://git.evandro.dev.br/evandro/PiAgentUI/issues) へ。PR の前に `npm run validate` を実行してください。
|
||||
|
||||
## ライセンス
|
||||
|
||||
このリポジトリは `package.json` に記載されているライセンス `GPL-3.0-only` に従います。
|
||||
GPL-3.0-only。[`LICENSE`](LICENSE) を参照してください。PiAgentUI は OpenCodeUI をフォークして作り直したもので、元の作者は `src-tauri/Cargo.toml` に記載されています。
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<sub>作成: <a href="https://evandro.dev.br">Evandro Fonseca Junior</a> · <a href="https://git.evandro.dev.br/evandro">git.evandro.dev.br</a></sub>
|
||||
</div>
|
||||
@@ -1,198 +1,136 @@
|
||||
<div align="center">
|
||||
|
||||
<img src="./assets/app-icons/app-icon.svg" width="96" alt="PiAgentUI logo" />
|
||||
<img src="assets/readme/hero.svg" width="100%" alt="PiAgentUI: a desktop and web workspace for live Pi Agent sessions, with chat, tool call cards and the Files, Changes, MCP and Skills panel">
|
||||
|
||||
<h1>PiAgentUI</h1>
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
<p><strong>Desktop and web workspace for AI coding agents: streams real Pi Agent sessions with chat, tool cards, MCP and skills panels.</strong></p>
|
||||
[Issues](https://git.evandro.dev.br/evandro/PiAgentUI/issues) · [Changelog](CHANGELOG.md) · [Design specs](docs/superpowers/specs/)
|
||||
|
||||
<a href="#-quickstart">Quickstart</a> ·
|
||||
<a href="#-architecture">Architecture</a> ·
|
||||
<a href="#-documentation">Docs</a> ·
|
||||
<a href="https://git.evandro.dev.br/evandro/PiAgentUI/issues">Issues</a>
|
||||
|
||||

|
||||

|
||||

|
||||
|
||||
**English (US)** | [Português (BR)](./README.pt-BR.md) | [Español](./README.es.md) | [日本語](./README.ja.md)
|
||||
**English** · [Português (BR)](README.pt-BR.md) · [Español](README.es.md) · [日本語](README.ja.md)
|
||||
|
||||
</div>
|
||||
|
||||
<hr />
|
||||

|
||||
|
||||
## 📌 The problem
|
||||
## What it is
|
||||
|
||||
Pi Agent runs in a terminal. A bare terminal gives you no overview of sessions, no readable tool calls, and no place to inspect MCP servers, skills or context usage. PiAgentUI puts those in one window, as a web app or a Tauri desktop app, without inventing agent state: sessions, models, tools, skills and commands come from the Pi runtime whenever possible.
|
||||
PiAgentUI is a chat UI and workspace for the [Pi coding agent](https://www.npmjs.com/package/@mariozechner/pi-coding-agent). It runs as a web app served by a Pi extension or as a Tauri 2 desktop app, and shows in one window what a bare terminal hides: the session list, tool calls, MCP servers, skills and context usage.
|
||||
|
||||
## ✨ What it does
|
||||
|
||||
- Streams real Pi Agent sessions into a chat view over SSE (`/global/event`), with Markdown, code highlighting (Shiki) and math (KaTeX).
|
||||
- Renders tool calls as cards and shows context usage for the active session.
|
||||
- Switches models, using the normalized capabilities returned by the runtime.
|
||||
- Streams real Pi sessions over SSE (`/global/event`) and renders Markdown, code (Shiki) and math (KaTeX).
|
||||
- Shows tool calls as cards and the context usage of the active session.
|
||||
- Switches models using the capabilities the runtime reports.
|
||||
- Lists configured MCP servers (transport, command, URL, source) and effective skills grouped by source.
|
||||
- Exposes built-in and dynamic slash commands, plus Git controls in the composer.
|
||||
- Embeds a terminal (xterm.js) and a file explorer next to the chat.
|
||||
- Accepts voice input through an OpenAI-compatible STT endpoint configured in settings.
|
||||
- Ships as a web build or a Tauri 2 app, with UI locales `en`, `pt-BR`, `es`, `ja`, `zh-CN`, `hi`, `bn` and `ar`.
|
||||
- Accepts voice input through an OpenAI-compatible STT endpoint set in settings.
|
||||
- UI locales: `en`, `pt-BR`, `es`, `zh-CN`, `hi`, `bn`, `ar` (`src/locales/`).
|
||||
|
||||
## 🚀 Quickstart
|
||||
## Why use it
|
||||
|
||||
| Tool | Minimum version | Needed for |
|
||||
PiAgentUI does not keep its own agent state. Sessions, models, tools, skills and commands come from the Pi runtime through the extension, so what you see is what Pi is running.
|
||||
|
||||
Do not use it if you do not run Pi: without the extension the UI only shows the server connection dialog. It also handles one runtime per window and has no hosted demo or published npm package.
|
||||
|
||||
## How it works
|
||||
|
||||
- `extensions/piagentui-server.ts` is the Pi extension. It serves the built UI from `dist/` over Node `http` + `ws` and injects `window.PI_BOOT_DATA` (base URL and token).
|
||||
- On start it listens on port `58785` (or the next free one) and writes the port and a random token to `~/.pi/agent/piagentui-port.json`.
|
||||
- `GET /global/health` is open; other `/api/*` routes require `Authorization: Bearer <token>`. The socket binds `0.0.0.0`, but each request is checked against loopback unless the LAN toggle at `/api/network/access` is on (off by default).
|
||||
- The Tauri app reads the same discovery file through `get_pi_agent_connection`, so the desktop build connects to the local runtime without manual setup.
|
||||
- In containers, the Rust router (`src-router/`, axum) sits behind Caddy as the gateway in front of the frontend and backend services.
|
||||
|
||||
## Quickstart
|
||||
|
||||
| Tool | Version | Needed for |
|
||||
|---|---|---|
|
||||
| Node.js | `>=22` (`.tool-versions`: 22.22.0) | everything |
|
||||
| npm | `>=10` | everything (`package-lock.json` is authoritative) |
|
||||
| Rust | `1.85.0` (`src-tauri/Cargo.toml`) | desktop app and gateway router only |
|
||||
| Docker | Docker Compose | container stack only |
|
||||
| npm | bundled with Node | everything (`package-lock.json`) |
|
||||
| Rust | `1.85.0` (`.tool-versions`) | desktop app and gateway router |
|
||||
| Docker Compose | any recent | container stack only |
|
||||
| Pi Agent | installed locally | real sessions and models |
|
||||
|
||||
Without Pi Agent the UI starts in standalone mode and only shows the server connection dialog.
|
||||
|
||||
```bash
|
||||
git clone https://git.evandro.dev.br/evandro/PiAgentUI.git
|
||||
cd PiAgentUI
|
||||
npm ci # postinstall runs scripts/copy-material-icons.mjs
|
||||
npm run build # tsc -b && vite build -> dist/
|
||||
npm run dev # Vite dev server on http://localhost:5173
|
||||
npm ci # postinstall runs scripts/copy-material-icons.mjs
|
||||
npm run build # tsc -b && vite build -> dist/
|
||||
npm run dev # Vite dev server on http://localhost:5173
|
||||
```
|
||||
|
||||
`npm run dev` is front-end only: it proxies `/api` to `127.0.0.1:4096` with the prefix stripped. For the Pi flow, build first and let the extension serve `dist/`:
|
||||
`npm run dev` is front end only: it proxies `/api` to `127.0.0.1:4096` with the prefix stripped. For the Pi flow, build first and let the extension serve `dist/` (Pi loads this repository as a package through the `pi.extensions` field of `package.json`):
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
cat ~/.pi/agent/piagentui-port.json # {"port": 58785, "token": "..."}
|
||||
# open http://127.0.0.1:58785 (Pi Agent running this repo as a Pi package, see package.json "pi")
|
||||
cat ~/.pi/agent/piagentui-port.json # {"port": 58785, "token": "..."}
|
||||
# open http://127.0.0.1:58785
|
||||
```
|
||||
|
||||
Desktop and Android:
|
||||
|
||||
```bash
|
||||
npm run tauri dev # desktop window on the Vite dev server
|
||||
npm run tauri build # bundles: nsis, dmg, deb (src-tauri/tauri.conf.json)
|
||||
npm run tauri android dev # see scripts/dev-android.sh
|
||||
npm run tauri dev # desktop window on the Vite dev server
|
||||
npm run tauri build # bundles: nsis, dmg, deb (src-tauri/tauri.conf.json)
|
||||
npm run tauri android dev # see scripts/dev-android.sh
|
||||
```
|
||||
|
||||
### Container stack
|
||||
Before a PR, `npm run validate` runs typecheck, extension typecheck, lint, build and tests; it is the gate CI runs in `build.yml`.
|
||||
|
||||
Copy `.env.example` to `.env` first. Four compose files exist:
|
||||
## Configuration
|
||||
|
||||
The container stack is inherited from the OpenCodeUI deployment. Copy `.env.example` to `.env` first.
|
||||
|
||||
| File | Command | What it does |
|
||||
|---|---|---|
|
||||
| `docker-compose.yml` | `docker compose up -d` | Full stack: `gateway` (Caddy + Rust router, `127.0.0.1:6658` and `6659`), `frontend` (Caddy, 3000) and `backend` (`opencode serve`, 4096, 4G memory limit). |
|
||||
| `docker-compose.yml` | `docker compose up -d` | Full stack: `gateway` (Caddy + Rust router, `127.0.0.1:6658` and `6659`), `frontend`, `backend` (`opencode serve`, 4096, 4G memory limit). |
|
||||
| `docker-compose.standalone.yml` | `docker compose -f docker-compose.standalone.yml up -d` | Front end only, for an existing `opencode serve`. Uses `BACKEND_URL` (default `host.docker.internal:4096`) and `PORT` (default `3000`). |
|
||||
| `docker-compose.host.yml` | `docker compose -f docker-compose.yml -f docker-compose.host.yml up -d` | Optional override: `backend` runs privileged with the Docker socket and the host `/` mounted at `/host`. Use only when really needed. |
|
||||
| `docker-compose.host.yml` | `docker compose -f docker-compose.yml -f docker-compose.host.yml up -d` | Optional override: `backend` runs privileged with the Docker socket and host `/` mounted at `/host`. |
|
||||
| `docker-compose.build.yml` | `docker compose -f docker-compose.yml -f docker-compose.build.yml up -d --build` | Optional override: builds gateway, frontend and backend locally from `docker/`. |
|
||||
|
||||
The `backend` and `gateway` images come from `ghcr.io/evandrodevbr/opencodeui-{backend,gateway}`. The `frontend` image still points at upstream `ghcr.io/lehhair/opencodeui-frontend`, because `docker-frontend.yml` has failed since 2026-06-01 and no `ghcr.io/evandrodevbr/opencodeui-frontend` was published.
|
||||
|
||||
### Environment variables
|
||||
|
||||
All variables come from `.env.example` and apply to the container stack only (the Pi extension flow needs none).
|
||||
<details>
|
||||
<summary>Environment variables (container stack only)</summary>
|
||||
|
||||
| Variable | Required | Description |
|
||||
|---|---|---|
|
||||
| `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GEMINI_API_KEY`, `DEEPSEEK_API_KEY`, `GROQ_API_KEY`, `MISTRAL_API_KEY`, `XAI_API_KEY` | At least one | LLM provider keys passed to the backend container. |
|
||||
| `GATEWAY_PORT` | No (`6658`) | Host port of the unified entry point. |
|
||||
| `PREVIEW_PORT` | No (`6659`) | Host port of the dedicated preview entry point. |
|
||||
| `PREVIEW_DOMAIN` | No | Separate domain for previews, to avoid front-end asset path problems; the reverse proxy forwards it to `PREVIEW_PORT`. |
|
||||
| `PREVIEW_PORT` | No (`6659`) | Host port of the preview entry point. |
|
||||
| `PREVIEW_DOMAIN` | No | Separate domain for previews; the reverse proxy forwards it to `PREVIEW_PORT`. |
|
||||
| `WORKSPACE` | No (`./workspace`) | Host directory mounted at `/workspace` in the backend. |
|
||||
| `OPENCODE_SERVER_PASSWORD` | Public deployments | Password for the backend and the router. Set it when exposing the stack. |
|
||||
| `OPENCODE_SERVER_PASSWORD` | Public deployments | Password for the backend and the router. |
|
||||
| `OPENCODE_SERVER_USERNAME` | No (`opencode`) | Username paired with the password above. |
|
||||
| `PUBLIC_BASE_URL` | No | Public base URL used by the router built into the gateway. |
|
||||
| `ROUTER_SCAN_INTERVAL` | No (`5`) | Router scan interval. |
|
||||
| `ROUTER_TOKEN_LENGTH` | No (`12`) | Length of the generated route tokens. |
|
||||
| `ROUTER_PORT_RANGE` | No (`3000-9999`) | Port range the router handles. |
|
||||
| `ROUTER_EXCLUDE_PORTS` | No (`4096`) | Ports the router skips. |
|
||||
| `DOCKER_API_VERSION` | No (`1.40`) | Docker API version for the backend; set in `docker-compose.yml`, not in `.env.example`. |
|
||||
| `USE_CHINA_MIRROR` | No (`1`) | Backend image build option: use the mirror sources below. |
|
||||
| `APT_MIRROR`, `APT_SECURITY_MIRROR` | No | Debian mirrors for the backend image build. |
|
||||
| `NPM_CONFIG_REGISTRY`, `NODEJS_ORG_MIRROR`, `PIP_INDEX_URL`, `PIP_TRUSTED_HOST` | No | npm, Node.js and pip sources for the backend toolchain. |
|
||||
| `APT_MIRROR`, `APT_SECURITY_MIRROR`, `NPM_CONFIG_REGISTRY`, `NODEJS_ORG_MIRROR`, `PIP_INDEX_URL`, `PIP_TRUSTED_HOST` | No | Mirrors for the backend toolchain. |
|
||||
| `MISE_INSTALL_URL`, `OPENCODE_INSTALL_URL` | No | Installer URLs used when building the backend image. |
|
||||
|
||||
## 🧱 Architecture
|
||||
</details>
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
UI["React UI in browser or Tauri webview"] -->|"HTTP api, SSE, WebSocket"| SRV["Pi extension server"]
|
||||
PI["Pi Agent runtime"] -->|"loads extension"| SRV
|
||||
SRV -->|"writes port and token"| DISC["~/.pi/agent/piagentui-port.json"]
|
||||
TAURI["Tauri shell"] -->|"get_pi_agent_connection"| DISC
|
||||
TAURI --> UI
|
||||
```
|
||||
## Project status
|
||||
|
||||
- The extension (`extensions/piagentui-server.ts`, Node `http` + `ws`) serves the built UI from `dist/` and injects `window.PI_BOOT_DATA {baseUrl, token}`.
|
||||
- On session start it listens on port `58785` (or the next free one) and publishes the port and a random token in the discovery file.
|
||||
- `GET /global/health` is open; other `/api/*` routes require `Authorization: Bearer <token>`. Access is loopback-only by default, with a LAN toggle at `/api/network/access`.
|
||||
- The extension bridges sessions, models, tools, MCP, skills and commands; the full route table lives in the server file.
|
||||
- The Tauri app reads the same discovery file, so the desktop build connects to the local runtime without manual setup.
|
||||
- In containers, the Rust router (`src-router`, axum) sits behind Caddy as the gateway in front of the frontend and backend services.
|
||||
Beta, pre-1.0 (`0.6.10`), maintained by one developer. Releases are built by `release.yml` on `v*` tags (Windows, macOS, Linux and Android artifacts); `deploy.yml` publishes the web build with `VITE_BASE_PATH=/PiAgentUI/`.
|
||||
|
||||
## 🗂️ Structure
|
||||
|
||||
```text
|
||||
extensions/ Pi extension: HTTP/WebSocket server, settings, git and extension managers (Vitest)
|
||||
src/ React 19 front end: api, components, features, hooks, locales, store
|
||||
src-router/ Rust gateway router (axum) behind Caddy
|
||||
src-tauri/ Tauri 2 desktop and mobile shell, Android project in gen/
|
||||
docker/ Dockerfiles, Caddyfiles, entrypoints
|
||||
scripts/ icon copy, version bump, release preparation, Android dev helper
|
||||
docs/ design specs and plans (docs/superpowers/)
|
||||
assets/ app icon sources
|
||||
.github/ 6 workflows: build, deploy, release, docker-backend/frontend/gateway
|
||||
```
|
||||
|
||||
## 🧪 Scripts
|
||||
|
||||
| Command | What it does |
|
||||
|---|---|
|
||||
| `npm run dev` | Vite dev server (front end only). |
|
||||
| `npm run build` | `tsc -b && vite build`, output in `dist/`. |
|
||||
| `npm run preview` | Serves `dist/` locally for a final check. |
|
||||
| `npm run typecheck` | `tsc -b` (app and extension projects). |
|
||||
| `npm run type-check` | Alias of `typecheck`. |
|
||||
| `npm run typecheck:extensions` | `tsc -p tsconfig.extension.json --noEmit`. |
|
||||
| `npm run lint` | `eslint .` |
|
||||
| `npm run format` | `prettier . --write` |
|
||||
| `npm run format:check` | `prettier . --check` |
|
||||
| `npm run test` | `vitest` in watch mode. |
|
||||
| `npm run test:run` | `vitest run` (needs `dist/`, so build first). |
|
||||
| `npm run validate` | typecheck, extension typecheck, lint, build, tests. The gate CI runs in `build.yml`. |
|
||||
| `npm run check` | format check, lint, build, tests. |
|
||||
| `npm run tauri` | Tauri CLI (`dev`, `build`, `android dev`). |
|
||||
| `npm run icons:tauri` | Regenerates `src-tauri/icons` from `src-tauri/app-icon.manifest.json`. |
|
||||
| `npm run release:prepare` | Runs `scripts/prepare-release.mjs`. |
|
||||
| `npm run postinstall` | Runs `scripts/copy-material-icons.mjs` (automatic after `npm ci`). |
|
||||
|
||||
Deploy notes: `dist/` is a plain SPA; under a subpath build with `VITE_BASE_PATH=/subpath/ npm run build`. `deploy.yml` publishes to GitHub Pages with `VITE_BASE_PATH=/PiAgentUI/` on pushes to `main`, and `release.yml` attaches Windows, macOS, Linux and Android artifacts on `v*` tags.
|
||||
|
||||
## 📚 Documentation
|
||||
|
||||
| Document | Content |
|
||||
|---|---|
|
||||
| [`docs/superpowers/specs/`](docs/superpowers/specs/) | Design specs: Pi extension migration, sessions, STT and Git controls. |
|
||||
| [`docs/superpowers/plans/`](docs/superpowers/plans/) | Implementation plans and the context, skills and MCP roadmap. |
|
||||
| [`CHANGELOG.md`](CHANGELOG.md) | Release history used by the release workflow. |
|
||||
| [`docker/`](docker/) | Dockerfiles, Caddy configs and entrypoints. |
|
||||
|
||||
## 🛣️ Limitations and next steps
|
||||
|
||||
- Active single-developer project, pre-1.0 (`0.6.10`); some areas are still moving.
|
||||
- OpenCodeUI naming is only partly cleaned: the Rust crate is `opencodeui-router`, images are `opencodeui-*`, `.env.example` comments are in Chinese, and the Docker backend runs `opencode serve`, which belongs to the inherited deployment, not the Pi extension flow.
|
||||
- `docker-frontend.yml` must be fixed before `ghcr.io/evandrodevbr/opencodeui-frontend` exists; compose files pull that image from upstream until then.
|
||||
- No tests for the Tauri shell or the Rust gateway beyond compilation; desktop and Android bundles are only built by the release workflow.
|
||||
- Tests are component- and server-level: no end-to-end browser test and no coverage threshold. `npm run format:check` reported unformatted files at the last audit, so `npm run check` can fail on that step while `npm run validate` passes.
|
||||
- `@mariozechner/pi-coding-agent` is a devDependency for types only, and npm marks that package line as deprecated in favour of `@earendil-works/pi-coding-agent`.
|
||||
- One runtime per window (discovery file or manually configured server); no multi-runtime aggregation.
|
||||
- OpenCodeUI naming is only partly cleaned: the Rust router crate is `opencodeui-router`, images are `opencodeui-*`, Android APKs are named `OpenCodeUI-*`, `.env.example` comments are in Chinese, and the Docker backend runs `opencode serve`, which belongs to the inherited deployment, not to the Pi extension flow.
|
||||
- `docker-compose.yml` and `docker-compose.standalone.yml` still pull the upstream `ghcr.io/lehhair/opencodeui-frontend` image.
|
||||
- Tests are component- and server-level (Vitest). There are no tests for the Tauri shell or the Rust router beyond compilation, no end-to-end browser test and no coverage threshold.
|
||||
- Voice input needs an OpenAI-compatible STT endpoint and has no automated browser test.
|
||||
- No published npm package and no hosted web demo.
|
||||
|
||||
## 🤝 Contributing
|
||||
Issues and pull requests go to the [issue tracker](https://git.evandro.dev.br/evandro/PiAgentUI/issues); run `npm run validate` before a PR.
|
||||
|
||||
Open an issue or a PR on the [issue tracker](https://git.evandro.dev.br/evandro/PiAgentUI/issues). Before a PR, this must pass:
|
||||
## License
|
||||
|
||||
```bash
|
||||
npm run validate
|
||||
```
|
||||
GPL-3.0-only, see [`LICENSE`](LICENSE). PiAgentUI is a fork and rework of OpenCodeUI; the original author is credited in `src-tauri/Cargo.toml`.
|
||||
|
||||
## 📄 License
|
||||
---
|
||||
|
||||
GPL-3.0-only, see [`LICENSE`](LICENSE). PiAgentUI is a fork and rework of OpenCodeUI; the original authors are credited in `src-tauri/Cargo.toml`.
|
||||
<div align="center">
|
||||
<sub>Made by <a href="https://evandro.dev.br">Evandro Fonseca Junior</a> · <a href="https://git.evandro.dev.br/evandro">git.evandro.dev.br</a></sub>
|
||||
</div>
|
||||
+97
-171
@@ -1,210 +1,136 @@
|
||||
<p align="center">
|
||||
<img src="./src/assets/images/logo/PiAgentUiBlack%20%283%29.png" alt="Logo do PiAgentUI" width="760" />
|
||||
</p>
|
||||
<div align="center">
|
||||
|
||||
# PiAgentUI
|
||||
<img src="assets/readme/hero.svg" width="100%" alt="PiAgentUI: workspace desktop e web para sessões reais do Pi Agent, com chat, cards de tool calls e o painel Files, Changes, MCP e Skills">
|
||||
|
||||
**Workspace desktop e web para agentes de código: sessões reais do Pi Agent, chat com streaming, painéis de MCP e skills, terminal, explorador de arquivos e app desktop em Tauri.**
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
[](https://github.com/evandrodevbr/PiAgentUI/actions/workflows/build.yml)
|
||||
[Issues](https://git.evandro.dev.br/evandro/PiAgentUI/issues) · [Changelog](CHANGELOG.md) · [Specs de design](docs/superpowers/specs/)
|
||||
|
||||
[English (US)](./README.md) | **Português (BR)** | [Español](./README.es.md) | [日本語](./README.ja.md)
|
||||
[English](README.md) · **Português (BR)** · [Español](README.es.md) · [日本語](README.ja.md)
|
||||
|
||||
## Sobre
|
||||
</div>
|
||||
|
||||
PiAgentUI é uma interface de chat e um workspace para o runtime do Pi Agent. No lugar de um terminal cru, ele reúne sessões, troca de modelo, tool calls em cards, metadados de servidores MCP, skills agrupadas por origem, slash commands, controles de Git, terminal e explorador de arquivos, como aplicação web ou como app desktop Tauri.
|
||||

|
||||
|
||||
O projeto é Pi-first: sessões, modelos, uso de contexto, tool calls, skills, configuração MCP e slash commands vêm do runtime do Pi sempre que possível. A UI cacheia e enriquece esses dados para apresentação, mas não inventa estado do agente. É um fork e uma reescrita da base OpenCodeUI, e parte dessa herança ainda aparece (veja [Estado atual e limitações](#estado-atual-e-limitações)).
|
||||
## O que é
|
||||
|
||||
PiAgentUI é uma interface de chat e um workspace para o [agente de código Pi](https://www.npmjs.com/package/@mariozechner/pi-coding-agent). Roda como app web servido por uma extensão do Pi ou como app desktop em Tauri 2, e mostra numa janela o que o terminal cru esconde: a lista de sessões, as tool calls, os servidores MCP, as skills e o uso de contexto.
|
||||
|
||||
- Faz streaming das sessões reais do Pi por SSE (`/global/event`) e renderiza Markdown, código (Shiki) e matemática (KaTeX).
|
||||
- Mostra tool calls como cards e o uso de contexto da sessão ativa.
|
||||
- Troca de modelo usando as capacidades que o runtime informa.
|
||||
- Lista os servidores MCP configurados (transporte, comando, URL, origem) e as skills efetivas agrupadas por origem.
|
||||
- Expõe slash commands nativos e dinâmicos, além de controles de Git no composer.
|
||||
- Embute um terminal (xterm.js) e um explorador de arquivos ao lado do chat.
|
||||
- Aceita entrada de voz por um endpoint de STT compatível com OpenAI configurado nas settings.
|
||||
- Idiomas da interface: `en`, `pt-BR`, `es`, `zh-CN`, `hi`, `bn`, `ar` (`src/locales/`).
|
||||
|
||||
## Por que usar
|
||||
|
||||
O PiAgentUI não guarda estado próprio do agente. Sessões, modelos, tools, skills e comandos vêm do runtime do Pi pela extensão, então o que aparece na tela é o que o Pi está rodando.
|
||||
|
||||
Não use se você não roda o Pi: sem a extensão, a interface mostra só o diálogo de conexão com o servidor. Ele também atende um runtime por janela e não tem demo hospedada nem pacote publicado no npm.
|
||||
|
||||
## Como funciona
|
||||
|
||||
```text
|
||||
janela do navegador / webview Tauri
|
||||
|
|
||||
| HTTP /api/* + SSE /global/event + WebSocket
|
||||
v
|
||||
Servidor da extensão Pi (extensions/piagentui-server.ts, Node http + ws)
|
||||
|-- serve o build da UI a partir de dist/ e injeta window.PI_BOOT_DATA {baseUrl, token}
|
||||
|-- grava os dados de conexão em ~/.pi/agent/piagentui-port.json {port, token}
|
||||
|-- exige bearer token em /api/* e restringe o acesso ao loopback por padrão
|
||||
|-- faz a ponte para sessões, modelos, ferramentas, MCP, skills e comandos
|
||||
^
|
||||
| carregado pelo runtime
|
||||
Processo do Pi Agent
|
||||
```
|
||||
|
||||
- Ao iniciar uma sessão, a extensão escuta na porta `58785` (ou na próxima livre) e publica a porta escolhida e um token aleatório no arquivo de descoberta.
|
||||
- `GET /global/health` é aberto; todas as outras rotas `/api/*` exigem `Authorization: Bearer <token>`.
|
||||
- O app Tauri lê o mesmo arquivo de descoberta pelo comando Rust `get_pi_agent_connection`, então o build desktop se conecta ao runtime local sem configuração manual.
|
||||
- `npm run dev` (Vite) serve apenas o front end em desenvolvimento; ele faz proxy de `/api` para `127.0.0.1:4096` removendo o prefixo `/api`. Aponte para um servidor compatível ou use o build servido pela extensão para o fluxo Pi.
|
||||
|
||||
## Stack
|
||||
|
||||
| Área | Escolha |
|
||||
|---|---|
|
||||
| UI | React 19, TypeScript 5.9 |
|
||||
| Build | Vite 8 (rolldown), com `tsc -b` como gate de tipos |
|
||||
| Estilo | Tailwind CSS 4 e design tokens do projeto |
|
||||
| Desktop e mobile | Tauri 2 (Rust 1.85+), alvos Android gerados em `src-tauri/gen` |
|
||||
| Markdown e código | Streamdown, Shiki, KaTeX |
|
||||
| Terminal | xterm.js |
|
||||
| i18n | i18next, locales `en`, `pt-BR`, `es`, `ja`, `zh-CN`, `hi`, `bn`, `ar` |
|
||||
| Testes | Vitest 4, Testing Library, jsdom |
|
||||
| Backend local | Extensão Pi: servidor HTTP Node com `ws` (SSE e WebSocket) |
|
||||
| Gateway (containers) | Roteador Rust (`src-router`, axum) na frente do Caddy |
|
||||
| Pacotes | npm com `package-lock.json` |
|
||||
|
||||
## Requisitos
|
||||
|
||||
- Node.js `>=22` (o CI roda Node 22; verificado localmente em Node 24.20.0)
|
||||
- npm `>=10` (o repositório é npm; `package-lock.json` é a referência)
|
||||
- Rust `1.85+` apenas para buildar o app desktop ou o gateway
|
||||
- Docker apenas para a stack de containers em `docker/`
|
||||
- Pi Agent instalado para ter sessões e modelos reais; sem ele a UI sobe em modo standalone e mostra apenas o diálogo de conexão com servidores
|
||||
- `extensions/piagentui-server.ts` é a extensão do Pi. Ela serve a UI compilada de `dist/` com `http` + `ws` do Node e injeta `window.PI_BOOT_DATA` (URL base e token).
|
||||
- Ao iniciar, escuta na porta `58785` (ou na próxima livre) e grava a porta e um token aleatório em `~/.pi/agent/piagentui-port.json`.
|
||||
- `GET /global/health` é aberto; as outras rotas `/api/*` exigem `Authorization: Bearer <token>`. O socket escuta em `0.0.0.0`, mas cada requisição é checada contra loopback, a menos que o acesso pela LAN em `/api/network/access` esteja ligado (vem desligado).
|
||||
- O app Tauri lê o mesmo arquivo de descoberta pelo comando `get_pi_agent_connection`, então o build desktop conecta no runtime local sem configuração manual.
|
||||
- Em containers, o router em Rust (`src-router/`, axum) fica atrás do Caddy como gateway na frente dos serviços de frontend e backend.
|
||||
|
||||
## Início rápido
|
||||
|
||||
| Ferramenta | Versão | Usada para |
|
||||
|---|---|---|
|
||||
| Node.js | `>=22` (`.tool-versions`: 22.22.0) | tudo |
|
||||
| npm | a que vem com o Node | tudo (`package-lock.json`) |
|
||||
| Rust | `1.85.0` (`.tool-versions`) | app desktop e router do gateway |
|
||||
| Docker Compose | recente | só a stack em containers |
|
||||
| Pi Agent | instalado localmente | sessões e modelos reais |
|
||||
|
||||
```bash
|
||||
git clone https://github.com/evandrodevbr/PiAgentUI.git
|
||||
git clone https://git.evandro.dev.br/evandro/PiAgentUI.git
|
||||
cd PiAgentUI
|
||||
npm ci # 615 pacotes; roda scripts/copy-material-icons.mjs
|
||||
npm run build # tsc -b && vite build -> dist/
|
||||
npm run dev # servidor de desenvolvimento Vite em http://localhost:5173
|
||||
npm ci # o postinstall roda scripts/copy-material-icons.mjs
|
||||
npm run build # tsc -b && vite build -> dist/
|
||||
npm run dev # servidor Vite em http://localhost:5173
|
||||
```
|
||||
|
||||
UI web servida pela extensão Pi (é o caminho que conversa com o runtime Pi de verdade):
|
||||
`npm run dev` é só o front end: ele faz proxy de `/api` para `127.0.0.1:4096` sem o prefixo. Para o fluxo com o Pi, compile antes e deixe a extensão servir `dist/` (o Pi carrega este repositório como pacote pelo campo `pi.extensions` do `package.json`):
|
||||
|
||||
```bash
|
||||
npm run build # a extensão serve o dist/
|
||||
# com o Pi Agent carregando este repositório como pacote Pi (veja "pi" em package.json)
|
||||
cat ~/.pi/agent/piagentui-port.json # {"port": 58785, "token": "..."}
|
||||
npm run build
|
||||
cat ~/.pi/agent/piagentui-port.json # {"port": 58785, "token": "..."}
|
||||
# abra http://127.0.0.1:58785
|
||||
```
|
||||
|
||||
App desktop:
|
||||
Desktop e Android:
|
||||
|
||||
```bash
|
||||
npm run tauri dev # janela de desenvolvimento, usa o servidor Vite
|
||||
npm run tauri build # empacota conforme src-tauri/tauri.conf.json (deb no Linux, dmg, nsis)
|
||||
npm run tauri dev # janela desktop sobre o servidor Vite
|
||||
npm run tauri build # bundles: nsis, dmg, deb (src-tauri/tauri.conf.json)
|
||||
npm run tauri android dev # veja scripts/dev-android.sh
|
||||
```
|
||||
|
||||
Android (veja `scripts/dev-android.sh` e o job de Android no workflow de release):
|
||||
Antes de um PR, `npm run validate` roda typecheck, typecheck da extensão, lint, build e testes; é o gate que o CI roda em `build.yml`.
|
||||
|
||||
```bash
|
||||
npm run tauri android dev
|
||||
```
|
||||
## Configuração
|
||||
|
||||
## Uso
|
||||
A stack em containers foi herdada do deploy do OpenCodeUI. Copie `.env.example` para `.env` antes.
|
||||
|
||||
Rotas locais expostas pelo servidor da extensão. Todas, exceto `/global/health` e a rota SSE, exigem o bearer token do arquivo de descoberta.
|
||||
| Arquivo | Comando | O que faz |
|
||||
|---|---|---|
|
||||
| `docker-compose.yml` | `docker compose up -d` | Stack completa: `gateway` (Caddy + router em Rust, `127.0.0.1:6658` e `6659`), `frontend`, `backend` (`opencode serve`, 4096, limite de 4G de memória). |
|
||||
| `docker-compose.standalone.yml` | `docker compose -f docker-compose.standalone.yml up -d` | Só o front end, para um `opencode serve` já existente. Usa `BACKEND_URL` (padrão `host.docker.internal:4096`) e `PORT` (padrão `3000`). |
|
||||
| `docker-compose.host.yml` | `docker compose -f docker-compose.yml -f docker-compose.host.yml up -d` | Override opcional: o `backend` roda privilegiado, com o socket do Docker e o `/` do host montado em `/host`. |
|
||||
| `docker-compose.build.yml` | `docker compose -f docker-compose.yml -f docker-compose.build.yml up -d --build` | Override opcional: compila gateway, frontend e backend localmente a partir de `docker/`. |
|
||||
|
||||
| Rota | Para que serve |
|
||||
|---|---|
|
||||
| `GET /global/health` | Prova de vida, responde `{"status":"ok","pi":"ready"}` |
|
||||
| `GET /global/event` | Stream SSE de eventos (sessões, partes de mensagem, status) |
|
||||
| `GET /api/models` | Lista de modelos com capacidades normalizadas |
|
||||
| `GET /api/sessions` | Lista de sessões |
|
||||
| `POST /api/sessions` | Cria sessão |
|
||||
| `POST /api/sessions/abort` | Aborta o turno em execução |
|
||||
| `GET /api/sessions/:id/messages` | Histórico da sessão normalizado para renderização |
|
||||
| `GET /api/sessions/:id/context` | Uso de contexto da sessão ativa |
|
||||
| `POST /api/messages/send` | Envia mensagem do usuário para uma sessão |
|
||||
| `GET /api/skills` | Skills efetivas agrupadas por origem |
|
||||
| `GET /api/mcp/status` | Servidores MCP configurados (transporte, comando, URL, origem) |
|
||||
| `GET /api/commands/list` | Slash commands built-in e dinâmicos |
|
||||
| `GET /api/agents`, `GET /api/files/list`, `GET /api/permissions/list`, `GET /api/questions/list` | Inventário do runtime para os painéis |
|
||||
| `GET /api/vcs/status`, `/info`, `/branches` | Estado do Git usado pelos controles do composer |
|
||||
| `GET /api/extensions/list` | Catálogo de extensões do painel de extensões |
|
||||
| `GET /api/settings/stt`, `/api/settings/tts` | Configurações de voz (STT/TTS) |
|
||||
| `GET /api/network/access`, `POST /api/network/access` | Chave de acesso em LAN (padrão: só loopback) |
|
||||
<details>
|
||||
<summary>Variáveis de ambiente (só para a stack em containers)</summary>
|
||||
|
||||
A tabela completa de rotas, incluindo as mutações de Git e de extensões, está em [`extensions/piagentui-server.ts`](extensions/piagentui-server.ts). Portas e caminhos podem mudar; o arquivo de descoberta é a fonte de verdade para porta e token.
|
||||
| Variável | Obrigatória | Descrição |
|
||||
|---|---|---|
|
||||
| `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GEMINI_API_KEY`, `DEEPSEEK_API_KEY`, `GROQ_API_KEY`, `MISTRAL_API_KEY`, `XAI_API_KEY` | Ao menos uma | Chaves de provedores de LLM repassadas ao container do backend. |
|
||||
| `GATEWAY_PORT` | Não (`6658`) | Porta do host para o ponto de entrada unificado. |
|
||||
| `PREVIEW_PORT` | Não (`6659`) | Porta do host para o ponto de entrada de previews. |
|
||||
| `PREVIEW_DOMAIN` | Não | Domínio separado para previews; o proxy reverso encaminha para `PREVIEW_PORT`. |
|
||||
| `WORKSPACE` | Não (`./workspace`) | Pasta do host montada em `/workspace` no backend. |
|
||||
| `OPENCODE_SERVER_PASSWORD` | Em deploys públicos | Senha do backend e do router. |
|
||||
| `OPENCODE_SERVER_USERNAME` | Não (`opencode`) | Usuário que acompanha a senha acima. |
|
||||
| `PUBLIC_BASE_URL` | Não | URL base pública usada pelo router embutido no gateway. |
|
||||
| `ROUTER_SCAN_INTERVAL` | Não (`5`) | Intervalo de varredura do router. |
|
||||
| `ROUTER_TOKEN_LENGTH` | Não (`12`) | Tamanho dos tokens de rota gerados. |
|
||||
| `ROUTER_PORT_RANGE` | Não (`3000-9999`) | Faixa de portas que o router atende. |
|
||||
| `ROUTER_EXCLUDE_PORTS` | Não (`4096`) | Portas que o router ignora. |
|
||||
| `DOCKER_API_VERSION` | Não (`1.40`) | Versão da API do Docker para o backend; definida no `docker-compose.yml`, não no `.env.example`. |
|
||||
| `USE_CHINA_MIRROR` | Não (`1`) | Opção de build da imagem do backend: usa os mirrors abaixo. |
|
||||
| `APT_MIRROR`, `APT_SECURITY_MIRROR`, `NPM_CONFIG_REGISTRY`, `NODEJS_ORG_MIRROR`, `PIP_INDEX_URL`, `PIP_TRUSTED_HOST` | Não | Mirrors para o toolchain do backend. |
|
||||
| `MISE_INSTALL_URL`, `OPENCODE_INSTALL_URL` | Não | URLs de instalação usadas no build da imagem do backend. |
|
||||
|
||||
Auditar o agente pelo shell também funciona, por exemplo:
|
||||
</details>
|
||||
|
||||
```bash
|
||||
TOKEN=$(node -e "console.log(require(process.env.HOME+'/.pi/agent/piagentui-port.json').token)")
|
||||
curl -s -H "Authorization: Bearer $TOKEN" http://127.0.0.1:58785/api/models | head -c 300
|
||||
```
|
||||
## Estado do projeto
|
||||
|
||||
## Produção e deploy
|
||||
Beta, antes da 1.0 (`0.6.10`), mantido por um desenvolvedor. As releases saem do `release.yml` em tags `v*` (artefatos para Windows, macOS, Linux e Android); o `deploy.yml` publica o build web com `VITE_BASE_PATH=/PiAgentUI/`.
|
||||
|
||||
```bash
|
||||
npm run build # tsc -b && vite build; saída em dist/ (cerca de 14 MB, estático)
|
||||
npm run preview # serve o dist/ localmente para conferência final
|
||||
```
|
||||
- O nome OpenCodeUI ainda não saiu de tudo: o crate do router em Rust é `opencodeui-router`, as imagens são `opencodeui-*`, os APKs Android saem como `OpenCodeUI-*`, os comentários do `.env.example` estão em chinês e o backend Docker roda `opencode serve`, que é do deploy herdado, não do fluxo com a extensão do Pi.
|
||||
- `docker-compose.yml` e `docker-compose.standalone.yml` ainda puxam a imagem upstream `ghcr.io/lehhair/opencodeui-frontend`.
|
||||
- Os testes são de componente e de servidor (Vitest). Não há testes do shell Tauri nem do router em Rust além da compilação, nem teste end-to-end no navegador, nem meta de cobertura.
|
||||
- A entrada de voz depende de um endpoint de STT compatível com OpenAI e não tem teste automatizado no navegador.
|
||||
|
||||
- Hospedagem estática: `dist/` é uma SPA comum. Se for montada em um subcaminho, build com `VITE_BASE_PATH=/subcaminho/ npm run build`.
|
||||
- Container (front end com Caddy): `docker/Dockerfile.frontend` builda a UI em Node 22 e serve pelo Caddy na porta 3000.
|
||||
- Stack completa de containers: `docker-compose.yml` sobe `gateway` (Caddy com o roteador Rust em 6658/6659), `frontend` e `backend`. Copie `.env.example` para `.env` antes. As imagens vêm de `ghcr.io/evandrodevbr/opencodeui-{backend,frontend,gateway}`, publicadas pelos workflows `docker-*`; para buildar localmente use `docker compose -f docker-compose.yml -f docker-compose.build.yml up -d --build`.
|
||||
- GitHub Pages: `.github/workflows/deploy.yml` builda o `dist/` com `VITE_BASE_PATH=/PiAgentUI/` e publica a cada push em `main` (na primeira vez, habilite o Pages com origem "GitHub Actions").
|
||||
- Releases desktop e mobile: `.github/workflows/release.yml` roda em tags `v*` e anexa artefatos de Windows, macOS, Linux e Android ao release do GitHub.
|
||||
|
||||
## Estrutura do projeto
|
||||
|
||||
```text
|
||||
extensions/ Extensão Pi: servidor HTTP/WebSocket, store de settings,
|
||||
gerentes de git e de extensões, todos com testes Vitest
|
||||
src/ Front end React (entrada Vite em index.html)
|
||||
├── api/ Clientes HTTP/SSE e pipeline de requisições
|
||||
├── components/ Peças de UI compartilhadas (code blocks, diffs, command palette)
|
||||
├── features/ chat, input, mensagens, ferramentas, sessões, settings, slash commands
|
||||
├── hooks/ sessão, eventos, transcrição, permissões
|
||||
├── locales/ 8 bundles traduzidos
|
||||
├── store/ Stores (sessões, mensagens, layout, tema)
|
||||
└── constants/ URL base da API, chaves de storage, métricas de UI
|
||||
src-router/ Roteador do gateway em Rust (axum), atrás do Caddy
|
||||
src-tauri/ Shell desktop e mobile Tauri 2 (Rust), projeto Android em gen/
|
||||
docker/ Dockerfiles, configs do Caddy, entrypoints
|
||||
scripts/ cópia de ícones, bump de versão, preparação de release, helper Android
|
||||
docs/superpowers/ Specs de design e planos escritos durante a migração
|
||||
```
|
||||
|
||||
## Verificação
|
||||
|
||||
Tudo abaixo foi executado em um clone limpo neste estado do repositório:
|
||||
|
||||
| Comando | Resultado |
|
||||
|---|---|
|
||||
| `npm ci` | 615 pacotes instalados, postinstall copia 266 ícones |
|
||||
| `npm run typecheck` | exit 0 (`tsc -b`, projetos app e extensão) |
|
||||
| `npm run typecheck:extensions` | exit 0 |
|
||||
| `npm run lint` | exit 0 (0 erros, 109 avisos) |
|
||||
| `npm run build` | exit 0, `dist/` com cerca de 14 MB |
|
||||
| `npm run test:run` | 89 arquivos, 319 testes, todos passando |
|
||||
| `npm run validate` | exit 0 (o mesmo gate que o CI roda em `build.yml`) |
|
||||
| `cargo check` em `src-router/` | exit 0 |
|
||||
| `cargo check --manifest-path src-tauri/Cargo.toml` | exit 0 (1 aviso) |
|
||||
| servidor da extensão via HTTP | `/global/health` 200, `/` 200 com `PI_BOOT_DATA`, `/api/models` 200 com token e 401 sem, `/api/sessions`, `/api/sessions/:id/messages`, `/api/sessions/:id/context`, `/api/skills`, `/api/mcp/status`, `/api/commands/list`, `/api/network/access` todos 200, `/global/event` 200 `text/event-stream` |
|
||||
|
||||
Dois detalhes ao rodar a suíte: `npm run test:run` precisa do `dist/` existir, porque o teste do servidor da extensão busca o `index.html` servido, então `npm run build` deve rodar antes (é a ordem em `npm run validate`); e `npm run format:check` hoje acusa 67 arquivos fora do padrão do Prettier, então `npm run check` falha nesse passo mesmo com o gate do CI passando.
|
||||
|
||||
## Estado atual e limitações
|
||||
|
||||
- Projeto ativo de um desenvolvedor, pré-1.0 (`0.6.10`). Chat, sessões, MCP, skills e painéis de comandos funcionam contra um runtime Pi real; algumas áreas ainda mudam rápido.
|
||||
- A herança de nomes da base OpenCodeUI foi limpa só em parte: o crate Rust se chama `opencodeui-router`, as imagens de container são `opencodeui-*`, os comentários do `.env.example` estão em chinês e a stack Docker roda um backend `opencode serve` que pertence ao deploy herdado, não ao fluxo da extensão Pi.
|
||||
- Não há teste do shell Tauri nem do gateway Rust além da compilação; os pacotes desktop e Android só são gerados pelo workflow de release.
|
||||
- A suíte é de componentes e de servidor; não há teste end-to-end de navegador nem limite de cobertura.
|
||||
- `@mariozechner/pi-coding-agent` é devDependency só para tipos (o runtime fornece a API real da extensão) e o npm marca essa linha como depreciada em favor de `@earendil-works/pi-coding-agent`.
|
||||
- O front end conversa com um runtime por janela: o arquivo de descoberta ou um servidor configurado à mão. Não há agregação de múltiplos runtimes.
|
||||
- A entrada de voz existe na UI (`src/hooks/useVoiceTranscription.ts`) e exige um endpoint STT compatível com OpenAI configurado nos settings; não há teste automatizado de navegador para ela.
|
||||
- Sem pacote publicado no npm e sem demo web hospedada; o README e o código assumem um runtime local.
|
||||
|
||||
## Documentação
|
||||
|
||||
| Documento | Conteúdo |
|
||||
|---|---|
|
||||
| [`docs/superpowers/specs/`](docs/superpowers/specs/) | Specs de design da migração para extensão Pi, sessões, STT e controles de Git |
|
||||
| [`docs/superpowers/plans/`](docs/superpowers/plans/) | Planos de implementação e roadmap de contexto, skills e MCP |
|
||||
| [`CHANGELOG.md`](CHANGELOG.md) | Histórico de releases usado pelo workflow de release |
|
||||
| [`docker/`](docker/) | Dockerfiles, configs do Caddy e entrypoints da stack de containers |
|
||||
Issues e pull requests vão para o [issue tracker](https://git.evandro.dev.br/evandro/PiAgentUI/issues); rode `npm run validate` antes de abrir um PR.
|
||||
|
||||
## Licença
|
||||
|
||||
GPL-3.0-only, conforme `package.json` e [`LICENSE`](LICENSE). PiAgentUI é um fork e uma reescrita do OpenCodeUI; os autores originais estão creditados em `src-tauri/Cargo.toml`.
|
||||
GPL-3.0-only, veja [`LICENSE`](LICENSE). O PiAgentUI é um fork retrabalhado do OpenCodeUI; o autor original está creditado em `src-tauri/Cargo.toml`.
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<sub>Feito por <a href="https://evandro.dev.br">Evandro Fonseca Junior</a> · <a href="https://git.evandro.dev.br/evandro">git.evandro.dev.br</a></sub>
|
||||
</div>
|
||||
@@ -0,0 +1,48 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="420" viewBox="0 0 1200 420" role="img" aria-labelledby="title desc">
|
||||
<title id="title">PiAgentUI</title>
|
||||
<desc id="desc">PiAgentUI: a desktop and web workspace for live Pi Agent sessions. On the right, a simplified app window shows a chat with a tool call card, the composer prompt and the Files, Changes, MCP and Skills side panel.</desc>
|
||||
|
||||
<rect width="1200" height="420" rx="24" fill="#1e1d1c"/>
|
||||
|
||||
<g id="title-block" font-family="system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif">
|
||||
<text x="64" y="156" font-size="68" font-weight="700" fill="#f4f1ea">PiAgentUI</text>
|
||||
<text x="64" y="214" font-size="28" fill="#f4f1ea">A desktop and web workspace for</text>
|
||||
<text x="64" y="252" font-size="28" fill="#f4f1ea">live Pi Agent sessions, tools and MCP.</text>
|
||||
<text x="64" y="326" font-size="20" fill="#a8a29e" font-family="ui-monospace, "SF Mono", Consolas, monospace">React 19 · Vite 8 · Tauri 2 · Node ≥22</text>
|
||||
</g>
|
||||
|
||||
<g id="workspace" transform="translate(640 60)" font-family="system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif">
|
||||
<rect width="496" height="300" rx="16" fill="#262422" stroke="#3a3633" stroke-width="2"/>
|
||||
<text x="24" y="31" font-size="18" fill="#a8a29e">Session</text>
|
||||
<line x1="0" y1="48" x2="496" y2="48" stroke="#3a3633" stroke-width="2"/>
|
||||
<line x1="316" y1="48" x2="316" y2="300" stroke="#3a3633" stroke-width="2"/>
|
||||
|
||||
<g id="chat">
|
||||
<rect x="124" y="64" width="176" height="40" rx="12" fill="#3a3633"/>
|
||||
<text x="140" y="91" font-size="20" fill="#f4f1ea">fix the build</text>
|
||||
|
||||
<rect x="24" y="120" width="276" height="76" rx="12" fill="none" stroke="#d97706" stroke-width="2"/>
|
||||
<g font-family="ui-monospace, "SF Mono", Consolas, monospace" font-size="18">
|
||||
<text x="40" y="150" fill="#d97706">bash</text>
|
||||
<text x="96" y="150" fill="#f4f1ea">npm run build</text>
|
||||
<path d="M42 172 L48 178 L60 165" fill="none" stroke="#a8a29e" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<text x="70" y="180" fill="#a8a29e">exit 0</text>
|
||||
</g>
|
||||
|
||||
<text x="24" y="232" font-size="20" fill="#f4f1ea">Build passes.</text>
|
||||
|
||||
<rect x="24" y="248" width="276" height="36" rx="10" fill="#1e1d1c" stroke="#3a3633" stroke-width="2"/>
|
||||
<path d="M38 259 L46 266 L38 273" fill="none" stroke="#d97706" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<line x1="50" y1="274" x2="56" y2="274" stroke="#d97706" stroke-width="3" stroke-linecap="round"/>
|
||||
<text x="68" y="272" font-size="18" fill="#a8a29e">Reply to agent</text>
|
||||
</g>
|
||||
|
||||
<g id="side-panel" font-size="20">
|
||||
<text x="344" y="96" fill="#a8a29e">Files</text>
|
||||
<text x="344" y="140" fill="#a8a29e">Changes</text>
|
||||
<rect x="328" y="164" width="4" height="28" rx="2" fill="#d97706"/>
|
||||
<text x="344" y="184" fill="#d97706" font-weight="700">MCP</text>
|
||||
<text x="344" y="228" fill="#a8a29e">Skills</text>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.1 KiB |
Reference in new issue
Block a user