Contains clickable URLs to every guide/doc file so agents can fetch individual files via HTTP without cloning the repo.
7.2 KiB
7.2 KiB
Tauri 2.0 Reference Library — LLM Index
This file is a navigation index for LLMs and AI agents. Each document listed below is hosted as a raw Markdown file on Gitea. Fetch individual files via their URLs instead of cloning the entire repository.
Base URL pattern: https://git.client.guacamolebox.net/butterfly/tauri2-vin-ws-temp/raw/branch/main/
Official Tauri 2.0 Docs: https://v2.tauri.app Rust API Docs: https://docs.rs/tauri/latest/tauri/
Constraints for Agents
- You cannot compile or run code in a sandbox. Verify correctness using logic, API pattern matching, and cross-referencing these documents.
- All code in this repository is Tauri 2.0 only — do NOT use v1 patterns (see migration section for full v1-to-v2 diff).
- Every plugin requires 4 things: (1) Rust crate in
Cargo.toml, (2).plugin()registration in the Builder, (3) npm package, (4) permissions in capabilities.
Definitive Developer Guide
Part 1: Core Architecture, Config, Commands, IPC (Sections 1–7)
| Topic | Section |
|---|---|
| Architecture overview, project structure, scaffolding | 1–2 |
Configuration (tauri.conf.json v2 schema) |
3 |
| Capabilities & permissions (ACL security model) | 4 |
Rust backend: lib.rs, commands, Builder pattern |
5 |
| Frontend integration (JS imports, invoke, plugins) | 6 |
| IPC: commands, events, channels, streaming | 7 |
Part 2: Windows, Plugins, WebSocket, State, Migration (Sections 8–15)
| Topic | Section |
|---|---|
| Window management (multi-window, external URLs) | 8 |
| Plugin ecosystem (all 33+ official plugins) | 9 |
| Native WebSocket server (Tokio + broadcast) | 10 |
| Script injection into webview windows | 11 |
| State management (Mutex, managed state) | 12 |
| v1 to v2 migration (full API diff) | 13 |
| Anti-patterns to avoid | 14 |
| Quick reference cheat sheet | 15 |
Agent Prompts
Part 1: System Prompt + Common Prompts (Sections 1–7)
| Topic | Section |
|---|---|
| Universal system prompt (REQUIRED prefix) | 1 |
| Scaffold a new Tauri 2.0 project | 2 |
| Add a Tauri plugin | 3 |
| Create a custom command (IPC) | 4 |
| Add state management | 5 |
| Implement event-based communication | 6 |
| Create multi-window app | 7 |
Part 2: Advanced Prompts, Checklist, Migration (Sections 8–15)
| Topic | Section |
|---|---|
| Build a WebSocket server in Rust | 8 |
| Implement script injection | 9 |
| Set up capabilities & permissions | 10 |
| Migrate a v1 app to v2 | 11 |
| Full app build (end-to-end) | 12 |
| Verification checklist for agents | 13 |
| v1 vs v2 API map | 14 |
| Debug a Tauri 2.0 build/compile error | 15 |
Error Resolution Guide
Part 1: Build, Config, Permission, Plugin Errors (Categories A–H)
| Topic | Category |
|---|---|
| Rust compilation errors (Cargo build failures) | A |
| v1-to-v2 migration compile errors | B |
| Async/thread safety errors (Mutex, Send, lifetime) | C |
Config errors (tauri.conf.json validation) |
D |
| Permission/capability errors ("not allowed") | E |
| Plugin integration errors | F |
| IPC / command runtime errors | G |
| Webview & window runtime errors | H |
Part 2: Runtime, Platform, Mobile Errors (Categories I–R)
| Topic | Category |
|---|---|
| Event system errors | I |
| Content Security Policy (CSP) errors | J |
| Frontend integration errors (Vite, Next.js, SvelteKit) | K |
| WebSocket errors | L |
| Path & asset protocol errors | M |
| Shell & sidecar errors | N |
| Mobile build errors (iOS & Android) | O |
| Platform-specific build errors | P |
| Panics & runtime crashes | Q |
| Error handling best practices | R |
| Top 25 most common errors (quick lookup) | Quick-Reference |
Supplementary References
Quick-Reference Cheat Sheet
Commands, config, IPC, and WebSocket patterns in condensed form.
WebSocket Server + Client + Injection Deep-Dive
Comprehensive guide for native WebSocket server implementation, client-side JS integration, and script injection patterns.
Official Docs Links
Curated links to official Tauri 2.0 documentation for migration, security, configuration, and more.
Quick Reference — v1 vs v2
| Area | v1 (WRONG in v2) | v2 (Correct) |
|---|---|---|
| Window type | tauri::Window |
tauri::WebviewWindow |
| Window builder | tauri::WindowBuilder |
tauri::WebviewWindowBuilder |
| Window URL | tauri::WindowUrl |
tauri::WebviewUrl |
| Get window | get_window("main") |
get_webview_window("main") |
| JS invoke import | @tauri-apps/api/tauri |
@tauri-apps/api/core |
| JS window import | @tauri-apps/api/window |
@tauri-apps/api/webviewWindow |
| Plugin JS imports | @tauri-apps/api/<name> |
@tauri-apps/plugin-<name> |
| Config app section | tauri key |
app key |
| Config dist dir | build.distDir |
build.frontendDist |
| Security model | allowlist in config |
Capabilities + Permissions (ACL) |
| Core logic file | main.rs only |
lib.rs + main.rs pattern |
| Event emit | window.emit() |
app.emit() (global) / app.emit_to() (targeted) |
| Rust APIs | tauri::api::* modules |
Everything moved to plugins |
Search Keywords for LLMs
- Error messages: Search exact error string (e.g.,
"unresolved import tauri::api","not allowed") in Error Resolution Guide parts - API names: Search type names (e.g.,
WebviewWindowBuilder,Emitter,Channel) in Definitive Guide parts - Config keys: Search JSON key names (e.g.,
frontendDist,withGlobalTauri,capabilities) in Part 1 of Definitive Guide - Plugin names: Search identifiers (e.g.,
tauri-plugin-fs,fs:default) in Part 2 of Definitive Guide - Migration: Search old v1 names (e.g.,
WindowBuilder,allowlist) to find v2 replacements - Patterns: Search keywords (e.g.,
initialization_script,run_on_main_thread,broadcast channel) in WebSocket guide - Permissions: Search permission strings (e.g.,
core:event:allow-listen,fs:allow-read) in Part 1 Definitive Guide Section 4 and Error Resolution Part 1 Category E