Skip to content

feat(app): add reactive pet bubbles based on global metrics#26

Open
aiexkwan wants to merge 1 commit into
ntd4996:mainfrom
aiexkwan:pet-reactive-bubbles
Open

feat(app): add reactive pet bubbles based on global metrics#26
aiexkwan wants to merge 1 commit into
ntd4996:mainfrom
aiexkwan:pet-reactive-bubbles

Conversation

@aiexkwan

Copy link
Copy Markdown
Contributor

Summary

  • Pet reacts to 6 global metrics via speech bubbles: rate limit, daily token usage, session count, hunger, streak days, and daily meals
  • Powered entirely by existing @Published data sources (OpenUsageClient, PetCareController, AppDaemon) — zero new extraction logic
  • Tiered phrase pools (silent → low → mid → high) with cooldown tracking (same-metric ≥10min, cross-metric ≥30s, hunger max 2/day) to prevent notification spam
  • New "Pet Reactive Bubbles" toggle in Settings → Bubble (default ON)
  • 36 unit tests covering all threshold boundaries and cooldown gate logic

Design details

Component Implementation
ReactiveEngine @MainActor singleton, Combine sinks on 3 existing publishers
Thresholds Static constants in Thresholds namespace, table-driven tier resolution
Cooldown Per-metric + cross-metric + hunger daily limit, UTC day-key tracking
UI integration PetController.flashReactiveLine(_:) — respects showChat, never changes pet mood
Settings BubbleSettings.reactiveBubblesEnabled persisted in UserDefaults

Test plan

  • swift build — compiles cleanly
  • swift test — 186 tests, 0 failures, no regressions
  • Manual: wait for rate limit to drop below 50% → pet shows rate limit reaction bubble
  • Manual: accumulate >1M tokens in a day → pet shows token usage reaction
  • Manual: open 5+ concurrent agent sessions → pet shows session count reaction
  • Manual: toggle OFF "Pet Reactive Bubbles" in Settings → no more reactive bubbles appear
  • Manual: toggle OFF "Show chat" → reactive bubbles also suppressed

Pet reacts to rate limits, daily token usage, session count, hunger,
streak days, and daily meals via speech bubbles — all powered by
existing @published data sources with zero new extraction logic.
Includes tiered phrase pools, cooldown tracking, and a settings toggle.
@aiexkwan aiexkwan force-pushed the pet-reactive-bubbles branch from 714159c to 56ef574 Compare June 17, 2026 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant