fix: 修复 OpenCode 运行时启动与本地打包

This commit is contained in:
2026-08-09 00:02:49 +08:00
parent d092132d86
commit a6fe14a8d6
20 changed files with 1847 additions and 154 deletions

View File

@@ -30,7 +30,7 @@ import { registerZoomShortcuts } from './zoom-shortcuts';
import { appUpdater, registerUpdateHandlers } from './updater';
import { logger } from '../utils/logger';
import { warmupNetworkOptimization } from '../utils/uv-env';
import { resolvePythonRuntime } from '../utils/python-runtime';
import { resolvePythonRuntime, resolveUvRuntime } from '../utils/python-runtime';
import { initTelemetry } from '../utils/telemetry';
import {
getOrCreateAgentGatewaySessionClientId,
@@ -578,6 +578,13 @@ if (gotTheLock) {
arch: process.arch,
configuredPath: process.env.NIANCODE_PYTHON_PATH,
});
const uvRuntime = resolveUvRuntime({
isPackaged: app.isPackaged,
resourcesPath: process.resourcesPath,
appPath: app.getAppPath(),
platform: process.platform,
arch: process.arch,
});
const bundledSuperpowersDir = resolveBundledSuperpowersDir({
isPackaged: app.isPackaged,
resourcesPath: process.resourcesPath,
@@ -594,13 +601,15 @@ if (gotTheLock) {
appPath: app.getAppPath(),
});
opencodeManager = new OpencodeManager({
port: 4096,
port: getPort('OPENCODE_RUNTIME'),
binPath: opencodePaths.binPath,
preflightPreferredPort: true,
userDataDir: app.getPath('userData'),
bundledSuperpowersDir,
bundledCourseSkillsDir,
bundledAgentBrowserPluginPath,
pythonRuntime,
uvRuntime,
runtimeConfigProvider: async () => {
const runtime = await buildOpencodeRuntimeConfigFromNianCodeProviders({
mcpServers: {