Files
Lumotia/docs/architecture-map/02-tauri-runtime/commands/profiles.md
Jake 26c7307607
Some checks failed
check / cargo check (macos-latest) (push) Has been cancelled
check / cargo check (ubuntu-22.04) (push) Has been cancelled
check / cargo check (windows-latest) (push) Has been cancelled
check / svelte build + lint (push) Has been cancelled
agent: lumotia-rebrand — docs, scripts, root config, residuals
Phase 9 of the rebrand cascade. Sweep covers everything the Phase 8
frontend pass deliberately skipped: docs/, root markdown, scripts,
Cargo.toml descriptions, code comments that survived earlier
word-boundary sed, plus a handful of identifiers caught on the final
verify pass.

transcription-app changes:
- README.md, HANDOVER.md, KNOWN-ISSUES.md, run.sh — magnotia/Magnotia
  -> lumotia/Lumotia.
- docs/ — sweep across all subdirs except docs/handovers/ (preserved
  as immutable audit trail). Includes architecture-map references
  to magnotia_core::*, magnotia_storage::*, etc. now pointing at
  lumotia_*; dev-setup.md tracing output examples (lumotia_startup
  target); brief/ + superpowers/ + issues/ + whisper-ecosystem/ +
  audit/.
- Cargo.toml descriptions on 9 crates (core, audio, cloud-providers,
  hotkey, llm, mcp, plus referenced others).
- crates/core/src/{error,hardware,recommendation,paths}.rs +
  crates/audio/src/wav.rs + crates/llm/src/model_manager.rs +
  crates/cloud-providers/src/keystore.rs + crates/mcp/src/lib.rs —
  doc comments and a model-manager user-agent string.
- Caught on final pass: BroadcastChannel("magnotia_task_sync") -> ...
  ("lumotia_task_sync"); magnotia_locale i18n localStorage key
  renamed + migration shim added; CSS keyframe names
  magnotiaPulse / magnotiaBar / magnotiaFade renamed in the design-
  system kit; magnotia_viewer_item / magnotia_viewer_mode handoff
  keys renamed in HistoryPage + viewer/+page.svelte; src/assets/
  wordmark.svg text.
- src-tauri/src/lib.rs comment cleanup ("magnotia era" was sed'd
  to "lumotia era" earlier — restored).

Preserved (intentional):
- crates/core/src/paths.rs — keeps "magnotia" / "Magnotia" / ".magnotia"
  legacy detection strings in legacy_and_target_paths() so the
  migration shim can still find user data from the magnotia era.
- src/lib/stores/{page,focusTimer}.svelte.ts + src/lib/i18n/index.ts
  — migration call sites reference the legacy magnotia keys
  deliberately.
- docs/handovers/ — historical audit trail.

cargo build --workspace passes. 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>
2026-05-13 12:38:03 +01:00

5.2 KiB

name, type, slice, last_verified
name type slice last_verified
Profiles architecture-map-page 02-tauri-runtime 2026/05/09

commands::profiles

Where you are: Architecture mapTauri runtimeCommands → Profiles

Plain English summary. Task 12 storage-backed profiles + per-profile vocabulary terms. Profiles are the unit that scopes a Whisper initial_prompt, a vocabulary list (biases the decoder toward correct spellings), HITL feedback exemplars, and transcripts. Nine commands: profile CRUD (5), profile-term CRUD (3), and the auto-learn pass that diffs an original transcript against an edited transcript and persists likely vocabulary corrections.

