Commit Graph

376 Commits

Author SHA1 Message Date
jake
8b34fed606 refactor(kon): add design tokens — radius scale, title size, button component classes
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 02:17:25 +00:00
jake
b9178f8117 feat(kon): add schema versioning — sequential migration system replaces CREATE TABLE IF NOT EXISTS
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 02:13:19 +00:00
jake
e70cfca63d refactor(kon): remove LLM command stubs — will be rewritten with llama-cpp-rs in Phase 3
- Remove 8 LLM command registrations from invoke_handler macro
- Delete commands/llm.rs stub file
- Remove pub mod llm from commands/mod.rs
- Build passes cleanly with cargo clippy

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 02:11:11 +00:00
jake
ad31249e88 fix(kon): remove all Ramble references — titles, exports, copy, version bump to v1.0
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 02:09:51 +00:00
jake
11bf7163da fix(kon): hotkey event mismatch — layout now dispatches kon:toggle-recording
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 02:09:48 +00:00
jake
6e959ed0c9 refactor(kon): clean up storage and cloud-providers — remove unused deps, add safety docs
- Remove unused chrono and uuid dependencies from kon-storage
- Add schema versioning TODO to run_migrations() for pre-release safety
- Add doc comment and usage example to log_error() (uncalled public API)
- Add TODO to consolidate app_data_dir() with model_manager::dirs_path()
- Add safety comments and #[allow(deprecated)] to keystore set_var usage
- Add TODO for keyring crate migration in cloud-providers keystore
- Apply cargo fmt

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 00:23:30 +00:00
jake
2ac98e6d40 fix(kon): normalise British English table, single-pass whitespace collapse, byte-index safety
- Normalise BRITISH_REPLACEMENTS: remove baked-in \b from entries so all
  entries are plain base words; the function adds boundaries uniformly
- Replace O(n*m) while-loop double-space removal with single-pass collapse
- Add debug_assert! documenting ASCII assumption for byte-indexed suffix slicing
- Expand llm_client.rs module-level doc comment
- Run cargo fmt on ai-formatting crate

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 00:19:59 +00:00
jake
95c8d490c3 fix(kon): harden core crate — shared System instance, accurate CPU field, serialisable errors
- Share single System::new_all() in probe_system() instead of calling it twice
- Rename CpuInfo::core_count to logical_processors (sys.cpus().len() returns logical, not physical)
- Add fallback arm to probe_os() for unsupported cfg targets
- Add serde::Serialize to KonError for structured frontend error reporting
- Annotate dead code (ProviderRegistry, TranscriptMetadata) with #[allow(dead_code)] + TODO comments
- Update downstream references in recommendation tests and tauri hardware command

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 00:19:04 +00:00
jake
4fa20255ae fix(kon): rename ramble refs, fix export extensions, use shared constants in DictationPage
- Rename custom event from ramble:toggle-recording to kon:toggle-recording
- Change download filename prefix from ramble- to kon-
- Fix export extension mapping: csv and html formats now produce correct file extensions instead of falling through to .txt
- Add console.warn when PCM buffer exceeds 5-minute cap and gets truncated
- Replace magic numbers with shared constants (MAX_PCM_SAMPLES, MIN_CHUNK_SAMPLES, CHUNK_INTERVAL_MS, FEEDBACK_TIMEOUT_MS)
- Use shared pad() utility from time.js instead of inline reimplementation
- Remove unused saveTasks import
- Simplify redundant 3-branch append logic to 2 branches with clarifying comment
- Use $derived.by to avoid double transcript.trim() in wordCount

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 00:16:55 +00:00
jake
c5b2767ad8 fix(kon): task sidebar overlay click handling
- Backdrop tint div has direct onclick to close sidebar
- Sidebar panel uses stopPropagation so clicks inside don't close
- Outer container uses target check for self-click dismiss
- Svelte 5 compatible (no |self modifier)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 23:33:54 +00:00
jake
fe3739fdbb fix(kon): task sidebar overlay, Parakeet model management, conditional engine settings
TaskSidebar:
- Changed from flex layout member to fixed overlay with backdrop
- Click backdrop or press Escape to close
- Content no longer shrinks when sidebar opens — buttons stay accessible
- Positioned at z-50 over main content, top offset for titlebar

Settings — Parakeet model management:
- Added Parakeet model state: download, check, load status
- New downloadParakeet() and loadParakeet() functions
- Listens for parakeet-download-progress events
- Parakeet section shows download/load/status controls

