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

@@ -0,0 +1,68 @@
import { useState } from 'react'
import { ChevronDown, ChevronUp } from 'lucide-react'
import { getRelativePath } from './FileToolRender'
interface StepFileChangesProps {
files: string[]
snapshot?: string
onFileClick?: (filePath: string) => void
}
const INITIAL_FILES_SHOWN = 3
function fileNoun(count: number): string {
return count === 1 ? 'file' : 'files'
}
export function StepFileChanges({ files, snapshot, onFileClick }: StepFileChangesProps) {
const [expanded, setExpanded] = useState(false)
if (files.length === 0) return null
const hasMoreFiles = files.length > INITIAL_FILES_SHOWN
const displayedFiles = expanded ? files : files.slice(0, INITIAL_FILES_SHOWN)
const hiddenCount = files.length - INITIAL_FILES_SHOWN
return (
<div className="border border-border rounded-lg overflow-hidden my-2">
<button
type="button"
onClick={() => hasMoreFiles && setExpanded(!expanded)}
className="w-full px-3 py-1.5 bg-card hover:bg-card-hover text-left flex items-center justify-between text-sm gap-2"
>
<span className="font-medium">File Changes ({files.length} {fileNoun(files.length)})</span>
<div className="flex items-center gap-2 flex-shrink-0">
{snapshot && <span className="text-muted-foreground text-xs font-mono">{snapshot.slice(0, 8)}</span>}
{hasMoreFiles && (
expanded ? <ChevronUp className="w-4 h-4 text-muted-foreground" /> : <ChevronDown className="w-4 h-4 text-muted-foreground" />
)}
</div>
</button>
<div className="bg-card px-3 py-2 space-y-1">
{displayedFiles.map((file) => (
<button
key={file}
type="button"
title={file}
onClick={() => onFileClick?.(file)}
className="block max-w-full truncate text-left text-xs font-mono text-blue-600 dark:text-blue-400 hover:underline cursor-pointer"
>
{getRelativePath(file)}
</button>
))}
{hasMoreFiles && (
<button
type="button"
onClick={() => setExpanded(!expanded)}
className="text-xs text-muted-foreground hover:text-foreground flex items-center gap-1 mt-1"
>
{expanded ? <ChevronUp className="w-3 h-3" /> : <ChevronDown className="w-3 h-3" />}
{expanded ? 'Show less' : `+${hiddenCount} more ${fileNoun(hiddenCount)}`}
</button>
)}
</div>
</div>
)
}