Nico Albanese 166f287aef
Add offline diff caching and viewing support (#83)
* Add cached diff viewing for offline sandbox state

Cache diff results in the database when fetched from a live sandbox.
When the sandbox is offline, the diff viewer falls back to cached data
with a visual indicator showing when it was last saved.

- Add cachedDiff and cachedDiffUpdatedAt fields to tasks schema
- Create /api/tasks/[id]/diff/cached endpoint for retrieving cached diffs
- Update diff viewer to show stale banner when viewing cached data
- Enable diff button when sandbox is offline but cached data exists
- Fix lint issues: unused variables, missing useCallback dependencies

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* update

* Show git diff stats in header and remove Share button

Display +/- line counts next to the Diff button in the task header.
Initialize diff cache from database on page load to prevent layout shift.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Clean up unused variables and add type assertion comments

- Remove unused _isStale destructuring in diff-viewer
- Remove unused _timeRemaining parameter from SandboxInputOverlay
- Simplify boolean cast for cachedDiff disabled check
- Add comments explaining jsonb type assertions are safe

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 22:38:57 +00:00
..