Chris Scott 304f636516 fix: stabilize scheduled runs and background task tracking (#365)
* fix: stabilize scheduled runs and background task tracking

* fix: complete scheduled runs and harden background task status

- Route directory-less OpenCode session events (session.execution.*,
  session.usage.updated) to backend listeners by remembering each
  session's directory in the SSE aggregator, so scheduled runs finish
  and failure push notifications fire; browser delivery is unchanged.
- Resolve background shell status from the transcript completion notice
  when OpenCode no longer lists the shell, keep the first terminal
  status so a kill is not reported as completed, and share one status
  icon and colour mapping between the transcript and background bar.
- Reconcile child sessions only while unknown or running, trigger it
  from the EventProvider alone, refresh children that drop to unknown
  after a poll, and forget deleted sessions.
- Fetch the model list and default concurrently while waiting for the
  schedule model, share configured-model selection, and consolidate
  schedule startup cancellation cleanup.
- Reduce background work re-renders, prune shell exit records, remove
  dead exports, and document background work in the chat guide.

* fix: hide finished background tasks and clip long dialog titles
2026-09-28 23:55:01 -04:00
2025-11-23 22:17:21 -05:00

OpenCode Manager

Mobile-first web interface for OpenCode AI agents. Manage, control, and code from any device.

opencodemanager.app

License Stars Latest Release PRs Welcome

OpenCode Manager
Mobile view Mobile repository and session switcher

Requirements

OpenCode Manager requires OpenCode 2.x at 2.0.15 or newer (bundled 2.0.15); OpenCode 1.x is not supported. Upgrading from 1.x? See the v1 → v2 migration guide. OpenCode 2 migrates V1 session history in the background on first start, so older sessions can be incomplete until it finishes; progress is reported at GET /api/experimental/migration/v1.

Quick Start

git clone https://github.com/chriswritescode-dev/opencode-manager.git
cd opencode-manager
cp .env.example .env
echo "AUTH_SECRET=$(openssl rand -base64 32)" >> .env
docker-compose up -d
# Open http://localhost:5003

On first launch, you'll be prompted to create an admin account. That's it!

For local development setup, see the Development Guide.

Features

  • Repositories & Git — Multi-repo management, local discovery, SSH auth, worktrees, unified diffs, branch and commit management
  • Chat & Sessions — Real-time SSE streaming, slash commands, @file mentions, Plan/Build modes, Mermaid diagram rendering
  • Files — Directory browser with tree view, syntax highlighting, create/rename/delete, ZIP download
  • Assistant Mode — Dedicated AI workspace with auto-provisioned skills for schedules, notifications, settings, and repo operations
  • Schedules — Recurring repo jobs with reusable prompts, run history, linked sessions, markdown-rendered output
  • MCP Servers — Add, configure, authenticate, and manage local or remote MCP servers with OAuth support
  • AI Configuration — Model/provider setup, API keys, OAuth for Anthropic and GitHub Copilot, custom agent definitions
  • Skills — Extend agent capabilities with shareable, scoped skill definitions
  • Notifications — Push notifications for session events, questions, errors, and completions
  • Audio — Text-to-speech and speech-to-text (browser native and OpenAI-compatible APIs)
  • Themes — Light/dark/system appearance plus a color theme picker with the Manager default and 36 bundled OpenCode palettes
  • Mobile & PWA — Responsive mobile-first UI, installable on any device, iOS-optimized

Architecture

OpenCode Manager is a pnpm workspace with four TypeScript packages:

  • backend/ — Bun + Hono API server with Better Auth, SQLite migrations, OpenCode process management, SSE, schedules, and push notifications.
  • frontend/ — React + Vite SPA using React Router, TanStack Query, Radix UI/Tailwind, service worker support, and mobile-first navigation.
  • shared/ — shared Zod schemas, config helpers, types, and utilities consumed by both backend and frontend.
  • ocm-cli/ — ocm CLI that attaches your local OpenCode TUI to a repo hosted on the Manager.

A MkDocs Material site (docs/) provides guides, feature docs, configuration, and troubleshooting.

Development

This repo uses pnpm workspaces for shared, backend, frontend, and ocm-cli.

pnpm install
pnpm dev
pnpm lint
pnpm typecheck
pnpm test

See the Development Guide for local setup, scripts, database notes, and testing.

Configuration

# Required for production
AUTH_SECRET=your-secure-random-secret  # Generate with: openssl rand -base64 32

# Pre-configured admin (optional)
ADMIN_EMAIL=admin@example.com
ADMIN_PASSWORD=your-secure-password

# For LAN/remote access
AUTH_TRUSTED_ORIGINS=http://localhost:5003,https://yourl33tdomain.com
AUTH_SECURE_COOKIES=false  # Set to true when using HTTPS

For OAuth, Passkeys, Push Notifications (VAPID), and advanced configuration, see the Configuration Guide.

ocm CLI

OpenCode Manager ships an ocm CLI (from ocm-cli/) that attaches your local OpenCode TUI to a repo hosted on the Manager. It lists ready repos, attaches with opencode --server through the Manager's repo-scoped /api/opencode-proxy/repos/:repoId route (so prompts run on the Manager's filesystem against a single shared OpenCode server), and can sync the working tree up or down with ocm push / ocm pull (fast git bundle + working-tree patch by default; pass --full for the legacy tarball mirror). Running ocm inside a local clone auto-detects the matching Manager repo by origin URL.

See the ocm CLI guide for setup and commands.

Documentation

License

MIT

Languages
TypeScript 99.5%
Shell 0.3%
CSS 0.1%