Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
13b464b4d6 | ||
|
|
8ce05620e0 | ||
|
|
da09846708 | ||
|
|
e8a252ecde | ||
|
|
039d25f084 | ||
|
|
0e46e5857e | ||
|
|
1dcd951bd7 | ||
|
|
d5b4362ed7 |
No files matched your search
@@ -2,7 +2,7 @@ name: Deploy to GitHub Pages
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [dev]
|
||||
branches: [main]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
@@ -29,7 +29,12 @@ jobs:
|
||||
|
||||
- run: npm run build
|
||||
env:
|
||||
VITE_BASE_PATH: /OpenCodeUI/
|
||||
VITE_BASE_PATH: /PiAgentUI/
|
||||
|
||||
- name: Setup Pages
|
||||
uses: actions/configure-pages@v5
|
||||
with:
|
||||
enablement: true
|
||||
|
||||
- uses: actions/upload-pages-artifact@v5
|
||||
with:
|
||||
|
||||
@@ -6,3 +6,4 @@ tmp/
|
||||
*.log
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
.pi-lens/
|
||||
@@ -1 +0,0 @@
|
||||
{"version":"v2","builtAt":"2026-06-01T00:40:39.785Z","signature":"D:/Documents/Github/PiAgentUI/PiAgentUi/eslint.config.js:1486:1780022589270.6587|D:/Documents/Github/PiAgentUI/PiAgentUi/extensions/piagentui-extension-manager.test.ts:5516:1780258362691.8145|D:/Documents/Github/PiAgentUI/PiAgentUi/extensions/piagentui-extension-manager.ts:16383:1780258362659.5957|D:/Documents/Github/PiAgentUI/PiAgentUi/extensions/piagentui-git-manager.test.ts:4040:1780266481529.727|D:/Documents/Github/PiAgentUI/PiAgentUi/extensions/piagentui-git-manager.ts:7293:1780266481600.4917|D:/Documents/Github/PiAgentUI/PiAgentUi/extensions/piagentui-server-core.test.ts:6112:1780253705167.7166|D:/Documents/Github/PiAgentUI/PiAgentUi/extensions/piagentui-server-core.ts:5140:1780253889743.0134|D:/Documents/Github/PiAgentUI/PiAgentUi/extensions/piagentui-server.test.ts:39380:1780272600127.7744|D:/Documents/Github/PiAgentUI/PiAgentUi/extensions/piagentui-server.ts:83661:1780272653246.032|D:/Documents/Github/PiAgentUI/PiAgentUi/extensions/piagentui-settings-store.test.ts:2999:1780248290341.1304|D:/Documents/Github/PiAgentUI/PiAgentUi/extensions/piagentui-settings-store.ts:6608:1780250094524.6309|D:/Documents/Github/PiAgentUI/PiAgentUi/public/notification-sw.js:1287:1780022589275.1758|D:/Documents/Github/PiAgentUI/PiAgentUi/scripts/bump-version.mjs:7766:1780022589276.6814|D:/Documents/Github/PiAgentUI/PiAgentUi/scripts/copy-material-icons.mjs:2053:1780022589276.6814|D:/Documents/Github/PiAgentUI/PiAgentUi/scripts/prepare-release.mjs:2730:1780022589276.6814|D:/Documents/Github/PiAgentUI/PiAgentUi/src-router/src/caddy.rs:2091:1780022589277.6882|D:/Documents/Github/PiAgentUI/PiAgentUi/src-router/src/config.rs:3669:1780022589278.6926|D:/Documents/Github/PiAgentUI/PiAgentUi/src-router/src/main.rs:796:1780022589278.6926|D:/Documents/Github/PiAgentUI/PiAgentUi/src-router/src/router.rs:12128:1780022589278.6926|D:/Documents/Github/PiAgentUI/PiAgentUi/src-router/src/scanner.rs:2323:1780022589279.694|D:/Documents/Github/PiAgentUI/PiAgentUi/src-router/src/state.rs:2417:1780022589279.694|D:/Documents/Github/PiAgentUI/PiAgentUi/src-tauri/build.rs:40:1780022589282.198|D:/Documents/Github/PiAgentUI/PiAgentUi/src-tauri/src/app/bridge/args.rs:1765:1780022589313.2903|D:/Documents/Github/PiAgentUI/PiAgentUi/src-tauri/src/app/bridge/event.rs:558:1780022589313.2903|D:/Documents/Github/PiAgentUI/PiAgentUi/src-tauri/src/app/bridge/mod.rs:197:1780022589313.2903|D:/Documents/Github/PiAgentUI/PiAgentUi/src-tauri/src/app/bridge/state.rs:4232:1780022589313.2903|D:/Documents/Github/PiAgentUI/PiAgentUi/src-tauri/src/app/commands/bridge.rs:13983:1780022589314.2903|D:/Documents/Github/PiAgentUI/PiAgentUi/src-tauri/src/app/commands/mod.rs:124:1780027014784.0298|D:/Documents/Github/PiAgentUI/PiAgentUi/src-tauri/src/app/commands/pi_agent.rs:4814:1780027011663.1926|D:/Documents/Github/PiAgentUI/PiAgentUi/src-tauri/src/app/commands/utils.rs:1496:1780029769772.7441|D:/Documents/Github/PiAgentUI/PiAgentUi/src-tauri/src/app/dir_state.rs:773:1780022589315.2903|D:/Documents/Github/PiAgentUI/PiAgentUi/src-tauri/src/app/mod.rs:10869:1780029779431.7087|D:/Documents/Github/PiAgentUI/PiAgentUi/src-tauri/src/app/service.rs:500:1780027024480.5833|D:/Documents/Github/PiAgentUI/PiAgentUi/src-tauri/src/lib.rs:100:1780022589315.2903|D:/Documents/Github/PiAgentUI/PiAgentUi/src-tauri/src/main.rs:193:1780022589316.2898|D:/Documents/Github/PiAgentUI/PiAgentUi/src/api/agent.ts:929:1780026517593.7356|D:/Documents/Github/PiAgentUI/PiAgentUi/src/api/client.test.ts:1876:1780180406861.2058|D:/Documents/Github/PiAgentUI/PiAgentUi/src/api/client.ts:3901:1780257142048.0273|D:/Documents/Github/PiAgentUI/PiAgentUi/src/api/command.test.ts:2375:1780194572795.3748|D:/Documents/Github/PiAgentUI/PiAgentUi/src/api/command.ts:3632:1780194752659.6665|D:/Documents/Github/PiAgentUI/PiAgentUi/src/api/config.ts:1414:1780026299997.4521|D:/Documents/Github/PiAgentUI/PiAgentUi/src/api/events.test.ts:8606:1780119380006.358|D:/Documents/Github/PiAgentUI/PiAgentUi/src/api/events.ts:27784:1780121498237.752|D:/Documents/Github/PiAgentUI/PiAgentUi/src/api/extension.test.ts:1680:1780258114988.9187|D:/Documents/Github/PiAgentUI/PiAgentUi/src/api/extension.ts:1197:1780258069136.5046|D:/Documents/Github/PiAgentUI/PiAgentUi/src/api/file.ts:4453:1780026718153.368|D:/Documents/Github/PiAgentUI/PiAgentUi/src/api/global.ts:981:1780026539178.5913|D:/Documents/Github/PiAgentUI/PiAgentUi/src/api/http.test.ts:1443:1780022589319.4368|D:/Documents/Github/PiAgentUI/PiAgentUi/src/api/http.ts:1509:1780029793129.7656|D:/Documents/Github/PiAgentUI/PiAgentUi/src/api/index.ts:135:1780022589319.4368|D:/Documents/Github/PiAgentUI/PiAgentUi/src/api/lsp.ts:657:1780026505282.3206|D:/Documents/Github/PiAgentUI/PiAgentUi/src/api/mcp.test.ts:1017:1780188851123.1152|D:/Documents/Github/PiAgentUI/PiAgentUi/src/api/mcp.ts:1868:1780188942993.4717|D:/Documents/Github/PiAgentUI/PiAgentUi/src/api/message.ts:4368:1780026289798.4277|D:/Documents/Github/PiAgentUI/PiAgLine truncated
|
||||
@@ -1,212 +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)
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
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.
|
||||
[Issues](https://git.evandro.dev.br/evandro/PiAgentUI/issues) · [Changelog](CHANGELOG.md) · [Specs de diseño](docs/superpowers/specs/)
|
||||
|
||||
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.
|
||||
[English](README.md) · [Português (BR)](README.pt-BR.md) · **Español** · [日本語](README.ja.md)
|
||||
|
||||
> **Estado del proyecto:** desarrollo local activo. Algunas áreas ya son cercanas a producto, mientras otras siguen cambiando rápidamente.
|
||||
</div>
|
||||
|
||||
## Demostración del software
|
||||

|
||||
|
||||
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.
|
||||
## Qué es
|
||||
|
||||

|
||||
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
|
||||
|
||||
## Qué hace PiAgentUI hoy
|
||||
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.
|
||||
|
||||
- **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.
|
||||
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.
|
||||
|
||||
## Dirección del producto
|
||||
## Cómo funciona
|
||||
|
||||
PiAgentUI está evolucionando hacia una aplicación completa de agentes:
|
||||
- `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.
|
||||
|
||||
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.
|
||||
## Inicio rápido
|
||||
|
||||
## 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>
|
||||
@@ -1,212 +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) | **日本語**
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
PiAgentUI は **Pi Agent** のためのモダンな Web / デスクトップ UI です。単なるチャット画面ではありません。最終的には Codex や Claude Desktop のような、エージェント中心の本格的な開発アプリになることを目指しています。
|
||||
[Issues](https://git.evandro.dev.br/evandro/PiAgentUI/issues) · [Changelog](CHANGELOG.md) · [設計 spec](docs/superpowers/specs/)
|
||||
|
||||
PiAgentUI は、実際の Pi runtime を信頼できる唯一の情報源として扱います。セッション、モデルメタデータ、コンテキスト使用量、tool call、skills、MCP 設定、slash command は、可能な限り Pi から取得し、UI 側だけの仮の状態として再実装しません。
|
||||
[English](README.md) · [Português (BR)](README.pt-BR.md) · [Español](README.es.md) · **日本語**
|
||||
|
||||
> **プロジェクト状態:** アクティブなローカル開発中です。一部は製品に近い品質ですが、まだ高速に変化している領域もあります。
|
||||
</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 が実際に動かしているものです。
|
||||
|
||||
- **ストリーミング対応チャット** — 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、モデルセレクター、プロジェクト/セッションナビゲーション、レスポンシブレイアウト。
|
||||
Pi を使っていないなら向きません。拡張機能がないと、UI はサーバー接続ダイアログしか表示しません。また 1 ウィンドウにつき 1 ランタイムで、ホストされたデモや npm 公開パッケージもありません。
|
||||
|
||||
## プロダクトの方向性
|
||||
## 仕組み
|
||||
|
||||
PiAgentUI は、完全なエージェントアプリへ進化しています。
|
||||
- `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 の前に立ちます。
|
||||
|
||||
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,241 +1,136 @@
|
||||
<p align="center">
|
||||
<img src="./src/assets/images/logo/PiAgentUiBlack%20%283%29.png" alt="PiAgentUI logo" width="760" />
|
||||
</p>
|
||||
<div align="center">
|
||||
|
||||
<h1 align="center">PiAgentUI</h1>
|
||||
<p align="center">
|
||||
<strong>Professional Desktop & Web UI for AI Coding Agents</strong><br/>
|
||||
<em>Pi Agent · Claude Code · Codex · OpenCode · Cursor · Copilot</em>
|
||||
</p>
|
||||
<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">
|
||||
|
||||
<p align="center">
|
||||
<img src="https://img.shields.io/badge/version-0.6.10-blue" alt="Version" />
|
||||
<img src="https://img.shields.io/badge/license-GPL--3.0-green" alt="License" />
|
||||
<img src="https://img.shields.io/badge/platform-Tauri%202%20%7C%20Web-brightgreen" alt="Platform" />
|
||||
<img src="https://img.shields.io/badge/framework-React%2019%20%7C%20TypeScript-61DAFB" alt="Framework" />
|
||||
</p>
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
**English (US)** | [Português (BR)](./README.pt-BR.md) | [Español](./README.es.md) | [日本語](./README.ja.md)
|
||||
[Issues](https://git.evandro.dev.br/evandro/PiAgentUI/issues) · [Changelog](CHANGELOG.md) · [Design specs](docs/superpowers/specs/)
|
||||
|
||||
## TL;DR
|
||||
**English** · [Português (BR)](README.pt-BR.md) · [Español](README.es.md) · [日本語](README.ja.md)
|
||||
|
||||
PiAgentUI is a **full-featured workspace for AI coding agents** — sessions, model switching, MCP tools, skills browser, voice input, terminal, file explorer, and Tauri desktop app. Built for Pi Agent but compatible with Claude Code, Codex, OpenCode, Cursor, and any agent that speaks SSE/HTTP.
|
||||
</div>
|
||||
|
||||
> **Category:** AI Agent UI · Agent Desktop Client · MCP GUI · Coding Copilot Interface
|
||||
> **Status:** Active development — production-grade chat, evolving fast. Expect weekly releases.
|
||||

|
||||
|
||||
## Software preview
|
||||
## What it is
|
||||
|
||||
These screenshots show the current PiAgentUI experience: a dark, focused agent workspace with real Pi sessions, model selection, MCP metadata, settings, tool-aware chat, and side panels.
|
||||
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.
|
||||
|
||||

|
||||
- 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 set in settings.
|
||||
- UI locales: `en`, `pt-BR`, `es`, `zh-CN`, `hi`, `bn`, `ar` (`src/locales/`).
|
||||
|
||||

|
||||
## Why use it
|
||||
|
||||

|
||||
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.
|
||||
|
||||
## Quick Install
|
||||
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 | 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 |
|
||||
|
||||
```bash
|
||||
# Clone and install
|
||||
git clone https://github.com/lehhair/OpenCodeUI.git
|
||||
cd OpenCodeUI
|
||||
npm install
|
||||
|
||||
# Start dev server
|
||||
npm run dev
|
||||
|
||||
# Or build desktop app
|
||||
npm run tauri dev
|
||||
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
|
||||
```
|
||||
|
||||
Requires **Node.js ≥ 22** and **Pi Agent** installed. The UI auto-discovers the Pi runtime via `~/.pi/agent/piagentui-port.json`.
|
||||
|
||||
## What PiAgentUI does today
|
||||
|
||||
- **Agent chat with streaming** — live assistant output through SSE, stable message reconciliation, markdown rendering, code highlighting, reasoning parts, and tool cards.
|
||||
- **Real Pi sessions** — session list, active-session routing, restart-safe history loading, derived session titles, and selected-session send routing.
|
||||
- **Tool output as tool cards** — tool calls/results stay attached to assistant messages instead of leaking as normal chat text.
|
||||
- **Runtime context usage** — context usage comes from Pi runtime when available; unknown/compacted context is shown safely instead of `NaN`.
|
||||
- **Model metadata** — Pi provider/model identity remains authoritative, with optional OpenRouter catalog metadata used only for extra details like context, output, modality, pricing, and tokenizer hints.
|
||||
- **Skills panel** — real skills are parsed from the effective Pi prompt and grouped by source: global, project, package, and other.
|
||||
- **MCP metadata panel** — reads configured MCP servers from local/global config files and surfaces transport, command, URL, lifecycle, direct tools, and source.
|
||||
- **Pi slash commands** — `/api/commands/list` exposes Pi built-in commands plus dynamic extension, prompt, and skill commands.
|
||||
- **Attachments and multimodal input** — file/image/PDF/audio/video attachment affordances follow the selected model capabilities.
|
||||
- **Terminal and file tooling** — integrated terminal, file explorer, syntax highlighting, diff-oriented components, and Tauri desktop integration.
|
||||
- **Keyboard-first UI** — command palette, configurable keybindings, split panes, model selector, project/session navigation, and responsive layouts.
|
||||
|
||||
## Product direction
|
||||
|
||||
PiAgentUI is moving toward a complete agent app:
|
||||
|
||||
1. **Visual actions for every Pi command** — slash commands remain available, but frequent actions should become buttons, menus, dialogs, or panels.
|
||||
2. **Voice input and realtime transcription** — microphone recording, partial transcript deltas, final transcript insertion into the composer, and OpenAI-compatible STT provider configuration.
|
||||
3. **Deeper MCP integration** — beyond metadata: connect, authenticate, inspect tools, and execute MCP workflows from the UI.
|
||||
4. **Full session control** — fork, clone, tree navigation, import/export/share, branch summaries, and context management as first-class UI flows.
|
||||
5. **Desktop-grade experience** — a polished Tauri app with local runtime discovery, secure settings, notifications, and richer workspace controls.
|
||||
|
||||
## Audio and transcription roadmap
|
||||
|
||||
PiAgentUI already supports attaching audio files when the selected model declares audio input support. The planned voice system adds live speech-to-text directly in the composer.
|
||||
|
||||
Recommended architecture:
|
||||
|
||||
- **Default realtime provider:** OpenAI Realtime Transcription with `gpt-realtime-whisper` for low-latency partial transcripts.
|
||||
- **Default file fallback:** OpenAI Audio Transcriptions with `gpt-4o-transcribe`, `gpt-4o-mini-transcribe`, or `whisper-1`.
|
||||
- **Custom providers:** user-configurable OpenAI-compatible STT APIs, such as providers that implement `POST /v1/audio/transcriptions`.
|
||||
|
||||
Planned UX:
|
||||
|
||||
- microphone button in the composer;
|
||||
- recording and permission states;
|
||||
- partial transcript overlay;
|
||||
- final transcript inserted into the input;
|
||||
- optional append/replace behavior;
|
||||
- auto-send disabled by default;
|
||||
- recoverable error handling for permissions, network failures, and provider errors.
|
||||
|
||||
Planned provider config shape:
|
||||
|
||||
```json
|
||||
{
|
||||
"kind": "openai-compatible",
|
||||
"mode": "file",
|
||||
"baseUrl": "https://api.example.com/v1",
|
||||
"transcriptionEndpoint": "/audio/transcriptions",
|
||||
"transcriptionModel": "openai/whisper-large-v3",
|
||||
"language": "en"
|
||||
}
|
||||
```
|
||||
|
||||
Realtime support is treated as a separate capability because OpenAI-compatible HTTP transcription does not guarantee WebSocket compatibility.
|
||||
|
||||
## Architecture
|
||||
|
||||
```text
|
||||
PiAgentUI
|
||||
├─ React/Vite frontend
|
||||
│ ├─ chat, message rendering, input, panels, settings
|
||||
│ ├─ local stores for UI preferences
|
||||
│ └─ SSE/API clients for PiAgentUI local endpoints
|
||||
├─ Pi extension backend
|
||||
│ └─ extensions/piagentui-server.ts
|
||||
│ ├─ exposes local /api/* endpoints
|
||||
│ ├─ bridges to Pi runtime/session/model APIs
|
||||
│ ├─ streams Pi events to the browser
|
||||
│ └─ reads local metadata such as MCP config and skills
|
||||
└─ Pi Agent runtime
|
||||
├─ sessions
|
||||
├─ models/providers
|
||||
├─ tools
|
||||
├─ skills
|
||||
├─ MCP
|
||||
└─ slash commands
|
||||
```
|
||||
|
||||
The UI should not invent runtime state when Pi already knows the answer. PiAgentUI can cache and enrich data for UX, but Pi remains authoritative for agent behavior.
|
||||
|
||||
## Tech stack
|
||||
|
||||
| Area | Stack |
|
||||
| ------------------- | --------------------------------------------- |
|
||||
| UI | React 19, TypeScript |
|
||||
| Build | Vite 8 |
|
||||
| Styling | Tailwind CSS v4 plus project design tokens |
|
||||
| Desktop | Tauri 2 |
|
||||
| Markdown | Streamdown / markdown rendering pipeline |
|
||||
| Syntax highlighting | Shiki |
|
||||
| Terminal | xterm.js |
|
||||
| Testing | Vitest, Testing Library |
|
||||
| Local backend | Pi extension, Node HTTP server, WebSocket/SSE |
|
||||
|
||||
## Local development
|
||||
|
||||
Install dependencies:
|
||||
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
Start the frontend dev server:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
Build the app:
|
||||
`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
|
||||
```
|
||||
|
||||
Run tests:
|
||||
Desktop and Android:
|
||||
|
||||
```bash
|
||||
npm run test:run
|
||||
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
|
||||
```
|
||||
|
||||
Run type checks:
|
||||
Before a PR, `npm run validate` runs typecheck, extension typecheck, lint, build and tests; it is the gate CI runs in `build.yml`.
|
||||
|
||||
```bash
|
||||
npm run typecheck
|
||||
npm run typecheck:extensions
|
||||
```
|
||||
## Configuration
|
||||
|
||||
Full validation:
|
||||
The container stack is inherited from the OpenCodeUI deployment. Copy `.env.example` to `.env` first.
|
||||
|
||||
```bash
|
||||
npm run validate
|
||||
```
|
||||
| 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`, `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 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/`. |
|
||||
|
||||
## Pi extension runtime
|
||||
<details>
|
||||
<summary>Environment variables (container stack only)</summary>
|
||||
|
||||
PiAgentUI is registered as a Pi extension in `package.json`:
|
||||
| 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 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. |
|
||||
| `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`, `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. |
|
||||
|
||||
```json
|
||||
{
|
||||
"pi": {
|
||||
"extensions": ["./extensions/piagentui-server.ts"]
|
||||
}
|
||||
}
|
||||
```
|
||||
</details>
|
||||
|
||||
When the extension starts, it writes local discovery metadata to:
|
||||
## Project status
|
||||
|
||||
```text
|
||||
~/.pi/agent/piagentui-port.json
|
||||
```
|
||||
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/`.
|
||||
|
||||
The web app uses that local port/token information to talk to the running extension server. Some backend changes require restarting or reloading the Pi extension process before the browser sees the new behavior.
|
||||
- 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.
|
||||
|
||||
## Important local endpoints
|
||||
|
||||
| Endpoint | Purpose |
|
||||
| -------------------------------- | ------------------------------------------------------ |
|
||||
| `GET /api/models` | Real Pi model list plus normalized capability metadata |
|
||||
| `GET /api/sessions` | Session list parsed from Pi session files |
|
||||
| `GET /api/sessions/:id/messages` | Session history normalized for UI rendering |
|
||||
| `GET /api/sessions/:id/context` | Runtime context usage for the active session |
|
||||
| `POST /api/messages/send` | Send user message to the requested Pi session |
|
||||
| `GET /api/skills` | Effective Pi skills grouped by source |
|
||||
| `GET /api/mcp/status` | Configured MCP server metadata |
|
||||
| `GET /api/commands/list` | Built-in and dynamic Pi slash commands |
|
||||
| `GET /global/event` | SSE event stream from PiAgentUI backend |
|
||||
|
||||
## Development principles
|
||||
|
||||
- Prefer real Pi runtime data over mocked UI-only state.
|
||||
- Keep OpenRouter metadata as catalog enrichment only; never replace Pi provider/model identity with it.
|
||||
- Treat unknown runtime values explicitly instead of rendering misleading numbers.
|
||||
- Add tests before behavior changes whenever possible.
|
||||
- Keep tool results inside tool cards.
|
||||
- Keep UI work aligned with the existing theme, motion, spacing, and panel patterns.
|
||||
- Document what is implemented separately from what is planned.
|
||||
|
||||
## Repository notes
|
||||
|
||||
This project still contains inherited naming from the original OpenCodeUI base in a few places, including package metadata and older documentation files. The current direction is PiAgentUI-first, and future cleanup should migrate remaining OpenCodeUI naming without breaking local workflows.
|
||||
Issues and pull requests go to the [issue tracker](https://git.evandro.dev.br/evandro/PiAgentUI/issues); run `npm run validate` before a PR.
|
||||
|
||||
## License
|
||||
|
||||
This repository currently follows the license declared in `package.json`: `GPL-3.0-only`.
|
||||
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`.
|
||||
|
||||
---
|
||||
|
||||
<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>
|
||||
@@ -1,212 +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">
|
||||
|
||||
[English (US)](./README.md) | **Português (BR)** | [Español](./README.es.md) | [日本語](./README.ja.md)
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
PiAgentUI é uma interface moderna web e desktop para o **Pi Agent**. Ele não é apenas uma camada visual de chat: o objetivo é evoluir para um aplicativo completo de agentes, na mesma categoria de produto de Codex, Claude Desktop e outros ambientes agent-first para desenvolvimento.
|
||||
[Issues](https://git.evandro.dev.br/evandro/PiAgentUI/issues) · [Changelog](CHANGELOG.md) · [Specs de design](docs/superpowers/specs/)
|
||||
|
||||
O PiAgentUI trata o runtime real do Pi como fonte de verdade. Sessões, metadados de modelo, uso de contexto, tool calls, skills, configuração MCP e slash commands vêm do Pi sempre que possível, em vez de serem recriados como estado falso de interface.
|
||||
[English](README.md) · **Português (BR)** · [Español](README.es.md) · [日本語](README.ja.md)
|
||||
|
||||
> **Status do projeto:** desenvolvimento local ativo. Algumas áreas já estão próximas de produto, enquanto outras ainda mudam rapidamente.
|
||||
</div>
|
||||
|
||||
## Demonstração do software
|
||||

|
||||
|
||||
Estas capturas mostram a experiência atual do PiAgentUI: um workspace escuro e focado para agentes, com sessões reais do Pi, seleção de modelos, metadados MCP, settings, chat com ferramentas e painéis laterais.
|
||||
## 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 que o PiAgentUI já faz hoje
|
||||
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.
|
||||
|
||||
- **Chat com streaming** — saída ao vivo via SSE, reconciliação estável de mensagens, markdown, code highlight, partes de reasoning e cards de ferramentas.
|
||||
- **Sessões reais do Pi** — lista de sessões, roteamento para sessão ativa, histórico seguro após restart, títulos derivados e envio para a sessão selecionada.
|
||||
- **Tool output em cards** — tool calls/results ficam anexados às mensagens do assistente, sem vazar como texto normal no chat.
|
||||
- **Uso real de contexto** — o uso de contexto vem do runtime do Pi quando disponível; contexto desconhecido/compactado é exibido de forma segura em vez de `NaN`.
|
||||
- **Metadados de modelos** — identidade de provider/modelo vem do Pi; o catálogo OpenRouter local é usado apenas como enriquecimento de detalhes.
|
||||
- **Painel de Skills** — skills reais são lidas do prompt efetivo do Pi e agrupadas por origem: global, project, package e other.
|
||||
- **Painel MCP** — lê servidores MCP configurados em arquivos locais/globais e mostra transporte, comando, URL, lifecycle, direct tools e origem.
|
||||
- **Slash commands do Pi** — `/api/commands/list` expõe comandos built-in do Pi e comandos dinâmicos de extensões, prompts e skills.
|
||||
- **Anexos multimodais** — suporte visual a arquivos/imagens/PDF/áudio/vídeo conforme as capacidades do modelo selecionado.
|
||||
- **Terminal e arquivos** — terminal integrado, explorador de arquivos, syntax highlighting, componentes de diff e integração desktop via Tauri.
|
||||
- **UI keyboard-first** — command palette, atalhos configuráveis, split panes, seletor de modelo, navegação por projeto/sessão e layouts responsivos.
|
||||
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.
|
||||
|
||||
## Direção do produto
|
||||
## Como funciona
|
||||
|
||||
O PiAgentUI está caminhando para virar um app completo de agentes:
|
||||
- `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.
|
||||
|
||||
1. **Ações visuais para todos os comandos do Pi** — slash commands continuam disponíveis, mas ações frequentes devem virar botões, menus, diálogos ou painéis.
|
||||
2. **Entrada por voz e transcrição em tempo real** — gravação de microfone, deltas parciais, inserção da transcrição final no composer e configuração de provedores STT OpenAI-compatible.
|
||||
3. **Integração MCP mais profunda** — além de metadados: conectar, autenticar, inspecionar ferramentas e executar workflows MCP pela UI.
|
||||
4. **Controle completo de sessões** — fork, clone, navegação em árvore, import/export/share, branch summaries e gerenciamento de contexto como fluxos nativos.
|
||||
5. **Experiência desktop completa** — app Tauri polido com descoberta local de runtime, settings seguros, notificações e controles ricos de workspace.
|
||||
## Início rápido
|
||||
|
||||
## Roadmap de áudio e transcrição
|
||||
|
||||
O PiAgentUI já aceita anexos de áudio quando o modelo selecionado declara suporte a áudio. O sistema planejado de voz adiciona speech-to-text ao vivo diretamente no composer.
|
||||
|
||||
Arquitetura recomendada:
|
||||
|
||||
- **Provedor realtime padrão:** OpenAI Realtime Transcription com `gpt-realtime-whisper` para transcrição parcial de baixa latência.
|
||||
- **Fallback por arquivo:** OpenAI Audio Transcriptions com `gpt-4o-transcribe`, `gpt-4o-mini-transcribe` ou `whisper-1`.
|
||||
- **Provedores customizados:** APIs STT OpenAI-compatible configuráveis pelo usuário, como provedores que implementam `POST /v1/audio/transcriptions`.
|
||||
|
||||
UX planejada:
|
||||
|
||||
- botão de microfone no composer;
|
||||
- estados de gravação e permissão;
|
||||
- overlay de transcrição parcial;
|
||||
- texto final inserido no input;
|
||||
- comportamento configurável de append/replace;
|
||||
- auto-send desligado por padrão;
|
||||
- tratamento recuperável para erros de permissão, rede e provedor.
|
||||
|
||||
Exemplo de configuração de provider:
|
||||
|
||||
```json
|
||||
{
|
||||
"kind": "openai-compatible",
|
||||
"mode": "file",
|
||||
"baseUrl": "https://api.example.com/v1",
|
||||
"transcriptionEndpoint": "/audio/transcriptions",
|
||||
"transcriptionModel": "openai/whisper-large-v3",
|
||||
"language": "pt"
|
||||
}
|
||||
```
|
||||
|
||||
Suporte realtime é tratado como capability separada, porque compatibilidade HTTP com a OpenAI não garante compatibilidade WebSocket.
|
||||
|
||||
## Arquitetura
|
||||
|
||||
```text
|
||||
PiAgentUI
|
||||
├─ Frontend React/Vite
|
||||
│ ├─ chat, renderização de mensagens, input, painéis e settings
|
||||
│ ├─ stores locais para preferências de UI
|
||||
│ └─ clientes SSE/API para endpoints locais do PiAgentUI
|
||||
├─ Backend como extensão Pi
|
||||
│ └─ extensions/piagentui-server.ts
|
||||
│ ├─ expõe endpoints locais /api/*
|
||||
│ ├─ faz ponte com runtime/sessões/modelos do Pi
|
||||
│ ├─ transmite eventos do Pi para o browser
|
||||
│ └─ lê metadados locais como MCP config e skills
|
||||
└─ Runtime Pi Agent
|
||||
├─ sessões
|
||||
├─ modelos/providers
|
||||
├─ ferramentas
|
||||
├─ skills
|
||||
├─ MCP
|
||||
└─ slash commands
|
||||
```
|
||||
|
||||
A UI não deve inventar estado de runtime quando o Pi já sabe a resposta. O PiAgentUI pode cachear e enriquecer dados para UX, mas o Pi continua autoritativo para o comportamento do agente.
|
||||
|
||||
## Stack técnica
|
||||
|
||||
| Área | Stack |
|
||||
| ------------------- | -------------------------------------------- |
|
||||
| UI | React 19, TypeScript |
|
||||
| Build | Vite 8 |
|
||||
| Estilo | Tailwind CSS v4 e design tokens do projeto |
|
||||
| Desktop | Tauri 2 |
|
||||
| Markdown | Streamdown / pipeline de markdown |
|
||||
| Syntax highlighting | Shiki |
|
||||
| Terminal | xterm.js |
|
||||
| Testes | Vitest, Testing Library |
|
||||
| Backend local | Extensão Pi, Node HTTP server, WebSocket/SSE |
|
||||
|
||||
## Desenvolvimento local
|
||||
|
||||
Instalar dependências:
|
||||
| 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
|
||||
npm install
|
||||
git clone https://git.evandro.dev.br/evandro/PiAgentUI.git
|
||||
cd PiAgentUI
|
||||
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
|
||||
```
|
||||
|
||||
Iniciar o frontend em modo dev:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
Build:
|
||||
`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
|
||||
cat ~/.pi/agent/piagentui-port.json # {"port": 58785, "token": "..."}
|
||||
# abra http://127.0.0.1:58785
|
||||
```
|
||||
|
||||
Testes:
|
||||
Desktop e Android:
|
||||
|
||||
```bash
|
||||
npm run test:run
|
||||
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
|
||||
```
|
||||
|
||||
Type checks:
|
||||
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 typecheck
|
||||
npm run typecheck:extensions
|
||||
```
|
||||
## Configuração
|
||||
|
||||
Validação completa:
|
||||
A stack em containers foi herdada do deploy do OpenCodeUI. Copie `.env.example` para `.env` antes.
|
||||
|
||||
```bash
|
||||
npm run validate
|
||||
```
|
||||
| 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/`. |
|
||||
|
||||
## Runtime da extensão Pi
|
||||
<details>
|
||||
<summary>Variáveis de ambiente (só para a stack em containers)</summary>
|
||||
|
||||
O PiAgentUI é registrado como extensão Pi em `package.json`:
|
||||
| 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. |
|
||||
|
||||
```json
|
||||
{
|
||||
"pi": {
|
||||
"extensions": ["./extensions/piagentui-server.ts"]
|
||||
}
|
||||
}
|
||||
```
|
||||
</details>
|
||||
|
||||
Quando a extensão inicia, ela escreve metadados de descoberta local em:
|
||||
## Estado do projeto
|
||||
|
||||
```text
|
||||
~/.pi/agent/piagentui-port.json
|
||||
```
|
||||
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/`.
|
||||
|
||||
O app web usa a porta/token desse arquivo para falar com o servidor local da extensão. Algumas mudanças de backend exigem reiniciar ou recarregar o processo da extensão Pi antes de aparecerem no browser.
|
||||
- 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.
|
||||
|
||||
## Endpoints locais importantes
|
||||
|
||||
| Endpoint | Finalidade |
|
||||
| -------------------------------- | ----------------------------------------------------- |
|
||||
| `GET /api/models` | Lista real de modelos Pi com capacidades normalizadas |
|
||||
| `GET /api/sessions` | Lista de sessões lida dos arquivos de sessão do Pi |
|
||||
| `GET /api/sessions/:id/messages` | Histórico normalizado para renderização na UI |
|
||||
| `GET /api/sessions/:id/context` | Uso de contexto runtime para a sessão ativa |
|
||||
| `POST /api/messages/send` | Envia mensagem para a sessão Pi solicitada |
|
||||
| `GET /api/skills` | Skills efetivas do Pi agrupadas por origem |
|
||||
| `GET /api/mcp/status` | Metadados dos servidores MCP configurados |
|
||||
| `GET /api/commands/list` | Slash commands built-in e dinâmicos do Pi |
|
||||
| `GET /global/event` | Stream SSE de eventos do backend PiAgentUI |
|
||||
|
||||
## Princípios de desenvolvimento
|
||||
|
||||
- Preferir dados reais do runtime Pi em vez de estado fake só da UI.
|
||||
- Manter OpenRouter como enriquecimento de catálogo, nunca como substituto da identidade provider/modelo do Pi.
|
||||
- Tratar valores runtime desconhecidos explicitamente.
|
||||
- Escrever testes antes de mudanças de comportamento sempre que possível.
|
||||
- Manter tool results dentro dos cards de ferramenta.
|
||||
- Seguir o sistema visual existente: tema, movimento, espaçamento e padrões de painéis.
|
||||
- Separar claramente o que está implementado do que é roadmap.
|
||||
|
||||
## Notas do repositório
|
||||
|
||||
O projeto ainda contém nomes herdados da base original OpenCodeUI em alguns pontos, incluindo metadados do pacote e documentação antiga. A direção atual é PiAgentUI-first, e uma limpeza futura deve migrar esses nomes sem quebrar os workflows locais.
|
||||
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
|
||||
|
||||
Este repositório segue a licença declarada em `package.json`: `GPL-3.0-only`.
|
||||
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 |
@@ -12,6 +12,8 @@
|
||||
|
||||
services:
|
||||
frontend:
|
||||
# Imagem do upstream: ghcr.io/evandrodevbr/opencodeui-frontend ainda não foi publicada
|
||||
# (docker-frontend.yml falha desde 2026-06-01). Para build local use docker-compose.build.yml.
|
||||
image: ghcr.io/lehhair/opencodeui-frontend:latest
|
||||
container_name: opencodeui
|
||||
restart: unless-stopped
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
services:
|
||||
# ---- 统一入口:网关 ----
|
||||
gateway:
|
||||
image: ghcr.io/lehhair/opencodeui-gateway:latest
|
||||
image: ghcr.io/evandrodevbr/opencodeui-gateway:latest
|
||||
container_name: opencode-gateway
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
@@ -46,6 +46,8 @@ services:
|
||||
|
||||
# ---- 前端:预构建镜像 ----
|
||||
frontend:
|
||||
# A imagem do próprio namespace ainda não existe (docker-frontend.yml falha desde 2026-06-01);
|
||||
# mantém a do upstream até o workflow publicar ghcr.io/evandrodevbr/opencodeui-frontend.
|
||||
image: ghcr.io/lehhair/opencodeui-frontend:latest
|
||||
container_name: opencode-frontend
|
||||
restart: unless-stopped
|
||||
@@ -54,7 +56,7 @@ services:
|
||||
|
||||
# ---- 后端:预构建镜像 ----
|
||||
backend:
|
||||
image: ghcr.io/lehhair/opencodeui-backend:latest
|
||||
image: ghcr.io/evandrodevbr/opencodeui-backend:latest
|
||||
container_name: opencode-backend
|
||||
restart: unless-stopped
|
||||
deploy:
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { describe, it, expect, vi } from 'vitest'
|
||||
import * as os from 'node:os'
|
||||
|
||||
vi.mock('node:os', async importOriginal => ({
|
||||
...(await importOriginal<typeof import('node:os')>()),
|
||||
networkInterfaces: vi.fn().mockReturnValue({}),
|
||||
}))
|
||||
import {
|
||||
isLoopbackHost,
|
||||
validateBearerToken,
|
||||
@@ -8,9 +14,47 @@ import {
|
||||
isRequestBodySizeAllowed,
|
||||
getLocalNetworkUrls,
|
||||
validateSttBaseUrl,
|
||||
sendInternalServerError,
|
||||
} from './piagentui-server-core.js'
|
||||
|
||||
describe('PiAgentUi Server Core Security Helpers', () => {
|
||||
describe('sendInternalServerError', () => {
|
||||
const response = () => ({
|
||||
headersSent: false,
|
||||
writableEnded: false,
|
||||
destroyed: false,
|
||||
writeHead: vi.fn(),
|
||||
end: vi.fn(),
|
||||
destroy: vi.fn(),
|
||||
})
|
||||
|
||||
it('sends a JSON error when the response has not started', () => {
|
||||
const res = response()
|
||||
sendInternalServerError(res)
|
||||
expect(res.writeHead).toHaveBeenCalledWith(500, { 'Content-Type': 'application/json' })
|
||||
expect(res.end).toHaveBeenCalledWith('{"error":"Internal Server Error"}')
|
||||
expect(res.destroy).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('closes a partial response without writing another header', () => {
|
||||
const res = { ...response(), headersSent: true }
|
||||
sendInternalServerError(res)
|
||||
expect(res.destroy).toHaveBeenCalledOnce()
|
||||
expect(res.writeHead).not.toHaveBeenCalled()
|
||||
expect(res.end).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('leaves completed and destroyed responses alone', () => {
|
||||
for (const state of [{ writableEnded: true }, { destroyed: true }]) {
|
||||
const res = { ...response(), ...state }
|
||||
sendInternalServerError(res)
|
||||
expect(res.writeHead).not.toHaveBeenCalled()
|
||||
expect(res.end).not.toHaveBeenCalled()
|
||||
expect(res.destroy).not.toHaveBeenCalled()
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
describe('isLoopbackHost', () => {
|
||||
it('should accept loopback hostnames and IPs', () => {
|
||||
expect(isLoopbackHost('localhost')).toBe(true)
|
||||
@@ -84,6 +128,12 @@ describe('PiAgentUi Server Core Security Helpers', () => {
|
||||
})
|
||||
|
||||
describe('getLocalNetworkUrls', () => {
|
||||
it('preserves local access when network enumeration is unavailable', () => {
|
||||
vi.mocked(os.networkInterfaces).mockImplementationOnce(() => {
|
||||
throw new Error('network enumeration denied')
|
||||
})
|
||||
expect(getLocalNetworkUrls(58785)).toEqual([])
|
||||
})
|
||||
it('should build LAN URLs from non-internal IPv4 interfaces', () => {
|
||||
const urls = getLocalNetworkUrls(58785, {
|
||||
WiFi: [
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
import * as path from 'node:path'
|
||||
import * as os from 'node:os'
|
||||
import type { ServerResponse } from 'node:http'
|
||||
|
||||
/** Finish a failed request without sending headers twice or leaving a partial response open. */
|
||||
export function sendInternalServerError(
|
||||
response: Pick<ServerResponse, 'headersSent' | 'writableEnded' | 'destroyed' | 'writeHead' | 'end' | 'destroy'>,
|
||||
): void {
|
||||
if (response.writableEnded || response.destroyed) return
|
||||
if (response.headersSent) {
|
||||
response.destroy()
|
||||
return
|
||||
}
|
||||
response.writeHead(500, { 'Content-Type': 'application/json' })
|
||||
response.end(JSON.stringify({ error: 'Internal Server Error' }))
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a host string matches a loopback host (localhost or 127.0.0.1 or ::1)
|
||||
@@ -123,10 +137,15 @@ export function validateHostAndOriginForAccess(
|
||||
return true
|
||||
}
|
||||
|
||||
export function getLocalNetworkUrls(
|
||||
port: number,
|
||||
interfaces: NodeJS.Dict<os.NetworkInterfaceInfo[]> = os.networkInterfaces(),
|
||||
): string[] {
|
||||
export function getLocalNetworkUrls(port: number, interfaces?: NodeJS.Dict<os.NetworkInterfaceInfo[]>): string[] {
|
||||
if (!interfaces) {
|
||||
try {
|
||||
interfaces = os.networkInterfaces()
|
||||
} catch {
|
||||
// LAN discovery is best effort; local API access still works without it.
|
||||
return []
|
||||
}
|
||||
}
|
||||
const physicalUrls = new Set<string>()
|
||||
const fallbackUrls = new Set<string>()
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
isRequestBodySizeAllowed,
|
||||
getLocalNetworkUrls,
|
||||
validateSttBaseUrl,
|
||||
sendInternalServerError,
|
||||
} from './piagentui-server-core.js'
|
||||
import {
|
||||
createPiAgentUiSettingsStore,
|
||||
@@ -2075,8 +2076,7 @@ export default function (pi: ExtensionAPI) {
|
||||
const urlPath = req.url || ''
|
||||
if (urlPath.startsWith('/api/') || urlPath.startsWith('/global/')) {
|
||||
handleApiRequest(req, res).catch(() => {
|
||||
res.writeHead(500, { 'Content-Type': 'application/json' })
|
||||
res.end(JSON.stringify({ error: 'Internal Server Error' }))
|
||||
sendInternalServerError(res)
|
||||
})
|
||||
} else {
|
||||
handleStaticFile(req, res, urlPath)
|
||||
|
||||
@@ -2,13 +2,16 @@
|
||||
"name": "piagentui",
|
||||
"version": "0.6.10",
|
||||
"description": "Professional AI Agent Desktop & Web UI — sessions, MCP tools, skills browser, voice input, terminal, file explorer, and Tauri desktop app. Works with Pi Agent, Claude Code, Codex, OpenCode, Cursor, and any SSE-compatible agent.",
|
||||
"homepage": "https://github.com/lehhair/OpenCodeUI",
|
||||
"homepage": "https://github.com/evandrodevbr/PiAgentUI",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/lehhair/OpenCodeUI.git"
|
||||
"url": "git+https://github.com/evandrodevbr/PiAgentUI.git"
|
||||
},
|
||||
"license": "GPL-3.0-only",
|
||||
"type": "module",
|
||||
"engines": {
|
||||
"node": ">=22"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"typecheck": "tsc -b",
|
||||
@@ -21,9 +24,9 @@
|
||||
"format:check": "prettier . --check",
|
||||
"test": "vitest",
|
||||
"test:run": "vitest run",
|
||||
"validate": "npm run typecheck && npm run typecheck:extensions && npm run lint && npm run test:run && npm run build",
|
||||
"validate": "npm run typecheck && npm run typecheck:extensions && npm run lint && npm run build && npm run test:run",
|
||||
"release:prepare": "node scripts/prepare-release.mjs",
|
||||
"check": "npm run format:check && npm run lint && npm run test:run && npm run build",
|
||||
"check": "npm run format:check && npm run lint && npm run build && npm run test:run",
|
||||
"preview": "vite preview",
|
||||
"tauri": "tauri",
|
||||
"postinstall": "node scripts/copy-material-icons.mjs"
|
||||
@@ -61,6 +64,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.39.4",
|
||||
"@mariozechner/pi-coding-agent": "^0.73.1",
|
||||
"@tailwindcss/vite": "^4.2.2",
|
||||
"@tauri-apps/cli": "^2.10.0",
|
||||
"@testing-library/jest-dom": "^6.9.1",
|
||||
|
||||
@@ -1 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#ff6e40" d="M2 1a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h2v-1H2V2h2V1Zm10 0v1h2v12h-2v1h2a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1ZM6 3c0 1 0 1-1 1v1h1v2h1V3Zm3 0a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h1a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1Zm0 1h1v2H9ZM6 9a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h1a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1Zm4 0c0 1 0 1-1 1v1h1v2h1V9Zm-4 1h1v2H6Z"/></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#ff6e40" d="M8 6V2H4a2 2 0 0 0-2 2v24a2 2 0 0 0 2 2h4v-4H4V6Zm16-4v4h4v20h-4v4h4a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2Zm-4 4h-2a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2m-2 6V8h2v4Zm-4 6h-2a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2m-2 6v-4h2v4Zm0-18c0 2 0 2-2 2v2h2v4h2V6Zm8 12c0 2 0 2-2 2v2h2v4h2v-8Z"/></svg>
|
||||
|
Before Width: | Height: | Size: 404 B After Width: | Height: | Size: 415 B |
@@ -1 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#ffca28" d="M14.483 6H4.721a1 1 0 0 0-.949.684L2 12V5h12a1 1 0 0 0-1-1H7.562a1 1 0 0 1-.64-.232l-.644-.536A1 1 0 0 0 5.638 3H2a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h11l2.403-5.606A1 1 0 0 0 14.483 6"/><path fill="#ffecb3" d="M12 5a4 2 0 0 0-4 2 4 2 0 0 0 4 2 4 2 0 0 0 4-2 4 2 0 0 0-4-2M8 8v2c0 1.105 1.791 2 4 2s4-.895 4-2V8c0 1.105-1.791 2-4 2s-4-.895-4-2m0 3v2c0 1.105 1.791 2 4 2s4-.895 4-2v-2c0 1.105-1.791 2-4 2s-4-.895-4-2"/></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#ffca28" d="M28.967 12H9.442a2 2 0 0 0-1.898 1.368L4 24V10h24a2 2 0 0 0-2-2H15.124a2 2 0 0 1-1.28-.464l-1.288-1.072A2 2 0 0 0 11.276 6H4a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h22l4.805-11.212A2 2 0 0 0 28.967 12"/><ellipse cx="24" cy="14" fill="#ffecb3" rx="8" ry="4"/><path fill="#ffecb3" d="M24 26c-4.418 0-8-1.79-8-4v4c0 2.21 3.582 4 8 4s8-1.79 8-4v-4c0 2.21-3.582 4-8 4"/><path fill="#ffecb3" d="M24 20c-4.418 0-8-1.79-8-4v4c0 2.21 3.582 4 8 4s8-1.79 8-4v-4c0 2.21-3.582 4-8 4"/></svg>
|
||||
|
Before Width: | Height: | Size: 502 B After Width: | Height: | Size: 553 B |
@@ -1 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#ffca28" d="m6.922 3.768-.644-.536A1 1 0 0 0 5.638 3H2a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1H7.562a1 1 0 0 1-.64-.232"/><path fill="#ffecb3" d="M12 5a4 2 0 0 0-4 2 4 2 0 0 0 4 2 4 2 0 0 0 4-2 4 2 0 0 0-4-2M8 8v2c0 1.105 1.791 2 4 2s4-.895 4-2V8c0 1.105-1.791 2-4 2s-4-.895-4-2m0 3v2c0 1.105 1.791 2 4 2s4-.895 4-2v-2c0 1.105-1.791 2-4 2s-4-.895-4-2"/></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#ffca28" d="m13.844 7.536-1.288-1.072A2 2 0 0 0 11.276 6H4a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h24a2 2 0 0 0 2-2V10a2 2 0 0 0-2-2H15.124a2 2 0 0 1-1.28-.464"/><ellipse cx="24" cy="14" fill="#ffecb3" rx="8" ry="4"/><path fill="#ffecb3" d="M24 26c-4.418 0-8-1.79-8-4v4c0 2.21 3.582 4 8 4s8-1.79 8-4v-4c0 2.21-3.582 4-8 4"/><path fill="#ffecb3" d="M24 20c-4.418 0-8-1.79-8-4v4c0 2.21 3.582 4 8 4s8-1.79 8-4v-4c0 2.21-3.582 4-8 4"/></svg>
|
||||
|
Before Width: | Height: | Size: 454 B After Width: | Height: | Size: 500 B |
@@ -4,7 +4,7 @@ version = "0.6.10"
|
||||
description = "Pi Agent UI - Tauri Desktop & Mobile App"
|
||||
authors = ["lehhair"]
|
||||
license = "GPL-3.0-only"
|
||||
repository = ""
|
||||
repository = "https://github.com/evandrodevbr/PiAgentUI"
|
||||
edition = "2021"
|
||||
rust-version = "1.85.0"
|
||||
|
||||
|
||||
@@ -9,6 +9,35 @@ vi.mock('../store', () => ({
|
||||
}))
|
||||
|
||||
describe('useSessionStats', () => {
|
||||
it('does not scan message text when actual usage is available', () => {
|
||||
const readText = vi.fn(() => 'large historical message')
|
||||
useMessageStoreMock.mockReturnValue({
|
||||
messages: [
|
||||
{
|
||||
info: {
|
||||
role: 'assistant',
|
||||
cost: 0,
|
||||
tokens: { input: 10, output: 5, reasoning: 0, cache: { read: 0, write: 0 } },
|
||||
},
|
||||
parts: [
|
||||
{
|
||||
type: 'text',
|
||||
get text() {
|
||||
return readText()
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
const { result } = renderHook(() => useSessionStats(100))
|
||||
|
||||
expect(result.current.contextUsed).toBe(15)
|
||||
expect(result.current.contextEstimated).toBe(false)
|
||||
expect(readText).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('switches to estimated context after a compaction turn', () => {
|
||||
useMessageStoreMock.mockReturnValue({
|
||||
messages: [
|
||||
|
||||
@@ -235,13 +235,12 @@ export function useSessionStats(
|
||||
}
|
||||
}
|
||||
|
||||
const totalOrEstimatedContext = estimateCurrentContext(messages)
|
||||
const contextEstimated = shouldUseEstimatedContext(messages, lastAssistantWithTokensIndex, lastAssistantWithTokens)
|
||||
const rawContextUsed = contextEstimated
|
||||
? totalOrEstimatedContext
|
||||
? estimateCurrentContext(messages)
|
||||
: lastAssistantWithTokens
|
||||
? tokenTotal(lastAssistantWithTokens.tokens)
|
||||
: totalOrEstimatedContext
|
||||
: estimateCurrentContext(messages)
|
||||
const contextUsed = Number.isFinite(rawContextUsed) ? rawContextUsed : 0
|
||||
const rawContextPercent = contextLimit > 0 ? (contextUsed / contextLimit) * 100 : 0
|
||||
const contextPercent = Number.isFinite(rawContextPercent) ? Math.min(100, Math.max(0, rawContextPercent)) : 0
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { saveData } from './downloadUtils'
|
||||
|
||||
vi.mock('./tauri', () => ({ isTauri: () => false }))
|
||||
|
||||
describe('browser file downloads', () => {
|
||||
beforeEach(() => {
|
||||
vi.spyOn(HTMLAnchorElement.prototype, 'click').mockImplementation(() => {})
|
||||
vi.stubGlobal('URL', { createObjectURL: vi.fn(() => 'blob:test'), revokeObjectURL: vi.fn() })
|
||||
})
|
||||
|
||||
it('downloads exactly the requested byte view without surrounding buffer contents', async () => {
|
||||
const bytes = new Uint8Array([11, 22, 33, 44, 55])
|
||||
saveData(bytes.subarray(1, 4), 'slice.bin')
|
||||
|
||||
const blob = vi.mocked(URL.createObjectURL).mock.calls[0][0] as Blob
|
||||
const contents = await new Promise<ArrayBuffer>((resolve, reject) => {
|
||||
const reader = new FileReader()
|
||||
reader.onload = () => resolve(reader.result as ArrayBuffer)
|
||||
reader.onerror = reject
|
||||
reader.readAsArrayBuffer(blob)
|
||||
})
|
||||
expect([...new Uint8Array(contents)]).toEqual([22, 33, 44])
|
||||
expect(blob.type).toBe('application/octet-stream')
|
||||
})
|
||||
})
|
||||
@@ -73,9 +73,7 @@ export function downloadFileContent(content: FileContent, fileName: string): voi
|
||||
const encoding = content.encoding || ''
|
||||
const textContent = content.content || ''
|
||||
// 统一转为 Uint8Array
|
||||
const data = isBinaryContent(encoding)
|
||||
? base64ToBytes(textContent)
|
||||
: new TextEncoder().encode(textContent)
|
||||
const data = isBinaryContent(encoding) ? base64ToBytes(textContent) : new TextEncoder().encode(textContent)
|
||||
|
||||
const mimeType = isBinaryContent(encoding)
|
||||
? content.mimeType || 'application/octet-stream'
|
||||
@@ -95,7 +93,8 @@ export function saveData(data: Uint8Array, fileName: string, mimeType = 'applica
|
||||
console.warn('[downloadUtils] Tauri save failed:', err)
|
||||
})
|
||||
} else {
|
||||
const blob = new Blob([data.buffer as ArrayBuffer], { type: mimeType })
|
||||
// A view may cover only part of its backing buffer (for example, a file chunk).
|
||||
const blob = new Blob([new Uint8Array(data)], { type: mimeType })
|
||||
triggerBrowserDownload(blob, fileName)
|
||||
}
|
||||
}
|
||||