Files
ChatLab/apps/desktop/electron-builder.yml
T
diguaandCursor 2bfae1db93 fix(ai): complete desktop semantic index parity and local embedding packaging
Bring the Electron desktop client to parity with CLI web for semantic
index, and package the local embedding runtime correctly.

- Inject semanticIndexService into the desktop AI tool debug executor so
  manual tool runs reach semantic search tools, matching the Agent stream.
  Extract a platform-agnostic tool-executor-core with unit tests.
- Persist the API key by reference in the degraded semantic-index config
  route (vector service unavailable) so API mode keys are not dropped;
  make auth-profile read/write injectable and add route + unit regression
  tests that never touch the real ~/.chatlab.
- Package desktop local embedding deps: declare @huggingface/transformers,
  asarUnpack onnxruntime-node / @img native libs, and trim onnxruntime-node
  binaries to the build target platform/arch to avoid shipping ~175M of
  unrelated Linux/Windows binaries.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-21 23:09:31 +08:00

86 lines
3.2 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 应用程序的唯一标识符
appId: com.chatlab.fun
# 应用程序的产品名称
productName: ChatLab
# 发布配置
publish:
provider: github
owner: ChatLab
repo: ChatLab
# 构建资源所在的目录
directories:
buildResources: build
# 包含在最终应用程序构建中的文件列表
files:
- out/**/*
- '!**/.vscode/*'
- '!electron.vite.config.{js,ts,mjs,cjs}'
- '!{.eslintignore,.eslintrc.cjs,.prettierignore,.prettierrc.yaml,CHANGELOG.md,README.md}'
- '!{.env,.env.*,.npmrc,pnpm-lock.yaml}'
- '!{tsconfig.json,tsconfig.node.json}'
# jieba 词库文件已改为启动时远程下载,无需打包内置
- '!node_modules/@node-rs/jieba/dict.txt'
- '!node_modules/@node-rs/jieba/idf.txt'
- '!node_modules/@node-rs/jieba/dict.js'
- '!node_modules/@node-rs/jieba/dict.d.ts'
# onnxruntime-node 自带 darwin/linux/win32 全平台全架构原生二进制(合计 ~210M)。
# 只保留当前构建目标 ${platform}/${arch} 一份,避免 mac 包含 Linux/Windows 二进制(反之亦然)。
# 先排除整组 bin/napi-v6,再按目标平台/架构重新包含;electron-builder 后写规则覆盖先写规则。
# ${platform} -> darwin/linux/win32,${arch} -> x64/arm64,正好匹配该包目录结构。
- '!node_modules/onnxruntime-node/bin/napi-v6/**'
- 'node_modules/onnxruntime-node/bin/napi-v6/${platform}/${arch}/**'
# 哪些文件将不会被压缩,而是解压到构建目录
# 仅含 .dylib(无 .node)的原生包不会被 electron-builder 自动解包,必须显式列出,
# 否则 dlopen 无法从 asar 内加载:
# - sqlite-vec*:vec0.dylib(SQLite 扩展)
# - onnxruntime-node:onnxruntime_binding.node + libonnxruntime.*.dylib(本地向量模型推理)
# - @img/**:sharp 原生绑定与 libvips-cpp.dylib(transformers 本地模型 eager require sharp)
asarUnpack:
- resources/**
- node_modules/sqlite-vec*/**
- node_modules/onnxruntime-node/**
- node_modules/@img/**
# Windows 平台配置
win:
executableName: ChatLab
target: nsis
# NSIS 安装器配置
nsis:
oneClick: false
artifactName: ChatLab-${version}-setup.${ext}
shortcutName: ${productName}
uninstallDisplayName: ${productName}
createDesktopShortcut: always
allowElevation: true
allowToChangeInstallationDirectory: true
installerIcon: build/icon.ico
uninstallerIcon: build/icon.ico
include: installer-dpi.nsh
differentialPackage: false
# macOS 平台配置
mac:
entitlementsInherit: build/entitlements.mac.plist
entitlements: build/entitlements.mac.plist
# 代码签名 - Hardened Runtime 是公证的必要条件
hardenedRuntime: true
gatekeeperAssess: false
# 公证配置 - v26 自动检测环境变量进行公证,无需额外配置
extendInfo:
- NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder.
- NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder.
target:
# 架构由 CI 通过 --x64/--arm64 指定,避免在单个 job 里同时打双架构
- target: dmg
- target: zip
artifactName: ChatLab-${version}-${arch}.${ext}
# macOS 平台的 DMG 配置
dmg:
artifactName: ChatLab-${version}-${arch}.${ext}
# 是否在构建之前重新编译原生模块
npmRebuild: true