feat(opencode): migrate OpenCode Manager to OpenCode 2 (#359)

* feat(opencode): migrate OpenCode Manager to OpenCode 2

Port the backend lifecycle, generated plugins, event aggregation,
schedules, worktrees, provider credentials, MCP, config handling, the
frontend chat model, and the ocm CLI to OpenCode 2.

Adopt @opencode/client 2.0.15 as the single typed V2 API contract,
require OpenCode 2.0.0 or newer (pinned 2.0.15), and delete every
V1-only code path.

* refactor(opencode): reload config in place and drop v1 compatibility shims

Route config/skill/AGENTS.md changes through the OpenCode location reload
API instead of a full server restart, stop auto-resuming interrupted
sessions, remove the restart coordinator and v1 MCP/version shims, and pin
support to OpenCode >=2.0.15 <3.0.0. Adds integration-ready retries,
service-mode launch, ocm-cli repo proxy, and new frontend form/MCP helpers.

* refactor(opencode): consolidate v2 migration helpers and harden install, proxy, and session flows

- extract shared semver and model-ref utilities, reuse across version checks
- share the OpenCode release download script across Docker, entrypoint, dev setup
- unify install/upgrade failure recovery and guard externally managed OPENCODE_BIN
- scope the repo proxy location rewrite and surface ocm proxy errors
- rework frontend session projection, permission lookup, and cache invalidation

* fix(schedules): reject unavailable agents before creating a session

* feat(opencode): add ocm install, schedule agent fallback, and session move guards
This commit is contained in:
Chris Scott authored and GitHub committed 2026-09-26 13:16:45 -04:00
1 parent 6c2ebd764b
commit dacde879d6
383 files changed
+29905 -46566

No files matched your search

@@ -3,7 +3,7 @@ import { useOpenCodeServerAuth } from '@/hooks/useOpenCodeServerAuth'
import { Button } from '@/components/ui/button'
import { Input } from '@/components/ui/input'
import { Alert, AlertDescription } from '@/components/ui/alert'
import { AlertTriangle, CheckCircle2, Eye, EyeOff, XCircle } from 'lucide-react'
import { CheckCircle2, Eye, EyeOff } from 'lucide-react'
import { SettingsDisclosure } from './SettingsDisclosure'
interface OpenCodeServerAuthSettingsProps {
@@ -31,14 +31,14 @@ export function OpenCodeServerAuthSettings({ isOpen: controlledOpen, onToggle }:
if (!status) return 'Loading...'
if (status.source === 'db') return 'Set (configured via UI)'
if (status.source === 'env') return 'Set (configured via env var)'
return 'Not set'
return 'Auto-generated by OpenCode Manager'
}
const getStatusIcon = () => {
if (!status) return null
if (status.source === 'db') return <CheckCircle2 className="h-4 w-4 text-green-500" />
if (status.source === 'env') return <CheckCircle2 className="h-4 w-4 text-blue-500" />
return <XCircle className="h-4 w-4 text-red-500" />
return <CheckCircle2 className="h-4 w-4 text-muted-foreground" />
}
return (
@@ -54,11 +54,10 @@ export function OpenCodeServerAuthSettings({ isOpen: controlledOpen, onToggle }:
</span>
}
>
{status?.source === 'none' && (
<Alert variant="destructive">
<AlertTriangle className="h-4 w-4" />
{status?.source === 'managed' && (
<Alert>
<AlertDescription>
If you set OPENCODE_HOST=0.0.0.0 in Docker without a password, the server will refuse to start.
OpenCode Manager generates and stores this password automatically. Set your own below to override it.
</AlertDescription>
</Alert>
)}
@@ -99,7 +98,7 @@ export function OpenCodeServerAuthSettings({ isOpen: controlledOpen, onToggle }:
onClick={() => clearPassword.mutate()}
disabled={clearPassword.isPending}
>
{clearPassword.isPending ? 'Clearing...' : 'Clear stored password'}
{clearPassword.isPending ? 'Clearing...' : 'Use auto-generated password'}
</Button>
)}
</SettingsDisclosure>