Development
Local development, builds, tech stack, architecture, and the REST API.
Development
Requirements
- Node.js 22 or newer;
.nvmrcselects the default development version. Focused state regressions require Node.js 24 or newer. - Rust 1.91 or newer, declared by the workspace for the updated security dependencies.
- Session data from at least one supported CLI.
Desktop platform dependencies:
| Platform | Requirements |
|---|---|
| Windows | Visual C++ Build Tools and WebView2 |
| macOS | Xcode command-line tools (xcode-select --install) |
| Ubuntu/Debian | libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf |
The web server does not need desktop WebKit/GUI libraries.
Run locally
git clone https://github.com/zuoliangyu/AI-Session-Viewer.git
cd AI-Session-Viewer
npm ci
npx tauri devUse npx tauri dev for desktop development: it starts both the Rust backend and Vite. Running Vite alone does not provide a desktop backend.
Windows provides ./menu.ps1; Linux/macOS provide ./menu.sh. Script details are in scripts/README.md. For web development, use npm run dev:web.
Build and validate manually
Run node scripts/audit-dependencies.mjs for dependency security checks. It reads lockfiles, verifies the vendored patch and queries advisories without installing dependencies or compiling. See dependency security maintenance for scope, the GLib backport and the remaining maintenance warning.
# Desktop packages
npx tauri build
# Web executable
npm run build:web && cargo build -p session-web --release
# Docker image
docker build -t ai-session-viewer-web .
# Lightweight regression checks
npm run check:scripts
npm run check:regressions # Node.js 24+, focused state regressions without compilation
# Rust lint and TypeScript validation
cargo clippy --workspace -- -D warnings
npx tsc --noEmitDesktop artifacts are in target/release/bundle/; the web executable is target/release/session-web. Local menu builds disable updater artifacts and do not require a signing key. Release CI uses repository signing secrets.
AppImage: the project pins @tauri-apps/cli to 2.11.4, which includes Tauri #15596. It creates relative .DirIcon and root .desktop symlinks, so they remain valid outside the build machine. Install dependencies from the lockfile. node scripts/check-appimage.mjs checks the version pin; Linux artifact extraction and launch still require manual verification. See the artifact checklist.
The interface remains Chinese by default. Providing an English option alone does not satisfy the AppImage catalog's request for English by default outside Chinese locales.
Translations: edit both dictionaries in src/i18n/locales/. Components use useTranslation; utilities share the same i18next instance. Keep placeholders consistent and do not translate user content. See src/i18n/README.md.
Release checks: tag releases call the CI workflow from the same commit and wait for all checks to pass before packaging or publishing. Failed or cancelled checks block release. CI also runs for pull requests, pushes to main/master, and manual runs; tags do not start a duplicate standalone CI run.
An independent Node.js 24 CI job runs focused regressions for sync previews, empty tag caching, question trees, message request isolation, billing pagination, chat lifecycle, and message navigation. The checks exercise real state logic with in-memory APIs and WebSockets, each in a separate process so mocks cannot leak between checks. They do not replace Rust/TypeScript compilation or live UI verification.
Conversation links and desktop navigation
Markdown HTTP(S) and mailto: links open in the system default application on desktop and in a new tab with opener isolation on the web. In-page anchors remain available. File, script, custom-protocol and relative-path links render as text instead of application routes. The desktop WebView only accepts exact application origins; development additionally permits the exact scheme, host and port configured in devUrl, preventing remote pages from gaining local IPC access.
node scripts/check-markdown-links.mjs verifies filtering and system-browser calls with in-memory mocks. It does not open real links. Rust navigation tests in src-tauri/src/navigation.rs require manual compilation.
Architecture
| Layer | Technology |
|---|---|
| Desktop | Tauri v2, Rust, system WebView |
| Web server | Axum + WebSocket |
| Frontend | React 19, TypeScript, Vite 6 |
| UI | Tailwind CSS, lucide-react |
| State | Zustand 5 |
| Localization | i18next + react-i18next |
| Rendering | react-markdown, remark-gfm, react-syntax-highlighter |
| Charts | Recharts |
| Shared backend | session-core Rust crate |
The Cargo workspace contains crates/session-core, src-tauri, and crates/session-web. Shared React components use api.ts, which selects Tauri IPC or HTTP/WebSocket via the compile-time __IS_TAURI__ flag. Providers parse source-specific files into shared project, session, and display-message models.
API overview
The web API uses source=claude|codex|grok|omp where applicable. Authenticated deployments require a bearer token.
| Method | Endpoint | Purpose |
|---|---|---|
| GET | /api/projects, /api/sessions | List projects and sessions |
| DELETE | /api/sessions | Delete a session |
| GET | /api/messages | Paginated messages (filePath, page, pageSize, fromEnd) |
| GET | /api/messages/questions | Compact question index (source, filePath) |
| GET | /api/messages/location | Locate any message role (source, filePath, messageId); returns { messageIndex: number | null }, with null for missing IDs |
| POST | /api/sessions/fork | Fork a session |
| PUT | /api/sessions/meta | Update alias and tags |
| GET | /api/trajectory | Codex trace records |
| GET | /api/export | JSON / Markdown / HTML export |
| GET | /api/scan-progress | Initial scan progress |
| GET | /api/search, /api/tags, /api/cross-tags | Search and tags |
| GET | /api/stats, /api/stats/requests, /api/stats/projects, /api/stats/session | Usage and cost statistics |
| GET, POST | /api/bookmarks | List or add bookmarks |
| DELETE | /api/bookmarks/:id | Remove a bookmark |
| GET | /api/cli/detect, /api/cli/config | CLI detection and masked configuration |
| POST | /api/models | List models |
| GET, DELETE | /api/skills | List or delete skills |
| GET | /api/skills/content | Read SKILL.md |
| POST | /api/skills/import | Import a ZIP archive |
| GET | /api/provider-sync/status | Provider metadata status |
| POST | /api/provider-sync/sync, /api/provider-sync/switch | Sync or change provider |
| POST | /api/provider-sync/restore, /api/provider-sync/prune | Restore or prune backups |
| WS | /ws, /ws/chat | File events and CLI chat |
