The WeatherCard widget expected a flat shape (`current_temp`,
`condition`, `today_high`, ...) but the prep payload sends raw
OpenMeteo data nested under `forecast_json` per location. Every
field read as null, so the card pinned to the top of the journal
chat showed "null°" and "null/null" — visual noise covering up
the prep prose.
The prep prose itself already mentions weather plainly ("Weather at
home will reach a high of 15.9° with a 0% chance of precipitation"),
so the visual card is redundant. Removing it eliminates the bug
without losing any actual info; the weather data is still in
metadata.sections.weather if a future reader needs it.
Also deletes the unused widget file.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
A small cloud-upload glyph appears next to any row whose id has a
queued offline write (offline-created temp ids and pending edits both
count). Tooltip reads "Pending sync — will save when online". Renders
nothing during normal online operation so the list stays clean.
- DB: `watchPendingIds(domain)` streams the union of target_id and
temp_id across the queue, scoped per domain.
- Per-domain Riverpod stream providers for notes / tasks / projects.
- New `PendingSyncBadge` widget — used by KnowledgeItemCard (both
list and grid variants), `_ProjectCard`, and `_TaskRow` in the
project workspace.
flutter analyze clean; 21 tests pass. Closes#147 — all four phases
of Tier 2 offline mode are in place.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Offline writes now queue + apply optimistically instead of throwing.
On reconnect, the queue drains automatically; conflicts and rejections
surface as one-time SnackBars so the user knows their edit didn't land.
- Drift schema v3: `pending_writes` table (verb + payload + baseline +
tries + last_error). Negative ids serve as cache placeholders for
offline-created rows until replay assigns the server id.
- Each write repository (notes, tasks, projects, milestones, events)
now catches NetworkException, applies the change to cache (with a
fresh `nextTempId()` for creates), and enqueues the API call.
- Edits to a still-queued offline-created row coalesce into the
original create payload — only one server call per row, in order.
- Deletes of still-queued offline-created rows drop the queue entry
and the cache row; no server call ever happens.
- New WriteQueue service drains the queue oldest-first.
Server-wins on `updated_at` baseline check (notes/tasks/projects);
last-writer-wins for milestones/events (no getOne available).
4xx → drop + surface as `rejected`; conflict → drop + `overwritten`;
404 on update → drop + `missing`; 5xx/network → keep + retry next
online cycle.
- Replay fires on AuthStatus → authenticated transitions
(cold-start, came-back-online, login).
- OfflineBanner shows "Retry (N)" with the pending-writes count.
- Distinct ServerException added so 4xx no longer masquerade as
NetworkException — the queue can drop them instead of looping.
flutter analyze clean; 21 tests pass (3 new for QueueFailure messaging).
Phase 4 (read-only UI indicators on cached/temp rows) still ahead.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Phase 1 cached only notes. Phase 2 brings the read-through pattern to every
domain the app reads in bulk:
- Drift schema v2: 5 new cached_* tables + onUpgrade migration. Calendar
events use range-scoped read/write (replaceEventsInRange) so disjoint
month fetches don't clobber each other; milestones are per-project.
- Wrap TasksRepository, ProjectsRepository, MilestonesRepository, and
ChatRepository (conversation list only) with NetworkException fallback.
Writes hit the API then sync the cache.
- New EventsRepository wrapping EventsApi; calendar_provider and
event_form_sheet repointed at the repository.
- OfflineBanner now surfaces getLatestSync() — most-recent timestamp
across all domains — so the hint reads sensibly regardless of screen.
flutter analyze clean; existing tests pass. Phase 3 (offline write queue)
and Phase 4 (read-only UI indicators) still to come.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
First slice of the tier 2 offline mode work tracked in Fable #147.
Notes are the only domain wired so far; this PR establishes the
shape and proves the round-trip end-to-end before extending to tasks
/ projects / events / etc. in phase 2.
Local store
- Adds drift ^2.20.0 + sqlite3_flutter_libs ^0.5.24 + path ^1.9.0
runtime deps and drift_dev / build_runner dev deps.
- New lib/data/local/database.dart: FabledDatabase with CachedNotes
(mirroring the Note model 1:1; tags stored as JSON-encoded text) and
SyncMetadata (per-domain last_synced_at). Database file lives at
$appDocs/fabled_cache.sqlite; opened lazily in a background isolate.
- fabledDatabaseProvider on the existing api_client_provider; closes
the DB when the ProviderScope disposes.
Repository pattern
- NotesRepository now takes (NotesApi, FabledDatabase). Reads attempt
the network first; on success the response is written to the cache.
On NetworkException reads fall back to the cache (rethrowing if it
is empty so fresh-install offline still surfaces the network error).
- Writes (create/update/delete) hit the server then sync the cache;
offline write queueing is phase 3 and explicitly not wired here.
- AuthStatus.offline stays owned by AuthNotifier.verify()'s heartbeat;
this repo deliberately doesn't poke that state.
OfflineBanner
- Reads notesRepository.lastSyncedAt(); when present, swaps
"Offline — showing cached data." for "Offline — last sync X min
ago." A 30s timer refreshes the relative-time string while the
banner is mounted.
- Falls back to the generic message if no cache exists yet (fresh
install offline).
Verification
- flutter analyze: No issues found
Out of scope (later phases per the task body)
- Tasks / projects / milestones / events / conversation list / journal
day caching (phase 2 — same wrapper pattern, repeated)
- Generic write queue with conflict resolution on updated_at (phase 3)
- Read-only UI indicators on screens that depend on cached data
(phase 4)
- Full offline chat (out of scope; needs a local model)
- RAG / search over cached content (out of scope)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Per-screen application of the design system to the Flutter app.
Mirrors the web's surface phase landed in FabledScribe v26.04.28.1.
Foundation port shipped in 0f05f47; this is the surface work.
Lucide icon migration
- Added lucide_icons ^0.257.0 dependency
- 107 Material Icons references → LucideIcons across 21 files. Drop-in
IconData swap (Icon(LucideIcons.X) instead of Icon(Icons.x)).
- Lucide import added to each touched file.
Input border radius
- theme.dart inputDecorationTheme borderRadius 24 → 8 in both light
and dark themes. Doc says radius-md (8px) for inputs; previous pill
shape was Material default that the doc deviates from.
Illuminated Transcript pattern (ChatMessageBubble)
- User bubble: accent-tinted border → neutral Pewter (scheme.outline).
Asymmetric corner already correct (bottomRight 4px).
- Assistant bubble: topLeft corner 4 → 16; only bottomLeft stays 4
(the "tail" effect, mirroring web's `border-bottom-left-radius: 4px`).
Background switched from surfaceContainerHighest (Slate) to surface
(Iron) per the doc spec "card surface".
- Assistant bubble glow shadow added — accent-tinted blur (28px alpha
0.14) + depth shadow (8px alpha 0.4 black). Mirrors web's
--color-bubble-asst-shadow.
ActionColors wiring (Hybrid rule)
- 5 'Delete' confirm buttons across notes / tasks / chat conversations
/ calendar event sheet → Oxblood action-destructive via the
ActionColors ThemeExtension defined in the foundation port. Foreground
for ghost/text variants, backgroundColor for filled.
- Calendar event Save button → Moss action-primary. The first call
site to wire ActionColors.primary; serves as the pattern for future
Save reclassifications.
- Other Save buttons (note edit, task edit, project edit, etc.) still
flow through colorScheme.primary (dusty violet) and read as
brand-moment. Reclassifying those is deferred — the wiring pattern
is established and can be applied incrementally as files are touched.
Indigo cleanup
- 4 hardcoded #7C3AED / #5B21B6 literals → dusty-violet equivalents
(#5B4A8A / #3F3560). Spots: project_tasks_screen color fallback
(×2), journal_screen gradient.
Verification
- flutter analyze: No issues found
What's deferred
- Per-screen Save / Cancel reclassification beyond the calendar event
Save button. Wiring pattern established; rollout opportunistic.
- Long-form 1.7 line-height on assistant Markdown content (would
require MarkdownStyleSheet work; minor).
- Surface walk on Knowledge / Projects / Settings screens for any
hardcoded styling that needs touch.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Mirrors the web frontend's design-system foundation pass (shipped on web
2026-04-27 in 7a9a8b7) for the Flutter app. Single-file change to
lib/core/theme.dart — most widgets read colorScheme.primary so the
palette flip alone covers a large surface.
Palette swap
- dark: cool grey #0F0F14 / #16161F → Obsidian #14171A / Iron #1E2228
with Slate #2C313A and Pewter #3F4651 borders; Parchment #E8E4D8
primary text, Vellum #C2BFB4 secondary
- light: white-and-cool-blue → warm parchment #F5F1E8 page / #FBF8F0
cards / #EFEAE0 inset; deep ink #14171A text; warm pewter #D9D6CE
borders
- primary (both modes): indigo #7C3AED → dusty violet #5B4A8A
- error: indigo-red pair → terracotta #C04A1F (semantic Error per the
doc; distinct from destructive Oxblood used for delete buttons)
Action token ThemeExtension
- New ActionColors extension exposes Moss / Bronze / Oxblood / Pewter
outside the ColorScheme so widgets can read them via
Theme.of(context).extension<ActionColors>()!.primary etc.
- Hybrid rule: ColorScheme.primary stays the dusty-violet brand accent
(Send buttons, empty-state CTAs); action buttons (Save / Cancel /
Delete / ghost) use the ActionColors palette. No widget refactors in
this commit — extension is defined for surface-phase work to consume.
Typography
- Inter loaded for body / labels / titleMedium-and-below (was system
default)
- Fraunces still loaded for display / headline / titleLarge — only at
≥18px per the doc rule
- JetBrains Mono available for code at call sites via
GoogleFonts.jetBrainsMono() (Flutter has no mono TextTheme slot)
GradientButton
- Brand-moment CTA equivalent of the web's --gradient-cta. Colors
swapped from indigo gradient to dusty-violet (#5B4A8A → #3F3560);
glow shadow rgba updated to match.
Out of scope (deferred to later surface-phase work)
- Per-screen button reclassification (Save → Moss FilledButton, Delete
→ Oxblood, etc.) — the ActionColors extension exists, no widgets
reach for it yet
- Lucide icon migration — separate task, requires picking a
flutter_lucide / lucide_icons package
- Input border radius (currently 24 / pill, doc says 8) — leave for
surface phase
- Voice/tone copy touchups
- Chat bubble Illuminated Transcript pattern (assistant left-edge
accent + glow) — not yet ported to ChatMessageBubble
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Previously, if the backend was unreachable at launch, the splash screen
routed to the login screen. The server URL remained persisted in
SharedPreferences but visually appeared lost, frustrating any user who
isn't the service operator.
- New AuthStatus.offline distinguishes network failures (NetworkException)
from HTTP 401 in AuthNotifier.verify().
- Persist has_ever_logged_in flag on first successful verify/login.
- Offline + ever-logged-in lands on the briefing with a sticky offline
banner (retry button) instead of being punted to login.
- OfflineBanner widget is Tier-2-ready so we can surface "last sync X min
ago" once real caching lands (Fable task #147).
Fetch server-side settings on app launch via new serverSettingsProvider.
Hide News from bottom sheet and NavigationRail when RSS is disabled.
Skip news card rendering in briefing messages when disabled.
Refactor tab navigation to use dynamic tabs list and route-based refresh.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update provider: auto-downloads APK in background after finding a newer
version, prompts via snackbar only when ready, cleans up old APKs on
startup. Replaces modal dialog with dismissible snackbar.
Chat bubble: resolve relative image URLs (/api/images/{id}) against
server base URL with auth cookies so search_images results render on
the phone app.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
VadHandler is now the sole mic owner — removed separate AudioRecorder that
caused audio focus contention on Android. Audio from onSpeechEnd is encoded
as WAV for Whisper. Provider switched to autoDispose to match widget lifecycle,
preventing defunct element assertions. Recording UI deferred until mic is open.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use VadHandler from the vad package (Silero VAD v5 ONNX) for speech
detection instead of amplitude thresholds. VAD runs its own PCM
stream while the file recorder captures AAC-LC for Whisper. Grace
period starts on speech-start, auto-stop on speech-end after grace.
No-speech guard shows error on manual stop without detected speech.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Shell: move Projects/News/Calendar into ShellRoute so the NavigationRail
persists across all screens. Show all 6 nav destinations on tablet
instead of 3+More overflow. Phone bottom nav unchanged.
Chat: master-detail layout on tablet — conversations list (320px) with
inline chat panel. Tapping a conversation updates state instead of
pushing a new route.
Knowledge: responsive grid (2 cols portrait, 3 cols landscape) with
card layout showing icon, title, body preview, and tags. Fix snippet
data — read json['snippet'] which the API actually sends. Bump snippet
length from 120 to 200 chars. Tasks now show description as snippet.
News: responsive grid with the same breakpoints. Larger snippet
(5 lines) in grid mode via snippetMaxLines parameter.
Briefing: centered reading column (maxWidth 700) on wide screens,
matching the web UI layout.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The previous -40 dBFS static threshold sat right on top of typical
phone mic ambient, so silence detection rarely fired and the user
always had to tap stop manually.
Silence threshold is now dynamic: track the session peak dBFS and
treat "silent" as 15 dB below peak. Auto-calibrates per mic and
environment rather than assuming a fixed ambient level.
- Grace period (1500 ms) at start so the user has time to begin
speaking before checks arm.
- Static -35 dB fallback until the peak clears -20 dB so a dead-
silent session doesn't spin forever.
- Silence duration bumped 1500 → 2000 ms for breathing room.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
VoiceState now carries a normalized mic amplitude (0..1) updated
from the existing onAmplitudeChanged subscription, with a 0.02
change threshold so we don't spam rebuilds.
VoiceMicButton swaps the constant-rate AnimationController for an
AnimatedScale + animated glow driven by the live amplitude. 0.1
floor keeps the button breathing on silence; 120ms ease-out smooths
between 200ms samples.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Purple-on-black was eye-catching but hard to read. Switch title text
to onSurface for contrast; keep the underline in primary at 70% alpha
as the "this is a link" signal.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Briefing chat now uses the same StreamIterator + 45s per-event timeout
as the main chat provider, so a dropped SSE socket no longer leaves
isBriefingStreaming stuck true. Adds refreshMessages() that unfreezes
state when the server-side message is complete, wired to a new
pull-to-refresh gesture and the app lifecycle-resume hook.
Chat provider gains attachToGeneration() — safe to call unconditionally
on screen init, so landing on a conversation that's already mid-stream
(e.g. the /news discuss button, which now creates a conv and auto-kicks
generation server-side) picks up live tokens instead of freezing on the
placeholder.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Mobile chat occasionally froze with the input disabled and nothing
progressing — the underlying cause is SSE sockets dropping silently on
mobile network handoffs / proxy idle timeouts. Dio never observes the
close, so the send loop's `await for` hangs indefinitely with
isStreaming=true.
Three changes:
- Wrap the SSE stream in a StreamIterator with a 45s per-event timeout
as a stall watchdog. On timeout, break out and let the polling pass
reconcile state from the server.
- Add pull-to-refresh on the chat message list and an AppBar refresh
button with inline spinner feedback. Works on both empty and
populated states.
- MessagesNotifier.refresh() now also clears isStreaming /
streamingStatus when the server reports the latest assistant message
as complete — so a stuck UI unfreezes the moment the user pulls down
or taps refresh, even if the original SSE loop is still hanging.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Chips now show the entity title ("Created note: Grocery List") and
deep-link to the matching screen when tapped — notes to the detail
screen, tasks to the edit screen, projects to the project tasks view,
events to the calendar. Read-only tools and errors stay non-tappable.
Closes the main goal behind the mobile chip work: seeing that a note
was created and jumping straight to it without backing out to the
library.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The mobile app was receiving SSE status events but showing the peek text
only while the assistant bubble was empty — as soon as the first token
arrived, the status line was replaced by streaming content and any tool
calls fired mid-turn left no trace. Tool call SSE events were also being
dropped by the parser, and Message.fromJson never read the persisted
tool_calls array, so chips never rendered after reload either.
Parse tool_call SSE frames into a new ChatToolCall event, carry tool
calls on Message, and update the chat and briefing streaming loops to
append chips to the in-flight assistant message as they arrive. Rework
ChatMessageBubble to show a chip row + rolling peek status line above
any streamed text, matching the web ToolCallCard/status indicator
behaviour across chat, briefing, and briefing history surfaces.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Voice: recreate AudioRecorder each session to avoid stale native
state, improve permission handling (re-check after settings), show
feedback after 3 consecutive empty transcripts, allow STT-only mode
when TTS is unavailable.
Knowledge: hydrate IDs immediately after loading more pages so
scroll-based pagination doesn't stall at the bottom.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Offline queue (SharedPreferences) persists captures when the device
is offline and replays them as chat conversations on next launch,
preserving the same fire-and-forget guarantee as the online path.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace POST /api/quick-capture with: create a conversation, send the
message, and fire-and-forget the SSE generation stream so the assistant
processes the request in the background without blocking the UI.
The new conversation appears immediately in the chat tab.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Same navigator mismatch as the chat delete bug — outer context inside
showDialog builder resolves to the wrong navigator ancestor.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Navigator.pop(outerContext) inside a showDialog builder resolves to the
ShellRoute's nested navigator instead of the root navigator where the
dialog lives, popping the conversations route and showing a black screen.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds discussArticle() to BriefingApi and wires it through to the
RSS news cards in BriefingScreen so tapping Discuss opens a chat
conversation seeded with the article. Also caps RSS cards per
message at 3 to avoid overly long briefing threads.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The app was creating conversations with title 'New conversation'.
The server only generates a title when conv_title is falsy (empty).
With a non-empty title, should_gen_title is False for the first
message (msg_count % 10 != 0), so auto-naming never fired.
Now creates with empty title (matching web app behaviour). The list
still displays 'New conversation' as a UI placeholder until the
server-generated title arrives.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Three bugs causing silent STT failure on Android:
1. AudioEncoder.opus produces an OGG container on Android but the file
was named .webm — faster-whisper rejected it due to format mismatch.
Changed to AudioEncoder.aacLc + .m4a (reliable on all Android versions).
Updated voice_api.dart to send audio/mp4 MIME type accordingly.
2. onError callback was never stored, so errors in _startListening() and
_handleSilence() were silently swallowed. Now stored as _onError and
called before exitVoiceMode() on any failure.
3. Amplitude stream can emit NaN or ±Infinity on some Android devices
during recorder initialisation. NaN < -40.0 is false, so silence was
never detected. Now treated explicitly as silence.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- App resume: invalidates all main providers (conversations, calendar,
news, knowledge, briefing) when the app returns to foreground.
Throttled to once per 5 minutes to avoid hammering the server.
- Tab switch: refreshes the incoming tab's provider when navigating
between Briefing / Knowledge / Conversations shell tabs.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Tasks are not part of the knowledge API (backend rejects type=task).
When the Tasks tab is selected, fetch from /api/tasks and convert to
KnowledgeItem. Also removes per-type counts from tab labels to prevent
tabs from awkwardly resizing when counts load.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Parse SSE `status` events alongside `chunk` events and display the
status text next to the spinner while the assistant is generating.
Previously the Android app discarded all non-chunk SSE events.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>