Add Device Logs panel#61
Conversation
📝 WalkthroughWalkthroughAdds a "Device Logs" sidebar with SSE streaming, client parsing/filtering utilities, a useDeviceLogs hook for buffered EventSource consumption, UI components (panel, tool, status, log row), client integration, and tests for parsing/filtering/buffering and server query-level handling. ChangesDevice Logs Feature
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/serve-sim/src/client/hooks/use-device-logs.ts`:
- Around line 46-50: The enqueue function can let pendingEntries.current grow
without bound while RAF is paused; modify enqueue (and associated flush logic)
to cap the queue (e.g., trim to a MAX_PENDING constant, dropping oldest entries)
and to install a fallback timer: when you schedule requestAnimationFrame in
enqueue (frame.current), also set a fallback timeout (e.g., FLUSH_TIMEOUT_MS)
that calls flush if RAF never fires, and clear that timeout inside flush; ensure
frame.current and the fallback handle are cleared after flush. Target
functions/vars: enqueue, pendingEntries.current, frame.current, flush, and the
RAF/timeout scheduling.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: fdba749b-e880-4c16-a893-4dee59f14687
📒 Files selected for processing (8)
packages/serve-sim/src/__tests__/device-logs.test.tspackages/serve-sim/src/client/client.tsxpackages/serve-sim/src/client/components/device-logs-panel.tsxpackages/serve-sim/src/client/components/device-logs-tool.tsxpackages/serve-sim/src/client/hooks/use-device-logs.tspackages/serve-sim/src/client/utils/logs.tspackages/serve-sim/src/client/utils/panel-widths.tspackages/serve-sim/src/middleware.ts
|
Logs are currently being sent to the browser console which allows agent MCP tools to query the logs like they would any other website. |
Yep, makes sense. I kept that path working, this PR is more for humans using serve-sim directly: searchable/filterable device logs in the UI without opening Xcode or digging through DevTools. If you’d rather keep logs console-only, I’m fine closing it. |



Summary
Adds a dedicated Device Logs panel for viewing simulator logs from the serve-sim UI while preserving the existing browser-console log stream used by agent/browser tooling.
Changes
/logsSSE endpoint with controlled verbosity