Add option for the notification interval
Summary by cubic
Adds a configurable toast duration for Magic Context notifications and threads it end-to-end from config to the TUI. The TUI loads it via a new toast-duration RPC and uses a unified toast helper; dream, status, setup, and restart toasts respect the setting, with 10s overrides for setup/restart.
-
New Features
- Added
toast_duration_msto config/schema (1000–60000, default 5000ms); documented and exposed in the Dashboard Config Editor. - New
toast-durationRPC; the TUI fetches and caches it on startup and uses a unifiedshowToastwith per-toast overrides. NotificationParamsandStatusDetailcarrytoastDurationMs; server notifications are queued via RPC and respect the duration.
- Added
-
Bug Fixes
- Preserved
toast_duration_msincreateSessionHooksand threaded it throughgetLiveNotificationParamsand command handlers so dream notifications use the configured duration; added regression test.
- Preserved
Greptile Summary
This PR adds a configurable toast_duration_ms setting (1000–60000 ms, default 5000 ms) for Magic Context TUI notifications. The config is validated via Zod, exposed in the Dashboard Config Editor and CONFIGURATION.md, fetched by the TUI on startup via a new toast-duration RPC, and threaded through NotificationParams so server-side notifications (dream, recomp outcomes) respect the configured duration.
- New RPC endpoint
toast-durationlets the TUI fetch and cachetoast_duration_mson startup; a unifiedshowToasthelper uses the cached value with per-call override support (durationOverrideMs). create-session-hooks.tsnow passestoast_duration_msinto the magic-context hook config so/ctx-dreamnotifications use the configured duration instead of always falling back to 5 s; a regression test covers this.- Restart-required toasts correctly carry
durationOverrideMs: 10_000, matching the intent called out in the previous review round.
Confidence Score: 4/5
Safe to merge after addressing the polling retry loop; all core notification paths behave correctly.
The 500 ms message poller fires refreshToastDurationMs() on every tick when the toast duration equals the default value. Because 5000 ms is both the configured default and the error-path fallback, this condition is permanently true for any user who has not overridden the setting — the overwhelming majority. Everything else in the PR (schema, RPC handler, dream notification threading, restart-toast overrides) is straightforward and correct.
packages/plugin/src/tui/index.tsx — the poller's retry guard at line 838
Important Files Changed
| Filename | Overview |
|---|---|
| packages/plugin/src/tui/index.tsx | Adds showToast helper, loadToastDurationMs on startup, and unified duration; restart toasts correctly carry durationOverrideMs: 10_000 — but the poller's retry guard fires every 500ms for default-config users |
| packages/plugin/src/plugin/rpc-handlers.ts | Adds toast-duration RPC handler and populates StatusDetail.toastDurationMs; the toastDurationMs field on StatusDetail is computed and transported but never read by any TUI consumer |
| packages/plugin/src/hooks/magic-context/command-handler.ts | Adds toastDurationMs to executeDreaming deps and dreamNotificationParams; correctly threads config value from createMagicContextCommandHandler |
| packages/plugin/src/plugin/hooks/create-session-hooks.ts | Threads toast_duration_ms from pluginConfig into the magic-context hook config; regression test added |
| packages/plugin/src/shared/rpc-types.ts | Adds toastDurationMs field to StatusDetail type with correct documentation |
| packages/plugin/src/tui/data/context-db.ts | Adds loadToastDurationMs() RPC helper; clean implementation with safe fallback |
Reviews (9): Last reviewed commit: "fix: thread toast duration through sessi..." | Re-trigger Greptile