VibeGame / src /lib /services /context.md
dylanebert's picture
initial commit
794cf6c
|
raw
history blame
1.17 kB

Services

Business logic layer with pure functions and singleton services

Purpose

  • Encapsulate complex business logic
  • Provide clean APIs for operations
  • Keep components simple and declarative

Layout

services/
β”œβ”€β”€ context.md          # This file
β”œβ”€β”€ auth.ts             # Hugging Face OAuth authentication
β”œβ”€β”€ game-engine.ts      # Game lifecycle management
β”œβ”€β”€ console-capture.ts  # Console interception
└── html-parser.ts      # Game HTML parsing

Scope

  • In-scope: Business logic, side effects, API calls, authentication
  • Out-of-scope: UI rendering, state storage

Entrypoints

  • authStore.login() - Start OAuth flow
  • authStore.logout() - Clear authentication
  • authStore.getToken() - Get current token
  • authStore.isTokenValid() - Check token validity
  • gameEngine.start() - Start game with world content
  • gameEngine.stop() - Clean up game instance
  • consoleCapture.setup() - Begin console interception
  • HTMLParser.extractGameContent() - Parse world from HTML

Dependencies

  • @huggingface/hub for OAuth
  • VibeGame for game engine
  • Stores for state updates
  • No UI dependencies