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.
This commit is contained in:
Chris Scott committed 2026-09-24 11:48:35 -04:00
1 parent 7351d5f002
commit f5d0f0c27e
171 files changed
+5046 -11437

No files matched your search

+18 -10
View File
@@ -42,12 +42,24 @@ grant_kvm_access() {
echo "Granted node access to $dev (group '$group_name', gid $dev_gid)"
}
MIN_OPENCODE_VERSION="2.0.0"
OPENCODE_SUPPORTED_FLOOR="${OPENCODE_BUNDLED_VERSION:-}"
version_gte() {
printf '%s\n%s\n' "$2" "$1" | sort -V -C
}
is_supported_opencode_version() {
local version="$1"
[[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || return 1
[ -n "$OPENCODE_SUPPORTED_FLOOR" ] || return 1
[ "${version%%.*}" = "${OPENCODE_SUPPORTED_FLOOR%%.*}" ] || return 1
version_gte "$version" "$OPENCODE_SUPPORTED_FLOOR"
}
supported_opencode_range() {
printf '>=%s <%s.0.0\n' "$OPENCODE_SUPPORTED_FLOOR" "$(( ${OPENCODE_SUPPORTED_FLOOR%%.*} + 1 ))"
}
read_opencode_version() {
local binary
binary="$(command -v "${1:-opencode}" 2>/dev/null || true)"
@@ -76,10 +88,6 @@ install_opencode() {
echo "ERROR: OPENCODE_BUNDLED_VERSION='$opencode_version' is not an X.Y.Z version; refusing to download it" >&2
return 1
fi
if ! version_gte "$opencode_version" "$MIN_OPENCODE_VERSION"; then
echo "ERROR: OPENCODE_BUNDLED_VERSION=$opencode_version is below the minimum supported $MIN_OPENCODE_VERSION; refusing to download it" >&2
return 1
fi
echo "Installing OpenCode ${opencode_version}..."
local staging
staging="$(mktemp -d)"
@@ -102,8 +110,8 @@ reconcile_persisted_opencode() {
rm -f "$persisted_path"
return 0
fi
if ! version_gte "$persisted_version" "$MIN_OPENCODE_VERSION"; then
echo "Persisted OpenCode $persisted_version is below the minimum supported $MIN_OPENCODE_VERSION; removing it so the bundled OpenCode 2 binary is used"
if ! is_supported_opencode_version "$persisted_version"; then
echo "Persisted OpenCode $persisted_version is outside the supported range $(supported_opencode_range); removing it so the bundled OpenCode $OPENCODE_SUPPORTED_FLOOR binary is used"
rm -f "$persisted_path"
return 0
fi
@@ -147,10 +155,10 @@ OPENCODE_VERSION="$(read_opencode_version)"
echo "OpenCode is installed (version: $OPENCODE_VERSION)"
if [ "$OPENCODE_VERSION" != "unknown" ]; then
if version_gte "$OPENCODE_VERSION" "$MIN_OPENCODE_VERSION"; then
echo "OpenCode version meets minimum requirement (>=$MIN_OPENCODE_VERSION)"
if is_supported_opencode_version "$OPENCODE_VERSION"; then
echo "OpenCode version is within the supported range $(supported_opencode_range)"
else
echo "OpenCode version $OPENCODE_VERSION is below minimum required version $MIN_OPENCODE_VERSION"
echo "OpenCode version $OPENCODE_VERSION is outside the supported range $(supported_opencode_range)"
echo "Reinstalling bundled OpenCode version ${OPENCODE_BUNDLED_VERSION}..."
install_opencode