Files
desktop/apps/hanzo-desktop/vite.config.ts
f56b876472 feat: embed native Hanzo engine (in-process) + default to Zen models (#5)
* feat(desktop): embed native Hanzo engine + default to Zen models

- Wire embedded_engine (engine fork, path dep) behind a `native-engine`
  Cargo feature (off by default): OpenAI-compatible server on
  127.0.0.1:36900 + Tauri IPC commands, sharing one engine instance.
- Port embedded engine to the engine 0.8.1 builder API.
- Default to Zen models on HF: zen-nano-0.6b (chat) + zen3-embedding-small
  (embedding), with zen5 as flagship.
- De-bundle ollama: only hanzo-node is a sidecar; ollama is external/
  configurable (like LM Studio).
- Docs: integration done; Zen5 = Qwen3.5 MoDE (not Qwen3.6).

* fix(desktop): repoint native engine to renamed hanzo crates

Engine fork was rebranded mistralrs-* -> hanzo-* (v0.9.0):
- deps: mistralrs/mistralrs-core -> hanzo (SDK) + hanzo-engine (core)
- imports: mistralrs:: -> hanzo::, mistralrs_core:: -> hanzo_engine::
- dev server/devUrl port 1420 -> 1421

* chore(desktop): lock hanzo/hanzo-engine native-engine deps

* fix(desktop): correct Zen catalog to live hf.co/zenlm naming

Repo models.ts was stale. Use verified HF ids + size-based naming:
- embedding: zen-embedding-0.6B (default) / 4B / 8B  (drop zen3-*, -small/-medium)
- chat: zen-nano-0.6b (default), zen-5 flagship (was zen5), zen-5-coder, zen-eco-4b-instruct
- add gguf_repo for prequantized local loading (zen-embedding-0.6B-GGUF, zen-5-gguf, ...)

* Commit local working changes

---------

Co-authored-by: Antje Worring <[email protected]>

Co-authored-by: Hanzo Dev <[email protected]>
2026-06-17 23:51:24 -07:00

98 lines
2.7 KiB
TypeScript

import { resolve } from 'path';
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vite';
import wasm from 'vite-plugin-wasm';
import tsconfigPaths from 'vite-tsconfig-paths';
import tailwindcss from '@tailwindcss/vite';
// https://vitejs.dev/config/
export default defineConfig(() => ({
resolve: {
alias: {
// libsodium-wrappers-sumo ESM entry imports ./libsodium-sumo.mjs which
// lives in the separate libsodium-sumo package
'./libsodium-sumo.mjs': resolve(
__dirname,
'../../node_modules/libsodium-sumo/dist/modules-sumo-esm/libsodium-sumo.mjs',
),
},
},
plugins: [
react(),
tailwindcss(),
tsconfigPaths({ root: '../..' }),
wasm(),
],
esbuild: {
// Important for wasm plugin
supported: {
'top-level-await': true,
bigint: true,
},
},
// Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
//
// 1. prevent vite from obscuring rust errors
clearScreen: false,
// 2. tauri expects a fixed port, fail if that port is not available
server: {
port: 1421,
strictPort: true,
watch: {
// Exclude output.wav from being watched
ignored: ['**/output.wav'],
},
// headers: {
// 'Cross-Origin-Embedder-Policy': 'require-corp',
// 'Cross-Origin-Opener-Policy': 'cross-origin',
// },
},
// 3. to make use of `TAURI_DEBUG` and other env variables
// https://tauri.studio/v1/api/config#buildconfig.beforedevcommand
// to access the Tauri environment variables set by the CLI with information about the current target
envPrefix: [
'VITE_',
'TAURI_PLATFORM',
'TAURI_ARCH',
'TAURI_FAMILY',
'TAURI_PLATFORM_VERSION',
'TAURI_PLATFORM_TYPE',
'TAURI_DEBUG',
],
build: {
rollupOptions: {
input: {
index: resolve(__dirname, 'index.html'),
hanzo_node_manager: resolve(
__dirname,
'src/windows/hanzo-node-manager/index.html',
),
spotlight: resolve(__dirname, 'src/windows/spotlight/index.html'),
coordinator: resolve(__dirname, 'src/windows/coordinator/index.html'),
hanzo_artifacts: resolve(
__dirname,
'src/windows/hanzo-artifacts/index.html',
),
},
},
},
test: {
watch: false,
setupFiles: './src/test-setup.ts',
globals: true,
cache: { dir: '../../node_modules/.vitest/apps/hanzo-desktop' },
environment: 'jsdom',
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
reporters: ['default'],
coverage: {
reportsDirectory: '../../coverage/libs/hanzo-message-ts',
provider: 'v8',
},
},
worker: {
format: 'es' as const,
},
}));