At a glance

  • Path: src-tauri/src/commands/profiles.rs.
  • LOC: 185.
  • Tauri commands exposed (9 total):
    • list_profiles_cmd(state) -> Result<Vec<ProfileDto>, String>.
    • get_profile_cmd(state, id) -> Result<Option<ProfileDto>, String>.
    • create_profile_cmd(state, name, initial_prompt) -> Result<ProfileDto, String>.
    • update_profile_cmd(state, id, name, initial_prompt) -> Result<(), String>.
    • delete_profile_cmd(state, id) -> Result<(), String>. The Default profile is guarded at the storage layer (SQLite triggers + Rust pre-checks).
    • list_profile_terms_cmd(state, profile_id) -> Result<Vec<ProfileTermDto>, String>.
    • add_profile_term_cmd(state, profile_id, term, note) -> Result<ProfileTermDto, String>.
    • learn_profile_terms_from_edit_cmd(state, profile_id, original_text, edited_text) -> Result<Vec<ProfileTermDto>, String>.
    • delete_profile_term_cmd(state, id) -> Result<(), String>.
  • Events emitted: none.
  • Depends on: lumotia_storage::{create_profile, update_profile, delete_profile, list_profiles, get_profile, add_profile_term, list_profile_terms, delete_profile_term, ProfileRow, ProfileTermRow}, lumotia_ai_formatting::extract_corrections.
  • Called from frontend at: Settings → Profiles (full CRUD), profile picker, History viewer (the auto-learn flow runs after the user saves an edit).

What's in here

ProfileDto and ProfileTermDto (src-tauri/src/commands/profiles.rs:31, :51)

camelCase mirrors of the storage rows. ProfileDto.initialPrompt is the saved Whisper prompt; ProfileTermDto.term is the vocabulary entry, note is a freeform note (used to mark "Auto-learned from transcript edit" for the auto-learn flow).

AUTO_LEARNED_NOTE (:25)

Constant so the auto-learn rows are uniformly tagged.

CRUD wrappers

  • list_profiles_cmd (:72), get_profile_cmd (:82), create_profile_cmd (:93), update_profile_cmd (:105), delete_profile_cmd (:117). Pure passthroughs to storage.
  • list_profile_terms_cmd (:127), add_profile_term_cmd (:138), delete_profile_term_cmd (:177). Same pattern.

learn_profile_terms_from_edit_cmd (:151)

  1. Pull the existing terms (so the diff doesn't propose duplicates).
  2. Call lumotia_ai_formatting::extract_corrections(&original, &edited, &existing_terms).
  3. Persist each new term via add_profile_term with the AUTO_LEARNED_NOTE.
  4. Return the freshly-inserted DTOs.

The actual diff heuristic lives in the formatting crate; the command file is just wiring.

Data flow

Settings Profiles tab -> list_profiles_cmd -> [ProfileDto, ...]
profile picker -> get_profile_cmd(id)
add profile -> create_profile_cmd(name, prompt) -> ProfileDto
edit profile -> update_profile_cmd(id, name, prompt) -> ()
delete profile -> delete_profile_cmd(id) -> () (Default is rejected at storage)

Profile terms tab -> list_profile_terms_cmd(profile_id)
add term -> add_profile_term_cmd(profile_id, term, note) -> ProfileTermDto
delete term -> delete_profile_term_cmd(id) -> ()

History viewer save edit:
  -> learn_profile_terms_from_edit_cmd(profile_id, original, edited)
     -> existing terms from DB
     -> extract_corrections(original, edited, existing) -> [String]
     -> add each as a profile term tagged "Auto-learned from transcript edit"
     -> [ProfileTermDto, ...]

Watch-outs

  • No ensure_main_window guard. The History viewer is a secondary window (transcript-viewer) and needs to call learn_profile_terms_from_edit_cmd after a save. So the whole module is callable from anywhere with the secondary-windows capability. If you want to lock down profile creation / deletion, add ensure_main_window to the destructive ones.
  • No PowerAssertion. No inference here.
  • extract_corrections runs synchronously (in the async fn). Acceptable for the small-text shape of a single transcript edit.
  • The Default profile is unkillable. SQLite trigger rejects the delete. Frontend should grey out the delete button when profile.id == DEFAULT_PROFILE_ID.
  • Auto-learned terms are recorded one at a time inside a loop (:166). Each iteration is a separate insert. Acceptable; if a future heuristic produces dozens of terms per edit, batch.

See also