Jacob Schmidt 0d77300c22 feat: Project Journal backend monorepo
Monorepo with centralized build props, npm workspaces, LlamaSharp AI,
SQLite/SQLCipher storage, Svelte frontend, and unified smoke tests.

Co-Authored-By: Oz <oz-agent@warp.dev>
2026-03-02 20:56:26 -06:00

34 lines
953 B
TypeScript

import { invoke } from "$lib/runtime/invoke";
import {
startRecording as startMicRecording,
stopRecording as stopMicRecording,
} from "tauri-plugin-mic-recorder-api";
type SpeechControlResult = {
running: boolean;
pid?: number;
launch?: string;
};
export async function startSpeechDictation(): Promise<SpeechControlResult> {
return invoke<SpeechControlResult>("speech_start");
}
export async function stopSpeechDictation(): Promise<SpeechControlResult> {
return invoke<SpeechControlResult>("speech_stop");
}
export async function probeMicrophoneAccess(): Promise<string> {
await startMicRecording();
await new Promise((resolve) => setTimeout(resolve, 300));
const outputPath = await stopMicRecording();
try {
await invoke<{ deleted: boolean }>("speech_cleanup_probe", {
path: outputPath,
});
} catch {
// Keep probe non-blocking; cleanup failure should not break dictation start.
}
return outputPath;
}