Skip to content

feat: persist and display device uptime and logged-in user#90

Open
ToddHebebrand wants to merge 2 commits intomainfrom
feat/agent-updates
Open

feat: persist and display device uptime and logged-in user#90
ToddHebebrand wants to merge 2 commits intomainfrom
feat/agent-updates

Conversation

@ToddHebebrand
Copy link
Collaborator

Summary

  • Agent: Compute system uptime via host.BootTime() (gopsutil) and send as uptime in heartbeat payload
  • API: Add last_user and uptime_seconds columns to devices table (migration + Drizzle schema), persist both fields in heartbeat handler
  • Frontend: Display uptime and logged-in user as summary cards on device overview tab and as info rows on the Device Details tab

Test plan

  • Agent compiles (go build ./cmd/breeze-agent)
  • Agent heartbeat tests pass (go test ./internal/heartbeat/...)
  • Frontend type-checks (tsc --noEmit)
  • Run pnpm db:migrate to apply migration
  • Send test heartbeat with lastUser and uptime fields — verify stored in DB
  • Navigate to device detail page — verify uptime and logged-in user appear in overview cards and Device Details tab

🤖 Generated with Claude Code

ToddHebebrand and others added 2 commits February 13, 2026 17:15
The agent already collected lastUser but it was never stored in the DB
or shown in the UI, and uptime was not computed at all. This adds:

- Agent: compute uptime via gopsutil host.BootTime() and include in heartbeat
- API: new DB migration adding last_user/uptime_seconds columns to devices
- API: heartbeat handler now persists both fields on each heartbeat
- Frontend: uptime and logged-in user cards on device overview tab
- Frontend: uptime and logged-in user rows on device info tab

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add lastUser and uptimeSeconds to device list API select and response
  mapping so overview cards populate when navigating from the list
- Log warning when host.BootTime() fails instead of silently swallowing
- Add .max(255) to lastUser and .min(0) to uptime Zod validation
- Extract duplicated formatUptime into shared lib/utils.ts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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