How x-t-e-r/openpet works
OpenPet is a local desktop-pet runtime: users configure a companion, import compatible pet packs, and see it react to clicks, movement, and agent progress. The main path runs from an agent or user through the local HTTP API or settings UI, into Tauri runtime state, then to the pet window and its animation. The README also documents CLI and MCP control, website import, event reactions, and configurable storage. Source excerpts clarify UI and API calls; some Rust runtime wiring and import details are only partially shown.
Main entry points: PetWindow.tsx Pet window · lib.rs Tauri runtime · SettingsPage.tsx Settings UI · http_api.rs Local HTTP API
Components 17
Desktop experience
- Settings UI
src/SettingsPage.tsx - Pet window
src/PetWindow.tsx - Window router
src/App.tsx
Pet behavior
- Pet catalog
src/pet/catalog.ts - Settings model
src/pet/settings.ts - Animation engine
src/pet/animation.ts - Walking motion
src/pet/motion.ts - Event mapping
src/pet/events.ts - Sprite renderer
src/pet/PetSprite.tsx
Runtime and imports
- Tauri runtime
src-tauri/src/lib.rs - Local HTTP API
src-tauri/src/http_api.rs - Bundled pet assets
public/pets
Agent interfaces
- OpenPet CLI
skills/openpet-cli/scripts/openpet_cli.py - MCP bridge
skills/openpet-mcp/scripts/openpet_mcp_server.py
Other components
- Desktop user
- Local agent
- Pet websites
Connections 27
- Desktop user → Settings UI: configures
README.md - Desktop user → Pet window: interacts with
README.md - Local agent → OpenPet CLI: uses
README.md - Local agent → MCP bridge: uses
README.md - Local agent → Local HTTP API: controls via HTTP
README.md - OpenPet CLI → Local HTTP API: calls localhost
README.md - MCP bridge → Local HTTP API: calls runtime API
README.md - Settings UI → Tauri runtime: invokes commands
src/SettingsPage.tsx - Settings UI → Settings model: uses settings model
src/SettingsPage.tsx - Settings UI → Pet catalog: uses catalog
src/SettingsPage.tsx - Settings UI → Event mapping: validates events
src/SettingsPage.tsx - Local HTTP API → Tauri runtime: dispatches actions
src-tauri/src/http_api.rs - Local HTTP API → Tauri runtime: requests imports
src-tauri/src/http_api.rs - Tauri runtime → Pet window: emits runtime events
- Tauri runtime → Pet catalog: provides snapshot
- Tauri runtime → Bundled pet assets: loads bundled packs
- Pet websites → Tauri runtime: provides import source
README.md - Pet window → Walking motion: resolves walking
src/PetWindow.tsx - Pet window → Animation engine: uses dimensions
src/PetWindow.tsx - Pet window → Settings model: reads preferences
src/PetWindow.tsx - Pet window → Sprite renderer: renders
src/PetWindow.tsx - Sprite renderer → Animation engine: uses frames
src/pet/PetSprite.tsx - Sprite renderer → Pet catalog: reads pet sheet
src/pet/PetSprite.tsx - Settings model → Pet catalog: uses catalog defaults
src/pet/settings.ts - Event mapping → Animation engine: maps event actions
src/pet/events.ts - Window router → Pet window: selects pet view
src/App.tsx - Window router → Settings UI: selects settings view
src/App.tsx