Settings — conditional engine sections:
- Whisper model selector only shows when engine === "whisper"
- Parakeet model controls only show when engine === "parakeet"
- Cleaner UI — only active engine's options visible

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 23:26:27 +00:00
jake
1ad2b55d9c fix(kon): float window sidebar, transcription doubling guard, branding
Float window fixes:
- Root layout now detects /float and /viewer URLs and hides Sidebar,
  Titlebar, TaskSidebar for secondary windows. Belt-and-braces fix
  since +layout@.svelte should handle this but may not in SPA mode.
- Float window title: "Ramble - To-do" → "Kon - To-do"

Transcription doubling guard:
- Added chunk_id deduplication set in DictationPage — if a chunk_id
  has already been processed, skip the duplicate result
- Set cleared on each new recording session

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 23:07:30 +00:00
jake
c463293935 fix(kon): security audit fixes — CSP, XSS, unwraps, key rename
Security fixes from code audit:
- CSP re-enabled in tauri.conf.json with strict directives
  (was null — critical vulnerability)
- XSS fix in viewer highlightText(): HTML entities escaped before
  inserting <mark> tags via {@html}
- Removed 3 unwrap() calls in rule_based.rs British English conversion
  — replaced with safe let-else guards
- Removed unwrap() on main window lookup in lib.rs setup — now uses
  if-let for graceful handling
- Wrapped JSON.parse in DictationPage transcription-result listener
  with try/catch

Rebrand cleanup:
- Renamed all localStorage keys from ramble_* to kon_* across
  7 files (stores, viewer, float, history)

12 tests passing, clippy clean.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 22:51:47 +00:00
jake
904d5fdb95 feat(kon): add first-run hardware probe and model recommendation wizard
- New probe_system command: returns RAM, CPU, OS info
- New rank_models command: scores models against detected hardware
- FirstRunPage.svelte: hardware summary, ranked model list with
  "Recommended" badge on top pick, download progress bar, skip option
- First-run detection in layout: checks list_models + list_parakeet_models,
  shows wizard if both empty
