agent: lumotia — v0.1 release-completion run
Closes the code-side v0.1 ship gate. All quality gates green: cargo fmt/clippy/test (~327 tests), npm check (0/0), vitest 13/13, scripts/dogfood-rebrand-drill.sh 8/8. Phase F — first-run onboarding promoted to v0.1 - FirstRunPage with skip-to-main + failure recovery + event recording - Six onboarding commands (record/list/has-completed + lumotia_events) - Storage migration v17 (onboarding_events + lumotia_events tables) UI hardening (in-scope items from v0.1-ui-hardening.md) - StatusPill + PostCaptureCard components, 21st preview entry - Sidebar recording-as-sacred-state (opacity + aria-disabled, reduced-motion) - Settings 6-section regroup + Help section + Activation log + Privacy toggle - Error-state copy sweep (DictationPage + SettingsPage, plain-language) - Global :focus-visible rule, textarea outlines restored - Ctrl+K / Ctrl+, / Escape bindings in +layout LLM resilience - rule_based_extract_tasks (regex-free imperative-verb extractor) + extract_tasks_with_fallback wrapper — task extraction never returns zero - tokio::time::timeout(120s) wraps cleanup/tags/tasks commands Release artefacts - LICENSE (canonical AGPL-3.0), CHANGELOG (Keep-a-Changelog format) - v0.1-release-notes, privacy-and-ai-use, install-warnings, tester-onboarding-kit, tester-acceptance-runbook, code-signing-setup, apple-silicon-rb08-runbook, virtual-audio-setup, v0.1-contrast-audit - Workspace versioning + AGPL spdx; npm exact-pin (10 ranges removed) - AppImage SHA-256 sidecar in build.yml - README v0.1 section + Reporting-issues; canonical repo slug Closure pass — items moved from human-required to code-complete - KI-02 Linux idle inhibit: zbus 5 → org.freedesktop.login1.Manager.Inhibit - KI-03 Windows sleep prevention: SetThreadExecutionState(ES_CONTINUOUS|...) - acquire/release_idle_inhibit Tauri commands, wired in DictationPage - Diagnostic-bundle frontend wire-up (Settings → Help button) - WCAG-AA contrast fix via .btn-filled-text utility (no token changes) - 8 destructive-action sites wrapped in plain-language confirm() guards - KNOWN-ISSUES.md + v0.1-known-limitations.md updated (KI-02/03 fixed) Scripts - pre-tag-verify.sh, tag-day.sh, smoke-linux + driver - parse-diagnostic-bundle.sh, parse-activation-log.py Per-item audit trail: docs/release/v0.1-completion-status.md Remaining: W-01…W-08 (signing certs, hardware probes, smoke matrix, tester recruitment) — see docs/release/v0.1-known-limitations.md.
This commit is contained in:
@@ -4,10 +4,12 @@
|
||||
import { Channel, invoke } from "@tauri-apps/api/core";
|
||||
import { emit } from "@tauri-apps/api/event";
|
||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||
import { page, settings, templates, profiles, addToHistory, addTask, tasks } from "$lib/stores/page.svelte.js";
|
||||
import { page, settings, templates, profiles, addToHistory, addTask, tasks, history } from "$lib/stores/page.svelte.js";
|
||||
import { markGenerating, markGenerationDone } from "$lib/stores/llmStatus.svelte.js";
|
||||
import { playStartCue, playStopCue, playCompleteCue } from "$lib/utils/sounds.js";
|
||||
import { profilesStore } from "$lib/stores/profiles.svelte.ts";
|
||||
import StatusPill from "$lib/components/StatusPill.svelte";
|
||||
import PostCaptureCard from "$lib/components/PostCaptureCard.svelte";
|
||||
import { toasts } from "$lib/stores/toasts.svelte.js";
|
||||
import Card from "$lib/components/Card.svelte";
|
||||
import ModelDownloader from "$lib/components/ModelDownloader.svelte";
|
||||
@@ -35,6 +37,7 @@
|
||||
let modelLoading = $state(false);
|
||||
let needsDownload = $state(false);
|
||||
let error = $state("");
|
||||
let errorDetail = $state(""); // technical detail shown in <details>, separate from user-facing copy
|
||||
let showExportMenu = $state(false);
|
||||
let transcribing = $state(false);
|
||||
let saved = $state(false);
|
||||
@@ -204,7 +207,9 @@
|
||||
}
|
||||
|
||||
if (status.type === "error") {
|
||||
error = status.message || "Live transcription failed";
|
||||
// Sub-task D: plain-language error with technical detail behind <details>
|
||||
error = "The live transcription hit a problem. Your audio up to this point is preserved — you can stop and review what was captured, or try again.";
|
||||
errorDetail = status.message || "Live transcription failed";
|
||||
transcriptionFailed = true;
|
||||
page.status = "Error";
|
||||
page.statusColor = "#e87171";
|
||||
@@ -231,7 +236,9 @@
|
||||
settings.language = "en";
|
||||
}
|
||||
} catch (err) {
|
||||
error = typeof err === "string" ? err : err.message || "Failed to check model";
|
||||
// Sub-task D: plain-language error with technical detail behind <details>
|
||||
error = "Lumotia couldn't check the transcription model. Try restarting the app.";
|
||||
errorDetail = typeof err === "string" ? err : err?.message || "Failed to check model";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -280,7 +287,9 @@
|
||||
page.status = "Ready";
|
||||
page.statusColor = "#7ec89a";
|
||||
} catch (err) {
|
||||
error = typeof err === "string" ? err : err.message || "Failed to load model";
|
||||
// Sub-task D: plain-language error with technical detail behind <details>
|
||||
error = "The transcription model couldn't load. Check Settings → Model and try again, or restart Lumotia.";
|
||||
errorDetail = typeof err === "string" ? err : err?.message || "Failed to load model";
|
||||
modelLoading = false;
|
||||
page.status = "Error";
|
||||
page.statusColor = "#e87171";
|
||||
@@ -302,9 +311,11 @@
|
||||
|
||||
async function startRecording() {
|
||||
error = "";
|
||||
errorDetail = "";
|
||||
liveWarning = "";
|
||||
saved = false;
|
||||
transcriptionFailed = false;
|
||||
showPostCaptureCard = false; // Sub-task C: hide post-capture card when new recording begins
|
||||
if (!tauriRuntimeAvailable) {
|
||||
error = browserPreviewMessage;
|
||||
page.status = "Desktop app required";
|
||||
@@ -371,6 +382,10 @@
|
||||
page.statusColor = "#e87171";
|
||||
timerInterval = setInterval(updateTimer, 1000);
|
||||
|
||||
// KI-02 / KI-03: inhibit OS idle/sleep for the duration of recording.
|
||||
// Best-effort — a failure here must never block the recording path.
|
||||
invoke("acquire_idle_inhibit").catch(() => {});
|
||||
|
||||
// Start cue (brief item #20). Off by default; volume user-set.
|
||||
playStartCue(settings.soundCueVolume, settings.soundCues);
|
||||
|
||||
@@ -387,11 +402,13 @@
|
||||
} catch { /* best effort */ }
|
||||
}
|
||||
} catch (err) {
|
||||
error = typeof err === "string" ? err : err?.message || "Microphone error";
|
||||
// Sub-task D: plain-language error with technical detail behind <details>
|
||||
errorDetail = typeof err === "string" ? err : err?.message || "Microphone error";
|
||||
error = "Couldn't start the recording. Make sure your microphone is plugged in and Lumotia has permission, then try again.";
|
||||
// Surface the failure as a sticky error toast so it does not get
|
||||
// swallowed if the inline `error` panel is not visible.
|
||||
// (Day 3 of the upgrade plan)
|
||||
toasts.error("Could not start recording", error);
|
||||
toasts.error("Could not start recording", errorDetail);
|
||||
page.status = "Error";
|
||||
page.statusColor = "#e87171";
|
||||
cleanup();
|
||||
@@ -405,6 +422,10 @@
|
||||
page.status = "Finalising...";
|
||||
page.statusColor = "#e8c86e";
|
||||
|
||||
// KI-02 / KI-03: release the OS idle/sleep inhibit acquired on start.
|
||||
// Best-effort — a failure here must never block the stop path.
|
||||
invoke("release_idle_inhibit").catch(() => {});
|
||||
|
||||
// Stop cue (brief item #20). "Recording over, finalising now."
|
||||
playStopCue(settings.soundCueVolume, settings.soundCues);
|
||||
|
||||
@@ -424,7 +445,9 @@
|
||||
await finaliseTranscription(response?.audioPath || null);
|
||||
}
|
||||
} catch (err) {
|
||||
error = typeof err === "string" ? err : err?.message || "Failed to stop live transcription";
|
||||
// Sub-task D: plain-language error with technical detail behind <details>
|
||||
errorDetail = typeof err === "string" ? err : err?.message || "Failed to stop live transcription";
|
||||
error = "Something went wrong while stopping the recording. Any audio captured before this point is preserved in History.";
|
||||
page.status = "Error";
|
||||
page.statusColor = "#e87171";
|
||||
cleanup();
|
||||
@@ -530,7 +553,11 @@
|
||||
if (settings.transcriptionPreview && settings.aiTier !== "off" && settings.formatMode !== "Raw") {
|
||||
emit("preview-cleanup").catch(() => {});
|
||||
}
|
||||
const rawSnapshot = transcript; // preserve raw for PostCaptureCard
|
||||
const cleanedTranscript = await cleanupTranscriptIfEnabled(transcript);
|
||||
// Track whether LLM was used for cleanup (for PostCaptureCard cleanedSource prop).
|
||||
// TODO v0.2: expose this from cleanupTranscriptIfEnabled return value.
|
||||
const wasLlmCleaned = settings.aiTier !== "off" && settings.formatMode !== "Raw" && cleanedTranscript !== rawSnapshot;
|
||||
if (cleanedTranscript !== transcript) {
|
||||
transcript = cleanedTranscript;
|
||||
replaceSegmentsWithCleanedText(cleanedTranscript);
|
||||
@@ -598,6 +625,30 @@
|
||||
// aligned with the history entry + paste landing.
|
||||
playCompleteCue(settings.soundCueVolume, settings.soundCues);
|
||||
|
||||
// Sub-task C: populate and show PostCaptureCard.
|
||||
lastCapture = {
|
||||
id: historyId,
|
||||
raw: rawSnapshot, // pre-cleanup text captured before cleanupTranscriptIfEnabled
|
||||
cleaned: transcript, // transcript is now the cleaned version (or raw if cleanup skipped)
|
||||
cleanedSource: wasLlmCleaned ? 'llm' : 'rule-based',
|
||||
tasks: extracted.map((t) => t.text),
|
||||
};
|
||||
showPostCaptureCard = true;
|
||||
|
||||
// Sub-task F: fire first_capture event (best-effort, gated on user opt-in).
|
||||
if (prefs.recordActivationEvents) {
|
||||
try {
|
||||
const events = await invoke<Array<{ kind: string }>>("list_lumotia_events");
|
||||
const isFirst = !events.some((e) => e.kind === "first_capture");
|
||||
if (isFirst) {
|
||||
await invoke("record_lumotia_event", { kind: "first_capture", payload: null });
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn("Could not record first_capture event:", err);
|
||||
// best-effort; never blocks the user
|
||||
}
|
||||
}
|
||||
|
||||
saved = true;
|
||||
setTimeout(() => { saved = false; extractedCount = 0; }, 4000);
|
||||
} else if (settings.transcriptionPreview) {
|
||||
@@ -631,6 +682,7 @@
|
||||
shouldStickToBottom = false;
|
||||
page.timerText = "00:00";
|
||||
error = "";
|
||||
errorDetail = "";
|
||||
liveWarning = "";
|
||||
saved = false;
|
||||
insertPos = -1;
|
||||
@@ -659,7 +711,9 @@
|
||||
return;
|
||||
} catch (err) {
|
||||
console.error("dictation export failed", err);
|
||||
error = `Export failed: ${typeof err === "string" ? err : err.message || err}`;
|
||||
// Sub-task D: plain-language error with technical detail behind <details>
|
||||
errorDetail = typeof err === "string" ? err : err?.message || String(err);
|
||||
error = `The ${format.toUpperCase()} export didn't complete. Check that you have write access to the selected folder and try again.`;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -816,6 +870,18 @@
|
||||
|
||||
let transcriptionFailed = $state(false);
|
||||
|
||||
// Post-capture card state
|
||||
let showPostCaptureCard = $state(false);
|
||||
// lastCapture holds the most recent finished recording data for PostCaptureCard.
|
||||
// Shape matches TranscriptEntry fields (id, text, preview) plus extracted tasks.
|
||||
let lastCapture = $state<{
|
||||
id: string;
|
||||
raw: string;
|
||||
cleaned: string;
|
||||
cleanedSource: 'llm' | 'rule-based';
|
||||
tasks: string[];
|
||||
} | null>(null);
|
||||
|
||||
// Screen-reader announcer for recording state transitions.
|
||||
// Announces both start and stop, then clears so the live region does not
|
||||
// hold stale text. prevRecording is a plain let (not $state) because it is
|
||||
@@ -846,9 +912,10 @@
|
||||
{:else}
|
||||
<!-- Control strip -->
|
||||
<div class="flex items-center gap-3 px-5 h-[56px] border-b border-border-subtle flex-shrink-0">
|
||||
<!-- Record button -->
|
||||
<!-- Record button — Sub-task B: enlarged to 80px (≥ 80px, primary CTA, impossible to miss) -->
|
||||
<button
|
||||
class="relative flex items-center justify-center w-[48px] h-[48px] min-w-[48px] flex-shrink-0 rounded-full text-white
|
||||
class="relative flex items-center justify-center w-[80px] h-[80px] min-w-[80px] flex-shrink-0 rounded-full btn-filled-text
|
||||
focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2
|
||||
{page.recording
|
||||
? 'bg-danger animate-pulse-warm'
|
||||
: modelLoading
|
||||
@@ -861,11 +928,11 @@
|
||||
aria-label={page.recording ? "Stop recording" : "Start recording"}
|
||||
>
|
||||
{#if page.recording}
|
||||
<span class="w-[16px] h-[16px] rounded-[3px] bg-white"></span>
|
||||
<span class="w-[24px] h-[24px] rounded-[4px] bg-white"></span>
|
||||
{:else if modelLoading}
|
||||
<Loader2 size={18} class="animate-spin" aria-hidden="true" />
|
||||
<Loader2 size={28} class="animate-spin" aria-hidden="true" />
|
||||
{:else}
|
||||
<span class="w-[16px] h-[16px] rounded-full bg-white/90"></span>
|
||||
<span class="w-[24px] h-[24px] rounded-full bg-white/90"></span>
|
||||
{/if}
|
||||
</button>
|
||||
<span class="text-[12px] font-medium flex-shrink-0 {page.recording ? 'text-danger' : 'text-text-secondary'}">
|
||||
@@ -912,17 +979,24 @@
|
||||
{page.timerText}
|
||||
</span>
|
||||
|
||||
<!-- Status indicator -->
|
||||
<span class="text-[12px] text-text-secondary flex-shrink-0 min-w-[60px] text-right">
|
||||
<!-- Status indicator — Sub-task A: <StatusPill> replaces hand-rolled pill -->
|
||||
<span class="flex-shrink-0">
|
||||
{#if page.recording}
|
||||
<span class="inline-flex items-center gap-1.5">
|
||||
<span class="w-[6px] h-[6px] rounded-full bg-danger animate-pulse-soft"></span>
|
||||
<span class="font-medium text-danger tracking-wide">REC</span>
|
||||
</span>
|
||||
<StatusPill status="recording" />
|
||||
{:else if modelLoading}
|
||||
<span class="text-warning">Loading</span>
|
||||
<StatusPill status="transcribing" label="Loading model…" />
|
||||
{:else if transcribing}
|
||||
<StatusPill status="transcribing" />
|
||||
{:else if saved}
|
||||
<StatusPill status="saved" />
|
||||
{:else if error}
|
||||
{#if transcriptionFailed}
|
||||
<StatusPill status="failed-safely" />
|
||||
{:else}
|
||||
<StatusPill status="needs-review" />
|
||||
{/if}
|
||||
{:else}
|
||||
<span class="text-success">Ready</span>
|
||||
<StatusPill status="ready" />
|
||||
{/if}
|
||||
</span>
|
||||
|
||||
@@ -941,13 +1015,41 @@
|
||||
<span class="text-[12px] {page.taskSidebarOpen ? 'text-accent' : 'text-text-tertiary'}">Tasks</span>
|
||||
</span>
|
||||
{#if taskCount > 0}
|
||||
<span class="absolute -top-0.5 -right-0.5 text-[12px] px-1 py-0 rounded-full bg-accent text-white font-medium min-w-[14px] text-center leading-[14px]">
|
||||
<span class="absolute -top-0.5 -right-0.5 text-[12px] px-1 py-0 rounded-full bg-accent btn-filled-text font-medium min-w-[14px] text-center leading-[14px]">
|
||||
{taskCount}
|
||||
</span>
|
||||
{/if}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Sub-task B: Profile + model summary line — answers "What is recording?" -->
|
||||
{#if !page.recording}
|
||||
<div class="px-5 py-1 border-b border-border-subtle flex-shrink-0 flex items-center justify-between">
|
||||
<p class="profile-summary m-0 text-[11px] text-text-tertiary leading-none">
|
||||
<small>Profile: {profilesStore.active?.name ?? page.activeProfile ?? '—'} · Model: {selectedModelId()}</small>
|
||||
</p>
|
||||
<!-- Sub-task B: Last-capture preview — answers "Where did my last capture go?" -->
|
||||
{#if history.length > 0}
|
||||
<details class="text-[11px] text-text-tertiary max-w-[50%]">
|
||||
<summary class="cursor-pointer select-none hover:text-text-secondary list-none flex items-center gap-1">
|
||||
<span class="text-accent">↩</span>
|
||||
<span>Last capture</span>
|
||||
</summary>
|
||||
<div class="absolute right-5 mt-1 z-10 bg-bg-card border border-border rounded-lg shadow-lg p-3 max-w-[360px] animate-fade-in">
|
||||
<p class="text-[11px] text-text-secondary m-0 mb-1">{history[0]?.date ?? ''}</p>
|
||||
<p class="text-[12px] text-text m-0 line-clamp-2">
|
||||
{(history[0]?.text ?? '').slice(0, 80)}{(history[0]?.text ?? '').length > 80 ? '…' : ''}
|
||||
</p>
|
||||
<button
|
||||
class="mt-2 text-[11px] text-accent hover:underline"
|
||||
onclick={() => page.current = 'history'}
|
||||
>Open in History →</button>
|
||||
</div>
|
||||
</details>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Toolbar -->
|
||||
<div class="flex items-center justify-end gap-1 px-5 py-2 border-b border-border-subtle flex-shrink-0">
|
||||
<!-- Template selector -->
|
||||
@@ -1024,11 +1126,30 @@
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Error -->
|
||||
<!-- Error — Sub-task D: structured copy with technical detail behind <details> -->
|
||||
{#if error}
|
||||
<div class="px-5 pt-2 animate-fade-in flex-shrink-0">
|
||||
<div class="px-4 py-2 rounded-lg bg-danger/10 border border-danger/20 text-[12px] text-danger">
|
||||
{error}
|
||||
<div class="px-4 py-3 rounded-lg bg-danger/10 border border-danger/20 text-[12px] text-danger space-y-2">
|
||||
<div class="flex items-start gap-2">
|
||||
{#if transcriptionFailed}
|
||||
<StatusPill status="failed-safely" />
|
||||
{:else}
|
||||
<StatusPill status="needs-review" />
|
||||
{/if}
|
||||
<p class="m-0">{error}</p>
|
||||
</div>
|
||||
{#if errorDetail}
|
||||
<details class="text-[11px] text-danger/70">
|
||||
<summary class="cursor-pointer select-none hover:text-danger">Technical details</summary>
|
||||
<pre class="mt-1 whitespace-pre-wrap break-words">{errorDetail}</pre>
|
||||
</details>
|
||||
{/if}
|
||||
<div>
|
||||
<button
|
||||
class="text-[11px] underline hover:no-underline text-danger/80 hover:text-danger"
|
||||
onclick={() => { error = ""; errorDetail = ""; }}
|
||||
>Dismiss</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -1041,6 +1162,25 @@
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Sub-task C: Post-capture card — shown after recording completes, hidden when new recording starts -->
|
||||
{#if showPostCaptureCard && lastCapture && !page.recording}
|
||||
<div class="px-5 pt-3 flex-shrink-0 animate-fade-in">
|
||||
<PostCaptureCard
|
||||
transcriptId={lastCapture.id}
|
||||
rawTranscript={lastCapture.raw}
|
||||
cleanedTranscript={lastCapture.cleaned}
|
||||
cleanedSource={lastCapture.cleanedSource ?? 'rule-based'}
|
||||
extractedTasks={lastCapture.tasks}
|
||||
onSelectTask={(idx) => {
|
||||
page.taskSidebarOpen = true;
|
||||
}}
|
||||
onExport={() => handleExport('txt')}
|
||||
onStartFirstMicroStep={() => {}}
|
||||
onOpenInHistory={() => { page.current = 'history'; }}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Transcript area -->
|
||||
<div class="flex-1 px-5 pt-3 pb-3 min-h-0" style="--text-transcript: {prefs.accessibility.transcriptSize}px; font-size: var(--text-transcript)">
|
||||
<Card classes="h-full flex flex-col">
|
||||
@@ -1055,7 +1195,8 @@
|
||||
<textarea
|
||||
bind:this={textareaEl}
|
||||
class="font-transcript flex-1 w-full bg-transparent text-text p-6
|
||||
resize-none focus:outline-none placeholder:text-text-tertiary min-h-0 hidden"
|
||||
resize-none placeholder:text-text-tertiary min-h-0 hidden
|
||||
focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-1"
|
||||
placeholder={activeTemplate ? "Click a section above, then press record..." : "Your words will appear here..."}
|
||||
bind:value={transcript}
|
||||
onclick={() => { showExportMenu = false; showTemplateMenu = false; }}
|
||||
@@ -1068,7 +1209,8 @@
|
||||
<textarea
|
||||
bind:this={textareaEl}
|
||||
class="font-transcript h-full w-full bg-transparent text-text p-6
|
||||
resize-none focus:outline-none placeholder:text-text-tertiary"
|
||||
resize-none placeholder:text-text-tertiary
|
||||
focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-1"
|
||||
placeholder={activeTemplate ? "Click a section above, then press record..." : "Your words will appear here..."}
|
||||
bind:value={transcript}
|
||||
onscroll={onTextareaScroll}
|
||||
@@ -1079,7 +1221,7 @@
|
||||
></textarea>
|
||||
{#if showScrollHint}
|
||||
<button
|
||||
class="absolute bottom-3 right-6 px-3 py-1.5 rounded-full bg-accent text-white text-[12px] font-medium shadow-md hover:bg-accent-hover animate-fade-in"
|
||||
class="absolute bottom-3 right-6 px-3 py-1.5 rounded-full bg-accent btn-filled-text text-[12px] font-medium shadow-md hover:bg-accent-hover animate-fade-in"
|
||||
onclick={scrollToBottom}
|
||||
aria-label="Scroll to latest"
|
||||
style="transition-duration: var(--duration-ui)"
|
||||
|
||||
@@ -211,7 +211,7 @@
|
||||
<!-- Browse buttons + progress -->
|
||||
<div class="flex items-center gap-2 px-7 pb-3">
|
||||
<button
|
||||
class="btn-lg rounded-lg font-medium text-white bg-accent hover:bg-accent-hover
|
||||
class="btn-lg rounded-lg font-medium btn-filled-text bg-accent hover:bg-accent-hover
|
||||
shadow-[var(--shadow-accent-raised)]"
|
||||
onclick={handleBrowse}
|
||||
disabled={transcribing}
|
||||
|
||||
@@ -5,8 +5,27 @@
|
||||
import { page, settings, saveSettings } from "$lib/stores/page.svelte.js";
|
||||
import UnicodeSpinner from "$lib/components/UnicodeSpinner.svelte";
|
||||
import { toasts } from "$lib/stores/toasts.svelte.js";
|
||||
import { Download, CheckCircle, Sunrise, Moon, Play } from 'lucide-svelte';
|
||||
import { Download, CheckCircle, Sunrise, Moon, Play, Mic } from 'lucide-svelte';
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Onboarding event helpers (best-effort — failures are logged, never blocking)
|
||||
// ---------------------------------------------------------------------------
|
||||
async function recordEvent(event: string, skipped = false, notes: string | null = null) {
|
||||
try {
|
||||
await invoke("record_onboarding_event", {
|
||||
event,
|
||||
version: "0.1.0",
|
||||
skipped,
|
||||
notes,
|
||||
});
|
||||
} catch (err) {
|
||||
console.warn("[onboarding] Could not record event:", event, err);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Core download state
|
||||
// ---------------------------------------------------------------------------
|
||||
let systemInfo = $state(null);
|
||||
let models = $state([]);
|
||||
let probing = $state(true);
|
||||
@@ -26,13 +45,38 @@
|
||||
return remaining / 60;
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Test-recording step state
|
||||
// ---------------------------------------------------------------------------
|
||||
// We use the documented fallback: a button that defers the real test to the
|
||||
// main UI rather than re-implementing the full DictationPage recording stack
|
||||
// here. The inline recording stack is ~150 lines of DictationPage machinery
|
||||
// (audio capture, chunked transcription, LLM cleanup) — too risky to
|
||||
// duplicate. Fallback is documented per task spec.
|
||||
type TestStep = "idle" | "prompt" | "done_skip";
|
||||
let testStep = $state<TestStep>("idle");
|
||||
|
||||
async function deferTestToMainUi() {
|
||||
await recordEvent("test_recording", true, "deferred_to_main_ui");
|
||||
testStep = "done_skip";
|
||||
setTimeout(() => {
|
||||
advanceToRituals();
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Probe + download
|
||||
// ---------------------------------------------------------------------------
|
||||
async function probe() {
|
||||
probing = true;
|
||||
error = "";
|
||||
try {
|
||||
systemInfo = await invoke("probe_system");
|
||||
models = await invoke("rank_models");
|
||||
await recordEvent("permissions_granted");
|
||||
probing = false;
|
||||
} catch (e) {
|
||||
error = `Hardware probe failed: ${e}`;
|
||||
error = `Hardware probe failed. This usually means a missing system library or a permission issue.\n\nDetail: ${e}`;
|
||||
probing = false;
|
||||
}
|
||||
}
|
||||
@@ -42,12 +86,12 @@
|
||||
downloadingModel = modelId;
|
||||
downloadProgress = 0;
|
||||
downloadStartedAt = Date.now();
|
||||
error = "";
|
||||
|
||||
// Tauri unlisten handles must be released on every exit path —
|
||||
// declared outside the try so the finally can always call them,
|
||||
// but assigned inside so a throw on the second listen() doesn't
|
||||
// leak the first one. SettingsPage.svelte:864-880 is the
|
||||
// long-form reference pattern (onMount + onDestroy).
|
||||
// leak the first one.
|
||||
let unlisten: (() => void) | undefined;
|
||||
let unlistenParakeet: (() => void) | undefined;
|
||||
|
||||
@@ -83,19 +127,16 @@
|
||||
settings.engine = "parakeet";
|
||||
}
|
||||
|
||||
await recordEvent("model_ready", false, modelId);
|
||||
|
||||
ready = true;
|
||||
// Brief "Ready" beat, then onto the rituals prompt (or straight
|
||||
// to dictation if the user has already seen it).
|
||||
// Brief "Ready" beat, then onto the test-recording step.
|
||||
setTimeout(() => {
|
||||
if (settings.ritualsPromptSeen) {
|
||||
page.current = "dictation";
|
||||
} else {
|
||||
ready = false;
|
||||
ritualsStep = "morning";
|
||||
}
|
||||
ready = false;
|
||||
testStep = "prompt";
|
||||
}, 1500);
|
||||
} catch (e) {
|
||||
error = `Download failed: ${e}`;
|
||||
error = `The download did not complete. Check your internet connection and try again.\n\nDetail: ${e}`;
|
||||
downloading = false;
|
||||
} finally {
|
||||
// Guard against listen() throwing before assigning the unlisten
|
||||
@@ -106,11 +147,21 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Phase 5: forced-choice rituals + autostart prompts. Research on
|
||||
// libertarian-paternalism nudges (Thaler/Sunstein) says defaults
|
||||
// drive uptake, but the ADHD target audience is sensitive to
|
||||
// parental framing — so we present explicit opt-in with calm copy
|
||||
// rather than defaulting anything on.
|
||||
// ---------------------------------------------------------------------------
|
||||
// After test-recording: advance to rituals or dictation
|
||||
// ---------------------------------------------------------------------------
|
||||
function advanceToRituals() {
|
||||
if (settings.ritualsPromptSeen) {
|
||||
page.current = "dictation";
|
||||
} else {
|
||||
testStep = "idle";
|
||||
ritualsStep = "morning";
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Phase 5: forced-choice rituals + autostart prompts.
|
||||
// ---------------------------------------------------------------------------
|
||||
type RitualsStep = "idle" | "morning" | "evening" | "autostart" | "done";
|
||||
let ritualsStep = $state<RitualsStep>("idle");
|
||||
let autostartApplying = $state(false);
|
||||
@@ -147,27 +198,35 @@
|
||||
settings.ritualsPromptSeen = true;
|
||||
saveSettings();
|
||||
ritualsStep = "done";
|
||||
await recordEvent("completed", false, settings.modelSize ?? null);
|
||||
setTimeout(() => { page.current = "dictation"; }, 900);
|
||||
}
|
||||
}
|
||||
|
||||
function skipRituals() {
|
||||
async function skipRituals() {
|
||||
settings.ritualsPromptSeen = true;
|
||||
saveSettings();
|
||||
await recordEvent("completed", false, settings.modelSize ?? null);
|
||||
page.current = "dictation";
|
||||
}
|
||||
|
||||
function skipSetup() {
|
||||
async function skipSetup() {
|
||||
// Skipping model download still marks the rituals prompt as seen —
|
||||
// the user chose to bypass the walk-through; they can find rituals
|
||||
// in Settings when they're ready.
|
||||
settings.ritualsPromptSeen = true;
|
||||
saveSettings();
|
||||
await recordEvent("skipped", true, "skipped_from_model_select");
|
||||
page.current = "dictation";
|
||||
}
|
||||
|
||||
// Start probing on mount
|
||||
probe();
|
||||
// ---------------------------------------------------------------------------
|
||||
// Mount: fire "started" event + kick off hardware probe
|
||||
// ---------------------------------------------------------------------------
|
||||
$effect(() => {
|
||||
recordEvent("started");
|
||||
probe();
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col items-center justify-center h-full px-8 py-12 max-w-xl mx-auto">
|
||||
@@ -182,7 +241,44 @@
|
||||
<div class="text-center">
|
||||
<CheckCircle size={40} strokeWidth={1.5} class="text-success mx-auto" />
|
||||
<h2 class="text-xl font-medium text-text mt-4">Ready to go</h2>
|
||||
<p class="text-sm text-text-secondary mt-2">A few quick choices, then you're in.</p>
|
||||
<p class="text-sm text-text-secondary mt-2">Let's make sure everything works.</p>
|
||||
</div>
|
||||
|
||||
{:else if testStep === "prompt"}
|
||||
<!-- Sub-task 4: pre-supplied test-recording prompt (fallback path) -->
|
||||
<div class="w-full max-w-md mx-auto text-center">
|
||||
<Mic size={32} strokeWidth={1.5} class="text-accent mx-auto mb-3" />
|
||||
<h2 class="text-xl font-medium text-text">Try a test recording</h2>
|
||||
<p class="text-sm text-text-secondary mt-3 leading-relaxed">
|
||||
Read this sentence aloud so we can confirm your microphone and the transcription are working.
|
||||
</p>
|
||||
<blockquote class="mt-4 px-4 py-3 rounded-lg bg-bg-input border-l-4 border-accent text-left">
|
||||
<p class="text-sm text-text italic leading-relaxed">
|
||||
"Today is a good day to test my microphone and see how the transcription looks."
|
||||
</p>
|
||||
</blockquote>
|
||||
<p class="text-xs text-text-tertiary mt-3 leading-relaxed">
|
||||
The main dictation screen is just a button press away. Try your first real recording there — it's the same experience you'll use every day.
|
||||
</p>
|
||||
<div class="flex items-center justify-center gap-3 mt-6">
|
||||
<button
|
||||
class="px-4 py-2 rounded-lg text-sm bg-accent btn-filled-text hover:bg-accent-hover"
|
||||
style="transition-duration: var(--duration-ui)"
|
||||
onclick={deferTestToMainUi}
|
||||
>Open the main app and try recording there</button>
|
||||
</div>
|
||||
<button
|
||||
class="mt-5 text-xs text-text-tertiary hover:text-text-secondary underline"
|
||||
style="transition-duration: var(--duration-ui)"
|
||||
onclick={skipRituals}
|
||||
>Skip and go straight to the app</button>
|
||||
</div>
|
||||
|
||||
{:else if testStep === "done_skip"}
|
||||
<div class="text-center">
|
||||
<CheckCircle size={40} strokeWidth={1.5} class="text-success mx-auto" />
|
||||
<h2 class="text-xl font-medium text-text mt-4">Almost there</h2>
|
||||
<p class="text-sm text-text-secondary mt-2">Taking you to the app now.</p>
|
||||
</div>
|
||||
|
||||
{:else if ritualsStep === "morning"}
|
||||
@@ -199,7 +295,7 @@
|
||||
onclick={() => answerMorning(false)}
|
||||
>No thanks</button>
|
||||
<button
|
||||
class="px-4 py-2 rounded-lg text-sm bg-accent text-white hover:bg-accent-hover"
|
||||
class="px-4 py-2 rounded-lg text-sm bg-accent btn-filled-text hover:bg-accent-hover"
|
||||
onclick={() => answerMorning(true)}
|
||||
>Yes, turn it on</button>
|
||||
</div>
|
||||
@@ -223,7 +319,7 @@
|
||||
onclick={() => answerEvening(false)}
|
||||
>No thanks</button>
|
||||
<button
|
||||
class="px-4 py-2 rounded-lg text-sm bg-accent text-white hover:bg-accent-hover"
|
||||
class="px-4 py-2 rounded-lg text-sm bg-accent btn-filled-text hover:bg-accent-hover"
|
||||
onclick={() => answerEvening(true)}
|
||||
>Yes, turn it on</button>
|
||||
</div>
|
||||
@@ -280,12 +376,29 @@
|
||||
</div>
|
||||
|
||||
{:else}
|
||||
<!-- Model selection + error recovery -->
|
||||
<div class="w-full">
|
||||
<h2 class="text-2xl font-medium text-text text-center">Welcome to Lumotia</h2>
|
||||
<p class="text-sm text-text-secondary text-center mt-2">Press the button. Start talking. That's it.</p>
|
||||
|
||||
{#if error}
|
||||
<div class="mt-4 p-3 rounded-lg bg-danger/10 text-danger text-sm">{error}</div>
|
||||
<!-- Sub-task 5: failure recovery — plain-English error + Try again / Skip -->
|
||||
<div class="mt-4 p-3 rounded-lg bg-danger/10 border border-danger/20">
|
||||
<p class="text-sm text-danger font-medium mb-1">Something went wrong</p>
|
||||
<p class="text-xs text-danger/80 whitespace-pre-line leading-relaxed">{error}</p>
|
||||
<div class="flex gap-2 mt-3">
|
||||
<button
|
||||
class="px-3 py-1.5 rounded-md text-xs bg-danger btn-filled-text hover:bg-danger/80"
|
||||
style="transition-duration: var(--duration-ui)"
|
||||
onclick={() => { error = ""; probe(); }}
|
||||
>Try again</button>
|
||||
<button
|
||||
class="px-3 py-1.5 rounded-md text-xs border border-danger/40 text-danger hover:bg-danger/10"
|
||||
style="transition-duration: var(--duration-ui)"
|
||||
onclick={skipSetup}
|
||||
>Skip this step</button>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if systemInfo}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -158,7 +158,7 @@
|
||||
<div class="pt-2">
|
||||
<button
|
||||
type="button"
|
||||
class="px-4 py-2 rounded-lg bg-accent text-white text-[12px] font-medium hover:bg-accent-hover"
|
||||
class="px-4 py-2 rounded-lg bg-accent btn-filled-text text-[12px] font-medium hover:bg-accent-hover"
|
||||
onclick={close}
|
||||
>
|
||||
Close
|
||||
|
||||
@@ -261,6 +261,7 @@
|
||||
}
|
||||
|
||||
function handleDeleteList(id: string) {
|
||||
if (!confirm("Delete this task list? All tasks in it will be removed. This cannot be undone.")) return;
|
||||
if (activeListId === id) activeListId = "all";
|
||||
deleteTaskList(id);
|
||||
contextMenuListId = null;
|
||||
@@ -644,7 +645,7 @@
|
||||
aria-label="Delete task"
|
||||
class="mt-0.5 text-text-tertiary hover:text-danger opacity-0 group-hover:opacity-100 focus:opacity-100"
|
||||
style="transition: opacity var(--duration-ui)"
|
||||
onclick={() => deleteTask(task.id)}
|
||||
onclick={() => { if (confirm("Delete this task? This cannot be undone.")) deleteTask(task.id); }}
|
||||
>
|
||||
<X size={16} aria-hidden="true" />
|
||||
</button>
|
||||
@@ -686,7 +687,7 @@
|
||||
aria-label="Delete completed task"
|
||||
class="mt-0.5 text-text-tertiary hover:text-danger opacity-0 group-hover:opacity-100 focus:opacity-100"
|
||||
style="transition: opacity var(--duration-ui)"
|
||||
onclick={() => deleteTask(task.id)}
|
||||
onclick={() => { if (confirm("Delete this task? This cannot be undone.")) deleteTask(task.id); }}
|
||||
>
|
||||
<X size={16} aria-hidden="true" />
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user