Refine desktop setup and remove bundled app center apps

This commit is contained in:
inman
2026-06-04 09:58:58 +08:00
parent 6153579b90
commit 84128dbe23
73 changed files with 3888 additions and 2024 deletions

View File

@@ -38,10 +38,11 @@ import { logger } from '../utils/logger';
import { prependPathEntry } from '../utils/env-path';
import { buildDotnetEnv } from '../utils/dotnet-runtime';
import { buildPlaywrightRuntimeEnv, ensureYinianPlaywrightRuntimeDirs } from '../utils/playwright-runtime';
import { copyPluginFromNodeModules, ensureCloudSyncPluginInstalled, fixupPluginManifest, cpSyncSafe } from '../utils/plugin-install';
import { copyPluginFromNodeModules, ensureCloudSyncPluginInstalled, fixupPluginManifest, cpSyncSafe, hasPluginRuntimeEntry } from '../utils/plugin-install';
import { stripSystemdSupervisorEnv } from './config-sync-env';
import { ensureYinianModelRuntimeConfigured } from '../utils/model-diagnostics';
import { cleanupOpenClawUserNativeClipboard } from '../utils/optional-native-cleanup';
import { syncDefaultProviderToRuntime } from '../services/providers/provider-runtime-sync';
export interface GatewayLaunchContext {
@@ -61,6 +62,7 @@ export interface GatewayLaunchContext {
const CHANNEL_PLUGIN_MAP: Record<string, { dirName: string; npmName: string }> = {
'openclaw-weixin': { dirName: 'openclaw-weixin', npmName: '@tencent-weixin/openclaw-weixin' },
feishu: { dirName: 'openclaw-lark', npmName: '@larksuite/openclaw-lark' },
};
const REMOVED_CHANNEL_PLUGIN_DIRS = ['dingtalk', 'wecom', 'feishu-openclaw-plugin'];
@@ -197,9 +199,12 @@ function ensureConfiguredPluginsUpgraded(configuredChannels: string[]): void {
if (bundledDir) {
const sourceVersion = readPluginVersion(join(bundledDir, 'package.json'));
const installedRuntimeReady = isInstalled ? hasPluginRuntimeEntry(targetDir) : false;
const sourceRuntimeReady = hasPluginRuntimeEntry(bundledDir);
// Install or upgrade if version differs or plugin not installed
if (!isInstalled || (sourceVersion && installedVersion && sourceVersion !== installedVersion)) {
logger.info(`[plugin] ${isInstalled ? 'Auto-upgrading' : 'Installing'} ${channelType} plugin${isInstalled ? `: ${installedVersion}${sourceVersion}` : `: ${sourceVersion}`} (bundled)`);
if (!isInstalled || (sourceVersion && installedVersion && sourceVersion !== installedVersion) || (!installedRuntimeReady && sourceRuntimeReady)) {
const reinstallReason = isInstalled && !installedRuntimeReady && sourceRuntimeReady ? 'repairing missing runtime entry for' : (isInstalled ? 'Auto-upgrading' : 'Installing');
logger.info(`[plugin] ${reinstallReason} ${channelType} plugin${isInstalled ? `: ${installedVersion}${sourceVersion}` : `: ${sourceVersion}`} (bundled)`);
try {
mkdirSync(fsPath(join(homedir(), '.openclaw', 'extensions')), { recursive: true });
rmSync(fsPath(targetDir), { recursive: true, force: true });
@@ -222,13 +227,16 @@ function ensureConfiguredPluginsUpgraded(configuredChannels: string[]): void {
if (!existsSync(fsPath(join(npmPkgPath, 'openclaw.plugin.json')))) continue;
const sourceVersion = readPluginVersion(join(npmPkgPath, 'package.json'));
if (!sourceVersion) continue;
const installedRuntimeReady = isInstalled ? hasPluginRuntimeEntry(targetDir) : false;
const sourceRuntimeReady = hasPluginRuntimeEntry(npmPkgPath);
// Skip only if installed AND same version — but still patch manifest ID.
if (isInstalled && installedVersion && sourceVersion === installedVersion) {
if (isInstalled && installedVersion && sourceVersion === installedVersion && (installedRuntimeReady || !sourceRuntimeReady)) {
fixupPluginManifest(targetDir);
continue;
}
logger.info(`[plugin] ${isInstalled ? 'Auto-upgrading' : 'Installing'} ${channelType} plugin${isInstalled ? `: ${installedVersion}${sourceVersion}` : `: ${sourceVersion}`} (dev/node_modules)`);
const reinstallReason = isInstalled && !installedRuntimeReady && sourceRuntimeReady ? 'Repairing missing runtime entry for' : (isInstalled ? 'Auto-upgrading' : 'Installing');
logger.info(`[plugin] ${reinstallReason} ${channelType} plugin${isInstalled ? `: ${installedVersion}${sourceVersion}` : `: ${sourceVersion}`} (dev/node_modules)`);
try {
mkdirSync(fsPath(join(homedir(), '.openclaw', 'extensions')), { recursive: true });
@@ -432,6 +440,15 @@ export async function syncGatewayConfigBeforeLaunch(
} catch (err) {
logger.warn('Failed to configure Yinian model runtime defaults before launch:', err);
}
try {
const defaultProviderId = await getDefaultProvider();
if (defaultProviderId) {
await syncDefaultProviderToRuntime(defaultProviderId);
}
} catch (err) {
logger.warn('Failed to sync default provider to OpenClaw before launch:', err);
}
}
async function loadProviderEnv(): Promise<{ providerEnv: Record<string, string>; loadedProviderKeyCount: number }> {