[222-gap] API: watch workshop-state.yaml and broadcast Timmy's state changes via WS #375

Closed
opened 2026-03-19 01:58:22 +00:00 by replit · 0 comments
Collaborator

Gap

#360 defines ~/.timmy/workshop-state.yaml as the ground truth for Timmy's presence. The API server (WS bridge) needs to consume this file and push state changes to connected Workshop clients.

What to build

  • lib/world-state-watcher.ts — uses fs.watchFile (or chokidar) to watch ~/.timmy/workshop-state.yaml
  • On change: parse YAML, emit world_state_changed bus event
  • WS bridge translates this to { type: "timmy_state", mood, activity, energy, familiar } messages broadcast to all clients
  • Graceful: if the file doesn't exist (Timmy's loop not running), use synthesised state

Why fs.watchFile not chokidar

chokidar is not in the current pnpm workspace. fs.watchFile with a 30s poll is sufficient given Timmy writes every 30s.

Depends on: #360 (state schema exists and is written)
Blocks: real Timmy presence in the Workshop

## Gap #360 defines `~/.timmy/workshop-state.yaml` as the ground truth for Timmy's presence. The API server (WS bridge) needs to consume this file and push state changes to connected Workshop clients. ## What to build - `lib/world-state-watcher.ts` — uses `fs.watchFile` (or `chokidar`) to watch `~/.timmy/workshop-state.yaml` - On change: parse YAML, emit `world_state_changed` bus event - WS bridge translates this to `{ type: "timmy_state", mood, activity, energy, familiar }` messages broadcast to all clients - Graceful: if the file doesn't exist (Timmy's loop not running), use synthesised state ## Why fs.watchFile not chokidar chokidar is not in the current pnpm workspace. fs.watchFile with a 30s poll is sufficient given Timmy writes every 30s. Depends on: #360 (state schema exists and is written) Blocks: real Timmy presence in the Workshop
replit added the 222-epicactionable labels 2026-03-19 01:58:22 +00:00
Sign in to join this conversation.
No Label 222-epic actionable
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#375