mirror of
https://github.com/Darkatse/TauriTavern.git
synced 2026-10-13 13:11:09 +00:00
|
|
||
|---|---|---|
| .agents | ||
| .github/workflows | ||
| .vscode | ||
| default | ||
| docs | ||
| example/agents/instruct_prompt | ||
| fastools | ||
| scripts | ||
| src | ||
| src-tauri | ||
| tests | ||
| .gitattributes | ||
| .gitignore | ||
| .taurignore | ||
| ExtensionDEV.md | ||
| LICENSE | ||
| package.json | ||
| pnpm-lock.yaml | ||
| pnpm-workspace.yaml | ||
| README.md | ||
| README_EN.md | ||
| rspack.config.js | ||
| tsconfig.host.json | ||
TauriTavern
TauriTavern ports SillyTavern into a native desktop app with Tauri v2 + Rust backend while keeping the upstream frontend experience. The frontend is now synced to SillyTavern 1.16.0 and integrated through a modular Tauri injection layer.
Highlights
- Native desktop runtime on Windows, macOS, Linux (Tauri v2)
- Rust backend with clean architecture layering
- Frontend compatibility with SillyTavern 1.16.0
- Chat Completion providers: OpenAI, Claude, Gemini(MakerSuite), and Custom OpenAI-compatible endpoint
- Modular request injection pipeline (
src/tauri/main/*), organized as a maintainable Host Kernel layering (context/kernel/services/adapters/routes) - Stable platform ABI:
window.__TAURITAVERN__+ request tracing header:x-tauritavern-trace-id - Engineering guardrails: strict type checks (
tsc -p tsconfig.host.json) + dependency/line-budget rules (routes must not referencewindow) - Unified frontend bootstrap pipeline without runtime loader indirection
Architecture
Backend (src-tauri)
presentation: Tauri commands and API boundaryapplication: use cases/services and DTO orchestrationdomain: core models, contracts, errorsinfrastructure: file persistence, repositories, logging
Frontend (src)
- Upstream SillyTavern frontend code (HTML/CSS/JS)
- Tauri bridge and interception layer for replacing HTTP endpoints with local Tauri command calls
Frontend startup flow:
src/init.jsloadslib.js->tauri-main.js->script.jssrc/lib.jsstatically importssrc/dist/lib.core.bundle.jsand re-exports a stable ESM library surface (heavy/optional libs are loaded on demand viagetHljs()/getReadability()fromsrc/dist/lib.optional.bundle.js)src/tauri-main.jsdelegates tobootstrapTauriMain()src/tauri/main/bootstrap.jscreates context/router/interceptors, installs thewindow.__TAURITAVERN__platform ABI, and injects a trace header for host-handled routes
Frontend Integration Layout
src/
├── tauri-bridge.js # low-level Tauri bridge (invoke/listen/convertFileSrc)
├── tauri-main.js # thin bootstrap entry
├── init.js # startup orchestrator
├── lib.js # library facade (ESM exports)
├── dist/lib.core.bundle.js # Rspack-built core vendor bundle (startup-critical)
├── dist/lib.optional.bundle.js # Rspack-built optional vendor bundle (on-demand)
└── tauri/main/
├── bootstrap.js # composition root
├── context.js # compatibility shim (re-export `context/index`)
├── context/ # host kernel facade + types (stable contract)
├── kernel/ # pure logic (policies/tracing/hash/...)
├── services/ # stateful capabilities (assets/thumbnails/characters/android…)
├── adapters/ # adapters touching window/DOM/upstream ST
├── http-utils.js # request/response parsing helpers
├── interceptors.js # fetch/jQuery ajax patching
├── router.js # lightweight route registry
└── routes/
├── system-routes.js
├── settings-routes.js
├── extensions-routes.js
├── resource-routes.js
├── character-routes.js
├── chat-routes.js
└── ai-routes.js
Development
Prerequisites:
- Rust stable
- Node.js 22.12+
- pnpm
- Tauri CLI
Setup:
git clone https://github.com/Darkatse/tauritavern.git
cd tauritavern
pnpm install
Common commands:
pnpm run check # guardrails + host-kernel type checks (recommended)
pnpm run web:build # build frontend bundles (Rspack)
pnpm run dev # desktop dev mode (alias of tauri:dev)
pnpm run tauri:dev # desktop dev mode
pnpm run tauri:build # build desktop installers
pnpm run android:dev # Android dev mode
pnpm run ios:dev # iOS dev mode
Portable build notes:
pnpm run tauri:build:portableoutputs torelease/by default- You can force portable runtime mode via
TAURITAVERN_RUNTIME_MODE=portableorportable.flag - On Windows, portable users must ensure WebView2 runtime is available
FasTools (Debug Utility)
fastools is an useful toolkit that facilitates debugging during development and desktop deployment.
Build:
pnpm run fastools:build
Run:
pnpm run fastools:run
If you prefer cargo directly, run from repository root:
cargo build --release --manifest-path fastools/Cargo.toml
cargo run --manifest-path fastools/Cargo.toml
Documentation
docs/FrontendGuide.md: frontend architecture and extension guidedocs/FrontendHostContract.md: public host-kernel contract (keep stable during refactors)docs/BackendStructure.md: backend architecture detailsdocs/TechStack.md: stack and integration choicesdocs/ImplementationPlan.md: roadmap and milestones
License
AGPL-3.0 (same license family as SillyTavern).
