perf(build): minify main process and lazy-load tiktoken rank table

Enable esbuild minification for main/preload (was renderer-only by default),
reducing main process bundle by ~55%. Extract cl100k_base BPE rank table out
of the synchronous startup path via dynamic import — it now lands in its own
chunk and is loaded on first agent run instead of at app startup.

Also fix Windows CI step to use PowerShell syntax for version injection.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
diguaandClaude Opus 4.8 committed 2026-06-03 00:46:34 +08:00
1 parent 3ff9437510
commit 2f8591fb8c
8 files changed
+89 -25

No files matched your search

+4
View File
@@ -13,6 +13,7 @@ import {
createCompressionLlmAdapter,
AgentEventHandler,
formatAIError,
initTokenizer,
type AgentStreamChunk,
type PiMessage,
type SimpleHistoryMessage,
@@ -74,6 +75,9 @@ export async function runServerAgent(options: RunAgentOptions): Promise<void> {
const aiLogger = getServerAiLogger()
// 确保 tokenizer rank 表已加载(compression + agent 路径均依赖)
await initTokenizer()
const llmConfig = getDefaultAssistantConfig(aiDataDir)
if (!llmConfig) {
onEvent({ type: 'error', error: { name: 'ConfigError', message: 'LLM service not configured' } })