🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
⏪️ build : Revert "support mac intel chip" (#9134)
Arvin Xuae28f1794cd2
diff --git a/.github/scripts/pr-comment.js b/.github/scripts/pr-comment.jsindex 0775d7070d5..bb0c1a77d19 100644--- a/.github/scripts/pr-comment.js+++ b/.github/scripts/pr-comment.js@@ -36,19 +36,10 @@ module.exports = async ({ github, context, releaseUrl, version, tag }) => {// Generate combined download tablelet assetTable = '| Platform | File | Size |\n| --- | --- | --- |\n';- // Add macOS assets with architecture detection+ // Add macOS assetsmacAssets.forEach((asset) => {const sizeInMB = (asset.size / (1024 * 1024)).toFixed(2);-- // Detect architecture from filename- let architecture = '';- if (asset.name.includes('arm64')) {- architecture = ' (Apple Silicon)';- } else if (asset.name.includes('x64') || asset.name.includes('-mac.')) {- architecture = ' (Intel)';- }-- assetTable += `| macOS${architecture} | [${asset.name}](${asset.browser_download_url}) | ${sizeInMB} MB |\n`;+ assetTable += `| macOS | [${asset.name}](${asset.browser_download_url}) | ${sizeInMB} MB |\n`;});// Add Windows assetsdiff --git a/.github/workflows/desktop-pr-build.yml b/.github/workflows/desktop-pr-build.ymlindex b5421fffbdf..1989b430f78 100644--- a/.github/workflows/desktop-pr-build.yml+++ b/.github/workflows/desktop-pr-build.yml@@ -32,18 +32,18 @@ jobs:with:node-version: 22- - name: Install bun- uses: oven-sh/setup-bun@v1+ - name: Setup pnpm+ uses: pnpm/action-setup@v2with:- bun-version: ${{ secrets.BUN_VERSION }}+ version: 10- name: Install deps- run: bun i+ run: pnpm installenv:NODE_OPTIONS: --max-old-space-size=6144- name: Lint- run: bun run lint+ run: pnpm run lintenv:NODE_OPTIONS: --max-old-space-size=6144@@ -93,7 +93,7 @@ jobs:runs-on: ${{ matrix.os }}strategy:matrix:- os: [macos-latest, macos-13, windows-2025, ubuntu-latest]+ os: [macos-latest, windows-2025, ubuntu-latest]steps:- uses: actions/checkout@v5with:@@ -172,27 +172,6 @@ jobs:NEXT_PUBLIC_DESKTOP_PROJECT_ID: ${{ secrets.UMAMI_NIGHTLY_DESKTOP_PROJECT_ID }}NEXT_PUBLIC_DESKTOP_UMAMI_BASE_URL: ${{ secrets.UMAMI_NIGHTLY_DESKTOP_BASE_URL }}- # 处理 macOS latest-mac.yml 重命名 (避免多架构覆盖)- - name: Rename macOS latest-mac.yml for multi-architecture support- if: runner.os == 'macOS'- run: |- cd apps/desktop/release- if [ -f "latest-mac.yml" ]; then- # 根据运行环境检测架构- if [[ "${{ matrix.os }}" == *"arm64"* || "${{ matrix.os }}" == "macos-latest" ]]; then- ARCH_SUFFIX="arm"- else- ARCH_SUFFIX="intel"- fi-- mv latest-mac.yml "latest-mac-${ARCH_SUFFIX}.yml"- echo "✅ Renamed latest-mac.yml to latest-mac-${ARCH_SUFFIX}.yml"- ls -la latest-mac-*.yml- else- echo "⚠️ latest-mac.yml not found, skipping rename"- ls -la latest*.yml || echo "No latest*.yml files found"- fi-# 上传构建产物- name: Upload artifactuses: actions/upload-artifact@v4@@ -210,62 +189,8 @@ jobs:apps/desktop/release/*.tar.gz*retention-days: 5- # 合并 macOS 多架构 latest-mac.yml 文件- merge-mac-files:- needs: [build, version]- name: Merge macOS Release Files for PR- runs-on: ubuntu-latest- permissions:- contents: write- steps:- - name: Checkout repository- uses: actions/checkout@v5-- - name: Setup Node.js- uses: actions/setup-node@v4- with:- node-version: 22-- - name: Install required dependencies only- run: |- # 创建临时目录并安装依赖- mkdir -p temp-deps- cd temp-deps- npm init -y- npm install fs-extra yaml tsx- # 确保回到项目根目录- cd ${{ github.workspace }}-- # 下载所有平台的构建产物- - name: Download artifacts- uses: actions/download-artifact@v4- with:- path: release- pattern: release-*- merge-multiple: true-- # 列出下载的构建产物- - name: List downloaded artifacts- run: ls -R release-- # 合并 macOS YAML 文件 (确保在项目根目录执行)- - name: Merge latest-mac.yml files- working-directory: ${{ github.workspace }}- run: NODE_PATH="${PWD}/temp-deps/node_modules" "${PWD}/temp-deps/node_modules/.bin/tsx" scripts/electronWorkflow/mergeMacReleaseFiles.ts ${{ needs.version.outputs.version }}- env:- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}- RELEASE_TAG: ${{ needs.version.outputs.version }}-- # 上传合并后的构建产物- - name: Upload artifacts with merged macOS files- uses: actions/upload-artifact@v4- with:- name: merged-release-pr- path: release/- retention-days: 1-publish-pr:- needs: [merge-mac-files, version]+ needs: [build, version]name: Publish PR Buildruns-on: ubuntu-latest# Grant write permissions for creating release and commenting on PR@@ -279,15 +204,16 @@ jobs:with:fetch-depth: 0- # 下载合并后的构建产物- - name: Download merged artifacts+ # 下载所有平台的构建产物+ - name: Download artifactsuses: actions/download-artifact@v4with:- name: merged-release-prpath: release+ pattern: release-*+ merge-multiple: true# 列出所有构建产物- - name: List final artifacts+ - name: List artifactsrun: ls -R release# 生成PR发布描述diff --git a/.github/workflows/release-desktop-beta.yml b/.github/workflows/release-desktop-beta.ymlindex 806df2ae253..3cdc5a6dfbc 100644--- a/.github/workflows/release-desktop-beta.yml+++ b/.github/workflows/release-desktop-beta.yml@@ -28,16 +28,16 @@ jobs:with:node-version: 22- - name: Install bun- uses: oven-sh/setup-bun@v1+ - name: Setup pnpm+ uses: pnpm/action-setup@v2with:- bun-version: ${{ secrets.BUN_VERSION }}+ version: 10- name: Install deps- run: bun i+ run: pnpm install- name: Lint- run: bun run lint+ run: pnpm run lintversion:name: Determine version@@ -80,7 +80,7 @@ jobs:runs-on: ${{ matrix.os }}strategy:matrix:- os: [macos-latest, macos-13, windows-2025, ubuntu-latest]+ os: [macos-latest, windows-2025, ubuntu-latest]steps:- uses: actions/checkout@v5with:@@ -91,14 +91,14 @@ jobs:with:node-version: 22- - name: Install bun- uses: oven-sh/setup-bun@v1+ - name: Setup pnpm+ uses: pnpm/action-setup@v2with:- bun-version: ${{ secrets.BUN_VERSION }}+ version: 10- # bun install 默认行为应该能确保 asar 压缩可用+ # node-linker=hoisted 模式将可以确保 asar 压缩可用- name: Install deps- run: bun i+ run: pnpm install --node-linker=hoisted- name: Install deps on Desktoprun: npm run install-isolated --prefix=./apps/desktop@@ -154,28 +154,7 @@ jobs:NEXT_PUBLIC_DESKTOP_PROJECT_ID: ${{ secrets.UMAMI_BETA_DESKTOP_PROJECT_ID }}NEXT_PUBLIC_DESKTOP_UMAMI_BASE_URL: ${{ secrets.UMAMI_BETA_DESKTOP_BASE_URL }}- # 处理 macOS latest-mac.yml 重命名 (避免多架构覆盖)- - name: Rename macOS latest-mac.yml for multi-architecture support- if: runner.os == 'macOS'- run: |- cd apps/desktop/release- if [ -f "latest-mac.yml" ]; then- # 根据运行环境检测架构- if [[ "${{ matrix.os }}" == *"arm64"* || "${{ matrix.os }}" == "macos-latest" ]]; then- ARCH_SUFFIX="arm"- else- ARCH_SUFFIX="intel"- fi-- mv latest-mac.yml "latest-mac-${ARCH_SUFFIX}.yml"- echo "✅ Renamed latest-mac.yml to latest-mac-${ARCH_SUFFIX}.yml"- ls -la latest-mac-*.yml- else- echo "⚠️ latest-mac.yml not found, skipping rename"- ls -la latest*.yml || echo "No latest*.yml files found"- fi-- # 上传构建产物 (工作流处理重命名,不依赖 electron-builder 钩子)+ # 上传构建产物,移除了 zip 相关部分- name: Upload artifactuses: actions/upload-artifact@v4with:@@ -192,32 +171,17 @@ jobs:apps/desktop/release/*.tar.gz*retention-days: 5- # 合并 macOS 多架构 latest-mac.yml 文件- merge-mac-files:+ # 正式版发布 job+ publish-release:needs: [build, version]- name: Merge macOS Release Files+ name: Publish Beta Releaseruns-on: ubuntu-latest+ # Grant write permission to contents for uploading release assetspermissions:contents: write+ outputs:+ artifact_path: ${{ steps.set_path.outputs.path }}steps:- - name: Checkout repository- uses: actions/checkout@v5-- - name: Setup Node.js- uses: actions/setup-node@v4- with:- node-version: 22-- - name: Install required dependencies only- run: |- # 创建临时目录并安装依赖- mkdir -p temp-deps- cd temp-deps- npm init -y- npm install fs-extra yaml tsx- # 确保回到项目根目录- cd ${{ github.workspace }}-# 下载所有平台的构建产物- name: Download artifactsuses: actions/download-artifact@v4@@ -226,46 +190,11 @@ jobs:pattern: release-*merge-multiple: true- # 列出下载的构建产物- - name: List downloaded artifacts- run: ls -R release-- # 合并 macOS YAML 文件 (确保在项目根目录执行)- - name: Merge latest-mac.yml files- working-directory: ${{ github.workspace }}- run: NODE_PATH="${PWD}/temp-deps/node_modules" "${PWD}/temp-deps/node_modules/.bin/tsx" scripts/electronWorkflow/mergeMacReleaseFiles.ts ${{ github.event.release.tag_name }}- env:- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}- RELEASE_TAG: ${{ github.event.release.tag_name }}-- # 上传合并后的构建产物- - name: Upload artifacts with merged macOS files- uses: actions/upload-artifact@v4- with:- name: merged-release- path: release/- retention-days: 1-- # 发布所有平台构建产物- publish-release:- needs: [merge-mac-files]- name: Publish Beta Release- runs-on: ubuntu-latest- permissions:- contents: write- steps:- # 下载合并后的构建产物- - name: Download merged artifacts- uses: actions/download-artifact@v4- with:- name: merged-release- path: release-# 列出所有构建产物- - name: List final artifacts+ - name: List artifactsrun: ls -R release- # 将构建产物上传到现有 release (现在包含合并后的 latest-mac.yml)+ # 将构建产物上传到现有 release- name: Upload to Releaseuses: softprops/action-gh-release@v1with:diff --git a/apps/desktop/electron-builder.js b/apps/desktop/electron-builder.jsindex 202e9c2e95c..9d1cf582a07 100644--- a/apps/desktop/electron-builder.js+++ b/apps/desktop/electron-builder.js@@ -1,15 +1,12 @@const dotenv = require('dotenv');-const os = require('node:os');dotenv.config();const packageJSON = require('./package.json');const channel = process.env.UPDATE_CHANNEL;-const arch = os.arch();console.log(`🚄 Build Version ${packageJSON.version}, Channel: ${channel}`);-console.log(`🏗️ Building for architecture: ${arch}`);const isNightly = channel === 'nightly';const isBeta = packageJSON.name.includes('beta');@@ -90,13 +87,12 @@ const config = {hardenedRuntime: true,notarize: true,target:- // 降低构建时间,nightly 只打 dmg- // 根据当前机器架构只构建对应架构的包+ // 降低构建时间,nightly 只打 arm64isNightly- ? [{ arch: [arch === 'arm64' ? 'arm64' : 'x64'], target: 'dmg' }]+ ? [{ arch: ['arm64'], target: 'dmg' }]: [- { arch: [arch === 'arm64' ? 'arm64' : 'x64'], target: 'dmg' },- { arch: [arch === 'arm64' ? 'arm64' : 'x64'], target: 'zip' },+ { arch: ['x64', 'arm64'], target: 'dmg' },+ { arch: ['x64', 'arm64'], target: 'zip' },],},npmRebuild: true,diff --git a/scripts/electronWorkflow/mergeMacReleaseFiles.ts b/scripts/electronWorkflow/mergeMacReleaseFiles.tsdeleted file mode 100644index 4a1bc8e104b..00000000000--- a/scripts/electronWorkflow/mergeMacReleaseFiles.ts+++ /dev/null@@ -1,207 +0,0 @@-/* eslint-disable unicorn/no-process-exit, unicorn/prefer-top-level-await */-import fs from 'fs-extra';-import path from 'node:path';-import { parse, stringify } from 'yaml';--interface LatestMacYml {- files: Array<{- sha512: string;- size: number;- url: string;- }>;- path: string;- releaseDate: string;- sha512: string;- version: string;-}--// 配置-const RELEASE_TAG = process.env.RELEASE_TAG || process.argv[2];-const FILE_NAME = 'latest-mac.yml';-const RELEASE_DIR = path.resolve('release');--// 验证环境变量和输入-if (!RELEASE_TAG) {- console.error('❌ RELEASE_TAG environment variable or argument is required');- process.exit(1);-}--// 验证 release tag 格式-if (!/^v?\d+\.\d+\.\d+/.test(RELEASE_TAG)) {- console.error(`❌ Invalid RELEASE_TAG format: ${RELEASE_TAG}. Expected format: v1.2.3`);- process.exit(1);-}--/**- * 检测 latest-mac.yml 文件的平台类型- */-function detectPlatform(yamlContent: LatestMacYml): 'intel' | 'arm' | 'both' | 'none' {- const hasIntel = yamlContent.files.some((file) => file.url.includes('-x64.dmg'));- const hasArm = yamlContent.files.some((file) => file.url.includes('-arm64.dmg'));-- if (hasIntel && hasArm) return 'both';- if (hasIntel && !hasArm) return 'intel';- if (!hasIntel && hasArm) return 'arm';- return 'none';-}--/**- * 合并两个 latest-mac.yml 文件- * @param intelContent Intel 平台的 YAML 内容- * @param armContent ARM 平台的 YAML 内容- */-function mergeYamlFiles(intelContent: LatestMacYml, armContent: LatestMacYml): string {- // 以 Intel 为基础(保持兼容性)- const merged: LatestMacYml = {- ...intelContent,- files: [...intelContent.files, ...armContent.files],- };-- // 使用 yaml 库生成,保持 sha512 在同一行- return stringify(merged, {- lineWidth: 0, // 不换行- });-}--// GitHub API functions removed since we're working with local files only--/**- * 读取本地文件- */-function readLocalFile(filePath: string): string | null {- try {- if (fs.existsSync(filePath)) {- const content = fs.readFileSync(filePath, 'utf8');- console.log(`✅ Read local file: ${filePath} (${content.length} chars)`);- return content;- }- console.log(`⚠️ Local file not found: ${filePath}`);- return null;- } catch (error) {- console.error(`❌ Error reading local file ${filePath}:`, error);- return null;- }-}--/**- * 写入本地文件- */-function writeLocalFile(filePath: string, content: string): void {- try {- fs.writeFileSync(filePath, content, 'utf8');- console.log(`✅ Written local file: ${filePath} (${content.length} chars)`);- } catch (error) {- console.error(`❌ Error writing local file ${filePath}:`, error);- throw error;- }-}--/**- * 主函数- */-async function main(): Promise<void> {- try {- console.log(`🚀 Starting macOS Release file merge for ${RELEASE_TAG}`);- console.log(`📁 Working directory: ${RELEASE_DIR}`);-- // 1. 检查 release 目录下的所有文件- const releaseFiles = fs.readdirSync(RELEASE_DIR);- console.log(`📂 Files in release directory: ${releaseFiles.join(', ')}`);-- // 2. 查找所有 latest-mac*.yml 文件- const macYmlFiles = releaseFiles.filter(- (f) => f.startsWith('latest-mac') && f.endsWith('.yml'),- );- console.log(`🔍 Found macOS YAML files: ${macYmlFiles.join(', ')}`);-- if (macYmlFiles.length === 0) {- console.log('⚠️ No macOS YAML files found, skipping merge');- return;- }-- // 3. 处理找到的文件,识别平台- const macFiles: Array<{- content: string;- filename: string;- platform: 'intel' | 'arm';- yaml: LatestMacYml;- }> = [];-- for (const fileName of macYmlFiles) {- const filePath = path.join(RELEASE_DIR, fileName);- const content = readLocalFile(filePath);-- if (!content) continue;-- try {- const yamlContent = parse(content) as LatestMacYml;- const platform = detectPlatform(yamlContent);-- if (platform === 'intel' || platform === 'arm') {- macFiles.push({ content, filename: fileName, platform, yaml: yamlContent });- console.log(`🔍 Detected ${platform} platform in ${fileName}`);- } else if (platform === 'both') {- console.log(`✅ Found already merged file: ${fileName}`);- // 如果已经是合并后的文件,直接复制为最终文件- writeLocalFile(path.join(RELEASE_DIR, FILE_NAME), content);- return;- } else {- console.log(`⚠️ Unknown platform type: ${platform} in ${fileName}`);- }- } catch (error) {- console.warn(`⚠️ Failed to parse ${fileName}:`, error);- }- }-- // 4. 检查是否有两个不同平台的文件- const intelFiles = macFiles.filter((f) => f.platform === 'intel');- const armFiles = macFiles.filter((f) => f.platform === 'arm');-- if (intelFiles.length === 0 && armFiles.length === 0) {- console.log('⚠️ No valid platform files found');- return;- }-- if (intelFiles.length === 0) {- console.log('⚠️ No Intel files found, using ARM only');- writeLocalFile(path.join(RELEASE_DIR, FILE_NAME), armFiles[0].content);- return;- }-- if (armFiles.length === 0) {- console.log('⚠️ No ARM files found, using Intel only');- writeLocalFile(path.join(RELEASE_DIR, FILE_NAME), intelFiles[0].content);- return;- }-- // 5. 合并 Intel 和 ARM 文件- const intelFile = intelFiles[0];- const armFile = armFiles[0];-- console.log(`🔄 Merging ${intelFile.filename} (Intel) and ${armFile.filename} (ARM)...`);- const mergedContent = mergeYamlFiles(intelFile.yaml, armFile.yaml);-- // 6. 保存合并后的文件- const mergedFilePath = path.join(RELEASE_DIR, FILE_NAME);- writeLocalFile(mergedFilePath, mergedContent);-- // 7. 验证合并结果- const mergedYaml = parse(mergedContent) as LatestMacYml;- const finalPlatform = detectPlatform(mergedYaml);-- if (finalPlatform === 'both') {- console.log('✅ Successfully merged both Intel and ARM platforms');- console.log(`📊 Final file contains ${mergedYaml.files.length} files`);- } else {- console.warn(`⚠️ Merge result unexpected: ${finalPlatform}`);- }-- console.log('🎉 Merge complete!');- } catch (error) {- console.error('❌ Error during merge:', error);- process.exit(1);- }-}--// 运行主函数-void main();