mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 20:34:18 +01:00
feat: add assistant mode, SSE streaming, and OpenCode server integration (#214)
This commit is contained in:
1 parent
3cc24288a6
commit
c3d6549f01
133 files changed
+7284
-6293
No files matched your search
@@ -126,7 +126,6 @@ The container entrypoint (`scripts/docker-entrypoint.sh`) automatically:
|
||||
2. **Verifies OpenCode** is installed (installed at build time, fallback install if missing)
|
||||
3. **Upgrades OpenCode** if below minimum version (1.0.137)
|
||||
4. **Validates AUTH_SECRET** is set (required for startup)
|
||||
5. **Validates memory plugin** installation (installed from npm during Docker build)
|
||||
|
||||
## Port Configuration
|
||||
|
||||
@@ -387,3 +386,44 @@ docker exec -it opencode-manager vi /workspace/.config/opencode/AGENTS.md
|
||||
### Precedence
|
||||
|
||||
Global instructions merge with repository-specific `AGENTS.md` files. Repository instructions take precedence.
|
||||
|
||||
## Exposing the OpenCode Server (Advanced)
|
||||
|
||||
By default, the OpenCode server binds to `127.0.0.1` inside the container and is **not reachable from outside the container**. This is the correct and safe default for nearly all users.
|
||||
|
||||
### When to Expose Externally
|
||||
|
||||
You only need to expose the OpenCode server on an external interface if you have a specific use case that requires other services or machines to connect directly to it.
|
||||
|
||||
### How to Expose Safely
|
||||
|
||||
To expose the OpenCode server on the host network:
|
||||
|
||||
1. **Set `OPENCODE_HOST=0.0.0.0`** in your environment
|
||||
2. **Add port `5551:5551`** to the compose ports
|
||||
3. **Set `OPENCODE_SERVER_PASSWORD`** — this is **required**; the managed OpenCode server will refuse to start without it
|
||||
|
||||
Example compose override:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
app:
|
||||
ports:
|
||||
- "5551:5551"
|
||||
environment:
|
||||
- OPENCODE_HOST=0.0.0.0
|
||||
- OPENCODE_SERVER_PASSWORD=${OPENCODE_SERVER_PASSWORD:?Set OPENCODE_SERVER_PASSWORD before exposing OpenCode on port 5551}
|
||||
```
|
||||
|
||||
### Password Configuration
|
||||
|
||||
The password can be configured in two ways:
|
||||
|
||||
1. **Environment variable:** Set `OPENCODE_SERVER_PASSWORD` in your `.env` file or compose environment
|
||||
2. **Via UI:** Use Settings → OpenCode → Server Auth to set a password at runtime
|
||||
|
||||
**DB-stored passwords take precedence over the environment variable.** If you set a password via the UI, it will override the env var.
|
||||
|
||||
### Startup Guard
|
||||
|
||||
If you set `OPENCODE_HOST=0.0.0.0` (or any non-localhost host) without configuring a password (either via env var or UI), the managed OpenCode server will refuse to start with an error message explaining how to fix it. The OpenCode Manager UI/API may remain available so you can configure a password and restart the managed server.
|
||||
@@ -94,6 +94,8 @@ When configured, users can enable push notifications in Settings → Notificatio
|
||||
|----------|-------------|---------|
|
||||
| `OPENCODE_SERVER_PORT` | Port for the OpenCode CLI server | `5551` |
|
||||
| `OPENCODE_HOST` | OpenCode server bind address | `127.0.0.1` |
|
||||
| `OPENCODE_SERVER_PASSWORD` | Basic Auth password required when binding OpenCode to a non-loopback host. Can also be set via UI (Settings → OpenCode → Server Auth). DB-stored passwords override this env var. | - |
|
||||
| `OPENCODE_SERVER_USERNAME` | Basic Auth username | `opencode` |
|
||||
|
||||
## Timeouts
|
||||
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
# Assistant Internal API
|
||||
|
||||
The Assistant Internal API provides capabilities for OpenCode agents to interact with the manager backend via a secure bearer-token API.
|
||||
|
||||
## Authentication
|
||||
|
||||
All endpoints require a bearer token. The token can be found at:
|
||||
- `.opencode/internal-token` (relative to the assistant workspace cwd)
|
||||
|
||||
Include the token in requests:
|
||||
```
|
||||
Authorization: Bearer <token>
|
||||
```
|
||||
|
||||
## Endpoints
|
||||
|
||||
### Notifications
|
||||
|
||||
**POST `/api/internal/notifications/send`**
|
||||
|
||||
Send push notifications to the user's registered devices.
|
||||
|
||||
**Request Body:**
|
||||
```ts
|
||||
{
|
||||
title: string // 1-120 characters
|
||||
body: string // 1-500 characters
|
||||
url?: string // Optional: deep link (1-500 chars)
|
||||
tag?: string // Optional: notification tag (max 80 chars)
|
||||
priority?: 'normal' | 'high'
|
||||
}
|
||||
```
|
||||
|
||||
**Query Parameters:**
|
||||
- `userId` (optional): Defaults to `"default"`
|
||||
|
||||
**Response:**
|
||||
```ts
|
||||
{
|
||||
delivered: number
|
||||
expired: number
|
||||
failed: number
|
||||
noSubscriptions: boolean
|
||||
}
|
||||
```
|
||||
|
||||
**Rate Limiting:** 10 requests per minute per token. Returns `429 Too Many Requests` with `Retry-After` header when exceeded.
|
||||
|
||||
**Status Codes:**
|
||||
- `200`: Notification sent
|
||||
- `400`: Invalid request body
|
||||
- `401`: Missing or invalid bearer token
|
||||
- `429`: Rate limit exceeded
|
||||
- `503`: Push notifications not configured (missing VAPID)
|
||||
|
||||
### Settings
|
||||
|
||||
**GET `/api/internal/settings`**
|
||||
|
||||
Retrieve the user's full settings and preferences.
|
||||
|
||||
**Query Parameters:**
|
||||
- `userId` (optional): Defaults to `"default"`
|
||||
|
||||
**Response:**
|
||||
```ts
|
||||
{
|
||||
preferences: {
|
||||
theme: 'dark' | 'light' | 'system',
|
||||
mode: 'plan' | 'build',
|
||||
defaultModel?: string,
|
||||
defaultAgent?: string,
|
||||
autoScroll: boolean,
|
||||
expandDiffs: boolean,
|
||||
expandToolCalls: boolean,
|
||||
showReasoning: boolean,
|
||||
simpleChatMode: boolean,
|
||||
leaderKey?: string,
|
||||
directShortcuts?: string[],
|
||||
keyboardShortcuts: Record<string, string>,
|
||||
customCommands: Array<{ name: string; description: string; promptTemplate: string }>,
|
||||
notifications?: { enabled: boolean; ... },
|
||||
repoOrder?: number[],
|
||||
repoSortMode: 'recent' | 'manual' | 'name',
|
||||
gitCredentials?: [...], // Read-only
|
||||
gitIdentity?: {...}, // Read-only
|
||||
tts?: {...}, // Read-only
|
||||
stt?: {...}, // Read-only
|
||||
},
|
||||
updatedAt: number
|
||||
}
|
||||
```
|
||||
|
||||
**PATCH `/api/internal/settings`**
|
||||
|
||||
Update a subset of safe user preferences.
|
||||
|
||||
**Allowed Keys:**
|
||||
The following preference keys can be modified:
|
||||
- `theme`, `mode`, `defaultModel`, `defaultAgent`
|
||||
- `autoScroll`, `expandDiffs`, `expandToolCalls`, `showReasoning`
|
||||
- `simpleChatMode`, `leaderKey`, `directShortcuts`
|
||||
- `keyboardShortcuts`, `customCommands`, `notifications`
|
||||
- `repoOrder`, `repoSortMode`
|
||||
|
||||
**Restricted Keys:**
|
||||
The following keys are **NOT** allowed and will be rejected:
|
||||
- `gitCredentials` - Git credentials must be managed via the full UI
|
||||
- `gitIdentity` - Git identity must be managed via the full UI
|
||||
- `tts.apiKey` - TTS credentials must be managed via the full UI
|
||||
- `stt.apiKey` - STT credentials must be managed via the full UI
|
||||
- `lastKnownGoodConfig` - Internal state, do not modify
|
||||
|
||||
**Request Body:**
|
||||
Partial object with any of the allowed keys.
|
||||
|
||||
**Response:**
|
||||
Returns the updated settings object.
|
||||
|
||||
**Status Codes:**
|
||||
- `200`: Settings updated
|
||||
- `400`: Invalid request body or disallowed key
|
||||
- `401`: Missing or invalid bearer token
|
||||
|
||||
## Skills
|
||||
|
||||
The assistant workspace includes three skills that document these capabilities:
|
||||
|
||||
1. **Schedule Management** (`.opencode/skills/schedule-management/SKILL.md`)
|
||||
2. **Notifications** (`.opencode/skills/notifications/SKILL.md`)
|
||||
3. **Manager Settings** (`.opencode/skills/manager-settings/SKILL.md`)
|
||||
|
||||
These skills are automatically provisioned when assistant mode is initialized and contain detailed examples and usage patterns.
|
||||
@@ -1,74 +0,0 @@
|
||||
# Memory Plugin
|
||||
|
||||
`@opencode-manager/memory` is an **optional** OpenCode plugin that stores and recalls project knowledge across sessions using vector embeddings and semantic search.
|
||||
|
||||
[](https://www.npmjs.com/package/@opencode-manager/memory)
|
||||
|
||||
!!! note "Not Required"
|
||||
This plugin is entirely optional. OpenCode Manager works fully without it — install it only if you want persistent project knowledge and semantic search capabilities.
|
||||
|
||||
!!! tip "Works with Standalone OpenCode"
|
||||
This plugin can also be used with standalone OpenCode installations outside of OpenCode Manager. Simply install the package and add it to your `opencode.json` plugins array.
|
||||
|
||||
!!! info "Standalone Repository"
|
||||
The memory plugin has moved to its own repository. For complete documentation including configuration, tools, agents, CLI reference, loops, and Docker sandbox, visit the **[opencode-memory repository](https://github.com/chriswritescode-dev/opencode-memory)**.
|
||||
|
||||
---
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
pnpm add @opencode-manager/memory
|
||||
```
|
||||
|
||||
Register the plugin in your `opencode.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"plugin": ["@opencode-manager/memory"]
|
||||
}
|
||||
```
|
||||
|
||||
The local embedding model downloads automatically on install. For API-based embeddings (OpenAI or Voyage), see the [configuration reference](https://github.com/chriswritescode-dev/opencode-memory#configuration).
|
||||
|
||||
---
|
||||
|
||||
## Features
|
||||
|
||||
- **Semantic Memory Search** — Store and retrieve project memories using vector embeddings
|
||||
- **Multiple Memory Scopes** — Categorize memories as convention, decision, or context
|
||||
- **Automatic Deduplication** — Prevents duplicates via exact match and semantic similarity
|
||||
- **Compaction Context Injection** — Injects conventions and decisions into session compaction
|
||||
- **Automatic Memory Injection** — Injects relevant memories into user messages via semantic search
|
||||
- **Project KV Store** — Ephemeral key-value storage with TTL management
|
||||
- **Bundled Agents** — Code, Architect, Auditor, and Librarian agents preconfigured for memory-aware workflows
|
||||
- **CLI Tools** — Export, import, list, stats, cleanup, upgrade, status, and cancel via `ocm-mem`
|
||||
- **Iterative Development Loops** — Autonomous coding/auditing loop with worktree isolation and session rotation
|
||||
- **Docker Sandbox** — Run loops inside isolated Docker containers
|
||||
- **TUI Sidebar** — Monitor loops and memory status directly in the OpenCode terminal interface
|
||||
|
||||
---
|
||||
|
||||
## Configuration
|
||||
|
||||
The plugin configuration lives at `~/.config/opencode/memory-config.jsonc`. It is created automatically on first run.
|
||||
|
||||
For the full configuration reference including embedding providers, loop settings, sandbox options, and more, see the [standalone repository README](https://github.com/chriswritescode-dev/opencode-memory#configuration).
|
||||
|
||||
---
|
||||
|
||||
## OpenCode Manager Integration
|
||||
|
||||
When the memory plugin is installed, OpenCode Manager's web UI provides:
|
||||
|
||||
- **Memory Browser** — View, search, create, edit, and delete project memories
|
||||
- **Loop Status** — Monitor active development loops and their progress
|
||||
- **Plugin Configuration** — Enable/disable the plugin and adjust settings
|
||||
- **KV Store Viewer** — Browse ephemeral key-value entries
|
||||
|
||||
---
|
||||
|
||||
## Links
|
||||
|
||||
- **GitHub**: [chriswritescode-dev/opencode-memory](https://github.com/chriswritescode-dev/opencode-memory)
|
||||
- **npm**: [@opencode-manager/memory](https://www.npmjs.com/package/@opencode-manager/memory)
|
||||
@@ -61,15 +61,6 @@ OpenCode Manager provides a comprehensive web interface for managing OpenCode AI
|
||||
|
||||
[Learn more →](mcp.md)
|
||||
|
||||
### Memory Plugin (Optional)
|
||||
|
||||
- Semantic Search — Store and retrieve project knowledge using vector embeddings
|
||||
- Memory Scopes — Categorize as convention, decision, or context
|
||||
- Iterative Development Loops — Autonomous coding/auditing with worktree isolation
|
||||
- Bundled Agents — Code, Architect, Librarian, and Auditor agents
|
||||
|
||||
[Learn more →](memory.md) | [Full documentation →](https://github.com/chriswritescode-dev/opencode-memory)
|
||||
|
||||
### Text-to-Speech
|
||||
|
||||
- **Browser TTS** - Built-in Web Speech API support
|
||||
|
||||
+35
-21
@@ -2,7 +2,6 @@
|
||||
|
||||
Mobile-first web interface for [OpenCode](https://opencode.ai) AI agents. Manage, control, and code from any device - your phone, tablet, or desktop.
|
||||
|
||||
<!-- Replace with your hero GIF -->
|
||||

|
||||
|
||||
## Quick Start
|
||||
@@ -19,37 +18,52 @@ Open [http://localhost:5003](http://localhost:5003) and create your admin accoun
|
||||
|
||||
## What is OpenCode Manager?
|
||||
|
||||
OpenCode Manager provides a web-based interface for OpenCode AI agents, allowing you to:
|
||||
OpenCode Manager is a mobile-first web interface for [OpenCode](https://opencode.ai) AI agents. It combines repository management, chat/session control, Git and file tools, schedules, AI configuration, MCP server management, push notifications, and full PWA support into a single responsive application.
|
||||
|
||||
- **Manage repositories** - Clone repos or discover existing local repos from a parent folder
|
||||
- **Chat with AI** - Real-time streaming chat with file mentions and slash commands
|
||||
- **Run recurring jobs** - Schedule repo reviews, health checks, and other reusable prompts
|
||||
- **View diffs** - See code changes with syntax highlighting
|
||||
- **Control from anywhere** - Mobile-first PWA with push notifications
|
||||
- **Configure AI** - Manage models, providers, and MCP servers
|
||||
- **Repository management** — Clone, discover, and manage multiple Git repos with SSH authentication and worktree support
|
||||
- **Chat & sessions** — Real-time SSE streaming with slash commands, `@file` mentions, and Plan/Build modes
|
||||
- **Schedules** — Recurring repo jobs with reusable prompts, run history, and linked sessions
|
||||
- **AI configuration** — Model/provider setup, OAuth for Anthropic/GitHub Copilot, custom agents
|
||||
- **MCP & Skills** — MCP server management and skill support
|
||||
- **Audio** — Text-to-speech and speech-to-text (browser + OpenAI-compatible)
|
||||
- **Mobile & notifications** — Installable PWA with push notifications and mobile-first navigation
|
||||
|
||||
## How It Works
|
||||
|
||||
OpenCode Manager runs as a pnpm workspace:
|
||||
|
||||
- The Bun/Hono backend initializes SQLite, Better Auth, settings, schedules, notifications, and an OpenCode client.
|
||||
- A supervised OpenCode server handles agent sessions while the backend proxies API calls and streams events over SSE.
|
||||
- The React/Vite frontend uses React Router and TanStack Query to render repositories, sessions, schedules, settings, and mobile navigation.
|
||||
- The shared package keeps config, schemas, and TypeScript types aligned between backend and frontend.
|
||||
|
||||
## Key Features
|
||||
|
||||
- **Multi-Repository Support** - Clone repos, discover local repo folders, and reconnect existing OpenCode chats
|
||||
- **Git Integration** - View diffs, manage branches, create PRs directly from the UI
|
||||
- **Real-time Chat** - Stream responses with file mentions and custom slash commands
|
||||
- **Scheduled Repo Jobs** - Run recurring prompts with linked sessions, logs, and reviewable output
|
||||
- **Mobile-First PWA** - Install as an app on any device with push notifications
|
||||
- **Push Notifications** - Get background alerts for agent events when app is closed
|
||||
- **AI Configuration** - Configure models, providers, OAuth, and custom agents
|
||||
- **MCP Servers** - Add local or remote MCP servers with OAuth support
|
||||
- **Memory Plugin (Optional)** — Persistent project knowledge with semantic search ([GitHub](https://github.com/chriswritescode-dev/opencode-memory))
|
||||
- **Repositories & Git** — Multi-repo management, local discovery, SSH auth, worktrees, unified diffs, branch/commit management — [Learn more](features/git.md)
|
||||
- **Chat & Sessions** — Real-time SSE streaming, slash commands, `@file` mentions, Plan/Build modes, Mermaid diagrams — [Learn more](features/chat.md)
|
||||
- **Files** — Directory browser with tree view, syntax highlighting, create/rename/delete, ZIP download — [Learn more](features/files.md)
|
||||
- **Schedules** — Recurring repo jobs with reusable prompts, run history, linked sessions — [Learn more](features/schedules.md)
|
||||
- **AI Configuration** — Model/provider setup, OAuth for Anthropic/GitHub Copilot, custom agents — [Learn more](features/ai-config.md)
|
||||
- **MCP Servers** — Add local or remote MCP servers with OAuth support — [Learn more](features/mcp.md)
|
||||
- **Skills** — Skill support for extended agent capabilities — [Learn more](features/skills.md)
|
||||
- **Mobile & PWA** — Responsive UI, installable on any device, iOS-optimized — [Learn more](features/mobile.md)
|
||||
- **Push Notifications** — Background alerts for agent events — [Learn more](features/notifications.md)
|
||||
- **Audio** — Text-to-speech and speech-to-text (browser + OpenAI-compatible) — [Learn more](features/tts.md) | [Learn more](features/stt.md)
|
||||
|
||||
!!! tip "Memory Plugin — Persistent Project Knowledge"
|
||||
Store and retrieve project knowledge across sessions using vector embeddings and semantic search. Works as a standalone plugin with any OpenCode installation.
|
||||
## Project Layout
|
||||
|
||||
**[Learn more →](features/memory.md)** | **[GitHub →](https://github.com/chriswritescode-dev/opencode-memory)**
|
||||
- `backend/` — Bun + Hono API routes, services, database migrations, auth, schedules, and OpenCode integration.
|
||||
- `frontend/` — React + Vite app, pages, components, hooks, API clients, stores, contexts, and PWA assets.
|
||||
- `shared/` — Workspace package for schemas, types, config, and utilities.
|
||||
- `docs/` — MkDocs Material documentation.
|
||||
- `scripts/`, `Dockerfile`, `docker-compose.yml` — Setup, build, and deployment support.
|
||||
|
||||
## Next Steps
|
||||
|
||||
- [Installation Guide](getting-started/installation.md) - Detailed setup instructions
|
||||
- [Quick Start](getting-started/quickstart.md) - Get up and running fast
|
||||
- [Development Setup](development/setup.md) - Local environment, scripts, and testing
|
||||
- [Contributing](development/contributing.md) - How to contribute to OpenCode Manager
|
||||
- [Features Overview](features/overview.md) - Explore all features
|
||||
- [Schedules & Recurring Jobs](features/schedules.md) - Automate recurring repo reviews and follow-ups
|
||||
- [Memory Plugin](features/memory.md) - Persistent project knowledge with semantic search ([GitHub](https://github.com/chriswritescode-dev/opencode-memory))
|
||||
- [Configuration](configuration/environment.md) - Environment variables and setup
|
||||
Reference in new issue
Block a user