- Sidebar hidden during first-run for clean wizard experience
- clippy clean

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 22:02:01 +00:00
jake
57eccaf373 fix(kon): spinner direction, sidebar nav lock, rebrand to Kon
- Spinner: reversed sinhala-spin from counter-clockwise to clockwise
- Sidebar nav lock: removed {#key page.current} block that forced full
  destroy/recreate of pages on every navigation. DictationPage's AudioWorklet
  cleanup in onDestroy was blocking the UI during the {#key} destruction cycle.
  Now uses {#if} blocks only — smoother page transitions.
- Rebranded sidebar: Ramble → Kon, v0.2 → v1.0

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 21:58:56 +00:00
jake
0bbdbc0591 feat(kon): replace browser clipboard with arboard
- New copy_to_clipboard Tauri command using arboard 3.6
- Replaced all 5 navigator.clipboard.writeText() calls across
  DictationPage, HistoryPage, FilesPage, and viewer with invoke()
- Native clipboard access independent of WebView permissions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 21:48:19 +00:00
jake
292f9716ff feat(kon): add full transcript provenance — enriched schema, metadata pipeline, error log
Schema enrichment:
- transcripts table: +engine, +model_id, +inference_ms, +sample_rate, +audio_channels,
  +format_mode, +remove_fillers, +british_english, +anti_hallucination
- New error_log table: context, error_code, message, metadata (JSON)
- 5 indices on frequently queried columns

Metadata pipeline:
- TranscriptMetadata struct in kon-core for full provenance capture
- LocalEngine tracks loaded ModelId, returns TimedTranscript with inference_ms
- std::time::Instant timing around transcribe-rs inference calls
- Tauri transcription commands emit inference_ms in event payloads
- InsertTranscriptParams accepts all provenance fields
- log_error() for structured error logging to SQLite

Every transcript is now fully reproducible from its stored metadata.
23 tests passing, clippy clean.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 21:36:44 +00:00
jake
29ff91d3f6 feat(kon): wire Tauri shell — thin commands, ProviderRegistry, tray
- lib.rs rewritten from scaffold to full app setup (~70 lines)
- AppState holds Arc<LocalEngine> for Whisper and Parakeet
- commands/models.rs: download, check, list, load for both engines
  Maps legacy size strings (Tiny/Base/Small/Medium) to ModelId
- commands/transcription.rs: transcribe_pcm, transcribe_file, transcribe_pcm_parakeet
  Delegates to LocalEngine.transcribe_sync() + post_process_segments()
- commands/audio.rs: save_audio via kon_audio::write_wav
- commands/windows.rs: open_task_window, open_viewer_window
- commands/llm.rs: 8 stub commands preserved for frontend compatibility
- tray.rs: extracted system tray setup (show, status, quit, click-to-show)
- Close-to-tray behaviour preserved
- All 25 v0.2 command names preserved for Svelte frontend compatibility
- clippy clean

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 21:15:16 +00:00
jake
0646c75de7 fix(kon): resolve ort version conflict — stub VAD, fix audio crate
- VAD stubbed: voice_activity_detector and silero-vad-rust both pin ort rc.10
  which conflicts with transcribe-rs requiring ort rc.12. Stubbed until ort
  ecosystem aligns at 2.0.0 stable. All audio treated as speech (matches v0.2).
- Refreshed Cargo.lock to resolve ort rc.12 + whisper-rs 0.16 correctly
- clippy clean

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 21:09:38 +00:00
jake
a83eafdc82 feat(kon): add cloud-providers crate — BYOK stubs, keystore
- Keystore stub using environment variables (keyring integration deferred)
- Minimal crate ready for cloud STT provider implementations post-Stage 1

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 21:01:07 +00:00
jake
ec06ab07c7 feat(kon): add storage crate — SQLite schema, CRUD operations
- SQLite via sqlx 0.8 with runtime-tokio
- Schema: transcripts, segments, tasks, task_lists, settings tables
- Full CRUD for transcripts (insert, get, list, delete)
- Full CRUD for tasks (insert, list, complete, delete)
- Settings key-value store (insert/replace, get)
- File storage paths: app_data_dir, database_path, recordings_dir
- 3 async tests passing against in-memory SQLite, clippy clean

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 20:59:21 +00:00
jake
a30c9cc107 feat(kon): add audio crate — cpal capture, VAD, rubato resample, symphonia decode
- File decode via symphonia (mp3, aac, flac, wav, ogg) with mono mixdown
- Sinc interpolation resampling via rubato 0.15 (48kHz/44.1kHz → 16kHz)
- WAV I/O via hound (read/write with f32→i16 conversion)
- Microphone capture via cpal 0.17 (WASAPI on Windows) with mpsc channel output
- Voice activity detection via Silero VAD V5 (voice_activity_detector 0.2)
- Async decode_and_resample() for file transcription pipeline
- 3 tests passing (resample passthrough, duration preservation, WAV roundtrip)
- clippy clean, no ort version conflicts

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 20:56:30 +00:00
jake
100ecb4eae feat(kon): add transcription crate — transcribe-rs wrapper, model manager
- LocalEngine wraps transcribe-rs SpeechModel behind Kon's own abstraction
- load_parakeet() and load_whisper() factory functions
- Unified model manager: download with progress callback, check, list, path resolution
- Atomic downloads: .part suffix with rename on completion
- run_inference() encapsulates spawn_blocking threading
- Zero Tauri dependency in this crate (progress via callback, not events)
- transcribe-rs v0.3.2 with onnx + whisper-cpp features
- 4 tests passing, clippy clean

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 20:39:37 +00:00
jake
0738fca22c feat(kon): add ai-formatting crate — filler removal, British English, text pipeline
- Filler word removal using word-boundary regex (fixed regex-lite lookbehind limitation)
- British English conversion: 26 -ize/-ise patterns, -or/-our, -er/-re, -ense/-ence
- Text formatting: sentence capitalisation, spacing cleanup
- Hallucination filter: blank_audio, music, silence, auto-thanks detection
- Post-processing pipeline: composed from pure functions, supports Raw/Clean/Smart modes
- Smart mode inserts paragraph breaks on >2s pauses between segments
- 12 tests passing, clippy clean

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 20:29:46 +00:00
jake
6588130e36 feat(kon): add core crate — types, traits, hardware, model registry, recommendation
- Value objects: ModelId, EngineName, Megabytes, AudioSamples, Segment, Transcript
- KonError enum with thiserror
- Constants centralised: audio pipeline, VAD, RAM thresholds, inference threading
- SpeechToText and TextProcessor provider traits with ProviderRegistry
- Unified model registry (Whisper tiny/base/small/medium + Parakeet CTC int8)
- Hardware detection: probe_ram, probe_cpu, probe_gpu (stub), probe_os
- Recommendation engine: score_model (pure function), rank_recommendations (sorted)
- 5 tests passing, clippy clean

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 20:27:27 +00:00
jake
9926a42b7a feat(kon): scaffold hybrid modular workspace
- Cargo workspace with 6 domain crates: core, audio, transcription, ai-formatting, storage, cloud-providers
- Minimal Tauri shell (lib.rs + main.rs) with plugin registration
- Svelte 5 frontend copied from Ramble v0.2
- All crates compile as empty stubs
- App identifier: uk.co.corbel.kon

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 20:21:38 +00:00