fix: prevent bundled OpenCode self-upgrades (#2525)
* fix: prevent bundled OpenCode self-upgrades * feat(vscode): support OpenCode upgrades * fix: refresh OpenCode update status on runtime switch --------- Co-authored-by: Bohdan Triapitsyn <artmore@protonmail.com>
This commit is contained in:
committed by
GitHub
co-authored by
Bohdan Triapitsyn
parent
c0405d3fa4
commit
c88dd16d2a
@@ -69,6 +69,7 @@ import { createServerUtilsRuntime } from './lib/opencode/server-utils-runtime.js
|
||||
import { createStaticRoutesRuntime } from './lib/opencode/static-routes-runtime.js';
|
||||
import { createSettingsRuntime } from './lib/opencode/settings-runtime.js';
|
||||
import { createOpenCodeResolutionRuntime } from './lib/opencode/opencode-resolution-runtime.js';
|
||||
import { resolveOpenCodeUpgradeCapability } from './lib/opencode/upgrade-capability.js';
|
||||
import { createBootstrapRuntime } from './lib/opencode/bootstrap-runtime.js';
|
||||
import { createSessionRuntime } from './lib/opencode/session-runtime.js';
|
||||
import { createOpenCodeWatcherRuntime } from './lib/opencode/watcher.js';
|
||||
@@ -666,6 +667,7 @@ const getLoginShellEnvSnapshot = (...args) => openCodeEnvRuntime.getLoginShellEn
|
||||
const ensureOpencodeCliEnv = (...args) => openCodeEnvRuntime.ensureOpencodeCliEnv(...args);
|
||||
const applyOpencodeBinaryFromSettings = (...args) => openCodeEnvRuntime.applyOpencodeBinaryFromSettings(...args);
|
||||
const resolveOpencodeCliPath = (...args) => openCodeEnvRuntime.resolveOpencodeCliPath(...args);
|
||||
const isBundledOpenCodeCliPath = (...args) => openCodeEnvRuntime.isBundledOpenCodeCliPath(...args);
|
||||
const isExecutable = (...args) => openCodeEnvRuntime.isExecutable(...args);
|
||||
const searchPathFor = (...args) => openCodeEnvRuntime.searchPathFor(...args);
|
||||
const resolveGitBinaryForSpawn = (...args) => openCodeEnvRuntime.resolveGitBinaryForSpawn(...args);
|
||||
@@ -1070,6 +1072,18 @@ const openCodeLifecycleRuntime = createOpenCodeLifecycleRuntime({
|
||||
},
|
||||
});
|
||||
|
||||
const getOpenCodeUpgradeCapability = () => {
|
||||
const activeBinary = lastOpenCodeLaunchDiagnostics?.sourceBinary
|
||||
|| lastOpenCodeLaunchDiagnostics?.binary
|
||||
|| resolvedOpencodeBinary;
|
||||
return resolveOpenCodeUpgradeCapability({
|
||||
isExternal: isExternalOpenCode,
|
||||
hasManagedProcess: Boolean(openCodeProcess),
|
||||
activeBinary,
|
||||
isBundledBinary: isBundledOpenCodeCliPath,
|
||||
});
|
||||
};
|
||||
|
||||
const restartOpenCode = (...args) => openCodeLifecycleRuntime.restartOpenCode(...args);
|
||||
const waitForOpenCodeReady = (...args) => openCodeLifecycleRuntime.waitForOpenCodeReady(...args);
|
||||
const waitForAgentPresence = (...args) => openCodeLifecycleRuntime.waitForAgentPresence(...args);
|
||||
@@ -1600,6 +1614,7 @@ async function main(options = {}) {
|
||||
readCustomThemesFromDisk,
|
||||
refreshOpenCodeAfterConfigChange,
|
||||
getOpenCodeResolutionSnapshot,
|
||||
getOpenCodeUpgradeCapability,
|
||||
formatSettingsResponse,
|
||||
readSettingsFromDisk,
|
||||
readSettingsFromDiskMigrated,
|
||||
|
||||
Reference in New Issue
Block a user