fix(cli): declare sqlite-vec and @huggingface/transformers as runtime dependencies

The CLI tsup build inlines @openchatlab/node-runtime into dist chunks.
Both sqlite-vec and @huggingface/transformers load platform-specific
native packages at runtime (sqlite-vec-linux-arm64, onnxruntime-node,
sharp), so inlining them breaks global/npm and Docker installs of
chatlab-cli: the bundled chunks reference native packages that were
never installed, and configuring the semantic index vector model fails
with HTTP 500 (Cannot find package 'sqlite-vec-linux-arm64').

Declare both packages as chatlab-cli dependencies and mark them as tsup
external so they are installed from npm with their native bindings,
matching how better-sqlite3 and @node-rs/jieba are already handled.
This commit is contained in:
kelaocai authored and digua committed 2026-08-01 11:33:41 +08:00
1 parent 982f37ced6
commit d48745f00b
3 files changed
+11 -1

No files matched your search

+2
View File
@@ -50,6 +50,7 @@
"@fastify/static": "^9.1.3",
"@earendil-works/pi-agent-core": "0.74.2",
"@earendil-works/pi-ai": "0.74.2",
"@huggingface/transformers": "^4.2.0",
"@modelcontextprotocol/sdk": "^1.12.1",
"better-sqlite3": "^12.4.6",
"commander": "^13.1.0",
@@ -57,6 +58,7 @@
"gray-matter": "^4.0.3",
"js-tiktoken": "^1.0.21",
"smol-toml": "^1.3.1",
"sqlite-vec": "^0.1.9",
"stream-json": "^1.9.1",
"zod": "^3.24.4"
},
+3 -1
View File
@@ -24,7 +24,9 @@ export default defineConfig({
noExternal: [/^@openchatlab\/(?!parser-native)/, 'chatlab-mcp', 'stream-json'],
// parser-native 是本地构建的可选 Rust 内核:不打包也不声明依赖,
// 运行时 require 失败会自动回退 TS 解析器。
external: ['better-sqlite3', '@node-rs/jieba', '@openchatlab/parser-native'],
// sqlite-vec / @huggingface/transformers 依赖按平台分发的原生包(sqlite-vec-*、onnxruntime-node、sharp),
// 必须作为真实依赖随 npm 安装,不能内联进 bundle
external: ['better-sqlite3', '@node-rs/jieba', 'sqlite-vec', '@huggingface/transformers', '@openchatlab/parser-native'],
banner: {
js: [
"import { createRequire as __createRequire } from 'module';",