feat: add assistant mode, SSE streaming, and OpenCode server integration (#214)

This commit is contained in:
Chris Scott authored and GitHub committed 2026-05-02 21:51:37 -04:00
1 parent 3cc24288a6
commit c3d6549f01
133 files changed
+7284 -6293

No files matched your search

+133
View File
@@ -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.
-74
View File
@@ -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.
[![npm](https://img.shields.io/npm/v/@opencode-manager/memory)](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)
-9
View File
@@ -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