agent: lumotia-rebrand — localStorage keys + event channels migration
Phase 7 of the rebrand cascade. Persisted UI state + inter-window event
channels migrated from magnotia to lumotia naming, with one-shot
localStorage key migration so dogfooded UI state survives the rename.
src/lib/utils/localStorageMigration.ts (new):
- migrateLocalStorageKey(old, new): idempotent + crash-safe shim.
- If new key exists, removes old (lumotia value is authoritative).
- If only old exists, copies value to new key, removes old.
- If neither, no-op.
- migrateLocalStorageKeys(pairs): batch wrapper.
src/lib/stores/page.svelte.ts:
- 4 key constants renamed to lumotia_settings / lumotia_profiles /
lumotia_task_lists / lumotia_templates.
- BroadcastChannel name renamed to lumotia_task_lists.
- migrateLocalStorageKeys() called at module load before any read.
src/lib/stores/focusTimer.svelte.ts:
- STORAGE_KEY renamed to lumotia.focusTimer.v1.
- migrateLocalStorageKey() called at module load.
Event channels (magnotia: -> lumotia:) renamed across frontend + Rust:
- magnotia:toggle-recording (src/routes/+layout.svelte)
- magnotia:hotkey-pressed / -released (src-tauri/src/commands/hotkey.rs +
consumers)
- magnotia:open-wind-down (src-tauri/src/tray.rs + consumer)
- magnotia:llm-download-progress (src-tauri/src/commands/llm.rs)
- magnotia:preferences-changed (src/lib/stores/preferences.svelte.ts +
consumers)
- magnotia:start-timer (nudgeBus + dispatch sites)
- magnotia:focus-timer-{complete,cancelled} (focusTimer + nudgeBus)
- magnotia:microstep-generated (nudgeBus + dispatch sites)
- magnotia:step-completed (nudgeBus + dispatch sites)
- magnotia:task-{completed,uncompleted,deleted} (page.svelte.ts +
nudgeBus + consumers)
Storage-event filters in src/routes/{float,viewer,preview}/+layout@.svelte
updated to filter on lumotia_settings.
User-facing toast strings still say "Magnotia" — deferred to Phase 8
(frontend strings).
npm run check: 0 errors / 0 warnings (3958 files).
cargo test --workspace: 339 pass / 0 fail.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -36,10 +36,21 @@ export const page = $state<PageState>({
|
||||
taskSidebarOpen: false,
|
||||
});
|
||||
|
||||
const SETTINGS_KEY = "magnotia_settings";
|
||||
const PROFILES_KEY = "magnotia_profiles";
|
||||
const TASK_LISTS_KEY = "magnotia_task_lists";
|
||||
const TEMPLATES_KEY = "magnotia_templates";
|
||||
import { migrateLocalStorageKeys } from "$lib/utils/localStorageMigration";
|
||||
|
||||
const SETTINGS_KEY = "lumotia_settings";
|
||||
const PROFILES_KEY = "lumotia_profiles";
|
||||
const TASK_LISTS_KEY = "lumotia_task_lists";
|
||||
const TEMPLATES_KEY = "lumotia_templates";
|
||||
|
||||
// One-shot key rename from the magnotia era. Idempotent. Runs once at
|
||||
// module load before any localStorage read below.
|
||||
migrateLocalStorageKeys([
|
||||
["lumotia_settings", SETTINGS_KEY],
|
||||
["magnotia_profiles", PROFILES_KEY],
|
||||
["magnotia_task_lists", TASK_LISTS_KEY],
|
||||
["magnotia_templates", TEMPLATES_KEY],
|
||||
]);
|
||||
|
||||
const defaults: SettingsState = {
|
||||
engine: "whisper",
|
||||
@@ -459,7 +470,7 @@ export async function deleteTask(id: string) {
|
||||
tasks.splice(idx, 1);
|
||||
broadcastTasks();
|
||||
if (typeof window !== "undefined") {
|
||||
window.dispatchEvent(new CustomEvent("magnotia:task-deleted", { detail: { id } }));
|
||||
window.dispatchEvent(new CustomEvent("lumotia:task-deleted", { detail: { id } }));
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
@@ -477,7 +488,7 @@ export async function completeTask(id: string) {
|
||||
// to this to clear micro-step-idle timers for the completed task
|
||||
// and, later, to drive Phase 7 "after a task completes" rules.
|
||||
if (typeof window !== "undefined") {
|
||||
window.dispatchEvent(new CustomEvent("magnotia:task-completed", { detail: { id } }));
|
||||
window.dispatchEvent(new CustomEvent("lumotia:task-completed", { detail: { id } }));
|
||||
}
|
||||
} catch (err) {
|
||||
toasts.error("Couldn't complete task", errorMessage(err));
|
||||
@@ -491,7 +502,7 @@ export async function uncompleteTask(id: string) {
|
||||
await invoke("uncomplete_task_cmd", { id });
|
||||
applyLocalTaskUpdate(id, { done: false, doneAt: null });
|
||||
if (typeof window !== "undefined") {
|
||||
window.dispatchEvent(new CustomEvent("magnotia:task-uncompleted", { detail: { id } }));
|
||||
window.dispatchEvent(new CustomEvent("lumotia:task-uncompleted", { detail: { id } }));
|
||||
}
|
||||
} catch (err) {
|
||||
toasts.error("Couldn't uncomplete task", errorMessage(err));
|
||||
@@ -654,7 +665,7 @@ interface TaskListChannelMessage {
|
||||
}
|
||||
|
||||
const taskListChannel = typeof BroadcastChannel !== "undefined"
|
||||
? new BroadcastChannel("magnotia_task_lists")
|
||||
? new BroadcastChannel("lumotia_task_lists")
|
||||
: null;
|
||||
|
||||
if (taskListChannel) {
|
||||
|
||||
Reference in New Issue
Block a user