Docs

Documentation

Live Activity Panel — Design

Date: 2026-11-05 · Repo: StratoSort Stack · Status: approved for planning

Goal

Let people see what the app is doing while it works: a floating, draggable, minimizable panel inside the main window that shows a friendly Activity feed by default and the real pino log lines in a Raw tab, in near real time.

Non-goals

Changes during implementation

The first non-goal held only in part. Beyond the panel itself, these shipped:

User-facing behavior

Architecture

Main process

  1. Logger hook (src/shared/logger.js): an opt-in listener API — addLiveRecordListener(fn) / removeLiveRecordListener(fn) — called from Logger._safeWrite after the record is written (pino or the console fallback; a write that throws announces nothing), with the already-sanitized message and data, and only when this.pino.isLevelEnabled(level) (so the feed shows exactly what the log contains), as { time, level, context, msg, data }. Zero cost when no listener is registered. Listener errors are swallowed (never break logging). Renderer messages the app already forwards into the main-process log appear too, with no extra work.
  2. liveLogFeed (src/main/services/liveLogFeed.js):
    • Registers the logger listener only while ≥1 renderer is subscribed.
    • Ring buffer of the last 500 entries (kept only while subscribed; cleared on last unsubscribe).
    • Each entry gets id (monotonic), the raw fields, and activity from the classifier (or null).
    • Sends batches to subscribed webContents every 250 ms, at most 200 entries per batch (oldest dropped first beyond that, with a dropped count in the batch).
    • Unsubscribes automatically when a webContents is destroyed.
  3. activityFromLogRecord (src/main/services/liveLogActivity.js): pure function. A table of rules keyed by context + message match → { kind, icon, text, file?, tone }. Initial rules (exact strings confirmed against the code during implementation):
    • Smart-folder watcher: analyzing file / analysis complete
    • Image / document analysis success (with category) and new-folder suggestions
    • Vision runtime starting / ready / shutting down; vision batch entered / exited
    • Embedding model loading / unloaded; embedding queue batch flushed
    • Vector store persisted (which collections); storage full raised / cleared
    • Organize: file moved (from → folder), undo
    • Downloads watcher: new download / held for disk full
    • Search index built; startup knowledge repair summary
    • Any warn/error record → "Problem: …" (tone warn/error)
  4. IPC:
    • Invoke system:live-log:subscribe → returns { entries: backlog } and starts streaming to the sender; system:live-log:unsubscribe.
    • Push event system:live-log:batch → { entries, dropped } (event-only channel).
    • Channels added to src/shared/constants.js, preload allowlist, Zod schemas (validationSchemas.js), event schema (ipcEventSchemas.js), so the existing verify scripts pass (generate:channels:check, verify:ipc-handlers, verify:ipc-handler-schemas, verify:ipc-event-schemas).

Renderer

Error handling

Performance

Accessibility

Testing

Edit this page on GitHub